avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/container/src/java/org/apache/excalibur/container/lifecycle LifecycleExtensionManager.java AbstractLifecycleExtensionManager.java
Date Wed, 13 Nov 2002 09:36:57 GMT
donaldp     2002/11/13 01:36:57

  Modified:    container/src/java/org/apache/excalibur/container/lifecycle
                        LifecycleExtensionManager.java
  Removed:     container/src/java/org/apache/excalibur/container/lifecycle
                        AbstractLifecycleExtensionManager.java
  Log:
  Merge abstract manager into main manager as offered little advantage to separate em
  
  Revision  Changes    Path
  1.3       +65 -2     jakarta-avalon-excalibur/container/src/java/org/apache/excalibur/container/lifecycle/LifecycleExtensionManager.java
  
  Index: LifecycleExtensionManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/container/src/java/org/apache/excalibur/container/lifecycle/LifecycleExtensionManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LifecycleExtensionManager.java	10 Nov 2002 03:36:31 -0000	1.2
  +++ LifecycleExtensionManager.java	13 Nov 2002 09:36:57 -0000	1.3
  @@ -54,6 +54,7 @@
   import java.util.Iterator;
   import java.util.List;
   import org.apache.avalon.framework.context.Context;
  +import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.excalibur.container.lifecycle.Accessor;
   import org.apache.excalibur.container.lifecycle.Creator;
   
  @@ -79,7 +80,7 @@
    * @version CVS $Revision$ $Date$
    */
   public class LifecycleExtensionManager
  -    extends AbstractLifecycleExtensionManager
  +    extends AbstractLogEnabled
   {
       public static final String ROLE = LifecycleExtensionManager.class.getName();
   
  @@ -299,6 +300,68 @@
       public void clearCreatorExtensions()
       {
           m_creatorExtensions.clear();
  +    }
  +    // Lifecycle method constants, these are passed to executeExtensions()
  +    protected static final int ACCESS = 0;
  +    protected static final int RELEASE = 1;
  +    protected static final int CREATE = 2;
  +    protected static final int DESTROY = 3;
  +
  +    /**
  +     * <code>executeExtensions</code> method, executes a given array of
  +     * lifecycle interfaces on a given component.
  +     *
  +     * @param component a <code>Component</code> instance
  +     * @param context   a <code>Context</code> instance
  +     * @param type      a constant, referencing which phase the
  +     *                  extensions array adheres to
  +     *
  +     * @exception Exception if an error occurs
  +     */
  +    protected void executeExtensions( final Object[] extensions,
  +                                      final Object component,
  +                                      final Context context,
  +                                      final int type )
  +        throws Exception
  +    {
  +        switch( type )
  +        {
  +            case ACCESS:
  +                for( int i = 0; i < extensions.length; ++i )
  +                {
  +                    ( (Accessor)extensions[ i ] ).access( component, context );
  +                }
  +                break;
  +
  +            case RELEASE:
  +                for( int i = 0; i < extensions.length; ++i )
  +                {
  +                    ( (Accessor)extensions[ i ] ).release( component, context );
  +                }
  +                break;
  +
  +            case CREATE:
  +                for( int i = 0; i < extensions.length; ++i )
  +                {
  +                    ( (Creator)extensions[ i ] ).create( component, context );
  +                }
  +                break;
  +
  +            case DESTROY:
  +                for( int i = 0; i < extensions.length; ++i )
  +                {
  +                    ( (Creator)extensions[ i ] ).destroy( component, context );
  +                }
  +                break;
  +
  +            default:
  +                if( getLogger().isErrorEnabled() )
  +                {
  +                    final String message =
  +                        "Incorrect extension phase specified: " + type;
  +                    getLogger().error( message );
  +                }
  +        }
       }
   
       /**
  
  
  

--
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