public class BundleWiringImpl extends Object implements BundleWiring
| Modifier and Type | Class and Description |
|---|---|
static class |
BundleWiringImpl.BundleClassLoader |
| Modifier and Type | Field and Description |
|---|---|
static ClassLoader |
CNFE_CLASS_LOADER |
static int |
EAGER_ACTIVATION |
static int |
LAZY_ACTIVATION |
static int |
LISTRESOURCES_DEBUG |
FINDENTRIES_RECURSE, LISTRESOURCES_LOCAL, LISTRESOURCES_RECURSE| Modifier and Type | Method and Description |
|---|---|
void |
addDynamicWire(BundleWire wire) |
void |
dispose() |
List<URL> |
findEntries(String path,
String filePattern,
int options)
Returns entries in this bundle wiring's
bundle
revision and its attached fragment revisions. |
org.apache.felix.framework.BundleImpl |
getBundle()
Returns the
Bundle object associated with this
BundleReference. |
List<BundleCapability> |
getCapabilities(String namespace)
Returns the capabilities provided by this bundle wiring.
|
Class |
getClassByDelegation(String name) |
ClassLoader |
getClassLoader()
Returns the class loader for this bundle wiring.
|
BundleRevision |
getImportedPackageSource(String pkgName) |
List<NativeLibrary> |
getNativeLibraries() |
List<Wire> |
getProvidedResourceWires(String namespace)
Returns the
Wires to the provided capabilities
of this wiring. |
List<BundleWire> |
getProvidedWires(String namespace)
Returns the
BundleWires to the provided capabilities of this bundle wiring. |
List<Wire> |
getRequiredResourceWires(String namespace)
Returns the
Wires to the requirements in use
by this wiring. |
List<BundleWire> |
getRequiredWires(String namespace)
Returns the
BundleWires to the requirements in use by this bundle wiring. |
List<BundleRequirement> |
getRequirements(String namespace)
Returns the requirements of this bundle wiring.
|
BundleRevision |
getResource()
Returns the resource associated with this wiring.
|
URL |
getResourceByDelegation(String name) |
List<Capability> |
getResourceCapabilities(String namespace)
Returns the capabilities provided by this wiring.
|
List<Requirement> |
getResourceRequirements(String namespace)
Returns the requirements of this wiring.
|
Enumeration |
getResourcesByDelegation(String name) |
BundleRevision |
getRevision()
Returns the bundle revision for the bundle in this bundle wiring.
|
boolean |
hasPackageSource(String pkgName) |
boolean |
isCurrent()
Returns
true if this bundle wiring is the current bundle wiring. |
boolean |
isInUse()
Returns
true if this bundle wiring is in use. |
Collection<String> |
listResources(String path,
String filePattern,
int options)
Returns the names of resources visible to this bundle wiring's
class loader. |
String |
toString() |
public static final int LISTRESOURCES_DEBUG
public static final int EAGER_ACTIVATION
public static final int LAZY_ACTIVATION
public static final ClassLoader CNFE_CLASS_LOADER
public void dispose()
public boolean hasPackageSource(String pkgName)
public BundleRevision getImportedPackageSource(String pkgName)
public boolean isCurrent()
BundleWiringtrue 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.isCurrent in interface BundleWiringtrue if this bundle wiring is the current bundle wiring;
false otherwise.public boolean isInUse()
BundleWiringtrue 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.isInUse in interface BundleWiringtrue if this bundle wiring is in use; false
otherwise.public List<Capability> getResourceCapabilities(String namespace)
BundleWiring
Only capabilities considered by the resolver are returned. For example,
capabilities with effective directive not equal to resolve are not returned.
A capability may not be required by any wiring and thus there may be no
wires for the capability.
A wiring for a non-fragment resource provides a subset of the declared capabilities from the resource and all attached fragment resources†. Not all declared capabilities may be provided since some may be discarded. For example, if a package is declared to be both exported and imported, only one is selected and the other is discarded.
A wiring for a fragment resource with a symbolic name must provide
exactly one osgi.identity capability.
† The osgi.identity capability provided by attached
fragment resource must not be included in the capabilities of the host
wiring.
This method returns the same value as BundleWiring.getCapabilities(String).
getResourceCapabilities in interface BundleWiringgetResourceCapabilities in interface Wiringnamespace - The namespace of the capabilities to return or
null to return the capabilities from all namespaces.Capabilitys, or an
empty list if this wiring provides no capabilities in the
specified namespace. For a given namespace, the list contains the
capabilities in the order the capabilities were specified in the
manifests of the resource and the attached
fragment resources† of this wiring. There is no
ordering defined between capabilities in different namespaces.public List<BundleCapability> getCapabilities(String namespace)
BundleWiring
Only capabilities considered by the resolver are returned. For example,
capabilities with effective directive not equal to resolve are not returned.
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 both exported and imported, only one is selected and the other is discarded.
A bundle wiring for a fragment revision with a symbolic name must provide
exactly one identity capability.
† The identity capability provided by
attached fragment revisions must not be included in the capabilities of
the host bundle wiring.
getCapabilities in interface BundleWiringnamespace - The namespace of the capabilities to return or
null to return the capabilities from all namespaces.BundleCapabilitys, or
an empty list if this bundle wiring provides no capabilities in
the specified namespace. If this bundle wiring is not
in use, null will be returned. For a
given namespace, the list contains the capabilities 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 namespaces.public List<Requirement> getResourceRequirements(String namespace)
BundleWiring
Only requirements considered by the resolver are returned. For example,
requirements with effective directive not equal to resolve are not returned.
A wiring for a non-fragment resource has a subset of the declared requirements from the resource and all attached fragment resources. 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.
This method returns the same value as BundleWiring.getRequirements(String).
getResourceRequirements in interface BundleWiringgetResourceRequirements in interface Wiringnamespace - The namespace of the requirements to return or
null to return the requirements from all namespaces.Requirements, or an
empty list if this wiring uses no requirements in the specified
namespace. For a given namespace, the list contains the
requirements in the order the requirements were specified in the
manifests of the resource and the attached
fragment resources of this wiring. There is no ordering defined
between requirements in different namespaces.public List<BundleRequirement> getRequirements(String namespace)
BundleWiring
Only requirements considered by the resolver are returned. For example,
requirements with effective directive not equal to resolve are not returned.
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 both exported and imported, only one is selected and the other is discarded.
getRequirements in interface BundleWiringnamespace - The namespace of the requirements to return or
null to return the requirements from all namespaces.BundleRequirements,
or an empty list if this bundle wiring uses no requirements in
the specified namespace. If this bundle wiring is not
in use, null will be returned. For a
given namespace, the list contains the requirements 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 namespaces.public List<NativeLibrary> getNativeLibraries()
public List<Wire> getProvidedResourceWires(String namespace)
BundleWiringWires to the provided capabilities
of this wiring.
This method returns the same value as BundleWiring.getProvidedWires(String).
getProvidedResourceWires in interface BundleWiringgetProvidedResourceWires in interface Wiringnamespace - The namespace of the capabilities for which to return
wires or null to return the wires for the capabilities in
all namespaces.Wires for the
capabilities of this wiring, or an empty list
if this wiring has no capabilities in the specified namespace.
For a given namespace, the list contains the wires in the order
the capabilities were specified in the manifests of the
resource and the attached fragment
resources of this wiring. There is no ordering defined between
capabilities in different namespaces.public List<BundleWire> getProvidedWires(String namespace)
BundleWiringBundleWires to the provided capabilities of this bundle wiring.getProvidedWires in interface BundleWiringnamespace - The namespace of the capabilities for which to return
wires or null to return the wires for the capabilities in
all namespaces.BundleWires for the
capabilities of this bundle wiring, or
an empty list if this bundle wiring has no capabilities in the
specified namespace. If this bundle wiring is not
in use, null will be returned. For a
given namespace, 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 namespaces.public List<Wire> getRequiredResourceWires(String namespace)
BundleWiringWires to the requirements in use
by this wiring.
This method returns the same value as BundleWiring.getRequiredWires(String).
getRequiredResourceWires in interface BundleWiringgetRequiredResourceWires in interface Wiringnamespace - The namespace of the requirements for which to return
wires or null to return the wires for the requirements in
all namespaces.Wires for the
requirements of this wiring, or an empty list
if this wiring has no requirements in the specified namespace.
For a given namespace, the list contains the wires in the order
the requirements were specified in the manifests of the
resource and the attached fragment
resources of this wiring. There is no ordering defined between
requirements in different namespaces.public List<BundleWire> getRequiredWires(String namespace)
BundleWiringBundleWires to the requirements in use by this bundle wiring.
This method may return different results if this bundle wiring establishes additional wires to more requirements. For example, dynamically importing a package will establish a new wire to the dynamically imported package.
getRequiredWires in interface BundleWiringnamespace - The namespace of the requirements for which to return
wires or null to return the wires for the requirements in
all namespaces.BundleWires for the
requirements of this bundle wiring, or
an empty list if this bundle wiring has no requirements in the
specified namespace. If this bundle wiring is not
in use, null will be returned. For a
given namespace, 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 followed by dynamically established wires,
if any, in the order they were established. There is no ordering
defined between requirements in different namespaces.public void addDynamicWire(BundleWire wire)
public BundleRevision getResource()
BundleWiring
This method returns the same value as BundleWiring.getRevision().
getResource in interface BundleWiringgetResource in interface Wiringpublic BundleRevision getRevision()
BundleWiring
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.
getRevision in interface BundleWiringBundleRevision.getWiring()public ClassLoader getClassLoader()
BundleWiringgetClassLoader in interface BundleWiringin use or this bundle wiring is for a
fragment revision, null will be returned.public List<URL> findEntries(String path, String filePattern, int options)
BundleWiringbundle
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 namespace 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.
URLs for directory entries must have their path end with "/".
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.
findEntries in interface BundleWiringpath - 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
BundleWiring.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)public Collection<String> listResources(String path, String filePattern, int options)
BundleWiringclass loader. The returned names can be used to
access the resources via this bundle wiring's class loader.
listResources in interface BundleWiringpath - 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
BundleWiring.LISTRESOURCES_LOCAL and BundleWiring.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.public org.apache.felix.framework.BundleImpl getBundle()
BundleReferenceBundle object associated with this
BundleReference.getBundle in interface BundleReferenceBundle object associated with this
BundleReference.public Enumeration getResourcesByDelegation(String name)
public Class getClassByDelegation(String name) throws ClassNotFoundException
ClassNotFoundExceptionCopyright © 2006–2021 The Apache Software Foundation. All rights reserved.