// Create parallel arrays for requirement and proposed candidate
// capability or actual capability if revision is resolved or not.
List<Requirement> reqs = new ArrayList();
List<Capability> caps = new ArrayList();
boolean isDynamicImporting = false;
Wiring wiring = env.getWirings().get(resource);
if (wiring != null)
{
// Use wires to get actual requirements and satisfying capabilities.
for (Wire wire : wiring.getRequiredResourceWires(null))
{
// Wrap the requirement as a hosted requirement if it comes
// from a fragment, since we will need to know the host. We
// also need to wrap if the requirement is a dynamic import,
// since that requirement will be shared with any other
// matching dynamic imports.
Requirement r = wire.getRequirement();
if (!r.getResource().equals(wire.getRequirer())
|| ((r.getDirectives()
.get(ResourceConstants.REQUIREMENT_RESOLUTION_DIRECTIVE) != null)
// TODO: RFC-112 - Need dynamic constant.
&& r.getDirectives()
.get(ResourceConstants.REQUIREMENT_RESOLUTION_DIRECTIVE).equals("dynamic")))
{
r = new HostedRequirement(wire.getRequirer(), r);
}
// Wrap the capability as a hosted capability if it comes
// from a fragment, since we will need to know the host.
Capability c = wire.getCapability();
if (!c.getResource().equals(wire.getProvider()))
{
c = new HostedCapability(wire.getProvider(), c);
}
reqs.add(r);
caps.add(c);
}
// Since the revision is resolved, it could be dynamically importing,
// so check to see if there are candidates for any of its dynamic
// imports.
for (Requirement req
: Util.getDynamicRequirements(wiring.getResourceRequirements(null)))
{
// Get the candidates for the current requirement.
SortedSet<Capability> candCaps = allCandidates.getCandidates(req);
// Optional requirements may not have any candidates.
if (candCaps == null)