throws ResolverException {
log.debug(LOG_ENTRY, "resolve", new Object[]{appName, appVersion,byValueBundles, inputs});
Collection<ImportedBundle> importedBundles = toImportedBundle(inputs);
Collection<ModelledResource> toReturn = new ArrayList<ModelledResource>();
Resolver obrResolver = getConfiguredObrResolver(appName, appVersion, byValueBundles, platformRepository);
// add a resource describing the requirements of the application metadata.
obrResolver.add(createApplicationResource( appName, appVersion, importedBundles));
if (obrResolver.resolve()) {
List<Resource> requiredResources = retrieveRequiredResources(obrResolver);
if (requiredResources == null) {
log.debug("resolver.getRequiredResources() returned null");
} else {
for (Resource r : requiredResources) {
NameValueMap<String, String> attribs = new NameValueMap<String, String>();
attribs.put(Constants.VERSION_ATTRIBUTE, "[" + r.getVersion() + ',' + r.getVersion()
+ "]");
ModelledResource modelledResourceForThisMatch = null;
// OBR may give us back the global capabilities. Typically these do not have a bundle symbolic name - they're a
// list of packages available in the target runtime environment. If the resource has no symbolic name, we can ignore it
if (r.getSymbolicName() != null) {
try {
modelledResourceForThisMatch = new ModelledBundleResource (r, modellingManager, modellingHelper);
} catch (InvalidAttributeException iax) {
ResolverException re = new ResolverException("Internal error occurred: " + iax.toString());
log.debug(LOG_EXIT, "resolve", re);
throw re;
}
toReturn.add(modelledResourceForThisMatch);
}
}
}
log.debug(LOG_EXIT, "resolve", toReturn);
return toReturn;
} else {
Reason[] reasons = obrResolver.getUnsatisfiedRequirements();
// let's refine the list by removing the indirect unsatisfied bundles that are caused by unsatisfied packages or other bundles
Map<String,Set<String>> refinedReqs = refineUnsatisfiedRequirements(obrResolver, reasons);
StringBuffer reqList = new StringBuffer();
List<String> unsatisfiedRequirements = new LinkedList<String>();