You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ap...@apache.org on 2007/04/26 11:13:50 UTC

svn commit: r532678 - in /tiles/framework/trunk: tiles-api/src/main/java/org/apache/tiles/ tiles-core/src/main/java/org/apache/tiles/definition/digester/ tiles-core/src/main/java/org/apache/tiles/factory/ tiles-core/src/main/java/org/apache/tiles/impl/...

Author: apetrelli
Date: Thu Apr 26 02:13:49 2007
New Revision: 532678

URL: http://svn.apache.org/viewvc?view=rev&rev=532678
Log:
TILES-164
All constants have been refactored.

Modified:
    tiles/framework/trunk/tiles-api/src/main/java/org/apache/tiles/package.html
    tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java
    tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java
    tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java
    tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java
    tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java
    tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactoryTest.java
    tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java
    tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml
    tiles/framework/trunk/tiles-test/src/main/webapp/testinitcontainer.jsp

Modified: tiles/framework/trunk/tiles-api/src/main/java/org/apache/tiles/package.html
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-api/src/main/java/org/apache/tiles/package.html?view=diff&rev=532678&r1=532677&r2=532678
==============================================================================
--- tiles/framework/trunk/tiles-api/src/main/java/org/apache/tiles/package.html (original)
+++ tiles/framework/trunk/tiles-api/src/main/java/org/apache/tiles/package.html Thu Apr 26 02:13:49 2007
@@ -202,7 +202,7 @@
                             /WEB-INF/tiles-tests-defs.xml,/WEB-INF/tiles-tutorial-defs.xml,
                             /WEB-INF/tiles-examples-defs.xml&" />
     <set-property property=&"moduleAware&" value=&"true&" />
-    <set-property property=&"definitions-parser-validate&" value=&"true&" />
+    <set-property property=&"org.apache.tiles.definition.digester.DigesterDefinitionsReader.PARSER_VALIDATE&" value=&"true&" />
   </plug-in>
 </pre>
     <ul>
@@ -212,7 +212,7 @@
                 </li>
             </ul>
         </li>
-        <li>definitions-parser-validate: (optional)
+        <li>org.apache.tiles.definition.digester.DigesterDefinitionsReader.PARSER_VALIDATE: (optional)
             <ul>
                 <li>Specify if XML parser should validate the Tiles configuration
                     file
@@ -296,7 +296,7 @@
 		false : no validation
 		--&gt; 	
     &lt;init-param&gt;
-      &lt;param-name&gt;definitions-parser-validate&lt;/param-name&gt;
+      &lt;param-name&gt;org.apache.tiles.definition.digester.DigesterDefinitionsReader.PARSER_VALIDATE&lt;/param-name&gt;
       &lt;param-value&gt;true&lt;/param-value&gt;
     &lt;/init-param&gt;
      ...
@@ -319,7 +319,7 @@
       &lt;param-value&gt;/WEB-INF/tiles-defs.xml&lt;/param-value&gt;
     &lt;/init-param&gt;
     &lt;init-param&gt;
