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

Class Extension

public final class Extension extends 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 CompatibilityCOMPATIBLE
Enum indicating that extension is compatible with other extension.
static NameEXTENSION_LIST
Manifest Attribute Name object for EXTENSION_LIST.
static NameEXTENSION_NAME
Manifest Attribute Name object for EXTENSION_NAME.
static NameIMPLEMENTATION_URL
Manifest Attribute Name object for IMPLEMENTATION_URL.
static NameIMPLEMENTATION_VENDOR
Manifest Attribute Name object for IMPLEMENTATION_VENDOR.
static NameIMPLEMENTATION_VENDOR_ID
Manifest Attribute Name object for IMPLEMENTATION_VENDOR_ID.
static NameIMPLEMENTATION_VERSION
Manifest Attribute Name object for IMPLEMENTATION_VERSION.
static CompatibilityINCOMPATIBLE
Enum indicating that extension is incompatible with other extension in ways other than other enums indicate).
static NameOPTIONAL_EXTENSION_LIST
Name object for Optional-Extension-List manifest attribute used for declaring optional dependencies on installed extensions.
static CompatibilityREQUIRE_IMPLEMENTATION_UPGRADE
Enum indicating that extension requires an upgrade of implementation to be compatible with other extension.
static CompatibilityREQUIRE_SPECIFICATION_UPGRADE
Enum indicating that extension requires an upgrade of specification to be compatible with other extension.
static CompatibilityREQUIRE_VENDOR_SWITCH
Enum indicating that extension requires a vendor switch to be compatible with other extension.
static NameSPECIFICATION_VENDOR
Manifest Attribute Name object for SPECIFICATION_VENDOR.
static NameSPECIFICATION_VERSION
Manifest Attribute Name object for SPECIFICATION_VERSION.
Constructor Summary
Extension(String extensionName, String specificationVersion, String specificationVendor, String implementationVersion, String implementationVendor, String implementationVendorId, String implementationURL)
The constructor to create Extension object.
Method Summary
static voidaddExtension(Extension extension, Attributes attributes)
Add Extension to the specified manifest Attributes.
static voidaddExtension(Extension extension, String prefix, Attributes attributes)
Add Extension to the specified manifest Attributes.
static Extension[]getAvailable(Manifest manifest)
Return an array of Extension objects representing optional packages that are available in the JAR file associated with the specified Manifest.
CompatibilitygetCompatibilityWith(Extension required)
Return a Compatibility enum indicating the relationship of this Extension with the specified Extension.
StringgetExtensionName()
Get the name of the extension.
StringgetImplementationURL()
Get the url of the extensions implementation.
StringgetImplementationVendor()
Get the vendor of the extensions implementation.
StringgetImplementationVendorID()
Get the vendorID of the extensions implementation.
DeweyDecimalgetImplementationVersion()
Get the version of the extensions implementation.
static Extension[]getOptions(Manifest manifest)
Return the set of Extension objects representing "Optional Packages" that the application declares they will use if present.
static Extension[]getRequired(Manifest manifest)
Return the set of Extension objects representing optional packages that are required by the application contained in the JAR file associated with the specified Manifest.
StringgetSpecificationVendor()
Get the vendor of the extensions specification.
DeweyDecimalgetSpecificationVersion()
Get the version of the extensions specification.
booleanisCompatibleWith(Extension required)
Return true if the specified Extension (which represents an optional package required by an application) is satisfied by this Extension (which represents an optional package that is already installed.
StringtoString()
Return a String representation of this object.

Field Detail

COMPATIBLE

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

EXTENSION_LIST

public static final Name EXTENSION_LIST
Manifest Attribute Name object for EXTENSION_LIST.

EXTENSION_NAME

public static final Name EXTENSION_NAME
Manifest Attribute Name object for EXTENSION_NAME.

IMPLEMENTATION_URL

public static final Name IMPLEMENTATION_URL
Manifest Attribute Name object for IMPLEMENTATION_URL.

IMPLEMENTATION_VENDOR

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

IMPLEMENTATION_VENDOR_ID

public static final Name IMPLEMENTATION_VENDOR_ID
Manifest Attribute Name object for IMPLEMENTATION_VENDOR_ID.

IMPLEMENTATION_VERSION

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

INCOMPATIBLE

public static final Compatibility INCOMPATIBLE
Enum indicating that extension is incompatible with other extension in ways other than other enums indicate). For example the other extension may have a different ID.

