jvanzyl     00/09/30 15:34:00

  Modified:    src/java/org/apache/velocity/runtime Runtime.java
  Log:
  - optionally defer the initialization of the template loader so
    that an external system can set the template.path. In this
    case so that turbine can set the template.path as specified
    in the TR.props.
  
  Revision  Changes    Path
  1.2       +14 -0     
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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Runtime.java      2000/09/30 17:04:21     1.1
  +++ Runtime.java      2000/09/30 22:34:00     1.2
  @@ -134,6 +134,15 @@
               // Create the template loader.
               templateLoader = TemplateFactory
                   .getLoader(getString(TEMPLATE_LOADER));
  +            
  +            // Initialize the template loader if there
  +            // is a real path set for the template.path
  +            // property. Otherwise defer initialization
  +            // of the template loader because it is going
  +            // to be set by some external mechanism. Turbine
  +            // for example.
  +            if (! getString(TEMPLATE_PATH).equals("system"))
  +                templateLoader.init();
   
               // put this in a method and make a pool of
               // parsers.
  @@ -162,6 +171,11 @@
           throws Exception
       {
           return parser.parse(inputStream);
  +    }
  +
  +    public void initTemplateLoader()
  +    {
  +        templateLoader.init();
       }
   
       public static Template getTemplate(String template)
  
  
  

Reply via email to