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/extension/src/java/org/apache/avalon/excalibur/extension Extension.java
Date Mon, 01 Apr 2002 08:58:11 GMT
donaldp     02/04/01 00:58:11

  Modified:    extension/src/java/org/apache/avalon/excalibur/extension
                        Extension.java
  Log:
  Moved constants to top of file and made toString() print out extension as it appears in
the manifest
  
  Revision  Changes    Path
  1.14      +95 -33    jakarta-avalon-excalibur/extension/src/java/org/apache/avalon/excalibur/extension/Extension.java
  
  Index: Extension.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/extension/src/java/org/apache/avalon/excalibur/extension/Extension.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Extension.java	27 Mar 2002 23:10:18 -0000	1.13
  +++ Extension.java	1 Apr 2002 08:58:11 -0000	1.14
  @@ -26,11 +26,59 @@
    *
    * @author <a href="mailto:craigmcc@apache.org">Craig R. McClanahan</a>
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.13 $ $Date: 2002/03/27 23:10:18 $
  + * @version $Revision: 1.14 $ $Date: 2002/04/01 08:58:11 $
    */
   public final class Extension
   {
       /**
  +     * Manifest Attribute Name object for EXTENSION_LIST.
  +     * @see Attributes.Name#EXTENSION_LIST
  +     */
  +    public static final Attributes.Name EXTENSION_LIST = Attributes.Name.EXTENSION_LIST;
  +
  +    /**
  +     * Manifest Attribute Name object for EXTENSION_NAME.
  +     * @see Attributes.Name#EXTENSION_NAME
  +     */
  +    public static final Attributes.Name EXTENSION_NAME = Attributes.Name.EXTENSION_NAME;
  +
  +    /**
  +     * Manifest Attribute Name object for SPECIFICATION_VERSION.
  +     * @see Attributes.Name#SPECIFICATION_VERSION
  +     */
  +    public static final Attributes.Name SPECIFICATION_VERSION = Attributes.Name.SPECIFICATION_VERSION;
  +
  +    /**
  +     * Manifest Attribute Name object for SPECIFICATION_VENDOR.
  +     * @see Attributes.Name#SPECIFICATION_VENDOR
  +     */
  +    public static final Attributes.Name SPECIFICATION_VENDOR = Attributes.Name.SPECIFICATION_VENDOR;
  +
  +    /**
  +     * Manifest Attribute Name object for IMPLEMENTATION_VERSION.
  +     * @see Attributes.Name#IMPLEMENTATION_VERSION
  +     */
  +    public static final Attributes.Name IMPLEMENTATION_VERSION = Attributes.Name.IMPLEMENTATION_VERSION;
  +
  +    /**
  +     * Manifest Attribute Name object for IMPLEMENTATION_VENDOR.
  +     * @see Attributes.Name#IMPLEMENTATION_VENDOR
  +     */
  +    public static final Attributes.Name IMPLEMENTATION_VENDOR = Attributes.Name.IMPLEMENTATION_VENDOR;
  +
  +    /**
  +     * Manifest Attribute Name object for IMPLEMENTATION_URL.
  +     * @see Attributes.Name#IMPLEMENTATION_URL
  +     */
  +    public static final Attributes.Name IMPLEMENTATION_URL = Attributes.Name.IMPLEMENTATION_URL;
  +
  +    /**
  +     * Manifest Attribute Name object for IMPLEMENTATION_VENDOR_ID.
  +     * @see Attributes.Name#IMPLEMENTATION_VENDOR_ID
  +     */
  +    public static final Attributes.Name IMPLEMENTATION_VENDOR_ID = Attributes.Name.IMPLEMENTATION_VENDOR_ID;
  +
  +    /**
        * Enum indicating that extension is compatible with other extension.
        */
       public static final Compatability COMPATIBLE =
  @@ -191,7 +239,7 @@
       private static void getRequired( final Attributes attributes,
                                        final ArrayList required )
       {
  -        final String names = attributes.getValue( Attributes.Name.EXTENSION_LIST );
  +        final String names = attributes.getValue( EXTENSION_LIST );
           if( null == names )
           {
               return;
  @@ -246,25 +294,25 @@
           //WARNING: We trim the values of all the attributes because
           //Some extension declarations are badly defined (ie have spaces
           //after version or vendorID)
  -        final String nameKey = prefix + Attributes.Name.EXTENSION_NAME;
  +        final String nameKey = prefix + EXTENSION_NAME;
           final String name = getTrimmedString( attributes.getValue( nameKey ) );
           if( null == name )
           {
               return null;
           }
   
  -        final String specVendorKey = prefix + Attributes.Name.SPECIFICATION_VENDOR;
  +        final String specVendorKey = prefix + SPECIFICATION_VENDOR;
           final String specVendor = getTrimmedString( attributes.getValue( specVendorKey
) );
  -        final String specVersionKey = prefix + Attributes.Name.SPECIFICATION_VERSION;
  +        final String specVersionKey = prefix + SPECIFICATION_VERSION;
           final String specVersion = getTrimmedString( attributes.getValue( specVersionKey
) );
   
  -        final String impVersionKey = prefix + Attributes.Name.IMPLEMENTATION_VERSION;
  +        final String impVersionKey = prefix + IMPLEMENTATION_VERSION;
           final String impVersion = getTrimmedString( attributes.getValue( impVersionKey
) );
  -        final String impVendorKey = prefix + Attributes.Name.IMPLEMENTATION_VENDOR;
  +        final String impVendorKey = prefix + IMPLEMENTATION_VENDOR;
           final String impVendor = getTrimmedString( attributes.getValue( impVendorKey )
);
  -        final String impVendorIDKey = prefix + Attributes.Name.IMPLEMENTATION_VENDOR_ID;
  +        final String impVendorIDKey = prefix + IMPLEMENTATION_VENDOR_ID;
           final String impVendorId = getTrimmedString( attributes.getValue( impVendorIDKey
) );
  -        final String impURLKey = prefix + Attributes.Name.IMPLEMENTATION_URL;
  +        final String impURLKey = prefix + IMPLEMENTATION_URL;
           final String impURL = getTrimmedString( attributes.getValue( impURLKey ) );
   
           return new Extension( name, specVersion, specVendor, impVersion,
  @@ -319,7 +367,7 @@
               {
                   m_specificationVersion = new DeweyDecimal( specificationVersion );
               }
  -            catch( NumberFormatException nfe )
  +            catch( final NumberFormatException nfe )
               {
                   final String error = "Bad specification version format '" + specificationVersion
+
                       "' in '" + extensionName + "'. (Reason: " + nfe + ")";
  @@ -337,7 +385,7 @@
               {
                   m_implementationVersion = new DeweyDecimal( implementationVersion );
               }
  -            catch( NumberFormatException nfe )
  +            catch( final NumberFormatException nfe )
               {
                   final String error = "Bad implementation version format '" + implementationVersion
+
                       "' in '" + extensionName + "'. (Reason: " + nfe + ")";
  @@ -496,46 +544,61 @@
        */
       public String toString()
       {
  -        final StringBuffer sb = new StringBuffer( "Extension[" );
  -        sb.append( m_extensionName );
  +        final String lineSeparator = System.getProperty( "line.separator" );
  +        final String brace = ": ";
   
  -        if( null != m_implementationURL )
  -        {
  -            sb.append( ", implementationURL=" );
  -            sb.append( m_implementationURL );
  -        }
  +        final StringBuffer sb = new StringBuffer( EXTENSION_NAME.toString() );
  +        sb.append( brace );
  +        sb.append( m_extensionName );
  +        sb.append( lineSeparator );
   
  -        if( null != m_implementationVendor )
  +        if( null != m_specificationVersion )
           {
  -            sb.append( ", implementationVendor=" );
  -            sb.append( m_implementationVendor );
  +            sb.append( SPECIFICATION_VERSION );
  +            sb.append( brace );
  +            sb.append( m_specificationVersion );
  +            sb.append( lineSeparator );
           }
   
  -        if( null != m_implementationVendorId )
  +        if( null != m_specificationVendor )
           {
  -            sb.append( ", implementationVendorId=" );
  -            sb.append( m_implementationVendorId );
  +            sb.append( SPECIFICATION_VENDOR );
  +            sb.append( brace );
  +            sb.append( m_specificationVendor );
  +            sb.append( lineSeparator );
           }
   
           if( null != m_implementationVersion )
           {
  -            sb.append( ", implementationVersion=" );
  +            sb.append( IMPLEMENTATION_VERSION );
  +            sb.append( brace );
               sb.append( m_implementationVersion );
  +            sb.append( lineSeparator );
           }
   
  -        if( null != m_specificationVendor )
  +        if( null != m_implementationVendorId )
           {
  -            sb.append( ", specificationVendor=" );
  -            sb.append( m_specificationVendor );
  +            sb.append( IMPLEMENTATION_VENDOR_ID );
  +            sb.append( brace );
  +            sb.append( m_implementationVendorId );
  +            sb.append( lineSeparator );
           }
   
  -        if( null != m_specificationVersion )
  +        if( null != m_implementationVendor )
           {
  -            sb.append( ", specificationVersion=" );
  -            sb.append( m_specificationVersion );
  +            sb.append( IMPLEMENTATION_VENDOR );
  +            sb.append( brace );
  +            sb.append( m_implementationVendor );
  +            sb.append( lineSeparator );
           }
   
  -        sb.append( "]" );
  +        if( null != m_implementationURL )
  +        {
  +            sb.append( IMPLEMENTATION_URL );
  +            sb.append( brace );
  +            sb.append( m_implementationURL );
  +            sb.append( lineSeparator );
  +        }
   
           return sb.toString();
       }
  @@ -551,5 +614,4 @@
       {
           return first.isGreaterThanOrEqual( second );
       }
  -
   }
  
  
  

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