org.osgi.service.resolver
Interface Environment

All Known Subinterfaces:
FelixEnvironment

public interface Environment

An environment provides options and constraints to the potential solution of a Resolver.resolve(Environment, Collection, Collection) operation.

Environments:

An environment may be used to provide capabilities via local resources and/or remote repositories.

A resolver may call the findProviders(Requirement), isEffective(Requirement) and getWirings() method any number of times during a resolve using any thread. Environments may also be shared between several resolvers. As such implementors should ensure that this class is properly synchronized.


Method Summary
 java.util.SortedSet<Capability> findProviders(Requirement requirement)
          Find any capabilities that match the supplied requirement.
 java.util.Map<Resource,Wiring> getWirings()
          An immutable map of wirings for resources.
 boolean isEffective(Requirement requirement)
          Test if a given requirement should be wired in a given resolve operation.
 

Method Detail

findProviders

java.util.SortedSet<Capability> findProviders(Requirement requirement)
Find any capabilities that match the supplied requirement.

A resolver should use the iteration order or the returned capability collection to infer preference in the case where multiple capabilities match a requirement. Capabilities at the start of the iteration are implied to be preferred over capabilities at the end.

Parameters:
requirement - the requirement that a resolver is attempting to satisfy
Returns:
an collection of capabilities that match the supplied requirement
Throws:
java.lang.NullPointerException - if the requirement is null

isEffective

boolean isEffective(Requirement requirement)
Test if a given requirement should be wired in a given resolve operation. If this method returns false then the resolver should ignore this requirement during this resolve operation.

The primary use case for this is to test the effective directive on the requirement, though implementations are free to use this for any other purposes.

Parameters:
requirement - the Requirement to test
Returns:
true if the requirement should be considered as part of this resolve operation
Throws:
java.lang.NullPointerException - if requirement is null

getWirings

java.util.Map<Resource,Wiring> getWirings()
An immutable map of wirings for resources. Multiple calls to this method for the same environment object must result in the same set of wirings.

Returns:
the wirings already defined in this environment


Copyright © 2006-2012 The Apache Software Foundation. All Rights Reserved.