avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/merlin/src/test/org/apache/avalon/playground StandardComponent.xinfo
Date Fri, 20 Dec 2002 11:58:01 GMT
mcconnell    2002/12/20 03:58:01

  Modified:    merlin   THE-RED-PILL.TXT
               merlin/src/java/org/apache/avalon/merlin/block
                        BlockLoader.java
               merlin/src/java/org/apache/avalon/merlin/container
                        ContainerLoader.java DefaultContainer.java
               merlin/src/java/org/apache/avalon/merlin/kernel
                        DefaultKernel.java
               merlin/src/java/org/apache/avalon/merlin/service
                        DefaultRegistry.java
               merlin/src/test/config block.xml
               merlin/src/test/org/apache/avalon/playground
                        StandardComponent.xinfo
  Log:
  Enhanced partition name management and registry related code.
  
  Revision  Changes    Path
  1.2       +1 -1      avalon-sandbox/merlin/THE-RED-PILL.TXT
  
  Index: THE-RED-PILL.TXT
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/THE-RED-PILL.TXT,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- THE-RED-PILL.TXT	4 Dec 2002 17:37:53 -0000	1.1
  +++ THE-RED-PILL.TXT	20 Dec 2002 11:58:00 -0000	1.2
  @@ -10,7 +10,7 @@
   # an evalon-meta/assembly deployment engine and logs some stuff in the 
   # process - interesting but not terribly valuable at the moment.
   #
  -# Pl,ease not - this code base is evolving daily as part of refactoring of the
  +# Please not - this code base is evolving daily as part of refactoring of the
   # Excalibur/assembly package. On completion there wil be a clean seperation of 
   # the internals containerment systems from the application notions of contaier 
   # hierachies.  The containement API element will be located under 
  
  
  
  1.7       +14 -3     avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/block/BlockLoader.java
  
  Index: BlockLoader.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/block/BlockLoader.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BlockLoader.java	17 Dec 2002 09:59:47 -0000	1.6
  +++ BlockLoader.java	20 Dec 2002 11:58:00 -0000	1.7
  @@ -203,6 +203,16 @@
           return (Block[]) blocks.toArray( new Block[0] );
       }
   
  +   /**
  +    * Load a block.  The implemention is provided with the parent engine and registry
  +    * and handles the creation of subsidiary systems.
  +    * 
  +    * @param parent the parent engine
  +    * @param registry the system registry
  +    * @param home the system home
  +    * @param url the block URL
  +    * @param system the system context
  +    */
       private Block loadBlock( 
         EngineClassLoader parent, Registry registry, File home, URL url, Context system )

         throws Exception
  @@ -241,15 +251,16 @@
   
           Configuration engineConfig = config.getChild( "engine" );
           EngineClassLoader engine = createChildEngine( parent, home, engineConfig, url,
logger );
  +        Registry childRegistry = registry.createChild( name );
   
           //
           // create and root container
           //
   
           Configuration containerConfig = config.getChild( "container" );
  -        Appliance appliance = createContainer( engine, registry, name, home, containerConfig,
logger );
  -        Logger child = getLogger().getChildLogger( name );
  +        Appliance appliance = createContainer( engine, childRegistry, name, home, containerConfig,
logger );
           DefaultBlock block = new DefaultBlock( appliance, url, manifest );
  +        Logger child = getLogger().getChildLogger( name );
           block.enableLogging( child );
   
           if( getLogger().isDebugEnabled() )
  
  
  
  1.6       +10 -19    avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/container/ContainerLoader.java
  
  Index: ContainerLoader.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/container/ContainerLoader.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ContainerLoader.java	19 Dec 2002 10:50:16 -0000	1.5
  +++ ContainerLoader.java	20 Dec 2002 11:58:00 -0000	1.6
  @@ -131,7 +131,7 @@
         EngineClassLoader engine, Registry registry, String name, File home, Configuration
