Java 类org.apache.velocity.runtime.log.CommonsLogLogChute 实例源码

项目:qemu-java    文件:SchemaWriter.java   
@Nonnull
private static VelocityEngine newVelocityEngine() {
    VelocityEngine engine = new VelocityEngine();
    engine
            .setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS, CommonsLogLogChute.class
            .getName());
    // engine.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS, SystemLogChute.class.getName());
    engine.setProperty(VelocityEngine.RESOURCE_LOADER,
            "classpath");
    engine.setProperty(
            "classpath.resource.loader.class", ClasspathResourceLoader.class
            .getName());
    // engine.setProperty(VelocityEngine.FILE_RESOURCE_LOADER_CACHE, "true");
    // engine.setProperty(VelocityEngine.FILE_RESOURCE_LOADER_PATH, "velocity/");
    engine.init();
    return engine;
}
项目:lams    文件:VelocityEngineFactory.java   
/**
 * Prepare the VelocityEngine instance and return it.
 * @return the VelocityEngine instance
 * @throws IOException if the config file wasn't found
 * @throws VelocityException on Velocity initialization failure
 */
public VelocityEngine createVelocityEngine() throws IOException, VelocityException {
    VelocityEngine velocityEngine = newVelocityEngine();
    Map<String, Object> props = new HashMap<String, Object>();

    // Load config file if set.
    if (this.configLocation != null) {
        if (logger.isInfoEnabled()) {
            logger.info("Loading Velocity config from [" + this.configLocation + "]");
        }
        CollectionUtils.mergePropertiesIntoMap(PropertiesLoaderUtils.loadProperties(this.configLocation), props);
    }

    // Merge local properties if set.
    if (!this.velocityProperties.isEmpty()) {
        props.putAll(this.velocityProperties);
    }

    // Set a resource loader path, if required.
    if (this.resourceLoaderPath != null) {
        initVelocityResourceLoader(velocityEngine, this.resourceLoaderPath);
    }

    // Log via Commons Logging?
    if (this.overrideLogging) {
        velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new CommonsLogLogChute());
    }

    // Apply properties to VelocityEngine.
    for (Map.Entry<String, Object> entry : props.entrySet()) {
        velocityEngine.setProperty(entry.getKey(), entry.getValue());
    }

    postProcessVelocityEngine(velocityEngine);

    // Perform actual initialization.
    velocityEngine.init();

    return velocityEngine;
}
项目:spring-velocity-adapter    文件:VelocityEngineFactory.java   
/**
 * Prepare the VelocityEngine instance and return it.
 * @return the VelocityEngine instance
 * @throws IOException if the config file wasn't found
 * @throws VelocityException on Velocity initialization failure
 */
public VelocityEngine createVelocityEngine() throws IOException, VelocityException {
    VelocityEngine velocityEngine = newVelocityEngine();
    Map<String, Object> props = new HashMap<String, Object>();

    // Load config file if set.
    if (this.configLocation != null) {
        if (logger.isInfoEnabled()) {
            logger.info("Loading Velocity config from [" + this.configLocation + "]");
        }
        CollectionUtils.mergePropertiesIntoMap(PropertiesLoaderUtils.loadProperties(this.configLocation), props);
    }

    // Merge local properties if set.
    if (!this.velocityProperties.isEmpty()) {
        props.putAll(this.velocityProperties);
    }

    // Set a resource loader path, if required.
    if (this.resourceLoaderPath != null) {
        initVelocityResourceLoader(velocityEngine, this.resourceLoaderPath);
    }

    // Log via Commons Logging?
    if (this.overrideLogging) {
        velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new CommonsLogLogChute());
    }

    // Apply properties to VelocityEngine.
    for (Map.Entry<String, Object> entry : props.entrySet()) {
        velocityEngine.setProperty(entry.getKey(), entry.getValue());
    }

    postProcessVelocityEngine(velocityEngine);

    // Perform actual initialization.
    velocityEngine.init();

    return velocityEngine;
}
项目:spring4-understanding    文件:VelocityEngineFactory.java   
/**
 * Prepare the VelocityEngine instance and return it.
 * @return the VelocityEngine instance
 * @throws IOException if the config file wasn't found
 * @throws VelocityException on Velocity initialization failure
 */
public VelocityEngine createVelocityEngine() throws IOException, VelocityException {
    VelocityEngine velocityEngine = newVelocityEngine();
    Map<String, Object> props = new HashMap<String, Object>();

    // Load config file if set.
    if (this.configLocation != null) {
        if (logger.isInfoEnabled()) {
            logger.info("Loading Velocity config from [" + this.configLocation + "]");
        }
        CollectionUtils.mergePropertiesIntoMap(PropertiesLoaderUtils.loadProperties(this.configLocation), props);
    }

    // Merge local properties if set.
    if (!this.velocityProperties.isEmpty()) {
        props.putAll(this.velocityProperties);
    }

    // Set a resource loader path, if required.
    if (this.resourceLoaderPath != null) {
        initVelocityResourceLoader(velocityEngine, this.resourceLoaderPath);
    }

    // Log via Commons Logging?
    if (this.overrideLogging) {
        velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new CommonsLogLogChute());
    }

    // Apply properties to VelocityEngine.
    for (Map.Entry<String, Object> entry : props.entrySet()) {
        velocityEngine.setProperty(entry.getKey(), entry.getValue());
    }

    postProcessVelocityEngine(velocityEngine);

    // Perform actual initialization.
    velocityEngine.init();

    return velocityEngine;
}
项目:beyondj    文件:VelocityEngineFactory.java   
/**
 * Prepare the VelocityEngine instance and return it.
 *
 * @return the VelocityEngine instance
 * @throws java.io.IOException                             if the config file wasn't found
 * @throws org.apache.velocity.exception.VelocityException on Velocity initialization failure
 */
public VelocityEngine createVelocityEngine() throws IOException, VelocityException {
    VelocityEngine velocityEngine = newVelocityEngine();
    Map<String, Object> props = new HashMap<String, Object>();

    // Load config file if set.
    if (this.configLocation != null) {
        if (logger.isInfoEnabled()) {
            logger.info("Loading Velocity config from [" + this.configLocation + "]");
        }
        CollectionUtils.mergePropertiesIntoMap(PropertiesLoaderUtils.loadProperties(this.configLocation), props);
    }

    // Merge local properties if set.
    if (!this.velocityProperties.isEmpty()) {
        props.putAll(this.velocityProperties);
    }

    // Set a resource loader path, if required.
    if (this.resourceLoaderPath != null) {
        initVelocityResourceLoader(velocityEngine, this.resourceLoaderPath);
    }

    // Log via Commons Logging?
    if (this.overrideLogging) {
        velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new CommonsLogLogChute());
    }

    // Apply properties to VelocityEngine.
    for (Map.Entry<String, Object> entry : props.entrySet()) {
        velocityEngine.setProperty(entry.getKey(), entry.getValue());
    }

    postProcessVelocityEngine(velocityEngine);

    // Perform actual initialization.
    velocityEngine.init();

    return velocityEngine;
}