OPTIONAL_EXTENSION_LIST

public static final Name OPTIONAL_EXTENSION_LIST
Name object for Optional-Extension-List manifest attribute used for declaring optional dependencies on installed extensions. Note that the dependencies declared by this method are not required for the library to operate but if present will be used. It is NOT part of the official "Optional Package" specification.

See Also: Installed extension dependency

REQUIRE_IMPLEMENTATION_UPGRADE

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

REQUIRE_SPECIFICATION_UPGRADE

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

REQUIRE_VENDOR_SWITCH

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

SPECIFICATION_VENDOR

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

SPECIFICATION_VERSION

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

Constructor Detail

Extension

public Extension(String extensionName, String specificationVersion, String specificationVendor, String implementationVersion, String implementationVendor, String implementationVendorId, String implementationURL)
The constructor to create Extension object. Note that every component is allowed to be specified but only the extensionName is mandatory.

Parameters: extensionName the name of extension. specificationVersion the specification Version of extension. specificationVendor the specification Vendor of extension. implementationVersion the implementation Version of extension. implementationVendor the implementation Vendor of extension. implementationVendorId the implementation VendorId of extension. implementationURL the implementation URL of extension.

Method Detail

addExtension

public static void addExtension(Extension extension, Attributes attributes)
Add Extension to the specified manifest Attributes.

Parameters: attributes the attributes of manifest to add to extension the extension

addExtension

public static void addExtension(Extension extension, String prefix, Attributes attributes)
Add Extension to the specified manifest Attributes. Use the specified prefix so that dependencies can added with a prefix such as "java3d-" etc.

Parameters: attributes the attributes of manifest to add to extension the extension prefix the name to prefix to extension

getAvailable

public static Extension[] getAvailable(Manifest manifest)
Return an array of Extension objects representing optional packages that are available in the JAR file associated with the specified Manifest. If there are no such optional packages, a zero-length array is returned.

Parameters: manifest Manifest to be parsed

Returns: the "available" extensions in specified manifest

getCompatibilityWith

public Compatibility getCompatibilityWith(Extension required)
Return a Compatibility enum indicating the relationship of this Extension with the specified Extension.

Parameters: required Description of the required optional package

Returns: the enum indicating the compatibility (or lack thereof) of specifed extension

getExtensionName

public String getExtensionName()
Get the name of the extension.

Returns: the name of the extension

getImplementationURL

public String getImplementationURL()
Get the url of the extensions implementation.

Returns: the url of the extensions implementation.

getImplementationVendor

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

Returns: the vendor of the extensions implementation.

getImplementationVendorID

public String getImplementationVendorID()
Get the vendorID of the extensions implementation.

Returns: the vendorID of the extensions implementation.

getImplementationVersion

public DeweyDecimal getImplementationVersion()
Get the version of the extensions implementation.

Returns: the version of the extensions implementation.

getOptions

public static Extension[] getOptions(Manifest manifest)
Return the set of Extension objects representing "Optional Packages" that the application declares they will use if present. If there are no such optional packages, a zero-length list is returned.

Parameters: manifest Manifest to be parsed

Returns: the optional dependencies that are specified in manifest

getRequired

public static Extension[] getRequired(Manifest manifest)
Return the set of Extension objects representing optional packages that are required by the application contained in the JAR file associated with the specified Manifest. If there are no such optional packages, a zero-length list is returned.

Parameters: manifest Manifest to be parsed

Returns: the dependencies that are specified in manifes

getSpecificationVendor

public String getSpecificationVendor()
Get the vendor of the extensions specification.

Returns: the vendor of the extensions specification.

getSpecificationVersion

public DeweyDecimal getSpecificationVersion()
Get the version of the extensions specification.

Returns: the version of the extensions specification.

isCompatibleWith

public boolean isCompatibleWith(Extension required)
Return true if the specified Extension (which represents an optional package required by an application) is satisfied by this Extension (which represents an optional package that is already installed. Otherwise, return false.

Parameters: required Description of the required optional package

Returns: true if the specified extension is compatible with this extension

toString

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

Returns: string representation of object.