Java Code Examples for org.apache.velocity.runtime.log.SystemLogChute

The following examples show how to use org.apache.velocity.runtime.log.SystemLogChute. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: sundrio   Author: sundrio   File: CodeGeneratorContext.java    License: Apache License 2.0 5 votes vote down vote up
public CodeGeneratorContext(VelocityEngine velocityEngine, VelocityContext velocityContext) {
    this.velocityEngine = velocityEngine;
    this.velocityContext = velocityContext;

    this.velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "string");
    this.velocityEngine.setProperty("string.resource.loader.class", StringResourceLoader.class.getName());
    //We are going to use shading so we need to make sure that the following configuration will be shade friendly...
    this.velocityEngine.setProperty(RuntimeConstants.RESOURCE_MANAGER_CLASS, ResourceManagerImpl.class.getName());
    this.velocityEngine.setProperty(RuntimeConstants.RESOURCE_MANAGER_CACHE_CLASS, ResourceCacheImpl.class.getName());
    this.velocityEngine.setProperty(RuntimeConstants.PARSER_POOL_CLASS, ParserPoolImpl.class.getName());
    this.velocityEngine.setProperty(RuntimeConstants.UBERSPECT_CLASSNAME, UberspectImpl.class.getName());
    this.velocityEngine.setProperty("runtime.log.logsystem.class", SystemLogChute.class.getName());

    ClassLoader current = Thread.currentThread().getContextClassLoader();
    try {
        Thread.currentThread().setContextClassLoader(VelocityEngine.class.getClassLoader());
        this.velocityEngine.init();

        //Load standard directives
        this.velocityEngine.loadDirective(ClassDirective.class.getCanonicalName());
        this.velocityEngine.loadDirective(MethodDirective.class.getCanonicalName());
        this.velocityEngine.loadDirective(FieldDirective.class.getCanonicalName());
        //Load utility directives
        this.velocityEngine.loadDirective(PluralizeDirective.class.getCanonicalName());
        this.velocityEngine.loadDirective(SingularizeDirective.class.getCanonicalName());
    } finally {
        Thread.currentThread().setContextClassLoader(current);
    }
}
 
Example #2
Source Project: gp2srv   Author: mvmn   File: TemplateEngine.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
private Properties getConfigurationAsProperties() {
	Properties result = new Properties();

	result.setProperty(RuntimeConstants.RESOURCE_LOADER, "string");
	result.setProperty(RuntimeConstants.VM_LIBRARY_AUTORELOAD, "false");
	result.setProperty(RuntimeConstants.VM_LIBRARY, RuntimeConstants.VM_LIBRARY_DEFAULT);
	result.setProperty("string.resource.loader.class", StringResourceLoader.class.getName());
	result.setProperty("string.resource.loader.modificationCheckInterval", "0");
	result.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, SystemLogChute.class.getName());

	return result;
}
 
Example #3
Source Project: ipmi4j   Author: shevek   File: IpmiCommandNameTest.java    License: Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
    engine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new SystemLogChute());
    engine.init();
}