Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.argouml.configuration
Class Configuration  view Configuration download Configuration.java

java.lang.Object
  extended byorg.argouml.configuration.Configuration

public class Configuration
extends java.lang.Object

This class provides the core user configuration implementation logic. All fancy handling and registry access occurs behind the scenes.


Field Summary
private static ConfigurationHandler _config
          The only occurance of the configuration handler.
static java.lang.String FILE_LOADED
          Property to indicate configuration load from file
static java.lang.String FILE_SAVED
          Property to indicate configuration save to file
private static Configuration SINGLETON
           
static java.lang.String URL_LOADED
          Property to indicate configuration load from url
static java.lang.String URL_SAVED
          Property to indicate configuration save to url
 
Constructor Summary
private Configuration()
          Private constructor so it cannot be instantiated.
 
Method Summary
static void addListener(ConfigurationKey key, java.beans.PropertyChangeListener pcl)
          Adds a property change listener.Static for simplicity of use.
static void addListener(java.beans.PropertyChangeListener pcl)
          Adds a property change listener.
static boolean getBoolean(ConfigurationKey key)
          Returns the boolean value of a configuration property.
static boolean getBoolean(ConfigurationKey key, boolean defaultValue)
          Returns the boolean value of a configuration property.
static ConfigurationHandler getConfigurationHandler()
          Returns the instance of the configuration singleton.
static double getDouble(ConfigurationKey key)
          Returns the numeric value of a configuration property.
static double getDouble(ConfigurationKey key, double defaultValue)
          Returns the numeric value of a configuration property.
static ConfigurationFactory getFactory()
          Returns the configuration factory instance.
static int getInteger(ConfigurationKey key)
          Returns the numeric value of a configuration property.
static int getInteger(ConfigurationKey key, int defaultValue)
          Returns the numeric value of a configuration property.
static java.lang.String getString(ConfigurationKey key)
          Returns the string value of a configuration property.
static java.lang.String getString(ConfigurationKey key, java.lang.String defaultValue)
          Returns the string value of a configuration property.
static boolean load()
          Load the configuration from the default location.
static boolean load(java.io.File file)
          Load the configuration from a specified file
static boolean load(java.net.URL url)
          Load the configuration from a specified url
static ConfigurationKey makeKey(ConfigurationKey ck, java.lang.String k1)
          Create a sub-component of an existing configuration key.
static ConfigurationKey makeKey(java.lang.String k1)
          Create a single component configuration key.
static ConfigurationKey makeKey(java.lang.String k1, java.lang.String k2)
          Create a two-component configuration key.
static ConfigurationKey makeKey(java.lang.String k1, java.lang.String k2, java.lang.String k3)
          Create a three-component configuration key.
static ConfigurationKey makeKey(java.lang.String k1, java.lang.String k2, java.lang.String k3, java.lang.String k4)
          Create a four-component configuration key.
static ConfigurationKey makeKey(java.lang.String k1, java.lang.String k2, java.lang.String k3, java.lang.String k4, java.lang.String k5)
          Create a five-component configuration key.
static void removeListener(ConfigurationKey key, java.beans.PropertyChangeListener pcl)
          Removes a property change listener.
static void removeListener(java.beans.PropertyChangeListener pcl)
          Removes a property change listener.
static boolean save()
          Save the configuration to the default location.
static boolean save(boolean force)
          Save the configuration to the default location.
static void setBoolean(ConfigurationKey key, boolean newValue)
          Sets the boolean value of a configuration property.
static void setDouble(ConfigurationKey key, double newValue)
          Sets the numeric value of a configuration property.
static void setInteger(ConfigurationKey key, int newValue)
          Sets the numeric value of a configuration property.
static void setString(ConfigurationKey key, java.lang.String newValue)
          Sets the string value of a configuration property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_LOADED

public static final java.lang.String FILE_LOADED
Property to indicate configuration load from file

See Also:
Constant Field Values

URL_LOADED

public static final java.lang.String URL_LOADED
Property to indicate configuration load from url

See Also:
Constant Field Values

FILE_SAVED

public static final java.lang.String FILE_SAVED
Property to indicate configuration save to file

See Also:
Constant Field Values

URL_SAVED

public static final java.lang.String URL_SAVED
Property to indicate configuration save to url

See Also:
Constant Field Values

_config

private static ConfigurationHandler _config
The only occurance of the configuration handler.


SINGLETON

