archive.addAsWebResource("OSGI-INF/blueprint/gravia-jaas-realm.xml", "OSGI-INF/blueprint/gravia-jaas-realm.xml");
archive.setManifest(new Asset() {
@Override
public InputStream openStream() {
if (ArchiveBuilder.getTargetContainer() == RuntimeType.KARAF) {
OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
builder.addBundleManifestVersion(2);
builder.addBundleSymbolicName(archive.getName());
builder.addBundleVersion("1.0.0");
builder.addManifestHeader(Constants.GRAVIA_ENABLED, Boolean.TRUE.toString());
builder.addImportPackages(RuntimeLocator.class, Servlet.class, HttpServlet.class, HttpService.class);
builder.addImportPackages(Subject.class, Callback.class, LoginContext.class);
builder.addImportPackage("org.apache.karaf.jaas.config");
builder.addImportPackage("org.apache.karaf.jaas.modules");
builder.addImportPackage("org.apache.karaf.jaas.modules.encryption");
builder.addImportPackage("org.apache.karaf.jaas.modules.properties");
builder.addImportPackages(Logger.class);
builder.addBundleClasspath("WEB-INF/classes");
return builder.openStream();
} else {
ManifestBuilder builder = new ManifestBuilder();
builder.addIdentityCapability("http-service-secure", "1.0.0");
return builder.openStream();
}
}
});
File[] libs = Maven.resolver().loadPomFromFile("pom.xml").resolve("org.apache.felix:org.apache.felix.http.proxy").withoutTransitivity().asFile();
archive.addAsLibraries(libs);