avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/startup DefaultStartupService.java StartupService.java package.html
Date Sat, 18 Jan 2003 20:45:58 GMT
mcconnell    2003/01/18 12:45:58

  Modified:    assembly/src/java/org/apache/avalon/assembly/lifecycle
                        DefaultDeploymentService.java
               assembly/src/java/org/apache/avalon/assembly/lifecycle/initialization
                        DefaultInitializationService.java
                        ExtendedInitializationService.java
                        InitializationService.java
  Removed:     assembly/src/java/org/apache/avalon/assembly/lifecycle/startup
                        DefaultStartupService.java StartupService.java
                        package.html
  Log:
  Removed startup service - refactor initialization service to handle Startup as part of the
Avalon 4 initialization strategy.
  
  Revision  Changes    Path
  1.15      +9 -45     avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/DefaultDeploymentService.java
  
  Index: DefaultDeploymentService.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/DefaultDeploymentService.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DefaultDeploymentService.java	18 Jan 2003 16:19:32 -0000	1.14
  +++ DefaultDeploymentService.java	18 Jan 2003 20:45:58 -0000	1.15
  @@ -78,8 +78,6 @@
   import org.apache.avalon.assembly.lifecycle.initialization.InitializationService;
   import org.apache.avalon.assembly.lifecycle.initialization.ExtendedInitializationService;
   import org.apache.avalon.assembly.lifecycle.initialization.DefaultInitializationService;
  -import org.apache.avalon.assembly.lifecycle.startup.StartupService;
  -import org.apache.avalon.assembly.lifecycle.startup.DefaultStartupService;
   import org.apache.avalon.assembly.lifecycle.disposal.DisposalService;
   import org.apache.avalon.assembly.lifecycle.disposal.DefaultDisposalService;
   import org.apache.avalon.assembly.lifecycle.disposal.ExtendedDisposalService;
  @@ -108,7 +106,6 @@
       private ParameterizationService m_parameters;
       private CompositionService m_composition;
       private InitializationService m_initialization;
  -    private StartupService m_startup;
       private DisposalService m_disposal;
   
       private boolean m_initialized = false;
  @@ -204,16 +201,6 @@
               m_initialization = makeInitializationService();
           }
   
  -        key = "urn:assembly:lifecycle.startup"; 
  -        if( m_context.hasEntry( key ) )
  -        {
  -            m_startup = (StartupService) m_context.get( key );
  -        }
  -        else
  -        {
  -            m_startup = makeStartupService();
  -        }
  -
           key = "urn:assembly:lifecycle.disposal"; 
           if( m_context.hasEntry( key ) )
           {
  @@ -286,10 +273,6 @@
               m_configuration.configure( appliance, instance );
               m_parameters.parameterize( appliance, instance );
               m_initialization.initialize( appliance, instance );
  -            if( appliance.getStartupPolicy() )
  -            {
  -                m_startup.start( appliance, instance );
  -            }
               return instance;
           }
           catch( Throwable e )
  @@ -328,18 +311,15 @@
               appliance.disassemble();
           }
   
  -        if( appliance.getStartupPolicy() )
  +        try
           {
  -            try
  -            {
  -                m_startup.stop( appliance, instance );
  -            }
  -            catch( Throwable e )
  -            {
  -                final String warning = 
  -                  "Ignoring shutdown error raised by component: " + appliance;
  -                getLogger().warn( warning, e );
  -            }
  +            m_initialization.deinitialize( appliance, instance );
  +        }
  +        catch( Throwable e )
  +        {
  +            final String warning = 
  +              "Ignoring shutdown error raised by component: " + appliance;
  +            getLogger().warn( warning, e );
           }
   
           m_disposal.dispose( appliance, instance );
  @@ -456,22 +436,6 @@
           {
               final String error = 
                 "Internal error while attempting to build the bootstrap initialization service.";
  -            throw new DeploymentException( error, e );
  -        }
  -    }
  -
  -    private StartupService makeStartupService() throws DeploymentException
  -    {
  -        try
  -        {
  -            DefaultStartupService service = new DefaultStartupService();
  -            service.enableLogging( getLogger().getChildLogger( "startup" ) );
  -            return service;
  -        }
  -        catch( Throwable e )
  -        {
  -            final String error = 
  -              "Internal error while attempting to build the bootstrap startup service.";
               throw new DeploymentException( error, e );
           }
       }
  
  
  
  1.4       +45 -4     avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/initialization/DefaultInitializationService.java
  
  Index: DefaultInitializationService.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/initialization/DefaultInitializationService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultInitializationService.java	21 Dec 2002 03:28:37 -0000	1.3
  +++ DefaultInitializationService.java	18 Jan 2003 20:45:58 -0000	1.4
  @@ -51,6 +51,7 @@
   package org.apache.avalon.assembly.lifecycle.initialization;
   
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.avalon.framework.activity.Startable;
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.assembly.appliance.Appliance;
   
  @@ -73,8 +74,8 @@
       public void initialize( Appliance appliance, Object object ) 
         throws Exception
       {
  -       if( object instanceof Initializable )
  -       {
  +        if( object instanceof Initializable )
  +        {
               if( getLogger().isDebugEnabled() )
               {
                   final String message =  
  @@ -82,6 +83,46 @@
                   getLogger().debug( message );
               }
              ((Initializable)object).initialize();
  -       }
  +        }
  +
  +        if( appliance.getStartupPolicy() && ( object instanceof Startable ) )
  +        {
  +            if( getLogger().isDebugEnabled() )
  +            {
  +                final String message = "starting " + appliance;
  +                getLogger().debug( message );
  +            }
  +            ((Startable)object).start();
  +        }
       }
  +
  +   /**
  +    * Deinitialize a supplied object in accordance with the parameters 
  +    * associated with the supplied appliance.
  +    * @param appliance the appliace
  +    * @param object the object to deinitialize
  +    */
  +    public void deinitialize( Appliance appliance, Object object ) 
  +      throws Exception
  +    {
  +        if( appliance == null )
  +        {
  +            throw new NullPointerException( "appliance" );
  +        }
  +        if( object == null )
  +        {
  +            throw new NullPointerException( "object" );
  +        }
  +
  +        if( appliance.getStartupPolicy() && ( object instanceof Startable ) )
  +        {
  +            if( getLogger().isDebugEnabled() )
  +            {
  +                final String message = "stopping " + appliance;
  +                getLogger().debug( message );
  +            }
  +            ((Startable)object).stop();
  +        }
  +    }
  +
   }
  
  
  
  1.13      +3 -11     avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/initialization/ExtendedInitializationService.java
  
  Index: ExtendedInitializationService.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/initialization/ExtendedInitializationService.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ExtendedInitializationService.java	15 Jan 2003 09:09:25 -0000	1.12
  +++ ExtendedInitializationService.java	18 Jan 2003 20:45:58 -0000	1.13
  @@ -74,7 +74,7 @@
    * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
    * @version $Revision$ $Date$
    */
  -public class ExtendedInitializationService extends AbstractLogEnabled implements InitializationService
  +public class ExtendedInitializationService extends DefaultInitializationService
   {
      /**
       * Initialize a supplied object in accordance with the parameters 
  @@ -169,14 +169,6 @@
           // and finally, initialize the component
           //
   
  -        if( object instanceof Initializable )
  -        {
  -            if( getLogger().isDebugEnabled() )
  -            {
  -                final String message = "initialization " + appliance;
  -                getLogger().debug( message );
  -            }
  -            ((Initializable)object).initialize();
  -        }
  +        super.initialize( appliance, object );
       }
   }
  
  
  
  1.2       +11 -2     avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/initialization/InitializationService.java
  
  Index: InitializationService.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/initialization/InitializationService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InitializationService.java	29 Nov 2002 13:04:55 -0000	1.1
  +++ InitializationService.java	18 Jan 2003 20:45:58 -0000	1.2
  @@ -67,8 +67,17 @@
       * Initialize a supplied object in accordance with the parameters 
       * associated with the supplied appliance.
       * @param appliance the appliace
  -    * @param object the object to parameterize
  +    * @param object the object to initialize
       */
       void initialize( Appliance appliance, Object object ) 
  +      throws Exception;
  +
  +   /**
  +    * Deinitialize a supplied object in accordance with the parameters 
  +    * associated with the supplied appliance.
  +    * @param appliance the appliace
  +    * @param object the object to deinitialize
  +    */
  +    void deinitialize( Appliance appliance, Object object ) 
         throws Exception;
   }
  
  
  

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