|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.framework.ServerConfigTool
This class provides methods for reading and writing the parameters in the system.properties file. A graphical user interface for editing the system.properties file should use this class as opposed to using the ServerConfig class directly.
Currently, this class is not implemented in a general purpose way, but the values are hard coded for each of the six variables currently supported. At some point, a more general method, such as XML Schema, should be used to specify this information. The api of this class will not change though, only the implementation. Thus, XML Schema or some other technology can be added without the user interface having to be modified.
Field Summary | |
static short |
ENUM
Returned by getParameterType() if the parameter is an enumeration. |
static short |
FLOAT
Returned by getParameterType() if the parameter is a float. |
static short |
INT
Returned by getParameterType() if the parameter is an int. |
private ServerConfig |
sc
The singleton ServerConfig object. |
static short |
STRING
Returned by getParameterType() if the parameter is a String. |
Constructor Summary | |
ServerConfigTool(ServerConfig config)
Initialize the tool. |
Method Summary | |
void |
cancel()
Cancel all operations performed since the last call to save() or cancel(). |
String[] |
getAllParameters()
Return an array of all the parameter names. |
String[] |
getEnumValues(String param)
Get the enumerated values for the parameter. |
int |
getMaximumInt(String param)
Get the maximum legal integer value to which this parameter can be set. |
int |
getMinimumInt(String param)
Get the minimum legal integer value to which this parameter can be set. |
short |
getParameterType(String param)
Get the type of the parameter. |
String |
getParameterValue(String param)
Get the value of a parameter. |
private boolean |
isValueLegalEnumValue(String param,
String value)
Determine if the value is in the legal range for the parameter. |
static void |
main(String[] args)
Test the application from the command line. |
void |
save()
Save all operations performed since the last call to save() or cancel(). |
void |
setParameter(String name,
String val)
Set the parameter to the given value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final short INT
public static final short FLOAT
public static final short STRING
public static final short ENUM
private ServerConfig sc
Constructor Detail |
public ServerConfigTool(ServerConfig config)
config
- The object that contains the config information.Method Detail |
public static void main(String[] args)
args
- Command line arguments to the application.public String[] getAllParameters()
public String getParameterValue(String param) throws NoSuchDataException
param
- The parameter name.
NoSuchDataException
- Thrown if the parameter name is invalid.public short getParameterType(String param) throws NoSuchDataException
param
- The name of the parameter.
NoSuchDataException
- Thrown if the parameter name is invalid.public int getMinimumInt(String param) throws NoSuchDataException, IllegalArgumentException
NoSuchDataException
- Thrown if the parameter is unknown.
IllegalArgumentException
- Thrown if the parameter is not an integer.public int getMaximumInt(String param) throws NoSuchDataException, IllegalArgumentException
NoSuchDataException
- Thrown if the parameter is unknown.
IllegalArgumentException
- Thrown if the parameter is not an integer.private boolean isValueLegalEnumValue(String param, String value) throws IllegalArgumentException, NoSuchDataException
param
- The name of the parameter.value
- The value to be checked.
IllegalArgumentException
- Thrown if the parameter is not of type enum.
NoSuchDataException
- Thrown if the parameter is unknown.public String[] getEnumValues(String param) throws IllegalArgumentException, NoSuchDataException
IllegalArgumentException
- Thrown if the parameter is not of type enum.
NoSuchDataException
- Thrown if the parameter is unknown.public void setParameter(String name, String val) throws IllegalArgumentException, NoSuchDataException
val
- The new value of the parameter.
IllegalArgumentException
- Thrown if the value is not in the legal range for the parameter.
NoSuchDataException
- Thrown if the parameter is unknown.public void cancel() throws InternalErrorException
InternalErrorException
- Thrown if the operation fails for any reason.public void save() throws Exception
InternalErrorException
- Thrown if the operation fails for any reason.
Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |