Leo Sutic wrote:
>Stephen,
>
>I looked over Merlin, and I think I'll ditch MicroContainer for it.
>
>In particular, it would appear as if I can keep just the MicroContainer
>class (maybe move it over to Merlin).
>
>Let me explain:
>
> + Merlin uses the ServiceLoader class to start up a component.
>
> + Basically, you say "ServiceLoader, the components are in these JAR
>files,
> I want to use this component, load it." So I could use ServiceLoader
>to
> get a DataSourceComponent and it would automatically check all listed
> JAR files for the depndencies of the DataSourceComponent.
>
>But then, once Merlin has loaded the component, how do I get a reference
>to it? That is, after calling initialize() on the serviceLoader, what do
>I do then?
>
ServiceLoader is a compoent that implements the interface
PipelineService. The PipelineService interface contains the operation
"pipeline" which is the directive to Merlin to load and process the
lifecycle of a target component given a classname. The pipeline
operation returns the component to the invoking client. Take a look at
the
http://home.osm.net/doc/merlin/org/apache/excalibur/merlin/package-summary.html
and the javadoc for ServiceLoader for addition details.
>
>In particular, suppose I have this:
>
>public void MyApp {
>
> public static void main(String[] args) throws Exception {
> // Do stuff
>
> ...
>
> // I want to use a DataSourceComponent right here.
> // The component I want to use is fully meta-enabled, and so is
> // all its dependencies. How?
>
> ...
>
> // Some other stuff
> }
>
>}
>
>Question:
>
> + Does Merlin *require* the use of external XML files for
>configuration? Or can
> a configuration be built programmatically and given to Merlin?
>
>
Its desiged to be built programatically. No configuration is
"required". The functional parameters are passed under a
ServiceLoaderContext.Details of ServiceLoader in terms of the
contextualize and configure requirements are detiled in the
ServiceLoader javadoc. The optional configuration lets the client
override the default configuration of a component - but this an area I
want to review as part of Merlin II (refer the excalibur assembly
package and the readme file for more details). What Merlin does require
is that component structure is declared in an xinfo file - at the moment
its a bick strict - and I think this could be generalized so that a
minimal component xinfo could be logically derived if not explicitly
declared - but that's more a Merlin II subject. Main changes between
current Merlin and Merlin II are (a) II builds extensively on
containerkit, (b) II introduces more structured approach to merlin
assembly defintions (an example is included in the Excalibur asssembly
package), and (c) the overall design focussed on the ability to create a
hierachy of merlin containers in service can be explicitly exported.
Cheers, Steve.
>/LS
>
>
>--
>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>
--
Stephen J. McConnell
OSM SARL
digital products for a global economy
mailto:[EMAIL PROTECTED]
http://www.osm.net
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>