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-excalibur/assembly/src/java/org/apache/excalibur/merlin/model ContainerDescriptor.java
Date Sat, 13 Jul 2002 13:39:00 GMT
mcconnell    2002/07/13 06:39:00

  Modified:    assembly build.xml
               assembly/src/java/org/apache/excalibur/merlin/container
                        DefaultContainer.java ProfileRegistry.java
               assembly/src/java/org/apache/excalibur/merlin/kernel
                        DefaultKernel.java
               assembly/src/java/org/apache/excalibur/merlin/model
                        ContainerDescriptor.java
  Log:
  added support for dynamic container and component profile addition to the mata dat model
  
  Revision  Changes    Path
  1.18      +3 -3      jakarta-avalon-excalibur/assembly/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/build.xml,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- build.xml	12 Jul 2002 20:35:11 -0000	1.17
  +++ build.xml	13 Jul 2002 13:39:00 -0000	1.18
  @@ -268,9 +268,9 @@
   
     <target name="patch">
       <replace 
  -       token="getContextDescriptor" 
  -       value="getContext" dir="src/java">
  -     <include name="org/apache/excalibur/**/*.*"/>
  +       token="getComponentProfiles" 
  +       value="getComponents" dir="src/java">
  +     <include name="org/apache/excalibur/merlin/**/*.*"/>
       </replace>
     </target>
   
  
  
  
  1.5       +5 -2      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/DefaultContainer.java
  
  Index: DefaultContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/DefaultContainer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultContainer.java	12 Jul 2002 19:09:26 -0000	1.4
  +++ DefaultContainer.java	13 Jul 2002 13:39:00 -0000	1.5
  @@ -221,7 +221,7 @@
           //
   
           getLogger().debug("explicit profile registration");
  -        ComponentProfile[] children = m_descriptor.getComponentProfiles();
  +        ComponentProfile[] children = m_descriptor.getComponents();
           for( int i=0; i<children.length; i++ )
           {
               m_profiles.register( children[i] );
  @@ -370,6 +370,8 @@
           {
               ((Controller)iterator.next()).startup();
           }
  +
  +        getLogger().info("container startup complete");
       }
   
       public void shutdown()
  @@ -388,6 +390,7 @@
               ((Controller)iterator.next()).shutdown();
           }
           stop();
  +        getLogger().info("container shutdown complete");
       }
   
       //=======================================================================
  
  
  
  1.5       +3 -3      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/ProfileRegistry.java
  
  Index: ProfileRegistry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/ProfileRegistry.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ProfileRegistry.java	12 Jul 2002 19:09:26 -0000	1.4
  +++ ProfileRegistry.java	13 Jul 2002 13:39:00 -0000	1.5
  @@ -114,7 +114,7 @@
       public Profile[] getProviders( ServiceDesignator designator )
       {
           ArrayList list = new ArrayList();
  -        ComponentProfile[] local = m_descriptor.getComponentProfiles();
  +        ComponentProfile[] local = m_descriptor.getComponents();
           for( int i=0; i<local.length; i++ )
           {
               Profile profile = local[i];
  @@ -155,7 +155,7 @@
       */
       public void assembleProfiles() throws Exception
       {
  -        Profile[] profiles = m_descriptor.getComponentProfiles();
  +        Profile[] profiles = m_descriptor.getComponents();
           for( int i=0; i<profiles.length; i++ )
           {
               Profile profile = profiles[i];
  
  
  
  1.14      +4 -1      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultKernel.java
  
  Index: DefaultKernel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultKernel.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DefaultKernel.java	13 Jul 2002 00:09:45 -0000	1.13
  +++ DefaultKernel.java	13 Jul 2002 13:39:00 -0000	1.14
  @@ -233,6 +233,8 @@
               getLogger().error( error, e );
               throw new KernelException( error, e );
           }
  +
  +        getLogger().info("startup complete");
       }
   
       public void shutdown()
  @@ -241,5 +243,6 @@
           if( getLogger().isInfoEnabled() )
             getLogger().info("shutdown");
           m_container.shutdown();
  +        getLogger().info("shutdown complete");
       }
   }
  
  
  
  1.3       +34 -26    jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/ContainerDescriptor.java
  
  Index: ContainerDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/ContainerDescriptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContainerDescriptor.java	12 Jul 2002 19:09:27 -0000	1.2
  +++ ContainerDescriptor.java	13 Jul 2002 13:39:00 -0000	1.3
  @@ -40,13 +40,13 @@
       /**
        * The component described within the scope of the container.
        */
  -    //private final ArrayList m_components = new ArrayList();
  -    private final ComponentProfile[] m_components;
  +    private final ArrayList m_components = new ArrayList();
   
       /**
        * The component described within the scope of the container.
        */
  -    private final ContainerDescriptor[] m_containers;
  +    //private final ContainerDescriptor[] m_containers;
  +    private final ArrayList m_containers = new ArrayList();
   
       /**
        * Create a ContainerDescriptor instance.
  @@ -66,16 +66,14 @@
           m_name = name;
           m_loggers = loggers;
           m_classpath = classpath;
  -        m_components = components;
  -        m_containers = containers;
   
           for( int i=0; i<containers.length; i++ )
           {
  -            containers[i].getCategoryDescriptor().setParent( loggers );
  +            addContainer( containers[i] );
           }
           for( int i=0; i<components.length; i++ )
           {
  -            components[i].getCategoryDescriptor().setParent( loggers );
  +            addComponent( components[i] );
           }
       }
   
  @@ -110,25 +108,42 @@
       }
   
       /**
  -     * Add a container to this container.
  +     * Add a component profile to this container.
        *
  -     * @parent the container to add
  +     * @param component the component profile to add to the container
        */
  -    //public void addComponent( ComponentProfile component )
  -    //{
  -    //    m_components.add( component );
  -    //    component.getCategoryDescriptor().setParent( getCategoryDescriptor() );
  -    //}
  +    public void addComponent( ComponentProfile component )
  +    {
  +        if( !m_components.contains( component ) )
  +        {
  +            m_components.add( component );
  +            component.getCategoryDescriptor().setParent( getCategoryDescriptor() );
  +        }
  +    }
   
       /**
        * Return the set of component descriptors contained within this container.
        *
        * @return the target descriptors
        */
  -    public ComponentProfile[] getComponentProfiles()
  +    public ComponentProfile[] getComponents()
  +    {
  +        return (ComponentProfile[]) m_components.toArray( new ComponentProfile[0] );
  +    }
  +
  +    /**
  +     * Add a container profile to this container.
  +     *
  +     * @parent the container to add
  +     */
  +    public void addContainer( ContainerDescriptor container )
       {
  -        //return (ComponentProfile[]) m_components.toArray( new ComponentProfile[0] );
  -        return m_components;
  +        if( !m_containers.contains( container ) )
  +        {
  +            m_containers.add( container );
  +            container.getCategoryDescriptor().setParent( getCategoryDescriptor() );
  +            container.setParent( this );
  +        }
       }
   
       /**
  @@ -138,10 +153,9 @@
        */
       public ContainerDescriptor[] getContainers()
       {
  -        return m_containers;
  +        return (ContainerDescriptor[]) m_containers.toArray( new ContainerDescriptor[0]
);
       }
   
  -
       /**
        * Set the parent container.
        *
  @@ -154,12 +168,6 @@
            throw new IllegalStateException("parent");
   
          m_parent = parent;
  -
  -       ContainerDescriptor[] containers = getContainers();
  -       for( int i=0; i<containers.length; i++ )
  -       {
  -          containers[i].setParent( this );
  -       }
       }
   
       /**
  
  
  

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