|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.org.iscream.cms.conient.Configuration
Provides configuration details to Conient This class is a Singleton class. It handles all the configuration for Conient. Once a connection has been made, it is told that it can get configuration from the server, thus allowing other components access to the servers configuration. It also shows the ConfigurationDialog on request, which allows local configuration options to be changed. It also has support for a variety of methods of saving the config in different files and in the default file.
Nested Class Summary | |
private class |
Configuration.SuffixFileFilter
An inner class for the file filter. |
Field Summary | |
private File |
_configFile
The file that the current configuration is loaded from |
private ConnectionHandler |
_connectionHandler
A reference to the ConnectionHandler, this allows this class to obtain configuration from the server |
private File |
_defaultConfigFile
The file containing the default configuration |
private static Configuration |
_instance
The reference to the singleton instance of this class |
private Properties |
_properties
The current configuration in use |
private boolean |
_usingSpecificConfig
A value to indicate whether a specific config is in use or not |
static String |
CONFIG_HEADER
|
private JFileChooser |
fc
A file chooser to prompt for file names when saving configuration |
private FileFilter |
filter
A file filter for the file chooser dialog boxes |
static String |
REVISION
The current CVS revision of this class |
Constructor Summary | |
private |
Configuration(String configFile)
The private constructor, ensures that this is a singleton. |
Method Summary | |
static Configuration |
getInstance()
Returns the singleton instance of this class. |
String |
getProperty(String key)
A wrapper for java.util.Properties.getProperty When given a key it returns the value of that key ie, key = value |
String |
getServerProperty(String configName,
String propertyName)
This method is called by any part of the system that requires configuration from the server. |
boolean |
getUsingSpecificConfig()
Returns whether a specific config is in use rather than a default one |
void |
GUIReconfiguration()
Tells the configuration class that it should perform user re-configuration through displaying a gui. |
static void |
initialise(String configFile)
Creates and initialises a the Configuration system for Conient. |
void |
loadConfiguration()
Loads in a configuration that is chosen by the user after displaying a dialog. |
private Properties |
readFileConfiguration(File inputFile)
Reads in the specified file and parses its properties. |
void |
saveConfiguration()
This method saves the currently saves the current config, if the config has not been saved before at it is not the default, then it prompts for a file name by calling saveNewConfiguration(). |
void |
saveDefaultConfiguration()
This method saves the currently loaded config as the default config |
private void |
saveFileConfiguration(File outputFile)
This method writes out the current configuration to a file using the Properties.store() method. |
void |
saveNewConfiguration()
Prompts the user for a box to save the configuration to a specific filename. |
void |
setConnectionHandler(ConnectionHandler connectionHandler)
When the connection handler class starts up it notifys this class that it is up, so that we can obtain configuration through the open connections, should there be any. |
void |
setProperty(String key,
String value)
A wrapper for java.util.Properties.setProperty When given a key and a value, it writes it to the current properties. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String REVISION
public static final String CONFIG_HEADER
private Properties _properties
private ConnectionHandler _connectionHandler
private boolean _usingSpecificConfig
private File _configFile
private File _defaultConfigFile
private final FileFilter filter
private final JFileChooser fc
private static Configuration _instance
Constructor Detail |
private Configuration(String configFile)
configFile
- the path to the file that this configuration should loadMethod Detail |
public static void initialise(String configFile)
configFile
- the path to the file that this configuration should loadpublic static Configuration getInstance()
public String getServerProperty(String configName, String propertyName)
public void GUIReconfiguration()
public void saveNewConfiguration()
public void saveConfiguration()
public void saveDefaultConfiguration()
public void loadConfiguration()
private Properties readFileConfiguration(File inputFile) throws FileNotFoundException, IOException
FileNotFoundException
IOException
private void saveFileConfiguration(File outputFile)
public String getProperty(String key)
key
- the key the value of which is wantedpublic void setProperty(String key, String value)
key
- the key to writevalue
- the value to assign itpublic boolean getUsingSpecificConfig()
public void setConnectionHandler(ConnectionHandler connectionHandler)
connectionHandler
- a handle on the instance of the connnection handler
|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |