org.apache.tools.ant.taskdefs.optional.extension

Class Specification


public final class Specification
extends java.lang.Object

Utility class that represents either an available "Optional Package" (formerly known as "Standard Extension") as described in the manifest of a JAR file, or the requirement for such an optional package.

For more information about optional packages, see the document Optional Package Versioning in the documentation bundle for your Java2 Standard Edition package, in file guide/extensions/versioning.html.

Field Summary

static Compatibility
COMPATIBLE
Enum indicating that extension is compatible with other Package Specification.
static Attributes.Name
IMPLEMENTATION_TITLE
Manifest Attribute Name object for IMPLEMENTATION_TITLE.
static Attributes.Name
IMPLEMENTATION_VENDOR
Manifest Attribute Name object for IMPLEMENTATION_VENDOR.
static Attributes.Name
IMPLEMENTATION_VERSION
Manifest Attribute Name object for IMPLEMENTATION_VERSION.
static Compatibility
INCOMPATIBLE
This enum indicates that an extension is incompatible with other Package Specification in ways other than other enums indicate.
static Compatibility
REQUIRE_IMPLEMENTATION_CHANGE
Enum indicating that extension requires an upgrade of implementation to be compatible with other Package Specification.
static Compatibility
REQUIRE_SPECIFICATION_UPGRADE
Enum indicating that extension requires an upgrade of specification to be compatible with other Package Specification.
static Compatibility
REQUIRE_VENDOR_SWITCH
Enum indicating that extension requires a vendor switch to be compatible with other Package Specification.
static Attributes.Name
SPECIFICATION_TITLE
Manifest Attribute Name object for SPECIFICATION_TITLE.
static Attributes.Name
SPECIFICATION_VENDOR
Manifest Attribute Name object for SPECIFICATION_VENDOR.
static Attributes.Name
SPECIFICATION_VERSION
Manifest Attribute Name object for SPECIFICATION_VERSION.

Constructor Summary

Specification(String specificationTitle, String specificationVersion, String specificationVendor, String implementationTitle, String implementationVersion, String implementationVendor)
The constructor to create Package Specification object.
Specification(String specificationTitle, String specificationVersion, String specificationVendor, String implementationTitle, String implementationVersion, String implementationVendor, String[] sections)
The constructor to create Package Specification object.

Method Summary

Compatibility
getCompatibilityWith(Specification other)
Return a Compatibility enum indicating the relationship of this Package Specification with the specified Extension.
String
getImplementationTitle()
Get the title of the specification.
String
getImplementationVendor()
Get the vendor of the extensions implementation.
String
getImplementationVersion()
Get the version of the implementation.
String[]
getSections()
Return an array containing sections to which specification applies or null if relevent to no sections.
String
getSpecificationTitle()
Get the title of the specification.
String
getSpecificationVendor()
Get the vendor of the specification.
DeweyDecimal
getSpecificationVersion()
Get the version of the specification.
static Specification[]
getSpecifications(Manifest manifest)
Return an array of Package Specification objects.
boolean
isCompatibleWith(Specification other)
Return true if the specified package is satisfied by this Specification.
String
toString()
Return a String representation of this object.

Field Details

COMPATIBLE

public static final Compatibility COMPATIBLE
Enum indicating that extension is compatible with other Package Specification.

IMPLEMENTATION_TITLE

public static final Attributes.Name IMPLEMENTATION_TITLE
Manifest Attribute Name object for IMPLEMENTATION_TITLE.

IMPLEMENTATION_VENDOR

public static final Attributes.Name IMPLEMENTATION_VENDOR
Manifest Attribute Name object for IMPLEMENTATION_VENDOR.

IMPLEMENTATION_VERSION

public static final Attributes.Name IMPLEMENTATION_VERSION
Manifest Attribute Name object for IMPLEMENTATION_VERSION.

INCOMPATIBLE

public static final Compatibility INCOMPATIBLE
This enum indicates that an extension is incompatible with other Package Specification in ways other than other enums indicate. For example, the other Package Specification may have a different ID.

REQUIRE_IMPLEMENTATION_CHANGE

