Resources Service

Within Turbine was a service for reading and accessing data in Property files. The classes that accomplish this have been borrowed from the Apache JServ project, moved many time and finally ended up in the commons-configuration sub-project. So we removed the Service itself and now use commons-configuration everywhere.

Configuring Turbine

Turbine gets its configuration file from the servlet container at startup time. It is necessary to have an init parameter in the servlet section of your web.xml file:

<init-param>
    <param-name>properties</param-name>
    <!-- This is relative to the docBase -->
    <param-value>
        /WEB-INF/conf/TurbineResources.properties
    </param-value>
</init-param>

Accessing properties

Turbine post-2.2 uses commons-configuration all over the place, so if you want to access properties files, you can use it in two ways.

Inside arbitrary code:

import org.apache.commons.configuration.Configuration;
import org.apache.turbine.Turbine;

//
// Access all properties from TurbineResource.properties
Configuration conf = Turbine.getConfiguration();

String myProperty = conf.getString("this.is.my.property");

Inside a service, you can easily access the already subclassed property object for your service (that is, with the services.<your service name> stripped away from the property:

public class myService extends TurbineBaseService
{
.
.
.
    Configuration conf = getConfiguration();
    String myProp = conf.getString("my.property"); // services.myService.my.property
.
.
.
}