gr.uoa.di.madgik.commons.configuration
Class ConfigurationManager

java.lang.Object
  extended by gr.uoa.di.madgik.commons.configuration.ConfigurationManager

public class ConfigurationManager
extends java.lang.Object

This class is the main entry point to the Configuration Utility. Once the ConfigurationManager class is loaded, the configuration file is loaded and parsed, the DependencyGraph is cosntructed and then resolved. If after the parameter evaluation there are still some parameters that were not resolved the process stops and the Configuration manager will not be able to be used for all the parameters that were declared in the configuration file. Since all configuration parameters are evaluated at startup and the default behaviour for most parameters is to serve values that cannot be changed, the ConfigurationManager does not perform any type of locking. One parameter though, ObjectParameter can be set to be shared. This means that the same reference will be passed to any requestor of the parameter. In this case any kind of locking that might be nessecary should be performed by the client code, or be handled withinthe objec itself. Event though a client might change the value of an ObjectParameter field, this change is not reflected in the configuration file. If the ConfigurationManager is reinitialized, the change made to the object's field are not mirrored. TODO Rethink the way the configuration file is found

Author:
gpapanikos

Constructor Summary
ConfigurationManager()
           
 
Method Summary
static java.lang.Boolean GetBooleanParameter(java.lang.String ParameterName)
          Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter.
static java.lang.Byte GetByteParameter(java.lang.String ParameterName)
          Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter.
static java.lang.Double GetDoubleParameter(java.lang.String ParameterName)
          Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter.
static java.lang.Float GetFloatParameter(java.lang.String ParameterName)
          Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter.
static java.io.File GetGonfigurationFile()
          Retrieves the configuration file the ConfigurationManager is using
static java.lang.Integer GetIntegerParameter(java.lang.String ParameterName)
          Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter.
static java.lang.Long GetLongParameter(java.lang.String ParameterName)
          Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter.
static java.lang.Object GetParameter(java.lang.String ParameterName)
          Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter.
static java.lang.Short GetShortParameter(java.lang.String ParameterName)
          Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter.
static java.lang.String GetStringParameter(java.lang.String ParameterName)
          Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationManager

public ConfigurationManager()
Method Detail

GetGonfigurationFile

public static java.io.File GetGonfigurationFile()
Retrieves the configuration file the ConfigurationManager is using

Returns:
the configuration file

GetParameter

public static java.lang.Object GetParameter(java.lang.String ParameterName)
                                     throws java.lang.Exception
Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter. If the key does not point to a valid non internal entry, an exception is thrown

Parameters:
ParameterName - the name of the parameter
Returns:
the value of the parameter
Throws:
java.lang.Exception - The parameter is not defined of the value is not of the expected type

GetBooleanParameter

public static java.lang.Boolean GetBooleanParameter(java.lang.String ParameterName)
                                             throws java.lang.Exception
Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter. If the key does not point to a valid non internal entry, an exception is thrown

Parameters:
ParameterName - the name of the parameter
Returns:
the value of the parameter
Throws:
java.lang.Exception - The parameter is not defined of the value is not of the expected type

GetByteParameter

public static java.lang.Byte GetByteParameter(java.lang.String ParameterName)
                                       throws java.lang.Exception
Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter. If the key does not point to a valid non internal entry, an exception is thrown

Parameters:
ParameterName - the name of the parameter
Returns:
the value of the parameter
Throws:
java.lang.Exception - The parameter is not defined of the value is not of the expected type

GetDoubleParameter

public static java.lang.Double GetDoubleParameter(java.lang.String ParameterName)
                                           throws java.lang.Exception
Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter. If the key does not point to a valid non internal entry, an exception is thrown

Parameters:
ParameterName - the name of the parameter
Returns:
the value of the parameter
Throws:
java.lang.Exception - The parameter is not defined of the value is not of the expected type

GetFloatParameter

public static java.lang.Float GetFloatParameter(java.lang.String ParameterName)
                                         throws java.lang.Exception
Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter. If the key does not point to a valid non internal entry, an exception is thrown

Parameters:
ParameterName - the name of the parameter
Returns:
the value of the parameter
Throws:
java.lang.Exception - The parameter is not defined of the value is not of the expected type

GetIntegerParameter

public static java.lang.Integer GetIntegerParameter(java.lang.String ParameterName)
                                             throws java.lang.Exception
Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter. If the key does not point to a valid non internal entry, an exception is thrown

Parameters:
ParameterName - the name of the parameter
Returns:
the value of the parameter
Throws:
java.lang.Exception - The parameter is not defined of the value is not of the expected type

GetLongParameter

public static java.lang.Long GetLongParameter(java.lang.String ParameterName)
                                       throws java.lang.Exception
Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter. If the key does not point to a valid non internal entry, an exception is thrown

Parameters:
ParameterName - the name of the parameter
Returns:
the value of the parameter
Throws:
java.lang.Exception - The parameter is not defined of the value is not of the expected type

GetShortParameter

public static java.lang.Short GetShortParameter(java.lang.String ParameterName)
                                         throws java.lang.Exception
Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter. If the key does not point to a valid non internal entry, an exception is thrown

Parameters:
ParameterName - the name of the parameter
Returns:
the value of the parameter
Throws:
java.lang.Exception - The parameter is not defined of the value is not of the expected type

GetStringParameter

public static java.lang.String GetStringParameter(java.lang.String ParameterName)
                                           throws java.lang.Exception
Retrieves the parameter value attached to the specified key if the key points to a valid non internal parameter. If the key does not point to a valid non internal entry, an exception is thrown

Parameters:
ParameterName - the name of the parameter
Returns:
the value of the parameter
Throws:
java.lang.Exception - The parameter is not defined of the value is not of the expected type