public BundleFrameworkConfiguration createBundleFrameworkConfig(String frameworkId,
BundleContext parentCtx, AriesApplication app)
{
BundleFrameworkConfiguration config = null;
DeploymentMetadata metadata = app.getDeploymentMetadata();
/**
* Set up framework config properties
*/
Properties frameworkConfig = new Properties();
String flowedSystemPackages = EquinoxFrameworkUtils.calculateSystemPackagesToFlow(
EquinoxFrameworkUtils.getSystemExtraPkgs(parentCtx), metadata.getImportPackage());
frameworkConfig.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, flowedSystemPackages);
/**
* Set up BundleManifest for the framework bundle
*/
Properties frameworkBundleManifest = new Properties();
frameworkBundleManifest.put(Constants.BUNDLE_SYMBOLICNAME, metadata
.getApplicationSymbolicName());
frameworkBundleManifest.put(Constants.BUNDLE_VERSION, metadata.getApplicationVersion()
.toString());
/**
* Set up Import-Package header for framework manifest
*/
// Extract the import packages and remove anything we already have available in the current framework
Collection<Content> imports = EquinoxFrameworkUtils.calculateImports(metadata
.getImportPackage(), EquinoxFrameworkUtils.getExportPackages(parentCtx));
if (imports != null && !imports.isEmpty()) {
StringBuffer buffer = new StringBuffer();
for (Content i : imports)
buffer.append(EquinoxFrameworkUtils.contentToString(i) + ",");
frameworkBundleManifest.put(Constants.IMPORT_PACKAGE, buffer
.substring(0, buffer.length() - 1));
}
/**
* Set up CompositeServiceFilter-Import header for framework manifest
*/
StringBuffer serviceImportFilter = new StringBuffer("(" + Constants.OBJECTCLASS + "="
+ EquinoxFrameworkConstants.TRANSACTION_REGISTRY_BUNDLE + ")");
for (Filter importFilter : metadata.getDeployedServiceImport()) {
if (serviceImportFilter.length() > 0) {
serviceImportFilter.append(",");
}
serviceImportFilter.append(importFilter.toString());
}