org.acm.seguin.util
Class FileSettings

java.lang.Object
  extended by org.acm.seguin.util.FileSettings
All Implemented Interfaces:
Settings

public class FileSettings
extends java.lang.Object
implements Settings

Settings loaded from a file

Author:
Chris Seguin, Mike Atkinson

Constructor Summary
  FileSettings(java.io.File express)
          Constructor for the FileSettings object
protected FileSettings(java.lang.String project, java.lang.String app, java.lang.String type)
          Constructor for the FileSettings object
 
Method Summary
 boolean getBoolean(java.lang.String key)
          Gets a boolean
 double getDouble(java.lang.String key)
          Gets a double
 java.io.File getFile()
          Return the file we are monitoring
 int getInteger(java.lang.String key)
          Gets a integer
 java.util.Enumeration getKeys()
          Gets the keys associated with this properties
 java.lang.String getProperty(java.lang.String key)
          Gets a string
 java.lang.String getProperty(java.lang.String key, java.lang.String def)
          Gets a string
static FileSettings getRefactoryPrettySettings()
          Factory method to create FileSettings objects.
static FileSettings getRefactorySettings(java.lang.String name)
          Factory method to create FileSettings objects.
static java.io.File getRefactorySettingsRoot()
          Gets the SettingsRoot for a Refactory application
static FileSettings getSettings(java.lang.String app, java.lang.String name)
          Factory method to create FileSettings objects
static FileSettings getSettings(java.lang.String project, java.lang.String app, java.lang.String name)
          Factory method to create FileSettings objects
static java.io.File getSettingsRoot()
          Gets the SettingsRoot attribute of the FileSettings class
 java.lang.String getString(java.lang.String key)
          Gets a string
 boolean isLocalProperty(java.lang.String key)
          Gets a string
static void main(java.lang.String[] args)
          Main program to test the FileSettings object
 void removeKey(java.lang.String key)
          Description of the Method
 void save()
          Stores all the settings from the file
 void setContinuallyReload(boolean way)
          Sets the ContinuallyReload attribute of the FileSettings object
protected  void setParent(FileSettings value)
          Sets the Parent attribute of the FileSettings object
 void setReloadNow(boolean way)
          Sets the ReloadNow attribute of the FileSettings object
static void setSettingsRoot(java.io.File dir)
          Sets the root directory for settings files
static void setSettingsRoot(java.lang.String dir)
          Sets the root directory for settings files
 void setString(java.lang.String key, java.lang.String value)
          Sets a string
 java.lang.String toString()
          Description of the Method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileSettings

public FileSettings(java.io.File express)
             throws MissingSettingsException
Constructor for the FileSettings object

Parameters:
express - The file to use for loading
Throws:
MissingSettingsException - The file is not found

FileSettings

protected FileSettings(java.lang.String project,
                       java.lang.String app,
                       java.lang.String type)
                throws MissingSettingsException
Constructor for the FileSettings object

Parameters:
project - Description of the Parameter
app - The application name
type - The application type
Throws:
MissingSettingsException - The file is not found
Method Detail

setContinuallyReload

public void setContinuallyReload(boolean way)
Sets the ContinuallyReload attribute of the FileSettings object

Parameters:
way - The new ContinuallyReload value

setReloadNow

public void setReloadNow(boolean way)
Sets the ReloadNow attribute of the FileSettings object

Parameters:
way - The new ReloadNow value

getKeys

public java.util.Enumeration getKeys()
Gets the keys associated with this properties

Returns:
the iterator

removeKey

public void removeKey(java.lang.String key)
Description of the Method

Parameters:
key - Description of the Parameter

isLocalProperty

public boolean isLocalProperty(java.lang.String key)
Gets a string

Parameters:
key - The code to look up
Returns:
The associated string

getProperty

public java.lang.String getProperty(java.lang.String key)
Gets a string

Parameters:
key - The code to look up
Returns:
The associated string

getString

public java.lang.String getString(java.lang.String key)
Gets a string

Specified by:
getString in interface Settings
Parameters:
key - The code to look up
Returns:
The associated string

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String def)
Gets a string

Parameters:
key - The code to look up
def - Use this if the code is not found
Returns:
The associated string

setString

public void setString(java.lang.String key,
                      java.lang.String value)
Sets a string

Parameters:
key - The code to look up
value - New value for the setting code.

getInteger

public int getInteger(java.lang.String key)
Gets a integer

Specified by:
getInteger in interface Settings
Parameters:
key - The code to look up
Returns:
The associated integer

getDouble

public double getDouble(java.lang.String key)
Gets a double

Specified by:
getDouble in interface Settings
Parameters:
key - The code to look up
Returns:
The associated double

getBoolean

public boolean getBoolean(java.lang.String key)
Gets a boolean

Specified by:
getBoolean in interface Settings
Parameters:
key - The code to look up
Returns:
The associated boolean

setParent

protected void setParent(FileSettings value)
Sets the Parent attribute of the FileSettings object

Parameters:
value - The new Parent value

save

public void save()
Stores all the settings from the file


setSettingsRoot

public static void setSettingsRoot(java.lang.String dir)
Sets the root directory for settings files

Parameters:
dir - The new SettingsRoot value

setSettingsRoot

public static void setSettingsRoot(java.io.File dir)
Sets the root directory for settings files

Parameters:
dir - The new SettingsRoot value

getSettings

public static FileSettings getSettings(java.lang.String project,
                                       java.lang.String app,
                                       java.lang.String name)
Factory method to create FileSettings objects

Parameters:
project - The name of the project
app - The name of the application
name - The name of the specific settings
Returns:
A settings object

getSettings

public static FileSettings getSettings(java.lang.String app,
                                       java.lang.String name)
Factory method to create FileSettings objects

Parameters:
app - The name of the application
name - The name of the specific settings
Returns:
A settings object

getRefactorySettings

public static FileSettings getRefactorySettings(java.lang.String name)
Factory method to create FileSettings objects. Equivalent to getSettings("Refactory",name)

Parameters:
name - The name of the specific settings
Returns:
A settings object
Since:
2.7.04

getRefactoryPrettySettings

public static FileSettings getRefactoryPrettySettings()
Factory method to create FileSettings objects. Equivalent to getSettings("Refactory","pretty")

Returns:
A settings object
Since:
2.7.04

getRefactorySettingsRoot

public static java.io.File getRefactorySettingsRoot()
Gets the SettingsRoot for a Refactory application

Returns:
The SettingsRoot value
Since:
2.7.04

getSettingsRoot

public static java.io.File getSettingsRoot()
Gets the SettingsRoot attribute of the FileSettings class

Returns:
The SettingsRoot value

main

public static void main(java.lang.String[] args)
Main program to test the FileSettings object

Parameters:
args - the command line arguments

getFile

public java.io.File getFile()
Return the file we are monitoring

Returns:
The file value

toString

public java.lang.String toString()
Description of the Method

Overrides:
toString in class java.lang.Object
Returns:
Description of the Return Value