org.apache.felix.deploymentadmin

## Class AbstractDeploymentPackage

- java.lang.Object
- - org.apache.felix.deploymentadmin.AbstractDeploymentPackage

All Implemented Interfaces:
  org.osgi.framework.Constants, org.osgi.service.deploymentadmin.DeploymentPackage

Direct Known Subclasses:
  FileDeploymentPackage, StreamDeploymentPackage

    public abstract class AbstractDeploymentPackage
    extends Object
    implements org.osgi.service.deploymentadmin.DeploymentPackage, Constants

Base class for various types of deployment packages. Indifferent in regard to how the deployment package data is obtained, this should be handled by extending classes.

### Field Summary

Fields
`protected static AbstractDeploymentPackage` `EMPTY_PACKAGE`

### Fields inherited from interface org.osgi.service.deploymentadmin.DeploymentPackage

`EVENT_DEPLOYMENTPACKAGE_CURRENTVERSION, EVENT_DEPLOYMENTPACKAGE_NAME, EVENT_DEPLOYMENTPACKAGE_NEXTVERSION, EVENT_DEPLOYMENTPACKAGE_READABLENAME`

### Fields inherited from interface org.apache.felix.deploymentadmin.Constants

`BUNDLE_LOCATION_PREFIX, BUNDLE_SYMBOLICNAME, BUNDLE_VERSION, CODE_BAD_HEADER, CODE_BUNDLE_NAME_ERROR, CODE_BUNDLE_SHARING_VIOLATION, CODE_CANCELLED, CODE_COMMIT_ERROR, CODE_FOREIGN_CUSTOMIZER, CODE_MISSING_BUNDLE, CODE_MISSING_FIXPACK_TARGET, CODE_MISSING_HEADER, CODE_MISSING_RESOURCE, CODE_NOT_A_JAR, CODE_ORDER_ERROR, CODE_OTHER_ERROR, CODE_PROCESSOR_NOT_FOUND, CODE_RESOURCE_SHARING_VIOLATION, CODE_SIGNING_ERROR, CODE_TIMEOUT, DEPLOYMENTPACKAGE_CUSTOMIZER, DEPLOYMENTPACKAGE_FIXPACK, DEPLOYMENTPACKAGE_ICON, DEPLOYMENTPACKAGE_MISSING, DEPLOYMENTPACKAGE_NAME, DEPLOYMENTPACKAGE_SYMBOLICMAME, DEPLOYMENTPACKAGE_VERSION, EVENTPROPERTY_DEPLOYMENTPACKAGE_CURRENTVERSION, EVENTPROPERTY_DEPLOYMENTPACKAGE_NAME, EVENTPROPERTY_DEPLOYMENTPACKAGE_NEXTVERSION, EVENTPROPERTY_DEPLOYMENTPACKAGE_READABLENAME, EVENTPROPERTY_SUCCESSFUL, EVENTTOPIC_COMPLETE, EVENTTOPIC_INSTALL, EVENTTOPIC_UNINSTALL, RESOURCE_PROCESSOR, SERVICE_PID`

### Fields inherited from interface org.osgi.framework.Constants

