morgand     01/08/29 16:14:53

  Modified:    latka/src/java/org/apache/commons/latka LatkaProperties.java
  Log:
  added Javadocs
  
  Revision  Changes    Path
  1.6       +43 -2     
jakarta-commons/latka/src/java/org/apache/commons/latka/LatkaProperties.java
  
  Index: LatkaProperties.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/LatkaProperties.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LatkaProperties.java      2001/08/29 16:53:17     1.5
  +++ LatkaProperties.java      2001/08/29 23:14:53     1.6
  @@ -63,11 +63,20 @@
   import java.util.Properties;
   
   /**
  - * Stores properties for Latka.  Backed by a ThreadLocal 
  - * variable.
  + * Stores properties for Latka.  This class is backed by a 
  + * ThreadLocal variable, so every Thread is guaranteed to
  + * get a unique Properties object.  Note, however, that
  + * inside an environment utilizing a Thread pool, such
  + * as many Servlet engines, it is possible for 
  + * the Properties object to travel quite widely.  Use the
  + * {@link #resetProperties()} method to reset the Properties
  + * object for a Thread to its default values.
  + * 
  + * @author Morgan Delagrange
    */
   public class LatkaProperties {
   
  +  // default Properties file for Latka
     protected static Properties _initProps = loadDefaultProps();
   
     /**
  @@ -77,6 +86,12 @@
     protected static ThreadLocal _propsThreadLocal =
       new LatkaThreadLocal(_initProps);
   
  +  /**
  +   * Returns the unique Properties object for the current
  +   * Thread.
  +   * 
  +   * @return Latka Properties object 
  +   */
     public static Properties getProperties() {
       return(Properties) _propsThreadLocal.get();
     }
  @@ -93,6 +108,14 @@
       props.putAll(_initProps);
     }
   
  +  /**
  +   * Loads the default Properties from the 
  +   * first "latka.properties" file located encountered 
  +   * in the classpath.
  +   * 
  +   * @return A Properties object generated from the contents of the
  +   *         default property file
  +   */
     protected static Properties loadDefaultProps() {
       Properties properties  = new Properties();
       
  @@ -108,14 +131,32 @@
   
     }
   
  +  /**
  +   * Custom ThreadLocal class that automatically initialized
  +   * the default Properties for the Thread.
  +   * 
  +   * @author Morgan Delagrange
  +   */
     private static class LatkaThreadLocal extends ThreadLocal {
   
       protected Properties _initProps = null;
   
  +    /**
  +     * Constructor specifying the default Properties object
  +     * for Latka
  +     * 
  +     * @param initProps default Properties object
  +     */
       public LatkaThreadLocal(Properties initProps) {
         _initProps = initProps;
       }
   
  +    /**
  +     * Returns a clone of the default Properties file
  +     * for Latka
  +     * 
  +     * @return Latka Properties file for the current Thread
  +     */
       protected Object initialValue() {
         return _initProps.clone();
       }
  
  
  

Reply via email to