Steve,

Many thanks for the detailed reply. More questions below :-(

On Sat, 2002-08-17 at 02:44, Stephen McConnell wrote:
> 
> 
> Peter Courcoux wrote:
> 
> >Hi,
> >
> >I've been quietly reading the user and dev lists for a week or two and
> >am now getting my brain round my first trivial components. Many thanks
> >to Berin for "Developing with Apache Avalon". It makes a lot of sense
> >and has helped considerably in understanding the principals. 
> >
> >I have struggled a bit with the 'ContainerComponent' and
> >'ComponentManager' part of 'Implementing the Dream'. I am only slowly
> >beginning to see how these actually fit into an application. It is
> >relatively clear what they do, I think, just not clear to my very slow
> >mind what best practice is in using them.
> >
> 
> Think of the following two things:
> 
>     * a container - something that manager the establishment and 
> deployment of a componet

So if I am writing an application and I have a number of services which
I wish to have available, I do so by including them all in a container
which is responsible for lifecycle management and my application uses a
service by obtaining a reference to it. So in this case all the
application logic is kept away from the container.



>     * a compoent - a managable object that has a well defined lifecycle
Understood.

> 
> Then think about the communication between a container and a component - 
> a number of utilities are used by a container to supply information and 
> resource to the component it is managing.  These include things like a 
> configuration, a context object, and a service manger or component 
> manager - in fact it is more correct to think of the class ServiceManger 
> as a ServiceLocator - bacuase in actual fact it doesn't do any mangement 
> at all - it's simply a holder of the service that a componet needs.  The 
> real management is in the container.
> 
This makes sense.
> >
> >If a re-usable component itself uses components, in addition to
> >implementing its work interface it needs to also be a container to be
> >able to obtain the references to the components it needs. Is this
> >correct?
> >
> 
> Does not sound right ...
> A component may have dependecies on services exposed by other compoents 
> and can itself publish service it provides.  A componet that receives 
> service and uses these in the performace of the service it offers is not 
> a container - its simply a component with depedencies.  If however - 
> that componet nneeded to build and deploy new components internally, 
> then you starting see container charachersitics in you component.  For 
> example, the Merlin container is a componet.  It a componet becuase it 
> can be managed as a classic compoent by a partent, it can have 
> depedecies, etc. - but it also manages the deployment of other components.
>

Ah....

Presumably a component that uses the services of other components
obtains the references for the required services from the container. So
the order of initialization of the services by the container is
important if there are dependencies. 

But a component can instantiate and manage its required services if for
some reason it is not appropriate to obtain them from the 'container'.

> >
> >I had wondered whether the 'work interface' should be kept separate from
> >the 'container', but I think I am right in saying that this is not what
> >the framework intends.  
> >  
> >
> 
> Work interface is not really a notion at the container level - this is a 
> component abstraction.  I could define a componet that has logging, 
> configuration, serviceable, etc. and my interface could be the interface 
> AuditManager.  The internal lifecycle interface (LogEnabled, 
> Configurable, Contextualizable, Initializable, Startable, Disposable, 
> etc.) are used by the container - but its the work interface that is 
> exposed.  Some contains such a Phoenix expose componet via a proxy so 
> that the internal lifecycle interface are not accessible to clients 
> using the components service.
> 
I think that the bit that I couldn't see is beginning to come into
focus. 

> >If someone could either confirm my thoughts or put me on the right track
> >I would be most grateful.
> >
> >One small point that confused me is the javadoc for the Serviceable
> >interface. Am I correct that line 11 of the source should start 'A
> >Serviceable' and not 'A Composable'?
> >  
> >
> 
> Thaks for the update - I just fixed it the CVS.
Only a small contribution.
> 
> Cheers, Steve.

Many thanks for your time on this. It is a great help. 

Peter

> 
> >Many thanks.
> >
> >  
> >
> 
> -- 
> 
> 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]>



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

Reply via email to