avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl DefaultKernel.java
Date Tue, 26 Aug 2003 22:45:25 GMT
mcconnell    2003/08/26 15:45:25

  Modified:    merlin/activation/src/java/org/apache/avalon/activation/appliance/impl
                        DefaultBlock.java
               merlin/composition/src/java/org/apache/avalon/composition/data/builder
                        XMLContainmentProfileCreator.java
                        XMLDeploymentProfileCreator.java
                        XMLProfileCreator.java
               merlin/composition/src/java/org/apache/avalon/composition/data/writer
                        XMLContainmentProfileWriter.java
                        XMLDeploymentProfileWriter.java
               merlin/composition/src/java/org/apache/avalon/composition/logging/impl
                        DefaultLoggingManager.java
               merlin/composition/src/java/org/apache/avalon/composition/model/impl
                        DefaultClassLoaderModel.java
                        DefaultContainmentModel.java
                        DefaultModelFactory.java Scanner.java
               merlin/composition-spi/src/java/org/apache/avalon/composition/data
                        ContainmentProfile.java
               merlin/composition-spi/src/java/org/apache/avalon/composition/model
                        ClassLoaderModel.java ContainmentModel.java
               merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl
                        DefaultKernel.java
  Log:
  Global update supporting revisions to log catagory handling on containers scoped definitions.
  
  Revision  Changes    Path
  1.8       +7 -2      avalon-sandbox/merlin/activation/src/java/org/apache/avalon/activation/appliance/impl/DefaultBlock.java
  
  Index: DefaultBlock.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/activation/src/java/org/apache/avalon/activation/appliance/impl/DefaultBlock.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultBlock.java	20 Aug 2003 11:57:13 -0000	1.7
  +++ DefaultBlock.java	26 Aug 2003 22:45:24 -0000	1.8
  @@ -867,9 +867,14 @@
           {
               getLogger().debug( "creating block: " + path );
               ContainmentModel containment = (ContainmentModel) model;
  +            CategoriesDirective categories = containment.getCategories();
  +            if( categories != null )
  +            {
  +                m_context.getLoggingManager().addCategories( path, categories );
  +            }
  +            Logger logger = m_context.getLoggingManager().getLoggerForCategory( path );
               ApplianceRepository repository = 
                 new DefaultApplianceRepository( m_repository );
  -            Logger logger = m_context.getLoggingManager().getLoggerForCategory( path );
               appliance = 
                 new DefaultBlock( 
                   logger, containment, new DependencyGraph( m_graph ), m_context,
  
  
  
  1.11      +14 -2     avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLContainmentProfileCreator.java
  
  Index: XMLContainmentProfileCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/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	25 Aug 2003 16:41:04 -0000	1.10
  +++ XMLContainmentProfileCreator.java	26 Aug 2003 22:45:24 -0000	1.11
  @@ -69,6 +69,7 @@
   import org.apache.avalon.meta.info.ServiceDescriptor;
   import org.apache.avalon.composition.data.BlockCompositionDirective;
   import org.apache.avalon.composition.data.BlockIncludeDirective;
  +import org.apache.avalon.composition.data.CategoriesDirective;
   import org.apache.avalon.composition.data.ContainmentProfile;
   import org.apache.avalon.composition.data.DeploymentProfile;
   import org.apache.avalon.composition.data.FilesetDirective;
  @@ -162,13 +163,24 @@
                   implementation.getChild( "classloader", false ) );
           }
   
  +        //
  +        // build any logging category directives
  +        // 
  +
  +        final CategoriesDirective categories = 
  +          getCategoriesDirective( implementation.getChild( "categories", false ), name
);
  +
  +        //
  +        // build nested profiles
  +        // 
  +
           final Profile[] profiles = createProfiles( implementation );
   
           //
           // return the containment profile
           // 
   
  -        return new ContainmentProfile( name, classloader, exports, profiles );
  +        return new ContainmentProfile( name, classloader, exports, categories, profiles
);
       }
   
       private ClassLoaderDirective createClassLoaderDirective( Configuration config )
  
  
  
  1.7       +1 -47     avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLDeploymentProfileCreator.java
  
  Index: XMLDeploymentProfileCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLDeploymentProfileCreator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XMLDeploymentProfileCreator.java	19 Aug 2003 03:51:23 -0000	1.6
  +++ XMLDeploymentProfileCreator.java	26 Aug 2003 22:45:24 -0000	1.7
  @@ -213,52 +213,6 @@
           return new SelectionDirective( feature, value, match, optional );
       }
   
  -    public CategoriesDirective getCategoriesDirective( 
  -      Configuration config, String name )
  -      throws ConfigurationException
  -    {
  -        if( config != null )
  -        {
  -            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;
  -    }
  -
  -    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] );
  -    }
  -
  -    public CategoryDirective getCategoryDirective( Configuration config )
  -      throws ConfigurationException
  -    {
  -        try
  -        {
  -            final String name = config.getAttribute( "name" );
  -            final String priority = config.getAttribute( "priority", null );
  -            final String target = config.getAttribute( "target", null );
  -            return new CategoryDirective( name, priority, target );
  -        }
  -        catch( ConfigurationException e )
  -        {
  -            final String error = 
  -              "Invalid category descriptor."
  -              + ConfigurationUtil.list( config );
  -            throw new ConfigurationException( error, e );
  -        }
  -    }
  -
       protected Parameters getParameters( Configuration config )
         throws ConfigurationException
       {
  
  
  
  1.3       +55 -1     avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLProfileCreator.java
  
  Index: XMLProfileCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLProfileCreator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLProfileCreator.java	27 Jul 2003 11:50:05 -0000	1.2
  +++ XMLProfileCreator.java	26 Aug 2003 22:45:24 -0000	1.3
  @@ -50,9 +50,16 @@
   
   package org.apache.avalon.composition.data.builder;
   
  +import java.util.ArrayList;
  +
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.configuration.Configuration;
  +import org.apache.avalon.framework.configuration.ConfigurationException;
  +import org.apache.avalon.composition.data.CategoriesDirective;
  +import org.apache.avalon.composition.data.CategoryDirective;
  +import org.apache.excalibur.configuration.ConfigurationUtil;
  +
   
   /**
    *
  @@ -118,4 +125,51 @@
           }
           return fallback ;
       }
  +
  +    public CategoriesDirective getCategoriesDirective( 
  +      Configuration config, String name )
  +      throws ConfigurationException
  +    {
  +        if( config != null )
  +        {
  +            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;
  +    }
  +
  +    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] );
  +    }
  +
  +    public CategoryDirective getCategoryDirective( Configuration config )
  +      throws ConfigurationException
  +    {
  +        try
  +        {
  +            final String name = config.getAttribute( "name" );
  +            final String priority = config.getAttribute( "priority", null );
  +            final String target = config.getAttribute( "target", null );
  +            return new CategoryDirective( name, priority, target );
  +        }
  +        catch( ConfigurationException e )
  +        {
  +            final String error = 
  +              "Invalid category descriptor."
  +              + ConfigurationUtil.list( config );
  +            throw new ConfigurationException( error, e );
  +        }
  +    }
  +
   }
  
  
  
  1.10      +2 -1      avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/writer/XMLContainmentProfileWriter.java
  
  Index: XMLContainmentProfileWriter.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/writer/XMLContainmentProfileWriter.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XMLContainmentProfileWriter.java	17 Aug 2003 06:35:51 -0000	1.9
  +++ XMLContainmentProfileWriter.java	26 Aug 2003 22:45:24 -0000	1.10
  @@ -127,6 +127,7 @@
           final String padding = pad + INDENT;
           writeServiceDirectives( writer, profile.getExportDirectives(), padding );
           writeClassLoader( writer, profile.getClassLoaderDirective(), padding );
  +        writeCategories( writer, profile.getCategories(), padding );
           writeProfiles( writer, profile.getProfiles(), padding );
           writer.write( "\n" + pad + "</container>" );
           writer.write( "\n" );
  
  
  
  1.4       +15 -6     avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/writer/XMLDeploymentProfileWriter.java
  
  Index: XMLDeploymentProfileWriter.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/writer/XMLDeploymentProfileWriter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLDeploymentProfileWriter.java	25 Jul 2003 06:14:05 -0000	1.3
  +++ XMLDeploymentProfileWriter.java	26 Aug 2003 22:45:24 -0000	1.4
  @@ -271,14 +271,23 @@
        * @param categories the logging categopries directive
        * @throws IOException if unable to write xml
        */
  -    private void writeCategories( 
  +    protected void writeCategories( 
         final Writer writer, final CategoriesDirective categories, String pad )
         throws IOException
       {
  -        if( categories == null )
  -        {
  -            return;
  -        }
  +
  +        //
  +        // if the categoriy is null or empty then don't bother with it
  +        //
  +
  +        if( categories == null ) return;
  +        if( ( categories.getPriority() == null ) 
  +          && ( categories.getTarget() == null )
  +          && ( categories.getCategories().length == 0 ) ) return;
  +
  +        //
  +        // write out the categories directive
  +        //
   
           writer.write( "\n" + pad + "<categories" );
           if( categories.getPriority() != null )
  
  
  
  1.9       +1 -0      avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/logging/impl/DefaultLoggingManager.java
  
  Index: DefaultLoggingManager.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/logging/impl/DefaultLoggingManager.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultLoggingManager.java	23 Aug 2003 09:35:45 -0000	1.8
  +++ DefaultLoggingManager.java	26 Aug 2003 22:45:24 -0000	1.9
  @@ -346,6 +346,7 @@
   
           if( !m_debug && priority != null )
           {
  +            //System.out.println( "## setting [" + name + "] to: " + priority );
               final Priority priorityValue = Priority.getPriorityForName( priority );
               if( !priorityValue.getName().equals( priority ) )
               {
  
  
  
  1.20      +7 -19     avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultClassLoaderModel.java
  
  Index: DefaultClassLoaderModel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultClassLoaderModel.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DefaultClassLoaderModel.java	23 Aug 2003 17:16:35 -0000	1.19
  +++ DefaultClassLoaderModel.java	26 Aug 2003 22:45:24 -0000	1.20
  @@ -114,7 +114,7 @@
    *  <li>consolidate the generated classpath relative to 
    *      the optional extensions established by any parent
    *      classloader models</li>
  - * </li>
  + * </ul>
    * <p>
    * Class dependecies include the Excalibur i18n, the assembly 
    * repository package, the avalon framework and meta packages,
  @@ -240,8 +240,8 @@
   
               ArrayList types = new ArrayList();
               ArrayList services = new ArrayList();
  -            Scanner scanner = new Scanner( m_classLoader );
  -            scanner.enableLogging( getLocalLogger().getChildLogger( "scanner" ) );
  +            Logger scannerLogger = getLocalLogger().getChildLogger( "scanner" );
  +            Scanner scanner = new Scanner( scannerLogger, m_classLoader );
               scanner.scan( m_urls, types, services );
   
               //
  @@ -270,26 +270,14 @@
       * Creation of a classloader context using this model as the 
       * relative parent.
       *
  +    * @param logger the loggiong channel
       * @param profile the profile directive
  +    * @param implied a sequence of implied urls
       * @return a new classloader context
       */
       public ClassLoaderContext createChildContext( 
  -       ContainmentProfile profile, String name )
  +       Logger logger, ContainmentProfile profile, URL[] implied )
       {
  -        return createChildContext( profile, name, null );
  -    }
  -
  -   /**
  -    * Creation of a classloader context using this model as the 
  -    * relative parent.
  -    *
  -    * @param profile the profile directive
  -    * @return a new classloader context
  -    */
  -    public ClassLoaderContext createChildContext( 
  -       ContainmentProfile profile, String name, URL[] implied )
  -    {
  -        Logger logger = getLogger().getChildLogger( name );
           Repository repository = m_context.getRepository();
           File base = m_context.getBaseDirectory();
           OptionalPackage[] packages = getOptionalPackages();
  
  
  
  1.30      +41 -10    avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java
  
  Index: DefaultContainmentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- DefaultContainmentModel.java	25 Aug 2003 16:41:04 -0000	1.29
  +++ DefaultContainmentModel.java	26 Aug 2003 22:45:24 -0000	1.30
  @@ -63,6 +63,7 @@
   
   import org.apache.avalon.composition.data.BlockCompositionDirective;
   import org.apache.avalon.composition.data.BlockIncludeDirective;
  +import org.apache.avalon.composition.data.CategoriesDirective;
   import org.apache.avalon.composition.data.ContainmentProfile;
   import org.apache.avalon.composition.data.DeploymentProfile;
   import org.apache.avalon.composition.data.Profile;
  @@ -82,6 +83,7 @@
   import org.apache.avalon.composition.model.ModelSelector;
   import org.apache.avalon.composition.model.ProfileSelector;
   import org.apache.avalon.composition.model.TypeRepository;
  +import org.apache.avalon.composition.logging.LoggingManager;
   import org.apache.avalon.composition.util.StringHelper;
   import org.apache.avalon.repository.Repository;
   import org.apache.avalon.repository.RepositoryException;
  @@ -142,6 +144,11 @@
   
       private final Map m_models = new Hashtable();
   
  +    /**
  +     * The assigned logging categories.
  +     */
  +    private CategoriesDirective m_categories;
  +
       //==============================================================
       // constructor
       //==============================================================
  @@ -240,6 +247,25 @@
       // ContainmentModel
       //==============================================================
   
  +   /**
  +    * 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
  +    }
  +
       public Model addModel( URL url ) throws ModelException
       {
           ContainmentModel model = createContainmentModel( null, url );
  @@ -386,7 +412,7 @@
         throws ModelException
       {
           final String partition = getPartition();
  -        final Logger logger = getLogger().getChildLogger( name );
  +
           if( getLogger().isDebugEnabled() )
           {
               final String message = 
  @@ -394,20 +420,28 @@
               getLogger().debug( message );
           }
   
  +
  +        LoggingManager logging = m_context.getSystemContext().getLoggingManager();
  +        final String base = partition + name;
  +        logging.addCategories( base, profile.getCategories() );
  +        Logger log = logging.getLoggerForCategory( base );
  +        
           try
           {
               ClassLoaderContext cntx = 
                 m_context.getClassLoaderModel().createChildContext( 
  -                profile, name, implicit );
  +                log, profile, implicit );
  +
               final ClassLoaderModel classLoaderModel = 
                 DefaultClassLoaderModel.createClassLoaderModel( cntx );
               final File home = new File( m_context.getHomeDirectory(), name );
               final File temp = new File( m_context.getTempDirectory(), name );
  +            final Logger logger = getLogger().getChildLogger( name );
   
               DefaultContainmentContext context = 
                 new DefaultContainmentContext( 
                   logger, m_context.getSystemContext(), 
  -                classLoaderModel, home, temp, profile, getPartition(), name );
  +                classLoaderModel, home, temp, profile, partition, name );
   
               //
               // TODO: lookup the profile for a factory declaration, then 
  @@ -472,7 +506,7 @@
                       {
                           ((DeploymentModel)child).setConfiguration( target.getConfiguration()
);
                       }
  -                    else
  +                    else if( child instanceof ContainmentModel )
                       {
                           final String warn = 
                             "Ignoring target configuration as the path [" 
  @@ -486,12 +520,9 @@
                       {
                           ((DeploymentModel)child).setCategories( target.getCategoriesDirective()
);
                       }
  -                    else
  +                    else if( child instanceof ContainmentModel )
                       {
  -                        final String warn = 
  -                          "Ignoring target categories as the path [" 
  -                          + target.getPath() 
  -                          + "] does not refer to a deployment model";
  +                        ((ContainmentModel)child).setCategories( target.getCategoriesDirective()
);
                       }
                   }
               }
  
  
  
  1.12      +3 -2      avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultModelFactory.java
  
  Index: DefaultModelFactory.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultModelFactory.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DefaultModelFactory.java	20 Aug 2003 11:57:13 -0000	1.11
  +++ DefaultModelFactory.java	26 Aug 2003 22:45:24 -0000	1.12
  @@ -224,7 +224,8 @@
               throw new NullPointerException( "profile" );
           }
   
  -        final Logger logger = getLogger();
  +        m_system.getLoggingManager().addCategories( profile.getCategories() );
  +        final Logger logger = m_system.getLoggingManager().getLoggerForCategory("");
   
           try
           {
  
  
  
  1.13      +5 -2      avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/Scanner.java
  
  Index: Scanner.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/Scanner.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Scanner.java	23 Aug 2003 17:16:36 -0000	1.12
  +++ Scanner.java	26 Aug 2003 22:45:24 -0000	1.13
  @@ -73,6 +73,7 @@
   import org.apache.avalon.composition.util.ExceptionHelper;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  +import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.composition.data.Profile;
   import org.apache.avalon.composition.data.ProfilePackage;
  @@ -142,15 +143,17 @@
        * The scanner is responsible for scanning suppied URLs for 
        * service and types.
        *
  +     * @param logger the logging channel
        * @param classloader the classloader
        */
  -    public Scanner( ClassLoader classloader )
  +    public Scanner( Logger logger, ClassLoader classloader )
       {
           if( classloader == null )
           {
               throw new NullPointerException( "classloader" );
           }
           m_classloader = classloader;
  +        enableLogging( logger );
       }
   
       //=======================================================================
  
  
  
  1.7       +22 -2     avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/data/ContainmentProfile.java
  
  Index: ContainmentProfile.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/data/ContainmentProfile.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ContainmentProfile.java	23 Aug 2003 02:23:30 -0000	1.6
  +++ ContainmentProfile.java	26 Aug 2003 22:45:24 -0000	1.7
  @@ -87,6 +87,8 @@
   
       private static final Profile[] EMPTY_PROFILES = new Profile[0];
   
  +    private static final CategoriesDirective EMPTY_CATEGORIES = new CategoriesDirective();
  +
       private static final ClassLoaderDirective EMPTY_CLASSLOADER =
         new ClassLoaderDirective( new LibraryDirective(), new ClasspathDirective() );
   
  @@ -109,6 +111,11 @@
        */
       private final Profile[] m_profiles;
   
  +    /**
  +     * The assigned logging categories.
  +     */
  +    private CategoriesDirective m_categories;
  +
       //--------------------------------------------------------------------------
       // constructor
       //--------------------------------------------------------------------------
  @@ -118,7 +125,7 @@
       */
       public ContainmentProfile()
       {
  -        this( "container", null, null, null );
  +        this( "container", null, null, null, null );
       }
   
      /**
  @@ -135,10 +142,12 @@
       public ContainmentProfile( 
         final String name, final ClassLoaderDirective classloader, 
         final ServiceDirective[] exports,
  +      final CategoriesDirective categories, 
         Profile[] profiles )
       {
           super( name, true, Mode.EXPLICIT );
   
  +        m_categories = categories;
           m_classloader = classloader;
           m_profiles = profiles;
           m_export = exports;
  @@ -147,6 +156,17 @@
       //--------------------------------------------------------------------------
       // 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.10      +4 -14     avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/ClassLoaderModel.java
  
  Index: ClassLoaderModel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/ClassLoaderModel.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ClassLoaderModel.java	11 Aug 2003 22:58:50 -0000	1.9
  +++ ClassLoaderModel.java	26 Aug 2003 22:45:25 -0000	1.10
  @@ -55,7 +55,7 @@
   import org.apache.avalon.extension.manager.OptionalPackage;
   import org.apache.avalon.extension.manager.ExtensionManager;
   import org.apache.avalon.composition.data.ContainmentProfile;
  -
  +import org.apache.avalon.framework.logger.Logger;
   
   /**
    * <p>Specification of a classloader model from which a 
  @@ -129,21 +129,11 @@
       * Creation of a classloader context using this model as the 
       * relative parent.
       *
  +    * @param logger the logging channel 
       * @param profile the containment profile
  -    * @param name the container name
  -    * @return a new classloader context
  -    */
  -    ClassLoaderContext createChildContext( ContainmentProfile profile, String name );
  -
  -   /**
  -    * Creation of a classloader context using this model as the 
  -    * relative parent.
  -    *
  -    * @param profile the containment profile
  -    * @param name the container name
       * @param implied any implied urls
       * @return a new classloader context
       */
       ClassLoaderContext createChildContext( 
  -      ContainmentProfile profile, String name, URL[] implied );
  +      Logger logger, ContainmentProfile profile, URL[] implied );
   }
  
  
  
  1.14      +14 -1     avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/ContainmentModel.java
  
  Index: ContainmentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/ContainmentModel.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ContainmentModel.java	11 Aug 2003 22:58:50 -0000	1.13
  +++ ContainmentModel.java	26 Aug 2003 22:45:25 -0000	1.14
  @@ -56,6 +56,7 @@
   import org.apache.avalon.composition.data.DeploymentProfile;
   import org.apache.avalon.composition.data.Profile;
   import org.apache.avalon.composition.data.ServiceDirective;
  +import org.apache.avalon.composition.data.CategoriesDirective;
   import org.apache.avalon.meta.info.DependencyDescriptor;
   import org.apache.avalon.meta.info.StageDescriptor;
   
  @@ -70,6 +71,18 @@
   public interface ContainmentModel extends Model
   {
       public static String SEPERATOR = "/";
  +
  +   /**
  +    * Return the logging categories. 
  +    * @return the logging categories
  +    */
  +    CategoriesDirective getCategories();
  +
  +   /**
  +    * Set categories. 
  +    * @param categories the logging categories
  +    */
  +    void setCategories( CategoriesDirective categories );
   
      /**
       * Return the partition established by the containment model.
  
  
  
  1.10      +7 -5      avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.java
  
  Index: DefaultKernel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultKernel.java	25 Aug 2003 16:41:04 -0000	1.9
  +++ DefaultKernel.java	26 Aug 2003 22:45:25 -0000	1.10
  @@ -217,11 +217,13 @@
                           deployment.setCategories( target.getCategoriesDirective() );
                       }
                   }
  -                else
  +                else if( model instanceof ContainmentModel )
                   {
  -                    final String warning = 
  -                      "Cannot apply target: " + path + " to a containment model.";
  -                    getLogger().warn( warning );
  +                    ContainmentModel containment = (ContainmentModel) model;
  +                    if( target.getCategoriesDirective() != null )
  +                    {
  +                        containment.setCategories( target.getCategoriesDirective() );
  +                    }
                   }
               }
               else
  
  
  

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


Mime
View raw message