public ModuleIdentifier getModuleIdentifier(XBundleRevision brev) {
XBundle bundle = brev.getBundle();
Deployment deployment = bundle.adapt(Deployment.class);
ModuleIdentifier identifier = deployment.getAttachment(ModuleIdentifier.class);
if (identifier == null) {
XIdentityCapability icap = brev.getIdentityCapability();
List<XBundleRevision> allrevs = bundle.getAllBundleRevisions();
String name = icap.getSymbolicName();
if (allrevs.size() > 1) {
name += "-rev" + (allrevs.size() - 1);
}
identifier = ModuleIdentifier.create(MODULE_PREFIX + name, "" + icap.getVersion());
}
return identifier;
}