You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2010/02/17 16:35:27 UTC

svn commit: r911022 [1/2] - in /sling/trunk/bundles/scripting/jsp: ./ src/main/java/org/apache/sling/scripting/jsp/ src/main/java/org/apache/sling/scripting/jsp/jasper/ src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/ src/main/java/org/apa...

Author: cziegeler
Date: Wed Feb 17 15:35:26 2010
New Revision: 911022

URL: http://svn.apache.org/viewvc?rev=911022&view=rev
Log:
SLING-1038 : Recompile jsps on modifications and avoid periodic check

Removed:
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/PeriodicEventListener.java
Modified:
    sling/trunk/bundles/scripting/jsp/pom.xml
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletOptions.java
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/EmbeddedServletOptions.java
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/JspCompilationContext.java
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/Options.java
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/Compiler.java
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspDocumentParser.java
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspUtil.java
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/Parser.java
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServlet.java
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java
    sling/trunk/bundles/scripting/jsp/src/main/resources/OSGI-INF/metatype/metatype.properties

Modified: sling/trunk/bundles/scripting/jsp/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/pom.xml?rev=911022&r1=911021&r2=911022&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/pom.xml (original)
+++ sling/trunk/bundles/scripting/jsp/pom.xml Wed Feb 17 15:35:26 2010
@@ -99,6 +99,12 @@
 
     <dependencies>
         <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+            <version>1.2.0</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
             <version>2.0.8</version>

Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java?rev=911022&r1=911021&r2=911022&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java Wed Feb 17 15:35:26 2010
@@ -19,6 +19,8 @@
 import static org.apache.sling.api.scripting.SlingBindings.SLING;
 
 import java.io.Reader;
+import java.util.Dictionary;
+import java.util.Hashtable;
 
 import javax.script.Bindings;
 import javax.script.ScriptContext;
@@ -28,6 +30,12 @@
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.api.SlingConstants;
 import org.apache.sling.api.SlingException;
 import org.apache.sling.api.SlingIOException;
 import org.apache.sling.api.SlingServletException;
@@ -45,43 +53,53 @@
 import org.apache.sling.scripting.jsp.jasper.compiler.JspRuntimeContext;
 import org.apache.sling.scripting.jsp.jasper.runtime.JspApplicationContextImpl;
 import org.apache.sling.scripting.jsp.util.TagUtil;
+import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.component.ComponentContext;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * The JSP engine (a.k.a Jasper).
  *
- * @scr.component label="%jsphandler.name" description="%jsphandler.description"
- * @scr.property name="service.description" value="JSP Script Handler"
- * @scr.property name="service.vendor" value="The Apache Software Foundation" *
- * @scr.property name="jasper.development" value="true" type="Boolean"
- * @scr.property name="jasper.modificationTestInterval" value="4" type="Integer"
- * @scr.property name="jasper.classdebuginfo" value="true" type="Boolean"
- * @scr.property name="jasper.enablePooling" value="true" type="Boolean"
- * @scr.property name="jasper.ieClassId"
- *               value="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
- * @scr.property name="jasper.genStringAsCharArray" value="false" type="Boolean"
- * @scr.property name="jasper.keepgenerated" value="true" type="Boolean"
- * @scr.property name="jasper.mappedfile" value="true" type="Boolean"
- * @scr.property name="jasper.trimSpaces" value="false" type="Boolean"
- * @scr.property name="jasper.checkInterval" value="300" type="Integer"
- * @scr.property name="jasper.displaySourceFragments" value="true"
- *               type="Boolean"
- * @scr.service
  */
-public class JspScriptEngineFactory extends AbstractScriptEngineFactory {
+@Component(label="%jsphandler.name",
+           description="%jsphandler.description",
+           metatype=true)
+@Service(value=javax.script.ScriptEngineFactory.class)
+@Properties({
+   @Property(name="service.description",value="JSP Script Handler"),
+   @Property(name="service.vendor",value="The Apache Software Foundation"),
+   @Property(name="jasper.classdebuginfo",boolValue=true),
+   @Property(name="jasper.enablePooling",boolValue=true),
+   @Property(name="jasper.ieClassId",value="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"),
+   @Property(name="jasper.genStringAsCharArray",boolValue=false),
+   @Property(name="jasper.keepgenerated",boolValue=true),
+   @Property(name="jasper.mappedfile",boolValue=true),
+   @Property(name="jasper.trimSpaces",boolValue=false),
+   @Property(name="jasper.displaySourceFragments",boolValue=true)
+})
+public class JspScriptEngineFactory
+    extends AbstractScriptEngineFactory
+    implements EventHandler {
 
-    /** default log */
-    private final Logger log = LoggerFactory.getLogger(JspScriptEngineFactory.class);
+    /** Default logger */
+    private final Logger logger = LoggerFactory.getLogger(JspScriptEngineFactory.class);
 
-    ComponentContext componentContext;
-
-    /** @scr.reference */
+    @Reference
     private ServletContext slingServletContext;
 
+    @Reference
+    private DynamicClassLoaderManager dynamicClassLoaderManager;
+
+    @Reference
+    private ClassLoaderWriter classLoaderWriter;
+
+    /** The class loader for the jsps. */
     private ClassLoader jspClassLoader;
 
+    /** The io provider for reading and writing. */
     private SlingIOProvider ioProvider;
 
     private SlingTldLocationsCache tldLocationsCache;
@@ -94,11 +112,7 @@
 
     private ServletConfig servletConfig;
 
-    /** @scr.reference */
-    private DynamicClassLoaderManager dynamicClassLoaderManager;
-
-    /** @scr.reference */
-    private ClassLoaderWriter classLoaderWriter;
+    private ServiceRegistration eventHandlerRegistration;
 
     public static final String[] SCRIPT_TYPE = { "jsp", "jspf", "jspx" };
 
@@ -109,14 +123,23 @@
         setNames(NAMES);
     }
 
+    /**
+     * @see javax.script.ScriptEngineFactory#getScriptEngine()
+     */
     public ScriptEngine getScriptEngine() {
         return new JspScriptEngine();
     }
 
+    /**
+     * @see javax.script.ScriptEngineFactory#getLanguageName()
+     */
     public String getLanguageName() {
         return "Java Server Pages";
     }
 
+    /**
+     * @see javax.script.ScriptEngineFactory#getLanguageVersion()
+     */
     public String getLanguageVersion() {
         return "2.1";
     }
@@ -147,19 +170,18 @@
         }
     }
 
