hammant     2002/12/03 00:16:48

  Modified:    containerkit/src/java/org/apache/excalibur/containerkit/factory
                        DefaultComponentFactory.java
  Log:
  Peter's changes facilitatting auto-assembly for Phoenix
  
  Revision  Changes    Path
  1.14      +45 -5     
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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DefaultComponentFactory.java      4 Oct 2002 00:44:57 -0000       1.13
  +++ DefaultComponentFactory.java      3 Dec 2002 08:16:48 -0000       1.14
  @@ -73,9 +73,7 @@
           ComponentBundle bundle = (ComponentBundle)m_infos.get( implementationKey );
           if( null == bundle )
           {
  -            final ComponentInfo info =
  -                m_infoBuilder.buildComponentInfo( implementationKey, m_classLoader 
);
  -            bundle = new DefaultComponentBundle( info, m_classLoader );
  +            bundle = newBundle( implementationKey );
               m_infos.put( implementationKey, bundle );
           }
   
  @@ -91,7 +89,49 @@
       public Object createComponent( final String implementationKey )
           throws Exception
       {
  -        final Class clazz = m_classLoader.loadClass( implementationKey );
  +        final Class clazz = getClassLoader().loadClass( implementationKey );
           return clazz.newInstance();
  +    }
  +
  +
  +
  +    /**
  +     * Create a bundle for specified key.
  +     * Note that this does not cache bundle in any way.
  +     *
  +     * @param implementationKey the implementationKey
  +     * @return the new ComponentBundle
  +     * @throws Exception if unable to create bundle
  +     */
  +    protected ComponentBundle newBundle( final String implementationKey )
  +        throws Exception
  +    {
  +        ComponentBundle bundle;
  +        final ComponentInfo info = createComponentInfo( implementationKey );
  +        bundle = new DefaultComponentBundle( info, getClassLoader() );
  +        return bundle;
  +    }
  +
  +    /**
  +     * Create a {@link ComponentInfo} for component with specified 
implementationKey.
  +     *
  +     * @param implementationKey the implementationKey
  +     * @return the created {@link ComponentInfo}
  +     * @throws Exception if unabel to create componentInfo
  +     */
  +    protected ComponentInfo createComponentInfo( final String implementationKey )
  +        throws Exception
  +    {
  +        return m_infoBuilder.buildComponentInfo( implementationKey, 
getClassLoader() );
  +    }
  +
  +    /**
  +     * Retrieve ClassLoader associated with ComponentFactory.
  +     *
  +     * @return
  +     */
  +    protected ClassLoader getClassLoader()
  +    {
  +        return m_classLoader;
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to