public class ResolverImpl extends Object implements FelixResolver
Constructor and Description |
---|
ResolverImpl(Logger logger) |
Modifier and Type | Method and Description |
---|---|
Map<Resource,List<Wire>> |
resolve(Environment env,
Collection<Resource> mandatoryRevisions,
Collection<Resource> optionalRevisions)
Attempt to resolve the resources based on the specified environment and
return any new resources and wires to the caller.
|
Map<Resource,List<Wire>> |
resolve(FelixEnvironment env,
Collection<? extends Resource> mandatoryRevisions,
Collection<? extends Resource> optionalRevisions,
Collection<? extends Resource> ondemandFragments) |
Map<Resource,List<Wire>> |
resolve(FelixEnvironment env,
Resource resource,
Requirement req,
SortedSet<Capability> candidates,
Collection<? extends Resource> ondemandFragments) |
public ResolverImpl(Logger logger)
public Map<Resource,List<Wire>> resolve(Environment env, Collection<Resource> mandatoryRevisions, Collection<Resource> optionalRevisions)
Resolver
The resolver considers two groups of resources:
ResolutionException
The resolve method returns the delta between the start state defined by
Environment#getWiring()
and the end resolved state, i.e. only new
resources and wires are included. To get the complete resolution the caller
can merge the start state and the delta using something like the following:
Map<Resource, List<Wire>> delta = resolver.resolve(env, resources, null); Map<Resource, List<Wire>> wiring = env.getWiring(); for (Map.Entry<Resource, List<Wire>> e : delta.entrySet()) { Resource res = e.getKey(); List<Wire> newWires = e.getValue(); List<Wire> currentWires = wiring.get(res); if (currentWires != null) { newWires.addAll(currentWires); } wiring.put(res, newWires); }
For a given resolve operation the parameters to the resolve method should be considered immutable. This means that resources should have constant capabilities and requirements and an environment should return a consistent set of capabilities, wires and effective requirements.
The behavior of the resolver is not defined if resources or the environment supply inconsistent information.
resolve
in interface Resolver
env
- the environment into which to resolve the requirementsmandatoryRevisions
- The resources that must be resolved during this resolution step or
null if no resources must be resolvedoptionalRevisions
- Any resources which the resolver should attempt to resolve but
that will not cause an exception if resolution is impossible or
null if no resources are optional.public Map<Resource,List<Wire>> resolve(FelixEnvironment env, Collection<? extends Resource> mandatoryRevisions, Collection<? extends Resource> optionalRevisions, Collection<? extends Resource> ondemandFragments)
resolve
in interface FelixResolver
public Map<Resource,List<Wire>> resolve(FelixEnvironment env, Resource resource, Requirement req, SortedSet<Capability> candidates, Collection<? extends Resource> ondemandFragments)
resolve
in interface FelixResolver
Copyright © 2006-2013 The Apache Software Foundation. All Rights Reserved.