-    private JspServletWrapperAdapter getJspWrapperAdapter(
-            SlingScriptHelper scriptHelper) throws SlingException {
-
-        JspRuntimeContext rctxt = jspRuntimeContext;
+    private JspServletWrapperAdapter getJspWrapperAdapter(final SlingScriptHelper scriptHelper)
+    throws SlingException {
+        final JspRuntimeContext rctxt = jspRuntimeContext;
 
-        SlingScript script = scriptHelper.getScript();
-        String scriptName = script.getScriptResource().getPath();
+        final SlingScript script = scriptHelper.getScript();
+        final String scriptName = script.getScriptResource().getPath();
         JspServletWrapperAdapter wrapper = (JspServletWrapperAdapter) rctxt.getWrapper(scriptName);
         if (wrapper != null) {
             return wrapper;
         }
 
-        synchronized (this) {
+        synchronized (rctxt) {
             wrapper = (JspServletWrapperAdapter) rctxt.getWrapper(scriptName);
             if (wrapper != null) {
                 return wrapper;
@@ -183,12 +205,13 @@
 
     // ---------- SCR integration ----------------------------------------------
 
-    protected void activate(ComponentContext componentContext) {
-        this.componentContext = componentContext;
-
+    /**
+     * Activate this component
+     */
+    protected void activate(final ComponentContext componentContext) {
         // set the current class loader as the thread context loader for
         // the setup of the JspRuntimeContext
-        ClassLoader old = Thread.currentThread().getContextClassLoader();
+        final ClassLoader old = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(jspClassLoader);
 
         try {
@@ -203,11 +226,11 @@
                 componentContext, jspClassLoader, tldLocationsCache);
 
             // Initialize the JSP Runtime Context
-            jspRuntimeContext = new JspRuntimeContext(slingServletContext,
-                options);
+            this.jspRuntimeContext = new JspRuntimeContext(slingServletContext,
+                    options);
 
-            // by default access the repository
-            jspRuntimeContext.setIOProvider(ioProvider);
+                // by default access the repository
+            this.jspRuntimeContext.setIOProvider(ioProvider);
 
             jspServletContext = new JspServletContext(ioProvider,
                 slingServletContext, tldLocationsCache);
@@ -221,26 +244,35 @@
             Thread.currentThread().setContextClassLoader(old);
         }
 
-        if (log.isDebugEnabled()) {
-            log.debug("Scratch dir for the JSP engine is: {}",
-                options.getScratchDir().toString());
-            log.debug("IMPORTANT: Do not modify the generated servlets");
-        }
+        // register event handler
+        final Dictionary<String, String> props = new Hashtable<String, String>();
+        props.put("event.topics","org/apache/sling/api/resource/*");
+        props.put("service.description","JSP Script Modification Handler");
+        props.put("service.vendor","The Apache Software Foundation");
 
+        this.eventHandlerRegistration = componentContext.getBundleContext()
+                  .registerService(EventHandler.class.getName(), this, props);
+
+        logger.debug("IMPORTANT: Do not modify the generated servlets");
     }
 
-    protected void deactivate(ComponentContext oldComponentContext) {
-        if (log.isDebugEnabled()) {
-            log.debug("JspScriptEngine.deactivate()");
-        }
+    /**
+     * Activate this component
+     */
+    protected void deactivate(final ComponentContext componentContext) {
+        logger.debug("JspScriptEngine.deactivate()");
 
+        if ( this.eventHandlerRegistration != null ) {
+            this.eventHandlerRegistration.unregister();
+            this.eventHandlerRegistration = null;
+        }
         if (jspRuntimeContext != null) {
             try {
                 jspRuntimeContext.destroy();
             } catch (NullPointerException npe) {
                 // SLING-530, might be thrown on system shutdown in a servlet
                 // container when using the Equinox servlet container bridge
-                log.debug("deactivate: ServletContext might already be unavailable", npe);
+                logger.debug("deactivate: ServletContext might already be unavailable", npe);
             }
             jspRuntimeContext = null;
         }
@@ -251,7 +283,6 @@
         }
 
         ioProvider = null;
-        componentContext = null;
 
         // remove JspApplicationContextImpl from the servlet context, otherwise
         // a ClassCastException may be caused after this component is recreated
@@ -262,7 +293,7 @@
         } catch (NullPointerException npe) {
             // SLING-530, might be thrown on system shutdown in a servlet
             // container when using the Equinox servlet container bridge
-            log.debug("deactivate: ServletContext might already be unavailable", npe);
+            logger.debug("deactivate: ServletContext might already be unavailable", npe);
         }
     }
 
@@ -379,4 +410,17 @@
         }
 
     }
+
+    /**
+     * @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)
+     */
+    public void handleEvent(Event event) {
+        if ( SlingConstants.TOPIC_RESOURCE_CHANGED.equals(event.getTopic()) ) {
+            this.jspRuntimeContext.handleModification((String)event.getProperty(SlingConstants.PROPERTY_PATH));
+        } else if ( SlingConstants.TOPIC_RESOURCE_REMOVED.equals(event.getTopic()) ) {
+            this.jspRuntimeContext.handleModification((String)event.getProperty(SlingConstants.PROPERTY_PATH));
+        } else {
+            this.jspRuntimeContext.handleModification((String)event.getProperty(SlingConstants.PROPERTY_PATH));
+        }
+    }
 }

Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletOptions.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletOptions.java?rev=911022&r1=911021&r2=911022&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletOptions.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletOptions.java Wed Feb 17 15:35:26 2010
@@ -18,7 +18,6 @@
 
 import java.util.Dictionary;
 import java.util.Enumeration;
-import java.util.Map;
 import java.util.Properties;
 
 import javax.servlet.ServletContext;
@@ -47,11 +46,6 @@
     private Properties settings = new Properties();
 
     /**
-     * Is Jasper being used in development mode?
-     */
-    private boolean development = true;
-
-    /**
      * Should Ant fork its java compiles of JSP pages.
      */
     public boolean fork = true;
@@ -91,11 +85,6 @@
     private boolean classDebugInfo = true;
 
     /**
-     * Background compile thread check interval in seconds.
-     */
-    private int checkInterval = 0;
-
-    /**
      * Is the generation of SMAP info for JSR45 debuggin suppressed?
      */
     private boolean isSmapSuppressed = false;
@@ -155,11 +144,6 @@
     private String javaEncoding = "UTF8";
 
     /**
-     * Modification test interval.
-     */
-    private int modificationTestInterval = -1;
-
-    /**
      * The class loader to use to compile and load JSP files
      */
     private ClassLoader jspClassLoader;
@@ -225,27 +209,6 @@
     }
 
     /**
-     * Background JSP compile thread check intervall
-     */
-    public int getCheckInterval() {
-        return this.checkInterval;
-    }
-
-    /**
-     * Modification test interval.
-     */
-    public int getModificationTestInterval() {
-        return this.modificationTestInterval;
-    }
-
-    /**
-     * Is Jasper being used in development mode?
-     */
-    public boolean getDevelopment() {
-        return this.development;
-    }
-
-    /**
      * Is the generation of SMAP info for JSR45 debuggin suppressed?
      */
     public boolean isSmapSuppressed() {
@@ -349,15 +312,6 @@
         return this.tagPluginManager;
     }
 
-    public boolean isCaching() {
-        return false;
-    }
-
-    @SuppressWarnings("unchecked")
-    public Map getCache() {
-        return null;
-    }
-
     public boolean getDisplaySourceFragment() {
         return displaySourceFragments;
     }
@@ -493,47 +447,6 @@
             }
         }
 
