avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/info/builder TypeBuilder.java TypeCreator.java XMLTypeCreator.java
Date Sat, 20 Jul 2002 00:54:08 GMT
mcconnell    2002/07/19 17:54:08

  Modified:    assembly build.xml
               assembly/demo/src/java/org/apache/excalibur/playground
                        BasicComponent.java SimpleComponent.java
               assembly/src/etc kernel.xml
               assembly/src/java/org/apache/excalibur/merlin/container
                        DefaultContainer.java LifecycleHelper.java
                        ProfileDesignator.java ProfileRegistry.java
                        ResourceProvider.java
               assembly/src/java/org/apache/excalibur/merlin/kernel
                        ContainerClassLoader.java
               assembly/src/java/org/apache/excalibur/merlin/model
                        Profile.java
               assembly/src/java/org/apache/excalibur/merlin/model/builder
                        ProfileBuilder.java ProfileCreator.java
                        TypeManager.java XMLContainerCreator.java
                        XMLProfileCreator.java
               assembly/src/java/org/apache/excalibur/meta
                        ConfigurationBuilder.java
               assembly/src/java/org/apache/excalibur/meta/info Type.java
               assembly/src/java/org/apache/excalibur/meta/info/builder
                        TypeBuilder.java TypeCreator.java
                        XMLTypeCreator.java
  Added:       assembly/src/java/org/apache/excalibur/merlin/container
                        DefaultComponentManager.java DefaultManager.java
                        DefaultServiceManager.java
  Log:
  Addition of support for activation policy (on startup or deferred to first request)(.
  
  Revision  Changes    Path
  1.28      +4 -1      jakarta-avalon-excalibur/assembly/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/build.xml,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- build.xml	18 Jul 2002 16:57:00 -0000	1.27
  +++ build.xml	20 Jul 2002 00:54:06 -0000	1.28
  @@ -119,9 +119,11 @@
         </javac>
         <copy todir="${build}/main">
           <fileset dir="${src.dir}/java">
  -          <include name="**/merlin/**/*.xinfo"/>
             <include name="**/merlin/**/*.xml"/>
             <include name="**/merlin/**/*.properties"/>
  +          <include name="**/merlin/**/*.xinfo"/>
  +          <include name="**/merlin/**/*.xprofiles"/>
  +          <include name="**/merlin/**/*.xconfig"/>
           </fileset>
         </copy>
         <jar jarfile="${dist.dir}/${merlin.jar}" 
  @@ -187,6 +189,7 @@
             <include name="**/*.xml"/>
             <include name="**/*.properties"/>
             <include name="**/*.xprofile"/>
  +          <include name="**/*.xconfig"/>
           </fileset>
         </copy>
         <jar jarfile="${dist.dir}/demo.jar" basedir="${build}/demo" manifest="demo/src/etc/demo.mf"/>
  
  
  
  1.7       +25 -2     jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/BasicComponent.java
  
  Index: BasicComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/BasicComponent.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BasicComponent.java	19 Jul 2002 14:08:06 -0000	1.6
  +++ BasicComponent.java	20 Jul 2002 00:54:06 -0000	1.7
  @@ -8,6 +8,9 @@
   import org.apache.avalon.framework.context.Context;
   import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.avalon.framework.context.ContextException;
  +import org.apache.avalon.framework.configuration.Configuration;
  +import org.apache.avalon.framework.configuration.Configurable;
  +import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.activity.Startable;
   
  @@ -18,10 +21,11 @@
    * @author <a href="mailto:mcconnell@osm.net">Stephen McConnell</a>
    */
   public class BasicComponent extends AbstractLogEnabled 
  -implements Contextualizable, Initializable, Startable, BasicService
  +implements Contextualizable, Configurable, Initializable, Startable, BasicService
   {
   
       private String m_location;
  +    private String m_message;
       private File m_home;
   
       public void contextualize( Context context )
  @@ -31,13 +35,32 @@
           m_home = c.getWorkingDirectory();
       }
   
  +    //=======================================================================
  +    // Configurable
  +    //=======================================================================
  +
  +    public void configure( Configuration config )
  +    {
  +        getLogger().debug("configure");
  +        m_message = config.getChild("message").getValue(null);
  +    }
  +
  +    //=======================================================================
  +    // Initializable
  +    //=======================================================================
  +
       public void initialize()
       {
           getLogger().debug("initialize");
           getLogger().debug("location: " + m_location );
           getLogger().debug("home: " + m_home );
  +        getLogger().debug("message: " + m_message );
       }
   
  +    //=======================================================================
  +    // Startable
  +    //=======================================================================
  +
       public void start()
       {
           doPrimeObjective();
  @@ -54,7 +77,7 @@
   
       public void doPrimeObjective()
       {
  -        getLogger().info("hello from '" + m_location + "'.");
  +        getLogger().info( m_message + " from '" + m_location + "'.");
       }
   
   }
  
  
  
  1.5       +34 -4     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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimpleComponent.java	4 Jul 2002 09:01:32 -0000	1.4
  +++ SimpleComponent.java	20 Jul 2002 00:54:06 -0000	1.5
  @@ -5,6 +5,10 @@
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.service.Serviceable;
   import org.apache.avalon.framework.service.ServiceManager;
  +import org.apache.avalon.framework.service.ServiceException;
  +import org.apache.avalon.framework.configuration.Configuration;
  +import org.apache.avalon.framework.configuration.Configurable;
  +import org.apache.avalon.framework.activity.Initializable;
   
   /**
    * This is a minimal demonstration component that a dependency on 
  @@ -13,24 +17,50 @@
    * @author <a href="mailto:mcconnell@osm.net">Stephen McConnell</a>
    */
   
  -public class SimpleComponent extends AbstractLogEnabled implements Serviceable, SimpleService
  +public class SimpleComponent extends AbstractLogEnabled 
  +implements Configurable, Serviceable, Initializable, SimpleService
   {
   
  +    private String m_message;
  +    private BasicService m_basic;
  +
       //=======================================================================
       // PrimaryService
       //=======================================================================
   
       public void doObjective()
       {
  -        getLogger().info("hello from SimpleComponent");
  +        getLogger().info( m_message );
  +    }
  +
  +    //=======================================================================
  +    // Configurable
  +    //=======================================================================
  +
  +    public void configure( Configuration config )
  +    {
  +        getLogger().debug("configure");
  +        m_message = config.getChild("message").getValue(null);
       }
   
       //=======================================================================
       // Serviceable
       //=======================================================================
   
  -    public void service( ServiceManager manager )
  +    public void service( ServiceManager manager ) throws ServiceException
       {
  -        getLogger().debug("I'm being serviced!");
  +        getLogger().debug( "service" );
  +        m_basic = (BasicService) manager.lookup( "basic" );
       }
  +
  +    //=======================================================================
  +    // Initializable
  +    //=======================================================================
  +
  +    public void initialize()
  +    {
  +        getLogger().debug("initialize");
  +        doObjective();
  +    }
  +
   }
  
  
  
  1.14      +22 -57    jakarta-avalon-excalibur/assembly/src/etc/kernel.xml
  
  Index: kernel.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/etc/kernel.xml,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- kernel.xml	18 Jul 2002 16:57:00 -0000	1.13
  +++ kernel.xml	20 Jul 2002 00:54:06 -0000	1.14
  @@ -58,7 +58,7 @@
          <category priority="DEBUG"  name="loader" />
          <category priority="DEBUG"  name="types" />
          <category priority="INFO"  name="assembly" />
  -       <category priority="WARN"  name="lifecycle" />
  +       <category priority="INFO"  name="lifecycle" />
          <category priority="WARN"  name="verifier" />
        </loggers>
   
  @@ -74,7 +74,7 @@
        may be serviced by components declared in parent container.
        -->
   
  -     <component name="complex" class="org.apache.excalibur.playground.ComplexComponent">
  +     <component name="complex" class="org.apache.excalibur.playground.ComplexComponent" activation="true">
   
           <loggers priority="DEBUG">
             <category name="init" priority="DEBUG" />
  @@ -118,70 +118,35 @@
        child container instances.
        -->
   
  -     <container name="sub-container">
  +     <container name="sub">
   
          <loggers priority="INFO">
            <category priority="WARN"  name="loader" />
            <category priority="INFO"  name="assembly" />
            <category priority="WARN"  name="profiles" />
  -         <category priority="WARN"  name="lifecycle" />
  +         <category priority="INFO"  name="lifecycle" />
          </loggers>
   
  -       <classpath>
  -         <fileset dir="dist">
  -           <include name="demo.jar"/>
  -           <include name="merlin.jar"/>
  -         </fileset>
  -       </classpath>
  -
  -       <!--
  -       Declaration of an embedded container.  A container will be instantiated, initialized
  -       and a validation request will be invoked.  In the container is an instance of Container, 
  -       the reference to parent container will be supplied.
  -       ## pending context inport from container ##
  -       -->
  -
  -       <!--
  -       <component name="test" class="org.apache.avalon.merlin.kernel.DefaultKernel">
  -
  -         <context>
  -
  -           <import as="classloader">
  -              <classpath>
  -                <fileset dir="dist">
  -                  <include name="demo.jar"/>
  -                </fileset>
  -              </classpath>
  -           </import>
  -
  -           <import key="logging" as="logging"/>
  -
  -           <import as="descriptor">
  -             <kernel name="embedded">
  -               <container name="root-embedded">
  -                 <classpath>
  -                   <fileset dir="dist">
  -                     <include name="demo.jar"/>
  -                   </fileset>
  -                 </classpath>
  -               </container>
  -             </kernel>
  -           </import>
  -         </context>
  -
  -       </component>
  -       -->
  -
  -      <!--
  -      including the next entry demonstrates the resolution of a dependency via a profile
  -      resolved from a parent container. SimpleComponent needs BasicService with is available
  -      from either TerminalComponent or BasicComponent implicitly created in the parent 
  -      container path (due to a depenency declared by ComplexComponent).
  -      -->
  -      <component name="simple2" class="org.apache.excalibur.playground.SimpleComponent" enabled="true"/>
  +       <container name="demo">
  +
  +         <!--
  +         Including the next entry demonstrates the resolution of a dependency via a profile
  +         resolved from a parent container. SimpleComponent needs BasicService with is available
  +         from either TerminalComponent or BasicComponent implicitly created in the parent 
  +         container path (due to a depenency declared by ComplexComponent).  In addition, this
  +         profile demonstrates the use of a cascading configuration.  The configuration passed
  +         to the instantiated component is based primarily on this configuration declared here, 
  +         and defaults derived from SimpleComponent.xconfig.
  +         -->
  +         <component name="simple" class="org.apache.excalibur.playground.SimpleComponent" enabled="true">
  +           <configuration>
  +             <message>This is a custom message.</message>
  +           </configuration>
  +         </component>
  +
  +       </container>
   
        </container>
  -     <container name="empty"/>
   
      </container>
   
  
  
  
  1.13      +10 -12    jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/DefaultContainer.java
  
  Index: DefaultContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/DefaultContainer.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DefaultContainer.java	19 Jul 2002 14:08:06 -0000	1.12
  +++ DefaultContainer.java	20 Jul 2002 00:54:07 -0000	1.13
  @@ -332,11 +332,14 @@
                   {
                       ResourceDesignator resource = 
                         (ResourceDesignator) m_mapping.get( profile );
  -                    if( getLogger().isDebugEnabled() )
  -                      getLogger().debug("starting: " + resource.getPath() );
  -                    Object object = resource.getInstance();
  -                    if( getLogger().isInfoEnabled() )
  -                      getLogger().info("started: " + resource.getPath() );
  +                    if( resource.getProfile().getActivationPolicy() )
  +                    {
  +                        if( getLogger().isDebugEnabled() )
  +                          getLogger().debug("starting: " + resource.getPath() );
  +                        Object object = resource.getInstance();
  +                        if( getLogger().isInfoEnabled() )
  +                          getLogger().info("started: " + resource.getPath() );
  +                    }
                   }
                   catch( LifecycleException le )
                   {
  @@ -361,21 +364,16 @@
               if( this.contains( profile ) )
               {
                   final String name = profile.getName();
  -                if( getLogger().isDebugEnabled() )
  -                  getLogger().debug("stopping: " + name );
  -                
                   ResourceDesignator resource = 
                     (ResourceDesignator) m_mapping.get( profile );
                   try
                   {
                       resource.release();
  -                    if( getLogger().isInfoEnabled() )
  -                       getLogger().info("stopped: " + resource.getPath() );
                   }
                   catch( Exception le )
                   {
                       final String warning = 
  -                       "Could not shutdown a service derived from profile: " + profile;
  +                       "Could not shutdown a service derived from profile: '" + name + "'.";
                       getLogger().warn( warning, le );
                   }
               }
  
  
  
  1.4       +4 -0      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/LifecycleHelper.java
  
  Index: LifecycleHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/LifecycleHelper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LifecycleHelper.java	12 Jul 2002 19:09:26 -0000	1.3
  +++ LifecycleHelper.java	20 Jul 2002 00:54:07 -0000	1.4
  @@ -72,6 +72,8 @@
                              final ResourceProvider provider )
           throws LifecycleException
       {
  +
  +        getLogger().info("startup initiated for '" + name + "'." );
           int stage = 0;
           try
           {
  @@ -174,6 +176,8 @@
                             final Object object )
           throws LifecycleException
       {
  +
  +        getLogger().info("shutdown initiated for '" + name + "'." );
   
           //Stage at which failure occured
           int stage = 0;
  
  
  
  1.4       +4 -2      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/ProfileDesignator.java
  
  Index: ProfileDesignator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/ProfileDesignator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProfileDesignator.java	19 Jul 2002 14:08:06 -0000	1.3
  +++ ProfileDesignator.java	20 Jul 2002 00:54:07 -0000	1.4
  @@ -7,6 +7,8 @@
    */
   package org.apache.excalibur.merlin.container;
   
  +import org.apache.avalon.framework.logger.Logger;
  +import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.excalibur.merlin.model.Profile;
   import org.apache.excalibur.merlin.model.ResourceDesignator;
   import org.apache.excalibur.meta.info.ServiceDescriptor;
  @@ -123,7 +125,7 @@
        */
       public void release() throws LifecycleException
       {
  -        if( m_service == null )
  +        if( m_service != null )
             m_helper.shutdown( m_path, m_service );
       }
   
  
  
  
  1.10      +4 -2      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/ProfileRegistry.java
  
  Index: ProfileRegistry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/ProfileRegistry.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ProfileRegistry.java	19 Jul 2002 14:08:06 -0000	1.9
  +++ ProfileRegistry.java	20 Jul 2002 00:54:07 -0000	1.10
  @@ -162,7 +162,9 @@
               assembleProfile( profile, visited, "" );
   
               final String name = m_path + "/" + profile.getName();
  -            m_mapping.put( profile, new ProfileDesignator( name, profile, m_helper, m_provider ) );
  +            final ResourceDesignator resource = 
  +              new ProfileDesignator( name, profile, m_helper, m_provider );
  +            m_mapping.put( profile, resource );
               getLogger().debug( "created explicit resource for: " + name );
               m_map.add( profile );
           }
  
  
  
  1.7       +9 -8      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/ResourceProvider.java
  
  Index: ResourceProvider.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/ResourceProvider.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ResourceProvider.java	19 Jul 2002 14:08:06 -0000	1.6
  +++ ResourceProvider.java	20 Jul 2002 00:54:07 -0000	1.7
  @@ -42,7 +42,6 @@
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.avalon.framework.component.DefaultComponentManager;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.DefaultConfiguration;
  @@ -55,7 +54,6 @@
   import org.apache.avalon.framework.context.DefaultContext;
   import org.apache.avalon.framework.service.Serviceable;
   import org.apache.avalon.framework.service.ServiceManager;
  -import org.apache.avalon.framework.service.DefaultServiceManager;
   import org.apache.avalon.framework.service.ServiceException;
   import org.apache.avalon.excalibur.extension.PackageRepository;
   import org.apache.avalon.excalibur.extension.Extension;
  @@ -206,7 +204,6 @@
       {
           DefaultContext parent = new DefaultContext();
           Import[] imports = profile.getContext().getImports();
  -        getLogger().info( profile.getName() + " imports: " + imports.length );
           for( int i=0; i<imports.length; i++ )
           {
               Import directive = imports[i];
  @@ -249,7 +246,8 @@
           throws Exception
       {
           final Map services = getServices( profile );
  -        final DefaultComponentManager componentManager = new DefaultComponentManager();
  +        final DefaultComponentManager componentManager = new DefaultComponentManager( services );
  +/*
           final Iterator keys = services.keySet().iterator();
           while( keys.hasNext() )
           {
  @@ -266,6 +264,7 @@
               componentManager.put( key, (Component)service );
           }
           componentManager.makeReadOnly();
  +*/
           return componentManager;
       }
   
  @@ -280,7 +279,8 @@
           throws Exception
       {
           final Map services = getServices( profile );
  -        final DefaultServiceManager serviceManager = new DefaultServiceManager();
  +        final DefaultServiceManager serviceManager = new DefaultServiceManager( services );
  +/*
           final Iterator keys = services.keySet().iterator();
           while( keys.hasNext() )
           {
  @@ -289,6 +289,7 @@
               serviceManager.put( key, service );
           }
           serviceManager.makeReadOnly();
  +*/
           return serviceManager;
       }
   
  @@ -357,8 +358,8 @@
               try
               {
                   final Association association = profile.getAssociation( role );
  -                Object service = association.getProvider().getInstance();
  -                services.put( role, service );
  +                Object resource = association.getProvider();
  +                services.put( role, resource );
               }
               catch( Throwable e )
               {
  
  
  
  1.1                  jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/DefaultComponentManager.java
  
  Index: DefaultComponentManager.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.
   *
   * Original contribution by OSM SARL, http://www.osm.net
   */
  package org.apache.excalibur.merlin.container;
  
  import java.util.Map;
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  
  /**
   * Internal helper class the implements the <code>ComponentLocator</code> interface and
   * is supplied to dynamically created componets during lifecycle pipeline processing.
   * @author Stephen McConnell <mcconnell@osm.net>
   */
  class DefaultComponentManager
      extends DefaultManager
      implements ComponentManager
  {
      public DefaultComponentManager( Map providers )
      {
          super( providers );
      }
  
      public boolean hasComponent( String role )
      {
          return super.has( role );
      }
  
      public Component lookup( String role ) throws ComponentException
      {
          Object object = null;
          try
          {
              object = super.resolve( role );
              if( object instanceof Component )
              {
                  return (Component)object;
              }
              throw new ComponentException( role, "Service provider returned a non-Component." );
          }
          catch( ContainerException e )
          {
              final String error = "Provider related error during service resolution.";
              throw new ComponentException( role, error, e );
          }
      }
  
      /**
       * Release a pooled object.
       *
       * @param component a pooled object
       */
      public void release( Component component )
      {
          super.disgard( component );
      }
  }
  
  
  1.1                  jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/DefaultManager.java
  
  Index: DefaultManager.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.
   *
   * Original contribution by OSM SARL, http://www.osm.net
   */
  package org.apache.excalibur.merlin.container;
  
  import java.util.Map;
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.excalibur.merlin.model.ResourceDesignator;
  
  
  /**
   * Internal helper class the handles the functional requirements of
   * both ComponetManager and ComponentLocator.
   * @author <a href="mailto:mcconnell@osm.net">Stephen McConnell</a>
   */
  class DefaultManager
  {
      /**
       * A map of resources keyed by lookup role.
       */
      private Map m_providers;
  
     /**
      * Creation of a new manager.
      * @param providers the resource map
      */
      public DefaultManager( Map providers )
      {
          m_providers = providers;
      }
  
     /**
      * Return TRUE is the manager has a resoruce for the role.
      * @param role the role name to look for in the resource map
      * @return TRUE is a resource exists for the role
      */
      public boolean has( String role )
      {
          return ( m_providers.get( role ) != null );
      }
  
     /**
      * Returns the service object.
      * @return the service instance
      */
      public Object resolve( String role ) throws ContainerException
      {
          ResourceDesignator resource = (ResourceDesignator) m_providers.get( role );
          if( resource == null )
          {
              throw new ContainerException(
                  "Could not locate a provider for the role: " + role );
          }
          else
          {
              try
              {
                  return resource.getInstance();
              }
              catch( Throwable e )
              {
                  final String error = "Unexpected exception while resolving the service from " 
                  + resource.getPath() + " for the role: " + role;
                  throw new ContainerException( error, e );
              }
          }
      }
  
      /**
       * Release a pooled object.
       * @param object a pooled object
       */
      public void disgard( Object object )
      {
         //
      }
  
  }
  
  
  1.1                  jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/DefaultServiceManager.java
  
  Index: DefaultServiceManager.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.
   *
   * Original contribution by OSM SARL, http://www.osm.net
   */
  package org.apache.excalibur.merlin.container;
  
  import java.util.Map;
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceManager;
  
  /**
   * Internal helper class the implements the <code>ServiceManager</code> interface and
   * is supplied to dynamically created componets during lifecyle pipeline processing.
   * @author Stephen McConnell <mcconnell@osm.net>
   */
  class DefaultServiceManager
      extends DefaultManager
      implements ServiceManager
  {
      /**
       * Construct a new ServiceManager.
       */
      public DefaultServiceManager( Map providers )
      {
          super( providers );
      }
  
      /**
       * Returns true if a provider exists for the supplied role.
       * @param role the service identifier
       * @return boolean TRUE if the service is available else FALSE
       */
      public boolean hasService( String role )
      {
          return super.has( role );
      }
  
      /**
       * Retrieve Object by role from ComponentLocator.
       * @param role the role
       * @return the Object
       * @throws ServiceException if an error occurs
       */
      public Object lookup( String role ) throws ServiceException
      {
          try
          {
              return super.resolve( role );
          }
          catch( ContainerException e )
          {
              final String error = "Service resolution failure for role: " + role;
              throw new ServiceException( error, e );
          }
      }
  
      /**
       * Release a pooled object.
       * @param object a pooled object
       */
      public void release( Object object )
      {
          super.disgard( object );
      }
  }
  
  
  1.5       +3 -3      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/ContainerClassLoader.java
  
  Index: ContainerClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/ContainerClassLoader.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ContainerClassLoader.java	12 Jul 2002 12:04:54 -0000	1.4
  +++ ContainerClassLoader.java	20 Jul 2002 00:54:07 -0000	1.5
  @@ -58,8 +58,8 @@
    * @version $Revision$ $Date$
    */ 
   
  -public class ContainerClassLoader extends URLClassLoader 
  -  implements LogEnabled, Contextualizable, Initializable, TypeManager
  +public class ContainerClassLoader extends TypeManager 
  +  implements LogEnabled, Contextualizable, Initializable
   {
   
       //===================================================================
  
  
  
  1.8       +23 -2     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Profile.java	18 Jul 2002 16:57:00 -0000	1.7
  +++ Profile.java	20 Jul 2002 00:54:07 -0000	1.8
  @@ -39,7 +39,7 @@
        may be serviced by components declared in parent container.
        --&gt;</i></font>
   
  -     &lt;component name="<font color="darkred">complex</font>" class="<font color="darkred">org.apache.excalibur.playground.ComplexComponent</font>"&gt;
  +     &lt;component name="<font color="darkred">complex</font>" class="<font color="darkred">org.apache.excalibur.playground.ComplexComponent</font>" activation="<font color="darkred">startup</font>"&gt;
   
           &lt;loggers priority="<font color="darkred">DEBUG</font>"&gt;
             &lt;category name="<font color="darkred">init</font>" priority="<font color="darkred">DEBUG</font>" /&gt;
  @@ -150,6 +150,12 @@
       private boolean m_enabled = true;
   
       /**
  +     * The activation policy - TRUE if activation on startup, FALSE to activate on request.
  +     */
  +    private final boolean m_activation;
  +
  +
  +    /**
        * Create a Profile instance.
        *
        * @param name the abstract name of component meta data instance
  @@ -158,6 +164,7 @@
        * @param context the context instance to use during type instantiation
        * @param type the type of component that this profile qualifies
        * @param enabled the enabled state of the component profile
  +     * @param activation TRUE if activation on startup, FALSE to activate on request 
        * @param mode the creation mode (either IMPLICIT, PACKAGED, or EXPLICIT)
        */
       public Profile( final String name,
  @@ -167,6 +174,7 @@
                              final CategoryDescriptor loggers,
                              final Type type,
                              final boolean enabled,
  +                           final boolean activation,
                              final int mode )
       {
           if( null == name )
  @@ -189,6 +197,7 @@
           m_context = context;
           m_loggers = loggers;
           m_enabled = enabled;
  +        m_activation = activation;
           m_mode = mode;
       }
   
  @@ -311,6 +320,18 @@
           Association association = new Association( role, resource );
           m_dependencies.put( role, association );
           return association;
  +    }
  +
  +   /**
  +    * Return the activation policy for the component.  If TRUE, activation
  +    * will occur at startup.  If false, activation will be deferred to 
  +    * the first lookup invocation if any (i.e. lazy activation).
  +    *
  +    * @return the activation policy 
  +    */
  +    public boolean getActivationPolicy()
  +    {
  +        return m_activation;
       }
   
      /**
  
  
  
  1.2       +6 -17     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/builder/ProfileBuilder.java
  
  Index: ProfileBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/builder/ProfileBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProfileBuilder.java	12 Jul 2002 12:04:55 -0000	1.1
  +++ ProfileBuilder.java	20 Jul 2002 00:54:07 -0000	1.2
  @@ -18,6 +18,7 @@
   import org.apache.excalibur.meta.info.Type;
   import org.apache.excalibur.meta.info.builder.TypeBuilder;
   import org.apache.excalibur.merlin.model.Profile;
  +import org.xml.sax.InputSource;
   
   /**
    * A ProfileBuilder is responsible for building {@link Profile}
  @@ -48,29 +49,17 @@
               type.getInfo().getImplementationKey().replace( '.', '/' ) + ".xprofile";
           final InputStream inputStream =
               classLoader.getResourceAsStream( xprofile );
  +
           final ProfileCreator creator = getXMLProfileCreator( xprofile );
  -        if( null == inputStream )
  -        {
  -            return creator.createProfiles( type, new DefaultConfiguration("profiles", null ) );
  -        }
  -        else
  -        {
  -            return creator.createProfiles( type, inputStream );
  -        }
  -    }
  +        return creator.createProfiles( classLoader, type, inputStream );
   
  -    public Profile build( Type type, Configuration profile )
  -        throws Exception
  -    {
  -        final ProfileCreator creator = getXMLProfileCreator( "implicit" );
  -        return creator.createProfile( type, profile );
       }
   
       /**
        * Utility to get xml info builder, else throw
        * an exception if missing descriptor.
        *
  -     * @return the TypeCreator
  +     * @return the ProfileCreator
        */
       private ProfileCreator getXMLProfileCreator( final String classname )
           throws Exception
  @@ -92,7 +81,7 @@
        * Utility to get XMLProfileCreator if XML files are on
        * ClassPath.
        *
  -     * @return the XML {@link TypeCreator}
  +     * @return the XML {@link ProfileCreator}
        */
       private static ProfileCreator createXMLProfileCreator()
       {
  
  
  
  1.2       +8 -12     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/builder/ProfileCreator.java
  
  Index: ProfileCreator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/builder/ProfileCreator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProfileCreator.java	12 Jul 2002 12:04:55 -0000	1.1
  +++ ProfileCreator.java	20 Jul 2002 00:54:07 -0000	1.2
  @@ -29,21 +29,17 @@
        * @return the newly created {@link Type}
        * @throws Exception
        */
  -    Profile[] createProfiles( Type type, InputStream inputStream )
  +    Profile[] createProfiles( ClassLoader loader, Type type, InputStream inputStream )
           throws Exception;
   
       /**
  -     * Create a {@link Profile} from a configuration
  -     *
  -     * @param key the name of component type that we are looking up
  -     * @param inputStream the stream that the resource is loaded from
  -     * @return the newly created {@link Type}
  -     * @throws Exception
  +     * Create an explicit {@link Profile} instances from a configuration.
  +     * @param type the component type
  +     * @param config the profile description
  +     * @return the profile
  +     * @exception Exception if an error occurs during profile creation
        */
  -    Profile[] createProfiles( Type type, Configuration config )
  -        throws Exception;
  -
  -    Profile createProfile( Type type, Configuration config )
  +    Profile createProfile( ClassLoader loader, Type type, Configuration config )
           throws Exception;
   
   }
  
  
  
  1.2       +27 -9     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/builder/TypeManager.java
  
  Index: TypeManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/builder/TypeManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TypeManager.java	12 Jul 2002 12:04:55 -0000	1.1
  +++ TypeManager.java	20 Jul 2002 00:54:07 -0000	1.2
  @@ -7,25 +7,43 @@
    */
   package org.apache.excalibur.merlin.model.builder;
   
  +import java.net.URLClassLoader;
  +import java.net.URL;
  +
   import org.apache.excalibur.meta.info.Type;
   import org.apache.excalibur.meta.info.ServiceDesignator;
   import org.apache.excalibur.merlin.model.ClasspathDescriptor;
   
   /**
  - * Interface implemented by resources capable a resolving a Type form a classname.
  + * Abstract type manager.
    *
    * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
    * @version $Revision$ $Date$
    */
  -public interface TypeManager
  +public abstract class TypeManager extends URLClassLoader 
   {
   
  +    public TypeManager( )
  +    {
  +        super( new URL[ 0 ], Thread.currentThread().getContextClassLoader() );
  +    }
  +
  +    public TypeManager( ClassLoader parent )
  +    {
  +        super( new URL[ 0 ], parent );
  +    }
  +
  +    public TypeManager( URL[] urls, ClassLoader parent )
  +    {
  +        super( urls, parent );
  +    }
  +
      /**
       * Add classes to the manager declared within a classpath structure.
       * @param classpath the classpath descriptor
       * @exception Exception if an exception occurs during class loading
       */
  -    void addClasspath( ClasspathDescriptor classpath ) throws Exception;
  +    public abstract void addClasspath( ClasspathDescriptor classpath ) throws Exception;
   
      /**
       * Resolve a {@link Type} from a classname.
  @@ -33,7 +51,7 @@
       * @param classname the component type
       * @return the component type
       */
  -    Type lookup( String classname ) throws Exception;
  +    public abstract Type lookup( String classname ) throws Exception;
   
      /**
       * Register a potential supplier component type.  The implementation will
  @@ -43,26 +61,26 @@
       * @param classname the component class name
       * @return the component type
       */
  -    Type register( String classname ) throws Exception;
  +    public abstract Type register( String classname ) throws Exception;
   
      /**
       * Returns the set of component types know to the registry.
       * @return the set of component types registered with the registry
       */
  -    Type[] getTypes();
  +    public abstract Type[] getTypes();
   
      /**
       * Returns the set of component types know to the registry that are capable of 
       * supporting the supplied service.
       * @return the set of candidate component types
       */
  -    Type[] getTypes( ServiceDesignator service );
  +    public abstract Type[] getTypes( ServiceDesignator service );
   
      /**
       * Returns a registered component type.
       * @return the component type from the registry or null if the type is unknown
       */
  -    Type getType( String classname );
  +    public abstract Type getType( String classname );
   
   
   
  
  
  
  1.5       +2 -2      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/builder/XMLContainerCreator.java
  
  Index: XMLContainerCreator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/builder/XMLContainerCreator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XMLContainerCreator.java	14 Jul 2002 12:11:20 -0000	1.4
  +++ XMLContainerCreator.java	20 Jul 2002 00:54:07 -0000	1.5
  @@ -88,7 +88,7 @@
           {
               Configuration config = configs[i];
               Type type = manager.lookup( config.getAttribute("class") );
  -            list.add( super.createProfile( type, config ) );
  +            list.add( super.createProfile( manager, type, config ) );
           }
           return (Profile[]) list.toArray( new Profile[0] );
       }
  
  
  
  1.8       +68 -36    jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/builder/XMLProfileCreator.java
  
  Index: XMLProfileCreator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/builder/XMLProfileCreator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XMLProfileCreator.java	19 Jul 2002 14:08:07 -0000	1.7
  +++ XMLProfileCreator.java	20 Jul 2002 00:54:07 -0000	1.8
  @@ -29,6 +29,7 @@
   import org.apache.excalibur.merlin.model.Entry;
   import org.apache.excalibur.merlin.model.Parameter;
   import org.apache.excalibur.configuration.ContextFactory;
  +import org.apache.excalibur.configuration.CascadingConfiguration;
   import org.xml.sax.InputSource;
   
   /**
  @@ -46,20 +47,42 @@
           ResourceManager.getPackageResources( XMLTypeCreator.class );
   
       /**
  -     * Create a {@link Type} object for specified
  -     * classname, loaded from specified {@link InputStream}.
  +     * Create a {@link Profile} object for specified
  +     * classname, loaded from specified {@link InputStream}.  If the 
  +     * input stream is null, an implicit profile will be created.
        *
        * @param implementationKey The classname of Component
        * @param inputStream the InputStream to load Type from
  -     * @return the created Type
  +     * @return the created set of profiles
        * @throws ConfigurationException if an error occurs
        */
  -    public Profile[] createProfiles( Type type, InputStream inputStream )
  +    public Profile[] createProfiles( ClassLoader loader, Type type, InputStream inputStream )
           throws Exception
       {
  -        final InputSource input = new InputSource( inputStream );
  -        final Configuration configuration = ConfigurationBuilder.build( input );
  -        return createProfiles( type, configuration );
  +        if( inputStream != null )
  +        {
  +            final InputSource input = new InputSource( inputStream );
  +            final Configuration configuration = ConfigurationBuilder.build( input );
  +            return createPackagedProfiles( loader, type, configuration );
  +        }
  +        else
  +        {
  +            Profile profile = createImplicitProfile( loader, type );
  +            return new Profile[]{ profile };
  +        }
  +    }
  +
  +    /**
  +     * Create an explicit {@link Profile} instance from a configuration.
  +     * @param type the component type
  +     * @param config the profile description
  +     * @return the profile
  +     * @exception Exception if an error occurs during profile creation
  +     */
  +    public Profile createProfile( ClassLoader loader, Type type, Configuration config )
  +        throws Exception
  +    {
  +        return buildProfile( loader, type, config, Profile.EXPLICIT );
       }
   
       /**
  @@ -68,51 +91,48 @@
        *
        * @param classname The classname of Component
        * @param info the Type configuration
  -     * @return the created Type
  +     * @return the created set of profiles
        * @throws ConfigurationException if an error occurs
        */
  -    public Profile[] createProfiles( Type type, final Configuration info )
  +    private Profile[] createPackagedProfiles( ClassLoader loader, Type type, final Configuration info )
           throws Exception
       {
           Vector vector = new Vector();
           Configuration[] profiles = info.getChildren("component");
           if( profiles.length == 0 )
           {
  -            //
  -            // build a default profile
  -            //
  -
  -            CategoryDescriptor loggers = new CategoryDescriptor( 
  -              type.getInfo().getName(), null, null );
  -            ContextDirective context = new ContextDirective( 
  -              ContextDirective.DEFAULT_CONTEXT_CLASS, new Import[0], new Entry[0] );
  -
  -            return new Profile[]{ 
  -               new Profile( null, null, null, context, loggers, type, true, Profile.IMPLICIT  ) };
  +            Profile profile = createImplicitProfile( loader, type );
  +            return new Profile[]{ profile };
           }
           for( int i=0; i<profiles.length; i++ )
           {
  -           vector.add( buildProfile( type, profiles[i], Profile.PACKAGED ) );
  +           vector.add( buildProfile( loader, type, profiles[i], Profile.PACKAGED ) );
           }
           return (Profile[]) vector.toArray( new Profile[0] );
       }
   
  -    public Profile createProfile( Type type, Configuration config )
  -        throws Exception
  -    {
  -        return buildProfile( type, config, Profile.EXPLICIT );
  -    }
  -
  -    private Profile buildProfile( Type type, Configuration profile, int mode ) throws Exception
  +    private Profile buildProfile( 
  +      ClassLoader loader, Type type, Configuration profile, int mode ) throws Exception
       {
           final String name = profile.getAttribute("name");
  -        boolean enabled = profile.getAttributeAsBoolean( "enabled", true );
  -        Parameters params = Parameters.fromConfiguration( profile.getChild("parameters") );
  -        Configuration config = profile.getChild("configuration");
  -        Configuration loggersConfig = profile.getChild("loggers");
  -        CategoryDescriptor loggers = createCategoryDescriptor( loggersConfig, name );
  -        ContextDirective context = createContextDirective( profile.getChild("context") );
  -        return new Profile( name, params, config, context, loggers, type, enabled, mode  );
  +        final boolean enabled = profile.getAttributeAsBoolean( "enabled", true );
  +        final boolean activation = profile.getAttributeAsBoolean( "activation", false );
  +        final Parameters params = Parameters.fromConfiguration( profile.getChild("parameters") );
  +        final Configuration loggersConfig = profile.getChild("loggers");
  +        final CategoryDescriptor loggers = createCategoryDescriptor( loggersConfig, name );
  +        final ContextDirective context = createContextDirective( profile.getChild("context") );
  +        final Configuration defaults = type.getDefaultConfiguration( loader );
  +        final Configuration base = profile.getChild("configuration");
  +        Configuration config;
  +        if( null == defaults )
  +        {
  +            config = base;
  +        }
  +        else
  +        {
  +            config = new CascadingConfiguration( base, defaults );
  +        }
  +        return new Profile( name, params, config, context, loggers, type, enabled, activation, mode  );
       }
   
       public ContextDirective createContextDirective( Configuration config ) throws ConfigurationException
  @@ -219,4 +239,16 @@
           return (CategoryDescriptor[]) list.toArray( new CategoryDescriptor[0] );
       }
   
  +    private Profile createImplicitProfile( ClassLoader loader, Type type ) throws Exception
  +    {
  +        CategoryDescriptor loggers = new CategoryDescriptor( 
  +          type.getInfo().getName(), null, null );
  +        ContextDirective context = new ContextDirective( 
  +          ContextDirective.DEFAULT_CONTEXT_CLASS, new Import[0], new Entry[0] );
  +        final Configuration defaults = type.getDefaultConfiguration( loader );
  +        return new Profile( 
  +          type.getInfo().getName(), null, defaults, context, loggers, type, true, false,
  +          Profile.IMPLICIT  
  +        );
  +    }
   }
  
  
  
  1.2       +2 -2      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/ConfigurationBuilder.java
  
  Index: ConfigurationBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/ConfigurationBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConfigurationBuilder.java	12 Jul 2002 07:58:14 -0000	1.1
  +++ ConfigurationBuilder.java	20 Jul 2002 00:54:07 -0000	1.2
  @@ -92,7 +92,7 @@
           throws SAXException, ParserConfigurationException, IOException
       {
           if( input == null ) 
  -          throw new NullPointerException("null input source");
  +          throw new NullPointerException("input");
   
           final XMLReader reader = createXMLReader();
           final SAXConfigurationHandler handler = new SAXConfigurationHandler();
  
  
  
  1.6       +40 -1     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/info/Type.java
  
  Index: Type.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/info/Type.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Type.java	15 Jul 2002 02:12:24 -0000	1.5
  +++ Type.java	20 Jul 2002 00:54:07 -0000	1.6
  @@ -8,12 +8,17 @@
   package org.apache.excalibur.meta.info;
   
   import java.io.Serializable;
  +import org.xml.sax.InputSource;
  +import java.io.InputStream;
  +
  +import org.apache.excalibur.meta.ConfigurationBuilder;
   import org.apache.excalibur.meta.info.ComponentDescriptor;
   import org.apache.excalibur.meta.info.ContextDescriptor;
   import org.apache.excalibur.meta.info.DependencyDescriptor;
   import org.apache.excalibur.meta.info.LoggerDescriptor;
   import org.apache.excalibur.meta.info.ServiceDescriptor;
   import org.apache.excalibur.meta.info.ServiceDesignator;
  +import org.apache.avalon.framework.configuration.Configuration;
   
   /**
    * This class contains the meta information about a particular
  @@ -40,6 +45,9 @@
       private final DependencyDescriptor[] m_dependencies;
       private final LoggerDescriptor[] m_loggers;
   
  +    private transient Configuration m_configuration;
  +    private transient boolean m_loaded = false;
  +
       /**
        * Basic constructor that takes as parameters all parts.
        */
  @@ -146,6 +154,37 @@
           return null;
       }
   
  +    /** 
  +     * Returns the default configuration supplied with the type.
  +     *
  +     * @return the default configuration or null if no packaged defaults
  +     */
  +    public Configuration getDefaultConfiguration( ClassLoader loader ) throws Exception
  +    {
  +        if( m_loaded )
  +          return m_configuration;
  +
  +        final String xconfig =
  +            getInfo().getImplementationKey().replace( '.', '/' ) + ".xconfig";
  +        final InputStream stream =
  +            loader.getResourceAsStream( xconfig );
  +        if( stream == null )
  +        {
  +            m_loaded = true;
  +        }
  +        else
  +        {
  +            final InputSource source = new InputSource( stream );
  +            m_configuration = ConfigurationBuilder.build( source );
  +            m_loaded = true;
  +        }
  +        return m_configuration;
  +    }
  +
  +   /**
  +    * Return a string representation of the type.
  +    * @return the stringified type
  +    */
       public String toString()
       {
           return "Type name: " + getInfo().getName() + " key: " + getInfo().getImplementationKey();
  
  
  
  1.3       +16 -1     jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/info/builder/TypeBuilder.java
  
  Index: TypeBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/info/builder/TypeBuilder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TypeBuilder.java	12 Jul 2002 19:09:28 -0000	1.2
  +++ TypeBuilder.java	20 Jul 2002 00:54:07 -0000	1.3
  @@ -122,17 +122,32 @@
                                                     final ClassLoader classLoader )
           throws Exception
       {
  +        //
  +        // get the input stream for the .xinfo resource
  +        //
  +
           final String xinfo =
               classname.replace( '.', '/' ) + ".xinfo";
           final InputStream inputStream =
               classLoader.getResourceAsStream( xinfo );
  +
           if( null == inputStream )
           {
  +            //##############################################################//
  +            // Need to upgrade this to handle automated xinfo creation      //
  +            // using implemented interfaces for services, no dependecies,   //
  +            // no context, etc.                                             //
  +            //##############################################################//
  +
               final String message =
                   REZ.getString( "builder.missing-info.error",
                                  classname );
               throw new Exception( message );
           }
  +
  +        //
  +        // build the type
  +        //
   
           final TypeCreator xmlTypeCreator = getXMLTypeCreator( classname );
           return xmlTypeCreator.createType( classname, inputStream );
  
  
  
  1.2       +3 -3      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/info/builder/TypeCreator.java
  
  Index: TypeCreator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/info/builder/TypeCreator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TypeCreator.java	12 Jul 2002 15:11:58 -0000	1.1
  +++ TypeCreator.java	20 Jul 2002 00:54:07 -0000	1.2
  @@ -26,10 +26,10 @@
        * Create a {@link Type} from stream
        *
        * @param key the name of component type that we are looking up
  -     * @param inputStream the stream that the resource is loaded from
  +     * @param input the input stream that the resource is loaded from
        * @return the newly created {@link Type}
        * @throws Exception
        */
  -    Type createType( String key, InputStream inputStream )
  +    Type createType( String key, InputStream input )
           throws Exception;
   }
  
  
  
  1.4       +6 -7      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/info/builder/XMLTypeCreator.java
  
  Index: XMLTypeCreator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/meta/info/builder/XMLTypeCreator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLTypeCreator.java	18 Jul 2002 16:57:00 -0000	1.3
  +++ XMLTypeCreator.java	20 Jul 2002 00:54:07 -0000	1.4
  @@ -54,16 +54,16 @@
        * @throws Exception if an error occurs
        */
       public Type createType( String implementationKey,
  -                                              InputStream inputStream )
  +                                              InputStream inputStream  )
           throws Exception
       {
           if( inputStream == null ) 
  -          throw new NullPointerException("input stream.");
  +          throw new NullPointerException("input");
   
           final InputSource input = new InputSource( inputStream );
           final String classname = implementationKey;
  -        final Configuration configuration = ConfigurationBuilder.build( input );
  -        return build( classname, configuration );
  +        final Configuration xinfo = ConfigurationBuilder.build( input );
  +        return build( classname, xinfo );
       }
   
       /**
  @@ -75,8 +75,7 @@
        * @return the created Type
        * @throws ConfigurationException if an error occurs
        */
  -    private Type build( final String classname,
  -                                 final Configuration info )
  +    private Type build( final String classname, final Configuration info )
           throws Exception
       {
           if( getLogger().isDebugEnabled() )
  
  
  

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


Mime
View raw message