anima.component.javalocal
Class JavaLocalComponentFactory

java.lang.Object
  extended by anima.component.javalocal.JavaLocalComponentFactory
All Implemented Interfaces:
IComponentFactory

public class JavaLocalComponentFactory
extends java.lang.Object
implements IComponentFactory

This an Factory of Local components. This class create an local component based on IComponenteFactory, more information about it's interface

See Also:
Implements the interface IComponentFactory


This UML diagram represent class JavaLocalComponentFactory

Constructor Summary
JavaLocalComponentFactory()
           
 
Method Summary
 void assignMessageFactory(IMessageFactory messageFactory)
          Assign an message factory that will be used to component.
 IUnknown createInstance(java.lang.String classId, java.lang.String primaryKey)
           public IUnknown createInstance(String classId, String primaryKey) { IUnknown component = null; if (classId.equalsIgnoreCase(StatisticsComponent.STATISTICSCOMPONENT_ID)) component = new StatisticsComponent(primaryKey); else if (classId.equalsIgnoreCase(StatisticsConsumerComponent.STATISTICSCONSUMERCOMPONENT_ID)) component = new StatisticsConsumerComponent(primaryKey); else if (classId.equalsIgnoreCase(StatisticsComponentSyncMessage.STATISTICSCOMPONENTMESSAGE_ID)) component = new StatisticsComponentSyncMessage(primaryKey); else if (classId.equalsIgnoreCase(StatisticsConsumerComponentSyncMessage.STATISTICSCONSUMERCOMPONENTMESSAGE_ID)) component = new StatisticsConsumerComponentSyncMessage(primaryKey); else if (classId.equalsIgnoreCase(StatisticsComponentAssyncMessage.STATISTICSCOMPONENTMESSAGE_ID)) component = new StatisticsComponentAssyncMessage(primaryKey); else if (classId.equalsIgnoreCase(StatisticsConsumerComponentAssyncMessage.STATISTICSCONSUMERCOMPONENTMESSAGE_ID)) component = new StatisticsConsumerComponentAssyncMessage(primaryKey); if (messageFactory !
 IUnknown createInstance(java.lang.String classId, java.lang.String primaryKey, java.lang.String interfaceId)
          Create an instance and return it's interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaLocalComponentFactory

public JavaLocalComponentFactory()
Method Detail

createInstance

public IUnknown createInstance(java.lang.String classId,
                               java.lang.String primaryKey)
 public IUnknown createInstance(String classId, String primaryKey) {
        IUnknown component = null;

        if (classId.equalsIgnoreCase(StatisticsComponent.STATISTICSCOMPONENT_ID))
            component = new StatisticsComponent(primaryKey);
        else if (classId.equalsIgnoreCase(StatisticsConsumerComponent.STATISTICSCONSUMERCOMPONENT_ID))
            component = new StatisticsConsumerComponent(primaryKey);
        else if (classId.equalsIgnoreCase(StatisticsComponentSyncMessage.STATISTICSCOMPONENTMESSAGE_ID))
            component = new StatisticsComponentSyncMessage(primaryKey);
        else if (classId.equalsIgnoreCase(StatisticsConsumerComponentSyncMessage.STATISTICSCONSUMERCOMPONENTMESSAGE_ID))
            component = new StatisticsConsumerComponentSyncMessage(primaryKey);
        else if (classId.equalsIgnoreCase(StatisticsComponentAssyncMessage.STATISTICSCOMPONENTMESSAGE_ID))
            component = new StatisticsComponentAssyncMessage(primaryKey);
        else if (classId.equalsIgnoreCase(StatisticsConsumerComponentAssyncMessage.STATISTICSCONSUMERCOMPONENTMESSAGE_ID))
            component = new StatisticsConsumerComponentAssyncMessage(primaryKey);

        if (messageFactory != null && component instanceof IComponentMessageDriven)
            ((IComponentMessageDriven)component).assignMessageFactory(messageFactory);

        return component;
    }
 
This is an parameterized Factory Method get two parameters and return an instance.
There are three instances supported even the moment:
StatisticsComponent StatisticsConsumerComponent
StatisticsComponentMessage StatisticsConsumerComponentMessage

Specified by:
createInstance in interface IComponentFactory
Parameters:
classId - This attribute refers to the ID of the class.
primaryKey - This attribute refers to the Primary Key that identifies the component.
Returns:
Component
Does the confrontation between the parameter classId with the parameter Id of the StatisticsComponent

createInstance

public IUnknown createInstance(java.lang.String classId,
                               java.lang.String primaryKey,
                               java.lang.String interfaceId)
Create an instance and return it's interface.
public IUnknown createInstance(String classId, String primaryKey,
                                   String interfaceId) {
        IUnknown componentInterface = null;

                IUnknown component = createInstance(classId, primaryKey);
                if (component != null)
                        componentInterface = component.queryInterface(interfaceId);

                return componentInterface;
        }
 

Specified by:
createInstance in interface IComponentFactory
Parameters:
classId - This attribute refers to the ID of the class.
primaryKey - This attribute refers to the Primary Key that identifies the component.
interfaceId - This attribute refers to the ID if the interface.
Returns:
ComponentInterface

assignMessageFactory

public void assignMessageFactory(IMessageFactory messageFactory)
Assign an message factory that will be used to component.
public void assignMessageFactory(IMessageFactory messageFactory) {
                this.messageFactory = messageFactory;
        }
 

Specified by:
assignMessageFactory in interface IComponentFactory


Copyright © 2007. All Rights Reserved.