-        String checkInterval = getProperty("checkInterval");
-        if (checkInterval != null) {
-            try {
-                this.checkInterval = Integer.parseInt(checkInterval);
-                if (this.checkInterval == 0) {
-                    this.checkInterval = 300;
-                    if (log.isWarnEnabled()) {
-                        log.warn(Localizer.getMessage("jsp.warning.checkInterval"));
-                    }
-                }
-            } catch (NumberFormatException ex) {
-                if (log.isWarnEnabled()) {
-                    log.warn(Localizer.getMessage("jsp.warning.checkInterval"));
-                }
-            }
-        }
-
-        String modificationTestInterval = getProperty("modificationTestInterval");
-        if (modificationTestInterval != null) {
-            try {
-                this.modificationTestInterval = Integer.parseInt(modificationTestInterval);
-            } catch (NumberFormatException ex) {
-                if (log.isWarnEnabled()) {
-                    log.warn(Localizer.getMessage("jsp.warning.modificationTestInterval"));
-                }
-            }
-        }
-
-        String development = getProperty("development");
-        if (development != null) {
-            if (development.equalsIgnoreCase("true")) {
-                this.development = true;
-            } else if (development.equalsIgnoreCase("false")) {
-                this.development = false;
-            } else {
-                if (log.isWarnEnabled()) {
-                    log.warn(Localizer.getMessage("jsp.warning.development"));
-                }
-            }
-        }
-
         String suppressSmap = getProperty("suppressSmap");
         if (suppressSmap != null) {
             if (suppressSmap.equalsIgnoreCase("true")) {

Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/EmbeddedServletOptions.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/EmbeddedServletOptions.java?rev=911022&r1=911021&r2=911022&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/EmbeddedServletOptions.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/EmbeddedServletOptions.java Wed Feb 17 15:35:26 2010
@@ -5,9 +5,9 @@
  * 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.
@@ -18,7 +18,8 @@
 package org.apache.sling.scripting.jsp.jasper;
 
 import java.io.File;
-import java.util.*;
+import java.util.Enumeration;
+import java.util.Properties;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
@@ -32,266 +33,230 @@
 import org.apache.sling.scripting.jsp.jasper.xmlparser.ParserUtils;
 
 /**
- * A class to hold all init parameters specific to the JSP engine. 
+ * A class to hold all init parameters specific to the JSP engine.
  *
  * @author Anil K. Vijendran
  * @author Hans Bergsten
  * @author Pierre Delisle
  */
 public final class EmbeddedServletOptions implements Options {
-    
+
     // Logger
     private Log log = LogFactory.getLog(EmbeddedServletOptions.class);
-    
+
     private Properties settings = new Properties();
-    
-    /**
-     * Is Jasper being used in development mode?
-     */
-    private boolean development = true;
-    
+
     /**
      * Should Ant fork its java compiles of JSP pages.
      */
     public boolean fork = true;
-    
+
     /**
      * Do you want to keep the generated Java files around?
      */
     private boolean keepGenerated = true;
-    
+
     /**
      * Should white spaces between directives or actions be trimmed?
      */
     private boolean trimSpaces = false;
-    
+
     /**
      * Determines whether tag handler pooling is enabled.
      */
     private boolean isPoolingEnabled = true;
-    
+
     /**
      * Do you want support for "mapped" files? This will generate
      * servlet that has a print statement per line of the JSP file.
      * This seems like a really nice feature to have for debugging.
      */
     private boolean mappedFile = true;
-    
+
     /**
      * Do you want stack traces and such displayed in the client's
      * browser? If this is false, such messages go to the standard
-     * error or a log file if the standard error is redirected. 
+     * error or a log file if the standard error is redirected.
      */
     private boolean sendErrorToClient = false;
-    
+
     /**
      * Do we want to include debugging information in the class file?
      */
     private boolean classDebugInfo = true;
-    
-    /**
-     * Background compile thread check interval in seconds.
-     */
-    private int checkInterval = 0;
-    
+
     /**
      * Is the generation of SMAP info for JSR45 debuggin suppressed?
      */
     private boolean isSmapSuppressed = false;
-    
+
     /**
      * Should SMAP info for JSR45 debugging be dumped to a file?
      */
     private boolean isSmapDumped = false;
-    
+
     /**
      * Are Text strings to be generated as char arrays?
      */
     private boolean genStringAsCharArray = false;
-    
+
     private boolean errorOnUseBeanInvalidClassAttribute = true;
-    
+
     /**
      * I want to see my generated servlets. Which directory are they
      * in?
      */
     private String scratchDir;
-    
+
     /**
      * Need to have this as is for versions 4 and 5 of IE. Can be set from
      * the initParams so if it changes in the future all that is needed is
      * to have a jsp initParam of type ieClassId="<value>"
      */
     private String ieClassId = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93";
-    
+
     /**
      * What classpath should I use while compiling generated servlets?
      */
     private String classpath = null;
-    
+
     /**
      * Compiler to use.
      */
     private String compiler = null;
-    
+
     /**
      * Compiler target VM.
      */
     private String compilerTargetVM = "1.5";
-    
+
     /**
      * The compiler source VM.
      */
     private String compilerSourceVM = "1.5";
-    
+
     /**
      * The compiler class name.
      */
     private String compilerClassName = null;
-    
+
     /**
      * Cache for the TLD locations
      */
     private TldLocationsCache tldLocationsCache = null;
-    
+
     /**
      * Jsp config information
      */
     private JspConfig jspConfig = null;
-    
+
     /**
      * TagPluginManager
      */
     private TagPluginManager tagPluginManager = null;
-    
+
     /**
      * Java platform encoding to generate the JSP
      * page servlet.
      */
     private String javaEncoding = "UTF8";
-    
-    /**
-     * Modification test interval.
-     */
-    private int modificationTestInterval = 4;
-    
+
     /**
      * Is generation of X-Powered-By response header enabled/disabled?
      */
     private boolean xpoweredBy;
-    
+
     /**
      * Should we include a source fragment in exception messages, which could be displayed
      * to the developer ?
      */
     private boolean displaySourceFragment = true;
 
-    
+
     public String getProperty(String name ) {
         return settings.getProperty( name );
     }
-    
+
     public void setProperty(String name, String value ) {
-        if (name != null && value != null){ 
+        if (name != null && value != null){
             settings.setProperty( name, value );
         }
     }
-    
+
     /**
      * Are we keeping generated code around?
      */
     public boolean getKeepGenerated() {
         return keepGenerated;
     }
-    
+
     /**
      * Should white spaces between directives or actions be trimmed?
      */
     public boolean getTrimSpaces() {
         return trimSpaces;
     }
-    
+
     public boolean isPoolingEnabled() {
         return isPoolingEnabled;
     }
-    
+
     /**
      * Are we supporting HTML mapped servlets?
      */
     public boolean getMappedFile() {
         return mappedFile;
     }
-    
+
     /**
      * Should errors be sent to client or thrown into stderr?
      */
     public boolean getSendErrorToClient() {
         return sendErrorToClient;
     }
-    
+
     /**
      * Should class files be compiled with debug information?
      */
     public boolean getClassDebugInfo() {
         return classDebugInfo;
     }
-    
-    /**
-     * Background JSP compile thread check intervall
-     */
-    public int getCheckInterval() {
-        return checkInterval;
-    }
-    
-    /**
-     * Modification test interval.
-     */
-    public int getModificationTestInterval() {
-        return modificationTestInterval;
-    }
-    
-    /**
-     * Is Jasper being used in development mode?
-     */
-    public boolean getDevelopment() {
-        return development;
-    }
-    
+
     /**
      * Is the generation of SMAP info for JSR45 debuggin suppressed?
      */
     public boolean isSmapSuppressed() {
         return isSmapSuppressed;
     }
-    
+
     /**
      * Should SMAP info for JSR45 debugging be dumped to a file?
      */
     public boolean isSmapDumped() {
         return isSmapDumped;
     }
-    
+
     /**
      * Are Text strings to be generated as char arrays?
      */
     public boolean genStringAsCharArray() {
         return this.genStringAsCharArray;
     }
-    
+
     /**
-     * Class ID for use in the plugin tag when the browser is IE. 
+     * Class ID for use in the plugin tag when the browser is IE.
      */
     public String getIeClassId() {
         return ieClassId;
     }
-    
+
     /**
      * What is my scratch dir?
      */
     public String getScratchDir() {
         return scratchDir;
     }
-    
+
     /**
      * What classpath should I use while compiling the servlets
      * generated from JSP files?
@@ -299,42 +264,42 @@
     public String getClassPath() {
         return classpath;
     }
-    
+
     /**
      * Return <code>null</code> to force use of the <code>JasperLoader</code>.
      */
     public ClassLoader getJspClassLoader() {
         return null;
     }
-    
+
     /**
      * Is generation of X-Powered-By response header enabled/disabled?
      */
     public boolean isXpoweredBy() {
         return xpoweredBy;
     }
-    
+
     /**
      * Compiler to use.
      */
     public String getCompiler() {
         return compiler;
     }
-    
+
     /**
      * @see Options#getCompilerTargetVM
      */
     public String getCompilerTargetVM() {
         return compilerTargetVM;
     }
-    
+
     /**
      * @see Options#getCompilerSourceVM
      */
     public String getCompilerSourceVM() {
         return compilerSourceVM;
     }
-    
+
     /**
      * Java compiler class to use.
      */
@@ -345,42 +310,34 @@
     public boolean getErrorOnUseBeanInvalidClassAttribute() {
         return errorOnUseBeanInvalidClassAttribute;
     }
-    
+
     public void setErrorOnUseBeanInvalidClassAttribute(boolean b) {
         errorOnUseBeanInvalidClassAttribute = b;
     }
-    
+
     public TldLocationsCache getTldLocationsCache() {
         return tldLocationsCache;
     }
-    
+
     public void setTldLocationsCache( TldLocationsCache tldC ) {
         tldLocationsCache = tldC;
     }
-    
+
     public String getJavaEncoding() {
         return javaEncoding;
     }
-    
+
     public boolean getFork() {
         return fork;
     }
-    
+
     public JspConfig getJspConfig() {
         return jspConfig;
     }
-    
+
     public TagPluginManager getTagPluginManager() {
         return tagPluginManager;
     }
-    
-    public boolean isCaching() {
-        return false;
-    }
-    
-    public Map getCache() {
-        return null;
-    }
 
     /**
      * Should we include a source fragment in exception messages, which could be displayed
@@ -392,11 +349,11 @@
 
     /**
      * Create an EmbeddedServletOptions object using data available from
-     * ServletConfig and ServletContext. 
+     * ServletConfig and ServletContext.
      */
     public EmbeddedServletOptions(ServletConfig config,
             ServletContext context) {
-        
+
         // JVM version numbers
         try {
             if (Float.parseFloat(System.getProperty("java.specification.version")) > 1.4) {
@@ -407,18 +364,19 @@
         } catch (NumberFormatException e) {
             // Ignore
         }
-        
-        Enumeration enumeration=config.getInitParameterNames();
+
+        @SuppressWarnings("unchecked")
+        Enumeration<String> enumeration=config.getInitParameterNames();
         while( enumeration.hasMoreElements() ) {
-            String k=(String)enumeration.nextElement();
+            String k=enumeration.nextElement();
             String v=config.getInitParameter( k );
             setProperty( k, v);
         }
-        
+
         // quick hack
         String validating=config.getInitParameter( "validating");
         if( "false".equals( validating )) ParserUtils.validating=false;
-        
+
         String keepgen = config.getInitParameter("keepgenerated");
         if (keepgen != null) {
             if (keepgen.equalsIgnoreCase("true")) {
@@ -431,9 +389,9 @@
                 }
             }
         }
-        
-        
-        String trimsp = config.getInitParameter("trimSpaces"); 
+
+
+        String trimsp = config.getInitParameter("trimSpaces");
         if (trimsp != null) {
             if (trimsp.equalsIgnoreCase("true")) {
                 trimSpaces = true;
@@ -445,10 +403,10 @@
                 }
             }
         }
-        
+
         this.isPoolingEnabled = true;
         String poolingEnabledParam
-        = config.getInitParameter("enablePooling"); 
+        = config.getInitParameter("enablePooling");
         if (poolingEnabledParam != null
                 && !poolingEnabledParam.equalsIgnoreCase("true")) {
             if (poolingEnabledParam.equalsIgnoreCase("false")) {
@@ -456,11 +414,11 @@
             } else {
                 if (log.isWarnEnabled()) {
                     log.warn(Localizer.getMessage("jsp.warning.enablePooling"));
-                }		       	   
+                }
             }
         }
-        
-        String mapFile = config.getInitParameter("mappedfile"); 
+
+        String mapFile = config.getInitParameter("mappedfile");
         if (mapFile != null) {
             if (mapFile.equalsIgnoreCase("true")) {
                 this.mappedFile = true;
@@ -472,7 +430,7 @@
                 }
             }
         }
-        
+
         String senderr = config.getInitParameter("sendErrToClient");
         if (senderr != null) {
             if (senderr.equalsIgnoreCase("true")) {
@@ -485,7 +443,7 @@
                 }
             }
         }
-        
+
         String debugInfo = config.getInitParameter("classdebuginfo");
         if (debugInfo != null) {
             if (debugInfo.equalsIgnoreCase("true")) {
@@ -498,42 +456,7 @@
                 }
             }
         }
