avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/lifecycle/impl AbstractResourceProvider.java
Date Sat, 31 Aug 2002 09:18:16 GMT
donaldp     2002/08/31 02:18:16

  Modified:    containerkit/src/java/org/apache/excalibur/containerkit/factory
                        ComponentFactory.java DefaultComponentFactory.java
               containerkit/src/java/org/apache/excalibur/containerkit/lifecycle/impl
                        AbstractResourceProvider.java
  Added:       containerkit/src/java/org/apache/excalibur/containerkit/factory
                        DefaultComponentBundle.java
  Log:
  Update ComponentFactory to work with bundles.
  
  Revision  Changes    Path
  1.8       +7 -7      jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/factory/ComponentFactory.java
  
  Index: ComponentFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/factory/ComponentFactory.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ComponentFactory.java	19 Aug 2002 13:23:37 -0000	1.7
  +++ ComponentFactory.java	31 Aug 2002 09:18:16 -0000	1.8
  @@ -7,14 +7,14 @@
    */
   package org.apache.excalibur.containerkit.factory;
   
  -import org.apache.avalon.framework.info.ComponentInfo;
  +import org.apache.avalon.framework.info.ComponentBundle;
   
   /**
    * This interface defines the mechanism via which a
  - * component or its associated {@link ComponentInfo} can
  + * component or its associated {@link ComponentBundle} can
    * be created.
    *
  - * <p>Usually the component or componentInfo will just be loaded
  + * <p>Usually the component or ComponentBundle will just be loaded
    * from a particular ClassLoader. However if a developer wanted
    * to dynamically assemble applications they could implement
    * a custom factory that created components via non-standard
  @@ -34,14 +34,14 @@
       String ROLE = ComponentFactory.class.getName();
   
       /**
  -     * Create a {@link ComponentInfo} for component
  +     * Create a {@link ComponentBundle} for component
        * specified by implementationKey.
        *
        * @param implementationKey the key indicating type of component (usually classname)
  -     * @return the ComponentInfo for component
  +     * @return the ComponentBundle for component
        * @throws Exception if unable to create Info object
        */
  -    ComponentInfo createInfo( String implementationKey )
  +    ComponentBundle createBundle( String implementationKey )
           throws Exception;
   
       /**
  
  
  
  1.10      +11 -8     jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/factory/DefaultComponentFactory.java
  
  Index: DefaultComponentFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/factory/DefaultComponentFactory.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultComponentFactory.java	31 Aug 2002 09:03:19 -0000	1.9
  +++ DefaultComponentFactory.java	31 Aug 2002 09:18:16 -0000	1.10
  @@ -12,6 +12,7 @@
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.framework.info.ComponentInfo;
  +import org.apache.avalon.framework.info.ComponentBundle;
   import org.apache.avalon.framework.tools.infobuilder.ComponentInfoBuilder;
   
   /**
  @@ -65,19 +66,21 @@
        * Create a component by creating info for class
        * with specified name and loaded from factorys ClassLoader.
        *
  -     * @see ComponentFactory#createInfo
  +     * @see ComponentFactory#createBundle
        */
  -    public ComponentInfo createInfo( final String implementationKey )
  +    public ComponentBundle createBundle( final String implementationKey )
           throws Exception
       {
  -        ComponentInfo info = (ComponentInfo)m_infos.get( implementationKey );
  -        if( null == info )
  +        ComponentBundle bundle = (ComponentBundle)m_infos.get( implementationKey );
  +        if( null == bundle )
           {
  -            info = m_infoBuilder.build( implementationKey, m_classLoader );
  -            m_infos.put( implementationKey, info );
  +            final ComponentInfo info =
  +                m_infoBuilder.build( implementationKey, m_classLoader );
  +            bundle = new DefaultComponentBundle( info, m_classLoader );
  +            m_infos.put( implementationKey, bundle );
           }
   
  -        return info;
  +        return bundle;
       }
   
       /**
  
  
  
  1.1                  jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/factory/DefaultComponentBundle.java
  
  Index: DefaultComponentBundle.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.containerkit.factory;
  
  import org.apache.avalon.framework.info.ComponentBundle;
  import org.apache.avalon.framework.info.ComponentInfo;
  import java.io.InputStream;
  
  /**
   *
   *
   * @author <a href="mailto:peter at apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/08/31 09:18:16 $
   */
  public class DefaultComponentBundle
      implements ComponentBundle
  {
      private final ComponentInfo m_componentInfo;
      private final ClassLoader m_classLoader;
  
      public DefaultComponentBundle( final ComponentInfo componentInfo,
                                     final ClassLoader classLoader )
      {
          if( null == componentInfo )
          {
              throw new NullPointerException( "componentInfo" );
          }
          if( null == classLoader )
          {
              throw new NullPointerException( "classLoader" );
          }
          m_componentInfo = componentInfo;
          m_classLoader = classLoader;
      }
  
      public ComponentInfo getComponentInfo()
      {
          return m_componentInfo;
      }
  
      public InputStream getResourceAsStream( String resource )
      {
          return m_classLoader.getResourceAsStream( resource );
      }
  }
  
  
  
  1.16      +6 -3      jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/lifecycle/impl/AbstractResourceProvider.java
  
  Index: AbstractResourceProvider.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/lifecycle/impl/AbstractResourceProvider.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AbstractResourceProvider.java	18 Aug 2002 03:46:08 -0000	1.15
  +++ AbstractResourceProvider.java	31 Aug 2002 09:18:16 -0000	1.16
  @@ -28,6 +28,7 @@
   import org.apache.avalon.framework.info.ComponentInfo;
   import org.apache.avalon.framework.info.ContextDescriptor;
   import org.apache.avalon.framework.info.EntryDescriptor;
  +import org.apache.avalon.framework.info.ComponentBundle;
   import org.apache.excalibur.containerkit.factory.ComponentFactory;
   
   /**
  @@ -191,7 +192,8 @@
           final ComponentMetaData component = getMetaData( componentEntry );
           final String componentName = component.getName();
           final String impl = component.getImplementationKey();
  -        final ComponentInfo info = m_factory.createInfo( impl );
  +        final ComponentBundle bundle = m_factory.createBundle( impl );
  +        final ComponentInfo info = bundle.getComponentInfo();
           final ContextDescriptor descriptor = info.getContextDescriptor();
   
           final Map contextData = new HashMap();
  @@ -348,7 +350,8 @@
       {
           final ComponentMetaData component = getMetaData( componentEntry );
           final String impl = component.getImplementationKey();
  -        final ComponentInfo info = m_factory.createInfo( impl );
  +        final ComponentBundle bundle = m_factory.createBundle( impl );
  +        final ComponentInfo info = bundle.getComponentInfo();
           final DependencyMetaData[] dependencies = component.getDependencies();
   
           final HashMap services = new HashMap();
  
  
  

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