struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvanma...@apache.org
Subject svn commit: r373997 - in /struts/shale/trunk: clay-plugin/src/java/org/apache/shale/clay/config/beans/ clay-plugin/src/java/org/apache/shale/clay/faces/ core-library/src/java/org/apache/shale/application/ use-cases/src/java/org/apache/shale/usecases/ro...
Date Wed, 01 Feb 2006 05:38:09 GMT
Author: gvanmatre
Date: Tue Jan 31 21:37:51 2006
New Revision: 373997

URL: http://svn.apache.org/viewcvs?rev=373997&view=rev
Log:
Applied a fix for bug 37867 reopened by Richarad Wallace.  The cascading style sheets were
not loading due to the Clay file watch dog filter command.  This command was not overriding
enough of the default behavior in AbstractRegExpFilter.  

Added some cleanup items identified by David Geary.

Modified:
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ConfigDefinitionsWatchdogFilter.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateComponentConfigBean.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java
    struts/shale/trunk/core-library/src/java/org/apache/shale/application/AbstractRegExpFilter.java
    struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/Rolodex.java
    struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/WebPagerRenderer.java

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java?rev=373997&r1=373996&r2=373997&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java
(original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java
Tue Jan 31 21:37:51 2006
@@ -66,7 +66,7 @@
     
     /**
      * <p>This parameter is initialized from the <code>init</code>
-     * method from the <code>auto-reload-clay-files</code> init 
+     * method from the <code>org.apache.shale.clay.AUTO_RELOAD_CONFIG_FILES</code>
init 
      * parameter in the web.xml.  The default value is <code>true</code>
      * which will trigger reloading the files when a change has occurred.
      * </p>

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ConfigDefinitionsWatchdogFilter.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ConfigDefinitionsWatchdogFilter.java?rev=373997&r1=373996&r2=373997&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ConfigDefinitionsWatchdogFilter.java
(original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ConfigDefinitionsWatchdogFilter.java
Tue Jan 31 21:37:51 2006
@@ -18,12 +18,21 @@
 
 package org.apache.shale.clay.config.beans;
 
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.shale.application.AbstractRegExpFilter;
 import org.apache.shale.faces.ShaleWebContext;
 
 public class ConfigDefinitionsWatchdogFilter extends AbstractRegExpFilter {
 
     /**
+     * <p>Log instance for this class.</p>
+     */
+    private static final Log log = LogFactory.getLog(ConfigDefinitionsWatchdogFilter.class);
+
+    
+    /**
      * <p>Return the servlet path (if any) concatenated with the path info
      * (if any) for this request.</p>
      *
@@ -43,17 +52,42 @@
 
     }
 
+    
     /**
-     * <p>Override the base implementation to ignore this condition.</p>
-     * 
-     * @param context <code>Context</code> for the current request
+     * <p>Perform the matching algorithm against the value 
+     * returned by the <code>value()</code> method.  If the 
+     * value <code>matches()</code> the <code>includes</code>
+     * pattern list, the {@link org.apache.shale.clay.component.Clay} 
+     * configuration files are checked for changes and reloaded.</p>
+     *
+     * @param context <code>ShaleWebContext</code> for this request
      */
-    protected void reject(ShaleWebContext context) throws Exception {
+    public boolean execute(Context context) throws Exception {
+
+        // Acquire the value to be tested
+        ShaleWebContext webContext = (ShaleWebContext) context;
+        String value = value(webContext);
+        if (log.isDebugEnabled()) {
+            log.debug("execute(" + value + ")");
+        }
+
+        // Check for a match on the included list
+        if (value != null && matches(value, getIncludesPatterns(), true)) {
+            if (log.isTraceEnabled()) {
+                log.trace("  accept(include)");
+            }
+            accept(webContext);
+        }
+
+        return false;
+
     }
 
+    
     /**
      * <p>Trigger reloading of the {@link org.apache.shale.clay.component.Clay}'s
-     * xml configuration files if the <code>org.apache.shale.clay.AUTO_RELOAD_CONFIG_FILES</code>
init 
+     * xml configuration files if the 
+     * <code>org.apache.shale.clay.AUTO_RELOAD_CONFIG_FILES</code> init 
      * parameter is set to <code>true</code> in the web.xml.  The HTML templates
      * are re-cashed on-demand due to their atomicity.  The XML configuration 
      * files are shared by all {@link org.apache.shale.clay.component.Clay} 
@@ -66,7 +100,6 @@
            
         ConfigBeanFactory.refresh();
     }
-    
-    
+        
     
 }

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateComponentConfigBean.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateComponentConfigBean.java?rev=373997&r1=373996&r2=373997&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateComponentConfigBean.java
(original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateComponentConfigBean.java
Tue Jan 31 21:37:51 2006
@@ -72,10 +72,12 @@
             // adds the watcher to a map identified by name
             watchDogs.put(watchDog.getName(), watchDog);
 
-            // loads the config files
-            watchDog.refresh(true);
+	        // loads the config files
+	        watchDog.refresh(true);
+
         }
-        
+
+
         param = null;
     }
     

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java?rev=373997&r1=373996&r2=373997&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java
(original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java
Tue Jan 31 21:37:51 2006
@@ -77,6 +77,10 @@
            //loads the HTML template the first time and when file 
            //has been modified
            watchDog.refresh(false);
+        } else {
+		   //check to see if an existing html template 
+		   //needs reloaded
+	       watchDog.refresh(false);
         }
         
         // returns the cached element

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java?rev=373997&r1=373996&r2=373997&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java
(original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java
Tue Jan 31 21:37:51 2006
@@ -270,7 +270,7 @@
      * <p>HTML form markers for client side state saving for MyFaces and Sun RI 
      * implementations.</p> 
      */
-    protected static final String[] FORM_MAKKERS = {"com.sun.faces.saveStateFieldMarker",
"<!--@@JSF_FORM_STATE_MARKER@@-->"};
+    protected static final String[] FORM_MARKERS = {"com.sun.faces.saveStateFieldMarker",
"<!--@@JSF_FORM_STATE_MARKER@@-->"};
     
     /**
      * <p>Returns an index into the <code>FORM_MAKKERS</code> array.  The
index will be used to
@@ -363,11 +363,11 @@
 
                 //might be multiple forms in the document 
                 do {
-                    fndPos = buff.indexOf(FORM_MAKKERS[frmMkrIdx], curPos);
+                    fndPos = buff.indexOf(FORM_MARKERS[frmMkrIdx], curPos);
                     if (fndPos > -1) {
                         responsewriter.write(buff.substring(curPos, fndPos));
                         stateManager.writeState(context, serializedview);
-                        curPos = fndPos + FORM_MAKKERS[frmMkrIdx].length();
+                        curPos = fndPos + FORM_MARKERS[frmMkrIdx].length();
                     } else {
                         responsewriter.write(buff.substring(curPos));
                     }

Modified: struts/shale/trunk/core-library/src/java/org/apache/shale/application/AbstractRegExpFilter.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/core-library/src/java/org/apache/shale/application/AbstractRegExpFilter.java?rev=373997&r1=373996&r2=373997&view=diff
==============================================================================
--- struts/shale/trunk/core-library/src/java/org/apache/shale/application/AbstractRegExpFilter.java
(original)
+++ struts/shale/trunk/core-library/src/java/org/apache/shale/application/AbstractRegExpFilter.java
Tue Jan 31 21:37:51 2006
@@ -106,6 +106,11 @@
      * <p>Array of regular expression patterns for the includes list.</p>
      */
     private Pattern includesPatterns[] = new Pattern[0];
+    
+    /**
+     * <p>Returns an array of regular expression patterns for the includes list.</p>
+     */
+    protected Pattern[] getIncludesPatterns() {return includesPatterns;};
 
 
     // -------------------------------------------------------------- Properties
@@ -270,7 +275,7 @@
      * @param patterns Array of <code>Pattern</code> to be tested against
      * @param unrestricted Result to be returned if there are no matches
      */
-    private boolean matches(String expr, Pattern patterns[],
+    protected boolean matches(String expr, Pattern patterns[],
                             boolean unrestricted) {
 
         // Check for the unrestricted case
@@ -299,7 +304,7 @@
      *
      * @param expr Comma-delimited regular expressions
      */
-    private Pattern[] precompile(String expr) {
+     private Pattern[] precompile(String expr) {
 
         if (expr == null) {
             return new Pattern[0];

Modified: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/Rolodex.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/Rolodex.java?rev=373997&r1=373996&r2=373997&view=diff
==============================================================================
--- struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/Rolodex.java (original)
+++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/Rolodex.java Tue
Jan 31 21:37:51 2006
@@ -303,9 +303,6 @@
         if (log.isInfoEnabled())
             log.info("createTabs()");
 
-        // cast to the clay component, the one triggering the event
-        Clay clayComponent = (Clay) component;
-
         // find the dao cached in application scope
         RolodexDao dao = (RolodexDao) getBean("rolodexDao");
 

Modified: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/WebPagerRenderer.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/WebPagerRenderer.java?rev=373997&r1=373996&r2=373997&view=diff
==============================================================================
--- struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/WebPagerRenderer.java
(original)
+++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/WebPagerRenderer.java
Tue Jan 31 21:37:51 2006
@@ -159,6 +159,7 @@
             url.append(prevImage);
             writer.startElement("img", pager);
             writer.writeAttribute("src", context.getExternalContext().encodeActionURL(url.toString()),
"scr");
+			writer.endElement("img");
             
             
             writer.endElement("a");



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


Mime
View raw message