* Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
capabilitiesthat the Resolver can use to satisfy
method. A wiring consists of a map of existing
A resolver may call the methods on the resolve context any number of times during a resolve operation using any thread. Implementors should ensure that this class is properly thread safe.
resolve context methods must be idempotent. This means that resources
must have constant capabilities and requirements and the resolve context must
return a consistent set of capabilities, wires and effective requirements.
The default implementation returns an empty collection.
The returned list contains
objects where the Resource
must be the declared Resource of the Capability. The Resolver can then
objects with the
method when it,
for example, attaches fragments. Those
will then use the host's Resource which likely differs from the declared
Resource of the corresponding Capability.
The returned list is in priority order such that the Capabilities with a
lower index have a preference over those with a higher index. The
resolver must use the
method to add
additional Capabilities to maintain priority order. In general, this is
necessary when the Resolver uses Capabilities declared in a Resource but
that must originate from an attached host.
Each returned Capability must match the given Requirement. This implies
that the filter in the Requirement must match as well as any namespace
specific directives. For example, the mandatory attributes for the
requirementThe requirement that a resolver is attempting to satisfy. Must not be
objects that match the specified requirement.
to the list of capabilities returned from
This method is used by the
to add Capabilities that are
hosted by another Resource to the list of Capabilities returned from
. This function is necessary to allow
fragments to attach to hosts, thereby changing the origin of a
Capability. This method must insert the specified HostedCapability in a
place that makes the list maintain the preference order. It must return
the index in the list of the inserted
capabilitiesThe list returned from
. Must not be
hostedCapabilityThe HostedCapability to insert in the specified list. Must not be
public abstract int insertHostedCapability(List<Capability> capabilities, HostedCapability hostedCapability);
false, then the resolver should ignore this requirement during the resolve operation.
The primary use case for this is to test the
on the requirement, though implementations are free to use any effective
requirementThe Requirement to test. Must not be
trueif the requirement should be considered as part of the resolve operation.
For example, if this resolve context is for an OSGi framework, then the result would contain all the currently resolved bundles with each bundle's current wiring.
Multiple calls to this method for this resolve context must return the same result.