Interface BundleRevision
-
- All Superinterfaces:
BundleReference,Resource
@ProviderType public interface BundleRevision extends BundleReference, 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 returnsnull.The framework defines namespaces for
package,bundleandhostcapabilities and requirements. These namespaces are defined only to express wiring information by the framework. They must not be used inProvide-CapabilityandRequire-Capabilitymanifest headers.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBUNDLE_NAMESPACENamespace for bundle capabilities and requirements.static java.lang.StringHOST_NAMESPACENamespace for host capabilities and requirements.static java.lang.StringPACKAGE_NAMESPACENamespace for package capabilities and requirements.static intTYPE_FRAGMENTBundle revision type indicating the bundle revision is a fragment.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<Capability>getCapabilities(java.lang.String namespace)Returns the capabilities declared by this resource.java.util.List<BundleCapability>getDeclaredCapabilities(java.lang.String namespace)Returns the capabilities declared by this bundle revision.java.util.List<BundleRequirement>getDeclaredRequirements(java.lang.String namespace)Returns the requirements declared by this bundle revision.java.util.List<Requirement>getRequirements(java.lang.String namespace)Returns the requirements declared by this bundle resource.java.lang.StringgetSymbolicName()Returns the symbolic name for this bundle revision.intgetTypes()Returns the special types of this bundle revision.VersiongetVersion()Returns the version for this bundle revision.BundleWiringgetWiring()Returns the bundle wiring which is using this bundle revision.-
Methods inherited from interface org.osgi.framework.BundleReference
getBundle
-
-
-
-
Field Detail
-
PACKAGE_NAMESPACE
static final java.lang.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-Packagemanifest header, can be found in the capability'sdirectivesandattributes. Theversioncapability attribute must contain theVersionof the package if one is specified orVersion.emptyVersionif not specified. Thebundle-symbolic-namecapability attribute must contain thesymbolic nameof the provider if one is specified. Thebundle-versioncapability attribute must contain theversionof the provider if one is specified orVersion.emptyVersionif 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_SYSTEMPACKAGESandConstants.FRAMEWORK_SYSTEMPACKAGES_EXTRAframework properties as well as any other package exported by the framework implementation.A bundle revision
declareszero or more package capabilities (this is, exported packages) anddeclareszero or more package requirements.A bundle wiring
provideszero or more resolved package capabilities (that is, exported packages) andrequireszero 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, Constant Field Values
-
BUNDLE_NAMESPACE
static final java.lang.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-SymbolicNamemanifest header, can be found in the capability'sdirectivesandattributes. Thebundle-versioncapability attribute must contain theVersionof the bundle from theBundle-Versionmanifest header if one is specified orVersion.emptyVersionif not specified.A non-fragment revision
declaresexactly 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
providesexactly one† bundle capability (that is, the bundle can be required by another bundle) andrequireszero 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, Constant Field Values
-
HOST_NAMESPACE
static final java.lang.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-SymbolicNamemanifest header, can be found in the capability'sdirectivesandattributes. Thebundle-versioncapability attribute must contain theVersionof the bundle from theBundle-Versionmanifest header if one is specified orVersion.emptyVersionif not specified.A non-fragment revision
declareszero or one† host capability if the bundleallows fragments to be attached. A fragment revision mustdeclareexactly one host requirement.A bundle wiring for a non-fragment revision
provideszero or one† host capability if the bundleallows fragments to be attached. A bundle wiring for a fragment revisionrequiresa 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, Constant Field Values
-
TYPE_FRAGMENT
static final int TYPE_FRAGMENT
Bundle revision type indicating the bundle revision is a fragment.- See Also:
getTypes(), Constant Field Values
-
-
Method Detail
-
getSymbolicName
java.lang.String getSymbolicName()
Returns the symbolic name for this bundle revision.- Returns:
- The symbolic name for this bundle revision.
- See Also:
Bundle.getSymbolicName()
-
getVersion
Version getVersion()
Returns the version for this bundle revision.- Returns:
- The version for this bundle revision, or
Version.emptyVersionif this bundle revision has no version information. - See Also:
Bundle.getVersion()
-
getDeclaredCapabilities
java.util.List<BundleCapability> getDeclaredCapabilities(java.lang.String namespace)
Returns the capabilities declared by this bundle revision.- Parameters:
namespace- The namespace of the declared capabilities to return ornullto return the declared capabilities from all namespaces.- 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.
-
getDeclaredRequirements
java.util.List<BundleRequirement> getDeclaredRequirements(java.lang.String namespace)
Returns the requirements declared by this bundle revision.- Parameters:
namespace- The namespace of the declared requirements to return ornullto return the declared requirements from all namespaces.- 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.
-
getTypes
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:
- The special types of this bundle revision. The type values are ORed together.
-
getWiring
BundleWiring getWiring()
Returns the bundle wiring which is using this bundle revision.- Returns:
- The bundle wiring which is using this bundle revision or
nullif no bundle wiring is using this bundle revision. - See Also:
BundleWiring.getRevision()
-
getCapabilities
java.util.List<Capability> getCapabilities(java.lang.String namespace)
Returns the capabilities declared by this resource.This method returns the same value as
getDeclaredCapabilities(String).- Specified by:
getCapabilitiesin interfaceResource- Parameters:
namespace- The namespace of the declared capabilities to return ornullto return the declared capabilities from all namespaces.- 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. - Since:
- 1.1
-
getRequirements
java.util.List<Requirement> getRequirements(java.lang.String namespace)
Returns the requirements declared by this bundle resource.This method returns the same value as
getDeclaredRequirements(String).- Specified by:
getRequirementsin interfaceResource- Parameters:
namespace- The namespace of the declared requirements to return ornullto return the declared requirements from all namespaces.- Returns:
- An unmodifiable list containing the declared
Requirements from the specified namespace. The returned list will be empty if this resource declares no requirements in the specified namespace. - Since:
- 1.1
-
-