|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.turbine.services.BaseInitable org.apache.turbine.services.BaseService org.apache.turbine.services.TurbineBaseService org.apache.turbine.services.resources.TurbineResourceService org.apache.jetspeed.services.resources.VariableResourcesService
This implementation of the resourcesService
relies
on an external properties file for storing the configuration keys
and values
In order to be compatible with legacy applications, this implementation kept a static method for initializing the service, so it's still possible to write the following code:
TurbineResourceService.setPropertiesName("d:/conf/Turbine.properties");
Vector myVar = TurbineResources.getVector("myvar");
This implementation allows the use of several pre-defined variables within
the configuration file. The variables are identified by the following
sequence of tokens: ${
The predefined variables are:
The init parameters of the servlet are also imported as default variables. They may override the previously defined default variables
Field Summary | |
static java.lang.String |
END_TOKEN
|
static java.lang.String |
JVM_DIR
|
static java.lang.String |
START_TOKEN
|
static java.lang.String |
WEB_DIR
|
static java.lang.String |
WEBAPP_DIR
|
Fields inherited from class org.apache.turbine.services.BaseService |
name, properties, serviceBroker |
Fields inherited from class org.apache.turbine.services.BaseInitable |
initableBroker, isInitialized |
Fields inherited from interface org.apache.turbine.services.resources.ResourceService |
SERVICE_NAME |
Constructor Summary | |
VariableResourcesService()
|
Method Summary | |
org.apache.turbine.services.resources.ResourceService |
getResources(java.lang.String prefix)
The purpose of this method is to extract a subset of configuraton resources sharing a common name prefix. |
java.lang.String |
getString(java.lang.String name)
The purpose of this method is to get the configuration resource with the given name as a string. |
java.lang.String |
getString(java.lang.String name,
java.lang.String def)
The purpose of this method is to get the configuration resource with the given name as a string, or a default value. |
java.lang.String[] |
getStringArray(java.lang.String name)
The purpose of this method is to get the configuration resource with the given name as a string array. |
java.util.Vector |
getVector(java.lang.String name)
The purpose of this method is to get the configuration resource with the given name as a vector. |
java.util.Vector |
getVector(java.lang.String name,
java.util.Vector def)
The purpose of this method is to get the configuration resource with the given name as a vector, or a default value. |
void |
init()
Late init. |
void |
init(javax.servlet.ServletConfig config)
This method is called when the Service is initialized |
protected void |
setVariables(java.util.Hashtable vars)
|
protected java.lang.String |
substituteString(java.lang.String base)
|
Methods inherited from class org.apache.turbine.services.resources.TurbineResourceService |
getBoolean, getBoolean, getConfiguration, getConfiguration, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getKeys, getKeys, getLong, getLong, init, interpolate, setProperties, setPropertiesFileName, setProperty |
Methods inherited from class org.apache.turbine.services.TurbineBaseService |
init, shutdown |
Methods inherited from class org.apache.turbine.services.BaseService |
getName, getProperties, getServiceBroker, setName, setServiceBroker |
Methods inherited from class org.apache.turbine.services.BaseInitable |
getInit, getInitableBroker, setInit, setInitableBroker |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.turbine.services.Service |
getName, getProperties, setName, setServiceBroker |
Methods inherited from interface org.apache.turbine.services.Initable |
getInit, setInitableBroker, shutdown |
Field Detail |
public static final java.lang.String WEBAPP_DIR
public static final java.lang.String WEB_DIR
public static final java.lang.String JVM_DIR
public static final java.lang.String START_TOKEN
public static final java.lang.String END_TOKEN
Constructor Detail |
public VariableResourcesService()
Method Detail |
public void init()
public void init(javax.servlet.ServletConfig config) throws org.apache.turbine.services.InitializationException
config
- a ServletConfig object
org.apache.turbine.services.InitializationException
protected void setVariables(java.util.Hashtable vars)
protected java.lang.String substituteString(java.lang.String base)
public java.lang.String getString(java.lang.String name)
name
- The resource name.
public java.lang.String getString(java.lang.String name, java.lang.String def)
name
- The resource name.def
- The default value of the resource.
public java.lang.String[] getStringArray(java.lang.String name)
name
- The resource name.
public java.util.Vector getVector(java.lang.String name)
name
- The resource name.
public java.util.Vector getVector(java.lang.String name, java.util.Vector def)
name
- The resource name.def
- The default value of the resource.
public org.apache.turbine.services.resources.ResourceService getResources(java.lang.String prefix)
prefix
- the common name prefix
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |