private static VelocityEngine newVelocityEngine() { ExtendedProperties prop = new ExtendedProperties(); prop.addProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, SimpleLog4JLogSystem.class.getName()); prop.addProperty("runtime.log.logsystem.log4j.category", "GenerateToString"); VelocityEngine velocity = new VelocityEngine(); velocity.setExtendedProperties(prop); velocity.init(); return velocity; }
/** * Returns a new instance of the VelocityEngine. * <p/> * The engine is initialized and outputs its logging to IDEA logging. * * @return a new velocity engine that is initialized. */ private static VelocityEngine newVeloictyEngine() { ExtendedProperties prop = new ExtendedProperties(); prop.addProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, SimpleLog4JLogSystem.class.getName()); prop.addProperty("runtime.log.logsystem.log4j.category", "GenerateToString"); prop.addProperty(RuntimeConstants.RESOURCE_LOADER, "includes"); prop.addProperty("includes.resource.loader.class", VelocityIncludesClassLoader.class.getName()); VelocityEngine velocity = new VelocityEngine(); velocity.setExtendedProperties(prop); velocity.init(); return velocity; }
private static synchronized VelocityEngine getEngine() { if (instance == null) { try { VelocityEngine engine = new VelocityEngine(); ExtendedProperties extendedProperties = new ExtendedProperties(); extendedProperties.addProperty(RuntimeConstants.RESOURCE_LOADER, "file"); extendedProperties.addProperty(RuntimeConstants.PARSER_POOL_SIZE, "1"); extendedProperties.addProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader"); extendedProperties.addProperty("file.resource.loader.path", PathManager.getPluginsPath() + "/Copyright/resources"); extendedProperties.addProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, SimpleLog4JLogSystem.class.getName()); extendedProperties .addProperty("runtime.log.logsystem.log4j.category", CopyrightManager.class.getName()); engine.setExtendedProperties(extendedProperties); engine.init(); instance = engine; } catch (Exception ignored) { } } return instance; }
/** * Returns a new instance of the VelocityEngine. * <p/> * The engine is initialized and outputs its logging to IDEA logging. * * @return a new velocity engine that is initialized. * @throws Exception error creating the VelocityEngine. */ public static VelocityEngine newVeloictyEngine() throws Exception { ExtendedProperties prop = new ExtendedProperties(); prop.addProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS, SimpleLog4JLogSystem.class.getName()); prop.addProperty("runtime.log.logsystem.log4j.category", "GenerateToString"); VelocityEngine velocity = new VelocityEngine(); velocity.setExtendedProperties(prop); velocity.init(); return velocity; }