You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/10/11 14:23:11 UTC

svn commit: r1181749 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/startup/HostConfig.java java/org/apache/catalina/startup/LocalStrings.properties webapps/docs/changelog.xml

Author: markt
Date: Tue Oct 11 12:23:10 2011
New Revision: 1181749

URL: http://svn.apache.org/viewvc?rev=1181749&view=rev
Log:
Simplify deployment code
Use full paths in log messages to remove ambiguity

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 11 12:23:10 2011
@@ -1 +1 @@
-/tomcat/trunk:1156115,1156171,1156276,1156304,1156519,1156530,1156602,1157015,1157018,1157151,1157198,1157204,1157810,1157832,1157834,1157847,1157908,1157939,1158155,1158160,1158176,1158195,1158198-1158199,1158227,1158331,1158334-1158335,1158426,1160347,1160592,1160611,1160619,1160626,1160639,1160652,1160720-1160721,1160772,1160774,1160776,1161303,1161310,1161322,1161339,1161486,1161540,1161549,1161584,1162082,1162149,1162169,1162721,1162769,1162836,1162932,1163630,1164419,1164438,1164469,1164480,1164567,1165234,1165247-1165248,1165253,1165273,1165282,1165309,1165331,1165338,1165347,1165360-1165361,1165367-1165368,1165602,1165608,1165677,1165693,1165721,1165723,1165728,1165730,1165738,1165746,1165765,1165777,1165918,1165921,1166077,1166150-1166151,1166290,1166366,1166620,1166686,1166752,1166757,1167368,1167394,1169447,1170647,1171692,1172233-1172234,1172236,1172269,1172278,1172282,1172610,1172664,1172689,1172711,1173020-1173021,1173082,1173088,1173090,1173096,1173241,1173256
 ,1173288,1173333,1173342,1173461,1173614,1173630,1173659,1173722,1174061,1174239,1174322,1174325,1174329-1174330,1174337-1174339,1174343,1174353,1174799,1174882,1174884,1174983,1175155,1175158,1175167,1175182,1175190,1175201,1175272,1175275,1175283,1175582,1175589-1175590,1175594,1175602,1175613,1175633,1175690,1175713,1175889,1175896,1175907,1176584,1176590,1176799,1177050,1177060,1177125,1177152,1177160,1177245,1177850,1177862,1177978,1178209,1178228,1178233,1178449,1178542,1178681,1178721,1180261,1180907,1181028,1181123,1181125,1181136
+/tomcat/trunk:1156115,1156171,1156276,1156304,1156519,1156530,1156602,1157015,1157018,1157151,1157198,1157204,1157810,1157832,1157834,1157847,1157908,1157939,1158155,1158160,1158176,1158195,1158198-1158199,1158227,1158331,1158334-1158335,1158426,1160347,1160592,1160611,1160619,1160626,1160639,1160652,1160720-1160721,1160772,1160774,1160776,1161303,1161310,1161322,1161339,1161486,1161540,1161549,1161584,1162082,1162149,1162169,1162721,1162769,1162836,1162932,1163630,1164419,1164438,1164469,1164480,1164567,1165234,1165247-1165248,1165253,1165273,1165282,1165309,1165331,1165338,1165347,1165360-1165361,1165367-1165368,1165602,1165608,1165677,1165693,1165721,1165723,1165728,1165730,1165738,1165746,1165765,1165777,1165918,1165921,1166077,1166150-1166151,1166290,1166366,1166620,1166686,1166752,1166757,1167368,1167394,1169447,1170647,1171692,1172233-1172234,1172236,1172269,1172278,1172282,1172610,1172664,1172689,1172711,1173020-1173021,1173082,1173088,1173090,1173096,1173241,1173256
 ,1173288,1173333,1173342,1173461,1173614,1173630,1173659,1173722,1174061,1174239,1174322,1174325,1174329-1174330,1174337-1174339,1174343,1174353,1174799,1174882,1174884,1174983,1175155,1175158,1175167,1175182,1175190,1175201,1175272,1175275,1175283,1175582,1175589-1175590,1175594,1175602,1175613,1175633,1175690,1175713,1175889,1175896,1175907,1176584,1176590,1176799,1177050,1177060,1177125,1177152,1177160,1177245,1177850,1177862,1177978,1178209,1178228,1178233,1178449,1178542,1178681,1178721,1180261,1180907,1181028,1181123,1181125,1181136,1181291,1181743

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=1181749&r1=1181748&r2=1181749&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java Tue Oct 11 12:23:10 2011
@@ -522,16 +522,15 @@ public class HostConfig
         // Deploy XML descriptors from configBase
         File xml = new File(configBase, baseName + ".xml");
         if (xml.exists())
