org.apache.turbine.services.resources
Interface ResourceService

All Superinterfaces:
Initable, Service
All Known Implementing Classes:
TurbineResourceService

public interface ResourceService
extends Service

This service define a resource interface for accessing the configuration information of the application.

Since implementations of this service are used by Turbine itself and the TurbineServices depends on their proper operation, they must respect some specific implementation rules:

Version:
$Id: ResourceService.java,v 1.5 2002/07/11 16:53:25 mpoeschl Exp $
Author:
Jon S. Stevens, Greg Ritter, Raphaël Luta, Jason van Zyl

Field Summary
static java.lang.String SERVICE_NAME
           
 
Method Summary
 boolean getBoolean(java.lang.String name)
          The purpose of this method is to get the configuration resource with the given name as a boolean value.
 boolean getBoolean(java.lang.String name, boolean def)
          The purppose of this method is to get the configuration resource with the given name as a boolean value, or a default value.
 org.apache.commons.configuration.Configuration getConfiguration(java.lang.String prefix)
          The purpose of this method is to extract a subset configuraton sharing a common name prefix.
 double getDouble(java.lang.String name)
          The purpose of this method is to get the configuration resource with the given name as a double.
 double getDouble(java.lang.String name, double def)
          The purpose of this method is to get the configuration resource with the given name as a double, or a default value.
 float getFloat(java.lang.String name)
          The purpose of this method is to get the configuration resource with the given name as a float.
 float getFloat(java.lang.String name, float def)
          The purpose of this method is to get the configuration resource with the given name as a float, or a default value.
 int getInt(java.lang.String name)
          The purpose of this method is to get the configuration resource with the given name as an integer.
 int getInt(java.lang.String name, int def)
          The purpose of this method is to get the configuration resource with the given name as an integer, or a default value.
 java.util.Iterator getKeys()
          Get the list of the keys contained in the configuration repository.
 java.util.Iterator getKeys(java.lang.String prefix)
          Get the list of the keys contained in the configuration repository that match the specified prefix.
 long getLong(java.lang.String name)
          The purpose of this method is to get the configuration resource with the given name as a long.
 long getLong(java.lang.String name, long def)
          The purpose of this method is to get the configuration resource with the given name as a long, or a default value.
 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 setProperty(java.lang.String key, java.lang.String value)
          Set a property in with a key=value pair.
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker, shutdown
 

Field Detail

SERVICE_NAME

public static final java.lang.String SERVICE_NAME
Method Detail

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Set a property in with a key=value pair.
Parameters:
String - key
String - value

getBoolean

public boolean getBoolean(java.lang.String name)
The purpose of this method is to get the configuration resource with the given name as a boolean value.
Parameters:
name - The resource name.
Returns:
The value of the named resource as a boolean.

getBoolean

public boolean getBoolean(java.lang.String name,
                          boolean def)
The purppose of this method is to get the configuration resource with the given name as a boolean value, or a default value.
Parameters:
name - The resource name.
def - The default value of the resource.
Returns:
The value of the named resource as a boolean.

getDouble

public double getDouble(java.lang.String name)
The purpose of this method is to get the configuration resource with the given name as a double.
Parameters:
name - The resoource name.
Returns:
The value of the named resource as double.

getDouble

public double getDouble(java.lang.String name,
                        double def)
The purpose of this method is to get the configuration resource with the given name as a double, or a default value.
Parameters:
name - The resource name.
def - The default value of the resource.
Returns:
The value of the named resource as a double.

getFloat

public float getFloat(java.lang.String name)
The purpose of this method is to get the configuration resource with the given name as a float.
Parameters:
name - The resource name.
Returns:
The value of the resource as a float.

getFloat

public float getFloat(java.lang.String name,
                      float def)
The purpose of this method is to get the configuration resource with the given name as a float, or a default value.
Parameters:
name - The resource name.
def - The default value of the resource.
Returns:
The value of the resource as a float.

getInt

public int getInt(java.lang.String name)
The purpose of this method is to get the configuration resource with the given name as an integer.
Parameters:
name - The resource name.
Returns:
The value of the resource as an integer.

getInt

public int getInt(java.lang.String name,
                  int def)
The purpose of this method is to get the configuration resource with the given name as an integer, or a default value.
Parameters:
name - The resource name.
def - The default value of the resource.
Returns:
The value of the resource as an integer.

getKeys

public java.util.Iterator getKeys()
Get the list of the keys contained in the configuration repository.
Returns:
An Enumeration with all the keys.

getKeys

public java.util.Iterator getKeys(java.lang.String prefix)
Get the list of the keys contained in the configuration repository that match the specified prefix.
Parameters:
prefix - A String prefix to test against.
Returns:
An Enumeration of keys that match the prefix.

getLong

public long getLong(java.lang.String name)
The purpose of this method is to get the configuration resource with the given name as a long.
Parameters:
name - The resource name.
Returns:
The value of the resource as a long.

getLong

public long getLong(java.lang.String name,
                    long def)
The purpose of this method is to get the configuration resource with the given name as a long, or a default value.
Parameters:
name - The resource name.
def - The default value of the resource.
Returns:
The value of the resource as a long.

getString

public 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.
Parameters:
name - The resource name.
Returns:
The value of the resource as a string.

getString

public 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.
Parameters:
name - The resource name.
def - The default value of the resource.
Returns:
The value of the resource as a string.

getStringArray

public 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.
Parameters:
name - The resource name.
Returns:
The value of the resource as a string array.

getVector

public 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.
Parameters:
name - The resource name.
Returns:
The value of the resource as a vector.

getVector

public 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.
Parameters:
name - The resource name.
def - The default value of the resource.
Returns:
The value of the resource as a vector.

getResources

public ResourceService getResources(java.lang.String prefix)
The purpose of this method is to extract a subset of configuraton resources sharing a common name prefix.
Parameters:
prefix - the common name prefix
Returns:
A ResourceService providing the subset of configuration.

getConfiguration

public org.apache.commons.configuration.Configuration getConfiguration(java.lang.String prefix)
The purpose of this method is to extract a subset configuraton sharing a common name prefix.
Parameters:
prefix - the common name prefix
Returns:
A Configuration providing the subset of configuration.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.