cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components LifecycleHelper.java
Date Wed, 16 Jul 2003 22:46:23 GMT
bruno       2003/07/16 15:46:21

  Modified:    src/java/org/apache/cocoon/components LifecycleHelper.java
  Log:
  support Serviceable
  
  Revision  Changes    Path
  1.2       +50 -2     cocoon-2.1/src/java/org/apache/cocoon/components/LifecycleHelper.java
  
  Index: LifecycleHelper.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/LifecycleHelper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LifecycleHelper.java	9 Mar 2003 00:08:46 -0000	1.1
  +++ LifecycleHelper.java	16 Jul 2003 22:46:20 -0000	1.2
  @@ -64,6 +64,8 @@
   import org.apache.avalon.framework.logger.LogKitLogger;
   import org.apache.avalon.framework.parameters.Parameterizable;
   import org.apache.avalon.framework.parameters.Parameters;
  +import org.apache.avalon.framework.service.ServiceManager;
  +import org.apache.avalon.framework.service.Serviceable;
   
   import org.apache.avalon.excalibur.component.RoleManageable;
   import org.apache.avalon.excalibur.component.RoleManager;
  @@ -96,6 +98,10 @@
        */
       private ComponentManager        m_componentManager;
   
  +    /** The service manager for this component.
  +     */
  +    private ServiceManager        m_serviceManager;
  +
       /** The configuration for this component.
        */
       private Configuration           m_configuration;
  @@ -136,6 +142,21 @@
           m_configuration = configuration;
       }
   
  +    public LifecycleHelper( final Logger logger,
  +            final Context context,
  +            final ServiceManager serviceManager,
  +            final RoleManager roles,
  +            final LogKitManager logkit,
  +            final Configuration configuration )
  +    {
  +        m_logger = logger;
  +        m_context = context;
  +        m_serviceManager = serviceManager;
  +        m_roles = roles;
  +        m_logkit = logkit;
  +        m_configuration = configuration;
  +    }
  +
       /**
        * Setup a component, including initialization and start.
        *
  @@ -165,6 +186,7 @@
           return setupComponent( component,
                   m_logger,
                   m_context,
  +                m_serviceManager,
                   m_componentManager,
                   m_roles,
                   m_logkit,
  @@ -209,6 +231,28 @@
               final boolean initializeAndStart )
           throws Exception
       {
  +        return setupComponent( component,
  +                logger,
  +                context,
  +                null,
  +                componentManager,
  +                roles,
  +                logkit,
  +                configuration,
  +                initializeAndStart);
  +    }
  +
  +    static Object setupComponent( final Object component,
  +            final Logger logger,
  +            final Context context,
  +            final ServiceManager serviceManager,
  +            final ComponentManager componentManager,
  +            final RoleManager roles,
  +            final LogKitManager logkit,
  +            final Configuration configuration,
  +            final boolean initializeAndStart )
  +        throws Exception
  +    {
           if( component instanceof LogEnabled )
           {
               Logger usedLogger;
  @@ -242,7 +286,11 @@
               ((Contextualizable)component).contextualize( context );
           }
   
  -        if( null != componentManager && component instanceof Composable )
  +        if( null != serviceManager && component instanceof Serviceable )
  +        {
  +            ((Serviceable)component).service( serviceManager );
  +        }
  +        else if( null != componentManager && component instanceof Composable )
           {
               ((Composable)component).compose( componentManager );
           }
  
  
  

Mime
View raw message