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/meta/tools/src/java/org/apache/avalon/meta/info/builder/tags TypeTag.java
Date Tue, 15 Jul 2003 21:26:35 GMT
mcconnell    2003/07/15 14:26:35

  Modified:    meta/api/src/java/org/apache/avalon/meta/info Type.java
               meta/impl/src/java/org/apache/avalon/meta/info/builder
                        SerializedTypeCreator.java TypeBuilder.java
                        XMLLegacyCreator.java XMLTypeCreator.java
               meta/impl/src/java/org/apache/avalon/meta/info/writer
                        SerializedTypeWriter.java XMLTypeWriter.java
               meta/spi/src/java/org/apache/avalon/meta/info/builder
                        TypeCreator.java TypeFactory.java
               meta/spi/src/java/org/apache/avalon/meta/info/writer
                        TypeWriter.java
               meta/tools/src/java/org/apache/avalon/meta/info/ant
                        MetaTask.java
               meta/tools/src/java/org/apache/avalon/meta/info/builder/tags
                        TypeTag.java
  Removed:     meta/api/src/java/org/apache/avalon/meta/info
                        MetaInfoException.java MetaInfoLocator.java
  Log:
  Move meta-info getting of input and output streams tyo a service and out of the type definition.
  
  Revision  Changes    Path
  1.11      +32 -27    avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/Type.java
  
  Index: Type.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/Type.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Type.java	15 Jul 2003 19:15:56 -0000	1.10
  +++ Type.java	15 Jul 2003 21:26:35 -0000	1.11
  @@ -84,7 +84,6 @@
       private final CategoryDescriptor[] m_loggers;
       private final StageDescriptor[] m_stages;
       private final ExtensionDescriptor[] m_extensions;
  -    private final transient MetaInfoLocator m_locator;
   
       /**
        * Creation of a new Type instance using a supplied component descriptor,
  @@ -107,8 +106,7 @@
        * @exception NullPointerException if the descriptor, loggers, context, services,
        *   dependencies, stages, or extensions argument is null
        */
  -    public Type( final MetaInfoLocator locator,
  -                 final InfoDescriptor descriptor,
  +    public Type( final InfoDescriptor descriptor,
                    final CategoryDescriptor[] loggers,
                    final ContextDescriptor context,
                    final ServiceDescriptor[] services,
  @@ -117,7 +115,7 @@
                    final ExtensionDescriptor[] extensions )
               throws NullPointerException
       {
  -        this( locator, descriptor, loggers, context, services, dependencies, stages, extensions,
null );
  +        this( descriptor, loggers, context, services, dependencies, stages, extensions,
null );
       }
   
       /**
  @@ -141,8 +139,7 @@
        * @exception NullPointerException if the descriptor, loggers, context, services,
        *   dependencies, stages, or extensions argument is null
        */
  -    public Type( final MetaInfoLocator locator,
  -                 final InfoDescriptor descriptor,
  +    public Type( final InfoDescriptor descriptor,
                    final CategoryDescriptor[] loggers,
                    final ContextDescriptor context,
                    final ServiceDescriptor[] services,
  @@ -152,16 +149,35 @@
                    final Configuration defaults )
               throws NullPointerException
       {
  -        if ( null == locator ) throw new NullPointerException( "locator" );
  -        if ( null == descriptor ) throw new NullPointerException( "descriptor" );
  -        if ( null == loggers ) throw new NullPointerException( "loggers" );
  -        if ( null == context ) throw new NullPointerException( "context" );
  -        if ( null == services ) throw new NullPointerException( "services" );
  -        if ( null == dependencies ) throw new NullPointerException( "dependencies" );
  -        if ( null == stages ) throw new NullPointerException( "stages" );
  -        if ( null == extensions ) throw new NullPointerException( "extensions" );
  +        if ( null == descriptor )
  +        {
  +            throw new NullPointerException( "descriptor" );
  +        }
  +        if ( null == loggers )
  +        {
  +            throw new NullPointerException( "loggers" );
  +        }
  +        if ( null == context )
  +        {
  +            throw new NullPointerException( "context" );
  +        }
  +        if ( null == services )
  +        {
  +            throw new NullPointerException( "services" );
  +        }
  +        if ( null == dependencies )
  +        {
  +            throw new NullPointerException( "dependencies" );
  +        }
  +        if ( null == stages )
  +        {
  +            throw new NullPointerException( "stages" );
  +        }
  +        if ( null == extensions )
  +        {
  +            throw new NullPointerException( "extensions" );
  +        }
   
  -        m_locator = locator;
           m_descriptor = descriptor;
           m_loggers = loggers;
           m_context = context;
  @@ -173,17 +189,6 @@
       }
   
       /**
  -     * Return the MetaInfoLocator so that extensions can load in the appropriate information
  -     * that they need as well.
  -     *
  -     * @return the required MetaInfoLocator
  -     */
  -    public MetaInfoLocator getLocator()
  -    {
  -        return m_locator;
  -    }
  -
  -    /**
        * Return the Component descriptor.
        *
        * @return the Component descriptor.
  @@ -415,7 +420,7 @@
           hash ^= m_context.hashCode();
           hash >>>= 13;
           if( m_configuration != null )
  -        {
  +        { 
               hash ^= m_context.hashCode();
               hash >>>= 13;
           }
  
  
  
  1.3       +6 -4      avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/builder/SerializedTypeCreator.java
  
  Index: SerializedTypeCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/builder/SerializedTypeCreator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SerializedTypeCreator.java	15 Jul 2003 19:15:56 -0000	1.2
  +++ SerializedTypeCreator.java	15 Jul 2003 21:26:35 -0000	1.3
  @@ -51,9 +51,9 @@
   
   package org.apache.avalon.meta.info.builder;
   
  +import java.io.InputStream;
   import java.io.ObjectInputStream;
   import org.apache.avalon.meta.info.Type;
  -import org.apache.avalon.meta.info.MetaInfoLocator;
   
   /**
    * Create {@link Type} from stream made up of
  @@ -68,14 +68,16 @@
   
       /**
        * Create of a type instance from a serialized form.
  -     * @param locator   the MetaInfoLocator for the type
  +     * @param key not-used
  +     * @param inputStream the input stream
        * @return the meta-info instance that describes the component type
        * @exception Exception if an error occurs
        */
  -    public Type createType( final MetaInfoLocator locator )
  +    public Type createType( final String key,
  +                            final InputStream inputStream )
           throws Exception
       {
  -        final ObjectInputStream ois = new ObjectInputStream( locator.getInputStream(".ztype")
);
  +        final ObjectInputStream ois = new ObjectInputStream( inputStream );
           return (Type)ois.readObject();
       }
   
  
  
  
  1.5       +17 -50    avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/builder/TypeBuilder.java
  
  Index: TypeBuilder.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/builder/TypeBuilder.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TypeBuilder.java	15 Jul 2003 19:59:00 -0000	1.4
  +++ TypeBuilder.java	15 Jul 2003 21:26:35 -0000	1.5
  @@ -51,17 +51,14 @@
   package org.apache.avalon.meta.info.builder;
   
   import java.io.InputStream;
  -import java.io.OutputStream;
  -
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.meta.info.Type;
  -import org.apache.avalon.meta.info.MetaInfoLocator;
  -import org.apache.avalon.meta.info.MetaInfoException;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.DefaultConfiguration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.meta.ConfigurationBuilder;
  +import org.apache.excalibur.configuration.ConfigurationUtil;
   import org.xml.sax.InputSource;
   
   /**
  @@ -112,14 +109,15 @@
       /**
        * Build Type from the XML descriptor format.
        *
  -     * @param clazz The class of the Component
  +     * @param classname The classname of Component
  +     * @param classLoader the ClassLoader to load info from
        * @return the created Type
        * @throws Exception if an error occurs
        */
       private Type buildFromSerDescriptor( final Class clazz )
           throws Exception
       {
  -        Type type = buildFromSerDescriptor( clazz, ".ztype" );
  +        Type type = buildFromSerDescriptor( clazz, ".ztype" ); 
           if( type != null )
           {
               return type;
  @@ -142,19 +140,20 @@
           {
               return null;
           }
  -        return m_serialTypeCreator.createType( getMetaInfoLocator(clazz) );
  +        return m_serialTypeCreator.createType( classname, stream );
       }
   
       /**
        * Build Type from the XML descriptor format.  The implementation
        * will attempt to locate a <classname>.xtype resource.  If
  -     * not found, the implementation will attempt to locate
  +     * not found, the implementation will attempt to locate 
        * a <classname>.info resource.  Once a resource is established
        * the type will be resolved relative to the root element.  Normally
  -     * the root element is a &lttype>, however the implementation
  -     * also recognises the legacy <blockinfo> schema.
  -     *
  -     * @param clazz The class of Component
  +     * the root element is a &lttype>, however the implementation 
  +     * also recognises the legacy <blockinfo> schema. 
  +     * 
  +     * @param classname The classname of Component
  +     * @param classLoader the ClassLoader to load info from
        * @return the created Type
        * @throws Exception if an error occurs
        */
  @@ -202,7 +201,7 @@
           if( defaultsStream != null )
           {
               final InputSource defaultsSource = new InputSource( defaultsStream );
  -            defaults = resolveConfiguration(
  +            defaults = resolveConfiguration( 
                 classLoader, ConfigurationBuilder.build( defaultsSource ) );
           }
           else
  @@ -214,42 +213,10 @@
           // build the type
           //
   
  -        return xmlTypeFactory.createType( getMetaInfoLocator(clazz), xinfo, defaults );
  -    }
  -
  -    private MetaInfoLocator getMetaInfoLocator( Class clazz )
  -    {
  -        return new ClassLoaderMetaInfoLocator(clazz);
  -    }
  -
  -    private final static class ClassLoaderMetaInfoLocator implements MetaInfoLocator
  -    {
  -        private final Class m_class;
  -        private final String m_basePath;
  -
  -        private ClassLoaderMetaInfoLocator( final Class clazz )
  -        {
  -            m_class = clazz;
  -            m_basePath = m_class.getName().replace('.', '/') + ".";
  -        }
  -
  -        public String getKey()
  -        {
  -            return m_class.getName();
  -        }
  -
  -        public InputStream getInputStream( String extension ) throws MetaInfoException
  -        {
  -            return m_class.getClassLoader().getResourceAsStream( m_basePath + extension
);
  -        }
  -
  -        public OutputStream getOutputStream( String extension ) throws MetaInfoException
  -        {
  -            throw new MetaInfoException("This particular locator cannot write");
  -        }
  +        return xmlTypeFactory.createType( classname, xinfo, defaults );
       }
   
  -    private Configuration resolveConfiguration( ClassLoader classloader, Configuration
config )
  +    private Configuration resolveConfiguration( ClassLoader classloader, Configuration
config ) 
         throws Exception
       {
           if( config == null )
  @@ -275,14 +242,14 @@
                       throw new ConfigurationException( error );
                   }
                   final InputSource source = new InputSource( stream );
  -                return resolveConfiguration(
  +                return resolveConfiguration( 
                     classloader, ConfigurationBuilder.build( source ) );
               }
               else
               {
                   try
                   {
  -                    return resolveConfiguration(
  +                    return resolveConfiguration( 
                         classloader, ConfigurationBuilder.build( src ) );
                   }
                   catch( Throwable e )
  
  
  
  1.6       +36 -24    avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLLegacyCreator.java
  
  Index: XMLLegacyCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLLegacyCreator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XMLLegacyCreator.java	15 Jul 2003 19:59:00 -0000	1.5
  +++ XMLLegacyCreator.java	15 Jul 2003 21:26:35 -0000	1.6
  @@ -59,7 +59,16 @@
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.meta.ConfigurationBuilder;
  -import org.apache.avalon.meta.info.*;
  +import org.apache.avalon.meta.info.InfoDescriptor;
  +import org.apache.avalon.meta.info.ContextDescriptor;
  +import org.apache.avalon.meta.info.EntryDescriptor;
  +import org.apache.avalon.meta.info.DependencyDescriptor;
  +import org.apache.avalon.meta.info.ExtensionDescriptor;
  +import org.apache.avalon.meta.info.CategoryDescriptor;
  +import org.apache.avalon.meta.info.ReferenceDescriptor;
  +import org.apache.avalon.meta.info.ServiceDescriptor;
  +import org.apache.avalon.meta.info.StageDescriptor;
  +import org.apache.avalon.meta.info.Type;
   import org.apache.excalibur.configuration.ConfigurationUtil;
   import org.xml.sax.InputSource;
   
  @@ -81,47 +90,50 @@
        * Create a {@link Type} object for specified
        * classname, loaded from specified {@link InputStream}.
        *
  -     * @param locator the MetaInfoLocator to load Type from
  +     * @param implementationKey The classname of Component
  +     * @param inputStream the InputStream to load Type from
        * @return the created Type
        * @throws Exception if an error occurs
        */
  -    public Type createType( MetaInfoLocator locator )
  +    public Type createType( String implementationKey,
  +                            InputStream inputStream )
           throws Exception
       {
  -        if( locator == null )
  +        if( inputStream == null )
           {
  -            throw new NullPointerException( "locator" );
  +            throw new NullPointerException( "input" );
           }
  -        final InputSource input = new InputSource( locator.getInputStream(".xinfo") );
  +        final InputSource input = new InputSource( inputStream );
  +        final String classname = implementationKey;
           final Configuration xinfo = ConfigurationBuilder.build( input );
  -        return build( locator, xinfo );
  +        return build( classname, xinfo );
       }
   
       /**
        * Create a {@link Type} object for specified
        * classname and configuration.
        *
  -     * @param locator The MetaInfoLocator of the component
  +     * @param classname The classname of the component
        * @param config the meta info configuration fragment
        * @return the created Type
        * @throws ConfigurationException if an error occurs
        */
  -    public Type createType( MetaInfoLocator locator, Configuration config )
  +    public Type createType( String classname, Configuration config )
           throws ConfigurationException
       {
  -        return build( locator, config );
  +        return build( classname, config );
       }
   
       /**
        * Create a {@link Type} object for specified classname from
        * specified configuration data.
        *
  -     * @param locator The locator of Component
  +     * @param classname The classname of Component
        * @param info the Type configuration
        * @return the created Type
        * @throws ConfigurationException if an error occurs
        */
  -    private Type build( final MetaInfoLocator locator, final Configuration info )
  +    private Type build( final String classname, final Configuration info )
           throws ConfigurationException
       {
           final String topLevelName = info.getName();
  @@ -129,7 +141,7 @@
           {
               final String message =
                 REZ.getString( "builder.bad-toplevel-block-element.error",
  -                   locator.getKey(),
  +                   classname,
                      topLevelName );
               throw new ConfigurationException( message );
           }
  @@ -138,7 +150,7 @@
   
           configuration = info.getChild( "block" );
           final InfoDescriptor descriptor =
  -            buildInfoDescriptor( locator.getKey(), configuration );
  +            buildInfoDescriptor( classname, configuration );
   
           configuration = info.getChild( "loggers" );
           final CategoryDescriptor[] loggers = new CategoryDescriptor[0];
  @@ -156,7 +168,7 @@
           configuration = info.getChild( "extensions" );
           final ExtensionDescriptor[] extensions = buildExtensions( configuration );
   
  -        return new Type( locator,
  +        return new Type(
               descriptor, loggers, context, services, dependencies, phases, extensions );
       }
   
  @@ -173,9 +185,9 @@
         final String classname, final Configuration info )
         throws ConfigurationException
       {
  -        final String name =
  +        final String name = 
             info.getChild( "name" ).getValue( null );
  -        final Version version =
  +        final Version version = 
             buildVersion( info.getChild( "version" ).getValue( "1.0" ) );
           final Properties attributes =
               buildAttributes( info.getChild( "attributes" ) );
  @@ -185,15 +197,15 @@
   
       private ContextDescriptor buildPhoenixContext()
       {
  -        ReferenceDescriptor reference =
  +        ReferenceDescriptor reference = 
              createReference( "org.apache.avalon.framework.context.Context" );
  -        EntryDescriptor name =
  +        EntryDescriptor name = 
             new EntryDescriptor( "urn:avalon:name", "java.lang.String", false, false, "block.name"
);
  -        EntryDescriptor partition =
  +        EntryDescriptor partition = 
             new EntryDescriptor( "urn:avalon:partition", "java.lang.String", false, false,
"app.name" );
  -        EntryDescriptor home =
  +        EntryDescriptor home = 
             new EntryDescriptor( "urn:avalon:home", "java.io.File", false, false, "app.home"
);
  -        return new ContextDescriptor(
  +        return new ContextDescriptor( 
             reference, new EntryDescriptor[]{ name, partition, home }, null );
       }
   
  @@ -201,7 +213,7 @@
        * A utility method to build an array of {@link ServiceDescriptor}
        * objects from specified configuraiton.
        *
  -     * @param depSet the dependencies configuration
  +     * @param servicesSet the services configuration
        * @return the created ServiceDescriptor
        * @throws ConfigurationException if an error occurs
        */
  
  
  
  1.6       +50 -38    avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLTypeCreator.java
  
  Index: XMLTypeCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLTypeCreator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XMLTypeCreator.java	15 Jul 2003 19:59:00 -0000	1.5
  +++ XMLTypeCreator.java	15 Jul 2003 21:26:35 -0000	1.6
  @@ -60,7 +60,16 @@
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.context.Context;
   import org.apache.avalon.meta.ConfigurationBuilder;
  -import org.apache.avalon.meta.info.*;
  +import org.apache.avalon.meta.info.InfoDescriptor;
  +import org.apache.avalon.meta.info.ContextDescriptor;
  +import org.apache.avalon.meta.info.DependencyDescriptor;
  +import org.apache.avalon.meta.info.EntryDescriptor;
  +import org.apache.avalon.meta.info.ExtensionDescriptor;
  +import org.apache.avalon.meta.info.CategoryDescriptor;
  +import org.apache.avalon.meta.info.ReferenceDescriptor;
  +import org.apache.avalon.meta.info.ServiceDescriptor;
  +import org.apache.avalon.meta.info.StageDescriptor;
  +import org.apache.avalon.meta.info.Type;
   import org.apache.excalibur.configuration.ConfigurationUtil;
   import org.xml.sax.InputSource;
   
  @@ -82,49 +91,51 @@
        * Create a {@link Type} object for specified
        * classname, loaded from specified {@link InputStream}.
        *
  -     * @param locator the MetaInfoLocator to load Type from
  +     * @param classname The classname of Component
  +     * @param inputStream the InputStream to load Type from
        * @return the created Type
        * @throws Exception if an error occurs
        */
  -    public Type createType( MetaInfoLocator locator )
  +    public Type createType( String classname,
  +                            InputStream inputStream )
           throws Exception
       {
  -        if( locator == null )
  +        if( inputStream == null )
           {
  -            throw new NullPointerException( "locator" );
  +            throw new NullPointerException( "input" );
           }
   
  -        final InputSource input = new InputSource( locator.getInputStream(".xtype") );
  +        final InputSource input = new InputSource( inputStream );
           final Configuration xinfo = ConfigurationBuilder.build( input );
  -        return createType( locator, xinfo, (Configuration) null );
  +        return createType( classname, xinfo, (Configuration) null );
       }
   
       /**
        * Create an {@link Type} object for a specified classname from
        * specified configuration data.
        *
  -     * @param locator The classname of Component
  +     * @param classname The classname of Component
        * @param info the Type configuration
        * @param defaults the default configuration
        * @return the created Type
        * @throws Exception if an error occurs
        */
  -    public Type createType(
  -        final MetaInfoLocator locator, final Configuration info, final Configuration defaults
)
  -        throws Exception
  +    public Type createType( 
  +        final String classname, final Configuration info, final Configuration defaults
)
  +        throws ConfigurationException
       {
           final String topLevelName = info.getName();
  -
  +         
           if( topLevelName.equals( "blockinfo" ) )
           {
  -            return new XMLLegacyCreator().createType( locator, info );
  +            return new XMLLegacyCreator().createType( classname, info );
           }
   
           if( !topLevelName.equals( "type" ) )
           {
               final String message =
                   REZ.getString( "builder.bad-toplevel-element.error",
  -                        locator.getKey(),
  +                               classname,
                                  topLevelName );
               throw new ConfigurationException( message );
           }
  @@ -140,7 +151,7 @@
           configuration = info.getChild( "info", false );
   
           final InfoDescriptor descriptor =
  -            buildInfoDescriptor( locator.getKey(), configuration );
  +            buildInfoDescriptor( classname, configuration );
   
           configuration = info.getChild( "loggers" );
           final CategoryDescriptor[] loggers = buildLoggers( configuration );
  @@ -152,7 +163,7 @@
           final ServiceDescriptor[] services = buildServices( configuration );
   
           configuration = info.getChild( "dependencies" );
  -        final DependencyDescriptor[] dependencies =
  +        final DependencyDescriptor[] dependencies = 
              buildDependencies( configuration );
   
           configuration = info.getChild( "stages" );
  @@ -161,8 +172,8 @@
           configuration = info.getChild( "extensions" );
           final ExtensionDescriptor[] extensions = buildExtensions( configuration );
   
  -        return new Type( locator,
  -          descriptor, loggers, context, services, dependencies, phases,
  +        return new Type(
  +          descriptor, loggers, context, services, dependencies, phases, 
             extensions, defaults );
       }
   
  @@ -170,9 +181,9 @@
        * Utility function to create a set of phase descriptor from a configuration.
        * @param config a configuration containing 0..n phase elements
        * @return an array of phase descriptors
  -     * @exception ConfigurationException if a build error occurs
  +     * @exception Exception if a build error occurs
        */
  -    protected StageDescriptor[] buildPhases( Configuration config )
  +    protected StageDescriptor[] buildPhases( Configuration config ) 
         throws ConfigurationException
       {
           ArrayList list = new ArrayList();
  @@ -189,9 +200,9 @@
        * Utility function to create a set of phase descriptor from a configuration.
        * @param config a configuration containing 0..n phase elements
        * @return an array of phase descriptors
  -     * @exception ConfigurationException if a build error occurs
  +     * @exception Exception if a build error occurs
        */
  -    protected StageDescriptor buildPhase( Configuration config )
  +    protected StageDescriptor buildPhase( Configuration config ) 
         throws ConfigurationException
       {
           ReferenceDescriptor reference = buildReferenceDescriptor( config );
  @@ -230,8 +241,8 @@
           final String type = service.getAttribute("type", classname );
           if( type == null )
           {
  -            final String error =
  -              "Missing 'type' attribute in configuration: "
  +            final String error = 
  +              "Missing 'type' attribute in configuration: " 
                 + ConfigurationUtil.list( service );
               throw new ConfigurationException( error );
           }
  @@ -311,6 +322,7 @@
        * A utility method to build a {@link DependencyDescriptor}
        * object from specified configuraiton.
        *
  +     * @param classname The classname of Component (used for logging purposes)
        * @param dependency the dependency configuration
        * @return the created DependencyDescriptor
        * @throws ConfigurationException if an error occurs
  @@ -323,9 +335,9 @@
           {
               role = dependency.getAttribute( "key", null );
           }
  -        ReferenceDescriptor reference =
  +        ReferenceDescriptor reference = 
             buildReferenceDescriptor( dependency );
  -
  +        
           final boolean optional =
              dependency.getAttributeAsBoolean( "optional", false );
           final Properties attributes =
  @@ -360,7 +372,7 @@
           final Properties attributes =
             buildAttributes( context.getChild( "attributes" ) );
   
  -        ReferenceDescriptor reference =
  +        ReferenceDescriptor reference = 
             buildReferenceDescriptor( context, Context.class.getName() );
   
           return new ContextDescriptor( reference, entrys, attributes );
  @@ -420,20 +432,20 @@
         final String classname, final Configuration info )
         throws ConfigurationException
       {
  -        final String name =
  +        final String name = 
             info.getChild( "name" ).getValue( null );
  -        final Version version =
  +        final Version version = 
             buildVersion( info.getChild( "version" ).getValue( "1.0" ) );
           final Properties attributes =
               buildAttributes( info.getChild( "attributes" ) );
  -        final String lifestyle =
  +        final String lifestyle = 
             buildLifestyle( info, attributes );
           return new InfoDescriptor( name, classname, version, lifestyle, attributes );
       }
   
      /**
  -    * Handle the resolution of the component lifestyle.  Normally this is
  -    * resolved by retrieving the <lifestyle> element value, however, for
  +    * Handle the resolution of the component lifestyle.  Normally this is 
  +    * resolved by retrieving the <lifestyle> element value, however, for

       * backward compatability - if the lifecycle element is not present, we will
       * attempt to resolve the lifestyle using the attribute value relative to the
       * key urn:avalon:lifestyle.
  @@ -459,9 +471,9 @@
        * Utility function to create a set of phase descriptor from a configuration.
        * @param config a configuration containing 0..n phase elements
        * @return an array of phase descriptors
  -     * @exception ConfigurationException if a build error occurs
  +     * @exception Exception if a build error occurs
        */
  -    protected ExtensionDescriptor[] buildExtensions( Configuration config )
  +    protected ExtensionDescriptor[] buildExtensions( Configuration config ) 
         throws ConfigurationException
       {
           ArrayList list = new ArrayList();
  @@ -477,12 +489,12 @@
        * Utility function to create an extension descriptor from a configuration.
        * @param config a configuration containing the extension definition
        * @return the extension descriptor
  -     * @exception ConfigurationException if a build error occurs
  +     * @exception Exception if a build error occurs
        */
  -    protected ExtensionDescriptor buildExtension( Configuration config )
  +    protected ExtensionDescriptor buildExtension( Configuration config ) 
         throws ConfigurationException
       {
  -        ReferenceDescriptor reference =
  +        ReferenceDescriptor reference = 
             buildReferenceDescriptor( config );
           final Properties attributes =
             buildAttributes( config.getChild( "attributes" ) );
  
  
  
  1.3       +3 -2      avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/writer/SerializedTypeWriter.java
  
  Index: SerializedTypeWriter.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/writer/SerializedTypeWriter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SerializedTypeWriter.java	15 Jul 2003 19:15:57 -0000	1.2
  +++ SerializedTypeWriter.java	15 Jul 2003 21:26:35 -0000	1.3
  @@ -67,13 +67,14 @@
        * Write a {@link Type} to a stream
        *
        * @param type the meta info Type instance
  +     * @param stream the destination stream
        * @throws Exception if an error occurs while writting to the stream
        */
  -    public void writeType( final Type type )
  +    public void writeType( final Type type, final OutputStream stream )
           throws Exception
       {
           final ObjectOutputStream output =
  -          new ObjectOutputStream( type.getLocator().getOutputStream("ztype") );
  +          new ObjectOutputStream( stream );
           output.writeObject( type );
           output.flush();
       }
  
  
  
  1.8       +5 -3      avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/writer/XMLTypeWriter.java
  
  Index: XMLTypeWriter.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/writer/XMLTypeWriter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XMLTypeWriter.java	15 Jul 2003 20:03:03 -0000	1.7
  +++ XMLTypeWriter.java	15 Jul 2003 21:26:35 -0000	1.8
  @@ -82,12 +82,14 @@
        * Write out type representation to xml.
        *
        * @param type the type object
  +     * @param outputStream the stream to write to
        * @throws Exception if unable to write xml
        */
  -    public void writeType( final Type type )
  +    public void writeType( final Type type,
  +                                    final OutputStream outputStream )
           throws Exception
       {
  -        final Writer writer = new OutputStreamWriter( type.getLocator().getOutputStream("xtype")
);
  +        final Writer writer = new OutputStreamWriter( outputStream );
           writeHeader( writer );
           writeDoctype( writer, "type" );
           writer.write( "\n\n<type>" );
  
  
  
  1.3       +4 -2      avalon-sandbox/meta/spi/src/java/org/apache/avalon/meta/info/builder/TypeCreator.java
  
  Index: TypeCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/spi/src/java/org/apache/avalon/meta/info/builder/TypeCreator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TypeCreator.java	15 Jul 2003 19:15:57 -0000	1.2
  +++ TypeCreator.java	15 Jul 2003 21:26:35 -0000	1.3
  @@ -50,8 +50,8 @@
   
   package org.apache.avalon.meta.info.builder;
   
  +import java.io.InputStream;
   import org.apache.avalon.meta.info.Type;
  -import org.apache.avalon.meta.info.MetaInfoLocator;
   
   /**
    * Simple interface used to create {@link Type}
  @@ -67,10 +67,12 @@
       /**
        * Create a {@link Type} from stream
        *
  +     * @param key the name of component type that we are looking up
        * @param input the input stream that the resource is loaded from
        * @return the newly created {@link Type}
        * @exception Exception if an error occurs
        */
  -    Type createType( MetaInfoLocator input )
  +    Type createType( String key, InputStream input )
           throws Exception;
  +
   }
  
  
  
  1.3       +3 -4      avalon-sandbox/meta/spi/src/java/org/apache/avalon/meta/info/builder/TypeFactory.java
  
  Index: TypeFactory.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/spi/src/java/org/apache/avalon/meta/info/builder/TypeFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TypeFactory.java	15 Jul 2003 19:15:57 -0000	1.2
  +++ TypeFactory.java	15 Jul 2003 21:26:35 -0000	1.3
  @@ -51,7 +51,6 @@
   package org.apache.avalon.meta.info.builder;
   
   import org.apache.avalon.meta.info.Type;
  -import org.apache.avalon.meta.info.MetaInfoLocator;
   import org.apache.avalon.framework.configuration.Configuration;
   
   /**
  @@ -67,15 +66,15 @@
   {
   
       /**
  -     * Create a {@link Type} using a supplied type configuration and default configuration
  +     * Create a {@link Type} using a supplied type configuration and default configuration

        *
  -     * @param locator the class resource name of component type that we are looking up
  +     * @param path the class resource name of component type that we are looking up
        * @param xinfo the configuration fragment for the type
        * @param defaults the configuration fragment for the default configuration
        * @return the newly created {@link Type}
        * @exception Exception if an error occurs
        */
  -    Type createType( MetaInfoLocator locator, Configuration xinfo, Configuration defaults
)
  +    Type createType( String path, Configuration xinfo, Configuration defaults )
           throws Exception;
   
   }
  
  
  
  1.3       +4 -1      avalon-sandbox/meta/spi/src/java/org/apache/avalon/meta/info/writer/TypeWriter.java
  
  Index: TypeWriter.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/spi/src/java/org/apache/avalon/meta/info/writer/TypeWriter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TypeWriter.java	15 Jul 2003 19:15:57 -0000	1.2
  +++ TypeWriter.java	15 Jul 2003 21:26:35 -0000	1.3
  @@ -49,6 +49,8 @@
   
   package org.apache.avalon.meta.info.writer;
   
  +import java.io.OutputStream;
  +
   import org.apache.avalon.meta.info.Type;
   
   /**
  @@ -64,8 +66,9 @@
        * Write a {@link Type} to a stream
        *
        * @param type the meta info Type instance
  +     * @param stream the destination stream
        * @throws Exception if an error occurs while writting to the stream
        */
  -    void writeType( Type type )
  +    void writeType( Type type, OutputStream stream )
           throws Exception;
   }
  
  
  
  1.4       +0 -0      avalon-sandbox/meta/tools/src/java/org/apache/avalon/meta/info/ant/MetaTask.java
  
  Index: MetaTask.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/tools/src/java/org/apache/avalon/meta/info/ant/MetaTask.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  
  
  
  1.3       +0 -0      avalon-sandbox/meta/tools/src/java/org/apache/avalon/meta/info/builder/tags/TypeTag.java
  
  Index: TypeTag.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/tools/src/java/org/apache/avalon/meta/info/builder/tags/TypeTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  
  
  

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


Mime
View raw message