org.objectweb.jonathan.libs.kernel.decoders

Class JAssemblage

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, List _alternatives)
Creates a new assemblage whose alternatives are listed in _alternatives as JAlternatives.
JAssemblage(Component _factory, Component _configuration, int _alt)
JAssemblage(Component _factory, Component _configuration, int _alt, 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.
Object
getFactoryValue()
Return a wrapper of this JComponent value for factory aspects.
Object
getInstance()
From Instanciable interface.
protected void
initialize()
JAssemblage specific initialization code.
void
initialize(Object _obj, Context _c, int _alternative)
Implementation of the Initializer interface's initialize method.
boolean
isInstanciated()
From Instanciable interface.
Object
newObject(Context _c, int _alternative, Instanciable _instance)
Implementation of the MultiFactory interface's newObject method.
String
toString()

Methods inherited from class org.objectweb.jonathan.libs.kernel.decoders.LazyComponent

getIntValue, getType, getValue, initialize

Methods inherited from class org.objectweb.jonathan.libs.kernel.JComponent

duplicate, fork, getComponent, getElement, getFactoryValue, getIntValue, getReference, getType, getValue, getValue, internalFork, reset, setReference, toString

Field Details

alternative

protected int alternative


configuration

protected Component configuration


configuration_element

protected Element configuration_element


factory

protected Component factory


factory_element

protected Element factory_element


self

protected Element self

Constructor Details

JAssemblage

public JAssemblage(Component _factory,
                   Component _configuration)


JAssemblage

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


JAssemblage

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


JAssemblage

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

Method Details

duplicate

public Component duplicate()
Overrides:
duplicate in interface JComponent


getElement

public Element getElement(Name _name)
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 interface JComponent

Parameters:

Returns:
the corresponding element, if any; null otherwise.


getFactoryValue

public Object getFactoryValue()
            throws JonathanException
Return a wrapper of this JComponent value for factory aspects.
Specified by:
getFactoryValue in interface Component
Overrides:
getFactoryValue in interface JComponent

Returns:
a wrapper of this JComponent value for factory aspects.

Throws:
JonathanException -


getInstance

public Object getInstance()
From Instanciable interface.
Specified by:
getInstance in interface Instanciable

Returns:
the value of the component (without computing it!).


initialize

protected final void initialize()
Overrides:
initialize in interface LazyComponent


initialize

public void initialize(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.


isInstanciated

public boolean isInstanciated()
From Instanciable interface.
Specified by:
isInstanciated in interface Instanciable

Returns:
true if the value exists, false otherwise.


newObject

public 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.


toString

public String toString()
Overrides:
toString in interface JComponent