List<RequireDescription> requireDescriptions = checkPoint.getResolving().getRequireDescriptions();
if (!requireDescriptions.isEmpty())
{
CheckPoint result = null;
RequireDescription requireDescription = requireDescriptions.remove(0);
for (CandidateBundle candidate : ResolverUtils.collectEligibleBundlesFromUsed(requireDescription, checkPoint))
{
if (candidate instanceof Resolved)
{
try
{
Resolved resolvedHost = (Resolved) candidate;
result = doResolve(checkPoint.newCheckPointUsed(resolvedHost, requireDescription));
}
catch (IncompatibleException ie)
{
LOGGER.log(Level.FINEST, "Incompatible collection of host and required bundle", ie);
}
}
else if (candidate instanceof UnBound)
{
assert false;
}
else
{
try
{
BoundHost bound = (BoundHost) candidate;
result = doResolve(checkPoint.newCheckPoint(bound, requireDescription));
}
catch (IncompatibleException ie)
{
LOGGER.log(Level.FINEST, "Incompatible collection of host and required bundle", ie);
}
}
if (result != null) return result;
}
for (Candidate candidate : ResolverUtils.collectEligibleBundlesFromUnused(requireDescription, checkPoint))
{
if (candidate instanceof Resolved)
{
try
{
Resolved resolvedHost = (Resolved) candidate;
result = doResolve(checkPoint.newCheckPointUnused(resolvedHost, requireDescription));
}
catch (IncompatibleException ie)
{
LOGGER.log(Level.FINEST, "Incompatible collection of host and required bundle", ie);
}
}
else if (candidate instanceof UnBound)
{
UnBound unBound = (UnBound) candidate;
result = doResolve(checkPoint.newCheckPoint(unBound, requireDescription));
}
else
{
assert false;
}
if (result != null) return result;
}
if (requireDescription.getResolution() == Resolution.MANDATORY) return null;
}
return resolveWires(checkPoint);
}