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-apps/enterprise/tools/src/java/org/apache/avalon/excalibur/service ServiceFactory.java package.html
Date Sun, 03 Mar 2002 23:34:40 GMT
mcconnell    02/03/03 15:34:40

  Modified:    enterprise/tools/lib merlin.jar
               enterprise/tools/src/java/org/apache/avalon/excalibur/service
                        ServiceFactory.java package.html
  Log:
  no message
  
  Revision  Changes    Path
  1.3       +60 -54    jakarta-avalon-apps/enterprise/tools/lib/merlin.jar
  
  	<<Binary file>>
  
  
  1.3       +20 -10    jakarta-avalon-apps/enterprise/tools/src/java/org/apache/avalon/excalibur/service/ServiceFactory.java
  
  Index: ServiceFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/enterprise/tools/src/java/org/apache/avalon/excalibur/service/ServiceFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServiceFactory.java	3 Mar 2002 23:08:26 -0000	1.2
  +++ ServiceFactory.java	3 Mar 2002 23:34:40 -0000	1.3
  @@ -36,7 +36,6 @@
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.avalon.framework.component.DefaultComponentManager;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.service.Serviceable;
   import org.apache.avalon.framework.service.ServiceManager;
  @@ -121,6 +120,25 @@
           }
       }
   
  +    private ComponentManager createComponentManager( DependencyInfo[] dependencies ) throws
ServiceException
  +    {
  +        Hashtable providers = new Hashtable();
  +        try
  +        {
  +            for( int i=0; i<dependencies.length; i++ )
  +            {
  +                DependencyInfo info = dependencies[i];
  +                providers.put( info.getRole(), getProvider( info ));
  +            }
  +            return new DefaultComponentManager( providers );
  +        }
  +        catch( Throwable e )
  +        {
  +            final String error = "Unexpected exception while attempting to create a ComponentManager.";
  +            throw new ServiceException( error, e );
  +        }
  +    }
  +
       private Object getProvider( DependencyInfo info ) throws Exception
       {
   
  @@ -307,16 +325,8 @@
           else if( m_object instanceof Composable ) try
           {
               if( m_verbose ) getLogger().debug( role + " composition" );
  -            DefaultComponentManager manager = new DefaultComponentManager();
               DependencyInfo[] dependencies = info.getDependencies();
  -            for( int i=0; i<dependencies.length; i++ )
  -            {
  -                DependencyInfo dependency = dependencies[i];
  -                String dependency_role = dependency.getRole();
  -                UnitInfo block_info = m_registry.lookup( dependency );
  -                Object object = pipeline( block_info, dependency_role );
  -                manager.put( dependency_role, (Component) object );
  -            }
  +            ComponentManager manager = createComponentManager( dependencies );
               ((Composable)m_object).compose( manager );
           }
           catch( Throwable e )
  
  
  
  1.4       +1 -1      jakarta-avalon-apps/enterprise/tools/src/java/org/apache/avalon/excalibur/service/package.html
  
  Index: package.html
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/enterprise/tools/src/java/org/apache/avalon/excalibur/service/package.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- package.html	3 Mar 2002 23:08:26 -0000	1.3
  +++ package.html	3 Mar 2002 23:34:40 -0000	1.4
  @@ -138,7 +138,7 @@
         (b) TRANSIENT, manager is a factory of transient service instances 
         (c) OTHER, (default) The container will check if the class implements 
         the org.apache.excalibur.mpool.Pool interface.  If true, <code>lookup</code>

  -      and <code>release</code> invocations will be redirected to the pools
<code>aquire</code> and 
  +      and <code>release</code> invocations will be redirected to the pools
<code>acquire</code> and 
         <code>release</code> methods - otherwise, the class will be registered
under the 
         TRANSIENT policy.
         --&gt;</i></font>
  
  
  

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