[jboss-cvs] JBossAS SVN: r58058 - trunk/server/src/main/org/jboss/deployment
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Nov 3 02:11:03 EST 2006
Author: scott.stark at jboss.org
Date: 2006-11-03 02:11:01 -0500 (Fri, 03 Nov 2006)
New Revision: 58058
Modified:
trunk/server/src/main/org/jboss/deployment/EARStructure.java
Log:
Include the top-level archives if the ear has no application.xml
Modified: trunk/server/src/main/org/jboss/deployment/EARStructure.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/EARStructure.java 2006-11-03 06:45:36 UTC (rev 58057)
+++ trunk/server/src/main/org/jboss/deployment/EARStructure.java 2006-11-03 07:11:01 UTC (rev 58058)
@@ -33,6 +33,7 @@
import org.jboss.metadata.XmlFileLoader;
import org.jboss.virtual.VirtualFile;
import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
import org.jboss.virtual.plugins.vfs.helpers.SuffixMatchFilter;
import org.w3c.dom.Element;
@@ -156,7 +157,20 @@
// TODO: need to scan for annotationss
if( scan )
{
-
+ // Just include the top-level archives for now
+ SuffixMatchFilter jarFilter = new SuffixMatchFilter(JarUtils.getSuffixes());
+ List<VirtualFile> archives = root.getChildren(jarFilter);
+ if( archives != null )
+ {
+ String earPath = root.getPathName();
+ for(VirtualFile archive : archives)
+ {
+ String path = earRelativePath(earPath, archive.getPathName());
+ int type = typeFromSuffix(path, archive);
+ J2eeModuleMetaData mod = new J2eeModuleMetaData(type, path);
+ j2eeMetaData.addModule(mod);
+ }
+ }
}
// Create subdeployments for the ear modules
@@ -198,6 +212,37 @@
return valid;
}
+ private int typeFromSuffix(String path, VirtualFile archive)
+ {
+ int type = 0;
+ if( path.endsWith(".war") )
+ type = J2eeModuleMetaData.WEB;
+ else if( path.endsWith(".rar") )
+ type = J2eeModuleMetaData.CONNECTOR;
+ else if( path.endsWith(".har") )
+ type = J2eeModuleMetaData.HAR;
+ else if( path.endsWith(".sar") )
+ type = J2eeModuleMetaData.SERVICE;
+ else if( path.endsWith(".jar") )
+ {
+ // Look for a META-INF/application-client.xml
+ VirtualFile xml = getMetaDataFile(archive, "META-INF/application-client.xml");
+ if( xml != null )
+ type = J2eeModuleMetaData.CLIENT;
+ else
+ type = J2eeModuleMetaData.EJB;
+ }
+
+ return type;
+ }
+
+ private String earRelativePath(String earPath, String pathName)
+ {
+ StringBuilder tmp = new StringBuilder(pathName);
+ tmp.delete(0, earPath.length());
+ return tmp.toString();
+ }
+
private VirtualFile getMetaDataFile(VirtualFile file, String path)
{
VirtualFile metaFile = null;
More information about the jboss-cvs-commits
mailing list