addEECapability(capIndex, compatibleEE);
}
// Add system.bundle alias
Version frameworkVersion = Utils.findIdentityVersion(frameworkResource);
capIndex.addCapability(new CapReqBuilder(BundleNamespace.BUNDLE_NAMESPACE).addAttribute(BundleNamespace.BUNDLE_NAMESPACE, Constants.SYSTEM_BUNDLE_SYMBOLICNAME)
.addAttribute(BundleNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE, frameworkVersion).setResource(frameworkResource).buildCapability());
capIndex.addCapability(new CapReqBuilder(HostNamespace.HOST_NAMESPACE).addAttribute(HostNamespace.HOST_NAMESPACE, Constants.SYSTEM_BUNDLE_SYMBOLICNAME)
.addAttribute(HostNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE, frameworkVersion).setResource(frameworkResource).buildCapability());
// Add JRE packages
loadJREPackages();
// Add system.packages.extra
if (sysPkgsExtra != null)
for (ExportedPackage sysPkg : sysPkgsExtra) {
CapReqBuilder builder = new CapReqBuilder(PackageNamespace.PACKAGE_NAMESPACE);
builder.addAttribute(PackageNamespace.PACKAGE_NAMESPACE, sysPkg.getName());
String versionStr = sysPkg.getVersionString();
Version version = versionStr != null ? new Version(versionStr) : Version.emptyVersion;
builder.addAttribute(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE, version);
Capability cap = builder.setResource(framework).buildCapability();
capIndex.addCapability(cap);
}
// Add system capabilities extra
if (sysCapsExtraParams != null) {
for (Entry<String,Attrs> entry : sysCapsExtraParams.entrySet()) {
CapReqBuilder builder = new CapReqBuilder(entry.getKey());
for (String attrKey : entry.getValue().keySet()) {
if (attrKey.endsWith(":")) {
String directiveKey = attrKey.substring(0, attrKey.length() - 1);
builder.addDirective(directiveKey, entry.getValue().get(attrKey));
} else {
builder.addAttribute(attrKey, entry.getValue().getTyped(attrKey));
}
}
builder.setResource(frameworkResource);
capIndex.addCapability(builder.buildCapability());
}
}
}