`ACTIVATION_LAZY, BUNDLE_ACTIVATIONPOLICY, BUNDLE_ACTIVATOR, BUNDLE_CATEGORY, BUNDLE_CLASSPATH, BUNDLE_CONTACTADDRESS, BUNDLE_COPYRIGHT, BUNDLE_DESCRIPTION, BUNDLE_DOCURL, BUNDLE_LOCALIZATION, BUNDLE_LOCALIZATION_DEFAULT_BASENAME, BUNDLE_MANIFESTVERSION, BUNDLE_NAME, BUNDLE_NATIVECODE, BUNDLE_NATIVECODE_LANGUAGE, BUNDLE_NATIVECODE_OSNAME, BUNDLE_NATIVECODE_OSVERSION, BUNDLE_NATIVECODE_PROCESSOR, BUNDLE_REQUIREDEXECUTIONENVIRONMENT, BUNDLE_SYMBOLICNAME_ATTRIBUTE, BUNDLE_UPDATELOCATION, BUNDLE_VENDOR, BUNDLE_VERSION_ATTRIBUTE, DYNAMICIMPORT_PACKAGE, EXCLUDE_DIRECTIVE, EXPORT_PACKAGE, EXPORT_SERVICE, EXTENSION_BOOTCLASSPATH, EXTENSION_DIRECTIVE, EXTENSION_FRAMEWORK, FRAGMENT_ATTACHMENT_ALWAYS, FRAGMENT_ATTACHMENT_DIRECTIVE, FRAGMENT_ATTACHMENT_NEVER, FRAGMENT_ATTACHMENT_RESOLVETIME, FRAGMENT_HOST, FRAMEWORK_BEGINNING_STARTLEVEL, FRAMEWORK_BOOTDELEGATION, FRAMEWORK_BUNDLE_PARENT, FRAMEWORK_BUNDLE_PARENT_APP, FRAMEWORK_BUNDLE_PARENT_BOOT, FRAMEWORK_BUNDLE_PARENT_EXT, FRAMEWORK_BUNDLE_PARENT_FRAMEWORK, FRAMEWORK_EXECPERMISSION, FRAMEWORK_EXECUTIONENVIRONMENT, FRAMEWORK_LANGUAGE, FRAMEWORK_LIBRARY_EXTENSIONS, FRAMEWORK_OS_NAME, FRAMEWORK_OS_VERSION, FRAMEWORK_PROCESSOR, FRAMEWORK_SECURITY, FRAMEWORK_SECURITY_OSGI, FRAMEWORK_STORAGE, FRAMEWORK_STORAGE_CLEAN, FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT, FRAMEWORK_SYSTEMPACKAGES, FRAMEWORK_SYSTEMPACKAGES_EXTRA, FRAMEWORK_TRUST_REPOSITORIES, FRAMEWORK_VENDOR, FRAMEWORK_VERSION, FRAMEWORK_WINDOWSYSTEM, IMPORT_PACKAGE, IMPORT_SERVICE, INCLUDE_DIRECTIVE, MANDATORY_DIRECTIVE, OBJECTCLASS, PACKAGE_SPECIFICATION_VERSION, REQUIRE_BUNDLE, RESOLUTION_DIRECTIVE, RESOLUTION_MANDATORY, RESOLUTION_OPTIONAL, SELECTION_FILTER_ATTRIBUTE, SERVICE_DESCRIPTION, SERVICE_ID, SERVICE_RANKING, SERVICE_VENDOR, SINGLETON_DIRECTIVE, SUPPORTS_BOOTCLASSPATH_EXTENSION, SUPPORTS_FRAMEWORK_EXTENSION, SUPPORTS_FRAMEWORK_FRAGMENT, SUPPORTS_FRAMEWORK_REQUIREBUNDLE, SYSTEM_BUNDLE_LOCATION, SYSTEM_BUNDLE_SYMBOLICNAME, USES_DIRECTIVE, VERSION_ATTRIBUTE, VISIBILITY_DIRECTIVE, VISIBILITY_PRIVATE, VISIBILITY_REEXPORT`

### Constructor Summary

Constructors
Constructor and Description
`AbstractDeploymentPackage(Manifest manifest, org.osgi.framework.BundleContext bundleContext, DeploymentAdminImpl deploymentAdmin)` Creates an instance of this class.

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected AbstractInfo` `getAbstractInfoByPath(String path)` Determines the info about either a bundle or processed resource based on it's path/resource-id.
`org.osgi.framework.Bundle` `getBundle(String symbolicName)`
`BundleInfoImpl` `getBundleInfoByName(String symbolicName)` Determines the info about a bundle resource based on the bundle symbolic name.
`BundleInfoImpl` `getBundleInfoByPath(String path)` Determines the info about a bundle based on it's path/resource-id.
`BundleInfoImpl[]` `getBundleInfoImpls()` Returns the bundles of this deployment package as an array of `BundleInfoImpl` objects.
`org.osgi.service.deploymentadmin.BundleInfo[]` `getBundleInfos()`
`abstract InputStream` `getBundleStream(String symbolicName)` Determines the data stream of a bundle resource based on the bundle symbolic name
`abstract InputStream` `getCurrentEntryStream()` Determines the data stream to the current entry of this deployment package, use this together with the `getNextEntry` method.
`String` `getDisplayName()`
`String` `getHeader(String header)`
`URL` `getIcon()`
`String` `getName()`
`abstract AbstractInfo` `getNextEntry()` Determines the next resource entry in this deployment package based on the order in which the resources appeared when the package was originally received.
`abstract BundleInfoImpl[]` `getOrderedBundleInfos()` Determines the bundles of this deployment package in the order in which they were originally received.
`abstract ResourceInfoImpl[]` `getOrderedResourceInfos()` Determines the resources of this deployment package in the order in which they were originally received.
`String` `getResourceHeader(String resource, String header)`
`ResourceInfoImpl` `getResourceInfoByPath(String path)` Determines the info about a processed resource based on it's path/resource-id.
`ResourceInfoImpl[]` `getResourceInfos()` Returns the processed resources of this deployment package as an array of `ResourceInfoImpl` objects.
`org.osgi.framework.ServiceReference` `getResourceProcessor(String resource)`
`String[]` `getResources()`
`org.osgi.framework.Version` `getVersion()`
`VersionRange` `getVersionRange()` If this deployment package is a fix package this method determines the version range this deployment package can be applied to.
`boolean` `isFixPackage()` Determines whether this deployment package is a fix package.
`protected boolean` `isMetaInfFile(String name)` Returns whether the given name (which is expected to be the name of a JarEntry) is a signature file or the JAR index file.
`boolean` `isNew()`
`boolean` `isStale()`
`void` `setStale(boolean isStale)`
`void` `uninstall()`
`boolean` `uninstallForced()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.osgi.service.deploymentadmin.DeploymentPackage