-            deployDescriptor(cn, xml, baseName + ".xml");
+            deployDescriptor(cn, xml);
         // Deploy WARs, and loop if additional descriptors are found
         File war = new File(appBase, baseName + ".war");
         if (war.exists())
-            deployWAR(cn, war, baseName + ".war");
+            deployWAR(cn, war);
         // Deploy expanded folders
         File dir = new File(appBase, baseName);
         if (dir.exists())
-            deployDirectory(cn, dir, baseName);
-        
+            deployDirectory(cn, dir);
     }
 
 
@@ -553,9 +552,7 @@ public class HostConfig
                 if (isServiced(name))
                     continue;
                 
-                String file = files[i];
-
-                deployDescriptor(cn, contextXml, file);
+                deployDescriptor(cn, contextXml);
             }
         }
     }
@@ -564,9 +561,8 @@ public class HostConfig
     /**
      * @param cn
      * @param contextXml
-     * @param file
      */
-    protected void deployDescriptor(ContextName cn, File contextXml, String file) {
+    protected void deployDescriptor(ContextName cn, File contextXml) {
         if (deploymentExists(cn.getName())) {
             return;
         }
@@ -575,8 +571,8 @@ public class HostConfig
 
         // Assume this is a configuration descriptor and deploy it
         if(log.isInfoEnabled()) {
-            log.info(sm.getString("hostConfig.deployDescriptor", file,
-                    configBase.getPath()));
+            log.info(sm.getString("hostConfig.deployDescriptor",
+                    contextXml.getAbsolutePath()));
         }
 
         Context context = null;
@@ -585,8 +581,9 @@ public class HostConfig
                 try {
                     context = (Context) digester.parse(contextXml);
                     if (context == null) {
-                        log.error(sm.getString("hostConfig.deployDescriptor.error",
-                                file));
+                        log.error(sm.getString(
+                                "hostConfig.deployDescriptor.error",
+                                contextXml.getAbsolutePath()));
                         return;
                     }
                 } finally {
@@ -678,7 +675,7 @@ public class HostConfig
         } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);
             log.error(sm.getString("hostConfig.deployDescriptor.error",
-                                   file), t);
+                                   contextXml.getAbsolutePath()), t);
         }
 
         if (context != null && host.findChild(context.getName()) != null) {
@@ -718,9 +715,7 @@ public class HostConfig
                 if (isServiced(cn.getName()))
                     continue;
                 
-                String file = files[i];
-                
-                deployWAR(cn, dir, file);
+                deployWAR(cn, dir);
             }
         }
     }
@@ -765,9 +760,8 @@ public class HostConfig
     /**
      * @param cn
      * @param war
-     * @param file
      */
-    protected void deployWAR(ContextName cn, File war, String file) {
+    protected void deployWAR(ContextName cn, File war) {
         
         if (deploymentExists(cn.getName()))
             return;
@@ -779,12 +773,10 @@ public class HostConfig
         BufferedOutputStream ostream = null;
         File xml;
         if (copyXML) {
-            xml = new File(configBase(),
-                    file.substring(0, file.lastIndexOf(".")) + ".xml");
+            xml = new File(configBase(), cn.getBaseName() + ".xml");
         } else {
             xml = new File(appBase(),
-                    file.substring(0, file.lastIndexOf(".")) +
-                    "/META-INF/context.xml");
+                    cn.getBaseName() + "/META-INF/context.xml");
         }
         boolean xmlInWar = false;
         
@@ -850,7 +842,8 @@ public class HostConfig
         
         // Deploy the application in this WAR file
         if(log.isInfoEnabled()) 
-            log.info(sm.getString("hostConfig.deployWar", file));
+            log.info(sm.getString("hostConfig.deployWar",
+                    war.getAbsolutePath()));
 
         try {
             Context context = null;
@@ -859,8 +852,9 @@ public class HostConfig
                     try {
                         context = (Context) digester.parse(xml);
                         if (context == null) {
-                            log.error(sm.getString("hostConfig.deployDescriptor.error",
-                                    file));
+                            log.error(sm.getString(
+                                    "hostConfig.deployDescriptor.error",
+                                    war.getAbsolutePath()));
                             return;
                         }
                     } finally {
@@ -880,7 +874,7 @@ public class HostConfig
                         if (context == null) {
                             log.error(sm.getString(
                                     "hostConfig.deployDescriptor.error",
-                                    file));
+                                    war.getAbsolutePath()));
                             return;
                         }
                         context.setConfigFile(new URL("jar:" +
@@ -928,7 +922,7 @@ public class HostConfig
             context.setName(cn.getName());
             context.setPath(cn.getPath());
             context.setWebappVersion(cn.getVersion());
-            context.setDocBase(file);
+            context.setDocBase(cn.getBaseName() + ".war");
             host.addChild(context);
             // If we're unpacking WARs, the docBase will be mutated after
             // starting the context
@@ -947,7 +941,8 @@ public class HostConfig
             }
         } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);
