[jboss-cvs] JBossAS SVN: r87341 - in branches/Branch_5_x: tomcat/src/main/org/jboss/web/tomcat/service/deployers and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Apr 15 08:39:46 EDT 2009
Author: alesj
Date: 2009-04-15 08:39:46 -0400 (Wed, 15 Apr 2009)
New Revision: 87341
Modified:
branches/Branch_5_x/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java
Log:
Simple code refactoring.
Modified: branches/Branch_5_x/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
===================================================================
--- branches/Branch_5_x/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java 2009-04-15 12:26:23 UTC (rev 87340)
+++ branches/Branch_5_x/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java 2009-04-15 12:39:46 UTC (rev 87341)
@@ -54,7 +54,6 @@
import org.jboss.system.metadata.ServiceInjectionValueMetaData;
import org.jboss.system.metadata.ServiceMetaData;
import org.jboss.util.file.Files;
-import org.jboss.virtual.VFS;
import org.jboss.virtual.VFSUtils;
import org.jboss.virtual.VirtualFile;
import org.jboss.web.WebApplication;
@@ -95,8 +94,7 @@
protected boolean java2ClassLoadingCompliance = false;
/** A flag indicating if war archives should be unpacked */
protected boolean unpackWars = true;
- /** A flag indicating if local dirs with WEB-INF/web.xml should be treated as wars
- */
+ /** A flag indicating if local dirs with WEB-INF/web.xml should be treated as wars */
protected boolean acceptNonWarDirs = false;
/** If true, ejb-links that don't resolve don't cause an error (fallback to jndi-name) */
@@ -330,11 +328,7 @@
try
{
- /* Unpack wars to the tmp directory for now until tomcat can use the vfs directly. Since
- * the vfs deals with the distinction between a true directory, the only way we can tell from
- * this level of the api is to look for a url that ends in '/'. Here we assume that the name is
- * the root url.
- */
+ /* Unpack wars to the tmp directory for now until tomcat can use the vfs directly. */
String warName = unit.getName();
/**
@@ -345,7 +339,6 @@
if (unit instanceof VFSDeploymentUnit)
{
-
URL expWarUrl;
VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
@@ -391,11 +384,13 @@
// Indicate that an expanded URL exists
unit.addAttachment("org.jboss.web.expandedWarURL", expWarUrl, URL.class);
+ // add exploded VirtualFile directly
+ unit.addAttachment("org.jboss.web.expandedWarFile", unjared, VirtualFile.class);
}
else
{
expWarUrl = VFSUtils.getRealURL(root);
- }
+ }
// Resolve any ear relative alt-dd path to an expWarUrl/WEB-INF/alt-dd.xml file
String altDDPath = metaData.getAlternativeDD();
@@ -428,11 +423,13 @@
ClassLoadingMetaData classLoading = metaData.getClassLoading();
if (classLoading == null)
+ {
classLoading = new ClassLoadingMetaData();
+ metaData.setClassLoading(classLoading);
+ }
// pass in the java2ClassLoadingCompliance if it was not set at the war level
if (classLoading.wasJava2ClassLoadingComplianceSet() == false)
- classLoading.setJava2ClassLoadingCompliance(this.java2ClassLoadingCompliance);
- metaData.setClassLoading(classLoading);
+ classLoading.setJava2ClassLoadingCompliance(java2ClassLoadingCompliance);
// Build the context root if its not been set or is specified at the ear
String webContext = metaData.getContextRoot();
@@ -460,12 +457,10 @@
try
{
// Delete any expanded war
- URL warURL = unit.getAttachment("org.jboss.web.expandedWarURL", URL.class);
- if (warURL != null)
+ VirtualFile warFile = unit.getAttachment("org.jboss.web.expandedWarFile", VirtualFile.class);
+ if (warFile != null)
{
- // use vfs to cleanup/delete - since we created it with vfs
- VirtualFile file = VFS.getRoot(warURL);
- file.cleanup(); // it's temp, it will be deleted as well
+ warFile.cleanup(); // it's temp, it will be deleted as well
}
}
catch (Exception e)
Modified: branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java
===================================================================
--- branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java 2009-04-15 12:26:23 UTC (rev 87340)
+++ branches/Branch_5_x/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java 2009-04-15 12:39:46 UTC (rev 87341)
@@ -384,15 +384,15 @@
URL webXml = this.getClass().getClassLoader().getResource("web.xml");
if (webXml == null)
{
- webXml = this.getClass().getClassLoader().getResource("conf/web.xml");;
+ webXml = this.getClass().getClassLoader().getResource("conf/web.xml");
}
if (webXml == null)
throw new IllegalStateException("Unable to find shared web.xml or conf/web.xml");
+
SchemaBinding schema = JBossXBBuilder.build(Web25MetaData.class);
Web25MetaData confWebMD = (Web25MetaData) unmarshaller.unmarshal(webXml.toString(), schema);
sharedMetaData = new JBoss50WebMetaData();
sharedMetaData.merge(null, confWebMD);
-
}
@Override
@@ -406,7 +406,7 @@
*
* @param unit - the current web app deployment unit
* @param metaData - the parsed metdata for the web app deployment
- * @return TomcatDeployment instnace
+ * @return TomcatDeployment instance
*/
@Override
public AbstractWarDeployment getDeployment(DeploymentUnit unit, JBossWebMetaData metaData) throws Exception
@@ -418,22 +418,22 @@
.newInstance();
DeployerConfig config = new DeployerConfig();
- config.setDefaultSecurityDomain(this.defaultSecurityDomain);
- config.setSubjectAttributeName(this.subjectAttributeName);
+ config.setDefaultSecurityDomain(defaultSecurityDomain);
+ config.setSubjectAttributeName(subjectAttributeName);
config.setServiceClassLoader((getServiceClassLoader() == null)
? getClass().getClassLoader()
: getServiceClassLoader());
- config.setManagerClass(this.managerClass);
- config.setJava2ClassLoadingCompliance(this.java2ClassLoadingCompliance);
- config.setUnpackWars(this.unpackWars);
+ config.setManagerClass(managerClass);
+ config.setJava2ClassLoadingCompliance(java2ClassLoadingCompliance);
+ config.setUnpackWars(unpackWars);
config.setLenientEjbLink(this.lenientEjbLink);
config.setCatalinaDomain(catalinaDomain);
config.setContextClassName(contextClassName);
config.setServiceName(null);
- config.setSubjectAttributeName(this.subjectAttributeName);
- config.setUseJBossWebLoader(this.useJBossWebLoader);
- config.setAllowSelfPrivilegedWebApps(this.allowSelfPrivilegedWebApps);
- config.setSecurityManagerService(this.secMgrService);
+ config.setSubjectAttributeName(subjectAttributeName);
+ config.setUseJBossWebLoader(useJBossWebLoader);
+ config.setAllowSelfPrivilegedWebApps(allowSelfPrivilegedWebApps);
+ config.setSecurityManagerService(secMgrService);
config.setFilteredPackages(filteredPackages);
config.setSharedMetaData(sharedMetaData);
config.setDeleteWorkDirs(deleteWorkDirOnContextDestroy);
@@ -445,9 +445,11 @@
// Add a dependency on the webserver itself
List<String> depends = metaData.getDepends();
if (depends == null)
+ {
depends = new ArrayList<String>();
+ metaData.setDepends(depends);
+ }
depends.add(TOMCAT_SERVICE_NAME.getCanonicalName());
- metaData.setDepends(depends);
deployment.setServer(super.getServer());
deployment.init(config);
More information about the jboss-cvs-commits
mailing list