tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1239520 - in /tomcat/trunk/java/org/apache/catalina: core/ ha/deploy/ manager/ manager/host/ realm/ users/ valves/
Date Thu, 02 Feb 2012 10:30:58 GMT
Author: markt
Date: Thu Feb  2 10:30:58 2012
New Revision: 1239520

URL: http://svn.apache.org/viewvc?rev=1239520&view=rev
Log:
Obtain CATALINA_BASE in consistent way (though Container).
Note: still some direct access to system property to review.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
    tomcat/trunk/java/org/apache/catalina/core/StandardHost.java
    tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
    tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java
    tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java
    tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
    tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java
    tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java
    tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java

Modified: tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java?rev=1239520&r1=1239519&r2=1239520&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java Thu Feb  2 10:30:58 2012
@@ -1359,6 +1359,9 @@ public abstract class ContainerBase exte
         }
 
         if (base == null) {
+            // In theory this should never happen. In 'standard' usage the start
+            // scripts will set the system property. In embedded usage either
+            // the system property will be set or it will be set explicitly.
             return null;
         }
 

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardHost.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardHost.java?rev=1239520&r1=1239519&r2=1239520&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardHost.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardHost.java Thu Feb  2 10:30:58 2012
@@ -16,7 +16,6 @@
  */
 package org.apache.catalina.core;
 
-
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -29,7 +28,6 @@ import java.util.regex.Pattern;
 
 import org.apache.catalina.Container;
 import org.apache.catalina.Context;
-import org.apache.catalina.Globals;
 import org.apache.catalina.Host;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleEvent;
@@ -41,7 +39,6 @@ import org.apache.catalina.mbeans.MBeanU
 import org.apache.catalina.valves.ValveBase;
 import org.apache.tomcat.util.ExceptionUtils;
 
