|
OSGi™ Service Platform Core Specification Release 4 Version 4.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BundleWiring
A wiring for a bundle. Each time a bundle is resolved, a new bundle wiring for the bundle is created. A bundle wiring is associated with a bundle revision and represents the dependencies with other bundle wirings.
The bundle wiring for a bundle is the current
bundle
wiring if it is the most recent bundle wiring for the current bundle
revision. A bundle wiring is in use
if it is the current
bundle wiring or if some other in use bundle wiring is dependent upon it. For
example, another bundle wiring is wired to a capability provided by the
bundle wiring. An in use bundle wiring for a non-fragment bundle has a class
loader. All bundles with non-current, in use bundle wirings are considered
removal pending. Once a bundle wiring is no longer in use, it is considered
stale and is discarded by the framework.
The current bundle wiring for a bundle can be obtained by calling
bundle.adapt
(BundleWiring.class). A bundle in the
INSTALLED or UNINSTALLED state does not have a current wiring, adapting such
a bundle returns null
.
Field Summary | |
---|---|
static int |
FINDENTRIES_RECURSE
The find entries operation must recurse into subdirectories. |
static int |
LISTRESOURCES_LOCAL
The list resource names operation must limit the result to the names of matching resources contained in this bundle wiring's bundle revision and its attached fragment
revisions. |
static int |
LISTRESOURCES_RECURSE
The list resource names operation must recurse into subdirectories. |
Method Summary | |
---|---|
java.util.List<java.net.URL> |
findEntries(java.lang.String path,
java.lang.String filePattern,
int options)
Returns entries in this bundle wiring's bundle
revision and its attached fragment revisions. |
java.util.List<BundleCapability> |
getCapabilities(java.lang.String namespace)
Returns the capabilities provided by this bundle wiring. |
java.lang.ClassLoader |
getClassLoader()
Returns the class loader for this bundle wiring. |
java.util.List<BundleWire> |
getProvidedWires(java.lang.String namespace)
Returns the BundleWire s to the provided capabilities of this bundle wiring. |
java.util.List<BundleWire> |
getRequiredWires(java.lang.String namespace)
Returns the BundleWire s to the requirements in use by this bundle wiring. |
java.util.List<BundleRequirement> |
getRequirements(java.lang.String namespace)
Returns the requirements of this bundle wiring. |
BundleRevision |
getRevision()
Returns the bundle revision for the bundle in this bundle wiring. |
boolean |
isCurrent()
Returns true if this bundle wiring is the current bundle wiring. |
boolean |
isInUse()
Returns true if this bundle wiring is in use. |
java.util.Collection<java.lang.String> |
listResources(java.lang.String path,
java.lang.String filePattern,
int options)
Returns the names of resources visible to this bundle wiring's class loader . |
Methods inherited from interface org.osgi.framework.BundleReference |
---|
getBundle |
Field Detail |
---|
static final int FINDENTRIES_RECURSE
This bit may be set when calling
findEntries(String, String, int)
to specify the result must
include the matching entries from the specified path and its
subdirectories. If this bit is not set, then the result must only include
matching entries from the specified path.
findEntries(String, String, int)
,
Constant Field Valuesstatic final int LISTRESOURCES_RECURSE
This bit may be set when calling
listResources(String, String, int)
to specify the result must
include the names of matching resources from the specified path and its
subdirectories. If this bit is not set, then the result must only include
names of matching resources from the specified path.
listResources(String, String, int)
,
Constant Field Valuesstatic final int LISTRESOURCES_LOCAL
bundle revision
and its attached fragment
revisions. The result must not include resource names for resources in
package
names which are
imported
by this wiring.
This bit may be set when calling
listResources(String, String, int)
to specify the result must
only include the names of matching resources contained in this bundle
wiring's bundle revision and its attached fragment revisions. If this bit
is not set, then the result must include the names of matching resources
reachable from this bundle wiring's class loader which may include the
names of matching resources contained in imported packages and required
bundles.
listResources(String, String, int)
,
Constant Field ValuesMethod Detail |
---|
boolean isCurrent()
true
if this bundle wiring is the current bundle wiring.
The bundle wiring for a bundle is the current bundle wiring if it is the
most recent bundle wiring for the current bundle revision. All bundles
with non-current, in use bundle wirings are considered
removal pending
.
true
if this bundle wiring is the current bundle wiring;
false
otherwise.boolean isInUse()
true
if this bundle wiring is in use. A bundle wiring is
in use if it is the current
wiring or if some other
in use bundle wiring is dependent upon it. Once a bundle wiring is no
longer in use, it is considered stale and is discarded by the framework.
true
if this bundle wiring is in use; false
otherwise.java.util.List<BundleCapability> getCapabilities(java.lang.String namespace)
A capability may not be required by any bundle wiring and thus there may
be no wires
for the capability.
A bundle wiring for a non-fragment revision provides a subset of the declared capabilities from the bundle revision and all attached fragment revisions. Not all declared capabilities may be provided since some may be discarded. For example, if a package is declared to be exported and import, only one is selected and the other is discarded.
namespace
- The name space of the capabilities to return or
null
to return the capabilities from all name spaces.
BundleCapability
s, or
an empty list if this bundle wiring provides no capabilities in
the specified name space. If this bundle wiring is not
in use
, null
will be returned. For a
given name space, the list contains the wires in the order the
capabilities were specified in the manifests of the
bundle revision
and the attached fragments
of this bundle wiring. There is no ordering defined between
capabilities in different name spaces.java.util.List<BundleRequirement> getRequirements(java.lang.String namespace)
A bundle wiring for a non-fragment revision has a subset of the declared requirements from the bundle revision and all attached fragment revisions. Not all declared requirements may be present since some may be discarded. For example, if a package is declared to be optionally imported and is not actually imported, the requirement must be discarded.
namespace
- The name space of the requirements to return or
null
to return the requirements from all name spaces.
BundleRequirement
s,
or an empty list if this bundle wiring uses no requirements in
the specified name space. If this bundle wiring is not
in use
, null
will be returned. For a
given name space, the list contains the wires in the order the
requirements were specified in the manifests of the
bundle revision
and the attached fragments
of this bundle wiring. There is no ordering defined between
requirements in different name spaces.java.util.List<BundleWire> getProvidedWires(java.lang.String namespace)
BundleWire
s to the provided capabilities
of this bundle wiring.
namespace
- The name space of the capabilities for which to return
wires or null
to return the wires for the capabilities in
all name spaces.
BundleWire
s for the
capabilities
of this bundle wiring, or
an empty list if this bundle wiring has no capabilities in the
specified name space. If this bundle wiring is not
in use
, null
will be returned. For a
given name space, the list contains the wires in the order the
capabilities were specified in the manifests of the
bundle revision
and the attached fragments
of this bundle wiring. There is no ordering defined between
capabilities in different name spaces.java.util.List<BundleWire> getRequiredWires(java.lang.String namespace)
BundleWire
s to the requirements
in use by this bundle wiring.
This method may return different results if this bundle wiring adds wires to more requirements. For example, dynamically importing a package will establish a new wire to the dynamically imported package.
namespace
- The name space of the requirements for which to return
wires or null
to return the wires for the requirements in
all name spaces.
BundleWire
s for the
requirements
of this bundle wiring, or
an empty list if this bundle wiring has no requirements in the
specified name space. If this bundle wiring is not
in use
, null
will be returned. For a
given name space, the list contains the wires in the order the
requirements were specified in the manifests of the
bundle revision
and the attached fragments
of this bundle wiring. There is no ordering defined between
requirements in different name spaces.BundleRevision getRevision()
The bundle object referenced
by the
returned BundleRevision
may return different information than the
returned BundleRevision
since the returned BundleRevision
may refer to an older revision of the bundle.
BundleRevision.getWiring()
java.lang.ClassLoader getClassLoader()
in use
or this bundle wiring is for a
fragment revision, null
will be returned.
java.lang.SecurityException
- If the caller does not have the appropriate
RuntimePermission("getClassLoader")
, and the Java Runtime
Environment supports permissions.java.util.List<java.net.URL> findEntries(java.lang.String path, java.lang.String filePattern, int options)
bundle
revision
and its attached fragment revisions. This bundle wiring's class
loader is not used to search for entries. Only the contents of this
bundle wiring's bundle revision and its attached fragment revisions are
searched for the specified entries.
This method takes into account that the "contents" of this bundle wiring can have attached fragments. This "bundle space" is not a name space with unique members; the same entry name can be present multiple times. This method therefore returns a list of URL objects. These URLs can come from different JARs but have the same path name. This method can either return only entries in the specified path or recurse into subdirectories returning entries in the directory tree beginning at the specified path.
Note: Jar and zip files are not required to include directory entries. URLs to directory entries will not be returned if the bundle contents do not contain directory entries.
path
- The path name in which to look. The path is always relative
to the root of this bundle wiring and may begin with
"/". A path value of "/" indicates the root of
this bundle wiring.filePattern
- The file name pattern for selecting entries in the
specified path. The pattern is only matched against the last
element of the entry path. If the entry is a directory then the
trailing "/" is not used for pattern matching. Substring
matching is supported, as specified in the Filter specification,
using the wildcard character ("*"). If null
is
specified, this is equivalent to "*" and matches all
files.options
- The options for listing resource names. See
FINDENTRIES_RECURSE
. The method must ignore unrecognized
options.
AdminPermission[bundle,RESOURCE]
and the
Java Runtime Environment supports permissions. The list is
ordered such that entries from the bundle
revision
are returned first followed by the entries from
attached fragment revisions in attachment order. If this bundle
wiring is not in use
, null
must be
returned.Bundle.findEntries(String, String, boolean)
java.util.Collection<java.lang.String> listResources(java.lang.String path, java.lang.String filePattern, int options)
class loader
. The returned names can be used to
access the resources via this bundle wiring's class loader.
path
- The path name in which to look. The path is always relative
to the root of this bundle wiring's class loader and may begin
with "/". A path value of "/" indicates the
root of this bundle wiring's class loader.filePattern
- The file name pattern for selecting resource names in
the specified path. The pattern is only matched against the last
element of the resource path. If the resource is a directory then
the trailing "/" is not used for pattern matching.
Substring matching is supported, as specified in the Filter
specification, using the wildcard character ("*"). If
null
is specified, this is equivalent to "*" and
matches all files.options
- The options for listing resource names. See
LISTRESOURCES_LOCAL
and LISTRESOURCES_RECURSE
.
This method must ignore unrecognized options.
AdminPermission[bundle,RESOURCE]
and the Java Runtime
Environment supports permissions. The collection is unordered and
must contain no duplicate resource names. If this bundle wiring
is not in use
, null
must be returned.
|
OSGi™ Service Platform Core Specification Release 4 Version 4.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |