001
014
015 package com.liferay.portal.kernel.velocity;
016
017 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018
019 import java.io.Writer;
020
021
024 public class VelocityEngineUtil {
025
026 public static void clearClassLoader(ClassLoader classLoader) {
027 getVelocityEngine().clearClassLoader(classLoader);
028 }
029
030 public static void flushTemplate(String velocityTemplateId) {
031 getVelocityEngine().flushTemplate(velocityTemplateId);
032 }
033
034 public static VelocityContext getEmptyContext() {
035 return getVelocityEngine().getEmptyContext();
036 }
037
038 public static VelocityContext getRestrictedToolsContext() {
039 return getVelocityEngine().getRestrictedToolsContext();
040 }
041
042 public static VelocityContext getStandardToolsContext() {
043 return getVelocityEngine().getStandardToolsContext();
044 }
045
046 public static VelocityEngine getVelocityEngine() {
047 PortalRuntimePermission.checkGetBeanProperty(VelocityEngineUtil.class);
048
049 return _velocityEngine;
050 }
051
052 public static VelocityContext getWrappedClassLoaderToolsContext() {
053 return getVelocityEngine().getWrappedClassLoaderToolsContext();
054 }
055
056 public static VelocityContext getWrappedRestrictedToolsContext() {
057 return getVelocityEngine().getWrappedRestrictedToolsContext();
058 }
059
060 public static VelocityContext getWrappedStandardToolsContext() {
061 return getVelocityEngine().getWrappedStandardToolsContext();
062 }
063
064 public static void init() throws Exception {
065 getVelocityEngine().init();
066 }
067
068 public static boolean mergeTemplate(
069 String velocityTemplateId, String velocityTemplateContent,
070 VelocityContext velocityContext, Writer writer)
071 throws Exception {
072
073 return getVelocityEngine().mergeTemplate(
074 velocityTemplateId, velocityTemplateContent, velocityContext,
075 writer);
076 }
077
078 public static boolean mergeTemplate(
079 String velocityTemplateId, VelocityContext velocityContext,
080 Writer writer)
081 throws Exception {
082
083 return getVelocityEngine().mergeTemplate(
084 velocityTemplateId, velocityContext, writer);
085 }
086
087 public static boolean resourceExists(String resource) {
088 return getVelocityEngine().resourceExists(resource);
089 }
090
091 public void setVelocityEngine(VelocityEngine velocityEngine) {
092 PortalRuntimePermission.checkSetBeanProperty(getClass());
093
094 _velocityEngine = velocityEngine;
095 }
096
097 private static VelocityEngine _velocityEngine;
098
099 }