org.objectweb.jonathan.libs.kernel.decoders
Class JAssemblage

java.lang.Object
  extended byorg.objectweb.jonathan.libs.kernel.JComponent
      extended byorg.objectweb.jonathan.libs.kernel.decoders.LazyComponent
          extended byorg.objectweb.jonathan.libs.kernel.decoders.JAssemblage
All Implemented Interfaces:
Component, Forkable, Initializer, Instanciable, MultiFactory

public class JAssemblage
extends LazyComponent
implements Instanciable, MultiFactory, Initializer

Runtime assemblage component. Initialisation issues are dealt with by the LazyComponent implementation. Provides the basic behaviour of a MultiFactory too: holds a set of implementation alternatives.


Field Summary
protected  int alternative
           
protected  Component configuration
           
protected  Element configuration_element
           
protected  Component factory
           
protected  Element factory_element
           
protected  Element self
           
 
Fields inherited from class org.objectweb.jonathan.libs.kernel.decoders.LazyComponent
initialized
 
Fields inherited from class org.objectweb.jonathan.libs.kernel.JComponent
int_value, reference, type, value
 
Constructor Summary
JAssemblage(Component _factory, Component _configuration)
           
JAssemblage(Component _factory, Component _configuration, int _alt)
           
JAssemblage(Component _factory, Component _configuration, int _alt, java.util.List _alternatives)
          Creates a new assemblage whose alternatives are listed in _alternatives as JAlternatives.
JAssemblage(Component _factory, Component _configuration, java.util.List _alternatives)
          Creates a new assemblage whose alternatives are listed in _alternatives as JAlternatives.
 
Method Summary
 Component duplicate()
           
 Element getElement(Name _name)
          Returns the element in the target component identified by name, null if no element exists under name name.
 java.lang.Object getFactoryValue()
          Return a wrapper of this JComponent value for factory aspects.
 java.lang.Object getInstance()
          From Instanciable interface.
protected  void initialize()
          JAssemblage specific initialization code.
 void initialize(java.lang.Object _obj, Context _c, int _alternative)
          Implementation of the Initializer interface's initialize method.
 boolean isInstanciated()
          From Instanciable interface.
 java.lang.Object newObject(Context _c, int _alternative, Instanciable _instance)
          Implementation of the MultiFactory interface's newObject method.
 java.lang.String toString()
           
 
Methods inherited from class org.objectweb.jonathan.libs.kernel.decoders.LazyComponent
getIntValue, getType, getValue
 
Methods inherited from class org.objectweb.jonathan.libs.kernel.JComponent
fork, getComponent, getReference, getValue, internalFork, reset, setReference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

factory

protected Component factory

configuration

protected Component configuration

factory_element

protected Element factory_element

configuration_element

protected Element configuration_element

self

protected Element self

alternative

protected int alternative
Constructor Detail

JAssemblage

public JAssemblage(Component _factory,
                   Component _configuration,
                   java.util.List _alternatives)
Creates a new assemblage whose alternatives are listed in _alternatives as JAlternatives.


JAssemblage

public JAssemblage(Component _factory,
                   Component _configuration,
                   int _alt,
                   java.util.List _alternatives)
Creates a new assemblage whose alternatives are listed in _alternatives as JAlternatives.


JAssemblage

public JAssemblage(Component _factory,
                   Component _configuration)

JAssemblage

public JAssemblage(Component _factory,
                   Component _configuration,
                   int _alt)
Method Detail

duplicate

public Component duplicate()
Overrides:
duplicate in class JComponent

getElement

public Element getElement(Name _name)
Description copied from interface: Component
Returns the element in the target component identified by name, null if no element exists under name name.

Specified by:
getElement in interface Component
Overrides:
getElement in class JComponent

toString

public java.lang.String toString()
Overrides:
toString in class JComponent

getFactoryValue

public java.lang.Object getFactoryValue()
                                 throws JonathanException
Return a wrapper of this JComponent value for factory aspects.

Specified by:
getFactoryValue in interface Component
Overrides:
getFactoryValue in class JComponent
Returns:
a wrapper of this JComponent value for factory aspects.
Throws:
JonathanException

newObject

public java.lang.Object newObject(Context _c,
                                  int _alternative,
                                  Instanciable _instance)
                           throws JonathanException
Implementation of the MultiFactory interface's newObject method. Returns a new instance of the atom's implementation alternative whose ID is _alternative.

Specified by:
newObject in interface MultiFactory
Parameters:
_c - where the instanciation parameters are found
_alternative - the alternative to instantiate
_instance - the method's caller.
Returns:
an new _alternative's instance
Throws:
JonathanException - if something goes wrong.

initialize

public void initialize(java.lang.Object _obj,
                       Context _c,
                       int _alternative)
                throws JonathanException
Implementation of the Initializer interface's initialize method. Initializes an instance of the atom's implementation alternative whose ID is _alternative by calling its setters.

Specified by:
initialize in interface Initializer
Parameters:
_obj - the object to initialize
_c - where the initialisation parameters are found
_alternative - the alternative to instantiate
Throws:
JonathanException - if something goes wrong.

initialize

protected final void initialize()
JAssemblage specific initialization code. Seeks & instantiates its factory, and then asks its factory to instantiate the assemblage's own value. Used internally by LazyComponent.

Specified by:
initialize in class LazyComponent

isInstanciated

public boolean isInstanciated()
From Instanciable interface.

Specified by:
isInstanciated in interface Instanciable
Returns:
true if the value exists, false otherwise.

getInstance

public java.lang.Object getInstance()
From Instanciable interface.

Specified by:
getInstance in interface Instanciable
Returns:
the value of the component (without computing it!).