Top Description Fields Methods
org.osgi.framework.wiring

public Interface BundleRevision

extends BundleReference, Resource
Annotations
@ProviderType
Imports
java.util.List, org.osgi.annotation.versioning.ProviderType, org.osgi.framework.Bundle, .BundleReference, .Constants, .Version, org.osgi.framework.namespace.BundleNamespace, .HostNamespace, .PackageNamespace, org.osgi.resource.Capability, .Requirement, .Resource

Bundle Revision. When a bundle is installed and each time a bundle is updated, a new bundle revision of the bundle is created. Since a bundle update can change the entries in a bundle, different bundle wirings for the same bundle can be associated with different bundle revisions.

For a bundle that has not been uninstalled, the most recent bundle revision is defined to be the current bundle revision. A bundle in the UNINSTALLED state does not have a current revision. The current bundle revision for a bundle can be obtained by calling bundle.adapt (BundleRevision.class). Since a bundle in the UNINSTALLED state does not have a current revision, adapting such a bundle returns null.

The framework defines namespaces for package, bundle and host capabilities and requirements. These namespaces are defined only to express wiring information by the framework. They must not be used in Provide-Capability and Require-Capability manifest headers.

Author
$Id: 1f318afdf8f5fe6097a841b49b67bf67d8c924f2 $

Field Summary

Modifier and TypeField and Description
public static final String
BUNDLE_NAMESPACE

Namespace for bundle capabilities and requirements.

public static final String
HOST_NAMESPACE

Namespace for host capabilities and requirements.

public static final String
PACKAGE_NAMESPACE

Namespace for package capabilities and requirements.

public static final int
TYPE_FRAGMENT

Bundle revision type indicating the bundle revision is a fragment.

Method Summary

Modifier and TypeMethod and Description
public List<Capability>

Returns:

An unmodifiable list containing the declared Capabilitys from the specified namespace. The returned list will be empty if this resource declares no capabilities in the specified namespace.
getCapabilities
(String
The namespace of the declared capabilities to return or null to return the declared capabilities from all namespaces.
namespace
)

Redeclares org.osgi.resource.Resource.getCapabilities.

Returns the capabilities declared by this resource.

public List<BundleCapability>

Returns:

An unmodifiable list containing the declared BundleCapabilitys from the specified namespace. The returned list will be empty if this bundle revision declares no capabilities in the specified namespace. The list contains the declared capabilities in the order they are specified in the manifest.
getDeclaredCapabilities
(String
The namespace of the declared capabilities to return or null to return the declared capabilities from all namespaces.
namespace
)

Returns the capabilities declared by this bundle revision.

public List<BundleRequirement>

Returns:

An unmodifiable list containing the declared BundleRequirements from the specified namespace. The returned list will be empty if this bundle revision declares no requirements in the specified namespace. The list contains the declared requirements in the order they are specified in the manifest.
getDeclaredRequirements
(String
The namespace of the declared requirements to return or null to return the declared requirements from all namespaces.
namespace
)

Returns the requirements declared by this bundle revision.

public List<Requirement>

Returns:

An unmodifiable list containing the declared Requirement s from the specified namespace. The returned list will be empty if this resource declares no requirements in the specified namespace.
getRequirements
(String
The namespace of the declared requirements to return or null to return the declared requirements from all namespaces.
namespace
)

Redeclares org.osgi.resource.Resource.getRequirements.

Returns the requirements declared by this bundle resource.

public String

Returns:

The symbolic name for this bundle revision.
getSymbolicName
()

Returns the symbolic name for this bundle revision.

public int

Returns:

The special types of this bundle revision. The type values are ORed together.
getTypes
()

Returns the special types of this bundle revision.

public Version

Returns:

The version for this bundle revision, or Version#emptyVersion if this bundle revision has no version information.
getVersion
()

Returns the version for this bundle revision.

public BundleWiring

Returns:

The bundle wiring which is using this bundle revision or null if no bundle wiring is using this bundle revision.
getWiring
()

Returns the bundle wiring which is using this bundle revision.

Inherited from org.osgi.framework.BundleReference:
getBundle
Inherited from org.osgi.resource.Resource:
equalshashCode

Field Detail

BUNDLE_NAMESPACEback to summary
public static final String BUNDLE_NAMESPACE

Namespace for bundle capabilities and requirements.

The bundle symbolic name of the bundle is stored in the capability attribute of the same name as this namespace (osgi.wiring.bundle). The other directives and attributes of the bundle, from the Bundle-SymbolicName manifest header, can be found in the cabability's directives and attributes. The bundle-version capability attribute must contain the Version of the bundle from the Bundle-Version manifest header if one is specified or Version#emptyVersion if not specified.

A non-fragment revision declares exactly one† bundle capability (that is, the bundle can be required by another bundle). A fragment revision must not declare a bundle capability.

A bundle wiring for a non-fragment revision provides exactly one† bundle capability (that is, the bundle can be required by another bundle) and requires zero or more bundle capabilities (that is, requires other bundles).

† A bundle with no bundle symbolic name (that is, a bundle with Bundle-ManifestVersion < 2) must not provide a bundle capability.

See Also
BundleNamespace
HOST_NAMESPACEback to summary
public static final String HOST_NAMESPACE

Namespace for host capabilities and requirements.

