avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon/merlin/platform/tutorials/hello/conf block.xml
Date Thu, 11 Mar 2004 01:30:39 GMT
mcconnell    2004/03/10 17:30:39

  Modified:    merlin/composition/api/src/java/org/apache/avalon/composition/data
                        BlockCompositionDirective.java
                        BlockIncludeDirective.java ComponentProfile.java
                        ContainmentProfile.java DeploymentProfile.java
                        NamedComponentProfile.java TargetDirective.java
                        Targets.java
               merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder
                        XMLComponentProfileCreator.java
                        XMLContainmentProfileCreator.java
                        XMLProfileCreator.java XMLTargetsCreator.java
               merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl
                        DefaultComponentContext.java
                        DefaultComponentModel.java
                        DefaultContainmentContext.java
                        DefaultContainmentModel.java
                        DefaultDeploymentContext.java
                        DefaultDeploymentModel.java
               merlin/composition/spi/src/java/org/apache/avalon/composition/provider
                        ComponentContext.java DeploymentContext.java
               merlin/platform/tutorials/hello merlin.properties
               merlin/platform/tutorials/hello/conf block.xml
  Log:
  Push the notion of categories on profiles down to DeploymentProfile and simplify the related
API and implementation to consolidate this in one place.  Fix a bug related to updating of
the assigning logging channel following modification of the assifgned target categories.
  
  Revision  Changes    Path
  1.6       +2 -2      avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/BlockCompositionDirective.java
  
  Index: BlockCompositionDirective.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/BlockCompositionDirective.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BlockCompositionDirective.java	10 Mar 2004 10:52:17 -0000	1.5
  +++ BlockCompositionDirective.java	11 Mar 2004 01:30:38 -0000	1.6
  @@ -60,7 +60,7 @@
       public BlockCompositionDirective( 
         final String name, ResourceDirective resource, TargetDirective[] targets )
       {
  -        super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT );
  +        super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT, null );
           if( resource == null )
           {
               throw new NullPointerException( "resource" );
  
  
  
  1.6       +2 -2      avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/BlockIncludeDirective.java
  
  Index: BlockIncludeDirective.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/BlockIncludeDirective.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BlockIncludeDirective.java	10 Mar 2004 10:52:17 -0000	1.5
  +++ BlockIncludeDirective.java	11 Mar 2004 01:30:38 -0000	1.6
  @@ -37,7 +37,7 @@
        */
       public BlockIncludeDirective( final String name, final String path )
       {
  -        super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT );
  +        super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT, null );
           if( path == null )
           {
               throw new NullPointerException( "path" );
  
  
  
  1.5       +2 -12     avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/ComponentProfile.java
  
  Index: ComponentProfile.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/ComponentProfile.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ComponentProfile.java	10 Mar 2004 10:52:17 -0000	1.4
  +++ ComponentProfile.java	11 Mar 2004 01:30:38 -0000	1.5
  @@ -201,7 +201,7 @@
              final Configuration config,
              final Mode mode )
       {
  -        super( name, activation, mode );
  +        super( name, activation, mode, categories );
   
           if( null == classname )
           {
  @@ -257,16 +257,6 @@
       public int getCollectionPolicy()
       {
           return m_collection;
  -    }
  -
  -    /**
  -     * Return the logging categories for the profile.
  -     *
  -     * @return the logger
  -     */
  -    public CategoriesDirective getCategories()
  -    {
  -        return m_categories;
       }
   
       /**
  
  
  
  1.9       +2 -22     avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/ContainmentProfile.java
  
  Index: ContainmentProfile.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/ContainmentProfile.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ContainmentProfile.java	10 Mar 2004 10:52:17 -0000	1.8
  +++ ContainmentProfile.java	11 Mar 2004 01:30:38 -0000	1.9
  @@ -49,9 +49,6 @@
       private static final DeploymentProfile[] EMPTY_PROFILES = 
         new DeploymentProfile[0];
   
  -    private static final CategoriesDirective EMPTY_CATEGORIES = 
  -      new CategoriesDirective();
  -
       private static final ClassLoaderDirective EMPTY_CLASSLOADER =
         new ClassLoaderDirective( 
           new LibraryDirective(), 
  @@ -77,11 +74,6 @@
        */
       private final DeploymentProfile[] m_profiles;
   
  -    /**
  -     * The assigned logging categories.
  -     */
  -    private CategoriesDirective m_categories;
  -
       //--------------------------------------------------------------------------
       // constructor
       //--------------------------------------------------------------------------
  @@ -111,9 +103,8 @@
         final CategoriesDirective categories, 
         DeploymentProfile[] profiles )
       {
  -        super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT );
  +        super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT, categories );
   
  -        m_categories = categories;
           m_classloader = classloader;
           m_profiles = profiles;
           m_export = exports;
  @@ -122,17 +113,6 @@
       //--------------------------------------------------------------------------
       // implementation
       //--------------------------------------------------------------------------
  -
  -    /**
  -     * Return the logging categories for the profile.
  -     *
  -     * @return the categories
  -     */
  -    public CategoriesDirective getCategories()
  -    {
  -        if( m_categories == null ) return EMPTY_CATEGORIES;
  -        return m_categories;
  -    }
   
       /**
        * Return the classloader directive that describes the creation
  
  
  
  1.11      +26 -2     avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/DeploymentProfile.java
  
  Index: DeploymentProfile.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/DeploymentProfile.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DeploymentProfile.java	10 Mar 2004 10:52:17 -0000	1.10
  +++ DeploymentProfile.java	11 Mar 2004 01:30:38 -0000	1.11
  @@ -19,6 +19,8 @@
   
   import java.io.Serializable;
   
  +import org.apache.avalon.logging.data.CategoriesDirective;
  +
   /**
    * Abstract base class for ComponentProfile and ContainmentProfile.
    *
  @@ -27,10 +29,17 @@
    */
   public abstract class DeploymentProfile implements Serializable
   {
  +    //--------------------------------------------------------------------------
  +    // static
  +    //--------------------------------------------------------------------------
  +
       public static final int DEFAULT = -1;
       public static final int ENABLED = 1;
       public static final int DISABLED = 0;
   
  +    private static final CategoriesDirective EMPTY_CATEGORIES = 
  +      new CategoriesDirective();
  +
       //--------------------------------------------------------------------------
       // state
       //--------------------------------------------------------------------------
  @@ -51,14 +60,18 @@
       */
       private final Mode m_mode;
   
  +    private final CategoriesDirective m_categories;
  +
       //--------------------------------------------------------------------------
       // constructor
       //--------------------------------------------------------------------------
   
       public DeploymentProfile( 
  -      final String name, int activation, Mode mode ) 
  +      final String name, int activation, Mode mode, CategoriesDirective categories ) 
       {
           m_activation = activation;
  +        m_categories = categories;
  +
           if( mode != null )
           {
               m_mode = Mode.IMPLICIT;
  @@ -90,6 +103,17 @@
       public String getName()
       {
           return m_name;
  +    }
  +
  +    /**
  +     * Return the logging categories for the profile.
  +     *
  +     * @return the categories
  +     */
  +    public CategoriesDirective getCategories()
  +    {
  +        if( m_categories == null ) return EMPTY_CATEGORIES;
  +        return m_categories;
       }
   
      /**
  
  
  
  1.5       +2 -2      avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/NamedComponentProfile.java
  
  Index: NamedComponentProfile.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/NamedComponentProfile.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NamedComponentProfile.java	10 Mar 2004 10:52:17 -0000	1.4
  +++ NamedComponentProfile.java	11 Mar 2004 01:30:38 -0000	1.5
  @@ -46,7 +46,7 @@
              final String key,
              final int activation )
       {
  -        super( name, activation, Mode.EXPLICIT );
  +        super( name, activation, Mode.EXPLICIT, null );
           m_classname = classname;
           m_key = key;
       }
  
  
  
  1.7       +2 -2      avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/TargetDirective.java
  
  Index: TargetDirective.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/TargetDirective.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TargetDirective.java	29 Feb 2004 22:25:26 -0000	1.6
  +++ TargetDirective.java	11 Mar 2004 01:30:38 -0000	1.7
  @@ -118,7 +118,7 @@
       /**
        * Return the logging categories directive.
        *
  -     * @return the logging categories (possibly null)
  +     * @return the logging categories directive
        */
       public CategoriesDirective getCategoriesDirective()
       {
  
  
  
  1.6       +7 -7      avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/Targets.java
  
  Index: Targets.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/Targets.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Targets.java	29 Feb 2004 22:25:26 -0000	1.5
  +++ Targets.java	11 Mar 2004 01:30:38 -0000	1.6
  @@ -99,12 +99,12 @@
           return null;
       }
   
  -    /**
  -     * Return a set of targets relative to the supplied path.
  -     *
  -     * @param path the base path to match against
  -     * @return the set of relative targets
  -     */
  +   /**
  +    * Return a set of targets relative to the supplied path.
  +    *
  +    * @param path the base path to match against
  +    * @return the set of relative targets
  +    */
       public Targets getTargets( String path )
       {
           final String key = getKey( path );
  
  
  
  1.7       +2 -2      avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLComponentProfileCreator.java
  
  Index: XMLComponentProfileCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLComponentProfileCreator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XMLComponentProfileCreator.java	10 Mar 2004 10:52:18 -0000	1.6
  +++ XMLComponentProfileCreator.java	11 Mar 2004 01:30:38 -0000	1.7
  @@ -100,7 +100,7 @@
           final int collection = getCollectionPolicy( config );
   
           final CategoriesDirective categories = 
  -          getCategoriesDirective( config.getChild( "categories", false ), name );
  +          getCategoriesDirective( config.getChild( "categories", false ) );
           final ContextDirective context = 
             getContextDirective( config.getChild( "context", false ) );
           final DependencyDirective[] dependencies = 
  
  
  
  1.11      +2 -2      avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLContainmentProfileCreator.java
  
  Index: XMLContainmentProfileCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLContainmentProfileCreator.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XMLContainmentProfileCreator.java	10 Mar 2004 10:52:18 -0000	1.10
  +++ XMLContainmentProfileCreator.java	11 Mar 2004 01:30:38 -0000	1.11
  @@ -131,7 +131,7 @@
           // 
   
           final CategoriesDirective categories = 
  -          getCategoriesDirective( implementation.getChild( "categories", false ), name
);
  +          getCategoriesDirective( implementation.getChild( "categories", false ) );
   
           //
           // build nested profiles
  
  
  
  1.6       +45 -22    avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLProfileCreator.java
  
  Index: XMLProfileCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLProfileCreator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XMLProfileCreator.java	10 Mar 2004 10:52:18 -0000	1.5
  +++ XMLProfileCreator.java	11 Mar 2004 01:30:38 -0000	1.6
  @@ -57,7 +57,7 @@
           }
           else
           {
  -            return base + "-" + name; 
  +            return base + "-" + name;
           }
       }
   
  @@ -104,31 +104,28 @@
           }
       }
   
  -    public CategoriesDirective getCategoriesDirective( 
  -      Configuration config, String name )
  +   /**
  +    * Creation of a single categories directive instance from a supplied
  +    * configuration fragment.
  +    * @param config the configuration fragment
  +    * @return the categories directive
  +    */
  +    public CategoriesDirective getCategoriesDirective( Configuration config )
         throws ConfigurationException
       {
  -        if( config != null )
  +        if( null == config )
           {
  -            String priority = config.getAttribute( "priority", null );
  -            String target = target = config.getAttribute( "target", null );
  -            CategoryDirective[] categories = 
  -              getCategoryDirectives( config.getChildren( "category" ) );
  -            return new CategoriesDirective( name, priority, target, categories );
  +            return null;
           }
  -        return null;
  -    }
   
  -    private CategoryDirective[] getCategoryDirectives( Configuration[] children )
  -      throws ConfigurationException
  -    {
  -        ArrayList list = new ArrayList();
  -        for( int i = 0; i < children.length; i++ )
  -        {
  -            CategoryDirective category = getCategoryDirective( children[ i ] );
  -            list.add( category );
  -        }
  -        return (CategoryDirective[]) list.toArray( new CategoryDirective[0] );
  +        final String name = config.getAttribute( "name", "." );
  +        final String priority = config.getAttribute( "priority", null );
  +        final String target = config.getAttribute( "target", null );
  +        final Configuration[] children = config.getChildren();
  +        final CategoryDirective[] categories = 
  +          getCategoryDirectives( children );
  +
  +        return new CategoriesDirective( name, priority, target, categories );
       }
   
       public CategoryDirective getCategoryDirective( Configuration config )
  @@ -150,4 +147,30 @@
           }
       }
   
  +    private CategoryDirective[] getCategoryDirectives( Configuration[] children )
  +      throws ConfigurationException
  +    {
  +        final CategoryDirective[] categories = 
  +          new CategoryDirective[ children.length ];
  +        for( int i = 0; i<children.length; i++ )
  +        {
  +            Configuration config = children[i];
  +            final String name = config.getName();
  +            if( name.equals( "category" ) )
  +            {
  +                categories[i] = getCategoryDirective( config );
  +            }
  +            else if( name.equals( "categories" ) )
  +            {
  +                categories[i] = getCategoriesDirective( config );
  +            }
  +            else
  +            {
  +                final String error = 
  +                  "Nested element [" + name + "] not recognized.";
  +                throw new ConfigurationException( error );
  +            }
  +        }
  +        return categories;
  +    }
   }
  
  
  
  1.8       +2 -2      avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLTargetsCreator.java
  
  Index: XMLTargetsCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLTargetsCreator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XMLTargetsCreator.java	29 Feb 2004 22:25:26 -0000	1.7
  +++ XMLTargetsCreator.java	11 Mar 2004 01:30:38 -0000	1.8
  @@ -92,7 +92,7 @@
   
           CategoriesDirective categories = 
             getCategoriesDirective( 
  -            config.getChild( "categories", false ), name );
  +            config.getChild( "categories", false ) );
   
           //
           // get the overriding configuration
  
  
  
  1.10      +3 -3      avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultComponentContext.java
  
  Index: DefaultComponentContext.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultComponentContext.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultComponentContext.java	8 Mar 2004 11:28:36 -0000	1.9
  +++ DefaultComponentContext.java	11 Mar 2004 01:30:38 -0000	1.10
  @@ -108,7 +108,7 @@
         String partition )
       {
           super( 
  -          logger, system, partition, name, profile.getMode(), graph );
  +          logger, system, partition, name, profile.getMode(), profile, graph );
   
           if( partition == null )
           {
  @@ -195,7 +195,7 @@
       *
       * @return the profile
       */
  -    public ComponentProfile getProfile()
  +    public ComponentProfile getComponentProfile()
       {
           return m_profile;
       }
  
  
  
  1.13      +10 -37    avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultComponentModel.java
  
  Index: DefaultComponentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultComponentModel.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DefaultComponentModel.java	10 Mar 2004 10:52:18 -0000	1.12
  +++ DefaultComponentModel.java	11 Mar 2004 01:30:38 -0000	1.13
  @@ -106,8 +106,6 @@
       // mutable state
       //--------------------------------------------------------------
   
  -    private CategoriesDirective m_categories;
  -
       private Configuration m_config;
   
       private Parameters m_parameters;
  @@ -134,9 +132,7 @@
   
           m_activation = getDefaultActivationPolicy();
   
  -        m_categories = m_context.getProfile().getCategories();
  -
  -        setCollectionPolicy( m_context.getProfile().getCollectionPolicy() );
  +        setCollectionPolicy( m_context.getComponentProfile().getCollectionPolicy() );
   
           ClassLoader classLoader = m_context.getClassLoader();
   
  @@ -145,7 +141,7 @@
               final Configuration defaults = 
                 m_context.getType().getConfiguration();
               final Configuration explicit = 
  -              m_context.getProfile().getConfiguration();
  +              m_context.getComponentProfile().getConfiguration();
               final Configuration consolidated = 
                 consolidateConfigurations( explicit, defaults );
               if( consolidated != null )
  @@ -161,7 +157,7 @@
           if( isParameterizable() )
           {
               final Parameters parameters = 
  -              m_context.getProfile().getParameters();
  +              m_context.getComponentProfile().getParameters();
               if( parameters != null )
               {
                   m_parameters = parameters;
  @@ -179,7 +175,7 @@
               final ContextDescriptor contextDescriptor = 
                 m_context.getType().getContext();
               final ContextDirective contextDirective = 
  -              m_context.getProfile().getContext();
  +              m_context.getComponentProfile().getContext();
               final Logger log = getLogger().getChildLogger( "context" );
               m_contextModel = new DefaultContextModel( 
                 log, contextDescriptor, contextDirective, context );
  @@ -202,7 +198,7 @@
           {
               DependencyDescriptor descriptor = dependencies[i];
               DependencyDirective directive = 
  -              context.getProfile().getDependencyDirective( descriptor.getKey() );
  +              context.getComponentProfile().getDependencyDirective( descriptor.getKey()
);
               m_dependencies[i] = 
                 new DefaultDependencyModel( 
                   context.getLogger().getChildLogger( "deps" ), 
  @@ -225,7 +221,7 @@
           {
               StageDescriptor descriptor = stages[i];
               StageDirective directive = 
  -              context.getProfile().getStageDirective( descriptor.getKey() );
  +              context.getComponentProfile().getStageDirective( descriptor.getKey() );
               m_stages[i] = 
                 new DefaultStageModel( 
                   context.getLogger().getChildLogger( "stages" ), 
  @@ -239,7 +235,7 @@
       public boolean getDefaultActivationPolicy()
       {
           final int activation = 
  -          m_context.getProfile().getActivationDirective();
  +          m_context.getComponentProfile().getActivationDirective();
   
           if( activation != DeploymentProfile.DEFAULT )
           {
  @@ -419,18 +415,9 @@
           return m_context.getType().getService( reference ) != null;
       }
   
  -    //==============================================================
  +    //--------------------------------------------------------------
       // ComponentModel
  -    //==============================================================
  -
  -   /**
  -    * Return the logging categories. 
  -    * @return the logging categories
  -    */
  -    public CategoriesDirective getCategories()
  -    {
  -        return m_categories;
  -    }
  +    //--------------------------------------------------------------
   
      /**
       * Return the collection policy for the model. If a profile
  @@ -493,20 +480,6 @@
           return m_context.getType().getInfo().getCollectionPolicy();
       }
       
  -
  -   /**
  -    * Set categories. 
  -    * @param categories the categories directive
  -    */
  -    public void setCategories( CategoriesDirective categories )
  -    {
  -        //
  -        // TODO: merge categories with profile categories
  -        //
  -
  -        m_categories = categories;
  -    }
  -
      /**
       * Return the activation policy for the model. 
       * @return the activaltion policy
  
  
  
  1.8       +2 -2      avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentContext.java
  
  Index: DefaultContainmentContext.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentContext.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultContainmentContext.java	8 Mar 2004 11:28:36 -0000	1.7
  +++ DefaultContainmentContext.java	11 Mar 2004 01:30:38 -0000	1.8
  @@ -117,7 +117,7 @@
         File home, File temp, ContainmentModel parent, 
         ContainmentProfile profile, String partition, String name )
       {
  -        super( logger, system, partition, name, profile.getMode(), graph );
  +        super( logger, system, partition, name, profile.getMode(), profile, graph );
   
           if( system == null )
           {
  
  
  
  1.41      +9 -36     avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java
  
  Index: DefaultContainmentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- DefaultContainmentModel.java	8 Mar 2004 11:28:36 -0000	1.40
  +++ DefaultContainmentModel.java	11 Mar 2004 01:30:38 -0000	1.41
  @@ -558,26 +558,6 @@
       }
   
      /**
  -    * Return the logging categories. 
  -    * @return the logging categories
  -    */
  -    public CategoriesDirective getCategories()
  -    {
  -        if( m_categories == null ) 
  -          return m_context.getContainmentProfile().getCategories();
  -        return m_categories;
  -    }
  -
  -   /**
  -    * Set categories. 
  -    * @param categories the logging categories
  -    */
  -    public void setCategories( CategoriesDirective categories )
  -    {
  -        m_categories = categories; // TODO: merge with existing categories
  -    }
  -
  -   /**
       * Add a model referenced by a url to this model.
       * @param url the url of the model to include
       * @return the model 
  @@ -815,9 +795,16 @@
           {
               TargetDirective target = targets[i];
               final String path = target.getPath();
  -            Object model = getModel( path );
  +            DeploymentModel model = getModel( path );
               if( model != null )
               {
  +                getLogger().debug( "customizing target " + model );
  +                if( target.getCategoriesDirective() != null )
  +                {
  +                    model.setCategories( 
  +                      target.getCategoriesDirective() );
  +                }
  +
                   if( model instanceof ComponentModel )
                   {
                       ComponentModel deployment = (ComponentModel) model;
  @@ -825,20 +812,6 @@
                       {
                           deployment.setConfiguration( 
                             target.getConfiguration() );
  -                    }
  -                    if( target.getCategoriesDirective() != null )
  -                    {
  -                        deployment.setCategories( 
  -                          target.getCategoriesDirective() );
  -                    }
  -                }
  -                else if( model instanceof ContainmentModel )
  -                {
  -                    ContainmentModel containment = (ContainmentModel) model;
  -                    if( target.getCategoriesDirective() != null )
  -                    {
  -                        containment.setCategories( 
  -                          target.getCategoriesDirective() );
                       }
                   }
               }
  
  
  
  1.7       +20 -4     avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentContext.java
  
  Index: DefaultDeploymentContext.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentContext.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultDeploymentContext.java	10 Feb 2004 16:23:33 -0000	1.6
  +++ DefaultDeploymentContext.java	11 Mar 2004 01:30:38 -0000	1.7
  @@ -20,6 +20,7 @@
   import org.apache.avalon.composition.model.DependencyGraph;
   import org.apache.avalon.composition.provider.SystemContext;
   import org.apache.avalon.composition.provider.DeploymentContext;
  +import org.apache.avalon.composition.data.DeploymentProfile;
   
   import org.apache.avalon.framework.context.DefaultContext;
   import org.apache.avalon.framework.logger.Logger;
  @@ -44,6 +45,7 @@
       private final Mode m_mode;
       private final DependencyGraph m_graph;
       private final SystemContext m_system;
  +    private final DeploymentProfile m_profile;
   
       //---------------------------------------------------------
       // constructor
  @@ -60,7 +62,7 @@
       */
       public DefaultDeploymentContext( 
         Logger logger, SystemContext system, String partition, String name, 
  -      Mode mode, DependencyGraph graph )
  +      Mode mode, DeploymentProfile profile, DependencyGraph graph )
       {
           if( logger == null )
           {
  @@ -70,15 +72,20 @@
           {
               throw new NullPointerException( "name" );
           }
  -        if( mode == null )
  +        if( profile == null )
           {
               throw new NullPointerException( "mode" );
           }
  +        if( profile == null )
  +        {
  +            throw new NullPointerException( "profile" );
  +        }
           if( system == null )
           {
               throw new NullPointerException( "system" );
           }
   
  +        m_profile = profile;
           m_graph = new DependencyGraph( graph );
           if( graph != null )
           {
  @@ -90,7 +97,6 @@
           m_partition = partition;
           m_name = name;
           m_mode = mode;
  -
       }
   
       //---------------------------------------------------------
  @@ -149,6 +155,16 @@
       public Mode getMode()
       {
           return m_mode;
  +    }
  +
  +   /**
  +    * Return the deployment profile.
  +    *
  +    * @return the profile
  +    */
  +    public DeploymentProfile getProfile()
  +    {
  +        return m_profile;
       }
   
      /**
  
  
  
  1.20      +27 -5     avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentModel.java
  
  Index: DefaultDeploymentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentModel.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DefaultDeploymentModel.java	8 Mar 2004 11:28:36 -0000	1.19
  +++ DefaultDeploymentModel.java	11 Mar 2004 01:30:38 -0000	1.20
  @@ -36,6 +36,7 @@
   import org.apache.avalon.util.i18n.Resources;
   
   import org.apache.avalon.logging.data.CategoriesDirective;
  +import org.apache.avalon.logging.provider.LoggingManager;
   
   
   /**
  @@ -70,6 +71,10 @@
   
       private Commissionable m_handler = null;
   
  +    private CategoriesDirective m_categories;
  +
  +    private Logger m_logger;
  +
       //--------------------------------------------------------------
       // constructor
       //--------------------------------------------------------------
  @@ -91,9 +96,13 @@
           {
               throw new NullPointerException( "security" );
           }
  +
           m_context = context;
           m_security = security;
   
  +        m_logger = m_context.getLogger();
  +        m_categories = m_context.getProfile().getCategories();
  +
           Permissions permissions = security.getPermissions();
           ProtectionDomain domain = 
             new ProtectionDomain( null, permissions );
  @@ -217,7 +226,7 @@
       */
       public Logger getLogger()
       {
  -        return m_context.getLogger();
  +        return m_logger;
       }
   
      /**
  @@ -272,12 +281,25 @@
       * Return the logging categories. 
       * @return the logging categories
       */
  -    public abstract CategoriesDirective getCategories();
  +    public CategoriesDirective getCategories()
  +    {
  +        if( m_categories == null ) 
  +          return m_context.getProfile().getCategories();
  +        return m_categories;
  +    }
   
      /**
       * Set categories. 
       * @param categories the logging categories
       */
  -    public abstract void setCategories( CategoriesDirective categories );
  -
  +    public void setCategories( CategoriesDirective categories )
  +    {
  +        m_categories = categories;
  +        
  +        LoggingManager logging = 
  +          m_context.getSystemContext().getLoggingManager();
  +        final String path = getQualifiedName();
  +        logging.addCategories( path, categories );
  +        m_logger = logging.getLoggerForCategory( path );
  +    }
   }
  
  
  
  1.3       +2 -2      avalon/merlin/composition/spi/src/java/org/apache/avalon/composition/provider/ComponentContext.java
  
  Index: ComponentContext.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/spi/src/java/org/apache/avalon/composition/provider/ComponentContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ComponentContext.java	22 Feb 2004 16:12:58 -0000	1.2
  +++ ComponentContext.java	11 Mar 2004 01:30:38 -0000	1.3
  @@ -90,7 +90,7 @@
       *
       * @return the profile
       */
  -    ComponentProfile getProfile();
  +    ComponentProfile getComponentProfile();
   
      /**
       * Return the component type.
  
  
  
  1.2       +9 -1      avalon/merlin/composition/spi/src/java/org/apache/avalon/composition/provider/DeploymentContext.java
  
  Index: DeploymentContext.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/spi/src/java/org/apache/avalon/composition/provider/DeploymentContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DeploymentContext.java	10 Feb 2004 16:23:35 -0000	1.1
  +++ DeploymentContext.java	11 Mar 2004 01:30:38 -0000	1.2
  @@ -22,6 +22,7 @@
   import org.apache.avalon.framework.context.Context;
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.composition.data.Mode;
  +import org.apache.avalon.composition.data.DeploymentProfile;
   
   /**
    * Deployment context that is supplied to a deployment model.
  @@ -77,4 +78,11 @@
       * @return the dependency graph
       */
       DependencyGraph getDependencyGraph();
  +
  +   /**
  +    * Return the deployment profile.
  +    *
  +    * @return the profile
  +    */
  +    DeploymentProfile getProfile();
   }
  
  
  
  1.9       +5 -2      avalon/merlin/platform/tutorials/hello/merlin.properties
  
  Index: merlin.properties
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/platform/tutorials/hello/merlin.properties,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- merlin.properties	20 Feb 2004 22:49:57 -0000	1.8
  +++ merlin.properties	11 Mar 2004 01:30:39 -0000	1.9
  @@ -1,3 +1,6 @@
   
  -merlin.info = true
  -merlin.debug = false
  +#
  +# example properties
  +#
  +# merlin.info = true
  +# merlin.debug = false
  
  
  
  1.3       +1 -1      avalon/merlin/platform/tutorials/hello/conf/block.xml
  
  Index: block.xml
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/platform/tutorials/hello/conf/block.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- block.xml	14 Oct 2003 10:52:05 -0000	1.2
  +++ block.xml	11 Mar 2004 01:30:39 -0000	1.3
  @@ -1,6 +1,6 @@
   
   <container name="tutorial">
   
  -   <component name="hello" class="tutorial.HelloComponent"/>
  +   <component name="hello" class="tutorial.HelloComponent" activation="startup"/>
   
   </container>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message