Jon Elson-Green wrote:

Niclas Hedhman wrote:

On Wednesday 14 April 2004 11:29, Justin Permar wrote:


I'm curious as to why a Configuration object is passed to a
Configurable instead of a general-purpose XML document? Is it
possible to use XML configuration for a component (maybe a
lifecycle extension that provides that capability)?


As David said, Configuration is an interface which is DOM-like, but intentionally made smaller/simpler so that other tree-like sources can be used.

You can create Configuration from XML and vice versa fairly easy with org.apache.avalon.framework.configuration (which sits in avalon/framework/impl), but you could also create Configurations by manually instantiate and populate, node by node, yourself.


Cheers
Niclas


Is there a way to provide a custom configuration builder in standard
merlin or do I need to handle the lifecycle of such components myself?

The establishment of a configuration is a container concern. Within Merlin you can intercept this behavior using any of the following approaches:


   a) definition of a lifecycle stage extension that
      delivers a particular non-avalon lifecycle artifact
      (e.g. an XML document)

   b) definition of a custom context object that exposes
      operations to the component that allow access to
      a domain specific artifact

   c) creation of a facility that manipulates the component
      models in your system (i.e. programatically taking
      in XML info and setting aspects of the component
      model)

For example, to configure excalibur datasources from LDAP.

Now this is something different.


I'm presuming that your using the word "configure" in the sense of declaring and setting-up a set of component models that can be resolved based on supplied selection arguments. Using the avalon meta and composition packages the same thing can be done programatically - i.e. independently of an XML specification. Basically what you would do is use a facility (a component with access to the containment model) to create a private container model, populate the model with component models (using data from LDAP or wherever) and then the facility would respond to client requests.

Just for reference - there is some discussion on-going on the dev list concerning selection semantics which is rather relevant to this entire area.

Cheers, Stephen.

--

|------------------------------------------------|
| Magic by Merlin                                |
| Production by Avalon                           |
|                                                |
| http://avalon.apache.org/merlin                |
| http://dpml.net/merlin/distributions/latest    |
|------------------------------------------------|

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to