-
 /**
  * Standard implementation of the <b>Host</b> interface.  Each
  * child container must be a Context implementation to process the
@@ -208,9 +205,7 @@ public class StandardHost extends Contai
 
         // If not absolute, make it absolute
         if (!file.isAbsolute()) {
-            // This system property should always be set
-            file = new File(System.getProperty(Globals.CATALINA_BASE_PROP),
-                    file.getPath());
+            file = new File(getCatalinaBase(), file.getPath());
         }
 
         // Make it canonical if possible

Modified: tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java?rev=1239520&r1=1239519&r2=1239520&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java Thu Feb  2 10:30:58
2012
@@ -27,7 +27,6 @@ import javax.management.ObjectName;
 import org.apache.catalina.Container;
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
-import org.apache.catalina.Globals;
 import org.apache.catalina.Host;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.ha.ClusterDeployer;
@@ -162,8 +161,7 @@ public class FarmWarDeployer extends Clu
             }
         }
 
-        configBase = new File(
-                System.getProperty(Globals.CATALINA_BASE_PROP), "conf");
+        configBase = new File(engine.getCatalinaBase(), "conf");
         configBase = new File(configBase, engine.getName());
         configBase = new File(configBase, hostname);
 

Modified: tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java?rev=1239520&r1=1239519&r2=1239520&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java Thu Feb  2 10:30:58
2012
@@ -14,11 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.catalina.manager;
 
-
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -44,7 +41,6 @@ import org.apache.catalina.Container;
 import org.apache.catalina.ContainerServlet;
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
-import org.apache.catalina.Globals;
 import org.apache.catalina.Host;
 import org.apache.catalina.Manager;
 import org.apache.catalina.Server;
@@ -474,7 +470,7 @@ public class ManagerServlet extends Http
         // Identify the appBase of the owning Host of this Context
         // (if any)
         deployed = ((Host) context.getParent()).getAppBaseFile();
-        configBase = new File(System.getProperty(Globals.CATALINA_BASE_PROP), "conf");
+        configBase = new File(context.getCatalinaBase(), "conf");
         Container container = context;
         Container host = null;
         Container engine = null;

Modified: tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java?rev=1239520&r1=1239519&r2=1239520&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java Thu Feb  2
10:30:58 2012
@@ -14,11 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.catalina.manager.host;
 
-
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -40,7 +37,6 @@ import org.apache.catalina.Container;
 import org.apache.catalina.ContainerServlet;
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
-import org.apache.catalina.Globals;
 import org.apache.catalina.Host;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.core.ContainerBase;
@@ -375,7 +371,7 @@ public class HostManagerServlet
             file = new File(appBase);
         }
         if (!file.isAbsolute())
-            file = new File(System.getProperty(Globals.CATALINA_BASE_PROP), file.getPath());
+            file = new File(engine.getCatalinaBase(), file.getPath());
         try {
             appBaseFile = file.getCanonicalFile();
         } catch (IOException e) {
@@ -691,8 +687,7 @@ public class HostManagerServlet
      * Get config base.
      */
     protected File getConfigBase(String hostName) {
-        File configBase =
-            new File(System.getProperty(Globals.CATALINA_BASE_PROP), "conf");
+        File configBase = new File(context.getCatalinaBase(), "conf");
         if (!configBase.exists()) {
             return null;
         }

Modified: tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java?rev=1239520&r1=1239519&r2=1239520&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java Thu Feb  2 10:30:58
2012
@@ -14,11 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.catalina.realm;
 
-
 import java.io.File;
 import java.io.IOException;
 import java.security.Principal;
@@ -36,7 +33,6 @@ import javax.security.auth.login.LoginEx
 import javax.security.auth.spi.LoginModule;
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.catalina.Globals;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.digester.Digester;
@@ -345,7 +341,7 @@ public class JAASMemoryLoginModule exten
         // Validate the existence of our configuration file
         File file = new File(pathname);
         if (!file.isAbsolute())
-            file = new File(System.getProperty(Globals.CATALINA_BASE_PROP), pathname);
+            file = new File(getContainer().getCatalinaBase(), pathname);
         if (!file.exists() || !file.canRead()) {
             log.warn("Cannot load configuration file " + file.getAbsolutePath());
             return;

Modified: tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java?rev=1239520&r1=1239519&r2=1239520&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java Thu Feb  2 10:30:58 2012
@@ -14,18 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.catalina.realm;
 
-
 import java.io.File;
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.catalina.Globals;
 import org.apache.catalina.LifecycleException;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -267,7 +263,7 @@ public class MemoryRealm  extends RealmB
         // Validate the existence of our database file
         File file = new File(pathname);
         if (!file.isAbsolute())
-            file = new File(System.getProperty(Globals.CATALINA_BASE_PROP), pathname);
+            file = new File(getContainer().getCatalinaBase(), pathname);
         if (!file.exists() || !file.canRead())
             throw new LifecycleException
                 (sm.getString("memoryRealm.loadExist",

Modified: tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java?rev=1239520&r1=1239519&r2=1239520&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java Thu Feb  2 10:30:58
2012
@@ -516,9 +516,8 @@ public class MemoryUserDatabase implemen
 
 
     /**
-     * Check for permissions to save this user database
-     * to persistent storage location
-     *
+     * Check for permissions to save this user database to persistent storage
+     * location.
      */
     public boolean isWriteable() {
 
@@ -529,7 +528,6 @@ public class MemoryUserDatabase implemen
         }
         File dir = file.getParentFile();
         return dir.exists() && dir.isDirectory() && dir.canWrite();
-
     }
 
 

Modified: tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java?rev=1239520&r1=1239519&r2=1239520&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java Thu Feb  2 10:30:58 2012
@@ -1062,7 +1062,7 @@ public class AccessLogValve extends Valv
         // Create the directory if necessary
         File dir = new File(directory);
         if (!dir.isAbsolute()) {
-            dir = new File(System.getProperty(Globals.CATALINA_BASE_PROP), directory);
+            dir = new File(getContainer().getCatalinaBase(), directory);
         }
         if (!dir.mkdirs() && !dir.isDirectory()) {
             log.error(sm.getString("accessLogValve.openDirFail", dir));



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


Mime
View raw message