public static final Compatibility REQUIRE_IMPLEMENTATION_CHANGE
Enum indicating that extension requires an upgrade of implementation to be compatible with other Package Specification.

REQUIRE_SPECIFICATION_UPGRADE

public static final Compatibility REQUIRE_SPECIFICATION_UPGRADE
Enum indicating that extension requires an upgrade of specification to be compatible with other Package Specification.

REQUIRE_VENDOR_SWITCH

public static final Compatibility REQUIRE_VENDOR_SWITCH
Enum indicating that extension requires a vendor switch to be compatible with other Package Specification.

SPECIFICATION_TITLE

public static final Attributes.Name SPECIFICATION_TITLE
Manifest Attribute Name object for SPECIFICATION_TITLE.

SPECIFICATION_VENDOR

public static final Attributes.Name SPECIFICATION_VENDOR
Manifest Attribute Name object for SPECIFICATION_VENDOR.

SPECIFICATION_VERSION

public static final Attributes.Name SPECIFICATION_VERSION
Manifest Attribute Name object for SPECIFICATION_VERSION.

Constructor Details

Specification

public Specification(String specificationTitle,
                     String specificationVersion,
                     String specificationVendor,
                     String implementationTitle,
                     String implementationVersion,
                     String implementationVendor)
The constructor to create Package Specification object. Note that every component is allowed to be specified but only the specificationTitle is mandatory.
Parameters:
specificationTitle - the name of specification.
specificationVersion - the specification Version.
specificationVendor - the specification Vendor.
implementationTitle - the title of implementation.
implementationVersion - the implementation Version.
implementationVendor - the implementation Vendor.

Specification

public Specification(String specificationTitle,
                     String specificationVersion,
                     String specificationVendor,
                     String implementationTitle,
                     String implementationVersion,
                     String implementationVendor,
                     String[] sections)
The constructor to create Package Specification object. Note that every component is allowed to be specified but only the specificationTitle is mandatory.
Parameters:
specificationTitle - the name of specification.
specificationVersion - the specification Version.
specificationVendor - the specification Vendor.
implementationTitle - the title of implementation.
implementationVersion - the implementation Version.
implementationVendor - the implementation Vendor.
sections - the sections/packages that Specification applies to.

Method Details

getCompatibilityWith

public Compatibility getCompatibilityWith(Specification other)
Return a Compatibility enum indicating the relationship of this Package Specification with the specified Extension.
Parameters:
other - the other specification
Returns:
the enum indicating the compatibility (or lack thereof) of specifed Package Specification

getImplementationTitle

public String getImplementationTitle()
Get the title of the specification.
Returns:
the title of the specification.

getImplementationVendor

public String getImplementationVendor()
Get the vendor of the extensions implementation.
Returns:
the vendor of the extensions implementation.

getImplementationVersion

public String getImplementationVersion()
Get the version of the implementation.
Returns:
the version of the implementation.

getSections

public String[] getSections()
Return an array containing sections to which specification applies or null if relevent to no sections.
Returns:
an array containing sections to which specification applies or null if relevent to no sections.

getSpecificationTitle

public String getSpecificationTitle()
Get the title of the specification.
Returns:
the title of speciication

getSpecificationVendor

public String getSpecificationVendor()
Get the vendor of the specification.
Returns:
the vendor of the specification.

getSpecificationVersion

public DeweyDecimal getSpecificationVersion()
Get the version of the specification.
Returns:
the version of the specification.

getSpecifications

public static Specification[] getSpecifications(Manifest manifest)
            throws ParseException
Return an array of Package Specification objects. If there are no such optional packages, a zero-length array is returned.
Parameters:
manifest - Manifest to be parsed
Returns:
the Package Specifications extensions in specified manifest

isCompatibleWith

public boolean isCompatibleWith(Specification other)
Return true if the specified package is satisfied by this Specification. Otherwise, return false.
Parameters:
other - the specification
Returns:
true if the specification is compatible with this specification

toString

public String toString()
Return a String representation of this object.
Returns:
string representation of object.

Copyright B) 2000-2008 Apache Software Foundation. All Rights Reserved.