edu.ntnu.ecosim.basicfunctionality
Class Config

java.lang.Object
  extended by edu.ntnu.ecosim.basicfunctionality.Config

public class Config
extends java.lang.Object

This class is used to read the cofiguration file and put it into an accessible hashtable. To get a property, the Config.getInstance().getProperty("ecosim","property") method is used.


Method Summary
static Config getInstance()
          Method to get an instance of the configuration file
 java.lang.String getProperty(java.lang.String moduleName, java.lang.String propertyName)
          Method to get a property from the configuration.
 ConfigProperties getSubModule(java.lang.String moduleName, java.lang.String subModuleName)
          Gets the configuration properties of a sub module.
 void setConfigPath(java.lang.String path)
          Sets the configuration file path.
 void setLastModified(long l)
          Sets the time last modified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Config getInstance()
Method to get an instance of the configuration file

Returns:
The instance

getProperty

public java.lang.String getProperty(java.lang.String moduleName,
                                    java.lang.String propertyName)
                             throws PropertyNotFoundException
Method to get a property from the configuration. If the configuration file is changed, the new properties are read.

Parameters:
propertyName - Name of the required property, for instance "Log.LogLevel"
moduleName - Name of the module
Returns:
A string representing the value of the property
Throws:
PropertyNotFoundException

getSubModule

public ConfigProperties getSubModule(java.lang.String moduleName,
                                     java.lang.String subModuleName)
Gets the configuration properties of a sub module.

Parameters:
subModuleName - the sub module name
moduleName - the module name
Returns:
the configuration properties of the submodule

setConfigPath

public void setConfigPath(java.lang.String path)
Sets the configuration file path.

Parameters:
path - the file path

setLastModified

public void setLastModified(long l)
Sets the time last modified.

Parameters:
l - the time last modified