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 ; }
Prepare the VelocityEngine instance and return it .