public static synchronized VelocityEngine getVelocityEngine() {
		if (engine == null) {
			VelocityEngine newEngine = new VelocityEngine();

			// Class Loader
			newEngine.addProperty("resource.loader", "class");
			newEngine.addProperty("class.resource.loader.class",
					"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");

			// Caching
			if (isCaching()) {
				newEngine.addProperty("class.resource.loader.cache", "true");
				newEngine.addProperty(RuntimeConstants.RESOURCE_MANAGER_CACHE_CLASS,
						"com.github.bordertech.wcomponents.template.VelocityCacheImpl");
			} else {
				newEngine.addProperty("class.resource.loader.cache", "false");
			}

			// Logging
			newEngine.addProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
					"com.github.bordertech.wcomponents.velocity.VelocityLogger");

			try {
				newEngine.init();
			} catch (Exception ex) {
				throw new SystemException("Failed to configure VelocityEngine", ex);
			}
			engine = newEngine;
		}

		return engine;
	}
public static synchronized VelocityEngine getVelocityEngine ( ) { if ( engine == null ) { VelocityEngine newEngine = new VelocityEngine ( ) ; newEngine . addProperty ( "resource.loader" , "class" ) ; newEngine . addProperty ( "class.resource.loader.class" , "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader" ) ; if ( isCaching ( ) ) { newEngine . addProperty ( "class.resource.loader.cache" , "true" ) ; newEngine . addProperty ( RuntimeConstants . RESOURCE_MANAGER_CACHE_CLASS , "com.github.bordertech.wcomponents.template.VelocityCacheImpl" ) ; } else { newEngine . addProperty ( "class.resource.loader.cache" , "false" ) ; } newEngine . addProperty ( RuntimeConstants . RUNTIME_LOG_LOGSYSTEM_CLASS , "com.github.bordertech.wcomponents.velocity.VelocityLogger" ) ; try { newEngine . init ( ) ; } catch ( Exception ex ) { throw new SystemException ( "Failed to configure VelocityEngine" , ex ) ; } engine = newEngine ; } return engine ; }
<p>
Returns the VelocityEngine associated with this factory. If this is the first time we are using the engine,
create it and initialise it.</p>

<p>
Note that velocity engines are hugely resource intensive, so we don't want too many of them. For the time being
we have a single instance stored as a static variable. This would only be a problem if the VelocityLayout class
ever wanted to use different engine configurations (unlikely).</p>

@return the VelocityEngine associated with this factory.