| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 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 |
|
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 6 |
Complexity Density: 0.46 |
|
| 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 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 23 |
0
|
private VelocityCache()... |
| 24 |
|
{ |
| 25 |
0
|
initVelocity(); |
| 26 |
|
} |
| 27 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 28 |
0
|
public static VelocityCache getInstance()... |
| 29 |
|
{ |
| 30 |
0
|
if (instance == null) |
| 31 |
|
{ |
| 32 |
0
|
instance = new VelocityCache(); |
| 33 |
|
} |
| 34 |
|
|
| 35 |
0
|
return instance; |
| 36 |
|
} |
| 37 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 38 |
0
|
public VelocityEngine getEngine()... |
| 39 |
|
{ |
| 40 |
0
|
return ve; |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.25 |
|
| 46 |
0
|
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 |
|
} |