`equals, hashCode`

### Field Detail

#### EMPTY_PACKAGE

    protected static final AbstractDeploymentPackage EMPTY_PACKAGE

### Constructor Detail

#### AbstractDeploymentPackage

    public AbstractDeploymentPackage(Manifest manifest,
                                     org.osgi.framework.BundleContext bundleContext,
                                     DeploymentAdminImpl deploymentAdmin)
                              throws org.osgi.service.deploymentadmin.DeploymentException

Creates an instance of this class.

Parameters:
  `manifest` - The manifest of the deployment package.
  `bundleContext` - The bundle context.
Throws:
  `org.osgi.service.deploymentadmin.DeploymentException` - Thrown if the specified manifest does not describe a valid deployment package.

### Method Detail

#### getBundle

    public org.osgi.framework.Bundle getBundle(String symbolicName)

Specified by:
  `getBundle` in interface `org.osgi.service.deploymentadmin.DeploymentPackage`

#### getBundleInfoByName

    public BundleInfoImpl getBundleInfoByName(String symbolicName)

Determines the info about a bundle resource based on the bundle symbolic name.

Parameters:
  `symbolicName` - String containing a bundle symbolic name
Returns:
  `BundleInfoImpl` for the bundle identified by the specified symbolic name or null if the symbolic name is unknown

#### getBundleInfoByPath

    public BundleInfoImpl getBundleInfoByPath(String path)

Determines the info about a bundle based on it's path/resource-id.

Parameters:
  `path` - String containing a bundle path
Returns:
  `BundleInfoImpl` for the bundle resource identified by the specified path or null if the path is unknown or does not describe a bundle resource

#### getBundleInfoImpls

    public BundleInfoImpl[] getBundleInfoImpls()

Returns the bundles of this deployment package as an array of `BundleInfoImpl` objects.

Returns:
  Array containing `BundleInfoImpl` objects for each bundle this deployment package.

#### getBundleInfos

    public org.osgi.service.deploymentadmin.BundleInfo[] getBundleInfos()

Specified by:
  `getBundleInfos` in interface `org.osgi.service.deploymentadmin.DeploymentPackage`

#### getBundleStream

    public abstract InputStream getBundleStream(String symbolicName)
                                         throws IOException

Determines the data stream of a bundle resource based on the bundle symbolic name

Parameters:
  `symbolicName` - Bundle symbolic name
Returns:
  Stream to the bundle identified by the specified symbolic name or null if no such bundle exists in this deployment package.
Throws:
  `IOException` - If the bundle can not be properly offered as an inputstream

#### getCurrentEntryStream

    public abstract InputStream getCurrentEntryStream()

Determines the data stream to the current entry of this deployment package, use this together with the `getNextEntry` method.

Returns:
  Stream to the current resource in the deployment package (as determined by the order in which the deployment package was received originally) or null if there is no entry

#### getDisplayName

    public String getDisplayName()

Specified by:
  `getDisplayName` in interface `org.osgi.service.deploymentadmin.DeploymentPackage`

#### getHeader

    public String getHeader(String header)

Specified by:
  `getHeader` in interface `org.osgi.service.deploymentadmin.DeploymentPackage`

#### getIcon

    public URL getIcon()

Specified by:
  `getIcon` in interface `org.osgi.service.deploymentadmin.DeploymentPackage`

#### getName

    public String getName()

Specified by:
  `getName` in interface `org.osgi.service.deploymentadmin.DeploymentPackage`

#### getNextEntry

    public abstract AbstractInfo getNextEntry()
                                       throws IOException

Determines the next resource entry in this deployment package based on the order in which the resources appeared when the package was originally received.

Returns:
  `AbstractInfo` describing the next resource entry (as determined by the order in which the deployment package was received originally) or null if there is no next entry
Throws:
  `IOException` - if the next entry can not be properly determined

#### getOrderedBundleInfos

    public abstract BundleInfoImpl[] getOrderedBundleInfos()

Determines the bundles of this deployment package in the order in which they were originally received.

Returns:
  Array containing `BundleInfoImpl` objects of the bundles in this deployment package, ordered in the way they appeared when the deployment package was first received.

#### getOrderedResourceInfos

    public abstract ResourceInfoImpl[] getOrderedResourceInfos()

Determines the resources of this deployment package in the order in which they were originally received.

Returns:
  Array containing `ResourceInfoImpl` objects of all processed resources in this deployment package, ordered in the way they appeared when the deployment package was first received

#### getResourceHeader

    public String getResourceHeader(String resource,
                                    String header)

Specified by:
  `getResourceHeader` in interface `org.osgi.service.deploymentadmin.DeploymentPackage`

#### getResourceInfoByPath

    public ResourceInfoImpl getResourceInfoByPath(String path)

Determines the info about a processed resource based on it's path/resource-id.

Parameters:
  `path` - String containing a (processed) resource path
Returns:
  `ResourceInfoImpl` for the resource identified by the specified path or null if the path is unknown or does not describe a processed resource

#### getResourceInfos

    public ResourceInfoImpl[] getResourceInfos()

Returns the processed resources of this deployment package as an array of `ResourceInfoImpl` objects.

Returns:
  Array containing `ResourceInfoImpl` objects for each processed resource of this deployment package.

#### getResourceProcessor

    public org.osgi.framework.ServiceReference getResourceProcessor(String resource)

Specified by:
  `getResourceProcessor` in interface `org.osgi.service.deploymentadmin.DeploymentPackage`

#### getResources

    public String[] getResources()

Specified by:
  `getResources` in interface `org.osgi.service.deploymentadmin.DeploymentPackage`

#### getVersion

    public org.osgi.framework.Version getVersion()

Specified by:
  `getVersion` in interface `org.osgi.service.deploymentadmin.DeploymentPackage`

#### getVersionRange

    public VersionRange getVersionRange()

If this deployment package is a fix package this method determines the version range this deployment package can be applied to.

Returns:
  `VersionRange` the fix package can be applied to or `null` if it is not a fix package.

#### isFixPackage

    public boolean isFixPackage()

Determines whether this deployment package is a fix package.

Returns:
  True if this deployment package is a fix package, false otherwise.

#### isNew

    public boolean isNew()

Returns:
  `true` if this package is actually an empty package used for installing new deployment packages, `false` otherwise.

#### isStale

    public boolean isStale()

Specified by:
  `isStale` in interface `org.osgi.service.deploymentadmin.DeploymentPackage`

#### setStale

    public void setStale(boolean isStale)

#### uninstall

    public void uninstall()
                   throws org.osgi.service.deploymentadmin.DeploymentException

Specified by:
  `uninstall` in interface `org.osgi.service.deploymentadmin.DeploymentPackage`
Throws:
  `org.osgi.service.deploymentadmin.DeploymentException`

#### uninstallForced

    public boolean uninstallForced()
                            throws org.osgi.service.deploymentadmin.DeploymentException

Specified by:
  `uninstallForced` in interface `org.osgi.service.deploymentadmin.DeploymentPackage`
Throws:
  `org.osgi.service.deploymentadmin.DeploymentException`

#### getAbstractInfoByPath

    protected AbstractInfo getAbstractInfoByPath(String path)

Determines the info about either a bundle or processed resource based on it's path/resource-id.

Parameters:
  `path` - String containing a resource path (either bundle or processed resource)
Returns:
  `AbstractInfoImpl` for the resource identified by the specified path or null if the path is unknown

#### isMetaInfFile

    protected boolean isMetaInfFile(String name)

Returns whether the given name (which is expected to be the name of a JarEntry) is a signature file or the JAR index file.

Parameters:
  `name` - the name of the JAR entry to test, cannot be `null`.
Returns:
  `true` if the given JAR entry name is a signature file or JAR index file, `false` otherwise.