@ProviderType public interface FrameworkWiring extends BundleReference
bundle.adapt(FrameworkWiring.class)
on the system
bundle. Only the system bundle can be adapted to a FrameworkWiring object.
The system bundle associated with this FrameworkWiring object can be obtained
by calling BundleReference.getBundle()
.
Modifier and Type | Method and Description |
---|---|
java.util.Collection<BundleCapability> |
findProviders(Requirement requirement)
Find bundle capabilities that match the given requirement.
|
java.util.Collection<Bundle> |
getDependencyClosure(java.util.Collection<Bundle> bundles)
Returns the dependency closure for the specified bundles.
|
java.util.Collection<Bundle> |
getRemovalPendingBundles()
Returns the bundles that have
non-current , in use bundle wirings. |
void |
refreshBundles(java.util.Collection<Bundle> bundles,
FrameworkListener... listeners)
Refreshes the specified bundles.
|
boolean |
resolveBundles(java.util.Collection<Bundle> bundles)
Resolves the specified bundles.
|
getBundle
void refreshBundles(java.util.Collection<Bundle> bundles, FrameworkListener... listeners)
The technique by which the framework refreshes bundles may vary among different framework implementations. A permissible implementation is to stop and restart the framework.
This method returns to the caller immediately and then performs the following steps on a separate thread:
dependency
closure
of the specified bundles. If no bundles are specified, compute
the dependency closure of the removal
pending
bundles.ACTIVE
state will be stopped as described in the Bundle.stop
method.RESOLVED
state is unresolved and thus moved to the INSTALLED
state. The
effect of this step is that bundles in the dependency closure are no
longer RESOLVED
.UNINSTALLED
state is removed from the dependency closure and is
now completely removed from the Framework.ACTIVE
state prior to Step 2 is started as described in the Bundle.start
method, causing all bundles required for the restart to be resolved. It
is possible that, as a result of the previous steps, packages that were
previously exported no longer are. Therefore, some bundles may be
unresolvable until bundles satisfying the dependencies have been
installed in the Framework.
For any exceptions that are thrown during any of these steps, a framework
event of type FrameworkEvent.ERROR
is fired containing the
exception. The source bundle for these events should be the specific
bundle to which the exception is related. If no specific bundle can be
associated with the exception then the System Bundle must be used as the
source bundle for the event. All framework events fired by this method
are also delivered to the specified FrameworkListener
s in the
order they are specified.
When this process completes after the bundles are refreshed, the
Framework will fire a Framework event of type
FrameworkEvent.PACKAGES_REFRESHED
to announce it has completed
the bundle refresh. The specified FrameworkListener
s are notified
in the order specified. Each specified FrameworkListener
will be
called with a Framework event of type
FrameworkEvent.PACKAGES_REFRESHED
.
bundles
- The bundles to be refreshed, or null
to refresh
the removal pending
bundles.listeners
- Zero or more listeners to be notified when the bundle
refresh has been completed. The specified listeners do not need to
be otherwise registered with the framework. If a specified
listener is already registered with the framework, it will be
notified twice.java.lang.IllegalArgumentException
- If the specified Bundle
s were
not created by the same framework instance associated with this
FrameworkWiring.java.lang.SecurityException
- If the caller does not have
AdminPermission[System Bundle,RESOLVE]
and the Java
runtime environment supports permissions.boolean resolveBundles(java.util.Collection<Bundle> bundles)
If no bundles are specified, then the Framework will attempt to resolve all unresolved bundles. This method must not cause any bundle to be refreshed, stopped, or started. This method will not return until the operation has completed.
bundles
- The bundles to resolve or null
to resolve all
unresolved bundles installed in the Framework.true
if all specified bundles are resolved; false
otherwise.java.lang.IllegalArgumentException
- If the specified Bundle
s were
not created by the same framework instance associated with this
FrameworkWiring.java.lang.SecurityException
- If the caller does not have
AdminPermission[System Bundle,RESOLVE]
and the Java
runtime environment supports permissions.java.util.Collection<Bundle> getRemovalPendingBundles()
non-current
, in use
bundle wirings. This
is typically the bundles which have been updated or uninstalled since the
last call to refreshBundles(Collection, FrameworkListener...)
.Bundle
s which
have non-current, in use BundleWiring
s, or an empty
collection if there are no such bundles.java.util.Collection<Bundle> getDependencyClosure(java.util.Collection<Bundle> bundles)
A graph of bundles is computed starting with the specified bundles. The
graph is expanded by adding any bundle that is either wired to a package
that is currently exported by a bundle in the graph or requires a bundle
in the graph. The graph is fully constructed when there is no bundle
outside the graph that is wired to a bundle in the graph. The graph may
contain UNINSTALLED
bundles that are
removal pending
.
bundles
- The initial bundles for which to generate the dependency
closure.java.lang.IllegalArgumentException
- If the specified Bundle
s were
not created by the same framework instance associated with this
FrameworkWiring.java.util.Collection<BundleCapability> findProviders(Requirement requirement)
The returned collection contains BundleCapability
objects where
the revision must be the declaring
revision
of the capability and the revision must either be the current
bundle revision or an in use
bundle
revision.
Each returned capability must match the given requirement. This means that the filter in the requirement must match as well as any namespace specific directives. For example, the mandatory attributes for the osgi.wiring.package namespace.
The returned collection has not been filtered to remove capabilities that are non-effective, substituted or for which the providing bundle does not have permission to provide. No resolve hooks are called to filter matching capabilities.
requirement
- The requirement to find matching bundle capabilities.
Must not be null
.BundleCapability
objects that match the
specified requirement.Copyright © OSGi Alliance (2000, 2020). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0