Stephen,
Thanks for the clarifications.
Here comes new questions based on
1. Is Serviceable == ServiceConsumer in Merlin? If no, is there any
ServiceConsumer like interface in Merlin?
2. What interface does a service provider implement in Merlin? Is there any?
If the component class needs a
> service manager, then the container will create a new service manager
> based on the information in the component model.
3. Is service manager created on demand? Or is it some vital built-in
component(service) of a given container?
Thanks.
Best Regards
--
Nader Aeinehchi
Aasenhagen 66 E
2020 Skedsmokorset
NORWAY
Direct and Mobile +47 41 44 29 57
Tel (private): +47 64 83 09 08
Fax +47 64 83 08 07
www.aeinehchi.com
----- Original Message -----
From: "Stephen McConnell" <[EMAIL PROTECTED]>
To: "Avalon Developers List" <[EMAIL PROTECTED]>
Sent: Thursday, April 22, 2004 12:46 AM
Subject: Re: What is the primary purpose of Serviceable interface?
> Nader Aeinehchi wrote:
>
> > Hi
> >
> > I am trying to understand the primay usage of Serviceable interface.
> >
> > In Merlin documentation, I find an example where a service consumer
looks up for a certain service. This service consumer implements
Serviceable interface.
> >
> > 1. Do I understand it correctly that Serviceable interface
> > is supposed to be implemented by service consumers?
>
> Correct.
>
> A ServiceManager is simply a lifecycle artifact provided by the
> container to a component that either implements the Serviceable
> interface, or declares a ServiceManager as a constructor argument. The
> service manager will be pre-populated with services accessible using the
> keys the the consumer component declares.
>
> > 2. Can service providers implement Serviceable interface?
>
> Yes - if they are dependent on other services (in which case they would
> be a consumer of the services that they declare as dependencies).
>
> > 3. Intuitively, I would suppose that service providers should
> > Serviceable interface and not service consumers.
>
> I think there is a word missing in the above sentence.
>
> > How does Merlin think?
>
> When you describe a component that leverages IoC, you want to that
> component to be unconcerned with the problems of resolving the services
> it needs - so we hand this job over to the container. The container
> looks at the component type information associated with the component
> class and from this creates a component model. The container then
> assembles the model during which components that can provide
> corresponding services are assigned as providers. When an instance of
> the component is required, the container runs the component instance
> through it's deployment lifecycle. If the component class needs a
> service manager, then the container will create a new service manager
> based on the information in the component model.
>
> Stephen.
>
> > --------------------------------
> >
> >
> > Excerpt from Merlin examples:
> >
> > public class HelloComponent extends AbstractLogEnabled
> > implements Initializable, Serviceable, Disposable
> > {
> > RandomGenerator m_random = null;
> > Identifiable m_identifiable = null;
> > /**
> > * Servicing of the component by the container during
> > * which service dependencies declared under the component
> > * can be resolved using the supplied service manager.
> > *
> > * @param manager the service manager
> > * @avalon.dependency type="tutorial.RandomGenerator:1.0"
> > * key="random"
> > * @avalon.dependency type="tutorial.Identifiable"
> > */
> > public void service( ServiceManager manager )
> > throws ServiceException
> > {
> > m_random = (RandomGenerator) manager.lookup( "random" );
> > m_identifiable =
> > (Identifiable) manager.lookup( Identifiable.class.getName() );
> > }
> >
> >
> > Best Regards
> >
> > --
> > Nader Aeinehchi
> > Aasenhagen 66 E
> > 2020 Skedsmokorset
> > NORWAY
> > Direct and Mobile +47 41 44 29 57
> > Tel (private): +47 64 83 09 08
> > Fax +47 64 83 08 07
> > www.aeinehchi.com
> >
> >
>
>
> --
>
> |---------------------------------------|
> | Magic by Merlin |
> | Production by Avalon |
> | |
> | http://avalon.apache.org |
> |---------------------------------------|
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]