vr.system.options
Class SavableConfiguration

java.lang.Object
  extended by vr.system.options.SavableConfiguration
Direct Known Subclasses:
ClassifiersManager, StandaloneSavableConfiguration

public abstract class SavableConfiguration
extends java.lang.Object

The instances of this class provides access to properties provided in a constructor or defined in the properties file. The properties file name is the name of the class extending this abstract class. Class is quite exac copy of class Configuration

Version:
1.0 20 March 2005
Author:
Grzegorz Góra, Arkadiusz Wojna and Marcin Staszczyk

Field Summary
protected static java.lang.String CONFIGURATION_DIRECTORY
          SavableConfiguration directory path.
protected  java.util.Properties m_Properties
          Map between property names and property values.
protected  java.lang.String path
          path to file with properties
protected static java.lang.String PROPERTIES_EXTENSION
          Properties file extension.
 
Constructor Summary
SavableConfiguration(java.util.Properties prop)
          Constructor that reads properties from properties file.
 
Method Summary
 boolean getBoolProperty(java.lang.String propertyName)
          Returns property value as a boolean.
 double getDoubleProperty(java.lang.String propertyName)
          Returns property value as double.
 int getIntProperty(java.lang.String propertyName)
          Returns property value as int.
protected static java.lang.String[] getPropertiesFilePathes(java.lang.String className)
          Returns the pathes to the properties files for a given class name.
 java.lang.String getProperty(java.lang.String propertyName)
          Returns property value as a string.
static java.util.Properties loadDefaultProperties(java.lang.Class configurableClass)
          Returns the default properties for a given class.
 void setProperty(java.lang.String propertyName, java.lang.String propertyValue)
          Sets property to a given value.
protected  void writeProperties()
          Write properties to default properties folder.
 void writeProperties(java.io.PrintStream arg)
          Writes properties through a given stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIGURATION_DIRECTORY

protected static final java.lang.String CONFIGURATION_DIRECTORY
SavableConfiguration directory path.


PROPERTIES_EXTENSION

protected static final java.lang.String PROPERTIES_EXTENSION
Properties file extension.

See Also:
Constant Field Values

m_Properties

protected java.util.Properties m_Properties
Map between property names and property values.


path

protected java.lang.String path
path to file with properties

Constructor Detail

SavableConfiguration

public SavableConfiguration(java.util.Properties prop)
Constructor that reads properties from properties file.

Parameters:
prop - Map between property names and property values.
Method Detail

loadDefaultProperties

public static java.util.Properties loadDefaultProperties(java.lang.Class configurableClass)
Returns the default properties for a given class.

Parameters:
configurableClass - Class.
Returns:
Properties Default properties for a given class.

getPropertiesFilePathes

protected static java.lang.String[] getPropertiesFilePathes(java.lang.String className)
Returns the pathes to the properties files for a given class name.

Parameters:
className - Class name.
Returns:
Pathes to the properties files for a given class name.
Throws:
java.lang.ClassNotFoundException - If the class is not found.

getProperty

public java.lang.String getProperty(java.lang.String propertyName)
Returns property value as a string.

Parameters:
propertyName - Property name.
Returns:
Property value.

getBoolProperty

public boolean getBoolProperty(java.lang.String propertyName)
Returns property value as a boolean.

Parameters:
propertyName - Property name.
Returns:
Property value.

getIntProperty

public int getIntProperty(java.lang.String propertyName)
Returns property value as int.

Parameters:
propertyName - Property name.
Returns:
Property value.

getDoubleProperty

public double getDoubleProperty(java.lang.String propertyName)
Returns property value as double.

Parameters:
propertyName - Property name.
Returns:
Property value.

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.String propertyValue)
Sets property to a given value.

Parameters:
propertyName - Property name.
propertyValue - New property value.

writeProperties

public void writeProperties(java.io.PrintStream arg)
Writes properties through a given stream.

Parameters:
arg - Stream.

writeProperties

protected void writeProperties()
Write properties to default properties folder.