private static Configuration SINGLETON
Constructor Detail

Configuration

private Configuration()
Private constructor so it cannot be instantiated.

Method Detail

getConfigurationHandler

public static ConfigurationHandler getConfigurationHandler()
Returns the instance of the configuration singleton.


getFactory

public static final ConfigurationFactory getFactory()
Returns the configuration factory instance. This is equivalent to ConfigurationFactory.getInstance() but using Configuration.getFactory() is shorter to type and allows us not to have to deal with ConfigurationFactory at all if we don't need to modify or configure it.


load

public static final boolean load()
Load the configuration from the default location. The configuration will be automatically loaded from the default location the first time a value is queried or modified, if it had not been previously loaded. Only the first load request will be honored, so if the configuration is to be loaded from a non-default location, load(name) must be used prior to any other call. The configuration can be loaded only one time. Implementations must ignore load requests once a load is already successful, and must return false for each of those ignored requests.


load

public static final boolean load(java.io.File file)
Load the configuration from a specified file


load

public static final boolean load(java.net.URL url)
Load the configuration from a specified url


save

public static final boolean save()
Save the configuration to the default location. Implementations do not have to handle this method. If the method is not allowed or it fails, the implementation must return false.


save

public static final boolean save(boolean force)
Save the configuration to the default location. Implementations do not have to handle this method. If the method is not allowed or it fails, the implementation must return false.


getString

public static java.lang.String getString(ConfigurationKey key)
Returns the string value of a configuration property.


getString

public static final java.lang.String getString(ConfigurationKey key,
                                               java.lang.String defaultValue)
Returns the string value of a configuration property.


getInteger

public static final int getInteger(ConfigurationKey key)
Returns the numeric value of a configuration property.


getDouble

public static final double getDouble(ConfigurationKey key,
                                     double defaultValue)
Returns the numeric value of a configuration property.


getDouble

public static final double getDouble(ConfigurationKey key)
Returns the numeric value of a configuration property.


getInteger

public static final int getInteger(ConfigurationKey key,
                                   int defaultValue)
Returns the numeric value of a configuration property.


getBoolean

public static final boolean getBoolean(ConfigurationKey key)
Returns the boolean value of a configuration property.


getBoolean

public static final boolean getBoolean(ConfigurationKey key,
                                       boolean defaultValue)
Returns the boolean value of a configuration property.


setString

public static final void setString(ConfigurationKey key,
                                   java.lang.String newValue)
Sets the string value of a configuration property.


setInteger

public static final void setInteger(ConfigurationKey key,
                                    int newValue)
Sets the numeric value of a configuration property.


setDouble

public static final void setDouble(ConfigurationKey key,
                                   double newValue)
Sets the numeric value of a configuration property.


setBoolean

public static final void setBoolean(ConfigurationKey key,
                                    boolean newValue)
Sets the boolean value of a configuration property.


addListener

public static final void addListener(java.beans.PropertyChangeListener pcl)
Adds a property change listener.


removeListener

public static final void removeListener(java.beans.PropertyChangeListener pcl)
Removes a property change listener.


addListener

public static final void addListener(ConfigurationKey key,
                                     java.beans.PropertyChangeListener pcl)
Adds a property change listener.Static for simplicity of use.


removeListener

public static final void removeListener(ConfigurationKey key,
                                        java.beans.PropertyChangeListener pcl)
Removes a property change listener.


makeKey

public static ConfigurationKey makeKey(java.lang.String k1)
Create a single component configuration key.


makeKey

public static ConfigurationKey makeKey(ConfigurationKey ck,
                                       java.lang.String k1)
Create a sub-component of an existing configuration key.


makeKey

public static ConfigurationKey makeKey(java.lang.String k1,
                                       java.lang.String k2)
Create a two-component configuration key.


makeKey

public static ConfigurationKey makeKey(java.lang.String k1,
                                       java.lang.String k2,
                                       java.lang.String k3)
Create a three-component configuration key.


makeKey

public static ConfigurationKey makeKey(java.lang.String k1,
                                       java.lang.String k2,
                                       java.lang.String k3,
                                       java.lang.String k4)
Create a four-component configuration key.


makeKey

public static ConfigurationKey makeKey(java.lang.String k1,
                                       java.lang.String k2,
                                       java.lang.String k3,
                                       java.lang.String k4,
                                       java.lang.String k5)
Create a five-component configuration key.