donaldp     2002/09/07 20:35:21

  Modified:    info/src/java/org/apache/avalon/framework/info
                        ComponentDescriptor.java ServiceDescriptor.java
                        ServiceDesignator.java
               info/src/java/org/apache/avalon/framework/tools/infobuilder
                        XMLInfoCreator.java componentinfo.dtd
               info/src/java/org/apache/avalon/framework/tools/xdoclet
                        componentinfo.xdt
  Log:
  Make version into an attribute rather than as directly part of descriptors.
  
  Revision  Changes    Path
  1.4       +1 -24     
jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/ComponentDescriptor.java
  
  Index: ComponentDescriptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/ComponentDescriptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ComponentDescriptor.java  31 Aug 2002 13:36:06 -0000      1.3
  +++ ComponentDescriptor.java  8 Sep 2002 03:35:20 -0000       1.4
  @@ -8,7 +8,6 @@
   package org.apache.avalon.framework.info;
   
   import java.util.Properties;
  -import org.apache.avalon.framework.Version;
   
   /**
    * This class is used to provide explicit information to assembler
  @@ -18,7 +17,6 @@
    * <ul>
    *   <li>a symbolic name</li>
    *   <li>classname</li>
  - *   <li>version</li>
    * </ul>
    *
    * <p>The ComponentDescriptor also includes an arbitrary set
  @@ -65,14 +63,8 @@
        */
       private final String m_implementationKey;
   
  -    /**
  -     * The version of component that descriptor describes.
  -     */
  -    private final Version m_version;
  -
       public ComponentDescriptor( final String name,
                                   final String implementationKey,
  -                                final Version version,
                                   final Properties attributes )
       {
           super( attributes );
  @@ -84,14 +76,9 @@
           {
               throw new NullPointerException( "implementationKey" );
           }
  -        if( null == version )
  -        {
  -            throw new NullPointerException( "version" );
  -        }
   
           m_name = name;
           m_implementationKey = implementationKey;
  -        m_version = version;
       }
   
       /**
  @@ -112,15 +99,5 @@
       public String getImplementationKey()
       {
           return m_implementationKey;
  -    }
  -
  -    /**
  -     * Return the version of component.
  -     *
  -     * @return the version of component.
  -     */
  -    public Version getVersion()
  -    {
  -        return m_version;
       }
   }
  
  
  
  1.2       +2 -4      
jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/ServiceDescriptor.java
  
  Index: ServiceDescriptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/ServiceDescriptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServiceDescriptor.java    31 Aug 2002 08:17:00 -0000      1.1
  +++ ServiceDescriptor.java    8 Sep 2002 03:35:20 -0000       1.2
  @@ -13,9 +13,7 @@
   /**
    * This descriptor defines the type of service offerend or required
    * by a component. The type corresponds to the class name of the
  - * class/interface implemented by component. Associated with each
  - * classname is a version object so that different versions of same
  - * interface can be represented.
  + * class/interface implemented by component.
    *
    * <p>Also associated with each service is a set of arbitrary
    * attributes that can be used to store extra information
  
  
  
  1.2       +3 -41     
jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/ServiceDesignator.java
  
  Index: ServiceDesignator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/ServiceDesignator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServiceDesignator.java    31 Aug 2002 08:17:00 -0000      1.1
  +++ ServiceDesignator.java    8 Sep 2002 03:35:20 -0000       1.2
  @@ -7,7 +7,6 @@
    */
   package org.apache.avalon.framework.info;
   
  -import org.apache.avalon.framework.Version;
   import java.io.Serializable;
   
   /**
  @@ -30,31 +29,18 @@
       private final String m_classname;
   
       /**
  -     * The version of service class.
  -     */
  -    private final Version m_version;
  -
  -    /**
        * Construct a service with specified name, version and attributes.
        *
        * @param classname the name of the service
  -     * @param version the version of service
        */
  -    public ServiceDesignator( final String classname,
  -                              final Version version )
  +    public ServiceDesignator( final String classname )
       {
           if( null == classname )
           {
               throw new NullPointerException( "classname" );
           }
   
  -        if( null == version )
  -        {
  -            throw new NullPointerException( "version" );
  -        }
  -
           m_classname = classname;
  -        m_version = version;
       }
   
       /**
  @@ -69,36 +55,12 @@
       }
   
       /**
  -     * Return the version of interface
  -     *
  -     * @return the version of interface
  -     */
  -    public Version getVersion()
  -    {
  -        return m_version;
  -    }
  -
  -    /**
  -     * Determine if specified service will match this service.
  -     * To match a service has to have same name and must comply with version.
  -     *
  -     * @param other the other ServiceInfo
  -     * @return true if matches, false otherwise
  -     */
  -    public boolean matches( final ServiceDesignator other )
  -    {
  -        return
  -            other.getClassname().equals( getClassname() ) &&
  -            other.getVersion().complies( getVersion() );
  -    }
  -
  -    /**
        * Convert to a string of format name/version
        *
        * @return string describing service
        */
       public String toString()
       {
  -        return getClassname() + "/" + getVersion();
  +        return getClassname();
       }
   }
  
  
  
  1.2       +3 -18     
jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/XMLInfoCreator.java
  
  Index: XMLInfoCreator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/XMLInfoCreator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XMLInfoCreator.java       31 Aug 2002 08:17:01 -0000      1.1
  +++ XMLInfoCreator.java       8 Sep 2002 03:35:20 -0000       1.2
  @@ -12,7 +12,6 @@
   import java.util.Properties;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.avalon.framework.Version;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.context.Context;
  @@ -333,9 +332,7 @@
           throws ConfigurationException
       {
           final String name = service.getAttribute( "type" );
  -        final String versionString = service.getAttribute( "version", "1.0" 
);
  -        final Version version = buildVersion( versionString );
  -        return new ServiceDesignator( name, version );
  +        return new ServiceDesignator( name );
       }
   
       /**
  @@ -395,21 +392,9 @@
           throws ConfigurationException
       {
           final String name = component.getChild( "name" ).getValue( null );
  -        final Version version = buildVersion( component.getChild( "version" 
).getValue( "1.0" ) );
           final Properties attributes =
               buildAttributes( component.getChild( "attributes" ) );
   
  -        return new ComponentDescriptor( name, classname, version, attributes 
);
  -    }
  -
  -    /**
  -     * A utility method to parse a Version object from specified string.
  -     *
  -     * @param version the version string
  -     * @return the created Version object
  -     */
  -    private Version buildVersion( final String version )
  -    {
  -        return Version.getVersion( version );
  +        return new ComponentDescriptor( name, classname, attributes );
       }
   }
  
  
  
  1.2       +2 -8      
jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/componentinfo.dtd
  
  Index: componentinfo.dtd
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/componentinfo.dtd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- componentinfo.dtd 31 Aug 2002 08:17:01 -0000      1.1
  +++ componentinfo.dtd 8 Sep 2002 03:35:20 -0000       1.2
  @@ -39,12 +39,9 @@
   name         the human readable name of component type. Must be a string
                containing alphanumeric characters, '.', '_' and starting
                with a letter.
  -version           the version of the component in (in the format #.#.#, #.# 
or # where
  -             # is a integer
   -->
  -<!ELEMENT component      (name?,version,attributes?)>
  +<!ELEMENT component      (name?,attributes?)>
     <!ELEMENT name         (#PCDATA) >
  -  <!ELEMENT version      (#PCDATA) >
   
   <!--
   The logger element defines the loggers that are available to component.
  @@ -83,13 +80,10 @@
   
   type         the name of the service. This must be equal to the class name 
of the
                interface that defines the service.
  -version           the version of the block in (in the format #.#.#, #.# or # 
where
  -             # is a integer
   -->
   <!ELEMENT service-ref   EMPTY >
     <!ATTLIST service-ref
  -       type CDATA #REQUIRED
  -       version CDATA #IMPLIED >
  +       type CDATA #REQUIRED >
   
   <!--
   The service dependency describes a service that the component
  
  
  
  1.3       +2 -3      
jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/xdoclet/componentinfo.xdt
  
  Index: componentinfo.xdt
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/xdoclet/componentinfo.xdt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- componentinfo.xdt 7 Sep 2002 00:03:44 -0000       1.2
  +++ componentinfo.xdt 8 Sep 2002 03:35:21 -0000       1.3
  @@ -10,7 +10,6 @@
     <!-- section to describe Component -->
     <component>
       <XDtClass:ifHasClassTag tagName="avalon.component" 
paramName="name"><name><XDtClass:classTagValue tagName="avalon.component" 
paramName="name"/></name></XDtClass:ifHasClassTag>
  -    <version><XDtClass:classTagValue tagName="avalon.component" 
paramName="version" default="1.0"/></version>
       <attributes>
         <XDtAvalon:forAllClassAttributes tag="avalon.component" 
skip="interface,version,role">
         <attribute key="<XDtAvalon:getAttributeName/>" 
value="<XDtAvalon:getClassAttributeValue/>"/>
  @@ -38,7 +37,7 @@
     <services>
       <XDtAvalon:forAllServices>
       <service>
  -      <service-ref type="<XDtAvalon:getClassAttributeValueAsType 
name="interface"/>"<XDtClass:ifHasClassTag tagName="avalon.service" 
paramName="version"> version="<XDtClass:classTagValue tagName="avalon.service" 
paramName="version"/>"</XDtClass:ifHasClassTag>/>
  +      <service-ref type="<XDtAvalon:getClassAttributeValueAsType 
name="interface"/>"/>
         <attributes>
         <XDtAvalon:forAllClassAttributes skip="interface,version,role">
           <attribute key="<XDtAvalon:getAttributeName/>" 
value="<XDtAvalon:getClassAttributeValue/>"/>
  @@ -53,7 +52,7 @@
     <XDtAvalon:forAllDeps>
       <dependency<XDtMethod:ifHasMethodTag tagName="avalon.dependency" 
paramName="optional"> optional="<XDtMethod:methodTagValue 
tagName="avalon.dependency" paramName="optional"/>"</XDtMethod:ifHasMethodTag>>
         <XDtMethod:ifHasMethodTag tagName="avalon.dependency" 
paramName="role"><role><XDtMethod:methodTagValue tagName="avalon.dependency" 
paramName="role"/></role></XDtMethod:ifHasMethodTag>
  -      <service-ref type="<XDtAvalon:getMethodAttributeValueAsType 
name="interface"/>"<XDtMethod:ifHasMethodTag tagName="avalon.dependency" 
paramName="version"> version="<XDtMethod:methodTagValue 
tagName="avalon.dependency" paramName="version"/>"</XDtMethod:ifHasMethodTag>/>
  +      <service-ref type="<XDtAvalon:getMethodAttributeValueAsType 
name="interface"/>"/>
         <attributes>
         <XDtAvalon:forAllMethodAttributes 
skip="interface,version,role,optional">
           <attribute key="<XDtAvalon:getAttributeName/>" 
value="<XDtAvalon:getMethodAttributeValue/>"/>
  
  
  

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

Reply via email to