You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2002/07/30 09:03:35 UTC

cvs commit: jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground ExploitationManager.xinfo BasicComponent.java ExploitationManager.java SimpleComponent.java TerminalComponent.java DefaultExploitationManager.java DefaultExploitationManager.xinfo

mcconnell    2002/07/30 00:03:35

  Modified:    assembly/demo/src/etc demo.mf
               assembly/demo/src/java/org/apache/excalibur/playground
                        BasicComponent.java ExploitationManager.java
                        SimpleComponent.java TerminalComponent.java
  Added:       assembly/demo/src/java/org/apache/excalibur/playground
                        ExploitationManager.xinfo
  Removed:     assembly/demo/src/java/org/apache/excalibur/playground
                        DefaultExploitationManager.java
                        DefaultExploitationManager.xinfo
  Log:
  Updated to demonstrate pluggable extensions.
  
  Revision  Changes    Path
  1.6       +1 -1      jakarta-avalon-excalibur/assembly/demo/src/etc/demo.mf
  
  Index: demo.mf
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/etc/demo.mf,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- demo.mf	29 Jul 2002 06:14:28 -0000	1.5
  +++ demo.mf	30 Jul 2002 07:03:34 -0000	1.6
  @@ -19,5 +19,5 @@
   Name: org/apache/excalibur/playground/InvalidComponent.class
   Avalon-Block: true
   
  -Name: org/apache/excalibur/playground/DefaultExploitationManager.class
  +Name: org/apache/excalibur/playground/ExploitationManager.class
   Avalon-Facility: true
  
  
  
  1.8       +7 -1      jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/BasicComponent.java
  
  Index: BasicComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/BasicComponent.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BasicComponent.java	20 Jul 2002 00:54:06 -0000	1.7
  +++ BasicComponent.java	30 Jul 2002 07:03:34 -0000	1.8
  @@ -13,6 +13,7 @@
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.activity.Startable;
  +import org.apache.avalon.framework.activity.Disposable;
   
   /**
    * This is a minimal demonstration component that implements the 
  @@ -21,7 +22,7 @@
    * @author <a href="mailto:mcconnell@osm.net">Stephen McConnell</a>
    */
   public class BasicComponent extends AbstractLogEnabled 
  -implements Contextualizable, Configurable, Initializable, Startable, BasicService
  +implements Contextualizable, Configurable, Initializable, Startable, BasicService, Disposable
   {
   
       private String m_location;
  @@ -69,6 +70,11 @@
       public void stop()
       {
           getLogger().info("stopping");
  +    }
  +
  +    public void dispose()
  +    {
  +        getLogger().debug( "dispose" );
       }
   
       //=======================================================================
  
  
  
  1.2       +54 -2     jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/ExploitationManager.java
  
  Index: ExploitationManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/ExploitationManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExploitationManager.java	29 Jul 2002 06:14:28 -0000	1.1
  +++ ExploitationManager.java	30 Jul 2002 07:03:34 -0000	1.2
  @@ -2,12 +2,64 @@
   
   package org.apache.excalibur.playground;
   
  -import org.apache.excalibur.merlin.assembly.resource.PhaseManager;
  +import org.apache.avalon.framework.context.Context;
  +import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.excalibur.merlin.assembly.resource.Extension;
  +import org.apache.avalon.framework.activity.Initializable;
  +import org.apache.avalon.framework.activity.Disposable;
   
   /**
    * Definition of an extension type.
    * @author <a href="mailto:mcconnell@osm.net">Stephen McConnell</a>
    */
  -public interface ExploitationManager extends PhaseManager
  +public class ExploitationManager extends AbstractLogEnabled implements Initializable, Extension, Disposable
   {
  +
  +    //=======================================================================
  +    // Initializable
  +    //=======================================================================
  +
  +    public void initialize()
  +    {
  +        getLogger().debug("initialize");
  +    }
  +
  +    //=======================================================================
  +    // Disposable
  +    //=======================================================================
  +
  +    public void dispose()
  +    {
  +        getLogger().debug( "dispose" );
  +    }
  +
  +    //=======================================================================
  +    // Extension
  +    //=======================================================================
  +
  +    /**
  +     * Invoked by a container to request the application of a custom lifecycle
  +     * phase on the supplied object.
  +     *
  +     * @param int lifecycle stage
  +     * @param object the object to apply the extension to
  +     * @param context the context
  +     * @exception Exception if an error occurs
  +     */
  +    public void extend( int stage, Object object, Context context )
  +        throws Exception
  +     {
  +        getLogger().debug( "extend stage: " + stage );
  +        if( object instanceof Exploitable )
  +        {
  +            if( stage == CREATE )
  +            {
  +                ((Exploitable)object).exploit();
  +            }
  +        }
  +        else
  +        {
  +            getLogger().warn( "Invalid target - object does not implement Exploitable" );
  +        }
  +    }
   }
  
  
  
  1.8       +12 -2     jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/SimpleComponent.java
  
  Index: SimpleComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/SimpleComponent.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SimpleComponent.java	29 Jul 2002 06:14:28 -0000	1.7
  +++ SimpleComponent.java	30 Jul 2002 07:03:34 -0000	1.8
  @@ -10,6 +10,7 @@
   import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.activity.Startable;
  +import org.apache.avalon.framework.activity.Disposable;
   
   /**
    * This is a minimal demonstration component that a dependency on 
  @@ -19,7 +20,7 @@
    */
   
   public class SimpleComponent extends AbstractLogEnabled 
  -implements Configurable, Serviceable, Initializable, Startable, SimpleService, Exploitable
  +implements Configurable, Serviceable, Initializable, Startable, SimpleService, Exploitable, Disposable
   {
   
       private String m_message;
  @@ -53,7 +54,7 @@
   
       public void exploit()
       {
  -        getLogger().debug( "I've been exploited!" );
  +        getLogger().info( "I've been exploited!" );
       }
   
       //=======================================================================
  @@ -110,6 +111,15 @@
           catch( Throwable e )
           {
           }
  +    }
  +
  +    //=======================================================================
  +    // Disposable
  +    //=======================================================================
  +
  +    public void dispose()
  +    {
  +        getLogger().debug( "dispose" );
       }
   
       //=======================================================================
  
  
  
  1.4       +8 -1      jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/TerminalComponent.java
  
  Index: TerminalComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/TerminalComponent.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TerminalComponent.java	4 Jul 2002 09:01:32 -0000	1.3
  +++ TerminalComponent.java	30 Jul 2002 07:03:34 -0000	1.4
  @@ -3,6 +3,7 @@
   package org.apache.excalibur.playground;
   
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.avalon.framework.activity.Disposable;
   
   /**
    * This is a minimal demonstration component that provides BasicService 
  @@ -12,7 +13,7 @@
    */
   
   public class TerminalComponent extends AbstractLogEnabled
  -implements BasicService
  +implements BasicService, Disposable
   {
   
       //=======================================================================
  @@ -23,4 +24,10 @@
       {
           getLogger().info("hello from TerminalComponent");
       }
  +
  +    public void dispose()
  +    {
  +        getLogger().debug( "dispose" );
  +    }
  +
   }
  
  
  
  1.1                  jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/ExploitationManager.xinfo
  
  Index: ExploitationManager.xinfo
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
  Definition of the extension type phase support.
  -->
  
  <component-info>
  
    <component>
      <name>exploitation</name>
    </component>
  
    <!--
    Declaration of the lifecycle support phases that this manager provides. 
    -->
    <extensions>
  
      <!--
      Each extension has a name, a versioned interface reference, and optional 
      attributes.
      -->
      <extension stage="CREATE">
        <name>exploit</name>
        <reference type="org.apache.excalibur.playground.Exploitable" version="1.0"/>
        <attributes>
          <attribute key="status" value="experimental"/>
        </attributes>
      </extension>
  
    </extensions>
  
  </component-info>
  
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>