Jon Elson-Green wrote:

Hi all,

I have made a Selector which creates a number of selectable components based on it's configuration (DefaultFileHandlerSelector).
These selectable components depend on another component (a DataSourceSelector named datasources).
I have supplied a DataSourceSelector to my Selector during service() and attempt to create my selectable components during initialize() (DAFStoreFileHandler)


When I create a selectable component I pass my servicemanager to it so that it can access my DataSourceSelector however I get an exception:

Exception: org.apache.avalon.framework.service.ServiceException
Message: Unknown key: datasources (Key='datasources')

No surprise here - the service manager that is provided to you component has the service that your component has requested - absolutely nothing more - and absolutely nothing less. In your case the component that has received the service manager from merlin has not declared a dependency under the key 'datasources'.



My understanding of the lifecycle and automatic dependency resolving clearly needs work, without posting a bunch of sources could someone suggest where I have gone wrong.

Just a point of clarification here - automatic dependency management works just fine - no work needed in this area at all. Areas that are subject to work on the lifecycle side are when you want to run alternative or extended component lifecycles - and while currently possible, its too intrusive (component has to declare this explicitly using avalon constructs - as opposed to the container recognizing and adapting).


If you component is supplying a service manager to something then you component is acting as a container. As such its you responsibility to make sure that the component that is creating the service manager is either:

   (a) supplied with the service that will be needed by the
       user of the selector by merlin (using static dependency
       statements), or

   (b) building the components dynamically to meet the expected
       demands that will be placed on the selector

If your thinking about Merlin automation of this you will need to supplement the Merlin meta model by intercepting/extending the criteria against which merlin resolves dependency requirements. This is not currently a plug-and-play scenario and is closely linked to the on-going work on facilities management.

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