avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farr, Aaron" <Aaron.F...@am.sony.com>
Subject RE: [RT] Container Components
Date Fri, 27 Jun 2003 17:32:16 GMT


> -----Original Message-----
> #1) We need to provide access to component meta information
> #2) We need to provide access to container assembly information
> 
> The question is what interface would work best for this?

Here's on way to do this in Merlin:

Currently lifecycle extensions are handled by:
   org.apache.avalon.assembly.lifecycle.impl.DefaultDeploymentService
which is an implementation of:
   org.apache.avalon.assembly.lifecycle.DeploymentService

specifically, you want to look at the method:

   private void processCreateStage( 
      Appliance appliance, StageDescriptor stage, Object object )

Basically, the DeploymentService has a deploy() method which runs a
component through it's basic Avalon 4 lifecycle methods and then checks for
lifecycle extensions referred to in merlin as stages.

The processCreateStage() method uses the appliance object to look up the
stages and stage providers (lifecycle extension handlers) for this component
and then initializes them as follows:

   Object handler = provider.resolve( this );
   if (handler instanceof Creator)
   {
    ((Creator)handler).create(object,
        new DefaultLocator( appliance.getContextMap() ) );
   }
   provider.release( handler, this );


So if we provided a new type of lifecycle extension something like:

package org.apache.avalon.assembly.stage.CreateHandler;

public interface CreateHandler
{
    void create( Appliance appliance, Object object)
        throws Exception;
    
    void destroy( Appliance appliance, Object object)
        throws Exception;
}

We could then change the above processCreateStage() snippet to:

   Object handler = provider.resolve( this );
   if (handler instanceof Creator)
   {
    ((Creator)handler).create(object,
        new DefaultLocator( appliance.getContextMap() ) );
   }
   if (handler instanceof CreateHandler)
   {
    ((CreateHandler)handler).create(appliance,object);
   }
   provider.release( handler, this );

and we would be one step closer to having container extensions since the
appliance interface provides almost everything one would need including
configuration, context, meta-info, etc.

This isn't a final solution of course.  Support for the CreateHandler and
related interfaces would have to be added to the assembly and meta packages,
but it wouldn't be too hard and it would give us a start.

If this sounds interesting, I'll put together the necessary patches.

jaaron


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Mime
View raw message