You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2002/08/14 05:03:36 UTC

cvs commit: jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource DeploymentException.java DeploymentHelper.java AbstractLifestyleHandler.java DefaultLifestyleManager.java DefaultResource.java LifecycleException.java LifecycleHelper.java LifestyleManager.java ResourceProvider.java SingletonLifestyleHandler.java TransientLifestyleHandler.java

mcconnell    2002/08/13 20:03:36

  Modified:    assembly/demo/src/etc demo.mf
               assembly/demo/src/java/org/apache/excalibur/playground
                        BasicComponent.xinfo ComplexComponent.xinfo
                        CustomContainer.xinfo DemoManager.java
                        DemoManager.xinfo EmbeddedDemo.xconfig
                        EmbeddedDemo.xinfo ExploitationManager.xinfo
                        InvalidComponent.xinfo SimpleComponent.java
                        SimpleComponent.xinfo TerminalComponent.xinfo
               assembly/src/etc project.mf
               assembly/src/java/org/apache/excalibur/merlin/assembly
                        ContainerManager.java DefaultLoggerManager.java
                        DefaultSelector.java ProfileRegistry.java
                        Selector.java TypeManager.java TypeRegistry.java
               assembly/src/java/org/apache/excalibur/merlin/container
                        DefaultContainer.xinfo StructuralExtension.xinfo
               assembly/src/java/org/apache/excalibur/merlin/kernel
                        DefaultKernel.xinfo
               assembly/src/java/org/apache/excalibur/merlin/model
                        CategoriesDescriptor.java Profile.java
               assembly/src/java/org/apache/excalibur/merlin/resource
                        AbstractLifestyleHandler.java
                        DefaultLifestyleManager.java DefaultResource.java
                        LifecycleException.java LifecycleHelper.java
                        LifestyleManager.java ResourceProvider.java
                        SingletonLifestyleHandler.java
                        TransientLifestyleHandler.java
  Added:       assembly/src/java/org/apache/excalibur/merlin/resource
                        DeploymentException.java DeploymentHelper.java
  Log:
  Inital changes to seperate profile deployment stage actions from instance
  creation actions.  Deployment can be conidered as a sub-stage of the
  creation phase during which run-once actions are undertakes (such as
  logging channel establishment, context building and other profile scoped
  actions).
  
  Revision  Changes    Path
  1.10      +9 -9      jakarta-avalon-excalibur/assembly/demo/src/etc/demo.mf
  
  Index: demo.mf
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/etc/demo.mf,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- demo.mf	5 Aug 2002 12:39:37 -0000	1.9
  +++ demo.mf	14 Aug 2002 03:03:34 -0000	1.10
  @@ -5,28 +5,28 @@
   meta-Specification-Version: 1.0
   
   Name: org/apache/excalibur/playground/SimpleComponent.class
  -Avalon-Block: true
  +Avalon: Type
   
   Name: org/apache/excalibur/playground/TerminalComponent.class
  -Avalon-Block: true
  +Avalon: Type
   
   Name: org/apache/excalibur/playground/BasicComponent.class
  -Avalon-Block: true
  +Avalon: Type
   
   Name: org/apache/excalibur/playground/ComplexComponent.class
  -Avalon-Block: true
  +Avalon: Type
   
   Name: org/apache/excalibur/playground/InvalidComponent.class
  -Avalon-Block: true
  +Avalon: Type
   
   Name: org/apache/excalibur/playground/ExploitationManager.class
  -Avalon-Facility: true
  +Avalon: Type
   
   Name: org/apache/excalibur/playground/DemoManager.class
  -Avalon-Facility: true
  +Avalon: Type
   
   Name: org/apache/excalibur/playground/EmbeddedDemo.class
  -Avalon-Block: true
  +Avalon: Type
   
   Name: org/apache/excalibur/playground/CustomContainer.class
  -Avalon-Block: true
  +Avalon: Type
  
  
  
  1.9       +5 -5      jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/BasicComponent.xinfo
  
  Index: BasicComponent.xinfo
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/BasicComponent.xinfo,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BasicComponent.xinfo	4 Aug 2002 11:49:35 -0000	1.8
  +++ BasicComponent.xinfo	14 Aug 2002 03:03:34 -0000	1.9
  @@ -1,9 +1,9 @@
   <?xml version="1.0"?>
  -<!DOCTYPE component-info
  -      PUBLIC "-//AVALON/Component Info DTD Version 1.0//EN"
  -             "http://jakarta.apache.org/avalon/componentinfo_1_0.dtd" >
  +<!DOCTYPE type
  +      PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
  +             "http://jakarta.apache.org/avalon/type_1_0.dtd" >
   
  -<component-info>
  +<type>
   
     <component>
       <name>basic</name>
  @@ -20,5 +20,5 @@
       </service> 
     </services>
   
  -</component-info>
  +</type>
   
  
  
  
  1.11      +3 -3      jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/ComplexComponent.xinfo
  
  Index: ComplexComponent.xinfo
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/ComplexComponent.xinfo,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ComplexComponent.xinfo	12 Aug 2002 17:38:20 -0000	1.10
  +++ ComplexComponent.xinfo	14 Aug 2002 03:03:34 -0000	1.11
  @@ -1,7 +1,7 @@
   <?xml version="1.0"?>
  -<!DOCTYPE component-info
  -      PUBLIC "-//AVALON/Component Info DTD Version 1.0//EN"
  -             "http://jakarta.apache.org/avalon/componentinfo_1_0.dtd" >
  +<!DOCTYPE type
  +      PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
  +             "http://jakarta.apache.org/avalon/type_1_0.dtd" >
   
   <type>
   
  
  
  
  1.4       +7 -7      jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/CustomContainer.xinfo
  
  Index: CustomContainer.xinfo
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/CustomContainer.xinfo,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CustomContainer.xinfo	12 Aug 2002 20:34:33 -0000	1.3
  +++ CustomContainer.xinfo	14 Aug 2002 03:03:34 -0000	1.4
  @@ -1,7 +1,7 @@
   <?xml version="1.0"?>
  -<!DOCTYPE component-info
  -      PUBLIC "-//AVALON/Component Info DTD Version 1.0//EN"
  -             "http://jakarta.apache.org/avalon/componentinfo_1_0.dtd" >
  +<!DOCTYPE type
  +      PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
  +             "http://jakarta.apache.org/avalon/type_1_0.dtd" >
   
   <type>
   
  @@ -31,11 +31,11 @@
       </service>
     </services>
   
  -  <phases>
  -     <phase>
  +  <stages>
  +     <stage>
           <reference type="org.apache.excalibur.merlin.container.Structural"/>
  -     </phase>
  -  </phases>
  +     </stage>
  +  </stages>
   
   </type>
   
  
  
  
  1.5       +1 -2      jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/DemoManager.java
  
  Index: DemoManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/DemoManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DemoManager.java	13 Aug 2002 03:57:56 -0000	1.4
  +++ DemoManager.java	14 Aug 2002 03:03:34 -0000	1.5
  @@ -33,7 +33,7 @@
       {
           super.extend( stage, target, context );
           if( target instanceof Demonstratable )
  -          ((Demonstratable)target).demo( stageToString( stage ).toLowerCase() 
  +          ((Demonstratable)target).demo( "demonstratable, stage: " + stageToString( stage ).toLowerCase() 
                + ", instance: " + System.identityHashCode( this ) );
       }
   
  @@ -48,5 +48,4 @@
               getLogger().debug( "dispose" );  
           }
       }
  -
    }
  
  
  
  1.6       +6 -2      jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/DemoManager.xinfo
  
  Index: DemoManager.xinfo
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/DemoManager.xinfo,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DemoManager.xinfo	13 Aug 2002 03:57:56 -0000	1.5
  +++ DemoManager.xinfo	14 Aug 2002 03:03:34 -0000	1.6
  @@ -1,11 +1,15 @@
   <?xml version="1.0"?>
  +<!DOCTYPE type
  +      PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
  +             "http://jakarta.apache.org/avalon/type_1_0.dtd" >
  +
   
   <!--
   Definition of the extension type phase support.  This demonstrates the 
   use of a lifestyle policy inside an extension handler.
   -->
   
  -<facility>
  +<type>
   
     <component>
       <name>demonstratable</name>
  @@ -33,5 +37,5 @@
   
     </extensions>
   
  -</facility>
  +</type>
   
  
  
  
  1.2       +0 -4      jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/EmbeddedDemo.xconfig
  
  Index: EmbeddedDemo.xconfig
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/EmbeddedDemo.xconfig,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EmbeddedDemo.xconfig	12 Aug 2002 02:00:08 -0000	1.1
  +++ EmbeddedDemo.xconfig	14 Aug 2002 03:03:34 -0000	1.2
  @@ -1,7 +1,3 @@
  -<?xml version="1.0"?>
  -<!DOCTYPE component-info
  -      PUBLIC "-//AVALON/Component Info DTD Version 1.0//EN"
  -             "http://jakarta.apache.org/avalon/componentinfo_1_0.dtd" >
   
   <configuration>
   
  
  
  
  1.3       +5 -6      jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/EmbeddedDemo.xinfo
  
  Index: EmbeddedDemo.xinfo
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/EmbeddedDemo.xinfo,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EmbeddedDemo.xinfo	8 Aug 2002 10:02:34 -0000	1.2
  +++ EmbeddedDemo.xinfo	14 Aug 2002 03:03:34 -0000	1.3
  @@ -1,9 +1,9 @@
   <?xml version="1.0"?>
  -<!DOCTYPE component-info
  -      PUBLIC "-//AVALON/Component Info DTD Version 1.0//EN"
  -             "http://jakarta.apache.org/avalon/componentinfo_1_0.dtd" >
  +<!DOCTYPE type
  +      PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
  +             "http://jakarta.apache.org/avalon/type_1_0.dtd" >
   
  -<component-info>
  +<type>
   
     <component>
       <name>embeddor</name>
  @@ -13,6 +13,5 @@
       <entry key="avalon:home" type="java.io.File"/>
     </context>
   
  -
  -</component-info>
  +</type>
   
  
  
  
  1.6       +2 -2      jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/ExploitationManager.xinfo
  
  Index: ExploitationManager.xinfo
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/ExploitationManager.xinfo,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ExploitationManager.xinfo	12 Aug 2002 02:00:08 -0000	1.5
  +++ ExploitationManager.xinfo	14 Aug 2002 03:03:34 -0000	1.6
  @@ -4,7 +4,7 @@
   Definition of the extension type phase support.
   -->
   
  -<facility>
  +<type>
   
     <component>
       <name>exploit</name>
  @@ -29,5 +29,5 @@
   
     </extensions>
   
  -</facility>
  +</type>
   
  
  
  
  1.8       +5 -5      jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/InvalidComponent.xinfo
  
  Index: InvalidComponent.xinfo
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/InvalidComponent.xinfo,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- InvalidComponent.xinfo	4 Aug 2002 11:49:35 -0000	1.7
  +++ InvalidComponent.xinfo	14 Aug 2002 03:03:34 -0000	1.8
  @@ -1,9 +1,9 @@
   <?xml version="1.0"?>
  -<!DOCTYPE component-info
  -      PUBLIC "-//AVALON/Component Info DTD Version 1.0//EN"
  -             "http://jakarta.apache.org/avalon/componentinfo_1_0.dtd" >
  +<!DOCTYPE type
  +      PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
  +             "http://jakarta.apache.org/avalon/type_1_0.dtd" >
   
  -<component-info>
  +<type>
   
     <component>
       <name>invalid</name>
  @@ -16,5 +16,5 @@
         </dependency>
     </dependencies>
   
  -</component-info>
  +</type>
   
  
  
  
  1.13      +2 -2      jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/SimpleComponent.java
  
  Index: SimpleComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/SimpleComponent.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SimpleComponent.java	12 Aug 2002 17:36:15 -0000	1.12
  +++ SimpleComponent.java	14 Aug 2002 03:03:34 -0000	1.13
  @@ -68,9 +68,9 @@
       // Demonstratable
       //=======================================================================
   
  -    public void demo( String stage )
  +    public void demo( String message )
       {
  -        getLogger().info( stage + " stage (demonstratable)");
  +        getLogger().info( message );
       }
   
       //=======================================================================
  
  
  
  1.10      +7 -7      jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/SimpleComponent.xinfo
  
  Index: SimpleComponent.xinfo
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/SimpleComponent.xinfo,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SimpleComponent.xinfo	13 Aug 2002 03:57:56 -0000	1.9
  +++ SimpleComponent.xinfo	14 Aug 2002 03:03:34 -0000	1.10
  @@ -1,5 +1,5 @@
   <?xml version="1.0"?>
  -<!DOCTYPE component-info
  +<!DOCTYPE type
         PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
                "http://jakarta.apache.org/avalon/type_1_0.dtd" >
   
  @@ -33,14 +33,14 @@
     Each phase element contains a reference to a lifecycle phase interface that 
     the container has to manage.
     -->
  -  <phases>
  -     <phase>
  +  <stages>
  +     <stage>
           <reference type="org.apache.excalibur.playground.Exploitable" version="1.0"/>
  -     </phase>
  -     <phase>
  +     </stage>
  +     <stage>
           <reference type="org.apache.excalibur.playground.Demonstratable"/>
  -     </phase>
  -  </phases>
  +     </stage>
  +  </stages>
   
   </type>
   
  
  
  
  1.6       +5 -5      jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/TerminalComponent.xinfo
  
  Index: TerminalComponent.xinfo
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/TerminalComponent.xinfo,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TerminalComponent.xinfo	29 Jul 2002 06:14:28 -0000	1.5
  +++ TerminalComponent.xinfo	14 Aug 2002 03:03:34 -0000	1.6
  @@ -1,9 +1,9 @@
   <?xml version="1.0"?>
  -<!DOCTYPE component-info
  -      PUBLIC "-//AVALON/Component Info DTD Version 1.0//EN"
  -             "http://jakarta.apache.org/avalon/componentinfo_1_0.dtd" >
  +<!DOCTYPE type
  +      PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
  +             "http://jakarta.apache.org/avalon/type_1_0.dtd" >
   
  -<component-info>
  +<type>
   
     <component>
       <name>terminal-component</name>
  @@ -15,5 +15,5 @@
         </service> 
     </services>
   
  -</component-info>
  +</type>
   
  
  
  
  1.12      +2 -2      jakarta-avalon-excalibur/assembly/src/etc/project.mf
  
  Index: project.mf
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/etc/project.mf,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- project.mf	29 Jul 2002 06:14:29 -0000	1.11
  +++ project.mf	14 Aug 2002 03:03:35 -0000	1.12
  @@ -24,7 +24,7 @@
   Main-Class: org.apache.excalibur.merlin.Main
   
   Name: org/apache/excalibur/merlin/container/DefaultContainer.class
  -Avalon-Block: true
  +Avalon: Type
   
   Name: org/apache/excalibur/merlin/kernel/DefaultKernel.class
  -Avalon-Block: true
  +Avalon: Type
  
  
  
  1.18      +16 -8     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/ContainerManager.java
  
  Index: ContainerManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/ContainerManager.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ContainerManager.java	13 Aug 2002 05:12:29 -0000	1.17
  +++ ContainerManager.java	14 Aug 2002 03:03:35 -0000	1.18
  @@ -44,6 +44,7 @@
   import org.apache.excalibur.merlin.resource.TransientLifestyleHandler;
   import org.apache.excalibur.merlin.resource.LifecycleHelper;
   import org.apache.excalibur.merlin.resource.ResourceProvider;
  +import org.apache.excalibur.merlin.resource.DeploymentHelper;
   import org.apache.excalibur.merlin.model.ContainerDescriptor;
   import org.apache.excalibur.merlin.model.ClasspathDescriptor;
   import org.apache.excalibur.merlin.model.LoggingDescriptor;
  @@ -60,7 +61,6 @@
   import org.apache.excalibur.meta.info.DependencyDescriptor;
   import org.apache.excalibur.meta.info.ExtensionDescriptor;
   import org.apache.excalibur.meta.info.Type;
  -import org.apache.excalibur.meta.info.Facility;
   import org.apache.excalibur.meta.info.builder.TypeBuilder;
   import org.apache.excalibur.meta.verifier.ComponentVerifier;
   
  @@ -207,6 +207,11 @@
       */
       private LifestyleManager m_lifestyles;
   
  +   /**
  +    * The deployment helper.
  +    */
  +    private DeploymentHelper m_deployment;
  +
       //===================================================================
       // constructor
       //===================================================================
  @@ -279,6 +284,9 @@
       {
           super.initialize();
   
  +        m_deployment = new DeploymentHelper( getLoggingManager(), this );
  +        m_deployment.enableLogging( getLocalLogger().getChildLogger("deployment") );
  +
           XMLContainerUtil creator = new XMLContainerUtil();
   
           getLogger().debug(
  @@ -607,16 +615,16 @@
               addProfile( services[i].getService(), profile );
           }
   
  -        if( profile.getType() instanceof Facility )
  +        ExtensionDescriptor[] extensions = profile.getType().getExtensions();
  +        if( extensions.length > 0 )
           {
               //
  -            //  the profile is a facility so we need to 
  +            // the type implements extensions so we need to 
               // cross reference it against the extension support it 
               // provides
               //
                   
  -            Facility facility = (Facility) profile.getType();
  -            addProfile( facility.getExtensions(), profile );
  +            addProfile( extensions, profile );
           }
   
           getLocalLogger().debug("added: " + profile );
  @@ -802,7 +810,7 @@
           {
               LifestyleManager lifestyles = getLifestyleManager();
               LifestyleHandler handler =
  -              lifestyles.getHandler( this, m_helper, m_provider, profile, context );
  +              lifestyles.getHandler( this, m_deployment, m_helper, m_provider, profile, context );
               DefaultResource res = 
                 new DefaultResource( getPath(), profile, context, handler );
               res.enableLogging( getLocalLogger().getChildLogger( "resource" ) );
  @@ -1022,7 +1030,7 @@
       * Add a profile and cross-reference this relative to the extensions it 
       * is capable of supporting.
       *
  -    * @param extensions the set of extensions the facility supports
  +    * @param extensions the set of extensions the type supports
       * @param profile the profile
       */
       private void addProfile( ExtensionDescriptor[] extensions, Profile profile )
  
  
  
  1.7       +5 -0      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/DefaultLoggerManager.java
  
  Index: DefaultLoggerManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/DefaultLoggerManager.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultLoggerManager.java	12 Aug 2002 02:00:09 -0000	1.6
  +++ DefaultLoggerManager.java	14 Aug 2002 03:03:35 -0000	1.7
  @@ -204,6 +204,11 @@
           }
       }
   
  +    public Logger addCategory( String path, Category category )
  +    {
  +        return addCategory( path, category.getPriority(), category.getTarget(), true );
  +    }
  +
       private Logger addCategory( String path, String priority, String target )
       {
           return addCategory( path, priority, target, true );
  
  
  
  1.3       +1 -36     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/DefaultSelector.java
  
  Index: DefaultSelector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/DefaultSelector.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultSelector.java	4 Aug 2002 06:43:20 -0000	1.2
  +++ DefaultSelector.java	14 Aug 2002 03:03:35 -0000	1.3
  @@ -43,41 +43,6 @@
           return profiles[0];
       }
   
  -   /**
  -    * Returns the preferred profile form an available selection of candidate provider profiles.
  -    * @param facilities the set of profiles of potential service providers available in the 
  -    *   container hierachy
  -    * @param profiles the set of profiles of potential service providers contained with the 
  -    *   local container
  -    * @return the preferred provider or null if no satisfactory provider can be established 
  -    *    from the supplied profiles.
  -    */
  -    public Profile select( Profile[] facilities, Profile[] profiles )
  -    {
  -        //
  -        // apply default selection policy
  -        //
  -
  -        Profile profile = select( profiles, Profile.EXPLICIT );
  -        if( profile == null )
  -        {
  -            profile = select( facilities );
  -        }
  -        else
  -        {
  -            getLogger().debug("local selection: " + profile );
  -        }
  -        if( profile == null )
  -        {
  -            profile = select( profiles );
  -        }
  -        else
  -        {
  -            getLogger().debug("facility selection: " + profile );
  -        }
  -        return profile;
  -    }
  -
       private Profile select( Profile[] profiles, int mode )
       {
           for( int i=0; i<profiles.length; i++ )
  
  
  
  1.13      +1 -2      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/ProfileRegistry.java
  
  Index: ProfileRegistry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/ProfileRegistry.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ProfileRegistry.java	12 Aug 2002 17:36:16 -0000	1.12
  +++ ProfileRegistry.java	14 Aug 2002 03:03:35 -0000	1.13
  @@ -29,7 +29,6 @@
   import org.apache.excalibur.meta.info.DependencyDescriptor;
   import org.apache.excalibur.meta.info.PhaseDescriptor;
   import org.apache.excalibur.meta.info.Type;
  -import org.apache.excalibur.meta.info.Facility;
   import org.apache.excalibur.merlin.model.Profile;
   import org.apache.excalibur.merlin.model.Resource;
   import org.apache.excalibur.merlin.resource.ResourceException;
  
  
  
  1.2       +1 -11     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/Selector.java
  
  Index: Selector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/Selector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Selector.java	29 Jul 2002 06:14:29 -0000	1.1
  +++ Selector.java	14 Aug 2002 03:03:35 -0000	1.2
  @@ -33,14 +33,4 @@
       */
       Profile select( Profile[] profiles );
   
  -   /**
  -    * Returns the preferred profile form an available selection of candidate provider profiles.
  -    * @param facilities the set of profiles of potential service providers available in the 
  -    *   container hierachy
  -    * @param profiles the set of profiles of potential service providers contained with the 
  -    *   local container
  -    * @return the preferred provider or null if no satisfactory provider can be established 
  -    *    from the supplied profiles.
  -    */
  -    Profile select( Profile[] facilities, Profile[] profiles );
   }
  
  
  
  1.9       +6 -7      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/TypeManager.java
  
  Index: TypeManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/TypeManager.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TypeManager.java	12 Aug 2002 02:00:09 -0000	1.8
  +++ TypeManager.java	14 Aug 2002 03:03:35 -0000	1.9
  @@ -43,7 +43,6 @@
   import org.apache.avalon.excalibur.extension.OptionalPackage;
   import org.apache.avalon.excalibur.extension.DefaultPackageRepository;
   import org.apache.excalibur.meta.info.Type;
  -import org.apache.excalibur.meta.info.Facility;
   import org.apache.excalibur.meta.info.ReferenceDescriptor;
   import org.apache.excalibur.meta.info.PhaseDescriptor;
   import org.apache.excalibur.merlin.model.IncludeDescriptor;
  @@ -253,7 +252,7 @@
           if( !( getParent() instanceof TypeManager ))
           {
               m_types.addType( DEFAULT_CONTAINER_CLASS );
  -            m_types.addFacility( DEFAULT_STRUCTURE_CLASS );
  +            m_types.addType( DEFAULT_STRUCTURE_CLASS );
           }
   
       }
  @@ -304,18 +303,18 @@
                               }
                           }
                       }
  -                    else if( entry.toString().equals( "Avalon-Facility" ) )
  +                    else if( entry.toString().equals( "Avalon" ) )
                       {
  -                        if( attributes.get( entry ).equals( "true" ) )
  +                        if( attributes.get( entry ).equals( "Type" ) )
                           {
                               final String path = name.substring( 0, name.indexOf( ".class" ) );
                               try
                               {
  -                                m_types.addFacility( path );
  +                                m_types.addType( path );
                               }
                               catch( Throwable e )
                               {
  -                                final String warning = "Bypassing extension: " + path ;
  +                                final String warning = "Bypassing type: " + path ;
                                   getLocalLogger().warn( warning, e );
                               }
                           }
  
  
  
  1.6       +13 -51    jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/TypeRegistry.java
  
  Index: TypeRegistry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/TypeRegistry.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TypeRegistry.java	4 Aug 2002 06:43:20 -0000	1.5
  +++ TypeRegistry.java	14 Aug 2002 03:03:35 -0000	1.6
  @@ -22,11 +22,9 @@
   import org.apache.excalibur.meta.info.ReferenceDescriptor;
   import org.apache.excalibur.meta.info.DependencyDescriptor;
   import org.apache.excalibur.meta.info.Type;
  -import org.apache.excalibur.meta.info.Facility;
   import org.apache.excalibur.meta.info.PhaseDescriptor;
   import org.apache.excalibur.meta.info.ExtensionDescriptor;
   import org.apache.excalibur.meta.info.builder.TypeBuilder;
  -import org.apache.excalibur.meta.info.builder.FacilityBuilder;
   import org.apache.excalibur.merlin.model.Profile;
   import org.apache.excalibur.meta.verifier.ComponentVerifier;
   import org.apache.excalibur.configuration.ConfigurationUtil;
  @@ -46,7 +44,6 @@
       //=======================================================================
   
       private TypeBuilder m_typeBuilder = new TypeBuilder();
  -    private FacilityBuilder m_facilityBuilder = new FacilityBuilder();
   
       private ClassLoader m_classloader;
   
  @@ -56,8 +53,7 @@
       private Hashtable m_types = new Hashtable();
   
      /**
  -    * Facility types keyed by classname (facilities are also included 
  -    * in the m_types table).
  +    * Extension handler types keyed by classname.
       */
       private Hashtable m_facilities = new Hashtable();
   
  @@ -81,7 +77,6 @@
           m_classloader = loader;
           super.enableLogging( logger );
           m_typeBuilder.enableLogging( logger.getChildLogger("component") );
  -        m_facilityBuilder.enableLogging( logger.getChildLogger("facility") );
           getLogger().debug("type registry established");
       }
   
  @@ -123,29 +118,6 @@
           return type;
       }
   
  -   /**
  -    * Register a potential supplier component type.  The implementation will
  -    * create a component type instance for the entry if not already known and 
  -    * return the existing or new instance to the invoking client.
  -    *
  -    * @param classname the component class name
  -    * @return the component type
  -    */
  -    public Facility addFacility( String path ) throws Exception
  -    {
  -        final String classname = path.replace('/','.');
  -
  -        getLogger().info("facility: " + classname );
  -        Facility facility = getFacility( classname );
  -        if( facility == null )
  -        {
  -            facility = m_facilityBuilder.build( classname, m_classloader );
  -            verify( facility );
  -            register( facility );
  -        }
  -        return facility;
  -    }
  -
       private void verify( Type type ) throws Exception
       {
           String name = type.getInfo().getName();
  @@ -227,22 +199,22 @@
       * Returns the set of facilities know to the registry.
       * @return the set of registered facilities
       */
  -    public Facility[] getFacilities()
  +    public Type[] getFacilities()
       {
  -        return (Facility[]) m_facilities.values().toArray( new Facility[0] );
  +        return (Type[]) m_facilities.values().toArray( new Type[0] );
       }
   
      /**
  -    * Returns the set of facilities matching a supplied phase.
  -    * @return the set of matching facilities 
  +    * Returns the set of types matching a supplied phase.
  +    * @return the set of types capable of supporting the stage. 
       */
  -    public Facility[] getFacilities( PhaseDescriptor phase )
  +    public Type[] getType( PhaseDescriptor phase )
       {
           ArrayList list = new ArrayList();
  -        Facility[] facilities = getFacilities();
  +        Type[] facilities = getFacilities();
           for( int i=0; i<facilities.length; i++ )
           {
  -            Facility facility = facilities[i];
  +            Type facility = facilities[i];
               ExtensionDescriptor[] extensions = facility.getExtensions();
               for( int j=0; j<extensions.length; j++ )
               {
  @@ -254,7 +226,7 @@
                   }
               }
           }
  -        return (Facility[]) list.toArray( new Facility[ list.size() ] );
  +        return (Type[]) list.toArray( new Type[ list.size() ] );
       }
   
      /**
  @@ -277,15 +249,6 @@
       }
   
      /**
  -    * Returns a registered facility type.
  -    * @return the facility type from the registry or null if the facility is unknown
  -    */
  -    public Facility getFacility( String classname ) 
  -    {
  -        return (Facility) m_facilities.get( classname );
  -    }
  -
  -   /**
       * Register the type resulting in the cross-referencing of the type with the set of 
       * service tables that the type is is capable of supporting.
       */
  @@ -299,11 +262,10 @@
           {
               register( services[i].getService(), type );
           }
  -        if( type instanceof Facility )
  +        if( type.getExtensions().length > 0 )
           {
  -            Facility facility = (Facility) type;
  -            m_facilities.put( key, facility );
  -            getLogger().debug( "Facility: '" + key + "' registered.");
  +            m_facilities.put( key, type );
  +            getLogger().debug( "Extension: '" + key + "' registered.");
           }
       }
   
  
  
  
  1.9       +7 -4      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/DefaultContainer.xinfo
  
  Index: DefaultContainer.xinfo
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/DefaultContainer.xinfo,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultContainer.xinfo	12 Aug 2002 02:00:10 -0000	1.8
  +++ DefaultContainer.xinfo	14 Aug 2002 03:03:35 -0000	1.9
  @@ -1,4 +1,7 @@
   <?xml version="1.0"?>
  +<!DOCTYPE type
  +      PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
  +             "http://jakarta.apache.org/avalon/type_1_0.dtd" >
   
   <!--
   Copyright (C) The Apache Software Foundation. All rights reserved.
  @@ -39,10 +42,10 @@
       </service>
     </services>
   
  -  <phases>
  -     <phase>
  +  <stages>
  +     <stage>
           <reference type="org.apache.excalibur.merlin.container.Structural"/>
  -     </phase>
  -  </phases>
  +     </stage>
  +  </stages>
   
   </type>
  
  
  
  1.3       +2 -2      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/StructuralExtension.xinfo
  
  Index: StructuralExtension.xinfo
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/StructuralExtension.xinfo,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StructuralExtension.xinfo	13 Aug 2002 03:57:56 -0000	1.2
  +++ StructuralExtension.xinfo	14 Aug 2002 03:03:35 -0000	1.3
  @@ -4,7 +4,7 @@
   Definition of the extension type phase support.
   -->
   
  -<facility>
  +<type>
   
     <component>
       <name>structural</name>
  @@ -24,5 +24,5 @@
   
     </extensions>
   
  -</facility>
  +</type>
   
  
  
  
  1.9       +5 -2      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultKernel.xinfo
  
  Index: DefaultKernel.xinfo
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultKernel.xinfo,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultKernel.xinfo	2 Aug 2002 06:36:10 -0000	1.8
  +++ DefaultKernel.xinfo	14 Aug 2002 03:03:35 -0000	1.9
  @@ -1,4 +1,7 @@
   <?xml version="1.0"?>
  +<!DOCTYPE type
  +      PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
  +             "http://jakarta.apache.org/avalon/type_1_0.dtd" >
   
   <!--  
   Copyright (C) The Apache Software Foundation. All rights reserved.
  @@ -10,7 +13,7 @@
   @version 1.0 12/03/2001
   -->
   
  -<component-info>
  +<type>
   
     <component>
       <name>kernel</name>
  @@ -27,4 +30,4 @@
       </service>
     </services>
   
  -</component-info>
  +</type>
  
  
  
  1.3       +18 -1     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/CategoriesDescriptor.java
  
  Index: CategoriesDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/CategoriesDescriptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CategoriesDescriptor.java	2 Aug 2002 06:34:51 -0000	1.2
  +++ CategoriesDescriptor.java	14 Aug 2002 03:03:35 -0000	1.3
  @@ -73,5 +73,22 @@
           return m_categories;
       }
   
  +    /**
  +     * Return a named category.
  +     *
  +     * @return the category declaration
  +     */
  +    public Category getCategory( String name )
  +    {
  +        for( int i = 0; i < m_categories.length; i++ )
  +        {
  +            final Category category = m_categories[ i ];
  +            if( category.getName().equalsIgnoreCase( name ) )
  +            {
  +                return category;
  +            }
  +        }
  +        return null;
  +    }
   
   }
  
  
  
  1.21      +4 -5      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Profile.java
  
  Index: Profile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Profile.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Profile.java	12 Aug 2002 02:00:10 -0000	1.20
  +++ Profile.java	14 Aug 2002 03:03:35 -0000	1.21
  @@ -17,7 +17,6 @@
   import org.apache.avalon.framework.context.Context;
   import org.apache.excalibur.meta.ConfigurationBuilder;
   import org.apache.excalibur.meta.info.Type;
  -import org.apache.excalibur.meta.info.Facility;
   import org.apache.excalibur.meta.info.PhaseDescriptor;
   import org.apache.excalibur.merlin.model.Association;
   import org.apache.excalibur.configuration.ConfigurationUtil;
  @@ -508,16 +507,16 @@
       }
   
      /**
  -    * Return the facility associated as the phase provider.
  +    * Return the type associated as the phase provider.
       * @param phase the lifecycle phase specification
       * @return a reference to the phase extension
       */
  -    public Facility getFacility( PhaseDescriptor phase )
  +    public Type getFacility( PhaseDescriptor phase )
       {
           Profile profile = getExtensionProfile( phase );
           if( profile != null )
           {
  -            return (Facility) profile.getType();
  +            return (Type) profile.getType();
           }
           return null;
       }
  
  
  
  1.4       +21 -5     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/AbstractLifestyleHandler.java
  
  Index: AbstractLifestyleHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/AbstractLifestyleHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractLifestyleHandler.java	13 Aug 2002 03:57:56 -0000	1.3
  +++ AbstractLifestyleHandler.java	14 Aug 2002 03:03:35 -0000	1.4
  @@ -9,6 +9,8 @@
    */
   package org.apache.excalibur.merlin.resource;
   
  +import java.util.ArrayList;
  +
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.context.DefaultContext;
  @@ -19,8 +21,10 @@
   import org.apache.excalibur.merlin.model.Resource;
   import org.apache.excalibur.meta.info.PhaseDescriptor;
   import org.apache.excalibur.meta.info.ExtensionDescriptor;
  -import org.apache.excalibur.meta.info.Facility;
  -
  +import org.apache.excalibur.meta.info.Type;
  +import org.apache.excalibur.meta.info.LoggerDescriptor;
  +import org.apache.excalibur.merlin.model.CategoriesDescriptor;
  +import org.apache.excalibur.merlin.model.Category;
   
   /**
    * Lifestyle implementation that provides suppport for the singleton
  @@ -34,10 +38,12 @@
   {
        private Profile m_profile;
        private ContainerManager m_manager;
  +     private DeploymentHelper m_deployment;
        private ResourceProvider m_provider;
        private LifecycleHelper m_helper;
        private Context m_context;
   
  +     private boolean m_initialized = false;
        protected boolean m_disposed = false;
   
       /**
  @@ -49,16 +55,19 @@
        * @param context the establishment context
        */
        public AbstractLifestyleHandler( 
  -                           final ContainerManager manager, 
  +                           final ContainerManager manager,
  +                           final DeploymentHelper deployment, 
                              final ResourceProvider provider, 
                              final LifecycleHelper helper,
                              final Profile profile, 
                              final Context context )
        {
  -
            if( manager == null )
              throw new NullPointerException("manager");
   
  +         if( deployment == null )
  +           throw new NullPointerException("deployment");
  +
            if( provider == null )
              throw new NullPointerException("provider");
   
  @@ -73,6 +82,7 @@
   
            m_profile = profile;
            m_manager = manager;
  +         m_deployment = deployment;
            m_provider = provider;
            m_helper = helper;
            m_context = context;
  @@ -127,7 +137,7 @@
   
       private void processExtension( int stage, PhaseDescriptor phase, Object object, Context context ) throws Exception
       {
  -        final Facility facility = m_profile.getFacility( phase );
  +        final Type facility = m_profile.getFacility( phase );
           final ExtensionDescriptor ext = facility.getExtension( phase );
           if( ext.isApplicable( stage ) )
           {
  @@ -161,6 +171,12 @@
        protected Object createInstance() throws Exception
        {
           getLogger().debug("create");
  +
  +        if( !m_initialized )
  +        {
  +            m_deployment.deploy( m_profile );
  +            m_initialized = true;
  +        }
   
           //
           // load the class
  
  
  
  1.2       +3 -2      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DefaultLifestyleManager.java
  
  Index: DefaultLifestyleManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DefaultLifestyleManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultLifestyleManager.java	13 Aug 2002 03:57:56 -0000	1.1
  +++ DefaultLifestyleManager.java	14 Aug 2002 03:03:35 -0000	1.2
  @@ -77,6 +77,7 @@
        */
        public LifestyleHandler getHandler( 
                               ContainerManager manager, 
  +                            DeploymentHelper deployment,
                               LifecycleHelper helper, 
                               ResourceProvider provider, 
                               Profile profile, 
  @@ -94,7 +95,7 @@
               //
   
               SingletonLifestyleHandler handler = 
  -              new SingletonLifestyleHandler( manager, provider, helper, profile, context );
  +              new SingletonLifestyleHandler( manager, deployment, provider, helper, profile, context );
               handler.enableLogging( getLogger() );
               return handler;
           }
  @@ -105,7 +106,7 @@
               //
   
               TransientLifestyleHandler handler = 
  -              new TransientLifestyleHandler( manager, provider, helper, profile, context );
  +              new TransientLifestyleHandler( manager, deployment, provider, helper, profile, context );
               handler.enableLogging( getLogger() );
               return handler;
           }
  
  
  
  1.3       +1 -2      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DefaultResource.java
  
  Index: DefaultResource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DefaultResource.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultResource.java	12 Aug 2002 17:36:16 -0000	1.2
  +++ DefaultResource.java	14 Aug 2002 03:03:35 -0000	1.3
  @@ -19,7 +19,6 @@
   import org.apache.excalibur.meta.info.ServiceDescriptor;
   import org.apache.excalibur.meta.info.PhaseDescriptor;
   import org.apache.excalibur.meta.info.ExtensionDescriptor;
  -import org.apache.excalibur.meta.info.Facility;
   
   /**
    * Opaque type that maps a path to a profile.
  
  
  
  1.2       +3 -3      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/LifecycleException.java
  
  Index: LifecycleException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/LifecycleException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LifecycleException.java	12 Aug 2002 08:11:09 -0000	1.1
  +++ LifecycleException.java	14 Aug 2002 03:03:35 -0000	1.2
  @@ -21,7 +21,7 @@
       extends CascadingException
   {
       /**
  -     * Construct a new <code>VerifyException</code> instance.
  +     * Construct a new <code>LifecycleException</code> instance.
        *
        * @param message The detail message for this exception.
        */
  @@ -31,7 +31,7 @@
       }
   
       /**
  -     * Construct a new <code>VerifyException</code> instance.
  +     * Construct a new <code>LifecycleException</code> instance.
        *
        * @param message The detail message for this exception.
        * @param throwable the root cause of the exception
  
  
  
  1.4       +3 -3      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/LifecycleHelper.java
  
  Index: LifecycleHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/LifecycleHelper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LifecycleHelper.java	13 Aug 2002 03:57:56 -0000	1.3
  +++ LifecycleHelper.java	14 Aug 2002 03:03:35 -0000	1.4
  @@ -35,7 +35,7 @@
   import org.apache.excalibur.meta.info.ContextDescriptor;
   import org.apache.excalibur.meta.info.PhaseDescriptor;
   import org.apache.excalibur.meta.info.ExtensionDescriptor;
  -import org.apache.excalibur.meta.info.Facility;
  +import org.apache.excalibur.meta.info.Type;
   
   /**
    * This is a class to help an Application manage the lifecycle of a component.
  @@ -178,7 +178,7 @@
               for( int i=0; i<phases.length; i++ )
               {
                   PhaseDescriptor phase = phases[i];
  -                final Facility facility = profile.getFacility( phase );
  +                final Type facility = profile.getFacility( phase );
                   final ExtensionDescriptor ext = facility.getExtension( phase );
                   if( ext.isApplicable( ExtensionDescriptor.CREATE ) )
                   {
  @@ -284,7 +284,7 @@
           for( int i=(phases.length-1); i>-1; i-- )
           {
               PhaseDescriptor phase = phases[i];
  -            final Facility facility = profile.getFacility( phase );
  +            final Type facility = profile.getFacility( phase );
               final ExtensionDescriptor ext = facility.getExtension( phase );
               if( ext.isApplicable( ExtensionDescriptor.DESTROY ) )
               {
  
  
  
  1.2       +2 -0      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/LifestyleManager.java
  
  Index: LifestyleManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/LifestyleManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LifestyleManager.java	13 Aug 2002 03:57:56 -0000	1.1
  +++ LifestyleManager.java	14 Aug 2002 03:03:35 -0000	1.2
  @@ -75,6 +75,7 @@
        * </pre>
        *
        * @param manager the container type manager
  +     * @param deployment a profile deployment helper
        * @param helper a lifecycle helper
        * @param provider a resource provider
        * @param profile the profies containing the lifestyle policy
  @@ -85,6 +86,7 @@
        */
        public LifestyleHandler getHandler( 
                               ContainerManager manager, 
  +                            DeploymentHelper deployment, 
                               LifecycleHelper helper, 
                               ResourceProvider provider, 
                               Profile profile, 
  
  
  
  1.2       +4 -4      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/ResourceProvider.java
  
  Index: ResourceProvider.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/ResourceProvider.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ResourceProvider.java	12 Aug 2002 08:11:09 -0000	1.1
  +++ ResourceProvider.java	14 Aug 2002 03:03:35 -0000	1.2
  @@ -65,6 +65,7 @@
   import org.apache.excalibur.meta.info.ContextDescriptor;
   import org.apache.excalibur.meta.info.EntryDescriptor;
   import org.apache.excalibur.meta.info.ExtensionDescriptor;
  +import org.apache.excalibur.meta.info.LoggerDescriptor;
   import org.apache.excalibur.merlin.resource.ResourceException;
   import org.apache.excalibur.merlin.assembly.KernelManager;
   import org.apache.excalibur.merlin.assembly.ContainerManager;
  @@ -157,10 +158,9 @@
           }
           else
           {
  -            root = m_classloader.getPath().replace('/','.').substring(1) + "." + profile.getName();
  +            root = m_classloader.getPath().replace('/','.').substring(1) 
  +              + "." + profile.getName();
           }
  -
  -        m_logging.addCategories( root, profile.getCategories() );
           return m_logging.getLoggerForCategory( root );
       }
   
  
  
  
  1.3       +2 -2      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/SingletonLifestyleHandler.java
  
  Index: SingletonLifestyleHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/SingletonLifestyleHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SingletonLifestyleHandler.java	12 Aug 2002 17:36:16 -0000	1.2
  +++ SingletonLifestyleHandler.java	14 Aug 2002 03:03:35 -0000	1.3
  @@ -18,7 +18,6 @@
   import org.apache.excalibur.merlin.model.Resource;
   import org.apache.excalibur.meta.info.PhaseDescriptor;
   import org.apache.excalibur.meta.info.ExtensionDescriptor;
  -import org.apache.excalibur.meta.info.Facility;
   
   
   /**
  @@ -46,12 +45,13 @@
        */
        public SingletonLifestyleHandler( 
                              final ContainerManager manager, 
  +                           final DeploymentHelper deployment, 
                              final ResourceProvider provider,
                              final LifecycleHelper helper,
                              final Profile profile,
                              final Context context )
        {
  -         super( manager, provider, helper, profile, context );
  +         super( manager, deployment, provider, helper, profile, context );
            m_profile = profile;
            m_manager = manager;
            m_helper = helper;
  
  
  
  1.2       +2 -2      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/TransientLifestyleHandler.java
  
  Index: TransientLifestyleHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/TransientLifestyleHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TransientLifestyleHandler.java	12 Aug 2002 08:11:09 -0000	1.1
  +++ TransientLifestyleHandler.java	14 Aug 2002 03:03:35 -0000	1.2
  @@ -20,7 +20,6 @@
   import org.apache.excalibur.merlin.model.Resource;
   import org.apache.excalibur.meta.info.PhaseDescriptor;
   import org.apache.excalibur.meta.info.ExtensionDescriptor;
  -import org.apache.excalibur.meta.info.Facility;
   
   
   /**
  @@ -48,12 +47,13 @@
        */
        public TransientLifestyleHandler( 
                              final ContainerManager manager, 
  +                           final DeploymentHelper deployment, 
                              final ResourceProvider provider,
                              final LifecycleHelper helper,
                              final Profile profile,
                              final Context context )
        {
  -         super( manager, provider, helper, profile, context );
  +         super( manager, deployment, provider, helper, profile, context );
            m_profile = profile;
            m_manager = manager;
            m_helper = helper;
  
  
  
  1.1                  jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DeploymentException.java
  
  Index: DeploymentException.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.merlin.resource;
  
  import org.apache.avalon.framework.CascadingException;
  import org.apache.excalibur.meta.verifier.VerifyException;
  
  /**
   * Exception to indicate error during the deployment of a profile.
   *
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   * @version $Revision: 1.1 $ $Date: 2002/08/14 03:03:35 $
   */
  public final class DeploymentException
      extends CascadingException
  {
      /**
       * Construct a new <code>DeploymentException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public DeploymentException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>DeploymentException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public DeploymentException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DeploymentHelper.java
  
  Index: DeploymentHelper.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.merlin.resource;
  
  import java.util.ArrayList;
  
  import org.apache.avalon.excalibur.i18n.ResourceManager;
  import org.apache.avalon.excalibur.i18n.Resources;
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.activity.Startable;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.Composable;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.container.ContainerUtil;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.context.DefaultContext;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.logger.LogEnabled;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.parameters.Parameterizable;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.service.Serviceable;
  
  import org.apache.excalibur.merlin.assembly.KernelManager;
  import org.apache.excalibur.merlin.assembly.ContainerManager;
  import org.apache.excalibur.merlin.assembly.DefaultLoggerManager;
  import org.apache.excalibur.merlin.container.Container;
  import org.apache.excalibur.merlin.model.Profile;
  import org.apache.excalibur.merlin.model.Resource;
  import org.apache.excalibur.merlin.model.ContextDirective;
  import org.apache.excalibur.merlin.model.CategoriesDescriptor;
  import org.apache.excalibur.merlin.model.Category;
  import org.apache.excalibur.meta.info.ContextDescriptor;
  import org.apache.excalibur.meta.info.PhaseDescriptor;
  import org.apache.excalibur.meta.info.ExtensionDescriptor;
  import org.apache.excalibur.meta.info.LoggerDescriptor;
  import org.apache.excalibur.meta.info.Type;
  
  /**
   * A utility that handles profile deployment.
   * Profile deployment encapsulates the set of actions that need to be 
   * executed on deployment of a profile.  This includes actions such as 
   * the establishment of logging channels, preparation of context instances, 
   * and other once-only actions scoped relative to a specific profile.
   * Clients will normally deploy a profile prior to one or more creation of 
   * instances relative to the profile type.  In other words, deployment should
   * should be invoked once, prior to any subsequent instantiations of the type.
   *
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   */
  public class DeploymentHelper
      extends AbstractLogEnabled
  {
      //=======================================================================
      // static 
      //=======================================================================
  
      private static final Resources REZ =
          ResourceManager.getPackageResources( DeploymentHelper.class );
  
      //=======================================================================
      // state
      //=======================================================================
  
      private DefaultLoggerManager m_logging;
  
      private ContainerManager m_manager;
  
      //=======================================================================
      // constructor
      //=======================================================================
  
     /**
      * Utility class supporting deployment of a profile.
      * @param logging the logging system
      */
      public DeploymentHelper( DefaultLoggerManager logging, ContainerManager manager )
      {
           if( logging == null )
             throw new NullPointerException("logging");
  
           if( manager == null )
             throw new NullPointerException("manager");
  
          m_logging = logging;
          m_manager = manager;
      }
  
      //=======================================================================
      // implementation
      //=======================================================================
  
     /**
      * Method to initiate profile deployment. Th default implementation
      * handles the once only establishment of the logging categories declared
      * under the profile type, qualified by the priority and target criteria
      * declared under the profile categories descriptor.
      *
      * @param profile the profile to deploy
      *
      * @throws DeploymentException if an error during deployment
      */
      public void deploy( final Profile profile )
          throws DeploymentException
      {
          if( profile == null )
            throw new NullPointerException("profile");
  
          getLogger().info("deployment initiated for '" + profile.getName() + "'." );
  
          String root;
          CategoriesDescriptor categories = createLoggingCategories( profile );
          if( m_manager instanceof KernelManager )
          {
              root = m_manager.getPath().replace('/','.').substring(1);
          }
          else
          {
              root = m_manager.getPath().replace('/','.').substring(1) 
                  + "." + profile.getName();
          }
          m_logging.addCategories( root, categories );
      }
  
     /**
      * Create a categories descriptor that takes into account both type logging
      * category declarations and the profile level logging category definitions 
      * under a single <code>CategoriesDescriptor</code> instance.
      *
      * @param profile the profile defining the type and profile level category 
      *   information
      * @return a new fully populated <code>CategoriesDescriptor</code>
      */
      private CategoriesDescriptor createLoggingCategories( Profile profile )
      {
  
          CategoriesDescriptor categories = profile.getCategories();
          LoggerDescriptor[] loggers = profile.getType().getLoggers();
          ArrayList list = new ArrayList();
          for( int i=0; i<loggers.length; i++ )
          {
              String name = loggers[i].getName();
              Category category = categories.getCategory( name );
              if( category != null )
              {
                  list.add( category );
              }
              else
              {
                  list.add( new Category( name ) );
              }
          }
          return new CategoriesDescriptor(
            categories.getName(), 
            categories.getPriority(), 
            categories.getTarget(), 
            (Category[]) list.toArray( new Category[0] )
          );
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>