org.apache.struts2.config
Class DefaultSettings

java.lang.Object
  extended by org.apache.struts2.config.DefaultSettings

public class DefaultSettings
extends Object

DefaultSettings implements optional methods of Settings.

This class creates and delegates to other settings by using an internal DelegatingSettings object.


Field Summary
protected  Logger log
          The logging instance for this class.
 
Constructor Summary
DefaultSettings()
          Constructs an instance by loading the standard property files, any custom property files (struts.custom.properties), and any custom message resources ().
 
Method Summary
static String get(String name)
          Deprecated. Provides a setting value as a String.
 String getImpl(String aName)
          Implements the get(String) method.
static org.apache.struts2.config.Settings getInstance()
          Deprecated. Provides the Settings object.
static Locale getLocale()
          Deprecated. Provides the Struts default locale.
static Location getLocation(String name)
          Deprecated. Provides the Location of a setting.
 Location getLocationImpl(String name)
          Deprecated. Implements the getLocation(String) method.
static boolean isSet(String name)
          Deprecated. Determines whether or not a setting has a registered value.
 boolean isSetImpl(String aName)
          Implements the isSet(String) method.
static Iterator list()
          Deprecated. Provides an Iterator of all properties names.
 Iterator listImpl()
          Implements the list() method.
static void reset()
          Deprecated. Resets the default and any plugin Setting instance to null.
static void set(String name, String value)
          Deprecated. Registers a value for a setting.
 void setImpl(String name, String value)
          Implements the set(String, String) method.
static void setInstance(org.apache.struts2.config.Settings config)
          Deprecated. Registers a custom Settings implementation (plugin), and resets the cached locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected Logger log
The logging instance for this class.

Constructor Detail

DefaultSettings

public DefaultSettings()
Constructs an instance by loading the standard property files, any custom property files (struts.custom.properties), and any custom message resources ().

Since this constructor combines Settings from multiple resources, it utilizes a DelegatingSettings instance, and all API calls are handled by that instance.

Method Detail

setImpl

public void setImpl(String name,
                    String value)
             throws IllegalArgumentException,
                    UnsupportedOperationException
Implements the set(String, String) method.

Parameters:
name - Identifer for the setting to change.
value - The new value for the setting.
Throws:
IllegalArgumentException - if an error occurs when setting the value.
UnsupportedOperationException - if the config implementation does not support setting values.
See Also:
set(String, String)

getImpl

public String getImpl(String aName)
               throws IllegalArgumentException
Implements the get(String) method.

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:
get(String)

isSetImpl

public boolean isSetImpl(String aName)
Implements the isSet(String) method.

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

listImpl

public Iterator listImpl()
Implements the list() method.

Returns:
A list of the settings as an iterator
See Also:
list()

setInstance

public static void setInstance(org.apache.struts2.config.Settings config)
                        throws IllegalStateException
Deprecated. 
Registers a custom Settings implementation (plugin), and resets the cached locale.

This method can only be called once.

Parameters:
config - a Settings implementation
Throws:
IllegalStateException - if an error occurs when setting the settings implementation.

getInstance

public static org.apache.struts2.config.Settings getInstance()
Deprecated. 
Provides the Settings object.

This method will substitute the default instance if another instance is not registered.

Returns:
the Settings object.

getLocale

public static Locale getLocale()
Deprecated. 
Provides the Struts default locale.

This method utilizes the struts.locale setting, which should be given as the Java toString() representation of a Locale object ("en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr_MAC", and so forth).

If a struts.locale setting is not registered, then the default virtual machine locale is substituted and cached.

Returns:
the Struts default locale if specified or the VM default locale.
See Also:
Locale.getDefault()

isSet

public static boolean isSet(String name)
Deprecated. 
Determines whether or not a setting has a registered value.

This method is useful for testing for the existance of setting without throwing an IllegalArgumentException.

Parameters:
name - the name of a setting to test.
Returns:
true if the setting exists and has a value, false otherwise.

get

public static String get(String name)
                  throws IllegalArgumentException
Deprecated. 
Provides a setting value as a String.

The method will throw an IllegalArgumentException if an error occurs while retrieveing the property or if the property doesn't exist.

Parameters:
name - the name of the setting to retrieve.
Returns:
the setting value as a String.
Throws:
IllegalArgumentException - if an error occurs retrieving the property or the property does not exist.

getLocation

public static Location getLocation(String name)
                            throws IllegalArgumentException
Deprecated. 
Provides the Location of a setting.

The Location is utilized as part of precise error reporting.

This method will throw an IllegalArgumentException if an error occurs while retrieving the value or if the setting doesn't exist.

Parameters:
name - the name of the property to get.
Returns:
the Location of a property.
Throws:
IllegalArgumentException - if an error occurs retrieving the property or the property does not exist.

list

public static Iterator list()
Deprecated. 
Provides an Iterator of all properties names.

Returns:
an Iterator of all properties names.

set

public static void set(String name,
                       String value)
                throws IllegalArgumentException,
                       UnsupportedOperationException
Deprecated. 
Registers a value for a setting.

This method raises an exception if an error occurs when setting the value or if the settings implementation does not support setting values.

Parameters:
name - the name of the setting.
value - the value to register for the setting.
Throws:
IllegalArgumentException - if an error occurs when setting the value.
UnsupportedOperationException - if the config implementation does not support setting values.

getLocationImpl

public Location getLocationImpl(String name)
                         throws IllegalArgumentException
Deprecated. 
Implements the getLocation(String) method.

Parameters:
name - Name of the setting to locate
Returns:
The location of the setting
Throws:
IllegalArgumentException - if an error occurs when retrieving the value
See Also:
getLocation(String)

reset

public static void reset()
Deprecated. 
Resets the default and any plugin Setting instance to null.



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