Top Description Methods
org.osgi.service.resolver

public Interface Resolver

Annotations
@ProviderType
Imports
java.util.List, .Map, org.osgi.annotation.versioning.ProviderType, org.osgi.framework.namespace.PackageNamespace, org.osgi.resource.Namespace, .Requirement, .Resource, .Wire, .Wiring

A resolver service resolves the specified resources in the context supplied by the caller.
Author
$Id: e4011e12a98088d382bb7f5b27817213734f6504 $

Method Summary

Modifier and TypeMethod and Description
public Map<Resource, List<Wire>>

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.
resolve
(ResolveContext
The resolve context for the resolve operation. Must not be null.
context
)

Resolve the specified resolve context and return any new resources and wires to the caller.

public Map<Resource, List<Wire>>

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.
resolveDynamic
(ResolveContext
The resolve context for the resolve operation. Must not be null.
context
,
Wiring
The wiring with the dynamic requirement. Must not be null.
hostWiring
,
Requirement
The dynamic requirement. Must not be null.
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 Detail

resolveback to summary
public Map<Resource, List<Wire>> resolve(ResolveContext context) throws ResolutionException

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 a ResolutionException
  • 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:ResolveContext

The resolve context for the resolve operation. Must not be null.

Returns:Map<Resource, List<Wire>>

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.

Exceptions
ResolutionException:
If the resolution cannot be satisfied.
resolveDynamicback to summary
public 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 the package namespace with a resolution of type dynamic.

The resolve context is not asked for mandatory resources or for optional resources. The resolve context is asked to find providers for the given requirement. The matching package capabilities returned by the resolve context must not have a osgi.wiring.package attribute equal to a package capability already wired to by the wiring or equal a package capability provided by the wiring. The resolve context may be requested to find providers for other requirements in order to resolve the resources that provide the matching capabilities to the given requirement.

If the requirement cardinality is not multiple then no new wire must be created if the wires of the wiring already contain a wire that uses the requirement

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:ResolveContext

The resolve context for the resolve operation. Must not be null.

hostWiring:Wiring

The wiring with the dynamic requirement. Must not be null.

dynamicRequirement:Requirement

The dynamic requirement. Must not be null.

Returns:Map<Resource, List<Wire>>

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.

Exceptions
ResolutionException:
if the dynamic requirement cannot be resolved