-        
-        String checkInterval = config.getInitParameter("checkInterval");
-        if (checkInterval != null) {
-            try {
-                this.checkInterval = Integer.parseInt(checkInterval);
-            } catch(NumberFormatException ex) {
-                if (log.isWarnEnabled()) {
-                    log.warn(Localizer.getMessage("jsp.warning.checkInterval"));
-                }
-            }
-        }
-        
-        String modificationTestInterval = config.getInitParameter("modificationTestInterval");
-        if (modificationTestInterval != null) {
-            try {
-                this.modificationTestInterval = Integer.parseInt(modificationTestInterval);
-            } catch(NumberFormatException ex) {
-                if (log.isWarnEnabled()) {
-                    log.warn(Localizer.getMessage("jsp.warning.modificationTestInterval"));
-                }
-            }
-        }
-        
-        String development = config.getInitParameter("development");
-        if (development != null) {
-            if (development.equalsIgnoreCase("true")) {
-                this.development = true;
-            } else if (development.equalsIgnoreCase("false")) {
-                this.development = false;
-            } else {
-                if (log.isWarnEnabled()) {
-                    log.warn(Localizer.getMessage("jsp.warning.development"));
-                }
-            }
-        }
-        
+
         String suppressSmap = config.getInitParameter("suppressSmap");
         if (suppressSmap != null) {
             if (suppressSmap.equalsIgnoreCase("true")) {
@@ -546,7 +469,7 @@
                 }
             }
         }
-        
+
         String dumpSmap = config.getInitParameter("dumpSmap");
         if (dumpSmap != null) {
             if (dumpSmap.equalsIgnoreCase("true")) {
@@ -559,7 +482,7 @@
                 }
             }
         }
-        
+
         String genCharArray = config.getInitParameter("genStrAsCharArray");
         if (genCharArray != null) {
             if (genCharArray.equalsIgnoreCase("true")) {
@@ -572,7 +495,7 @@
                 }
             }
         }
-        
+
         String errBeanClass =
             config.getInitParameter("errorOnUseBeanInvalidClassAttribute");
         if (errBeanClass != null) {
@@ -586,20 +509,20 @@
                 }
             }
         }
-        
+
         String ieClassId = config.getInitParameter("ieClassId");
         if (ieClassId != null)
             this.ieClassId = ieClassId;
-        
+
         String classpath = config.getInitParameter("classpath");
         if (classpath != null)
             this.classpath = classpath;
-        
+
         /*
          * scratchdir
          */
         File scratchDir;
-        String dir = config.getInitParameter("scratchdir"); 
+        String dir = config.getInitParameter("scratchdir");
         if (dir != null) {
             scratchDir = new File(dir);
         } else {
@@ -612,40 +535,40 @@
                 if (dir != null)
                     scratchDir = new File(dir);
             }
-        }      
+        }
         if (scratchDir == null) {
             log.fatal(Localizer.getMessage("jsp.error.no.scratch.dir"));
             return;
         }
-        
+
         if (!(scratchDir.exists() && scratchDir.canRead() &&
                 scratchDir.canWrite() && scratchDir.isDirectory()))
             log.fatal(Localizer.getMessage("jsp.error.bad.scratch.dir",
                     scratchDir.getAbsolutePath()));
-        
+
         this.scratchDir = scratchDir.getAbsolutePath();
         this.compiler = config.getInitParameter("compiler");
-        
+
         String compilerTargetVM = config.getInitParameter("compilerTargetVM");
         if(compilerTargetVM != null) {
             this.compilerTargetVM = compilerTargetVM;
         }
-        
+
         String compilerSourceVM = config.getInitParameter("compilerSourceVM");
         if(compilerSourceVM != null) {
             this.compilerSourceVM = compilerSourceVM;
         }
-        
+
         String javaEncoding = config.getInitParameter("javaEncoding");
         if (javaEncoding != null) {
             this.javaEncoding = javaEncoding;
         }
-        
+
         String compilerClassName = config.getInitParameter("compilerClassName");
         if (compilerClassName != null) {
             this.compilerClassName = compilerClassName;
         }
-        
+
         String fork = config.getInitParameter("fork");
         if (fork != null) {
             if (fork.equalsIgnoreCase("true")) {
@@ -658,8 +581,8 @@
                 }
             }
         }
-        
-        String xpoweredBy = config.getInitParameter("xpoweredBy"); 
+
+        String xpoweredBy = config.getInitParameter("xpoweredBy");
         if (xpoweredBy != null) {
             if (xpoweredBy.equalsIgnoreCase("true")) {
                 this.xpoweredBy = true;
@@ -671,8 +594,8 @@
                 }
             }
         }
-        
-        String displaySourceFragment = config.getInitParameter("displaySourceFragment"); 
+
+        String displaySourceFragment = config.getInitParameter("displaySourceFragment");
         if (displaySourceFragment != null) {
             if (displaySourceFragment.equalsIgnoreCase("true")) {
                 this.displaySourceFragment = true;
@@ -684,17 +607,17 @@
                 }
             }
         }
-        
+
         // Setup the global Tag Libraries location cache for this
         // web-application.
         tldLocationsCache = new TldLocationsCache(context);
-        
+
         // Setup the jsp config info for this web app.
         jspConfig = new JspConfig(context);
-        
+
         // Create a Tag plugin instance
         tagPluginManager = new TagPluginManager(context);
     }
-    
+
 }
 

Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/JspCompilationContext.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/JspCompilationContext.java?rev=911022&r1=911021&r2=911022&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/JspCompilationContext.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/JspCompilationContext.java Wed Feb 17 15:35:26 2010
@@ -5,9 +5,9 @@
  * 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.
@@ -45,7 +45,7 @@
  * the instance variables are set at different points.
  *
  * Most of the path-related stuff is here - mangling names, versions, dirs,
- * loading resources and dealing with uris. 
+ * loading resources and dealing with uris.
  *
  * @author Anil K. Vijendran
  * @author Harish Prabandham
@@ -87,7 +87,7 @@
 
     protected ClassLoader jspLoader;
     protected URL baseUrl;
-    protected Class servletClass;
+    protected Class<?> servletClass;
 
     protected boolean isTagFile;
     protected boolean protoTypeMode;
@@ -127,7 +127,7 @@
     }
 
     public JspCompilationContext(String tagfile,
-                                 TagInfo tagInfo, 
+                                 TagInfo tagInfo,
                                  Options options,
                                  ServletContext context,
                                  JspServletWrapper jsw,
@@ -143,11 +143,11 @@
     }
 
     /* ==================== Methods to override ==================== */
