public class AbstractResolveContext extends XResolveContext
XResolveContext
.Constructor and Description |
---|
AbstractResolveContext(XEnvironment environment) |
Modifier and Type | Method and Description |
---|---|
List<org.osgi.resource.Capability> |
findProviders(org.osgi.resource.Requirement req)
Find Capabilities that match the given Requirement.
|
protected Comparator<org.osgi.resource.Capability> |
getComparator() |
XEnvironment |
getEnvironment() |
Map<org.osgi.resource.Resource,org.osgi.resource.Wiring> |
getWirings()
Returns the wirings for existing resolved resources.
|
int |
insertHostedCapability(List<org.osgi.resource.Capability> caps,
HostedCapability hostedCapability)
Add a
HostedCapability to the list of capabilities returned from
ResolveContext.findProviders(Requirement) . |
boolean |
isEffective(org.osgi.resource.Requirement req)
Test if a given requirement should be wired in the resolve operation.
|
getMandatoryResources, getOptionalResources
public AbstractResolveContext(XEnvironment environment)
protected Comparator<org.osgi.resource.Capability> getComparator()
public XEnvironment getEnvironment()
getEnvironment
in class XResolveContext
public List<org.osgi.resource.Capability> findProviders(org.osgi.resource.Requirement req)
ResolveContext
The returned list contains Capability
objects where the Resource
must be the declared Resource of the Capability. The Resolver can then
add additional HostedCapability
objects with the
ResolveContext.insertHostedCapability(List, HostedCapability)
method when it,
for example, attaches fragments. Those HostedCapability
objects
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
ResolveContext.insertHostedCapability(List, HostedCapability)
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
osgi.wiring.package
namespace.
findProviders
in class ResolveContext
req
- The requirement that a resolver is attempting to
satisfy. Must not be null
.Capability
objects that match the specified
requirement.public int insertHostedCapability(List<org.osgi.resource.Capability> caps, HostedCapability hostedCapability)
ResolveContext
HostedCapability
to the list of capabilities returned from
ResolveContext.findProviders(Requirement)
.
This method is used by the Resolver
to add Capabilities that are
hosted by another Resource to the list of Capabilities returned from
ResolveContext.findProviders(Requirement)
. 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 HostedCapability
.
insertHostedCapability
in class ResolveContext
caps
- The list returned from
ResolveContext.findProviders(Requirement)
. Must not be null
.hostedCapability
- The HostedCapability to insert in the specified
list. Must not be null
.public boolean isEffective(org.osgi.resource.Requirement req)
ResolveContext
false
, then the resolver should ignore this
requirement during the resolve operation.
The primary use case for this is to test the effective
directive
on the requirement, though implementations are free to use any effective
test.
isEffective
in class ResolveContext
req
- The Requirement to test. Must not be null
.true
if the requirement should be considered as part of
the resolve operation.public Map<org.osgi.resource.Resource,org.osgi.resource.Wiring> getWirings()
ResolveContext
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.
getWirings
in class ResolveContext
Copyright © 2013 JBoss by Red Hat. All Rights Reserved.