resolve
operation.
Resolve Contexts:
capabilities that the Resolver can use to
satisfy requirements via the
findProviders(Requirement) methodgetWirings() method. A wiring
consists of a map of existing resources to wiring.isEffective(Requirement).A resolver may call the methods on the resolve context any number of times during a resolve operation using any thread. Implementors should ensure that this class is properly thread safe.
Except for insertHostedCapability(List, HostedCapability) and
onCancel(Runnable), the resolve context methods must be
idempotent. This means that resources must have constant capabilities
and requirements and the resolve context must return a consistent set of
capabilities, wires and effective requirements.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static <T> Collection | |
| public abstract List | Returns: A list ofCapability objects that match the specified
requirement.The requirement that a resolver is attempting to
satisfy. Must not be requirement)null.Find Capabilities that match the given Requirement. |
| public Collection | Returns: A collection of the resources that the resolver should attempt to resolve for this resolve context. May be empty if there are no related resources. The returned collection may be unmodifiable.The Resource that a resolver is attempting to find
related resources for. Must not be resource)null.Find resources that are related to the given resource. |
| public Collection | Returns: A collection of the resources that must be resolved for this resolve context. May be empty if there are no mandatory resources. The returned collection may be unmodifiable.Return the resources that must be resolved for this resolve context. |
| public Collection | Returns: A collection of the resources that the resolver should attempt to resolve for this resolve context. May be empty if there are no optional resources. The returned collection may be unmodifiable.Return the resources that the resolver should attempt to resolve for this resolve context. |
| public List | Returns: A list containing a snapshot of the substitutionWires
for the requirements of the wiring, or an
empty list if the wiring has no substitution wires. The list
contains the wires in the order they are found in the
required wires of
the wiring.the wiring to get the substitution wires for. Must not be
wiring)null.Returns the subset of |
| public abstract Map | Returns: The wirings for existing resolved resources. The returned map is unmodifiable.Returns the wirings for existing resolved resources. |
| public abstract int | Returns: The index in the list of the inserted HostedCapability.The list returned from
capabilities, HostedCapability findProviders(Requirement). Must not be null.The HostedCapability to insert in the specified
list. Must not be hostedCapability)null.Add a |
| public abstract boolean | Returns: true if the requirement should be considered as part of
the resolve operation.The Requirement to test. Must not be requirement)null.Test if a given requirement should be wired in the resolve operation. |
| public void |
| ResolveContext | back to summary |
|---|---|
| public ResolveContext() | |
| emptyCollection | back to summary |
|---|---|
private static <T> Collection
| |
| findProviders | back to summary |
|---|---|
| public abstract List Find Capabilities that match the given Requirement.
The returned list contains
The returned list is in priority order such that the Capabilities with a
lower index have a preference over those with a higher index. The
resolver must use the
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
| |
| findRelatedResources | back to summary |
|---|---|
| public Collection Find resources that are related to the given resource.
The resolver attempts to resolve related resources during the current
resolve operation. Failing to resolve one of the related resources will
not result in a resolution exception unless the related resource is also
a
The resolve context is asked to return related resources for each
resource that is pulled into a resolve operation. This includes the
For example, a fragment can be considered a related resource for a host bundle. When a host is being resolved the resolve context will be asked if any related resources should be added to the resolve operation. The resolve context may decide that the potential fragments of the host should be resolved along with the host.
| |
| getMandatoryResources | back to summary |
|---|---|
| public Collection Return the resources that must be resolved for this resolve context. The default implementation returns an empty collection.
| |
| getOptionalResources | back to summary |
|---|---|
| public Collection Return the resources that the resolver should attempt to resolve for this resolve context. Inability to resolve one of the specified resources will not result in a resolution exception. The default implementation returns an empty collection.
| |
| getSubstitutionWires | back to summary |
|---|---|
| public List Returns the subset of
The resolver asks the resolve context to return substitution wires for
each wiring that
Note that this method searches all the
| |
| getWirings | back to summary |
|---|---|
| public abstract Map Returns the wirings for existing resolved resources. For example, if this resolve context is for an OSGi framework, then the result would contain all the currently resolved bundles with each bundle's current wiring. Multiple calls to this method for this resolve context must return the same result. | |
| insertHostedCapability | back to summary |
|---|---|
| public abstract int insertHostedCapability(List<Capability> capabilities, HostedCapability hostedCapability) Add a
This method is used by the
| |
| isEffective | back to summary |
|---|---|
| public abstract boolean isEffective(Requirement requirement) Test if a given requirement should be wired in the resolve operation. If
this method returns
The primary use case for this is to test the
| |
| onCancel | back to summary |
|---|---|
| public void onCancel(Runnable callback) Registers a callback with the resolve context that is associated with the currently running resolve operation. The callback can be executed in order to cancel the currently running resolve operation.
When a resolve operation begins, the resolver must call this method once
and only once for the duration of the resolve operation and that call
must happen before calling any other method on this resolve context. If
the specified callback is executed then the resolver must cancel the
currently running resolve operation and throw a
The callback allows a resolve context to cancel a long running resolve operation that appears to be running endlessly or at risk of running out of resources. The resolve context may then decide to give up on resolve operation or attempt to try another resolve operation with a smaller set of resources which may allow the resolve operation to complete normally.
| |