@Override
public XBundleRevision createResource() {
return new AbstractBundleRevisionAdaptor(syscontext, module);
}
};
XResource resource;
XResourceBuilder builder = XBundleRevisionBuilderFactory.create(factory);
if (metadata != null) {
builder.loadFrom(metadata);
resource = builder.getResource();
resource.addAttachment(OSGiMetaData.class, metadata);
} else {
builder.loadFrom(module);
resource = builder.getResource();
}
injectedEnvironment.getValue().installResources(resource);
// Set the start level of the adapted bundle
Integer bundleStartLevel = configcap.getStartLevel();
if (bundleStartLevel != null && bundleStartLevel > 0) {
StartLevel plugin = injectedStartLevel.getValue();
Long bundleId = resource.getAttachment(Long.class);
XBundle bundle = getBundleManager().getBundleById(bundleId);
plugin.setBundleStartLevel(bundle, bundleStartLevel);
}
return true;
}