Clover Coverage Report - Atlassian Core
Coverage timestamp: Sun Nov 30 2008 18:33:35 CST
13   63   6   3.25
2   42   0.46   4
4     1.5  
1    
 
 
  VelocityCache       Line # 16 13 6 0% 0.0
 
No Tests
 
1    /*
2    * Created by IntelliJ IDEA.
3    * User: Administrator
4    * Date: 25/07/2002
5    * Time: 21:16:42
6    * To change template for new class use
7    * Code Style | Class Templates options (Tools | IDE Options).
8    */
9    package com.atlassian.core.util;
10   
11    import org.apache.log4j.Category;
12    import org.apache.velocity.app.VelocityEngine;
13   
14    import java.util.Properties;
15   
 
16    public class VelocityCache
17    {
18    private static final Category log = Category.getInstance(VelocityCache.class);
19    private static VelocityCache instance;
20   
21    VelocityEngine ve;
22   
 
23  0 toggle private VelocityCache()
24    {
25  0 initVelocity();
26    }
27   
 
28  0 toggle public static VelocityCache getInstance()
29    {
30  0 if (instance == null)
31    {
32  0 instance = new VelocityCache();
33    }
34   
35  0 return instance;
36    }
37   
 
38  0 toggle public VelocityEngine getEngine()
39    {
40  0 return ve;
41    }
42   
43    /**
44    * Initialise Velocity
45    */
 
46  0 toggle private void initVelocity()
47    {
48  0 try
49    {
50  0 ve = new VelocityEngine();
51  0 Properties props = new Properties();
52  0 props.put("resource.loader", "class");
53  0 props.put("class.resource.loader.description", "Velocity Classpath Resource Loader");
54  0 props.put("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
55  0 ve.init(props);
56    }
57    catch (Exception e)
58    {
59  0 log.error("Exception initialising Velocity: " + e, e);
60    }
61    }
62   
63    }