org.objectweb.kilim.model
Class ComponentFactory

java.lang.Object
  extended byorg.objectweb.kilim.model.services.DefaultNamingContext
      extended byorg.objectweb.kilim.model.ComponentFactory
All Implemented Interfaces:
Factory, NamingContext

public class ComponentFactory
extends DefaultNamingContext
implements Factory

Author:
horn

Nested Class Summary
private static class ComponentFactory.RTArray
           
private static class ComponentFactory.RTClassSource
           
private static class ComponentFactory.RTConstructor
           
private static class ComponentFactory.RTEventSource
           
private static class ComponentFactory.RTGetter
           
private static class ComponentFactory.RTMethod
           
private static class ComponentFactory.RTNullElement
           
private static class ComponentFactory.RTReference
           
private static class ComponentFactory.RTSetter
           
 
Field Summary
private  RtComponent containingComponent
           
private  ComponentFactory containingFactory
           
private  TemplateDescription containingTemplate
           
private  RtComponent currentComponent
           
private  TemplateDescription currentTemplate
           
private  java.lang.String localName
           
private  java.util.LinkedHashMap references
           
private  java.util.List subFactories
           
 
Fields inherited from class org.objectweb.kilim.model.services.DefaultNamingContext
 
Constructor Summary
private ComponentFactory(java.lang.String aName, TemplateDescription aTemplate, ComponentFactory aFactory, RtComponent aComponent)
           
 
Method Summary
private  void addReference(java.lang.String aName, ComponentFactory.RTReference aReference)
          Method addReference.
 void addSubFactory(ComponentFactory aElement)
          In the present implementation factories are used as naming contexts.
protected  boolean containsElement(java.util.List aList, java.lang.String aName)
           
 void finalizeInstanciation()
          Method finalizeInstanciation.
 Component fork(Component aComponent)
          returns a new component which is a copy of aComponent (in the state defined by the template).
 Component getComponent()
          returns the component built by the factory.
 ComponentFactory getContainingFactory()
          In the present implementation factories are used as naming contexts.
protected  java.lang.Object getElement(java.util.List aList, java.lang.String aName)
           
private  java.lang.String getFullTemplateSequence()
           
 java.lang.String getLocalName()
          returns the local name of the factory (which is similar to the component name !!!!)
private  ComponentFactory.RTReference getReference(java.lang.String aName)
          Method containsReference.
private  java.util.Iterator getReferences()
          Method getInstances.
 java.util.Iterator getSubFactories()
          Method getComponentFactorys.
 ComponentFactory getSubFactory(java.lang.String aName)
          In the present implementation factories are used as naming contexts.
 void initializeInstanciation()
          Method initializeInstanciation This method is executed once by the component factory before any other actions.
private  void initNewComponent()
           
private  void installBinding(Binding aBinding)
          Method installBinding.
 void installBindings()
          Method installBindings.
private  void installPlug(Plug aPlug)
           
 void installPlugs()
          Method installPlugs.
private  void installTrigger(Trigger aTrigger)
          Method installTrigger.
 void installTriggers()
          Method installTriggers.
private  Component newComponent(Instance instance)
          Method newComponent.
static Component newComponent(TemplateDescription template)
          A factory method for creating a new component.
static Component newComponent(TemplateDescription template, InstanciationStrategy aStrgy)
          A factory method for creating a new component.
private  ComponentElement newComponentElement1(BasicElement elem)
           
private  ComponentFactory.RTArray newInnerArraySource(ArraySource aArray)
           
private  ComponentFactory.RTClassSource newInnerClassSource(ClassSource aSource)
           
private  ComponentFactory.RTConstructor newInnerConstructor(TpConstructor aCtor)
           
private  ComponentFactory.RTEventSource newInnerEventSource(EventSource aSource)
           
private  ComponentFactory.RTGetter newInnerGetter(TpGetter aGetter)
           
private  ComponentFactory.RTMethod newInnerMethod(TpMethod aMethod)
           
private  ComponentFactory.RTReference newInnerReference(Reference aReference)
           
private  ComponentFactory.RTSetter newInnerSetter(TpSetter aSetter)
           
private  RtComponentInterface newInterface(Port port)
           
