henning     2003/03/18 02:34:29

  Modified:    src/java/org/apache/turbine/util/template TemplateInfo.java
  Log:
  - Replaced the internal Hashtable with a Map object (HashMap)
  - moved hard coded "template" strings to a constant
  - remove another  replace(",", "/") which is no longer needed
  
  Revision  Changes    Path
  1.6       +13 -16    
jakarta-turbine-2/src/java/org/apache/turbine/util/template/TemplateInfo.java
  
  Index: TemplateInfo.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/template/TemplateInfo.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TemplateInfo.java 9 Mar 2003 02:54:14 -0000       1.5
  +++ TemplateInfo.java 18 Mar 2003 10:34:29 -0000      1.6
  @@ -54,14 +54,16 @@
    * <http://www.apache.org/>.
    */
   
  -import java.util.Hashtable;
  +import java.util.Map;
  +import java.util.HashMap;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
   import org.apache.turbine.services.template.TurbineTemplate;
  -
   import org.apache.turbine.util.RunData;
  +import org.apache.turbine.util.uri.URIConstants;
  +
   
   /**
    * This is a wrapper for Template specific information.  It's part of
  @@ -70,6 +72,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Dave Bryson</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Henning P. Schmiedehausen</a>
    * @version $Id$
    */
   public class TemplateInfo
  @@ -78,7 +81,7 @@
       private static Log log = LogFactory.getLog(TemplateInfo.class);
   
   
  -    /* Constants for tempStorage hashtable. */
  +    /* Constants for tempStorage hash map. */
       public static final String NAVIGATION_TEMPLATE = "00navigation_template00";
       public static final String LAYOUT_TEMPLATE = "00layout_template00";
       public static final String SERVICE_NAME = "template_service";
  @@ -87,7 +90,7 @@
       private RunData data = null;
   
       /* Place to store information about templates. */
  -    private Hashtable tempStorage = null;
  +    private Map tempStorage = null;
   
       /**
        * Constructor
  @@ -97,7 +100,7 @@
       public TemplateInfo(RunData data)
       {
           this.data = data;
  -        tempStorage = new Hashtable(10);
  +        tempStorage = new HashMap(10);
       }
   
       /**
  @@ -135,12 +138,7 @@
        */
       public String getScreenTemplate()
       {
  -        String temp = data.getParameters().getString("template", null);
  -        if (temp != null)
  -        {
  -            temp = temp.replace(',', '/');
  -        }
  -        return temp;
  +        return data.getParameters().getString(URIConstants.CGI_TEMPLATE_PARAM, 
null);
       }
   
       /**
  @@ -151,7 +149,7 @@
        */
       public void setScreenTemplate(String v)
       {
  -        data.getParameters().setString("template", v);
  +        data.getParameters().setString(URIConstants.CGI_TEMPLATE_PARAM, v);
   
           // We have changed the screen template so
           // we should now update the layout template
  @@ -276,12 +274,11 @@
        */
       public void setTemp(String name, Object value)
       {
  -        log.debug("setTemp(" + name + ", " + value + ")");
           tempStorage.put(name, value);
       }
   
       /**
  -     * Return a String[] from the temp hashtable.
  +     * Return a String[] from the temp hash map.
        *
        * @param name A String with the name of the object.
        * @return A String[].
  @@ -298,7 +295,7 @@
       }
   
       /**
  -     * Return a String from the temp hashtable.
  +     * Return a String from the temp hash map.
        *
        * @param name A String with the name of the object.
        * @return A String.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to