Skip to content

Commit

Permalink
AS7-1361 Move Modules Dependencies 'enrichment' to Protocol-JMX-AS7.
Browse files Browse the repository at this point in the history
The JMX-AS7 Protocol needs to enrich the Deployed archive with Dependencies on the Arquillian Service. This enrichment needs to be a part of the Protocol and not Container to avoid the same enrcihment leak into other Protocols e.g. Servlet. Adding these Dependencies with out deploying the Arquillian Service cause deployment exception.
  • Loading branch information
aslakknutsen authored and stuartwdouglas committed Aug 16, 2011
1 parent 561483f commit cc91865
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 284 deletions.

This file was deleted.

Expand Up @@ -30,7 +30,7 @@ public class CommonContainerExtension implements LoadableExtension {

@Override
public void register(ExtensionBuilder builder) {
builder.service(ApplicationArchiveProcessor.class, DelegatingApplicationArchiveProcessor.class);
builder.service(ApplicationArchiveProcessor.class, OSGiApplicationArchiveProcessor.class);
builder.service(DeploymentExceptionTransformer.class, ExceptionTransformer.class);
}
}

This file was deleted.

Expand Up @@ -32,23 +32,18 @@
*
* @author <a href="kabir.khan@jboss.com">Kabir Khan</a>
*/
public class ManifestUtils {
class ManifestUtils {

public static Manifest getManifest(Archive<?> archive, boolean create) {
Manifest manifest = null;
public static Manifest getManifest(Archive<?> archive) {
try {
Node node = archive.get(JarFile.MANIFEST_NAME);
if (node == null) {
manifest = new Manifest();
Attributes attributes = manifest.getMainAttributes();
attributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
} else if (create) {
manifest = new Manifest(node.getAsset().openStream());
if (node != null && node.getAsset() != null) {
return new Manifest(node.getAsset().openStream());
}
return manifest;
} catch (Exception ex) {
throw new IllegalStateException("Cannot obtain manifest", ex);
}
return null;
}

public static Manifest getOrCreateManifest(Archive<?> archive) {
Expand Down

This file was deleted.

Expand Up @@ -25,6 +25,9 @@

import org.jboss.arquillian.container.osgi.AbstractOSGiApplicationArchiveProcessor;
import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.test.spi.TestClass;
import org.jboss.osgi.spi.util.BundleInfo;
import org.jboss.shrinkwrap.api.Archive;


/**
Expand All @@ -35,8 +38,25 @@
*/
public class OSGiApplicationArchiveProcessor extends AbstractOSGiApplicationArchiveProcessor
{
@Override
public void process(Archive<?> appArchive, TestClass testClass) {
if(isValidOSGiBundle(appArchive)) {
super.process(appArchive, testClass);
}
}

@Override
protected Manifest createBundleManifest(String symbolicName) {
return null;
}

private boolean isValidOSGiBundle(Archive<?> appArchive) {
Manifest manifest = ManifestUtils.getManifest(appArchive);
if(manifest != null) {
if(BundleInfo.isValidBundleManifest(manifest)) {
return true;
}
}
return false;
}
}

0 comments on commit cc91865

Please sign in to comment.