config, Logger logger )
         throws Exception
       {
  -        return createContainer( engine, registry, name, home, config, logger, null );
  +        return createContainer( engine, registry, name, home, config, logger, "/" );
       }
   
      /**
  @@ -181,27 +181,16 @@
   
               if( partition == null )
               {
  -                childName = name;
  -                childLogger = logger;
  -                childEngine = engine;
  -                childPartition = name;
  -                childRegistry = registry;
  +                childPartition = name + "/";
               }
               else
               {
  -                childName = childConfig.getAttribute( "name", "untitled" );
  -                childLogger = logger.getChildLogger( childName );
  -                childEngine = childEngine = createChildEngine( engine, home, childConfig,
childLogger );
  -                if( partition.endsWith( "/" ) )
  -                {
  -                    childPartition = partition + "/" + name;
  -                }
  -                else
  -                {
  -                    childPartition = partition + name;
  -                }
  -                childRegistry = registry.createChild( name );
  +                childPartition = partition + name + "/";
               }
  +            childName = childConfig.getAttribute( "name", "untitled" );
  +            childLogger = logger.getChildLogger( childName );
  +            childEngine = childEngine = createChildEngine( engine, home, childConfig, childLogger
);
  +            childRegistry = registry.createChild( name );
   
               //
               // recursively call this method to create the subsidiary containers
  @@ -230,7 +219,9 @@
           {
               map.put("urn:avalon:partition.name", "" );
           }
  +
           ApplianceContext context = new ApplianceContext( descriptor );
  +        context.setName( name );
           context.setDeploymentContext( map );
           if( partition != null )
           {
  
  
  
  1.5       +10 -10    avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/container/DefaultContainer.java
  
  Index: DefaultContainer.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/container/DefaultContainer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultContainer.java	19 Dec 2002 10:50:16 -0000	1.4
  +++ DefaultContainer.java	20 Dec 2002 11:58:00 -0000	1.5
  @@ -167,16 +167,16 @@
           {
               if( m_partition.endsWith("/") )
               {
  -                m_path = m_partition + "/" + m_descriptor.getName();
  +                m_path = m_partition + m_descriptor.getName() + "/";
               }
               else
               {
  -                m_path = m_partition + m_descriptor.getName();
  +                m_path = m_partition + "/" + m_descriptor.getName() + "/";
               }
           }
           else
           {
  -            m_path = m_descriptor.getName();
  +            m_path = m_descriptor.getName() + "/";
           }
   
           if( getLogger().isDebugEnabled() )
  @@ -204,7 +204,7 @@
               if( getLogger().isDebugEnabled() )
               {
                   final String message =
  -                  "activating container: [" + appliance.getProfile().getName() + "]"; 
  +                  "activating container: [" + appliance.getName() + "]"; 
                   getLogger().debug( message );
               }
   
  @@ -217,7 +217,7 @@
               {
                   final String error =
                     "Could not establish a sub-container: " 
  -                     + appliance.getProfile().getName() 
  +                     + appliance.getName() 
                        + " in container: " + this;
                   throw new ContainerException( error, e );
               }
  @@ -315,7 +315,7 @@
               if( getLogger().isDebugEnabled() )
               {
                   final String message =
  -                  "activating component: [" + appliance.getProfile().getName() + "]"; 
  +                  "activating component: [" + appliance.getName() + "]"; 
                   getLogger().debug( message );
               }
   
  @@ -328,7 +328,7 @@
               {
                   final String error =
                     "Could not establish a component: " 
  -                     + appliance.getProfile().getName() 
  +                     + appliance.getName() 
                        + " in container: " + this;
                   throw new ContainerException( error, e );
               }
  @@ -354,7 +354,7 @@
               {
                   final String error =
                     "Could not start a subsidiary container: " 
  -                     + appliance.getProfile().getName() 
  +                     + appliance.getName() 
                        + " in container: " + this;
                   throw new ContainerException( error, e );
               }
  @@ -424,7 +424,7 @@
               {
                   final String error =
                     "Could not shutdown a subsidiary container: " 
  -                     + appliance.getProfile().getName() 
  +                     + appliance.getName() 
                        + " in container: " + this;
                   throw new ContainerException( error, e );
               }
  
  
  
  1.14      +3 -3      avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/kernel/DefaultKernel.java
  
  Index: DefaultKernel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/kernel/DefaultKernel.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DefaultKernel.java	19 Dec 2002 10:50:17 -0000	1.13
  +++ DefaultKernel.java	20 Dec 2002 11:58:00 -0000	1.14
  @@ -386,7 +386,7 @@
           // list the registered services
           //
   
  -        Appliance[] appliances = m_registry.getAppliances();
  +        URL[] appliances = m_registry.list();
           if( appliances.length == 0 )
           {
               getLogger().info( "empty registry" ); 
  @@ -395,7 +395,7 @@
           {
               for( int i=0; i<appliances.length; i++ )
               {
  -               getLogger().info("registry: " + appliances[i].getURL() ); 
  +               getLogger().info("registry: " + appliances[i] ); 
               }
           }
       }
  
  
  
  1.2       +19 -13    avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/service/DefaultRegistry.java
  
  Index: DefaultRegistry.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/service/DefaultRegistry.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultRegistry.java	17 Dec 2002 09:58:46 -0000	1.1
  +++ DefaultRegistry.java	20 Dec 2002 11:58:01 -0000	1.2
  @@ -217,7 +217,7 @@
       {
           synchronized( m_appliances )
           {
  -            final String name = appliance.getProfile().getName();
  +            final String name = appliance.getName();
               if( m_appliances.get( name ) != null )
               {
                   final String error = "Duplicate name: " + name;
  @@ -238,7 +238,7 @@
       {
           synchronized( m_appliances )
           {
  -            String name = appliance.getProfile().getName();
  +            String name = appliance.getName();
               Iterator iterator = m_appliances.entrySet().iterator();
               while( iterator.hasNext() )
               {
  @@ -363,30 +363,36 @@
       //=======================================================================
   
       /**
  -     * Returns a list of published appliance URLs.
  -     * @return the appliances
  +     * Returns a list of published appliance URLs from this registry and all
  +     * subsidiary registries.
  +     * @return the appliances urls
        */
       public URL[] list()
       {
           ArrayList list = new ArrayList();
  -        Registry[] publishers =
  -            (Registry[])m_table.values().toArray( new Registry[ 0 ] );
  -        for( int j = 0; j < publishers.length; j++ )
  -        {
  -            URL url = publishers[ j ].getBase();
  -            list.add( url );
  -        }
   
           Appliance[] appliances = (Appliance[])m_appliances.values().toArray( new Appliance[
0 ] );
           for( int i = 0; i < appliances.length; i++ )
           {
               list.add( appliances[ i ].getURL() );
           }
  +
  +        Registry[] publishers =
  +            (Registry[])m_table.values().toArray( new Registry[ 0 ] );
  +        for( int j = 0; j < publishers.length; j++ )
  +        {
  +            URL[] sublist = publishers[j].list();
  +            for( int k = 0; k < sublist.length; k++ )
  +            {
  +                list.add( sublist[ k ] );
  +            }
  +        }
  +
           return (URL[])list.toArray( new URL[ 0 ] );
       }
   
       /**
  -     * Returns a list of published appliances.
  +     * Returns a list of published appliances local to this registry.
        * @return the appliances
        */
       public Appliance[] getAppliances()
  
  
  
  1.8       +5 -4      avalon-sandbox/merlin/src/test/config/block.xml
  
  Index: block.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/src/test/config/block.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- block.xml	19 Dec 2002 10:50:17 -0000	1.7
  +++ block.xml	20 Dec 2002 11:58:01 -0000	1.8
  @@ -10,10 +10,11 @@
      </services>
   
      <container>
  -     <component name="standard" class="org.apache.avalon.playground.StandardComponent"
activation="startup">
  -       <context class="org.apache.avalon.playground.StandardContextImp"/>
  -     </component>
  -     <container name="test"/>
  +     <container name="test">
  +       <component name="standard" class="org.apache.avalon.playground.StandardComponent"
activation="startup">
  +         <context class="org.apache.avalon.playground.StandardContextImp"/>
  +       </component>
  +     </container>
      </container>
   
   </block>
  
  
  
  1.5       +0 -2      avalon-sandbox/merlin/src/test/org/apache/avalon/playground/StandardComponent.xinfo
  
  Index: StandardComponent.xinfo
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/src/test/org/apache/avalon/playground/StandardComponent.xinfo,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardComponent.xinfo	19 Dec 2002 10:50:17 -0000	1.4
  +++ StandardComponent.xinfo	20 Dec 2002 11:58:01 -0000	1.5
  @@ -28,12 +28,10 @@
     -->
   
     <context type="org.apache.avalon.playground.StandardContext">
  -
       <attributes>
         <attribute key="urn:assembly:lifecycle.context.extension"
             value="org.apache.avalon.playground.Contextualizable"/>
       </attributes>
  -
     </context>
   
     <services>
  
  
  

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