@Inject public VelocityViewFactory(Argo argo) { String viewFolder = viewFolderPath(argo); Properties ps = new Properties(); ps.setProperty("resource.loader", "file"); ps.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader"); ps.setProperty("file.resource.loader.path", viewFolder); ps.setProperty("file.resource.loader.cache", "false"); ps.setProperty("file.resource.loader.modificationCheckInterval", "2"); ps.setProperty("input.encoding", "UTF-8"); ps.setProperty("output.encoding", "UTF-8"); ps.setProperty("default.contentType", "text/html; charset=UTF-8"); ps.setProperty("velocimarco.library.autoreload", "true"); ps.setProperty("runtime.log.error.stacktrace", "false"); ps.setProperty("runtime.log.warn.stacktrace", "false"); ps.setProperty("runtime.log.info.stacktrace", "false"); ps.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.SimpleLog4JLogSystem"); ps.setProperty("runtime.log.logsystem.log4j.category", "velocity_log"); rtInstance = new RuntimeInstance(); try { rtInstance.init(ps); } catch (Exception e) { throw ArgoException.raise(e); } }
private void execute0() throws IOException, MojoExecutionException { velocity = new RuntimeInstance(); final ExtProperties p = new ExtProperties(); velocity.setConfiguration(p);
RuntimeInstance ri = new RuntimeInstance(); SimpleNode node = ri.parse( reader, "templateName" );
private void execute0() throws IOException, MojoExecutionException { velocity = new RuntimeInstance(); final ExtProperties p = new ExtProperties(); velocity.setConfiguration(p);
RuntimeInstance runtimeInstance = new RuntimeInstance(); runtimeInstance.init(); SimpleNode simpleNode = runtimeInstance.parse(reader, "nameOfYourTemplateResource"); Template template = new Template(); simpleNode.init(new InternalContextAdapterImpl(new VelocityContext()), runtimeInstance); template.setData(simpleNode); template.merge(...); ...
public VelocitySQLTemplateProcessor() { this.renderingUtils = new SQLTemplateRenderingUtils(); this.velocityRuntime = new RuntimeInstance(); // set null logger velocityRuntime.addProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new NullLogChute()); velocityRuntime .addProperty(RuntimeConstants.RESOURCE_MANAGER_CLASS, SQLTemplateResourceManager.class.getName()); velocityRuntime.addProperty("userdirective", BindDirective.class.getName()); velocityRuntime.addProperty("userdirective", BindEqualDirective.class.getName()); velocityRuntime.addProperty("userdirective", BindNotEqualDirective.class.getName()); velocityRuntime.addProperty("userdirective", BindObjectEqualDirective.class.getName()); velocityRuntime.addProperty("userdirective", BindObjectNotEqualDirective.class.getName()); velocityRuntime.addProperty("userdirective", ResultDirective.class.getName()); velocityRuntime.addProperty("userdirective", ChainDirective.class.getName()); velocityRuntime.addProperty("userdirective", ChunkDirective.class.getName()); try { velocityRuntime.init(); } catch (Exception ex) { throw new CayenneRuntimeException("Error setting up Velocity RuntimeInstance.", ex); } }
private static void initVelocityRuntime() { // init static velocity engine sharedRuntime = new RuntimeInstance(); // set null logger sharedRuntime.addProperty( RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new NullLogSystem()); sharedRuntime.addProperty( RuntimeConstants.RESOURCE_MANAGER_CLASS, SQLTemplateResourceManager.class.getName()); sharedRuntime.addProperty("userdirective", BindDirective.class.getName()); sharedRuntime.addProperty("userdirective", BindEqualDirective.class.getName()); sharedRuntime.addProperty("userdirective", BindNotEqualDirective.class.getName()); sharedRuntime.addProperty("userdirective", ResultDirective.class.getName()); sharedRuntime.addProperty("userdirective", ChainDirective.class.getName()); sharedRuntime.addProperty("userdirective", ChunkDirective.class.getName()); try { sharedRuntime.init(); } catch (Exception ex) { throw new CayenneRuntimeException( "Error setting up Velocity RuntimeInstance.", ex); } }
RuntimeInstance tmpEngine = new RuntimeInstance(); try
private static void initVelocityRuntime() { // init static velocity engine sharedRuntime = new RuntimeInstance(); // set null logger sharedRuntime.addProperty( RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new NullLogSystem()); sharedRuntime.addProperty( RuntimeConstants.RESOURCE_MANAGER_CLASS, SQLTemplateResourceManager.class.getName()); sharedRuntime.addProperty("userdirective", BindDirective.class.getName()); sharedRuntime.addProperty("userdirective", BindEqualDirective.class.getName()); sharedRuntime.addProperty("userdirective", BindNotEqualDirective.class.getName()); sharedRuntime.addProperty("userdirective", ResultDirective.class.getName()); sharedRuntime.addProperty("userdirective", ChainDirective.class.getName()); sharedRuntime.addProperty("userdirective", ChunkDirective.class.getName()); try { sharedRuntime.init(); } catch (Exception ex) { throw new CayenneRuntimeException( "Error setting up Velocity RuntimeInstance.", ex); } }
private RuntimeInstance ri = new RuntimeInstance();