tiles-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r532681 - in /tiles/framework/trunk/tiles-core/src: main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java
Date Thu, 26 Apr 2007 09:38:01 GMT
Author: apetrelli
Date: Thu Apr 26 02:38:00 2007
New Revision: 532681

URL: http://svn.apache.org/viewvc?view=rev&rev=532681
Log:
TILES-165
The key extractor classes have been refactored.

Modified:
    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/impl/KeyedDefinitionsFactoryTilesContainerTest.java

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=532681&r1=532680&r2=532681
==============================================================================
--- 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:38:00 2007
@@ -46,13 +46,6 @@
         "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.
-     */
-    public static final String DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME =
-        "org.apache.tiles.DEFINITIONS_FACTORY.key";
-
-    /**
      * Maps definition factories to their keys.
      */
     protected Map<String, DefinitionsFactory> key2definitionsFactory;
@@ -73,7 +66,7 @@
      * It represents an object able to return a key from a request. Each key
      * maps a different {@link DefinitionsFactory}.
      */
-    public interface KeyExtractor {
+    public static interface KeyExtractor {
 
         /**
          * Returns the definitions factory key.
@@ -88,7 +81,14 @@
      * This is the default factory key. Takes the key from the request-scoped
      * attribute <code>DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME</code>.
      */
-    protected class DefaultKeyExtractor implements KeyExtractor {
+    public static class DefaultKeyExtractor implements KeyExtractor {
+
+        /**
+         * Name of the attribute inside the request that will be used to get the
+         * key of the definitions factory to be used.
+         */
+        public static final String DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME =
+            "org.apache.tiles.impl.KeyedDefinitionsFactoryTilesContainer.DefaultKeyExtractor.KEY";
 
         /**
          * Returns the definitions factory key.

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=532681&r1=532680&r2=532681
==============================================================================
--- 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:38:00 2007
@@ -37,6 +37,7 @@
 import org.apache.tiles.definition.DefinitionsFactory;
 import org.apache.tiles.factory.KeyedDefinitionsFactoryTilesContainerFactory;
 import org.apache.tiles.factory.TilesContainerFactory;
+import org.apache.tiles.impl.KeyedDefinitionsFactoryTilesContainer.DefaultKeyExtractor;
 import org.apache.tiles.locale.impl.DefaultLocaleResolver;
 import org.apache.tiles.util.RollingVectorEnumeration;
 import org.easymock.EasyMock;
@@ -191,7 +192,7 @@
         EasyMock.expect(session.getAttribute(DefaultLocaleResolver.LOCALE_KEY)).andReturn(null).anyTimes();
         EasyMock.expect(request.getLocale()).andReturn(null).anyTimes();
         EasyMock.expect(request.getAttribute(
-                KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME))
+                DefaultKeyExtractor.DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME))
                 .andReturn(null).anyTimes();
         EasyMock.replay(request);
         EasyMock.replay(session);
@@ -204,7 +205,7 @@
         EasyMock.reset(session);
         EasyMock.reset(response);
         EasyMock.expect(request.getAttribute(
-                KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME))
+                DefaultKeyExtractor.DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME))
                 .andReturn("one").anyTimes();
         EasyMock.expect(request.getSession()).andReturn(session).anyTimes();
         EasyMock.expect(session.getAttribute(DefaultLocaleResolver.LOCALE_KEY)).andReturn(null).anyTimes();
@@ -220,7 +221,7 @@
         EasyMock.reset(session);
         EasyMock.reset(response);
         EasyMock.expect(request.getAttribute(
-                KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME))
+                DefaultKeyExtractor.DEFINITIONS_FACTORY_KEY_ATTRIBUTE_NAME))
                 .andReturn("two").anyTimes();
         EasyMock.expect(request.getSession()).andReturn(session).anyTimes();
         EasyMock.expect(session.getAttribute(DefaultLocaleResolver.LOCALE_KEY)).andReturn(null).anyTimes();



Mime
View raw message