Greetings.

In relation to the recent threads on Container Extensions [1] and Container
Components [2], I've put together the beginnings of assembly stage
extensions.  Assembly stage extensions are similar to Creator lifecycle
extensions except that they have access to the component Appliance as well
as the object itself.  Attached is a new interface called
"DeploymentStageExtension" for the assembly-spi package.  Also attached is a
diff to the DefaultDeploymentService in the assembly package which provides
support for the new extension.

More info on my wiki at
http://jadetower.org/vqwiki/jsp/Wiki?AvalonAssemblyExt 

--- DeploymentStageExtension ---
package org.apache.avalon.assembly.lifecycle;

import org.apache.avalon.assembly.appliance.Appliance;

public interface DeploymentStageExtension
{

  public void create(Appliance appliance, Object object)
    throws Exception;

  public void destroy(Appliance appliance, Object object)
    throws Exception;
}


------------ Usage ----------------

--- SimpleService: 

package org.jadetower.extensions;

/**
 * @avalon.meta.version 1.0
 * @avalon.meta.name simple
 * @avalon.meta.service type="org.jadetower.extensions.SimpleService"
 * @avalon.meta.stage type="org.jadetower.extensions.SimpleService"
 * @avalon.meta.attribute key="description" value="example extension"
 */
public class SimpleServiceImpl
   implements SimpleService
{
  public SimpleServiceImpl() {}

  public String getName()
  {
   return ROLE;
  }

}

---- Simple Stage Extension:

package org.jadetower.extensions;

import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.assembly.lifecycle.DeploymentStageExtension;
import org.apache.avalon.assembly.appliance.Appliance;

/**
 * @avalon.meta.name extension
 * @avalon.meta.version 1.0
 * @avalon.meta.service type="org.jadetower.extensions.StageExtension"
 * @avalon.meta.extension type="org.jadetower.extensions.SimpleService"
 */
public class StageExtensionImpl
   extends AbstractLogEnabled
   implements StageExtension, DeploymentStageExtension {

  public StageExtensionImpl() {
  }
  public String getName() {
   return ROLE;
  }

  public void create(Appliance appliance, Object object){
  String desc =
appliance.getType().getInfo().getAttribute("description","error");
  getLogger().info("appliance description = "+desc);
  }

  public void destroy(Appliance appliance, Object object){

  }
}

---- Output:
Running Merlin:
[INFO   ] (extension): appliance description = example

------------------

There's still issues.  Particularly, the meta and assembly packages only
allow Type stages, meaning it the stage must be defined as an interface
implemented by your particular service.  I'd like to change this to allow
Name base stages which don't require any interfaces.  

Thoughts?  Comments?

J. Aaron Farr
� SONY ELECTRONICS
� DDP-CIM
� (724) 696-7653
�
[1] http://marc.theaimsgroup.com/?t=105664714700002&r=1&w=2&n=11
[2] http://marc.theaimsgroup.com/?t=105672722000001&r=1&w=2&n=6

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

Reply via email to