}
private Module installSharedResource(Resource resource, File targetFile) throws Exception {
// Get a resource copy with updated content capability
DefaultResourceBuilder builder = new DefaultResourceBuilder();
for (Capability cap : resource.getCapabilities(null)) {
String namespace = cap.getNamespace();
if (!ContentNamespace.CONTENT_NAMESPACE.equals(namespace)) {
builder.addCapability(namespace, cap.getAttributes(), cap.getDirectives());
}
}
builder.addContentCapability(targetFile.toURI().toURL());
for (Requirement req : resource.getRequirements(null)) {
builder.addRequirement(req.getNamespace(), req.getAttributes(), req.getDirectives());
}
resource = builder.getResource();
// Add the module to the {@link SharedModuleClassLoader}
SharedModuleClassLoader.addSharedModule(resource);
Runtime runtime = RuntimeLocator.getRequiredRuntime();