struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r492136 - in /struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles: factory/ impl/ impl/mgmt/
Date Wed, 03 Jan 2007 13:25:23 GMT
Author: apetrelli
Date: Wed Jan  3 05:25:23 2007
New Revision: 492136

URL: http://svn.apache.org/viewvc?view=rev&rev=492136
Log:
SB-101
Added JavaDocs.
Small change to a name of an internal method.

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/impl/KeyedDefinitionsFactoryTilesContainer.java
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/mgmt/CachingKeyedDefinitionsFactoryTilesContainerFactory.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=492136&r1=492135&r2=492136
==============================================================================
--- 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 05:25:23 2007
@@ -32,9 +32,19 @@
 import org.apache.tiles.impl.mgmt.CachingKeyedDefinitionsFactoryTilesContainerFactory;
 import org.apache.tiles.mgmt.MutableTilesContainer;
 
+/**
+ * Factory that creates instances of container that will extend the
+ * {@link KeyedDefinitionsFactoryTilesContainer} class.
+ *
+ * @version $Rev$ $Date$
+ */
 public class KeyedDefinitionsFactoryTilesContainerFactory extends
 		TilesContainerFactory {
     
+    /**
+     * The name of the initialization parameter that will contain a
+     * comma-separated list of keys to use.
+     */
     public static final String CONTAINER_KEYS_INIT_PARAM =
         "org.apache.tiles.CONTAINER.keys";
 
@@ -57,6 +67,12 @@
     // 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.
+    /**
+     * Creates a definitions factory.
+     * @param context The context object to use.
+     * @return The newly created definitions factory.
+     * @throws TilesException If something goes wrong.
+     */
     public DefinitionsFactory createDefinitionsFactory(Object context)
             throws TilesException {
         DefinitionsFactory retValue;

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=492136&r1=492135&r2=492136
==============================================================================
--- 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 05:25:23 2007
@@ -31,13 +31,29 @@
 import org.apache.tiles.definition.DefinitionsFactory;
 import org.apache.tiles.definition.DefinitionsFactoryException;
 
+/**
+ * Container that can be used to store multiple {@link DefinitionsFactory}
+ * instances mapped to different keys.
+ *
+ * @version $Rev$ $Date$
+ */
 public class KeyedDefinitionsFactoryTilesContainer extends BasicTilesContainer {
     
+    /**
+     * 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;
 
+	/**
+	 * Constructor.
+	 */
 	public KeyedDefinitionsFactoryTilesContainer() {
 		key2definitionsFactory = new HashMap<String, DefinitionsFactory>();
 	}
@@ -45,7 +61,9 @@
 	/**
      * Standard Getter
      *
-     * @return the definitions factory used by this container.
+     * @return the definitions factory used by this container. If the key is not
+     * valid, the default factory will be returned.
+     * @param key The key of the needed definitions factory.
      */
     public DefinitionsFactory getDefinitionsFactory(String key) {
     	DefinitionsFactory retValue = null;
@@ -63,7 +81,9 @@
     /**
      * Standard Getter
      *
-     * @return the definitions factory used by this container.
+     * @return the definitions factory used by this container. If the key is not
+     * valid, <code>null</code> will be returned.
+     * @param key The key of the needed definitions factory.
      */
     public DefinitionsFactory getProperDefinitionsFactory(String key) {
         DefinitionsFactory retValue = null;
@@ -114,6 +134,12 @@
         return retValue;
     }
     
+    /**
+     * Returns the definitions factory key.
+     *
+     * @param request The request object.
+     * @return The needed factory key.
+     */
     protected String getDefinitionsFactoryKey(TilesRequestContext request) {
         String retValue = null;
         Map requestScope = request.getRequestScope();

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/mgmt/CachingKeyedDefinitionsFactoryTilesContainerFactory.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/mgmt/CachingKeyedDefinitionsFactoryTilesContainerFactory.java?view=diff&rev=492136&r1=492135&r2=492136
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/mgmt/CachingKeyedDefinitionsFactoryTilesContainerFactory.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/mgmt/CachingKeyedDefinitionsFactoryTilesContainerFactory.java
Wed Jan  3 05:25:23 2007
@@ -34,6 +34,14 @@
 import org.apache.tiles.mgmt.MutableTilesContainer;
 import org.apache.tiles.mgmt.TileDefinition;
 
+/**
+ * Container that can be used to store multiple {@link DefinitionsFactory}
+ * instances mapped to different keys, with the addition of being "mutable",
+ * i.e.  caches (in memory) the definitions registered to it.  If a definition
+ * is not found in cache, it will revert back to it's definitions factory.
+ *
+ * @version $Rev$ $Date$
+ */
 public class CachingKeyedDefinitionsFactoryTilesContainerFactory extends
         KeyedDefinitionsFactoryTilesContainer implements MutableTilesContainer {
 
@@ -52,7 +60,7 @@
     protected ComponentDefinition getDefinition(String definition,
                                                 TilesRequestContext context)
         throws DefinitionsFactoryException {
-        DefinitionManager mgr = getAppropriateDefinitionManager(
+        DefinitionManager mgr = getProperDefinitionManager(
                 getDefinitionsFactoryKey(context));
         return mgr.getDefinition(definition, context);
     }
@@ -64,7 +72,7 @@
 
     @Override
     public DefinitionsFactory getDefinitionsFactory(String key) {
-        DefinitionManager mgr = getAppropriateDefinitionManager(key);
+        DefinitionManager mgr = getProperDefinitionManager(key);
         return mgr.getFactory();
     }
 
@@ -80,6 +88,13 @@
         mgr.setFactory(definitionsFactory);
     }
     
+    /**
+     * Returns a definition manager if found, otherwise it will create a new
+     * one.
+     *
+     * @param key The key of the definition manager.
+     * @return The needed definition manager.
+     */
     protected DefinitionManager getOrCreateDefinitionManager(String key) {
         DefinitionManager mgr = key2definitionManager.get(key);
         if (mgr == null) {
@@ -90,7 +105,13 @@
         return mgr;
     }
     
-    protected DefinitionManager getAppropriateDefinitionManager(String key) {
+    /**
+     * Returns a definition manager if found.
+     *
+     * @param key The key of the definition manager.
+     * @return The needed definition manager.
+     */
+    protected DefinitionManager getProperDefinitionManager(String key) {
         DefinitionManager mgr = null;
         
         if (key != null) {



Mime
View raw message