The bundle symbolic name of the bundle is stored in the capability attribute of the same name as this namespace (osgi.wiring.host). The other directives and attributes of the bundle, from the Bundle-SymbolicName manifest header, can be found in the cabability's directives and attributes. The bundle-version capability attribute must contain the Version of the bundle from the Bundle-Version manifest header if one is specified or Version#emptyVersion if not specified.

A non-fragment revision declares zero or one† host capability if the bundle allows fragments to be attached. A fragment revision must declare exactly one host requirement.

A bundle wiring for a non-fragment revision provides zero or one† host capability if the bundle allows fragments to be attached. A bundle wiring for a fragment revision requires a host capability for each host to which it is attached.

† A bundle with no bundle symbolic name (that is, a bundle with Bundle-ManifestVersion < 2) must not provide a host capability.

See Also
HostNamespace
PACKAGE_NAMESPACEback to summary
public static final String PACKAGE_NAMESPACE

Namespace for package capabilities and requirements.

The name of the package is stored in the capability attribute of the same name as this namespace (osgi.wiring.package). The other directives and attributes of the package, from the Export-Package manifest header, can be found in the cabability's directives and attributes. The version capability attribute must contain the Version of the package if one is specified or Version#emptyVersion if not specified. The bundle-symbolic-name capability attribute must contain the symbolic name of the provider if one is specified. The bundle-version capability attribute must contain the version of the provider if one is specified or Version#emptyVersion if not specified.

The package capabilities provided by the system bundle, that is the bundle with id zero, must include the package specified by the Constants#FRAMEWORK_SYSTEMPACKAGES and Constants#FRAMEWORK_SYSTEMPACKAGES_EXTRA framework properties as well as any other package exported by the framework implementation.

A bundle revision declares zero or more package capabilities (this is, exported packages) and declares zero or more package requirements.

A bundle wiring provides zero or more resolved package capabilities (that is, exported packages) and requires zero or more resolved package requirements (that is, imported packages). The number of package wires required by a bundle wiring may change as the bundle wiring may dynamically import additional packages.

See Also
PackageNamespace
TYPE_FRAGMENTback to summary
public static final int TYPE_FRAGMENT

Bundle revision type indicating the bundle revision is a fragment.

See Also
getTypes()

Method Detail

getCapabilitiesback to summary
public List<Capability> getCapabilities(String namespace)

Redeclares org.osgi.resource.Resource.getCapabilities.

Returns the capabilities declared by this resource.

This method returns the same value as getDeclaredCapabilities(String).

Parameters
namespace:String

The namespace of the declared capabilities to return or null to return the declared capabilities from all namespaces.

Returns:List<Capability>

An unmodifiable list containing the declared Capabilitys from the specified namespace. The returned list will be empty if this resource declares no capabilities in the specified namespace.

Since
1.1
getDeclaredCapabilitiesback to summary
public List<BundleCapability> getDeclaredCapabilities(String namespace)

Returns the capabilities declared by this bundle revision.

Parameters
namespace:String

The namespace of the declared capabilities to return or null to return the declared capabilities from all namespaces.

Returns:List<BundleCapability>

An unmodifiable list containing the declared BundleCapabilitys from the specified namespace. The returned list will be empty if this bundle revision declares no capabilities in the specified namespace. The list contains the declared capabilities in the order they are specified in the manifest.

getDeclaredRequirementsback to summary
public List<BundleRequirement> getDeclaredRequirements(String namespace)

Returns the requirements declared by this bundle revision.

Parameters
namespace:String

The namespace of the declared requirements to return or null to return the declared requirements from all namespaces.

Returns:List<BundleRequirement>

An unmodifiable list containing the declared BundleRequirements from the specified namespace. The returned list will be empty if this bundle revision declares no requirements in the specified namespace. The list contains the declared requirements in the order they are specified in the manifest.

getRequirementsback to summary
public List<Requirement> getRequirements(String namespace)

Redeclares org.osgi.resource.Resource.getRequirements.

Returns the requirements declared by this bundle resource.

This method returns the same value as getDeclaredRequirements(String).

Parameters
namespace:String

The namespace of the declared requirements to return or null to return the declared requirements from all namespaces.

Returns:List<Requirement>

An unmodifiable list containing the declared Requirement s from the specified namespace. The returned list will be empty if this resource declares no requirements in the specified namespace.

Since
1.1
getSymbolicNameback to summary
public String getSymbolicName()

Returns the symbolic name for this bundle revision.

Returns:String

The symbolic name for this bundle revision.

See Also
Bundle#getSymbolicName()
getTypesback to summary
public int getTypes()

Returns the special types of this bundle revision. The bundle revision type values are:

A bundle revision may be more than one type at a time. A type code is used to identify the bundle revision type for future extendability.

If this bundle revision is not one or more of the defined types then 0 is returned.

Returns:int

The special types of this bundle revision. The type values are ORed together.

getVersionback to summary
public Version getVersion()

Returns the version for this bundle revision.

Returns:Version

The version for this bundle revision, or Version#emptyVersion if this bundle revision has no version information.

See Also
Bundle#getVersion()
getWiringback to summary
public BundleWiring getWiring()

Returns the bundle wiring which is using this bundle revision.

Returns:BundleWiring

The bundle wiring which is using this bundle revision or null if no bundle wiring is using this bundle revision.

See Also
BundleWiring#getRevision()