Action review comments
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 11 Jan 2011 18:35:42 +0000 (18:35 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 11 Jan 2011 18:35:42 +0000 (18:35 +0000)
Store deployIgnore as a Pattern in the Host

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1057788 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/Host.java
java/org/apache/catalina/core/StandardHost.java
java/org/apache/catalina/startup/HostConfig.java

index 37b1f98..e827f20 100644 (file)
@@ -16,6 +16,8 @@
  */
 package org.apache.catalina;
 
+import java.util.regex.Pattern;
+
 
 /**
  * A <b>Host</b> is a Container that represents a virtual host in the
@@ -154,6 +156,14 @@ public interface Host extends Container {
 
 
     /**
+     * Return the compiled regular expression that defines the files and
+     * directories in the host's {@link #appBase} that will be ignored by the
+     * automatic deployment process.
+     */
+    public Pattern getDeployIgnorePattern();
+
+
+    /**
      * Set the regular expression that defines the files and directories in
      * the host's {@link #appBase} that will be ignored by the automatic
      * deployment process.
index d7a6055..c78dbe9 100644 (file)
@@ -22,6 +22,7 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.WeakHashMap;
+import java.util.regex.Pattern;
 
 import org.apache.catalina.Container;
 import org.apache.catalina.Context;
@@ -173,7 +174,7 @@ public class StandardHost extends ContainerBase implements Host {
       * be ignored by the automatic deployment process (both
       * {@link #deployOnStartup} and {@link #autoDeploy}).
       */
-     private String deployIgnore = null;
+     private Pattern deployIgnore = null;
 
 
     // ------------------------------------------------------------- Properties
@@ -515,6 +516,20 @@ public class StandardHost extends ContainerBase implements Host {
      */
     @Override
     public String getDeployIgnore() {
+        if (deployIgnore == null) {
+            return null;
+        } 
+        return this.deployIgnore.toString();
+    }
+
+
+    /**
+     * Return the compiled regular expression that defines the files and
+     * directories in the host's {@link #appBase} that will be ignored by the
+     * automatic deployment process.
+     */
+    @Override
+    public Pattern getDeployIgnorePattern() {
         return this.deployIgnore;
     }
 
@@ -526,11 +541,20 @@ public class StandardHost extends ContainerBase implements Host {
      */
     @Override
     public void setDeployIgnore(String deployIgnore) {
-        String oldDeployIgnore = this.deployIgnore;
-        this.deployIgnore = deployIgnore;
+        String oldDeployIgnore;
+        if (this.deployIgnore == null) {
+            oldDeployIgnore = null;
+        } else {
+            oldDeployIgnore = this.deployIgnore.toString();
+        }
+        if (deployIgnore == null) {
+            this.deployIgnore = null;
+        } else {
+            this.deployIgnore = Pattern.compile(deployIgnore);
+        }
         support.firePropertyChange("deployIgnore",
                                    oldDeployIgnore, 
-                                   this.deployIgnore);
+                                   deployIgnore);
     }
 
 
index 696d474..9d46ff5 100644 (file)
@@ -486,12 +486,14 @@ public class HostConfig
             return unfilteredAppPaths;
         }
         
-        Pattern filter = Pattern.compile(host.getDeployIgnore());
+        Pattern filter = host.getDeployIgnorePattern();
 
         List<String> filteredList = new ArrayList<String>();
         for (String appPath : unfilteredAppPaths) {
             if (filter.matcher(appPath).matches()) {
-                log.debug(sm.getString("hostConfig.ignorePath", appPath));
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("hostConfig.ignorePath", appPath));
+                }
             } else {
                 filteredList.add(appPath);
             }