-            log.error(sm.getString("hostConfig.deployWar.error", file), t);
+            log.error(sm.getString("hostConfig.deployWar.error",
+                    war.getAbsolutePath()), t);
         }
         
         deployed.put(cn.getName(), deployedApp);
@@ -975,7 +970,7 @@ public class HostConfig
                 if (isServiced(cn.getName()))
                     continue;
 
-                deployDirectory(cn, dir, files[i]);
+                deployDirectory(cn, dir);
             }
         }
     }
@@ -984,9 +979,8 @@ public class HostConfig
     /**
      * @param cn
      * @param dir
-     * @param file
      */
-    protected void deployDirectory(ContextName cn, File dir, String file) {
+    protected void deployDirectory(ContextName cn, File dir) {
         
         if (deploymentExists(cn.getName()))
             return;
@@ -995,7 +989,8 @@ public class HostConfig
 
         // Deploy the application in this directory
         if( log.isInfoEnabled() ) 
-            log.info(sm.getString("hostConfig.deployDir", file));
+            log.info(sm.getString("hostConfig.deployDir",
+                    dir.getAbsolutePath()));
         try {
             Context context = null;
             File xml = new File(dir, Constants.ApplicationContextXml);
@@ -1015,7 +1010,7 @@ public class HostConfig
                     }
                 }
                 if (copyXML) {
-                    xmlCopy = new File(configBase(), file + ".xml");
+                    xmlCopy = new File(configBase(), cn.getBaseName() + ".xml");
                     InputStream is = null;
                     OutputStream os = null;
                     try {
@@ -1051,7 +1046,7 @@ public class HostConfig
             context.setName(cn.getName());
             context.setPath(cn.getPath());
             context.setWebappVersion(cn.getVersion());
-            context.setDocBase(file);
+            context.setDocBase(cn.getBaseName());
             host.addChild(context);
             deployedApp.redeployResources.put(dir.getAbsolutePath(),
                     Long.valueOf(dir.lastModified()));
@@ -1069,7 +1064,8 @@ public class HostConfig
             addWatchedResources(deployedApp, dir.getAbsolutePath(), context);
         } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);
-            log.error(sm.getString("hostConfig.deployDir.error", file), t);
+            log.error(sm.getString("hostConfig.deployDir.error", 
+                    dir.getAbsolutePath()), t);
         }
 
         deployed.put(cn.getName(), deployedApp);

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=1181749&r1=1181748&r2=1181749&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties Tue Oct 11 12:23:10 2011
@@ -81,7 +81,7 @@ hostConfig.context.remove=Error while re
 hostConfig.context.restart=Error during context [{0}] restart
 hostConfig.createDirs=Unable to create directory for deployment: {0}
 hostConfig.deploy=Deploying web application directory {0}
-hostConfig.deployDescriptor=Deploying configuration descriptor {0} from {1}
+hostConfig.deployDescriptor=Deploying configuration descriptor {0}
 hostConfig.deployDescriptor.error=Error deploying configuration descriptor {0}
 hostConfig.deployDescriptor.localDocBaseSpecified=A docBase {0} inside the host appBase has been specified, and will be ignored
 hostConfig.deployDir=Deploying web application directory {0}

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1181749&r1=1181748&r2=1181749&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Oct 11 12:23:10 2011
@@ -79,10 +79,10 @@
         <bug>51972</bug>: Correctly handle protocol relative URLs when used with
         <code>sendRedirect()</code>. (markt)
       </fix>
-      <update>
-        Update the package re-named copy of Commons BCEL (formerly Jakarta BCEL)
-        to the latest code from Commons BCEL trunk. (markt)
-      </update>
+      <scode>
+        Simplify the deployment code and use full paths in log messages to
+        remove any ambiguity in where a context is being deployed from. (markt)  
+      </scode>
     </changelog>
   </subsection>
   <subsection name="Coyote">
@@ -119,6 +119,10 @@
   </subsection>
   <subsection name="Other">
     <changelog>
+      <update>
+        Update the package re-named copy of Commons BCEL (formerly Jakarta BCEL)
+        to the latest code from Commons BCEL trunk. (markt)
+      </update>
       <scode>Remove some unused code from the packaged renamed Commons BCEL.
       (markt)</scode>
     </changelog>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org