org.objectweb.dsrg.sofa.microarchitecture
Class CollectionChain

java.lang.Object
  extended by org.objectweb.dsrg.sofa.microarchitecture.DelegationChain
      extended by org.objectweb.dsrg.sofa.microarchitecture.CollectionChain

public class CollectionChain
extends DelegationChain

Extends DelegationChain with functionality to create instances of the iterface by demand. CollectionChain stores inforamtion necessary to make such instance and to bind its microcomponents to other microcomponents as well.

MicroComponentProxy objects are used to store information about delegating microcomponents in the chain.


Constructor Summary
CollectionChain(SOFAInterfaceType type, java.lang.String name, java.lang.Class cl)
          Same constructor as in DelegationChain.
 
Method Summary
 SOFAMicroComponent add(MicroComponentInstance instance, java.util.HashMap<java.lang.String,java.lang.String> parameters)
          Adds microcomponent instance to the end of the delegation chain.
 java.lang.Object getEntrypoint()
          Returns reference to the provided delegated interface of the first microcomponent (or endpoint object if no microcomponent is contained) in the delegation chain.
 SOFAMicroComponent insert(MicroComponentInstance instance, java.util.HashMap<java.lang.String,java.lang.String> parameters)
          Inserts microcomponent instance to the beginning of the delegation chain.
 DelegationChain newInstance(java.lang.Object endpoint)
          Creates new instance from this CollectionChain.
 void setEndpoint(java.lang.Object ref)
          Sets the endpoint.
 
Methods inherited from class org.objectweb.dsrg.sofa.microarchitecture.DelegationChain
getInterfaceClass, getInterfaceName, getInterfaceType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionChain

public CollectionChain(SOFAInterfaceType type,
                       java.lang.String name,
                       java.lang.Class cl)
                throws DelegationChainException
Same constructor as in DelegationChain.

Parameters:
type - Type of the collection chain. Must be BUSINESS_REQUIRED.
name - Name of the interface represented.
cl - Class of the interface delegated.
Throws:
DelegationChainException
Method Detail

add

public SOFAMicroComponent add(MicroComponentInstance instance,
                              java.util.HashMap<java.lang.String,java.lang.String> parameters)
                       throws DelegationChainException
Description copied from class: DelegationChain
Adds microcomponent instance to the end of the delegation chain.

Overrides:
add in class DelegationChain
Throws:
DelegationChainException

insert

public SOFAMicroComponent insert(MicroComponentInstance instance,
                                 java.util.HashMap<java.lang.String,java.lang.String> parameters)
                          throws DelegationChainException
Description copied from class: DelegationChain
Inserts microcomponent instance to the beginning of the delegation chain.

Overrides:
insert in class DelegationChain
Throws:
DelegationChainException

setEndpoint

public void setEndpoint(java.lang.Object ref)
                 throws DelegationChainException
Description copied from class: DelegationChain
Sets the endpoint. Endpoint is the object called by the last microcomponent in the delegation chain.

Overrides:
setEndpoint in class DelegationChain
Parameters:
ref - Reference to the endpoint object.
Throws:
DelegationChainException

getEntrypoint

public java.lang.Object getEntrypoint()
                               throws DelegationChainException
Description copied from class: DelegationChain
Returns reference to the provided delegated interface of the first microcomponent (or endpoint object if no microcomponent is contained) in the delegation chain.

Overrides:
getEntrypoint in class DelegationChain
Returns:
Reference to delegated interface of the chain.
Throws:
DelegationChainException

newInstance

public DelegationChain newInstance(java.lang.Object endpoint)
                            throws DelegationChainException,
                                   InstantiationException
Creates new instance from this CollectionChain. Delegating microcomponents are instantiated from MicroComponentProxy objects stored in CollectionChain.

Parameters:
endpoint - Object to be set as endpoint for the new DelegationChain.
Returns:
New DelegationChain.
Throws:
DelegationChainException
InstantiationException