@ProviderType public interface BundleRevision extends BundleReference, Resource
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.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUNDLE_NAMESPACE
Namespace for bundle capabilities and requirements.
|
static java.lang.String |
HOST_NAMESPACE
Namespace for host capabilities and requirements.
|
static java.lang.String |
PACKAGE_NAMESPACE
Namespace for package capabilities and requirements.
|
static int |
TYPE_FRAGMENT
Bundle revision type indicating the bundle revision is a fragment.
|
Modifier and Type | Method and 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.String |
getSymbolicName()
Returns the symbolic name for this bundle revision.
|
int |
getTypes()
Returns the special types of this bundle revision.
|
Version |
getVersion()
Returns the version for this bundle revision.
|
BundleWiring |
getWiring()
Returns the bundle wiring which is using this bundle revision.
|
getBundle
static final java.lang.String PACKAGE_NAMESPACE
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 capability'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.
PackageNamespace
,
Constant Field Valuesstatic final java.lang.String BUNDLE_NAMESPACE
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 capability'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.
BundleNamespace
,
Constant Field Valuesstatic final java.lang.String HOST_NAMESPACE
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 capability'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.
HostNamespace
,
Constant Field Valuesstatic final int TYPE_FRAGMENT
getTypes()
,
Constant Field Valuesjava.lang.String getSymbolicName()
Bundle.getSymbolicName()
Version getVersion()
Version.emptyVersion
if this bundle revision has no
version information.Bundle.getVersion()
java.util.List<BundleCapability> getDeclaredCapabilities(java.lang.String namespace)
namespace
- The namespace of the declared capabilities to return or
null
to return the declared capabilities from all
namespaces.BundleCapability
s 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.java.util.List<BundleRequirement> getDeclaredRequirements(java.lang.String namespace)
namespace
- The namespace of the declared requirements to return or
null
to return the declared requirements from all
namespaces.BundleRequirement
s 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.int getTypes()
If this bundle revision is not one or more of the defined types then 0 is returned.
BundleWiring getWiring()
null
if no bundle wiring is using this bundle revision.BundleWiring.getRevision()
java.util.List<Capability> getCapabilities(java.lang.String namespace)
This method returns the same value as
getDeclaredCapabilities(String)
.
getCapabilities
in interface Resource
namespace
- The namespace of the declared capabilities to return or
null
to return the declared capabilities from all
namespaces.Capability
s
from the specified namespace. The returned list will be empty if
this resource declares no capabilities in the specified
namespace.java.util.List<Requirement> getRequirements(java.lang.String namespace)
This method returns the same value as
getDeclaredRequirements(String)
.
getRequirements
in interface Resource
namespace
- The namespace of the declared requirements to return or
null
to return the declared requirements from all
namespaces.Requirement
s from the specified namespace. The returned list will be empty
if this resource declares no requirements in the specified
namespace.Copyright © OSGi Alliance (2000, 2020). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0