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/infobuilder ComponentInfoBuilder.java
Date Thu, 27 Jun 2002 03:49:32 GMT
donaldp     2002/06/26 20:49:32

  Modified:    containerkit/src/java/org/apache/excalibur/containerkit/infobuilder
                        ComponentInfoBuilder.java
  Log:
  Add in some utility methods to load a Info file from
  ClassName/ClassLoader combo or Class object.
  
  Revision  Changes    Path
  1.9       +36 -3     jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/infobuilder/ComponentInfoBuilder.java
  
  Index: ComponentInfoBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/infobuilder/ComponentInfoBuilder.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ComponentInfoBuilder.java	25 Jun 2002 07:40:55 -0000	1.8
  +++ ComponentInfoBuilder.java	27 Jun 2002 03:49:32 -0000	1.9
  @@ -7,9 +7,9 @@
    */
   package org.apache.excalibur.containerkit.infobuilder;
   
  +import java.io.InputStream;
   import java.util.ArrayList;
   import java.util.Properties;
  -import java.io.InputStream;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.Version;
  @@ -42,6 +42,39 @@
           ResourceManager.getPackageResources( ComponentInfoBuilder.class );
   
       /**
  +     * Create a {@link ComponentInfo} object for specified Class.
  +     *
  +     * @param clazz The class of Component
  +     * @return the created ComponentInfo
  +     * @throws ConfigurationException if an error occurs
  +     */
  +    public ComponentInfo build( final Class clazz )
  +        throws Exception
  +    {
  +        return build( clazz.getName(), clazz.getClassLoader() );
  +    }
  +
  +    /**
  +     * Create a {@link ComponentInfo} object for specified
  +     * classname, in specified ClassLoader.
  +     *
  +     * @param classname The classname of Component
  +     * @param classLoader the ClassLoader to load info from
  +     * @return the created ComponentInfo
  +     * @throws ConfigurationException if an error occurs
  +     */
  +    public ComponentInfo build( final String classname,
  +                                final ClassLoader classLoader )
  +        throws Exception
  +    {
  +        final String xinfo =
  +            "/" + classname.replace( '.', '/' ) + ".xinfo";
  +        final InputStream inputStream =
  +            classLoader.getResourceAsStream( xinfo );
  +        return build( classname, inputStream );
  +    }
  +
  +    /**
        * Create a {@link ComponentInfo} object for specified
        * classname, loaded from specified URI.
        *
  @@ -85,7 +118,7 @@
        * @throws ConfigurationException if an error occurs
        */
       private ComponentInfo build( final String classname,
  -                                final InputSource inputSource )
  +                                 final InputSource inputSource )
           throws Exception
       {
           final Configuration configuration = ConfigurationBuilder.build( inputSource );
  
  
  

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