use of org.apache.felix.bundlerepository.DataModelHelper in project aries by apache.
the class OBRAriesResolver method addPlatformRepositories.
/* A 'platform repository' describes capabilities of the target runtime environment
* These should be added to the resolver without being listed as coming from a particular
* repository or bundle.
*/
private void addPlatformRepositories(Resolver obrResolver, String appName, PlatformRepository platformRepository) {
log.debug(LOG_ENTRY, "addPlatformRepositories", new Object[] { obrResolver, appName });
DataModelHelper helper = repositoryAdmin.getHelper();
if (platformRepository != null) {
Collection<URI> uris = platformRepository.getPlatformRepositoryURLs();
if ((uris != null) && (!uris.isEmpty())) {
for (URI uri : uris) {
InputStream is = null;
try {
is = uri.toURL().openStream();
Reader repoReader = new InputStreamReader(is);
Repository aPlatformRepo = helper.readRepository(repoReader);
Resource[] resources = aPlatformRepo.getResources();
for (Resource r : resources) {
Capability[] caps = r.getCapabilities();
for (Capability c : caps) {
obrResolver.addGlobalCapability(c);
}
}
} catch (Exception e) {
// not a big problem
log.error(MessageUtil.getMessage("RESOLVER_UNABLE_TO_READ_REPOSITORY_EXCEPTION", new Object[] { appName, uri }));
} finally {
IOUtils.close(is);
}
}
}
}
log.debug(LOG_EXIT, "addPlatformRepositories");
}
Aggregations