archive.addClasses(CamelTransformHttpActivator.class, BundleActivatorBridge.class);
archive.setManifest(new Asset() {
@Override
public InputStream openStream() {
if (ArchiveBuilder.getTargetContainer() == RuntimeType.KARAF) {
OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
builder.addBundleManifestVersion(2);
builder.addBundleSymbolicName(RESOURCE_D);
builder.addBundleActivator(BundleActivatorBridge.class);
builder.addManifestHeader(Constants.MODULE_ACTIVATOR, CamelTransformHttpActivator.class.getName());
builder.addImportPackages(BundleActivatorBridge.class, Runtime.class, Servlet.class, HttpServlet.class, HttpService.class);
builder.addImportPackages(CamelContext.class, DefaultCamelContext.class, RouteBuilder.class, RouteDefinition.class);
builder.addBundleClasspath("WEB-INF/classes");
return builder.openStream();
} else {
ManifestBuilder builder = new ManifestBuilder();
builder.addIdentityCapability(RESOURCE_D, Version.emptyVersion);
builder.addManifestHeader(Constants.MODULE_ACTIVATOR, CamelTransformHttpActivator.class.getName());
builder.addManifestHeader("Dependencies", "org.apache.camel.core");
return builder.openStream();
}
}
});
return archive;
}