org.ourgrid.common.config
Class Configuration

java.lang.Object
  extended by org.ourgrid.common.config.Configuration
Direct Known Subclasses:
CorePeerConfiguration, MyGridConfiguration, PeerConfiguration, UserAgentConfiguration

public abstract class Configuration
extends java.lang.Object

Description: This class provides access to the ourgrid's configuration model Each module that needs specific configuration properties should extend this class and sets its own properties.


Field Summary
static java.lang.String COREPEER
           
static java.lang.String MGROOT
           
static java.lang.String MYGRID
           
static java.lang.String PEER
           
static java.lang.String PROP_EXTERNAL_NAME
           
static java.lang.String PROP_KEYSTORE_FILENAME
           
static java.lang.String PROP_KEYSTORE_PASSWORD
           
static java.lang.String PROP_LOG_PROPERTIES_FILE
           
static java.lang.String PROP_LOGFILE
           
static java.lang.String PROP_NAME
           
static java.lang.String PROP_PORT
           
static java.lang.String PROP_SECURE_PORT
           
static java.lang.String PROP_SECURITY
           
static java.lang.String PROP_STARTED_TIME
           
static java.lang.String PROP_TRUSTSTORE_FILENAME
           
static java.lang.String PROP_TRUSTSTORE_PASSWORD
           
static int QUERY_FREQ
           
protected static Configuration singleInstance
           
static java.lang.String USERAGENT
           
static java.lang.String VERSION
           
 
Constructor Summary
Configuration()
           
 
Method Summary
static Configuration createInstance(java.lang.String configurationType)
          Creates the unique configuration instance.
 java.lang.String getHostname()
           
static Configuration getInstance()
           
static Configuration getInstance(java.lang.String configurationType)
          Creates, if not already created, the unique configuration instance.
 java.lang.String getLogPath()
          This method provides the absolute path to the log file.
 java.lang.String getLogPropertiesPath()
           
protected abstract  java.lang.String getPrefix()
          Returns the module specific prefix used to indentify it's own properties.
 java.lang.String getProperty(java.lang.String key)
          Gets the value of a given property.
abstract  java.lang.String getRootDir()
          Gets the module configuration rootdir.
 java.lang.String getXMLLogPath()
          This method provides the absolute path to the log file.
 boolean isEnabled(java.lang.String propertyKey)
          Verify if the property passed is enabled
 boolean isSecurityEnabled()
           
 boolean isUsingDefaultProperties()
           
protected  void loadPropertiesFromFile(java.lang.String file)
          This method reads properties from a file.
static void reset()
          Sets the singleton instance to null.
 void setProperty(java.lang.String key, java.lang.String value)
          Sets the value of a given property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values

singleInstance

protected static Configuration singleInstance

MYGRID

public static final java.lang.String MYGRID

PEER

public static final java.lang.String PEER

COREPEER

public static final java.lang.String COREPEER

USERAGENT

public static final java.lang.String USERAGENT

PROP_LOGFILE

public static final java.lang.String PROP_LOGFILE
See Also:
Constant Field Values

PROP_LOG_PROPERTIES_FILE

public static final java.lang.String PROP_LOG_PROPERTIES_FILE
See Also:
Constant Field Values

PROP_NAME

public static final java.lang.String PROP_NAME
See Also:
Constant Field Values

PROP_EXTERNAL_NAME

public static final java.lang.String PROP_EXTERNAL_NAME
See Also:
Constant Field Values

PROP_PORT

public static final java.lang.String PROP_PORT
See Also:
Constant Field Values

PROP_STARTED_TIME

public static final java.lang.String PROP_STARTED_TIME
See Also:
Constant Field Values

MGROOT

public static final java.lang.String MGROOT
See Also:
Constant Field Values

PROP_SECURITY

public static final java.lang.String PROP_SECURITY
See Also:
Constant Field Values

PROP_SECURE_PORT

public static final java.lang.String PROP_SECURE_PORT
See Also:
Constant Field Values

PROP_KEYSTORE_FILENAME

public static final java.lang.String PROP_KEYSTORE_FILENAME
See Also:
Constant Field Values

PROP_KEYSTORE_PASSWORD

public static final java.lang.String PROP_KEYSTORE_PASSWORD
See Also:
Constant Field Values

PROP_TRUSTSTORE_FILENAME

public static final java.lang.String PROP_TRUSTSTORE_FILENAME
See Also:
Constant Field Values

PROP_TRUSTSTORE_PASSWORD

public static final java.lang.String PROP_TRUSTSTORE_PASSWORD
See Also:
Constant Field Values

QUERY_FREQ

public static final int QUERY_FREQ
See Also:
Constant Field Values
Constructor Detail

Configuration

public Configuration()
Method Detail

getInstance

public static final Configuration getInstance()

getInstance

public static final Configuration getInstance(java.lang.String configurationType)
Creates, if not already created, the unique configuration instance.

Parameters:
configurationType - The configuration type to be created.
Returns:
The unique configuration instance.

reset

public static final void reset()
Sets the singleton instance to null. Used only by test classes.


getProperty

public final java.lang.String getProperty(java.lang.String key)
Gets the value of a given property.

Parameters:
key - The property name without the module specific prefix.
Returns:
The property value or null if the property was no setted.

isSecurityEnabled

public boolean isSecurityEnabled()
                          throws ConfigException
Throws:
ConfigException

setProperty

public final void setProperty(java.lang.String key,
                              java.lang.String value)
Sets the value of a given property.

Parameters:
key - The property name without the module specific prefix.
value - The property value.

isEnabled

public final boolean isEnabled(java.lang.String propertyKey)
Verify if the property passed is enabled

Parameters:
propertyKey - the key name of the property.
Returns:
true if property is yes, false otherwise.

loadPropertiesFromFile

protected void loadPropertiesFromFile(java.lang.String file)
This method reads properties from a file.

Parameters:
file - The property file to be loaded.

isUsingDefaultProperties

public boolean isUsingDefaultProperties()

getHostname

public final java.lang.String getHostname()
Returns:
local host name.

getLogPath

public java.lang.String getLogPath()
This method provides the absolute path to the log file.

Returns:
The absolute path where the log file is located

getLogPropertiesPath

public java.lang.String getLogPropertiesPath()

getXMLLogPath

public final java.lang.String getXMLLogPath()
This method provides the absolute path to the log file.

Returns:
The absolute path where the log file is located

getPrefix

protected abstract java.lang.String getPrefix()
Returns the module specific prefix used to indentify it's own properties. For example, the MyGrid properties prefix is "mg." , the OurGrid's one is "peer." .

Returns:
The module specific property prefix.

getRootDir

public abstract java.lang.String getRootDir()
Gets the module configuration rootdir.

Returns:
The module configuration rootdir path.

createInstance

public static Configuration createInstance(java.lang.String configurationType)
Creates the unique configuration instance.

Parameters:
configurationType - The configuration type to be created.
Returns:
The unique configuration instance.