On Monday 07 June 2004 03:22, Eike Stepper wrote:
> what is the preferred way to commission components dynamically?
>
> up to now i just call the constructor of the component class and
> some of the lifecycle methods. how is the association to a particular
> container established?
> i've also tried to use the model to add a DefaultComponentModel
> but got stuck when asked for the SystemContext with its awful ctor.
You need to add the
@avalon.entry key="urn:composition:containment.model"
type="org.apache.avalon.composition.model.ContainmentModel"
to the javadoc section of the facility's contextualize() method (or to its
constructor if you use constructor Context injection).
This basically signals two things to Merlin;
1. The component is a facility and has to be instantiated 'first'.
2. Make the top-level ContainmentModel available in the Context.
Containment model = (ContainmentModel) context.get(
"urn:composition:containment.model" );
To get hold of the model.
And then there are many things that you could possibly do, such as bring
components into one of the containers, create configurations on-the-fly, load
a complete container from a URL and other things.
Take a look at the 'dynamics' tutorial for further details;
https://svn.apache.org/repos/asf/avalon/trunk/planet/tutorials/dynamics
Cheers
Niclas
--
+------//-------------------+
/ http://www.bali.ac /
/ http://niclas.hedhman.org /
+------//-------------------+
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]