avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/resource AbstractExtension.java
Date Tue, 30 Jul 2002 13:52:57 GMT
mcconnell    2002/07/30 06:52:57

  Added:       assembly/demo/src/java/org/apache/excalibur/playground
                        DemoManager.java DemoManager.xinfo
                        Demonstratable.java
               assembly/src/java/org/apache/excalibur/merlin/assembly/resource
                        AbstractExtension.java
  Log:
  Copletion of pluggable phase management (addition of inner phases ACCESS and RELEASE).
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/DemoManager.java
  
  Index: DemoManager.java
  ===================================================================
  
  
  package org.apache.excalibur.playground;
  
  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.excalibur.merlin.assembly.resource.AbstractExtension;
  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 class DemoManager extends AbstractExtension implements Initializable, Disposable
  {
  
      //=======================================================================
      // Initializable
      //=======================================================================
  
      public void initialize()
      {
          getLogger().debug("initialize");
      }
  
      //=======================================================================
      // Disposable
      //=======================================================================
  
      public void dispose()
      {
          getLogger().debug( "dispose" );
      }
  
      //=======================================================================
      // Extension
      //=======================================================================
  
      public void extend( int stage, Object target, Context context ) throws Exception
      {
          super.extend( stage, target, context );
          if( target instanceof Demonstratable )
            ((Demonstratable)target).demo( stage );
      }
   }
  
  
  
  1.1                  jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/DemoManager.xinfo
  
  Index: DemoManager.xinfo
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
  Definition of the extension type phase support.
  -->
  
  <component-info>
  
    <component>
      <name>demo</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="ALL">
        <name>demonstrate</name>
        <reference type="org.apache.excalibur.playground.Demonstratable" version="1.0"/>
        <attributes>
          <attribute key="status" value="experimental"/>
        </attributes>
      </extension>
  
    </extensions>
  
  </component-info>
  
  
  
  
  1.1                  jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/Demonstratable.java
  
  Index: Demonstratable.java
  ===================================================================
  
  
  package org.apache.excalibur.playground;
  
  /**
   * @author <a href="mailto:mcconnell@osm.net">Stephen McConnell</a>
   */
  public interface Demonstratable 
  {
      void demo( int stage );
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/resource/AbstractExtension.java
  
  Index: AbstractExtension.java
  ===================================================================
  
  
  package org.apache.excalibur.merlin.assembly.resource;
  
  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 class AbstractExtension extends AbstractLogEnabled implements Extension
  {
  
      //=======================================================================
      // 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
       {
          if( stage == CREATE )
          {
              if( getLogger().isDebugEnabled() )
                getLogger().debug("extend CREATE" );
          }
          else if( stage == ACCESS )
          {
              if( getLogger().isDebugEnabled() )
                getLogger().debug("extend ACCESS" );
          }
          else if( stage == RELEASE )
          {
              if( getLogger().isDebugEnabled() )
                getLogger().debug("extend RELEASE" );
          }
          else if( stage == DESTROY )
          {
              if( getLogger().isDebugEnabled() )
                getLogger().debug("extend DESTROY" );
          }
          else
          {
              throw new IllegalArgumentException("stage");
          }
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message