-      &lt;param-name&gt;definitions-parser-validate&lt;/param-name&gt;
+      &lt;param-name&gt;org.apache.tiles.definition.digester.DigesterDefinitionsReader.PARSER_VALIDATE&lt;/param-name&gt;
       &lt;param-value&gt;true&lt;/param-value&gt;
     &lt;/init-param&gt;
    ...

Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java?view=diff&rev=532678&r1=532677&r2=532678
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java Thu Apr 26 02:13:49 2007
@@ -34,24 +34,28 @@
 import java.util.Map;
 
 /**
- * Reads {@link org.apache.tiles.definition.Definition Definition} objects
- * from an XML InputStream using Digester.
+ * Reads {@link org.apache.tiles.definition.Definition Definition} objects from
+ * an XML InputStream using Digester. <p/>
+ * <p>
+ * This <code>DefinitionsReader</code> implementation expects the source to be
+ * passed as an <code>InputStream</code>. It parses XML data from the source
+ * and builds a Map of Definition objects.
+ * </p>
  * <p/>
- * <p>This <code>DefinitionsReader</code> implementation expects the source to be
- * passed as an <code>InputStream</code>.  It parses XML data from the source and
- * builds a Map of Definition objects.</p>
- * <p/>
- * <p>The Digester object can be configured by passing in initialization parameters.
- * Currently the only parameter that is supported is the <code>validating</code>
- * parameter.  This value is set to <code>false</code> by default.  To enable DTD
- * validation for XML Definition files, give the init method a parameter
- * with a key of <code>definitions-parser-validate</code> and a value of
- * <code>&quot;true&quot;</code>.
- * <p/>
- * <p>The Definition objects are stored internally in a Map.  The Map is
- * stored as an instance variable rather than a local variable in the <code>read</code>
- * method.  This means that instances of this class are <strong>not</strong>
- * thread-safe and access by multiple threads must be synchronized.</p>
+ * <p>
+ * The Digester object can be configured by passing in initialization
+ * parameters. Currently the only parameter that is supported is the
+ * <code>validating</code> parameter. This value is set to <code>false</code>
+ * by default. To enable DTD validation for XML Definition files, give the init
+ * method a parameter with a key of
+ * <code>org.apache.tiles.definition.digester.DigesterDefinitionsReader.PARSER_VALIDATE</code>
+ * and a value of <code>&quot;true&quot;</code>. <p/>
+ * <p>
+ * The Definition objects are stored internally in a Map. The Map is stored as
+ * an instance variable rather than a local variable in the <code>read</code>
+ * method. This means that instances of this class are <strong>not</strong>
+ * thread-safe and access by multiple threads must be synchronized.
+ * </p>
  *
  * @version $Rev$ $Date$
  */
@@ -61,7 +65,7 @@
      * Digester validation parameter name.
      */
     public static final String PARSER_VALIDATE_PARAMETER_NAME =
-        "definitions-parser-validate";
+        "org.apache.tiles.definition.digester.DigesterDefinitionsReader.PARSER_VALIDATE";
 
     // Digester rules constants for tag interception.
 

Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java?view=diff&rev=532678&r1=532677&r2=532678
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java Thu Apr 26 02:13:49 2007
@@ -47,13 +47,13 @@
      * comma-separated list of keys to use.
      */
     public static final String CONTAINER_KEYS_INIT_PARAM =
-        "org.apache.tiles.CONTAINER.keys";
+        "org.apache.tiles.factory.KeyedDefinitionsFactoryTilesContainerFactory.KEYS";
 
     /**
      * Init parameter name that contains the class name for the key extractor.
      */
     public static final String KEY_EXTRACTOR_CLASS_INIT_PARAM =
-        "org.apache.tiles.CONTAINER.keyExtractor";
+        "org.apache.tiles.impl.KeyedDefinitionsFactoryTilesContainer.KeyExtractor";
 
     /** {@inheritDoc} */
     @Override