-    
+
     /** ---------- Class path and loader ---------- */
 
     /**
-     * The classpath that is passed off to the Java compiler. 
+     * The classpath that is passed off to the Java compiler.
      */
     public String getClassPath() {
         if( classPath != null )
@@ -156,7 +156,7 @@
     }
 
     /**
-     * The classpath that is passed off to the Java compiler. 
+     * The classpath that is passed off to the Java compiler.
      */
     public void setClassPath(String classPath) {
         this.classPath = classPath;
@@ -247,7 +247,7 @@
     /**
      * Create a "Compiler" object based on some init param data. This
      * is not done yet. Right now we're just hardcoding the actual
-     * compilers that are created. 
+     * compilers that are created.
      */
     public Compiler createCompiler() throws JasperException {
         if (jspCompiler != null ) {
@@ -277,7 +277,7 @@
     }
 
     protected Compiler createCompiler(String className) {
-        Compiler compiler = null; 
+        Compiler compiler = null;
         try {
             compiler = (Compiler) Class.forName(className).newInstance();
         } catch (InstantiationException e) {
@@ -295,14 +295,14 @@
         }
         return compiler;
     }
-    
+
     public Compiler getCompiler() {
         return jspCompiler;
     }
 
     /** ---------- Access resources in the webapp ---------- */
 
-    /** 
+    /**
      * Get the full value of a URI relative to this compilations context
      * uses current file as the base.
      */
@@ -311,15 +311,14 @@
         // a root directory deperator char
         if (uri.startsWith("/") || uri.startsWith(File.separator)) {
             return uri;
-        } else {
-            return baseURI + uri;
         }
+        return baseURI + uri;
     }
 
     /**
      * Gets a resource as a stream, relative to the meanings of this
      * context's implementation.
-     * @return a null if the resource cannot be found or represented 
+     * @return a null if the resource cannot be found or represented
      *         as an InputStream.
      */
     public java.io.InputStream getResourceAsStream(String res) {
@@ -331,11 +330,12 @@
         return context.getResource(canonicalURI(res));
     }
 
-    public Set getResourcePaths(String path) {
+    @SuppressWarnings("unchecked")
+    public Set<String> getResourcePaths(String path) {
         return context.getResourcePaths(canonicalURI(path));
     }
 
-    /** 
+    /**
      * Gets the actual path of a URI relative to the context of
      * the compilation.
      */
@@ -352,7 +352,7 @@
      * packaged.
      *
      * The map is populated when parsing the tag-file elements of the TLDs
-     * of any imported taglibs. 
+     * of any imported taglibs.
      */
     public URL getTagFileJarUrl(String tagFile) {
         return this.tagFileJarUrls.get(tagFile);
@@ -376,7 +376,7 @@
 
     /**
      * Just the class name (does not include package name) of the
-     * generated class. 
+     * generated class.
      */
     public String getServletClassName() {
 
@@ -400,10 +400,10 @@
     public void setServletClassName(String className) {
         this.className = className;
     }
-    
+
     /**
      * Path of the JSP URI. Note that this is not a file name. This is
-     * the context rooted URI of the JSP file. 
+     * the context rooted URI of the JSP file.
      */
     public String getJspFile() {
         return jspUri;
@@ -411,7 +411,7 @@
 
     /**
      * Are we processing something that has been declared as an
-     * errorpage? 
+     * errorpage?
      */
     public boolean isErrorPage() {
         return isErrPage;
@@ -479,7 +479,7 @@
         }
         return derivedPackageName;
     }
-	    
+
     /**
      * The package name into which the servlet class is generated.
      */
@@ -489,7 +489,7 @@
 
     /**
      * Full path name of the Java file into which the servlet is being
-     * generated. 
+     * generated.
      */
     public String getServletJavaFileName() {
         if (servletJavaFileName == null) {
@@ -499,7 +499,7 @@
     }
 
     /**
-     * Get hold of the Options object for this context. 
+     * Get hold of the Options object for this context.
      */
     public Options getOptions() {
         return options;
@@ -565,7 +565,7 @@
 
     /**
      * Gets the 'location' of the TLD associated with the given taglib 'uri'.
-     * 
+     *
      * @return An array of two Strings: The first element denotes the real
      * path to the TLD. If the path to the TLD points to a jar file, then the
      * second element denotes the name of the TLD entry in the jar file.
@@ -573,7 +573,7 @@
      * 'exposed' in the web application.
      */
     public String[] getTldLocation(String uri) throws JasperException {
-        String[] location = 
+        String[] location =
             getOptions().getTldLocationsCache().getLocation(uri);
         return location;
     }
@@ -585,7 +585,7 @@
         return getOptions().getKeepGenerated();
     }
 
-    // ==================== Removal ==================== 
+    // ==================== Removal ====================
 
     public void incrementRemoved() {
         if (removed == 0 && rctxt != null) {
@@ -602,7 +602,7 @@
     }
 
     // ==================== Compile and reload ====================
-    
+
     public void compile() throws JasperException, FileNotFoundException {
         createCompiler();
         if (isPackagedTagFile || jspCompiler.isOutDated()) {
@@ -612,6 +612,7 @@
                 jspCompiler.compile();
                 jsw.setReload(true);
                 jsw.setCompilationException(null);
+                this.getRuntimeContext().addJspDependencies(jsw);
             } catch (JasperException ex) {
                 // Cache compilation exception
                 jsw.setCompilationException(ex);
@@ -629,12 +630,12 @@
 
     // ==================== Manipulating the class ====================
 
-    public Class load() 
+    public Class<?> load()
         throws JasperException, FileNotFoundException
     {
         try {
             getJspLoader();
-            
+
             String name;
             if (isTagFile()) {
                 name = tagInfo.getTagClassName();
@@ -653,7 +654,7 @@
         return servletClass;
     }
 
-    // ==================== protected methods ==================== 
+    // ==================== protected methods ====================
 
     static Object outputDirLock = new Object();
 
@@ -666,7 +667,7 @@
             createOutputDir();
         }
     }
-        
+
     protected boolean makeOutputDir() {
         synchronized(outputDirLock) {
             return getRuntimeContext().getIOProvider().mkdirs(outputDir);
@@ -694,7 +695,7 @@
                 throw new IllegalStateException(Localizer.getMessage("jsp.error.outputfolder"), e);
             }
     }
-    
+
     protected static final boolean isPathSeparator(char c) {
        return (c == '/' || c == '\\');
     }
@@ -740,7 +741,7 @@
                        if (pos+3 < len && isPathSeparator(s.charAt(pos+3))) {
                            pos += 3;
                            int separatorPos = result.length()-1;
-                           while (separatorPos >= 0 && 
+                           while (separatorPos >= 0 &&
                                   ! isPathSeparator(result
                                                     .charAt(separatorPos))) {
                                --separatorPos;

Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/Options.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/Options.java?rev=911022&r1=911021&r2=911022&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/Options.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/Options.java Wed Feb 17 15:35:26 2010
@@ -5,9 +5,9 @@
  * 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.
@@ -17,15 +17,12 @@
 
 package org.apache.sling.scripting.jsp.jasper;
 
-import java.io.File;
-import java.util.Map;
-
 import org.apache.sling.scripting.jsp.jasper.compiler.JspConfig;
 import org.apache.sling.scripting.jsp.jasper.compiler.TagPluginManager;
 import org.apache.sling.scripting.jsp.jasper.compiler.TldLocationsCache;
 
 /**
- * A class to hold all init parameters specific to the JSP engine. 
+ * A class to hold all init parameters specific to the JSP engine.
  *
  * @author Anil K. Vijendran
  * @author Hans Bergsten
@@ -59,23 +56,13 @@
      * Should errors be sent to client or thrown into stderr?
      */
     public boolean getSendErrorToClient();
- 
+
     /**
      * Should we include debug information in compiled class?
      */
     public boolean getClassDebugInfo();
 
     /**
-     * Background compile thread check interval in seconds
-     */
-    public int getCheckInterval();
-
-    /**
-     * Is Jasper being used in development mode?
-     */
-    public boolean getDevelopment();
-
-    /**
      * Should we include a source fragment in exception messages, which could be displayed
      * to the developer ?
      */
@@ -99,7 +86,7 @@
     public boolean getTrimSpaces();
 
     /**
-     * Class ID for use in the plugin tag when the browser is IE. 
+     * Class ID for use in the plugin tag when the browser is IE.
      */
     public String getIeClassId();
 
@@ -113,14 +100,14 @@
      * generated from JSP files?
      */
     public String getClassPath();
-    
+
     /**
      * The classloader to use when compiling servlets generated from JSP files
      * and to load the servlets.
      * <p>
      * If this method returns <code>null</code> the
      * {@link org.apache.sling.scripting.jsp.jasper.servlet.JasperLoader} class is used.
-     * 
+     *
      * @return The <code>ClassLoader</code> to use for compilation and JSP
      *      loading or <code>null</code> to use the <code>JasperLoader</code>.
      */
@@ -139,19 +126,19 @@
     /**
      * Compiler source VM, e.g. 1.3, 1.4, or 1.5.
      */
-    public String getCompilerSourceVM();   
+    public String getCompilerSourceVM();
 
     /**
      * Java compiler class to use.
      */
-    public String getCompilerClassName();   
+    public String getCompilerClassName();
 
     /**
      * The cache for the location of the TLD's
      * for the various tag libraries 'exposed'
      * by the web application.
-     * A tag library is 'exposed' either explicitely in 
-     * web.xml or implicitely via the uri tag in the TLD 
+     * A tag library is 'exposed' either explicitely in
+     * web.xml or implicitely via the uri tag in the TLD
      * of a taglib deployed in a jar file (WEB-INF/lib).
      *
      * @return the instance of the TldLocationsCache
@@ -171,7 +158,7 @@
     public boolean getFork();
 
     /**
-     * Obtain JSP configuration informantion specified in web.xml.  
+     * Obtain JSP configuration informantion specified in web.xml.
      */
     public JspConfig getJspConfig();
 
@@ -189,24 +176,4 @@
      * Are Text strings to be generated as char arrays?
      */
     public boolean genStringAsCharArray();
-    
-    /**
-     * Modification test interval.
-     */
-    public int getModificationTestInterval();
-    
-    /**
-     * Is caching enabled (used for precompilation).
-     */
-    public boolean isCaching();
-    
-    /**
-     * The web-application wide cache for the returned TreeNode
-     * by parseXMLDocument in TagLibraryInfoImpl.parseTLD,
-     * if isCaching returns true.
-     * 
-     * @return the Map(String uri, TreeNode tld) instance.
-     */
-    public Map getCache();
-    
 }

Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/Compiler.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/Compiler.java?rev=911022&r1=911021&r2=911022&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/Compiler.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/Compiler.java Wed Feb 17 15:35:26 2010
@@ -324,9 +324,9 @@
             // In development mode, they are used for detailed
             // error messages.
             // http://issues.apache.org/bugzilla/show_bug.cgi?id=37062
-            if (!this.options.getDevelopment()) {
-                pageNodes = null;
-            }
+            //if (!this.options.getDevelopment()) {
+            //    pageNodes = null;
+            //}
 
             if (ctxt.getWriter() != null) {
                 ctxt.getWriter().close();
@@ -354,19 +354,13 @@
      *            .java file.
      */
     public boolean isOutDated(boolean checkClass) {
-
+        if ( jsw.getLastModificationTest() != 0 ) {
+            return false;
+        }
         String jsp = ctxt.getJspFile();
 
-        if (jsw != null
-                && (ctxt.getOptions().getModificationTestInterval() > 0)) {
-
-            if (jsw.getLastModificationTest()
-                    + (ctxt.getOptions().getModificationTestInterval() * 1000) > System
-                    .currentTimeMillis()) {
-                return false;
-            } else {
-                jsw.setLastModificationTest(System.currentTimeMillis());
-            }
+        if (jsw != null) {
+            jsw.setLastModificationTest(System.currentTimeMillis());
         }
 
         long jspRealLastModified = 0;

Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspDocumentParser.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspDocumentParser.java?rev=911022&r1=911021&r2=911022&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspDocumentParser.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspDocumentParser.java Wed Feb 17 15:35:26 2010
@@ -5,9 +5,9 @@
  * 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.
@@ -20,7 +20,6 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
-
 import java.util.Iterator;
 import java.util.List;
 import java.util.jar.JarFile;
@@ -78,7 +77,7 @@
      * Outermost (in the nesting hierarchy) node whose body is declared to be
      * scriptless. If a node's body is declared to be scriptless, all its
      * nested nodes must be scriptless, too.
-     */ 
+     */
     private Node scriptlessBodyNode;
 
     private Locator locator;
@@ -249,7 +248,7 @@
      * Receives notification of the start of an element.
      *
      * This method assigns the given tag attributes to one of 3 buckets:
-     * 
+     *
      * - "xmlns" attributes that represent (standard or custom) tag libraries.
      * - "xmlns" attributes that do not represent tag libraries.
      * - all remaining attributes.
@@ -291,7 +290,7 @@
         if (attrs != null) {
             /*
              * Notice that due to a bug in the underlying SAX parser, the
-             * attributes must be enumerated in descending order. 
+             * attributes must be enumerated in descending order.
              */
             boolean isTaglib = false;
             for (int i = attrs.getLength() - 1; i >= 0; i--) {
@@ -443,7 +442,7 @@
      * invoke this method with chunks of it.  This is a problem when we try
      * to determine if the text contains only whitespaces, or when we are
      * looking for an EL expression string.  Therefore it is necessary to
-     * buffer and concatenate the chunks and process the concatenated text 
+     * buffer and concatenate the chunks and process the concatenated text
      * later (at beginTag and endTag)
      *
      * @param buf The characters
@@ -757,7 +756,7 @@
     }
 
     /*
-     * Receives notification of the start of a Namespace mapping. 
+     * Receives notification of the start of a Namespace mapping.
      */
     public void startPrefixMapping(String prefix, String uri)
         throws SAXException {
@@ -766,7 +765,7 @@
         if (directivesOnly && !(JSP_URI.equals(uri))) {
             return;
         }
-        
+
         try {
             taglibInfo = getTaglibInfo(prefix, uri);
         } catch (JasperException je) {
@@ -787,7 +786,7 @@
     }
 
     /*
-     * Receives notification of the end of a Namespace mapping. 
+     * Receives notification of the end of a Namespace mapping.
      */
     public void endPrefixMapping(String prefix) throws SAXException {
 
@@ -1251,29 +1250,21 @@
 
             String[] location = ctxt.getTldLocation(uri);
             if (location != null || !isPlainUri) {
-                if (ctxt.getOptions().isCaching()) {
-                    result = (TagLibraryInfoImpl) ctxt.getOptions().getCache().get(uri);
-                }
-                if (result == null) {
-                    /*
-                     * If the uri value is a plain uri, a translation error must
-                     * not be generated if the uri is not found in the taglib map.
-                     * Instead, any actions in the namespace defined by the uri
-                     * value must be treated as uninterpreted.
-                     */
-                    result =
-                        new TagLibraryInfoImpl(
-                            ctxt,
-                            parserController,
-                            pageInfo,
-                            prefix,
-                            uri,
-                            location,
-                            err);
-                    if (ctxt.getOptions().isCaching()) {
-                        ctxt.getOptions().getCache().put(uri, result);
-                    }
-                }
+                /*
+                 * If the uri value is a plain uri, a translation error must
+                 * not be generated if the uri is not found in the taglib map.
+                 * Instead, any actions in the namespace defined by the uri
+                 * value must be treated as uninterpreted.
+                 */
+                result =
+                    new TagLibraryInfoImpl(
+                        ctxt,
+                        parserController,
+                        pageInfo,
+                        prefix,
+                        uri,
+                        location,
+                        err);
             }
         }
 
@@ -1401,7 +1392,7 @@
         //factory.setFeature(
         //    "http://xml.org/sax/features/validation",
         //    validating);
-        
+
         // Configure the parser
         SAXParser saxParser = factory.newSAXParser();
         XMLReader xmlReader = saxParser.getXMLReader();

Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java?rev=911022&r1=911021&r2=911022&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java Wed Feb 17 15:35:26 2010
@@ -5,9 +5,9 @@
  * 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.
@@ -18,7 +18,6 @@
 package org.apache.sling.scripting.jsp.jasper.compiler;
 
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.FilePermission;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -26,8 +25,12 @@
 import java.security.PermissionCollection;
 import java.security.Policy;
 import java.security.cert.Certificate;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 import javax.servlet.ServletContext;
@@ -37,7 +40,6 @@
 import org.apache.juli.logging.LogFactory;
 import org.apache.sling.scripting.jsp.jasper.Constants;
 import org.apache.sling.scripting.jsp.jasper.IOProvider;
-import org.apache.sling.scripting.jsp.jasper.JspCompilationContext;
 import org.apache.sling.scripting.jsp.jasper.Options;
 import org.apache.sling.scripting.jsp.jasper.runtime.JspFactoryImpl;
 import org.apache.sling.scripting.jsp.jasper.security.SecurityClassLoad;
@@ -119,34 +121,25 @@
             parentClassLoader = this.getClass().getClassLoader();
         }
 
-	if (log.isDebugEnabled()) {
-	    if (parentClassLoader != null) {
-		log.debug(Localizer.getMessage("jsp.message.parent_class_loader_is",
+        if (log.isDebugEnabled()) {
+            if (parentClassLoader != null) {
+                log.debug(Localizer.getMessage("jsp.message.parent_class_loader_is",
 					       parentClassLoader.toString()));
-	    } else {
-		log.debug(Localizer.getMessage("jsp.message.parent_class_loader_is",
+            } else {
+                log.debug(Localizer.getMessage("jsp.message.parent_class_loader_is",
 					       "<none>"));
-	    }
+            }
         }
 
         initClassPath();
 
-	if (context instanceof org.apache.sling.scripting.jsp.jasper.servlet.JspCServletContext) {
-	    return;
-	}
+    	if (context instanceof org.apache.sling.scripting.jsp.jasper.servlet.JspCServletContext) {
+    	    return;
+    	}
 
         if (Constants.IS_SECURITY_ENABLED) {
             initSecurity();
         }
-
-        // If this web application context is running from a
-        // directory, start the background compilation thread
-        String appBase = context.getRealPath("/");         
-        if (!options.getDevelopment()
-                && appBase != null
-                && options.getCheckInterval() > 0) {
-            lastCheck = System.currentTimeMillis();
-        }                                            
     }
 
     // ----------------------------------------------------- Instance Variables
@@ -158,18 +151,66 @@
     private Options options;
     private ClassLoader parentClassLoader;
     private PermissionCollection permissionCollection;
-    private CodeSource codeSource;                    
+    private CodeSource codeSource;
     private String classpath;
-    private long lastCheck = -1L;
 
     /**
      * Maps JSP pages to their JspServletWrapper's
      */
     private Map<String, JspServletWrapper> jsps = new ConcurrentHashMap<String, JspServletWrapper>();
- 
+
+    /**
+     * Maps dependencies to the using jsp.
+     */
+    private Map<String, Set<String>> depToJsp = new HashMap<String, Set<String>>();
 
     // ------------------------------------------------------ Public Methods
 
+    public void addJspDependencies(final JspServletWrapper jsw) {
+        final List<String> deps = jsw.getDependants();
+        if ( deps != null ) {
+            final String jspUri = jsw.getJspUri();
+            synchronized ( depToJsp ) {
+                for(final String dep : deps) {
+                    Set<String> set = depToJsp.get(dep);
+                    if ( set == null ) {
+                        set = new HashSet<String>();
+                        depToJsp.put(dep, set);
+                    }
+                    set.add(jspUri);
+                }
+            }
+        }
+    }
+
+    private void invalidate(final JspServletWrapper jsw) {
+        System.out.println("Invalidation " + jsw.getJspUri());
+        jsw.setLastModificationTest(0);
+    }
+
+    public void handleModification(final String scriptName) {
+        synchronized ( this ) {
+            // first check if jsps contains this
+            JspServletWrapper wrapper = jsps.get(scriptName);
+            if ( wrapper != null ) {
+                invalidate(wrapper);
+            }
+            if ( wrapper == null ) {
+                synchronized ( depToJsp ) {
+                    final Set<String> deps = depToJsp.get(scriptName);
+                    if ( deps != null ) {
+                        for(final String jspName : deps) {
+                            wrapper = jsps.get(jspName);
+                            if ( wrapper != null ) {
+                                invalidate(wrapper);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
     /**
      * Add a new JspServletWrapper.
      *
@@ -190,6 +231,13 @@
         return jsps.get(jspUri);
     }
 
+    public JspServletWrapper getAWrapper() {
+        if ( jsps.size() > 0 ) {
+            return jsps.values().iterator().next();
+        }
+        return null;
+    }
+
     /**
      * Remove a  JspServletWrapper.
      *
@@ -239,12 +287,12 @@
     }
 
     /**
-     * Process a "destory" event for this web application context.
-     */                                                        
+     * Process a "destroy" event for this web application context.
+     */
     public void destroy() {
-        Iterator servlets = jsps.values().iterator();
+        Iterator<JspServletWrapper> servlets = jsps.values().iterator();
         while (servlets.hasNext()) {
-            ((JspServletWrapper) servlets.next()).destroy();
+            servlets.next().destroy();
         }
     }
 
@@ -273,44 +321,6 @@
         return jspReloadCount;
     }
 
-
-    /**
-     * Method used by background thread to check the JSP dependencies
-     * registered with this class for JSP's.
-     */
-    public void checkCompile() {
-
-        if (lastCheck < 0) {
-            // Checking was disabled
-            return;
-        }
-        long now = System.currentTimeMillis();
-        if (now > (lastCheck + (options.getCheckInterval() * 1000L))) {
-            lastCheck = now;
-        } else {
-            return;
-        }
-        
-        Object [] wrappers = jsps.values().toArray();
-        for (int i = 0; i < wrappers.length; i++ ) {
-            JspServletWrapper jsw = (JspServletWrapper)wrappers[i];
-            JspCompilationContext ctxt = jsw.getJspEngineContext();
-            // JspServletWrapper also synchronizes on this when
-            // it detects it has to do a reload
-            synchronized(jsw) {
-                try {
-                    ctxt.compile();
-                } catch (FileNotFoundException ex) {
-                    ctxt.incrementRemoved();
-                } catch (Throwable t) {
-                    jsw.getServletContext().log("Background compile failed",
-						t);
-                }
-            }
-        }
-
-    }
-
     /**
      * The classpath that is passed off to the Java compiler.
      */
@@ -362,7 +372,7 @@
                     cpath.append(urls[i].getFile() + sep);
                 }
             }
-        }    
+        }
 
 	cpath.append(options.getScratchDir() + sep);
 
@@ -389,7 +399,7 @@
         // for that directory.
         Policy policy = Policy.getPolicy();
         if( policy != null ) {
-            try {          
+            try {
                 // Get the permissions for the web app context
                 String docBase = context.getRealPath("/");
                 if( docBase == null ) {

Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspUtil.java?rev=911022&r1=911021&r2=911022&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspUtil.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspUtil.java Wed Feb 17 15:35:26 2010
@@ -5,9 +5,9 @@
  * 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.
@@ -29,7 +29,6 @@
 import javax.el.FunctionMapper;
 import javax.servlet.jsp.el.ExpressionEvaluator;
 
-
 import org.apache.el.ExpressionFactoryImpl;
 import org.apache.sling.scripting.jsp.jasper.Constants;
 import org.apache.sling.scripting.jsp.jasper.JasperException;
@@ -37,7 +36,7 @@
 import org.apache.sling.scripting.jsp.jasper.el.ExpressionEvaluatorImpl;
 import org.xml.sax.Attributes;
 
-/** 
+/**
  * This class has all the utility method(s).
  * Ideally should move all the bean containers here.
  *
@@ -60,10 +59,10 @@
     private static final String CLOSE_EXPR_XML = "%";
 
     private static int tempSequenceNumber = 0;
-    
+
     //private static ExpressionEvaluatorImpl expressionEvaluator
     //= new ExpressionEvaluatorImpl();
-    
+
     //tc6
     private final static ExpressionEvaluator expressionEvaluator =
         new ExpressionEvaluatorImpl(new ExpressionFactoryImpl());
@@ -81,7 +80,7 @@
         "volatile", "while" };
 
     public static final int CHUNKSIZE = 1024;
-        
+
     public static char[] removeQuotes(char []chars) {
         CharArrayWriter caw = new CharArrayWriter();
         for (int i = 0; i < chars.length; i++) {
@@ -154,7 +153,7 @@
     }
 
     /**
-     * @return the "expression" part of a runtime expression, 
+     * @return the "expression" part of a runtime expression,
      * taking the delimiters out.
      */
     public static String getExpr (String expression, boolean isXml) {
@@ -169,7 +168,7 @@
         closeExpr = CLOSE_EXPR;
     }
     int length = expression.length();
-    if (expression.startsWith(openExpr) && 
+    if (expression.startsWith(openExpr) &&
                 expression.endsWith(closeExpr)) {
         returnString = expression.substring(
                                openExpr.length(), length - closeExpr.length());
@@ -186,7 +185,7 @@
         String returnString;
         int length = expression.length();
 
-        if (expression.startsWith(OPEN_EXPR) 
+        if (expression.startsWith(OPEN_EXPR)
                 && expression.endsWith(CLOSE_EXPR)) {
             returnString = expression.substring (1, length - 1);
         } else {
@@ -220,7 +219,7 @@
      * Checks if all mandatory attributes are present and if all attributes
      * present have valid names.  Checks attributes specified as XML-style
      * attributes as well as attributes specified using the jsp:attribute
-     * standard action. 
+     * standard action.
      */
     public static void checkAttributes(String typeOfTag,
                        Node n,
@@ -271,7 +270,7 @@
     String missingAttribute = null;
 
     for (int i = 0; i < validAttributes.length; i++) {
-        int attrPos;    
+        int attrPos;
         if (validAttributes[i].mandatory) {
                 attrPos = temp.indexOf(validAttributes[i].name);
         if (attrPos != -1) {
@@ -313,25 +312,25 @@
     }
     // XXX *could* move EL-syntax validation here... (sb)
     }
-    
+
     public static String escapeQueryString(String unescString) {
     if ( unescString == null )
         return null;
-    
+
     String escString    = "";
     String shellSpChars = "\\\"";
-    
+
     for(int index=0; index<unescString.length(); index++) {
         char nextChar = unescString.charAt(index);
-        
+
         if( shellSpChars.indexOf(nextChar) != -1 )
         escString += "\\";
-        
+
         escString += nextChar;
     }
     return escString;
     }
- 
+
     /**
      *  Escape the 5 entities defined by XML.
      */
@@ -379,7 +378,7 @@
         buf.append(with);
         begin = end + 1;
     }
-    
+
     return buf.toString();
     }
 
@@ -404,12 +403,12 @@
         this (name, false);
     }
     }
-    
+
     /**
      * Convert a String value to 'boolean'.
      * Besides the standard conversions done by
      * Boolean.valueOf(s).booleanValue(), the value "yes"
-     * (ignore case) is also converted to 'true'. 
+     * (ignore case) is also converted to 'true'.
      * If 's' is null, then 'false' is returned.
      *
      * @param s the string to be converted
@@ -479,7 +478,7 @@
     // Array of more than i dimension
     return java.lang.reflect.Array.newInstance(c, new int[dims]).getClass();
     }
-    
+
     /**
      * Produces a String representing a call to the EL interpreter.
      * @param expression a String containing zero or more "${}" expressions
@@ -492,7 +491,7 @@
                      String expression,
                                          Class expectedType,
                                          String fnmapvar,
-                                         boolean XmlEscape ) 
+                                         boolean XmlEscape )
     {
         /*
          * Determine which context object to use.
@@ -532,12 +531,12 @@
         } else if (expectedType.equals(Float.TYPE)) {
         targetType = Float.class.getName();
         primitiveConverterMethod = "floatValue";
-        } else if (expectedType.equals(Double.TYPE)) { 
+        } else if (expectedType.equals(Double.TYPE)) {
         targetType = Double.class.getName();
         primitiveConverterMethod = "doubleValue";
         }
     }
- 
+
     if (primitiveConverterMethod != null) {
         XmlEscape = false;
     }
@@ -562,11 +561,11 @@
                + "org.apache.sling.scripting.jsp.jasper.runtime.PageContextImpl.proprietaryEvaluate"
                + "(" + Generator.quote(expression) + ", "
                +       targetType + ".class, "
-           +       "(PageContext)" + jspCtxt 
+           +       "(PageContext)" + jspCtxt
                +       ", " + fnmapvar
            + ", " + XmlEscape
                + ")");
- 
+
     /*
          * Add the primitive converter method if we need to.
          */
@@ -574,7 +573,7 @@
         call.insert(0, "(");
         call.append(")." + primitiveConverterMethod + "()");
     }
- 
+
     return call.toString();
     }
 
@@ -585,6 +584,7 @@
      * @param err an error dispatcher to use
      * @deprecated now delegated to the org.apache.el Package
      */
+    @Deprecated
     public static void validateExpressions(Mark where,
                                            String expressions,
                                            Class expectedType,
@@ -593,8 +593,8 @@
             throws JasperException {
 
 //        try {
-//            
-//            JspUtil.expressionEvaluator.parseExpression( expressions, 
+//
+//            JspUtil.expressionEvaluator.parseExpression( expressions,
 //                expectedType, functionMapper );
 //        }
 //        catch( ELParseException e ) {
@@ -786,7 +786,7 @@
         return "((short) " + Short.valueOf(s).toString() + ")";
     }
     }
-    
+
     public static String coerceToShort(String s, boolean isNamedAttribute) {
     if (isNamedAttribute) {
         return "(Short) org.apache.sling.scripting.jsp.jasper.runtime.JspRuntimeLibrary.coerce(" + s + ", Short.class)";
@@ -799,7 +799,7 @@
         }
     }
     }
-    
+
     public static String coerceToPrimitiveLong(String s,
                            boolean isNamedAttribute) {
     if (isNamedAttribute) {
@@ -857,7 +857,7 @@
      * @param path Tag file path
      * @param err Error dispatcher
      *
-     * @return Fully-qualified class name of the tag handler corresponding to 
+     * @return Fully-qualified class name of the tag handler corresponding to
      * the given tag file path
      */
     public static String getTagHandlerClassName(String path,
@@ -867,7 +867,7 @@
         String className = null;
         int begin = 0;
         int index;
-        
+
         index = path.lastIndexOf(".tag");
         if (index == -1) {
             err.jspError("jsp.error.tagfile.badSuffix", path);
@@ -898,7 +898,7 @@
     }
 
         className += makeJavaPackage(path.substring(begin));
-  
+
        return className;
     }
 
@@ -948,7 +948,7 @@
         }
         return result;
     }
-            
+
     /**
      * Converts the given identifier to a legal Java identifier
      *
@@ -957,7 +957,7 @@
      * @return Legal Java identifier corresponding to the given identifier
      */
     public static final String makeJavaIdentifier(String identifier) {
-        StringBuffer modifiedIdentifier = 
+        StringBuffer modifiedIdentifier =
             new StringBuffer(identifier.length());
         if (!Character.isJavaIdentifierStart(identifier.charAt(0))) {
             modifiedIdentifier.append('_');
@@ -977,7 +977,7 @@
         }
         return modifiedIdentifier.toString();
     }
-    
+
     /**
      * Mangle the specified character to create a legal Java class name.
      */
@@ -1061,14 +1061,14 @@
 
         return reader;
     }
-    
+
     /**
      * Handles taking input from TLDs
      * 'java.lang.Object' -> 'java.lang.Object.class'
      * 'int' -> 'int.class'
      * 'void' -> 'Void.TYPE'
      * 'int[]' -> 'int[].class'
-     * 
+     *
      * @param type
      * @return
      */

Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/Parser.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/Parser.java?rev=911022&r1=911021&r2=911022&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/Parser.java (original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/Parser.java Wed Feb 17 15:35:26 2010
@@ -5,9 +5,9 @@
  * 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.
@@ -37,7 +37,7 @@
  * This class implements a parser for a JSP page (non-xml view). JSP page
  * grammar is included here for reference. The token '#' that appears in the
  * production indicates the current input token location in the production.
- * 
+ *
  * @author Kin-man Chung
  * @author Shawn Bayern
  * @author Mark Roth
@@ -95,7 +95,7 @@
 
     /**
      * The main entry for Parser
-     * 
+     *
      * @param pc
      *            The ParseController, use for getting other objects in compiler
      *            and for parsing included pages
@@ -411,18 +411,9 @@
                 }
                 if (pageInfo.getTaglib(uri) == null) {
                     TagLibraryInfoImpl impl = null;
-                    if (ctxt.getOptions().isCaching()) {
-                        impl = (TagLibraryInfoImpl) ctxt.getOptions()
-                                .getCache().get(uri);
-                    }
-                    if (impl == null) {
-                        String[] location = ctxt.getTldLocation(uri);
-                        impl = new TagLibraryInfoImpl(ctxt, parserController, pageInfo,
-                                prefix, uri, location, err);
-                        if (ctxt.getOptions().isCaching()) {
-                            ctxt.getOptions().getCache().put(uri, impl);
-                        }
-                    }
+                    String[] location = ctxt.getTldLocation(uri);
+                    impl = new TagLibraryInfoImpl(ctxt, parserController, pageInfo,
+                            prefix, uri, location, err);
                     pageInfo.addTaglib(uri, impl);
                 }
                 pageInfo.addPrefixMapping(prefix, uri);
@@ -447,7 +438,7 @@
      * Parses a directive with the following syntax: Directive ::= S? ( 'page'
      * PageDirective | 'include' IncludeDirective | 'taglib' TagLibDirective) S?
      * '%>'
-     * 
+     *
      * TagDirective ::= S? ('tag' PageDirective | 'include' IncludeDirective |
      * 'taglib' TagLibDirective) | 'attribute AttributeDirective | 'variable
      * VariableDirective S? '%>'
@@ -507,11 +498,11 @@
 
     /*
      * Parses a directive with the following syntax:
-     * 
+     *
      * XMLJSPDirectiveBody ::= S? ( ( 'page' PageDirectiveAttrList S? ( '/>' | (
      * '>' S? ETag ) ) | ( 'include' IncludeDirectiveAttrList S? ( '/>' | ( '>'
      * S? ETag ) ) | <TRANSLATION_ERROR>
-     * 
+     *
      * XMLTagDefDirectiveBody ::= ( ( 'tag' TagDirectiveAttrList S? ( '/>' | (
      * '>' S? ETag ) ) | ( 'include' IncludeDirectiveAttrList S? ( '/>' | ( '>'
      * S? ETag ) ) | ( 'attribute' AttributeDirectiveAttrList S? ( '/>' | ( '>'
@@ -838,13 +829,13 @@
 
     /*
      * For Include: StdActionContent ::= Attributes ParamBody
-     * 
+     *
      * ParamBody ::= EmptyBody | ( '>' S? ( '<jsp:attribute' NamedAttributes )? '<jsp:body'
      * (JspBodyParam | <TRANSLATION_ERROR> ) S? ETag ) | ( '>' S? Param* ETag )
-     * 
+     *
      * EmptyBody ::= '/>' | ( '>' ETag ) | ( '>' S? '<jsp:attribute'
      * NamedAttributes ETag )
-     * 
+     *
      * JspBodyParam ::= S? '>' Param* '</jsp:body>'
      */
     private void parseInclude(Node parent) throws JasperException {
@@ -965,23 +956,23 @@
      * since the syntax is identical (the only thing that differs substantially
      * is how to process the body, and thus we accept the body type as a
      * parameter).
-     * 
+     *
      * OptionalBody ::= EmptyBody | ActionBody
-     * 
+     *
      * ScriptlessOptionalBody ::= EmptyBody | ScriptlessActionBody
-     * 
+     *
      * TagDependentOptionalBody ::= EmptyBody | TagDependentActionBody
-     * 
+     *
      * EmptyBody ::= '/>' | ( '>' ETag ) | ( '>' S? '<jsp:attribute'
      * NamedAttributes ETag )
-     * 
+     *
      * ActionBody ::= JspAttributeAndBody | ( '>' Body ETag )
-     * 
+     *
      * ScriptlessActionBody ::= JspAttributeAndBody | ( '>' ScriptlessBody ETag )
-     * 
+     *
      * TagDependentActionBody ::= JspAttributeAndBody | ( '>' TagDependentBody
      * ETag )
-     * 
+     *
      */
     private void parseOptionalBody(Node parent, String tag, String bodyType)
             throws JasperException {
@@ -1008,7 +999,7 @@
     /**
      * Attempts to parse 'JspAttributeAndBody' production. Returns true if it
      * matched, or false if not. Assumes EmptyBody is okay as well.
-     * 
+     *
      * JspAttributeAndBody ::= ( '>' # S? ( '<jsp:attribute' NamedAttributes )? '<jsp:body' (
      * JspBodyBody | <TRANSLATION_ERROR> ) S? ETag )
      */
@@ -1068,14 +1059,14 @@
 
     /*
      * For Plugin: StdActionContent ::= Attributes PluginBody
-     * 
+     *
      * PluginBody ::= EmptyBody | ( '>' S? ( '<jsp:attribute' NamedAttributes )? '<jsp:body' (
      * JspBodyPluginTags | <TRANSLATION_ERROR> ) S? ETag ) | ( '>' S? PluginTags
      * ETag )
-     * 
+     *
      * EmptyBody ::= '/>' | ( '>' ETag ) | ( '>' S? '<jsp:attribute'
      * NamedAttributes ETag )
-     * 
+     *
      */
     private void parsePlugin(Node parent) throws JasperException {
         Attributes attrs = parseAttributes();
@@ -1159,24 +1150,24 @@
 
     /*
      * # '<' CustomAction CustomActionBody
-     * 
+     *
      * CustomAction ::= TagPrefix ':' CustomActionName
-     * 
+     *
      * TagPrefix ::= Name
-     * 
+     *
      * CustomActionName ::= Name
-     * 
+     *
      * CustomActionBody ::= ( Attributes CustomActionEnd ) | <TRANSLATION_ERROR>
-     * 
+     *
      * Attributes ::= ( S Attribute )* S?
-     * 
+     *
      * CustomActionEnd ::= CustomActionTagDependent | CustomActionJSPContent |
      * CustomActionScriptlessContent
-     * 
+     *
      * CustomActionTagDependent ::= TagDependentOptionalBody
-     * 
+     *
      * CustomActionJSPContent ::= OptionalBody
-     * 
+     *
      * CustomActionScriptlessContent ::= ScriptlessOptionalBody
      */
     private boolean parseCustomTag(Node parent) throws JasperException {