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 Thu, 18 Apr 2002 10:46:58 GMT
donaldp     02/04/18 03:46:58

  Modified:    extension/src/java/org/apache/avalon/excalibur/extension
                        Extension.java
  Log:
  Add cpability of scanning multiple manifests for available/required extensions.
  
  Revision  Changes    Path
  1.19      +67 -10    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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Extension.java	6 Apr 2002 04:49:49 -0000	1.18
  +++ Extension.java	18 Apr 2002 10:46:58 -0000	1.19
  @@ -26,7 +26,7 @@
    *
    * @author <a href="mailto:craigmcc@apache.org">Craig R. McClanahan</a>
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.18 $ $Date: 2002/04/06 04:49:49 $
  + * @version $Revision: 1.19 $ $Date: 2002/04/18 10:46:58 $
    */
   public final class Extension
   {
  @@ -46,49 +46,57 @@
        * @see <a href="http://java.sun.com/j2se/1.3/docs/guide/extensions/spec.html#dependnecy">
        *      Installed extension dependency</a>
        */
  -    public static final Attributes.Name OPTIONAL_EXTENSION_LIST = new Attributes.Name(
"Optional-Extension-List" );
  +    public static final Attributes.Name OPTIONAL_EXTENSION_LIST = 
  +	new Attributes.Name( "Optional-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;
  +    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;
  +    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;
  +    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;
  +    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;
  +    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;
  +    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;
  +    public static final Attributes.Name IMPLEMENTATION_VENDOR_ID = 
  +	Attributes.Name.IMPLEMENTATION_VENDOR_ID;
   
       /**
        * Enum indicating that extension is compatible with other extension.
  @@ -208,7 +216,32 @@
               }
           }
   
  -        return (Extension[])results.toArray( new Extension[ 0 ] );
  +        return (Extension[])results.toArray( new Extension[ results.size() ] );
  +    }
  +
  +
  +    /**
  +     * Retrieve the set of <code>Extension</code> objects that are available
  +     * by the specified Manifest objects. If there are no such optional 
  +     * packages, a zero-length list is returned.
  +     *
  +     * @param manifests the manifests to scan
  +     * @return the extensions
  +     */
  +    public static Extension[] getAvailable( final Manifest[] manifests )
  +    {
  +        final ArrayList set = new ArrayList();
  +
  +        for( int i = 0; i < manifests.length; i++ )
  +        {
  +            final Extension[] extensions = getAvailable( manifests[ i ] );
  +            for( int j = 0; j < extensions.length; j++ )
  +            {
  +                set.add( extensions[ j ] );
  +            }
  +        }
  +
  +        return (Extension[])set.toArray( new Extension[ set.size() ] );
       }
   
       /**
  @@ -223,6 +256,30 @@
       public static Extension[] getRequired( final Manifest manifest )
       {
           return getListed( manifest, EXTENSION_LIST );
  +    }
  +
  +    /**
  +     * Retrieve the set of <code>Extension</code> objects that are required
  +     * by the specified Manifest objects. If there are no such optional 
  +     * packages, a zero-length list is returned.
  +     *
  +     * @param manifests the manifests to scan
  +     * @return the extensions
  +     */
  +    public static Extension[] getRequired( final Manifest[] manifests )
  +    {
  +        final ArrayList set = new ArrayList();
  +
  +        for( int i = 0; i < manifests.length; i++ )
  +        {
  +            final Extension[] extensions = getRequired( manifests[ i ] );
  +            for( int j = 0; j < extensions.length; j++ )
  +            {
  +                set.add( extensions[ j ] );
  +            }
  +        }
  +
  +        return (Extension[])set.toArray( new Extension[ set.size() ] );
       }
   
       /**
  
  
  

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