private  RtComponentProperty newProperty(Property aProperty)
           
protected  java.lang.Object removeElement(java.util.List aList, java.lang.String aName)
           
private  void removeReference(java.lang.String aName)
          Method removeSubContext.
 void removeSubFactory(ComponentFactory aElement)
          In the present implementation factories are used as naming contexts.
private  void resolveReferences()
          Method resolveReference.
 
Methods inherited from class org.objectweb.kilim.model.services.DefaultNamingContext
addBoundName, addChildNamingContext, getBoundNames, getChildNamingContexts, getExternalReferenceMap, getParentNamingContext, getQualifiedName, removeBoundName, removeChildNamingContext, resolveReference, setExternalReferences, setParentNamingContext, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

localName

private java.lang.String localName

containingFactory

private ComponentFactory containingFactory

subFactories

private java.util.List subFactories

currentTemplate

private TemplateDescription currentTemplate

containingTemplate

private TemplateDescription containingTemplate

currentComponent

private RtComponent currentComponent

containingComponent

private RtComponent containingComponent

references

private java.util.LinkedHashMap references
Constructor Detail

ComponentFactory

private ComponentFactory(java.lang.String aName,
                         TemplateDescription aTemplate,
                         ComponentFactory aFactory,
                         RtComponent aComponent)
                  throws KilimException
Method Detail

newComponent

public static Component newComponent(TemplateDescription template)
                              throws KilimException
A factory method for creating a new component.

Parameters:
template - : the template to be used
Returns:
Component
Throws:
KilimException - : generated if template is null.

newComponent

public static Component newComponent(TemplateDescription template,
                                     InstanciationStrategy aStrgy)
                              throws KilimException
A factory method for creating a new component.

Parameters:
template - : the template to be used.
aStrgy - : the implementation strategy to be used.
Returns:
Component
Throws:
KilimException - : generated if template is null.

getLocalName

public java.lang.String getLocalName()
returns the local name of the factory (which is similar to the component name !!!!)

Specified by:
getLocalName in interface NamingContext
Overrides:
getLocalName in class DefaultNamingContext
Returns:
String
See Also:
NamingContext.getLocalName()

getComponent

public Component getComponent()
returns the component built by the factory. This method returns a reference of the Component meta-object bound to the "this" interface.

Returns:
Component

getContainingFactory

public ComponentFactory getContainingFactory()
In the present implementation factories are used as naming contexts. As a consequence they are organized according to a tree-like structure. This method therefore returns the containing factory.

Returns:
ComponentFactory

addSubFactory

public void addSubFactory(ComponentFactory aElement)
                   throws KilimException
In the present implementation factories are used as naming contexts. As a consequence they are organized according to a tree-like structure. This method adds a SubFactory.

Parameters:
aElement - : the Child factory to be added.
Throws:
KilimException - :

removeSubFactory

public void removeSubFactory(ComponentFactory aElement)
                      throws KilimException
In the present implementation factories are used as naming contexts. As a consequence they are organized according to a tree-like structure. This method removes a Sub Factory.

Parameters:
aElement - :
Throws:
KilimException - :

getSubFactory

public ComponentFactory getSubFactory(java.lang.String aName)
In the present implementation factories are used as naming contexts. As a consequence they are organized according to a tree-like structure. This method returns a SubFactory.

Parameters:
aName - :
Returns:
ComponentFactoryElement

getSubFactories

public java.util.Iterator getSubFactories()
Method getComponentFactorys.

Returns:
Iterator

newComponent

private Component newComponent(Instance instance)
                        throws KilimException
Method newComponent.

Parameters:
instance - :
Returns:
Component :
Throws:
KilimException - :

initNewComponent

private void initNewComponent()
                       throws KilimException
Throws:
KilimException

newComponentElement1

private ComponentElement newComponentElement1(BasicElement elem)
                                       throws KilimException
Throws:
KilimException

newProperty

private RtComponentProperty newProperty(Property aProperty)
                                 throws KilimException
Throws:
KilimException

newInterface

private RtComponentInterface newInterface(Port port)
                                   throws KilimException
Throws:
KilimException

newInnerArraySource

private ComponentFactory.RTArray newInnerArraySource(ArraySource aArray)
                                              throws KilimException
