File contentFile = getRepositoryEntry(bundlesDir, moduleIdentifier);
if (contentFile != null) {
URL baseURL = bundlesDir.toURI().toURL();
String contentPath = contentFile.toURI().toURL().toExternalForm();
contentPath = contentPath.substring(baseURL.toExternalForm().length());
XResource resource = XResourceBuilder.create(baseURL, contentPath).getResource();
result.add(resource.getIdentityCapability());
} else {
contentFile = getRepositoryEntry(modulesDir, moduleIdentifier);
if (contentFile != null) {
URL baseURL = modulesDir.toURI().toURL();
String contentPath = contentFile.toURI().toURL().toExternalForm();
contentPath = contentPath.substring(baseURL.toExternalForm().length());
XResource resource = XResourceBuilder.create(baseURL, contentPath).getResource();
result.add(resource.getIdentityCapability());
}
}
} catch (RepositoryResolutionException ex) {
throw ex;
} catch (Exception ex) {