org.apache.struts2.config
Class PropertiesSettings

java.lang.Object
  extended by org.apache.struts2.config.Settings
      extended by org.apache.struts2.config.PropertiesSettings

 class PropertiesSettings
extends Settings

A class to handle settings via a properties file.


Field Summary
(package private) static Logger LOG
           
(package private)  LocatableProperties settings
           
 
Fields inherited from class org.apache.struts2.config.Settings
defaultImpl, locale, settingsImpl
 
Constructor Summary
PropertiesSettings(String name)
          Creates a new properties config given the name of a properties file.
 
Method Summary
 String getImpl(String aName)
          Gets a property from the properties file.
 Location getLocationImpl(String aName)
          Gets the location of a property from the properties file.
 boolean isSetImpl(String aName)
          Tests to see if a property exists in the properties file.
 Iterator listImpl()
          Lists all keys in the properties file.
 void setImpl(String aName, String aValue)
          Sets a property in the properties file.
 
Methods inherited from class org.apache.struts2.config.Settings
get, getInstance, getLocale, getLocation, isSet, list, reset, set, setInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

settings

LocatableProperties settings

LOG

static Logger LOG
Constructor Detail

PropertiesSettings

public PropertiesSettings(String name)
Creates a new properties config given the name of a properties file. The name is expected to NOT have the ".properties" file extension. So when new PropertiesSettings("foo") is called this class will look in the classpath for the foo.properties file.

Parameters:
name - the name of the properties file, excluding the ".properties" extension.
Method Detail

setImpl

public void setImpl(String aName,
                    String aValue)
Sets a property in the properties file.

Overrides:
setImpl in class Settings
Parameters:
aName - Identifer for the setting to change.
aValue - The new value for the setting.
See Also:
Settings.set(String, String)

getImpl

public String getImpl(String aName)
               throws IllegalArgumentException
Gets a property from the properties file.

Overrides:
getImpl in class Settings
Parameters:
aName - The name of the setting value to retreive
Returns:
The setting value as a String
Throws:
IllegalArgumentException - if an error occurs when retrieving the value
See Also:
Settings.get(String)

getLocationImpl

public Location getLocationImpl(String aName)
                         throws IllegalArgumentException
Gets the location of a property from the properties file.

Overrides:
getLocationImpl in class Settings
Parameters:
aName - Name of the setting to locate
Returns:
The location of the setting
Throws:
IllegalArgumentException - if an error occurs when retrieving the value
See Also:
Settings.getLocation(String)

isSetImpl

public boolean isSetImpl(String aName)
Tests to see if a property exists in the properties file.

Overrides:
isSetImpl in class Settings
Parameters:
aName - Identifier for the setting value to change
Returns:
True if the setting exists and has a value, false otherwise.
See Also:
Settings.isSet(String)

listImpl

public Iterator listImpl()
Lists all keys in the properties file.

Overrides:
listImpl in class Settings
Returns:
A list of the settings as an iterator
See Also:
Settings.list()


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