Throws:
KilimException

newInnerClassSource

private ComponentFactory.RTClassSource newInnerClassSource(ClassSource aSource)
                                                    throws KilimException
Throws:
KilimException

newInnerGetter

private ComponentFactory.RTGetter newInnerGetter(TpGetter aGetter)
                                          throws KilimException
Throws:
KilimException

newInnerSetter

private ComponentFactory.RTSetter newInnerSetter(TpSetter aSetter)
                                          throws KilimException
Throws:
KilimException

newInnerMethod

private ComponentFactory.RTMethod newInnerMethod(TpMethod aMethod)
                                          throws KilimException
Throws:
KilimException

newInnerConstructor

private ComponentFactory.RTConstructor newInnerConstructor(TpConstructor aCtor)
                                                    throws KilimException
Throws:
KilimException

newInnerReference

private ComponentFactory.RTReference newInnerReference(Reference aReference)
                                                throws KilimException
Throws:
KilimException

newInnerEventSource

private ComponentFactory.RTEventSource newInnerEventSource(EventSource aSource)
                                                    throws KilimException
Throws:
KilimException

fork

public Component fork(Component aComponent)
               throws KilimException
returns a new component which is a copy of aComponent (in the state defined by the template). All operations performed at runtime is ignored.

Parameters:
aComponent - : the component to be forked
Returns:
Component
Throws:
KilimException - :

addReference

private void addReference(java.lang.String aName,
                          ComponentFactory.RTReference aReference)
                   throws KilimException
Method addReference.

Parameters:
aName - :
Throws:
KilimException - :

removeReference

private void removeReference(java.lang.String aName)
                      throws KilimException
Method removeSubContext.

Parameters:
aName - :
Throws:
KilimException - :

getReference

private ComponentFactory.RTReference getReference(java.lang.String aName)
                                           throws KilimException
Method containsReference.

Parameters:
aName - :
Returns:
boolean
Throws:
KilimException - :

resolveReferences

private void resolveReferences()
                        throws KilimException
Method resolveReference. This method recursively executes the resolution process in all factories.

Throws:
KilimException - :

getReferences

private java.util.Iterator getReferences()
Method getInstances.

Returns:
Iterator

installBinding

private void installBinding(Binding aBinding)
                     throws KilimException
Method installBinding.

Parameters:
aBinding - :
Throws:
KilimException - :

getFullTemplateSequence

private java.lang.String getFullTemplateSequence()

installBindings

public void installBindings()
                     throws KilimException
Method installBindings. This method recursively installs all bindings.

Throws:
KilimException - :

installPlug

private void installPlug(Plug aPlug)
                  throws KilimException
Throws:
KilimException

installPlugs

public void installPlugs()
                  throws KilimException
Method installPlugs. This method recursively installs all bindings.

Throws:
KilimException - :

installTrigger

private void installTrigger(Trigger aTrigger)
                     throws KilimException
Method installTrigger.

Parameters:
aTrigger -
Throws:
KilimException

installTriggers

public void installTriggers()
                     throws KilimException
Method installTriggers. This method recursively installs all triggers

Throws:
KilimException - :

finalizeInstanciation

public void finalizeInstanciation()
                           throws KilimException
Method finalizeInstanciation. This method is executed by the component factory after any other resolution/instanciation actions. This method recursively executes in each factory the finalizeInstanciation() method provided by the corresponding InstanciationMger.It is used among other things to associate an instanciation manager to each component.

Throws:
KilimException - :

initializeInstanciation

public void initializeInstanciation()
                             throws KilimException
Method initializeInstanciation This method is executed once by the component factory before any other actions. It can be used to settle resources required by the compoonent factories or any preliminary tasks.

Throws:
KilimException - :

containsElement

protected boolean containsElement(java.util.List aList,
                                  java.lang.String aName)
                           throws InternalException
Throws:
InternalException

removeElement

protected java.lang.Object removeElement(java.util.List aList,
                                         java.lang.String aName)
                                  throws InternalException
Throws:
InternalException

getElement

protected java.lang.Object getElement(java.util.List aList,
                                      java.lang.String aName)
                               throws InternalException
Throws:
InternalException