[jboss-cvs] JBossAS SVN: r101612 - in projects/jboss-deployers/trunk/deployers-vfs/src: test/java/org/jboss/test/deployers/vfs/structure/explicit/test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Feb 27 23:53:17 EST 2010
Author: johnbailey
Date: 2010-02-27 23:53:17 -0500 (Sat, 27 Feb 2010)
New Revision: 101612
Modified:
projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/explicit/DeclaredStructure.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/explicit/test/DeclaredStructureUnitTestCase.java
Log:
[JBDEPLOY-242] - Added support for mounting inner archives in DeclaredStructure
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/explicit/DeclaredStructure.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/explicit/DeclaredStructure.java 2010-02-28 04:26:42 UTC (rev 101611)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/explicit/DeclaredStructure.java 2010-02-28 04:53:17 UTC (rev 101612)
@@ -26,6 +26,8 @@
import java.util.Set;
import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.StructureMetaData;
import org.jboss.deployers.vfs.plugins.structure.AbstractVFSArchiveStructureDeployer;
import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
import org.jboss.deployers.vfs.spi.structure.StructureContext;
@@ -101,6 +103,7 @@
Unmarshaller unmarshaller = factory.newUnmarshaller();
StructureMetaDataObjectFactory ofactory = new StructureMetaDataObjectFactory();
unmarshaller.unmarshal(url.toString(), ofactory, structureContext.getMetaData());
+ mountChildren(structureContext);
isJBossStructure = true;
}
}
@@ -119,4 +122,32 @@
}
return false;
}
+
+ /**
+ * Iterate through the contexts and mount anything that looks like an archive
+ *
+ * @param structureContext the context
+ * @throws IOException if errors occur during mounting
+ */
+ private void mountChildren(StructureContext structureContext) throws IOException
+ {
+ final StructureMetaData structureMetaData = structureContext.getMetaData();
+ final VirtualFile structureRoot = structureContext.getRoot();
+ if(structureContext != null)
+ {
+ for(ContextInfo contextInfo : structureMetaData.getContexts())
+ {
+ final String contextPath = contextInfo.getPath();
+ if(hasValidSuffix(contextPath))
+ {
+ final VirtualFile child = structureRoot.getChild(contextPath);
+ if(child.exists() && child.isFile())
+ {
+ performMount(child);
+ }
+ }
+ }
+ }
+
+ }
}
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/explicit/test/DeclaredStructureUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/explicit/test/DeclaredStructureUnitTestCase.java 2010-02-28 04:26:42 UTC (rev 101611)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/explicit/test/DeclaredStructureUnitTestCase.java 2010-02-28 04:53:17 UTC (rev 101612)
@@ -30,6 +30,7 @@
import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
import org.jboss.test.deployers.vfs.structure.AbstractStructureTest;
+import org.jboss.vfs.VirtualFile;
/**
* DeclaredStructure deployer unit tests.
@@ -95,4 +96,13 @@
}
});
}
+
+ public void testArchiveWithStructure() throws Throwable
+ {
+ VFSDeploymentContext root = assertDeploy("/structure/explicit", "explicit.ear");
+ assertMetaData(root, "META-INF");
+ assertChildContexts(root, "inner.war");
+ VirtualFile war = root.getRoot().getChild("inner.war");
+ assertTrue(war.exists() && war.isDirectory());
+ }
}
More information about the jboss-cvs-commits
mailing list