@@ -118,7 +118,7 @@
             for (int i = 0; i < keys.length; i++) {
                 Map<String, String> initParams = new HashMap<String, String>();
                 String param = initParameters.get(
-                        BasicTilesContainer.DEFINITIONS_CONFIG + "@" + keys[i]);
+                        KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_CONFIG_PREFIX + keys[i]);
                 if (param != null) {
                     initParams.put(BasicTilesContainer.DEFINITIONS_CONFIG,
                             param);

Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java?view=diff&rev=532678&r1=532677&r2=532678
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java Thu Apr 26 02:13:49 2007
@@ -54,33 +54,33 @@
      * name.
      */
     public static final String CONTAINER_FACTORY_INIT_PARAM =
-        "org.apache.tiles.CONTAINER_FACTORY";
+        "org.apache.tiles.factory.TilesContainerFactory";
 
     /**
      * Initialization parameter that indicates if the container factory is
      * mutable.
      */
     public static final String CONTAINER_FACTORY_MUTABLE_INIT_PARAM =
-        "org.apache.tiles.CONTAINER_FACTORY.mutable";
+        "org.apache.tiles.factory.TilesContainerFactory.MUTABLE";
 
     /**
      * Initialization parameter that represents the context factory class name.
      */
     public static final String CONTEXT_FACTORY_INIT_PARAM =
-        "org.apache.tiles.CONTEXT_FACTORY";
+        "org.apache.tiles.context.TilesContextFactory";
 
     /**
      * Initialization parameter that represents the definitions factory class
      * name.
      */
     public static final String DEFINITIONS_FACTORY_INIT_PARAM =
-        "org.apache.tiles.DEFINITIONS_FACTORY";
+        "org.apache.tiles.definition.DefinitionsFactory";
 
     /**
      * Initialization parameter that represents the preparer factory class name.
      */
     public static final String PREPARER_FACTORY_INIT_PARAM =
-        "org.apache.tiles.PREPARER_FACTORY";
+        "org.apache.tiles.preparer.PreparerFactory";
 
 
     /**
@@ -107,7 +107,7 @@
      * specified context.
      * <p/>
      * The context will be queried and if a init parameter
-     * named 'org.apache.tiles.CONTAINER_FACTORY' is discovered
+     * named 'org.apache.tiles.factory.TilesContainerFactory' is discovered
      * this class will be instantiated and returned. Otherwise,
      * the factory will attempt to utilize one of it's internal
      * factories.
@@ -125,9 +125,9 @@
     /**
      * Retrieve a factory instance as configured through the specified context.
      * <p/> The context will be queried and if a init parameter named
-     * 'org.apache.tiles.CONTAINER_FACTORY' is discovered this class will be
-     * instantiated and returned. Otherwise, the factory will attempt to utilize
-     * one of it's internal factories.
+     * 'org.apache.tiles.factory.TilesContainerFactory' is discovered this class
+     * will be instantiated and returned. Otherwise, the factory will attempt to
+     * utilize one of it's internal factories.
      *
      * @param context the executing applications context. Typically a
      * ServletContext or PortletContext

Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java?view=diff&rev=532678&r1=532677&r2=532678
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java Thu Apr 26 02:13:49 2007
@@ -61,7 +61,7 @@
      * Constant representing the configuration parameter
      * used to define the tiles definition resources.
      */
-    public static final String DEFINITIONS_CONFIG = "org.apache.tiles.DEFINITIONS_CONFIG";
+    public static final String DEFINITIONS_CONFIG = "org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG";
 
     /**
      * Compatibility constant.

Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java?view=diff&rev=532678&r1=532677&r2=532678
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java Thu Apr 26 02:13:49 2007
@@ -39,6 +39,13 @@
 public class KeyedDefinitionsFactoryTilesContainer extends BasicTilesContainer {
 
     /**
+     * Constant representing the prefix of the configuration parameter used to
+     * define the tiles definition resources for a specific key.
+     */
+    public static final String DEFINITIONS_CONFIG_PREFIX =
+        "org.apache.tiles.impl.KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_CONFIG@";
+
+    /**
      * Name of the attribute inside the request that will be used to get the key
      * of the definitions factory to be used.
      */

Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactoryTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactoryTest.java?view=diff&rev=532678&r1=532677&r2=532678
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactoryTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactoryTest.java Thu Apr 26 02:13:49 2007
@@ -29,7 +29,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.tiles.TilesContainer;
 import org.apache.tiles.TilesException;
-import org.apache.tiles.impl.BasicTilesContainer;
 import org.apache.tiles.impl.KeyedDefinitionsFactoryTilesContainer;
 
 import java.util.Map;
@@ -102,10 +101,13 @@
         EasyMock.expect(context.getInitParameter(
                 KeyedDefinitionsFactoryTilesContainerFactory.CONTAINER_KEYS_INIT_PARAM))
                 .andReturn("one,two").anyTimes();
-        EasyMock.expect(context.getInitParameter(BasicTilesContainer.DEFINITIONS_CONFIG + "@one"))
+        EasyMock.expect(context.getInitParameter(
+                KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_CONFIG_PREFIX
+                + "one"))
                 .andReturn("/WEB-INF/tiles-one.xml").anyTimes();
-        EasyMock.expect(context.getInitParameter(BasicTilesContainer.DEFINITIONS_CONFIG + "@two"))
-                .andReturn("/WEB-INF/tiles-two.xml").anyTimes();
+        EasyMock.expect(context.getInitParameter(
+                KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_CONFIG_PREFIX
+                + "@two")).andReturn("/WEB-INF/tiles-two.xml").anyTimes();
         EasyMock.expect(context.getInitParameter(EasyMock.isA(String.class))).andReturn(null).anyTimes();
         EasyMock.expect(context.getInitParameterNames()).andReturn(enumeration.elements()).anyTimes();
         URL url = getClass().getResource("test-defs.xml");

Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java?view=diff&rev=532678&r1=532677&r2=532678
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java Thu Apr 26 02:13:49 2007
@@ -68,8 +68,10 @@
 
         Vector<String> v = new Vector<String>();
         v.add(KeyedDefinitionsFactoryTilesContainerFactory.CONTAINER_KEYS_INIT_PARAM);
-        v.add(BasicTilesContainer.DEFINITIONS_CONFIG + "@one");
-        v.add(BasicTilesContainer.DEFINITIONS_CONFIG + "@two");
+        v.add(KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_CONFIG_PREFIX
+                + "one");
+        v.add(KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_CONFIG_PREFIX
+                + "two");
 
         EasyMock.expect(context.getInitParameter(TilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM)).andReturn(null);
         EasyMock.expect(context.getInitParameter(TilesContainerFactory.CONTEXT_FACTORY_INIT_PARAM)).andReturn(null);
@@ -77,10 +79,12 @@
         EasyMock.expect(context.getInitParameter(
                 KeyedDefinitionsFactoryTilesContainerFactory.CONTAINER_KEYS_INIT_PARAM))
                 .andReturn("one,two").anyTimes();
-        EasyMock.expect(context.getInitParameter(BasicTilesContainer.DEFINITIONS_CONFIG + "@one"))
-                .andReturn("/WEB-INF/tiles-one.xml").anyTimes();
-        EasyMock.expect(context.getInitParameter(BasicTilesContainer.DEFINITIONS_CONFIG + "@two"))
-                .andReturn("/WEB-INF/tiles-two.xml").anyTimes();
+        EasyMock.expect(context.getInitParameter(
+                KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_CONFIG_PREFIX
+                + "one")).andReturn("/WEB-INF/tiles-one.xml").anyTimes();
+        EasyMock.expect(context.getInitParameter(
+                KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_CONFIG_PREFIX
+                + "two")).andReturn("/WEB-INF/tiles-two.xml").anyTimes();
         EasyMock.expect(context.getInitParameter(EasyMock.isA(String.class))).andReturn(null).anyTimes();
         EasyMock.expect(context.getInitParameterNames()).andReturn(new RollingVectorEnumeration<String>(v)).anyTimes();
         try {

Modified: tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml?view=diff&rev=532678&r1=532677&r2=532678
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml (original)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml Thu Apr 26 02:13:49 2007
@@ -31,12 +31,12 @@
     <distributable/>
 
     <context-param>
-        <param-name>org.apache.tiles.CONTEXT_FACTORY</param-name>
+        <param-name>org.apache.tiles.context.TilesContextFactory</param-name>
         <param-value>org.apache.tiles.context.enhanced.EnhancedContextFactory</param-value>
     </context-param>
 
     <context-param>
-        <param-name>org.apache.tiles.CONTAINER_FACTORY.mutable</param-name>
+        <param-name>org.apache.tiles.factory.TilesContainerFactory.MUTABLE</param-name>
         <param-value>true</param-value>
     </context-param>
 

Modified: tiles/framework/trunk/tiles-test/src/main/webapp/testinitcontainer.jsp
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/testinitcontainer.jsp?view=diff&rev=532678&r1=532677&r2=532678
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/testinitcontainer.jsp (original)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/testinitcontainer.jsp Thu Apr 26 02:13:49 2007
@@ -26,9 +26,9 @@
 <tiles:destroyContainer/>
 <tiles:initContainer containerFactory="org.apache.tiles.factory.TilesContainerFactory">
     <tiles:putAttribute name="definitions-config" value="/WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml"/>
-    <tiles:putAttribute name="org.apache.tiles.CONTEXT_FACTORY"
+    <tiles:putAttribute name="org.apache.tiles.context.TilesContextFactory"
                value="org.apache.tiles.context.enhanced.EnhancedContextFactory"/>
-    <tiles:putAttribute name="org.apache.tiles.CONTAINER_FACTORY.mutable"
+    <tiles:putAttribute name="org.apache.tiles.factory.TilesContainerFactory.MUTABLE"
                value="true"/>
 </tiles:initContainer>