|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.moyoman.framework.ServerConfig
This class allows for the reading and writing of configuration information. The information is stored in a Properties file in a well known location.
| Field Summary | |
private Properties |
properties
The system environment variables. |
private static ServerConfig |
sc
The singleton ServerConfig object. |
private String |
topdir
The top level directory name. |
| Constructor Summary | |
private |
ServerConfig()
Create the ServerConfig object. |
| Method Summary | |
protected void |
cancel()
Cancel any changes that have occurred since the last call to save() or cancel(). |
private void |
createDirectories()
|
private void |
createDirectoryIfNecessary(String dirname)
|
String[] |
getAllProperties()
Return an array of all of the property names. |
private String |
getFileName()
Get the file name of the system.properties file. |
String |
getProperty(String name)
Get the value for a specific property. |
static ServerConfig |
getServerConfig()
Get the singleton ServerConfig object. |
String |
getTopDirectory()
Get the top level directory name. |
private void |
processCommandLineArguments()
Override system parameters from the system.properties file with ones from the command line. |
private Properties |
readFile()
Read the system.properties file. |
protected void |
save()
Save any changes that have occurred since the last call to save() or cancel(). |
void |
setProperty(String name,
String value)
Set a given property. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private Properties properties
private String topdir
private static final ServerConfig sc
| Constructor Detail |
private ServerConfig()
| Method Detail |
private Properties readFile()
throws InternalErrorException
InternalErrorException - Thrown if the operation fails for any reason.private void processCommandLineArguments()
private void createDirectories()
throws InternalErrorException
InternalErrorException
private void createDirectoryIfNecessary(String dirname)
throws InternalErrorException
InternalErrorException
public String getProperty(String name)
throws NoSuchDataException
name - The name of the property to retrieve.
NoSuchDataException - Thrown if there is no entry for the property.
public void setProperty(String name,
String value)
name - The property to set.value - The value for that property.
protected void cancel()
throws InternalErrorException
InternalErrorException - Thrown if the operation fails for any reason.private String getFileName()
protected void save()
throws InternalErrorException
InternalErrorException - Thrown if the operation fails for any reason.public String[] getAllProperties()
public String getTopDirectory()
public static final ServerConfig getServerConfig()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||