org.osgi.service.resolver

## Interface Resolver

All Known Implementing Classes:
  ResolverImpl

    @ProviderType
    public interface Resolver

A resolver service resolves the specified resources in the context supplied by the caller.

Author:
  $Id: e4011e12a98088d382bb7f5b27817213734f6504 $

### Method Summary

All Methods Instance Methods Abstract Methods
`Map<org.osgi.resource.Resource,List<org.osgi.resource.Wire>>` `resolve(ResolveContext context)` Resolve the specified resolve context and return any new resources and wires to the caller.
`Map<org.osgi.resource.Resource,List<org.osgi.resource.Wire>>` `resolveDynamic(ResolveContext context, org.osgi.resource.Wiring hostWiring, org.osgi.resource.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 Detail

#### resolve

    Map<org.osgi.resource.Resource,List<org.osgi.resource.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` - The resolve context for the resolve operation. Must not be `null`.
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.

#### resolveDynamic

    Map<org.osgi.resource.Resource,List<org.osgi.resource.Wire>> resolveDynamic(ResolveContext context,
                                                                                org.osgi.resource.Wiring hostWiring,
                                                                                org.osgi.resource.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` - The resolve context for the resolve operation. Must not be `null`.
  `hostWiring` - The wiring with the dynamic `requirement`. Must not be `null`.
  `dynamicRequirement` - The dynamic requirement. Must not be `null`.
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