jvanzyl     00/10/23 11:27:49

  Modified:    src/java/org/apache/velocity/runtime Runtime.java
  Log:
  - added setDefaultProperties() so that the default properties could
    be nabbed and changed before initializing the runtime. Using this
    for the VelocityTestSuite:
  
    Runtime.setDefaultProperties();
    Runtime.setProperty(Runtime.TEMPLATE_PATH, TEST_TEMPLATE_PATH);
    Runtime.init();
  
    Just let's you change a few properties from the norm before
    initializing the Runtime.
  
  Revision  Changes    Path
  1.26      +17 -5     
jakarta-velocity/src/java/org/apache/velocity/runtime/Runtime.java
  
  Index: Runtime.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/Runtime.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Runtime.java      2000/10/22 21:17:34     1.25
  +++ Runtime.java      2000/10/23 18:27:48     1.26
  @@ -139,7 +139,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Jeff Bowden</a>
  - * @version $Id: Runtime.java,v 1.25 2000/10/22 21:17:34 jvanzyl Exp $
  + * @version $Id: Runtime.java,v 1.26 2000/10/23 18:27:48 jvanzyl Exp $
    */
   public class Runtime
   {
  @@ -228,7 +228,21 @@
        */
       public synchronized static void init() throws Exception
       {
  -        Properties properties = new Properties();
  +        if (properties == null)
  +            setDefaultProperties();
  +        
  +        init(properties);
  +    }
  +    
  +    /**
  +     * Get the default properties for the Velocity Runtime.
  +     * This would allow the retrieval and modification of
  +     * the base properties before initializing the Velocity
  +     * Runtime.
  +     */
  +    public static void setDefaultProperties()
  +    {
  +        properties = new Properties();
           ClassLoader classLoader = Runtime.class.getClassLoader();
           
           try
  @@ -240,10 +254,8 @@
           }
           catch (IOException ioe)
           {
  -            System.err.println("Cannot initialize Velocity Runtime!");
  +            System.err.println("Cannot get Velocity Runtime default properties!");
           }
  -        
  -        init(properties);
       }
   
       /**
  
  
  

Reply via email to