jvanzyl     00/10/09 13:32:19

  Modified:    src/java/org/apache/velocity/runtime Runtime.java
  Log:
  - cleaning up runtime in prep for velocity service.
  
  Revision  Changes    Path
  1.9       +36 -27    
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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Runtime.java      2000/10/09 20:14:12     1.8
  +++ Runtime.java      2000/10/09 20:32:18     1.9
  @@ -108,9 +108,7 @@
       private static TemplateLoader templateLoader;
       private final static boolean DEBUG_ON = true;
       private static Logger logger;
  -
       private static Parser parser;
  -
       private static boolean initialized;
   
       public synchronized static void init(String properties)
  @@ -122,31 +120,10 @@
               {
                   Configuration.setPropertiesFile(properties);
           
  -                // Initialize the logger.
  -                logger = LogKit.createLogger("velocity", 
  -                    getString(RUNTIME_LOG), "DEBUG");
  +                initializeLogger();
  +                initializeTemplateLoader();           
  +                initializeParserPool();
                   
  -                LogTarget[] t = logger.getLogTargets();            
  -                ((FileOutputLogTarget)t[0])
  -                    .setFormat("%5.5{time} %{message}\\n%{throwable}" );
  -            
  -                info("Logging system initialized.");
  -        
  -                // 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();
  -
  -                createParserPool();
  -                
                   info("Velocity successfully started.");
                   initialized = true;
               }
  @@ -162,8 +139,40 @@
       {
           Configuration.setProperty(key, value);
       }        
  +
  +    private static void initializeLogger() throws
  +        MalformedURLException
  +    {
  +        // Initialize the logger.
  +        logger = LogKit.createLogger("velocity", 
  +            getString(RUNTIME_LOG), "DEBUG");
  +                
  +        LogTarget[] t = logger.getLogTargets();            
  +        ((FileOutputLogTarget)t[0])
  +            .setFormat("%5.5{time} %{message}\\n%{throwable}" );
  +    }
  +
  +    /**
  +     * 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.
  +     */
  +    public static void initializeTemplateLoader()
  +        throws Exception
  +    {
  +        if (!getString(TEMPLATE_PATH).equals("system"))
  +        {
  +            templateLoader = TemplateFactory
  +                .getLoader(getString(TEMPLATE_LOADER));
  +            
  +            templateLoader.init();
  +        }            
  +    }
   
  -    private static void createParserPool()
  +    private static void initializeParserPool()
       {
           // put this in a method and make a pool of
           // parsers.
  
  
  

Reply via email to