donaldp     2002/08/19 05:30:42

  Modified:    containerkit/src/java/org/apache/excalibur/containerkit/kernel
                        AbstractServiceKernel.java
               containerkit/src/java/org/apache/excalibur/containerkit/dependency
                        DependencyMap.java
  Log:
  Use store in DependencyMap aswell.
  
  Revision  Changes    Path
  1.22      +2 -3      
jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/kernel/AbstractServiceKernel.java
  
  Index: AbstractServiceKernel.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/kernel/AbstractServiceKernel.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- AbstractServiceKernel.java        19 Aug 2002 12:12:35 -0000      1.21
  +++ AbstractServiceKernel.java        19 Aug 2002 12:30:42 -0000      1.22
  @@ -60,7 +60,7 @@
        * The {@link DependencyMap} via which dependency graph is
        * produced.
        */
  -    private final DependencyMap m_dependencyMap = new DependencyMap();
  +    private final DependencyMap m_dependencyMap = new DependencyMap( m_store );
   
       /**
        * Initialization of the kernel.  The implementation will request
  @@ -191,7 +191,6 @@
           final ComponentInfo info = m_factory.createInfo( 
component.getImplementationKey() );
           final ComponentEntry entry = new ComponentEntry( info, component );
           m_store.addComponent( entry );
  -        m_dependencyMap.add( entry );
       }
   
       protected final Object getComponent( final String name )
  
  
  
  1.13      +22 -31    
jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/dependency/DependencyMap.java
  
  Index: DependencyMap.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/dependency/DependencyMap.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DependencyMap.java        18 Aug 2002 03:46:07 -0000      1.12
  +++ DependencyMap.java        19 Aug 2002 12:30:42 -0000      1.13
  @@ -8,10 +8,12 @@
   package org.apache.excalibur.containerkit.dependency;
   
   import java.util.ArrayList;
  +import java.util.Collection;
   import org.apache.excalibur.containerkit.metadata.DependencyMetaData;
   import org.apache.excalibur.containerkit.metadata.ComponentMetaData;
   import org.apache.avalon.framework.info.DependencyDescriptor;
   import org.apache.excalibur.containerkit.kernel.ComponentEntry;
  +import org.apache.excalibur.containerkit.store.ComponentStore;
   
   /**
    * Utility class to help aquire a ordered graph of
  @@ -40,16 +42,18 @@
        * The set of components in assembly.
        * Used when searching for providers/consumers.
        */
  -    private final ArrayList m_components = new ArrayList();
  +    private final ComponentStore m_store;
   
  -    public DependencyMap()
  +    public DependencyMap( final ComponentStore store )
       {
  -        this( null );
  +        this( null, store );
       }
   
  -    public DependencyMap( final DependencyMap parent )
  +    public DependencyMap( final DependencyMap parent,
  +                          final ComponentStore store )
       {
           m_parent = parent;
  +        m_store = store;
       }
   
       /**
  @@ -73,16 +77,6 @@
       }
   
       /**
  -     * Add a component to current dependency graph.
  -     *
  -     * @param component the component
  -     */
  -    public void add( final ComponentEntry component )
  -    {
  -        m_components.add( component );
  -    }
  -
  -    /**
        * Get the serilized graph of {@link ComponentEntry} objects
        * required when starting up all the components. This makes sure
        * that all providers occur before their coresponding
  @@ -164,11 +158,12 @@
           final ArrayList result = new ArrayList();
           final ArrayList done = new ArrayList();
   
  -        final int size = m_components.size();
  -        for( int i = 0; i < size; i++ )
  +        final Collection components = m_store.getComponents();
  +        final ComponentEntry[] entrySet =
  +            (ComponentEntry[])components.toArray( new ComponentEntry[ 
components.size() ] );
  +        for( int i = 0; i < entrySet.length; i++ )
           {
  -            final ComponentEntry component =
  -                (ComponentEntry)m_components.get( i );
  +            final ComponentEntry component = entrySet[ i ];
               visitcomponent( component,
                               providers,
                               done,
  @@ -256,11 +251,12 @@
       {
           final String name = component.getMetaData().getName();
   
  -        final int size = m_components.size();
  -        for( int i = 0; i < size; i++ )
  +        final Collection components = m_store.getComponents();
  +        final ComponentEntry[] entrySet =
  +            (ComponentEntry[])components.toArray( new ComponentEntry[ 
components.size() ] );
  +        for( int i = 0; i < entrySet.length; i++ )
           {
  -            final ComponentEntry other =
  -                (ComponentEntry)m_components.get( i );
  +            final ComponentEntry other = entrySet[ i ];
               final DependencyMetaData[] roles =
                   other.getMetaData().getDependencies();
   
  @@ -290,15 +286,10 @@
        */
       private ComponentEntry getComponent( final String name )
       {
  -        final int size = m_components.size();
  -        for( int i = 0; i < size; i++ )
  +        final ComponentEntry component = m_store.getComponent( name );
  +        if( null != component )
           {
  -            final ComponentEntry component =
  -                (ComponentEntry)m_components.get( i );
  -            if( component.getMetaData().getName().equals( name ) )
  -            {
  -                return component;
  -            }
  +            return component;
           }
   
           if( null != m_parent )
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to