wireMap.put(revision, (List<ResolverWire>) Collections.EMPTY_LIST);
List<ResolverWire> packageWires = new ArrayList<ResolverWire>();
BundleRequirement dynReq = null;
BundleCapability dynCand = null;
for (BundleRequirement req
: Util.getDynamicRequirements(revision.getWiring().getRequirements(null)))
{
// Get the candidates for the current dynamic requirement.
List<BundleCapability> candCaps = allCandidates.getCandidates(req);
// Optional requirements may not have any candidates.
if ((candCaps == null) || candCaps.isEmpty())
{
continue;
}
// Record the dynamic requirement.
dynReq = req;
dynCand = candCaps.get(0);
// Can only dynamically import one at a time, so break
// out of the loop after the first.
break;
}
if (dynReq != null)
{
if (dynCand.getRevision().getWiring() == null)
{
populateWireMap(dynCand.getRevision(), revisionPkgMap, wireMap,
allCandidates);
}
packageWires.add(
new ResolverWireImpl(
revision,
dynReq,
getDeclaringBundleRevision(dynCand.getRevision()),
getDeclaredCapability(dynCand)));
}
wireMap.put(revision, packageWires);