org.apache.felix.resolver.impl
Class ResolverImpl
java.lang.Object
org.apache.felix.resolver.impl.ResolverImpl
- All Implemented Interfaces:
- FelixResolver, Resolver
public class ResolverImpl
- extends java.lang.Object
- implements FelixResolver
|
Method Summary |
java.util.Map<Resource,java.util.List<Wire>> |
resolve(Environment env,
java.util.Collection<? extends Resource> mandatoryRevisions,
java.util.Collection<? extends Resource> optionalRevisions)
Attempt to resolve the resources based on the specified environment and
return any new resources and wires to the caller. |
java.util.Map<Resource,java.util.List<Wire>> |
resolve(Environment env,
java.util.Collection<? extends Resource> mandatoryRevisions,
java.util.Collection<? extends Resource> optionalRevisions,
java.util.Collection<? extends Resource> ondemandFragments)
|
java.util.Map<Resource,java.util.List<Wire>> |
resolve(Environment env,
Resource resource,
Requirement req,
java.util.SortedSet<Capability> candidates,
java.util.Collection<? extends Resource> ondemandFragments)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ResolverImpl
public ResolverImpl(Logger logger)
resolve
public java.util.Map<Resource,java.util.List<Wire>> resolve(Environment env,
java.util.Collection<? extends Resource> mandatoryRevisions,
java.util.Collection<? extends Resource> optionalRevisions)
- Description copied from interface:
Resolver
- Attempt to resolve the resources based on the specified environment 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 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 this resource.
Delta
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);
}
Consistency
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.
- Specified by:
resolve in interface Resolver
- Parameters:
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.
- Returns:
- the new resources and wires required to satisfy the requirements
resolve
public java.util.Map<Resource,java.util.List<Wire>> resolve(Environment env,
java.util.Collection<? extends Resource> mandatoryRevisions,
java.util.Collection<? extends Resource> optionalRevisions,
java.util.Collection<? extends Resource> ondemandFragments)
- Specified by:
resolve in interface FelixResolver
resolve
public java.util.Map<Resource,java.util.List<Wire>> resolve(Environment env,
Resource resource,
Requirement req,
java.util.SortedSet<Capability> candidates,
java.util.Collection<? extends Resource> ondemandFragments)
- Specified by:
resolve in interface FelixResolver
Copyright © 2006-2012 The Apache Software Foundation. All Rights Reserved.