velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "B. Scott Smith" <sc...@smithdomain.com>
Subject loadConfiguration() equivalent in Velocity Tools 2.0
Date Tue, 22 Jun 2010 16:22:28 GMT
Hi, I am trying to migrate to Velocity Tools 2.0. My application 
currently needs to set a Velocity Property to a value that is determined 
at run-time.
For example, I would like to set a property to one of two possible 
values, based on the current setting of my application's debug value. 
Before, I did this by simply overwriting the loadConfiguration() method:

    protected Properties loadConfiguration( ServletConfig config )
         throws IOException, FileNotFoundException
    {
         Properties velocityProps = new Properties(  );
         if ( localDir != null ) {
             velocityProps.setProperty(
    Velocity.FILE_RESOURCE_LOADER_PATH, localDir );
         }
         velocityProps.setProperty( Velocity.RUNTIME_LOG, localDir +
    "velocity.log" );
         velocityProps.setProperty(
    Velocity.RUNTIME_LOG_LOGSYSTEM_CLASS, debugFlag ?
                                   
    "org.apache.velocity.runtime.log.SimpleLog4JLogSystem" :
                                   
    "org.apache.velocity.runtime.log.NullLogSystem" );
         return velocityProps;
    }


How can I accomplish the same thing in Tools 2.0?
Thanks in advance for your help.
  - Scott Smith


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message