o.a.tomcat.util.net should not depend on o.a.catalina
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 11 Dec 2010 21:14:45 +0000 (21:14 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 11 Dec 2010 21:14:45 +0000 (21:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1044723 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/AbstractEndpoint.java
java/org/apache/tomcat/util/net/Constants.java [new file with mode: 0644]
java/org/apache/tomcat/util/net/JIoEndpoint.java
java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java
res/checkstyle/org-import-control.xml

index ada0951..ff77f30 100644 (file)
@@ -28,7 +28,6 @@ import java.util.concurrent.TimeUnit;
 
 import javax.net.ssl.KeyManagerFactory;
 
-import org.apache.catalina.Globals;
 import org.apache.coyote.RequestGroupInfo;
 import org.apache.juli.logging.Log;
 import org.apache.tomcat.util.IntrospectionUtils;
@@ -586,7 +585,8 @@ public abstract class AbstractEndpoint {
     private String keystoreFile = System.getProperty("user.home")+"/.keystore";
     public String getKeystoreFile() { return keystoreFile;}
     public void setKeystoreFile(String s ) {
-        String file = adjustRelativePath(s, System.getProperty(Globals.CATALINA_BASE_PROP));
+        String file = adjustRelativePath(s,
+                System.getProperty(Constants.CATALINA_BASE_PROP));
         this.keystoreFile = file;
     }
 
@@ -633,7 +633,8 @@ public abstract class AbstractEndpoint {
     private String truststoreFile = System.getProperty("javax.net.ssl.trustStore");
     public String getTruststoreFile() {return truststoreFile;}
     public void setTruststoreFile(String s) {
-        String file = adjustRelativePath(s, System.getProperty(Globals.CATALINA_BASE_PROP));
+        String file = adjustRelativePath(s,
+                System.getProperty(Constants.CATALINA_BASE_PROP));
         this.truststoreFile = file;
     }
 
diff --git a/java/org/apache/tomcat/util/net/Constants.java b/java/org/apache/tomcat/util/net/Constants.java
new file mode 100644 (file)
index 0000000..67ed493
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tomcat.util.net;
+
+public class Constants {
+
+    /**
+     * Name of the system property containing
+     * the tomcat instance installation path
+     */
+    public static final String CATALINA_BASE_PROP = "catalina.base";
+
+
+    /**
+     * Has security been turned on?
+     */
+    public static final boolean IS_SECURITY_ENABLED =
+        (System.getSecurityManager() != null);
+}
index 38893e6..23fa87c 100644 (file)
@@ -28,7 +28,6 @@ import java.util.Iterator;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.RejectedExecutionException;
 
-import org.apache.catalina.Globals;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.ExceptionUtils;
@@ -508,7 +507,7 @@ public class JIoEndpoint extends AbstractEndpoint {
                 ClassLoader loader = Thread.currentThread().getContextClassLoader();
                 try {
                     //threads should not be created by the webapp classloader
-                    if (Globals.IS_SECURITY_ENABLED) {
+                    if (Constants.IS_SECURITY_ENABLED) {
                         PrivilegedAction<Void> pa = new PrivilegedSetTccl(
                                 getClass().getClassLoader());
                         AccessController.doPrivileged(pa);
@@ -522,7 +521,7 @@ public class JIoEndpoint extends AbstractEndpoint {
                     }
                     getExecutor().execute(proc);
                 }finally {
-                    if (Globals.IS_SECURITY_ENABLED) {
+                    if (Constants.IS_SECURITY_ENABLED) {
                         PrivilegedAction<Void> pa = new PrivilegedSetTccl(loader);
                         AccessController.doPrivileged(pa);
                     } else {
index 7e8ca6f..7a6a608 100644 (file)
@@ -58,8 +58,8 @@ import javax.net.ssl.TrustManager;
 import javax.net.ssl.TrustManagerFactory;
 import javax.net.ssl.X509KeyManager;
 
-import org.apache.catalina.Globals;
 import org.apache.tomcat.util.net.AbstractEndpoint;
+import org.apache.tomcat.util.net.Constants;
 import org.apache.tomcat.util.net.ServerSocketFactory;
 import org.apache.tomcat.util.res.StringManager;
 
@@ -370,8 +370,8 @@ public class JSSESocketFactory implements ServerSocketFactory {
                     "".equalsIgnoreCase(path))) {
                 File keyStoreFile = new File(path);
                 if (!keyStoreFile.isAbsolute()) {
-                    keyStoreFile = new File(System.getProperty(Globals.CATALINA_BASE_PROP),
-                                            path);
+                    keyStoreFile = new File(System.getProperty(
+                            Constants.CATALINA_BASE_PROP), path);
                 }
                 istream = new FileInputStream(keyStoreFile);
             }
@@ -612,7 +612,8 @@ public class JSSESocketFactory implements ServerSocketFactory {
 
         File crlFile = new File(crlf);
         if( !crlFile.isAbsolute() ) {
-            crlFile = new File(System.getProperty(Globals.CATALINA_BASE_PROP), crlf);
+            crlFile = new File(
+                    System.getProperty(Constants.CATALINA_BASE_PROP), crlf);
         }
         Collection<? extends CRL> crls = null;
         InputStream is = null;
index ea23ff9..e5f488f 100644 (file)
@@ -91,7 +91,6 @@
       <allow pkg="org.apache.tomcat.util"/>
       <disallow pkg="org.apache.util.scan"/>
       <!-- To remove? -->
-      <allow class="org.apache.catalina.Globals"/>
       <allow class="org.apache.coyote.RequestGroupInfo"/>
       <!-- end to remove -->
       <subpackage name="scan">