struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r492126 - in /struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles: factory/ impl/
Date Wed, 03 Jan 2007 12:45:35 GMT
Author: apetrelli
Date: Wed Jan  3 04:45:34 2007
New Revision: 492126

URL: http://svn.apache.org/viewvc?view=rev&rev=492126
Log:
SB-101
Various fixes to make the keyed definitions factory container work.

Modified:
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java?view=diff&rev=492126&r1=492125&r2=492126
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java
Wed Jan  3 04:45:34 2007
@@ -54,6 +54,20 @@
         return container;
     }
     
+    // FIXME Probably we should create some sort of "FactoryUtils" to create
+    // factories dynamically depending on a configuration.
+    // I think this method does not belong here.
+    public DefinitionsFactory createDefinitionsFactory(Object context)
+            throws TilesException {
+        DefinitionsFactory retValue;
+        Map<String, String> config = new HashMap<String, String>(defaultConfiguration);
+        config.putAll(getInitParameterMap(context));
+        retValue = (DefinitionsFactory) createFactory(config,
+                    DEFINITIONS_FACTORY_INIT_PARAM);
+
+        return retValue;
+    }
+
     @Override
     protected void storeContainerDependencies(Object context,
             BasicTilesContainer container) throws TilesException {
@@ -63,17 +77,16 @@
         if (keysString != null
                 && container instanceof KeyedDefinitionsFactoryTilesContainer) {
             String[] keys = keysString.split(",");
-            Map<String, String> initParams = new HashMap<String, String>();
+            Map<String, String> config = new HashMap<String, String>(defaultConfiguration);
+            config.putAll(getInitParameterMap(context));
             for (int i=0; i < keys.length; i++) {
+                Map<String, String> initParams = new HashMap<String, String>();
                 String param = getInitParameter(context,
                         BasicTilesContainer.DEFINITIONS_CONFIG + "@" + keys[i]);
                 if (param != null) {
                     initParams.put(BasicTilesContainer.DEFINITIONS_CONFIG,
                             param);
                 }
-
-                Map<String, String> config = new HashMap<String, String>(defaultConfiguration);
-                config.putAll(getInitParameterMap(context));
 
                 DefinitionsFactory defsFactory =
                     (DefinitionsFactory) createFactory(config,

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java?view=diff&rev=492126&r1=492125&r2=492126
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java
Wed Jan  3 04:45:34 2007
@@ -219,7 +219,7 @@
             value = getInitParameterMethod.invoke(context, parameterName);
         } catch (Exception e) {
             throw new TilesException("Unrecognized context.  Is this context" +
-                "a ServletContext, PortletContext, or similar?", e);
+                " a ServletContext, PortletContext, or similar?", e);
         }
         return value == null ? null : value.toString();
     }

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java?view=diff&rev=492126&r1=492125&r2=492126
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java
Wed Jan  3 04:45:34 2007
@@ -63,7 +63,7 @@
      * Constant representing the configuration parameter
      * used to define the tiles definition resources.
      */
-    public static final String DEFINITIONS_CONFIG = "org.apache.tiles.DEFINITION_CONFIG";
+    public static final String DEFINITIONS_CONFIG = "org.apache.tiles.DEFINITIONS_CONFIG";
 
     /**
      * Compatibility constant.
@@ -277,7 +277,7 @@
         throws TilesException {
 
         if (LOG.isDebugEnabled()) {
-            LOG.debug("Prepare request recieved for '" + preparerName);
+            LOG.debug("Prepare request received for '" + preparerName);
         }
 
         ViewPreparer preparer = preparerFactory.getPreparer(preparerName, null);

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java?view=diff&rev=492126&r1=492125&r2=492126
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java
Wed Jan  3 04:45:34 2007
@@ -61,6 +61,21 @@
     }
 
     /**
+     * Standard Getter
+     *
+     * @return the definitions factory used by this container.
+     */
+    public DefinitionsFactory getProperDefinitionsFactory(String key) {
+        DefinitionsFactory retValue = null;
+        
+        if (key != null) {
+            retValue = key2definitionsFactory.get(key);
+        }
+        
+        return retValue;
+    }
+
+    /**
      * Set the definitions factory. This method first ensures
      * that the container has not yet been initialized.
      *



Mime
View raw message