You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2002/11/18 12:23:46 UTC

cvs commit: jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/model/verifier ProfileVerifier.java

mcconnell    2002/11/18 03:23:46

  Modified:    meta     build.xml
               meta/src/java/org/apache/excalibur/meta/info
                        DependencyDescriptor.java Resources.properties
                        ServiceDescriptor.java Type.java
               meta/src/java/org/apache/excalibur/meta/info/builder
                        XMLBlockCreator.java XMLTypeCreator.java
               meta/src/java/org/apache/excalibur/meta/model Profile.java
               meta/src/java/org/apache/excalibur/meta/model/builder
                        ProfileBuilder.java
               meta/src/java/org/apache/excalibur/meta/model/verifier
                        ProfileVerifier.java
  Added:       meta/src/java/org/apache/excalibur/meta/info
                        InfoDescriptor.java
  Removed:     meta/src/java/org/apache/excalibur/meta/info
                        ComponentDescriptor.java
  Log:
  Two changes:
  1. Replacement of getImplementationKey() with getImplemetationClassName().
  This change reflects the fact that the notion of an implementation key was
  undefined and presented potential miss-interpritation of the semantics of
  the value returned.
  2. Renaming the ComponentDescriptor class to InfoDescriptor as the prev.
  name suggested that it was describing the component when in fact it is
  only describing information attributed to a componet type.
  
  Revision  Changes    Path
  1.9       +2 -7      jakarta-avalon-excalibur/meta/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/meta/build.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- build.xml	12 Nov 2002 01:19:19 -0000	1.8
  +++ build.xml	18 Nov 2002 11:23:45 -0000	1.9
  @@ -332,13 +332,8 @@
   
     <target name="patch">
       <replace dir="src/java" summary="true"
  -       token="CategoriesDescriptor"
  -       value="LoggingDirective" >
  -     <include name="**/*.*"/>
  -    </replace>
  -    <replace dir="src/java" summary="true"
  -       token="IncludeDescriptor"
  -       value="IncludeDirective" >
  +       token="ComponentDescriptor"
  +       value="InfoDescriptor" >
        <include name="**/*.*"/>
       </replace>
     </target>
  
  
  
  1.6       +2 -2      jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/DependencyDescriptor.java
  
  Index: DependencyDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/DependencyDescriptor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DependencyDescriptor.java	23 Oct 2002 16:34:46 -0000	1.5
  +++ DependencyDescriptor.java	18 Nov 2002 11:23:45 -0000	1.6
  @@ -68,7 +68,7 @@
    *
    * <p>Also associated with each dependency is a set of arbitrary
    * attributes that can be used to store extra information
  - * about dependency. See {@link ComponentDescriptor} for example
  + * about dependency. See {@link InfoDescriptor} for example
    * of how to declare the container specific attributes.</p>
    *
    * <p>Possible uses for the attributes are to declare container
  
  
  
  1.2       +1 -1      jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/Resources.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Resources.properties	20 Aug 2002 16:06:45 -0000	1.1
  +++ Resources.properties	18 Nov 2002 11:23:45 -0000	1.2
  @@ -1,2 +1,2 @@
  -#From ComponentDescriptor and ContextDescriptor classes
  +#From InfoDescriptor and ContextDescriptor classes
   component.invalid-classname.error=Invalid classname {1}.
  
  
  
  1.8       +2 -2      jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/ServiceDescriptor.java
  
  Index: ServiceDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/ServiceDescriptor.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ServiceDescriptor.java	23 Oct 2002 16:34:46 -0000	1.7
  +++ ServiceDescriptor.java	18 Nov 2002 11:23:45 -0000	1.8
  @@ -66,7 +66,7 @@
    *
    * <p>Also associated with each service is a set of arbitrary
    * attributes that can be used to store extra information
  - * about service. See {@link ComponentDescriptor} for example
  + * about service. See {@link InfoDescriptor} for example
    * of how to declare the container specific attributes.</p>
    *
    * <p>Possible uses for the attributes are to declare a service
  
  
  
  1.11      +6 -6      jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/Type.java
  
  Index: Type.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/Type.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Type.java	18 Nov 2002 10:41:33 -0000	1.10
  +++ Type.java	18 Nov 2002 11:23:45 -0000	1.11
  @@ -84,7 +84,7 @@
    */
   public class Type implements Serializable
   {
  -    private final ComponentDescriptor m_descriptor;
  +    private final InfoDescriptor m_descriptor;
       private final ContextDescriptor m_context;
       private final ServiceDescriptor[] m_services;
       private final DependencyDescriptor[] m_dependencies;
  @@ -116,7 +116,7 @@
        * @exception NullPointerException if the descriptor, loggers, context, services,
        *   dependencies, stages, or extensions argument is null
        */
  -    public Type( final ComponentDescriptor descriptor,
  +    public Type( final InfoDescriptor descriptor,
                    final LoggerDescriptor[] loggers,
                    final ContextDescriptor context,
                    final ServiceDescriptor[] services,
  @@ -168,7 +168,7 @@
        *
        * @return the Component descriptor.
        */
  -    public ComponentDescriptor getInfo()
  +    public InfoDescriptor getInfo()
       {
           return m_descriptor;
       }
  @@ -306,7 +306,7 @@
           }
   
           final String xconfig =
  -            getInfo().getImplementationKey().replace( '.', '/' ) + ".xconfig";
  +            getInfo().getImplementationClassName().replace( '.', '/' ) + ".xconfig";
           final InputStream stream =
               loader.getResourceAsStream( xconfig );
           if( stream == null )
  @@ -382,6 +382,6 @@
       public String toString()
       {
           return "Type name: " + getInfo().getName()
  -            + " key: " + getInfo().getImplementationKey();
  +            + " key: " + getInfo().getImplementationClassName();
       }
   }
  
  
  
  1.1                  jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/InfoDescriptor.java
  
  Index: InfoDescriptor.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.excalibur.meta.info;
  
  import java.util.Properties;
  import org.apache.avalon.framework.Version;
  
  /**
   * This class is used to provide explicit information to assembler
   * and administrator about the Component. It includes information
   * such as;
   *
   * <ul>
   *   <li>a symbolic name</li>
   *   <li>classname</li>
   *   <li>version</li>
   * </ul>
   *
   * <p>The InfoDescriptor also includes an arbitrary set
   * of attributes about component. Usually these are container
   * specific attributes that can store arbitrary information.
   * The attributes should be stored with keys based on package
   * name of container.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/18 11:23:45 $
   */
  public final class InfoDescriptor extends Descriptor
  {
      /**
       * The short name of the Component Type. Useful for displaying
       * human readable strings describing the type in
       * assembly tools or generators.
       */
      private final String m_name;
  
      /**
       * The implementation classname.
       */
      private final String m_classname;
  
      /**
       * The version of component that descriptor describes.
       */
      private final Version m_version;
  
      /**
       * Creation of a new component descriptor using a supplied name, key, version
       * and attribute set.
       * @param name the component name
       * @param key the implemetation key - typeically the classname
       * @param version the implementation version
       * @param attributes a set of attributes associated with the component type
       * @exception IllegalArgumentException if the implementation key is not a classname
       */
      public InfoDescriptor( final String name,
                                  final String key,
                                  final Version version,
                                  final Properties attributes )
          throws IllegalArgumentException
      {
          super( attributes );
  
          if( key.indexOf( "/" ) > -1 )
          {
              throw new IllegalArgumentException( "classname: " + key );
          }
  
          m_name = name;
          m_classname = key;
          m_version = version;
      }
  
      /**
       * Return the symbolic name of component.
       *
       * @return the symbolic name of component.
       */
      public String getName()
      {
          return m_name;
      }
  
      /**
       * Return the implementation key for component (usually classname).
       *
       * @return the implementation key for component (usually classname).
       * @depricated The notion of a implemetation key is undefined. This
       *    method is depricated in favour of the getImplementationClassName() 
       *    method
       */
      public String getImplementationKey()
      {
          return m_classname;
      }
  
      /**
       * Return the implementation class name for the compoennt type.
       *
       * @return the implementation class name
       */
      public String getImplementationClassName()
      {
          return m_classname;
      }
  
  
      /**
       * Return the version of component.
       *
       * @return the version of component.
       */
      public Version getVersion()
      {
          return m_version;
      }
  }
  
  
  1.8       +4 -4      jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/builder/XMLBlockCreator.java
  
  Index: XMLBlockCreator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/builder/XMLBlockCreator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XMLBlockCreator.java	23 Oct 2002 16:34:47 -0000	1.7
  +++ XMLBlockCreator.java	18 Nov 2002 11:23:46 -0000	1.8
  @@ -64,7 +64,7 @@
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.excalibur.meta.ConfigurationBuilder;
  -import org.apache.excalibur.meta.info.ComponentDescriptor;
  +import org.apache.excalibur.meta.info.InfoDescriptor;
   import org.apache.excalibur.meta.info.ContextDescriptor;
   import org.apache.excalibur.meta.info.DependencyDescriptor;
   import org.apache.excalibur.meta.info.ExtensionDescriptor;
  @@ -150,8 +150,8 @@
           Configuration configuration = null;
   
           configuration = info.getChild( "block" );
  -        final ComponentDescriptor descriptor =
  -            buildComponentDescriptor( classname, configuration );
  +        final InfoDescriptor descriptor =
  +            buildInfoDescriptor( classname, configuration );
   
           configuration = info.getChild( "loggers" );
           final LoggerDescriptor[] loggers = buildLoggers( configuration );
  
  
  
  1.14      +8 -8      jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/builder/XMLTypeCreator.java
  
  Index: XMLTypeCreator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/builder/XMLTypeCreator.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- XMLTypeCreator.java	23 Oct 2002 16:34:47 -0000	1.13
  +++ XMLTypeCreator.java	18 Nov 2002 11:23:46 -0000	1.14
  @@ -65,7 +65,7 @@
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.context.Context;
   import org.apache.excalibur.meta.ConfigurationBuilder;
  -import org.apache.excalibur.meta.info.ComponentDescriptor;
  +import org.apache.excalibur.meta.info.InfoDescriptor;
   import org.apache.excalibur.meta.info.ContextDescriptor;
   import org.apache.excalibur.meta.info.DependencyDescriptor;
   import org.apache.excalibur.meta.info.EntryDescriptor;
  @@ -161,8 +161,8 @@
               configuration = info.getChild( "component" );
           }
   
  -        final ComponentDescriptor descriptor =
  -            buildComponentDescriptor( classname, configuration );
  +        final InfoDescriptor descriptor =
  +            buildInfoDescriptor( classname, configuration );
   
           configuration = info.getChild( "loggers" );
           final LoggerDescriptor[] loggers = buildLoggers( configuration );
  @@ -460,15 +460,15 @@
       }
   
       /**
  -     * A utility method to build a {@link ComponentDescriptor}
  +     * A utility method to build a {@link InfoDescriptor}
        * object from specified configuraiton data and classname.
        *
        * @param classname The classname of Component (used to create descriptor)
        * @param component the Component Configuration
  -     * @return the created ComponentDescriptor
  +     * @return the created InfoDescriptor
        * @throws ConfigurationException if an error occurs
        */
  -    protected ComponentDescriptor buildComponentDescriptor( final String classname,
  +    protected InfoDescriptor buildInfoDescriptor( final String classname,
                                                               final Configuration component )
           throws ConfigurationException
       {
  @@ -477,7 +477,7 @@
           final Properties attributes =
               buildAttributes( component.getChild( "attributes" ) );
   
  -        return new ComponentDescriptor( name, classname, version, attributes );
  +        return new InfoDescriptor( name, classname, version, attributes );
       }
   
       /**
  
  
  
  1.3       +3 -3      jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/model/Profile.java
  
  Index: Profile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/model/Profile.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Profile.java	18 Nov 2002 10:41:34 -0000	1.2
  +++ Profile.java	18 Nov 2002 11:23:46 -0000	1.3
  @@ -376,7 +376,7 @@
           }
   
           final Class type = classloader.loadClass(
  -            getType().getInfo().getImplementationKey() );
  +            getType().getInfo().getImplementationClassName() );
           if( !Configurable.class.isAssignableFrom( type ) )
           {
               return null;
  @@ -462,7 +462,7 @@
           buffer.append( "PROFILE REPORT\n" );
           buffer.append( "\n  name: " + getName() );
           buffer.append( "\n  base: " + getType().getInfo().getName() );
  -        buffer.append( "\n  key: " + getType().getInfo().getImplementationKey() );
  +        buffer.append( "\n  key: " + getType().getInfo().getImplementationClassName() );
           buffer.append( "\n  context: " + getContext() );
           buffer.append( "\n  configuration:" );
           if( getConfiguration() != null )
  
  
  
  1.3       +2 -2      jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/model/builder/ProfileBuilder.java
  
  Index: ProfileBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/model/builder/ProfileBuilder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProfileBuilder.java	18 Nov 2002 10:41:34 -0000	1.2
  +++ ProfileBuilder.java	18 Nov 2002 11:23:46 -0000	1.3
  @@ -105,7 +105,7 @@
           throws Exception
       {
           final String xprofile =
  -            type.getInfo().getImplementationKey().replace( '.', '/' ) + ".xprofile";
  +            type.getInfo().getImplementationClassName().replace( '.', '/' ) + ".xprofile";
           final InputStream inputStream =
               loader.getResourceAsStream( xprofile );
   
  
  
  
  1.2       +2 -2      jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/model/verifier/ProfileVerifier.java
  
  Index: ProfileVerifier.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/model/verifier/ProfileVerifier.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProfileVerifier.java	11 Nov 2002 10:37:42 -0000	1.1
  +++ ProfileVerifier.java	18 Nov 2002 11:23:46 -0000	1.2
  @@ -320,6 +320,6 @@
        */
       private String getClassname( final Profile profile )
       {
  -        return profile.getType().getInfo().getImplementationKey();
  +        return profile.getType().getInfo().getImplementationClassName();
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>