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 groupmust be resolved. A failure to satisfy any mandatory requirement for these resources will result in throwing aResolutionException - Optional - any resource in the
optional groupmay 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
requirementof the wiring and must use thepackagenamespace with aresolutionof typedynamic.The resolve context is not asked for
mandatoryresources or foroptionalresources. The resolve context is asked tofind providersfor the given requirement. The matchingpackagecapabilities returned by the resolve context must not have aosgi.wiring.packageattribute equal to apackagecapability alreadywired toby the wiring or equal apackagecapabilityprovidedby the wiring. The resolve context may be requested tofind providersfor other requirements in order to resolve the resources that provide the matching capabilities to the given requirement.If the requirement
cardinalityis notmultiplethen no new wire must be created if thewiresof the wiring already contain a wire that uses therequirementThis 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
-