Author: markt
Date: Tue Jan 11 18:35:42 2011
New Revision: 1057788

URL: http://svn.apache.org/viewvc?rev=1057788&view=rev
Log:
Action review comments
Store deployIgnore as a Pattern in the Host

Modified:
    tomcat/trunk/java/org/apache/catalina/Host.java
    tomcat/trunk/java/org/apache/catalina/core/StandardHost.java
    tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java

Modified: tomcat/trunk/java/org/apache/catalina/Host.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Host.java?rev=1057788&r1=1057787&r2=1057788&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/Host.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Host.java Tue Jan 11 18:35:42 2011
@@ -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.

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=1057788&r1=1057787&r2=1057788&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardHost.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardHost.java Tue Jan 11 
18:35:42 2011
@@ -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 Contai
       * 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 Contai
      */
     @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 Contai
      */
     @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);
     }
 
 

Modified: tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=1057788&r1=1057787&r2=1057788&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java Tue Jan 11 
18:35:42 2011
@@ -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);
             }



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

Reply via email to