Interface Resolver
-
Method Summary
Modifier and TypeMethodDescriptionresolve
(ResolveContext context) Resolve the specified resolve context and return any new resources and wires to the caller.resolveDynamic
(ResolveContext context, Wiring hostWiring, Requirement dynamicRequirement) Resolves a given requirement dynamically for the given host wiring using the given resolve context and return any new resources and wires to the caller.
-
Method Details
-
resolve
Resolve the specified resolve context and return any new resources and wires to the caller.The resolver considers two groups of resources:
- Mandatory - any resource in the
mandatory group
must be resolved. A failure to satisfy any mandatory requirement for these resources will result in throwing aResolutionException
- Optional - any resource in the
optional group
may be resolved. A failure to satisfy a mandatory requirement for a resource in this group will not fail the overall resolution but no resources or wires will be returned for that resource.
The resolve method returns the delta between the start state defined by
ResolveContext.getWirings()
and the end resolved state. That is, only new resources and wires are included.The behavior of the resolver is not defined if the specified resolve context supplies inconsistent information.
- Parameters:
context
- The resolve context for the resolve operation. Must not benull
.- Returns:
- The new resources and wires required to satisfy the specified resolve context. The returned map is the property of the caller and can be modified by the caller.
- Throws:
ResolutionException
- If the resolution cannot be satisfied.
- Mandatory - any resource in the
-
resolveDynamic
Map<Resource,List<Wire>> resolveDynamic(ResolveContext context, Wiring hostWiring, Requirement dynamicRequirement) throws ResolutionException Resolves a given requirement dynamically for the given host wiring using the given resolve context and return any new resources and wires to the caller.The requirement must be a
requirement
of the wiring and must use thepackage
namespace with aresolution
of typedynamic
.The resolve context is not asked for
mandatory
resources or foroptional
resources. The resolve context is asked tofind providers
for the given requirement. The matchingpackage
capabilities returned by the resolve context must not have aosgi.wiring.package
attribute equal to apackage
capability alreadywired to
by the wiring or equal apackage
capabilityprovided
by the wiring. The resolve context may be requested tofind providers
for other requirements in order to resolve the resources that provide the matching capabilities to the given requirement.If the requirement
cardinality
is notmultiple
then no new wire must be created if thewires
of the wiring already contain a wire that uses therequirement
This operation may resolve additional resources in order to resolve the dynamic requirement. The returned map will contain entries for each resource that got resolved in addition to the specified wiring
resource
. The wire list for the wiring resource will only contain one wire which is for the dynamic requirement.- Parameters:
context
- The resolve context for the resolve operation. Must not benull
.hostWiring
- The wiring with the dynamicrequirement
. Must not benull
.dynamicRequirement
- The dynamic requirement. Must not benull
.- Returns:
- The new resources and wires required to satisfy the specified dynamic requirement. The returned map is the property of the caller and can be modified by the caller. If no new wires were created then a ResolutionException is thrown.
- Throws:
ResolutionException
- if the dynamic requirement cannot be resolved
-