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-phoenix/src/java/org/apache/avalon/phoenix/components/application LifecycleHelper.java
Date Thu, 21 Feb 2002 16:35:46 GMT
mcconnell    02/02/21 08:35:46

  Modified:    src/java/org/apache/avalon/phoenix/components/application
                        LifecycleHelper.java
  Log:
  updated to include Serviceable interface
  
  Revision  Changes    Path
  1.29      +24 -0     jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/application/LifecycleHelper.java
  
  Index: LifecycleHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/application/LifecycleHelper.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- LifecycleHelper.java	26 Jan 2002 08:22:43 -0000	1.28
  +++ LifecycleHelper.java	21 Feb 2002 16:35:46 -0000	1.29
  @@ -17,6 +17,9 @@
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.component.DefaultComponentManager;
  +import org.apache.avalon.framework.service.ServiceManager;
  +import org.apache.avalon.framework.service.Serviceable;
  +import org.apache.avalon.framework.service.DefaultServiceManager;
   import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  @@ -234,6 +237,12 @@
                   final ComponentManager componentManager = createComponentManager( metaData
);
                   ( (Composable)block ).compose( componentManager );
               }
  +            else if( block instanceof Serviceable )
  +            {
  +                notice( name, stage );
  +                final ServiceManager manager = createServiceManager( metaData );
  +                ( (Serviceable)block ).service( manager );
  +            }
   
               //Configuring stage
               stage = STAGE_CONFIG;
  @@ -491,6 +500,21 @@
           }
   
           return componentManager;
  +    }
  +
  +    private ServiceManager createServiceManager( final BlockMetaData metaData )
  +    {
  +        final DefaultServiceManager manager = new DefaultServiceManager();
  +        final DependencyMetaData[] roles = metaData.getDependencies();
  +
  +        for( int i = 0; i < roles.length; i++ )
  +        {
  +            final DependencyMetaData role = roles[ i ];
  +            final Block dependency = m_application.getBlock( role.getName() );
  +            manager.put( role.getRole(), dependency );
  +        }
  +
  +        return manager;
       }
   
       /**
  
  
  

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