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 2003/09/01 04:13:07 UTC

cvs commit: avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/excalibur/src/java/tutorial Demonstratable.java DemonstratableProvider.java HelloComponent.java

mcconnell    2003/08/31 19:13:07

  Added:       merlin/merlin-platform/tutorials .cvsignore
               merlin/merlin-platform/tutorials/lifecycle/activation
                        .cvsignore README.TXT project.xml
               merlin/merlin-platform/tutorials/lifecycle/activation/conf
                        block.xml
               merlin/merlin-platform/tutorials/lifecycle/activation/src/java/tutorial
                        Demonstratable.java DemonstratableProvider.java
                        HelloComponent.java
               merlin/merlin-platform/tutorials/lifecycle/excalibur
                        .cvsignore README.TXT project.xml
               merlin/merlin-platform/tutorials/lifecycle/excalibur/conf
                        block.xml
               merlin/merlin-platform/tutorials/lifecycle/excalibur/src/java/tutorial
                        Demonstratable.java DemonstratableProvider.java
                        HelloComponent.java
  Log:
  Update to include excalibur lifecycle extension and activation lifecycle extension demos.
  
  Revision  Changes    Path
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  maven.log
  velocity.log
  build
  target
  tutorial.jar
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/activation/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  maven.log
  velocity.log
  build
  target
  tutorial.jar
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/activation/README.TXT
  
  Index: README.TXT
  ===================================================================
  
  Merlin Extension Tutorial
  -------------------------
  
  This tutorial covers usage of merlin lifecycle extensions.
  
  $ maven
  $ merlin -execute target\classes
  
  [INFO   ] (tutorial.extension): invoking create on target: [deployment model : /tutorial/hello]
  [INFO   ] (tutorial.hello): extension said: creator id: 24109300
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/activation/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <project>
  
    <extend>${basedir}/../../project.xml</extend>
  
    <id>merlin-tutorial-lifecycle-excalibur</id>
    <name>Merlin Lifecycle Tutorial</name>
    <package>tutorial</package>
  
    <currentVersion>1.0</currentVersion>
    <inceptionYear>2003</inceptionYear>
    <shortDescription>Merlin Lifecycle Extension Tutorial.</shortDescription>
  
    <dependencies>
      <dependency>
        <groupId>avalon-framework</groupId>
        <artifactId>avalon-framework-api</artifactId>
        <version>SNAPSHOT</version>
      </dependency>
      <dependency>
        <groupId>avalon-framework</groupId>
        <artifactId>avalon-framework-impl</artifactId>
        <version>SNAPSHOT</version>
      </dependency>
      <dependency>
        <groupId>avalon-composition</groupId>
        <artifactId>avalon-composition-api</artifactId>
        <version>SNAPSHOT</version>
      </dependency>
      <dependency>
        <groupId>avalon-activation</groupId>
        <artifactId>avalon-activation-api</artifactId>
        <version>SNAPSHOT</version>
      </dependency>
      <dependency>
        <groupId>avalon-meta</groupId>
        <artifactId>avalon-meta-api</artifactId>
        <version>SNAPSHOT</version>
      </dependency>
    </dependencies>
    
    <build>
  
      <sourceDirectory>${basedir}/src/java</sourceDirectory>
  
      <resources>
        <resource>
          <directory>${basedir}/conf</directory>
          <targetPath>BLOCK-INF</targetPath>
          <includes>
            <include>block.xml</include>
          </includes>
        </resource>
      </resources>
  
      <jars></jars>
  
    </build>
  
  </project>
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/activation/conf/block.xml
  
  Index: block.xml
  ===================================================================
  
  <container name="tutorial">
  
     <classloader>
       <classpath>
         <repository>
           <resource id="avalon-framework:avalon-framework-impl" version="SNAPSHOT"/>
         </repository>
       </classpath>
     </classloader>
  
     <component name="hello" class="tutorial.HelloComponent"/>
  
  </container>
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/activation/src/java/tutorial/Demonstratable.java
  
  Index: Demonstratable.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package tutorial;
  
  /**
   * A stage interface.
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   */
  public interface Demonstratable
  {
      /**
       * Do something or other.
       * @param stage the stage being applied (as a string)
       */
      void demo( String stage );
  }
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/activation/src/java/tutorial/DemonstratableProvider.java
  
  Index: DemonstratableProvider.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package tutorial;
  
  import org.apache.avalon.activation.lifecycle.LifecycleCreateExtension;
  import org.apache.avalon.composition.model.DeploymentModel;
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.meta.info.StageDescriptor;
  
  /**
   * Definition of an extension type that logs messages related to
   * all lifestyle stages.
   *
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   * @avalon.component name="extension" version="1.0" lifestyle="singleton"
   * @avalon.extension id="urn:demo:demonstratable"
   */
  public class DemonstratableProvider extends AbstractLogEnabled
          implements LifecycleCreateExtension
  {
  
      //=======================================================================
      // LifecycleCreateExtension
      //=======================================================================
  
      /**
       * Invocation of the deployment creation stage extension.
       * @param model the model representing the object under deployment
       * @param stage the extension stage descriptor
       * @param object the object under deployment
       * @exception if a deployment error occurs
       */
       public void create( DeploymentModel model, StageDescriptor stage, Object object )
         throws Exception
       {
           getLogger().info( "invoking create on target: " + model );
           if( object instanceof Demonstratable )
           {
              ((Demonstratable)object).demo( "creator id: " + System.identityHashCode( this ) );
           }
       }
  }
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/activation/src/java/tutorial/HelloComponent.java
  
  Index: HelloComponent.java
  ===================================================================
  
  package tutorial;
  
  import java.io.File;
  
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  
  /**
   * Component demonstrating access to standard context entries.
   * @avalon.component name="demo" lifestyle="singleton" version="1.0"
   * @avalon.stage id="urn:demo:demonstratable"
   */
  public class HelloComponent extends AbstractLogEnabled 
    implements Demonstratable
  {
  
      /**
       * Do something or other.
       * @param stage the stage being applied (as a string)
       */
      public void demo( String stage )
      {
          getLogger().info( "extension said: " + stage );
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/excalibur/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  maven.log
  velocity.log
  build
  target
  tutorial.jar
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/excalibur/README.TXT
  
  Index: README.TXT
  ===================================================================
  
  Excalibur Extension Tutorial
  ----------------------------
  
  This tutorial covers usage of classic excalibur lifecycle extensions.
  
  $ maven
  $ merlin -execute target\classes
  
  [INFO   ] (tutorial.extension): initialize
  [INFO   ] (tutorial.extension): invoking create on target
  [INFO   ] (tutorial.hello): extension said: create id: 24109300, Thread[Thread-0,5,main]
  [INFO   ] (tutorial.extension): invoking access on target
  [INFO   ] (tutorial.hello): extension said: access id: 24109300, Thread[Thread-0,5,main]
  [INFO   ] (tutorial.extension): invoking destroy on target
  [INFO   ] (tutorial.hello): extension said: destroy id: 24109300, Thread[Thread-0,5,main]
  [INFO   ] (tutorial.extension): dispose
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/excalibur/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <project>
  
    <extend>${basedir}/../../project.xml</extend>
  
    <id>merlin-tutorial-lifecycle-excalibur</id>
    <name>Merlin Excalibur Lifecycle Tutorial</name>
    <package>tutorial</package>
  
    <currentVersion>1.0</currentVersion>
    <inceptionYear>2003</inceptionYear>
    <shortDescription>Merlin Excalibur Lifecycle Extension Tutorial.</shortDescription>
  
    <dependencies>
      <dependency>
        <groupId>avalon-framework</groupId>
        <artifactId>avalon-framework-api</artifactId>
        <version>SNAPSHOT</version>
      </dependency>
      <dependency>
        <groupId>avalon-framework</groupId>
        <artifactId>avalon-framework-impl</artifactId>
        <version>SNAPSHOT</version>
      </dependency>
      <dependency>
        <groupId>excalibur-lifecycle</groupId>
        <artifactId>excalibur-lifecycle-api</artifactId>
        <version>1.0</version>
      </dependency>
    </dependencies>
    
    <build>
  
      <sourceDirectory>${basedir}/src/java</sourceDirectory>
  
      <resources>
        <resource>
          <directory>${basedir}/conf</directory>
          <targetPath>BLOCK-INF</targetPath>
          <includes>
            <include>block.xml</include>
          </includes>
        </resource>
      </resources>
  
      <jars></jars>
  
    </build>
  
  </project>
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/excalibur/conf/block.xml
  
  Index: block.xml
  ===================================================================
  
  <container name="tutorial">
  
     <classloader>
       <classpath>
         <repository>
           <resource id="avalon-framework:avalon-framework-impl" version="SNAPSHOT"/>
         </repository>
       </classpath>
     </classloader>
  
     <component name="hello" class="tutorial.HelloComponent"/>
  
  </container>
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/excalibur/src/java/tutorial/Demonstratable.java
  
  Index: Demonstratable.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package tutorial;
  
  /**
   * A stage interface.
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   */
  public interface Demonstratable
  {
      /**
       * Do something or other.
       * @param stage the stage being applied (as a string)
       */
      void demo( String stage );
  }
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/excalibur/src/java/tutorial/DemonstratableProvider.java
  
  Index: DemonstratableProvider.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package tutorial;
  
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.lifecycle.Accessor;
  import org.apache.avalon.lifecycle.Creator;
  
  /**
   * Definition of an extension type that logs messages related to
   * all lifestyle stages.
   *
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   * @avalon.component name="extension" version="1.0" lifestyle="singleton"
   * @avalon.extension id="urn:demo:demonstratable"
   */
  public class DemonstratableProvider extends AbstractLogEnabled
          implements Creator, Accessor, Initializable, Disposable
  {
  
      //=======================================================================
      // Initializable
      //=======================================================================
  
      /**
       * Initialization of the component. Simply demonstrates that this is
       * a real componet that can implement any lifcycle stage in the role of
       * classic component.
       */
      public void initialize()
      {
          getLogger().info( "initialize" );
      }
  
      //=======================================================================
      // Creator
      //=======================================================================
  
      /**
       * Invoked by a container to handle a create stage action.
       * @param target the object to handle
       * @param context the context supplied to the extension by container
       *   corresponding to its extension context criteria
       * @exception Exception if an error occurs
       */
      public void create( Object target, Context context ) throws Exception
      {
          getLogger().info( "invoking create on target" );
          if( target instanceof Demonstratable )
          {
              ((Demonstratable) target).demo( "create id: "
                      + System.identityHashCode( this )
                      + ", " + Thread.currentThread() );
          }
      }
  
      /**
       * Invoked by a container to handle a destroy stage action.
       * @param target the object to handle
       * @param context the context supplied to the extension by container
       *   corresponding to its extension context criteria
       */
      public void destroy( Object target, Context context )
      {
          getLogger().info( "invoking destroy on target" );
          if( target instanceof Demonstratable )
          {
              ((Demonstratable) target).demo( "destroy id: "
                      + System.identityHashCode( this )
                      + ", " + Thread.currentThread() );
          }
      }
  
      /**
       * Invoked by a container to handle a access stage action.
       * @param target the object to handle
       * @param context the context supplied to the extension by container
       *   corresponding to its extension context criteria
       * @exception Exception if an error occurs
       */
      public void access( Object target, Context context ) throws Exception
      {
          getLogger().info( "invoking access on target" );
          if( target instanceof Demonstratable )
          {
              ((Demonstratable) target).demo( "access id: "
                      + System.identityHashCode( this )
                      + ", " + Thread.currentThread() );
          }
      }
  
      /**
       * Invoked by a container to handle a release stage action.
       * @param target the object to handle
       * @param context the context supplied to the extension by container
       *   corresponding to its extension context criteria
       */
      public void release( Object target, Context context )
      {
          getLogger().info( "invoking release on target" );
          if( target instanceof Demonstratable )
          {
              ((Demonstratable) target).demo( "release id: "
                      + System.identityHashCode( this )
                      + ", " + Thread.currentThread() );
          }
      }
  
      //=======================================================================
      // Disposable
      //=======================================================================
  
      /**
       * Disposal of the component.
       */
      public void dispose()
      {
          if( getLogger().isInfoEnabled() )
          {
              getLogger().info( "dispose" );
          }
      }
  }
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/tutorials/lifecycle/excalibur/src/java/tutorial/HelloComponent.java
  
  Index: HelloComponent.java
  ===================================================================
  
  package tutorial;
  
  import java.io.File;
  
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  
  /**
   * Component demonstrating access to standard context entries.
   * @avalon.component name="demo" lifestyle="singleton" version="1.0"
   * @avalon.stage id="urn:demo:demonstratable"
   */
  public class HelloComponent extends AbstractLogEnabled 
    implements Demonstratable
  {
  
      /**
       * Do something or other.
       * @param stage the stage being applied (as a string)
       */
      public void demo( String stage )
      {
          getLogger().info( "extension said: " + stage );
      }
  
  }
  
  
  

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