1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.kernel.velocity;
16  
17  import java.io.Writer;
18  
19  /**
20   * <a href="VelocityEngineUtil.java.html"><b><i>View Source</i></b></a>
21   *
22   * @author Raymond Augé
23   */
24  public class VelocityEngineUtil {
25  
26      public static void flushTemplate(String resource) {
27          getVelocityEngine().flushTemplate(resource);
28      }
29  
30      public static VelocityContext getEmptyContext() {
31          return getVelocityEngine().getEmptyContext();
32      }
33  
34      public static VelocityContext getRestrictedToolsContext() {
35          return getVelocityEngine().getRestrictedToolsContext();
36      }
37  
38      public static VelocityContext getStandardToolsContext() {
39          return getVelocityEngine().getStandardToolsContext();
40      }
41  
42      public static VelocityEngine getVelocityEngine() {
43          return _velocityEngine;
44      }
45  
46      public static VelocityContext getWrappedRestrictedToolsContext() {
47          return getVelocityEngine().getWrappedRestrictedToolsContext();
48      }
49  
50      public static VelocityContext getWrappedStandardToolsContext() {
51          return getVelocityEngine().getWrappedStandardToolsContext();
52      }
53  
54      public static void init() throws Exception {
55          getVelocityEngine().init();
56      }
57  
58      public static boolean mergeTemplate(
59              String velocityTemplateId, String velocityTemplateContent,
60              VelocityContext velocityContext, Writer writer)
61          throws Exception {
62  
63          return getVelocityEngine().mergeTemplate(
64              velocityTemplateId, velocityTemplateContent, velocityContext,
65              writer);
66      }
67  
68      public static boolean mergeTemplate(
69              String velocityTemplateId, VelocityContext velocityContext,
70              Writer writer)
71          throws Exception {
72  
73          return getVelocityEngine().mergeTemplate(
74              velocityTemplateId, velocityContext, writer);
75      }
76  
77      public static boolean resourceExists(String resource) {
78          return getVelocityEngine().resourceExists(resource);
79      }
80  
81      public void setVelocityEngine(VelocityEngine velocityEngine) {
82          _velocityEngine = velocityEngine;
83      }
84  
85      private static VelocityEngine _velocityEngine;
86  
87  }