|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.montsuqi.client.Configuration
public class Configuration
A class to manage configuration settings of the application.
Configuration is stored using the Preferences API. On Unix based systems, it is stored in XML files somewhere in user's home directory. On Windows, it is stored in the registry.
| Field Summary | |
|---|---|
(package private) static java.lang.String |
DEFAULT_APPLICATION
Default application name: "demo". |
(package private) static java.lang.String |
DEFAULT_CACHE_PATH
Default cache directory: [value of System property user.home]/.monsiaj/cache |
(package private) static java.lang.String |
DEFAULT_CLIENT_CERTIFICATE
Default client certificate path: empty string. |
(package private) static java.lang.String |
DEFAULT_CLIENT_CERTIFICATE_PASSWORD
Default client certificate password: empty string. |
(package private) static java.lang.String |
DEFAULT_ENCODING
Default encoding for the stream: EUC-JP. |
(package private) static java.lang.String |
DEFAULT_HOST
Default host: localhost |
(package private) static java.lang.String |
DEFAULT_LOOK_AND_FEEL_CLASS_NAME
Default look and feel class name: system look and feel. |
(package private) static java.lang.String |
DEFAULT_PASSWORD
Default password: empty string. |
(package private) static int |
DEFAULT_PORT
Default port: 8000 |
(package private) static int |
DEFAULT_PROTOCOL_VERSION
Default protocol version: 1. |
(package private) static boolean |
DEFAULT_SAVE_CLIENT_CERTIFICATE_PASSWORD
Default value of save client certificate password checkbox: false. |
(package private) static boolean |
DEFAULT_SAVE_PASSWORD
Default value of save password checkbox: false. |
(package private) static java.lang.String |
DEFAULT_STYLE_RESOURCE_NAME
Default style resource name: /org/montsuqi/client/style.properteis. |
(package private) static java.lang.String |
DEFAULT_STYLES
Default style definitions: empty string. |
(package private) static boolean |
DEFAULT_USE_LOG_VIEWER
Default value of use log viewer checkbox: false. |
(package private) static boolean |
DEFAULT_USE_SSL
Default value of use SSL checkbox: false. |
(package private) static java.lang.String |
DEFAULT_USER
Default user: value of System property user.name. |
protected static Logger |
logger
|
| Constructor Summary | |
|---|---|
Configuration(java.lang.Class clazz)
Constructs a configuration object. |
|
| Method Summary | |
|---|---|
java.lang.String |
getApplication()
Returns the name of the application. |
protected boolean |
getBoolean(java.lang.String key,
boolean defaultValue)
Returns configuration value(boolean). |
java.lang.String |
getCache()
Returns the cache directory. |
java.lang.String |
getClientCertificateFileName()
Returns the name of client certificate file. |
java.lang.String |
getClientCertificatePassword()
Returns the client certificate password. |
java.lang.String |
getEncoding()
Returns the encoding. |
java.lang.String |
getHost()
Returns the host. |
protected int |
getInt(java.lang.String key,
int defaultValue)
Returns configuration value(int). |
java.lang.String |
getLookAndFeelClassName()
Returns the look and feel class name. |
java.lang.String |
getPass()
Returns the password. |
int |
getPort()
Returns the port. |
java.lang.String |
getProperties()
Returns other properties as string. |
int |
getProtocolVersion()
Returns the protocol version. |
boolean |
getSaveClientCertificatePassword()
Returns the value of save client certificate password. |
boolean |
getSavePassword()
Returns the value of save password. |
protected java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue)
Returns configuration value(String). |
java.lang.String |
getStyleFileName()
Returns the style file name. |
java.net.URL |
getStyleURL()
Returns the style URL. |
boolean |
getUseLogViewer()
Returns the value of use log viewer. |
java.lang.String |
getUser()
Returns the user. |
boolean |
getUseSSL()
Returns the value of use SSL. |
protected void |
save()
Ensures the configuration is saved. |
void |
setApplication(java.lang.String app)
Sets the name of the application. |
protected void |
setBoolean(java.lang.String key,
boolean value)
Sets configuration value(boolean). |
void |
setCache(java.lang.String cache)
Sets the cache directory. |
void |
setClientCertificateFileName(java.lang.String fileName)
Sets the name of client certificate file. |
void |
setClientCertificatePassword(java.lang.String pass)
Sets the client certificate password. |
void |
setEncoding(java.lang.String encoding)
Sets the encoding. |
void |
setHost(java.lang.String host)
Sets the host. |
protected void |
setInt(java.lang.String key,
int value)
Sets configuration value(int). |
void |
setLookAndFeelClassName(java.lang.String className)
Sets the look and feel class name. |
void |
setPass(java.lang.String pass)
Sets the password. |
void |
setPort(int port)
Sets the port. |
void |
setProperties(java.lang.String properties)
Sets other properties. |
void |
setProtocolVersion(int version)
Sets the protocol version. |
void |
setSaveClientCertificatePassword(boolean flag)
Sets the value of save client certificate password. |
void |
setSavePassword(boolean flag)
Sets the value of save password. |
protected void |
setString(java.lang.String key,
java.lang.String value)
Sets configuration value(String). |
void |
setStyleFileName(java.lang.String styles)
Sets the style file name. |
void |
setUseLogViewer(boolean flag)
Sets the value of use log viewer. |
void |
setUser(java.lang.String user)
Sets the user. |
void |
setUseSSL(boolean flag)
Sets the value of use SSL. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final int DEFAULT_PORT
Default port: 8000
static final java.lang.String DEFAULT_HOST
Default host: localhost
static final java.lang.String DEFAULT_USER
Default user: value of System property user.name.
static final java.lang.String DEFAULT_PASSWORD
Default password: empty string.
static final java.lang.String DEFAULT_CLIENT_CERTIFICATE_PASSWORD
Default client certificate password: empty string.
static final java.lang.String DEFAULT_CLIENT_CERTIFICATE
Default client certificate path: empty string.
static final boolean DEFAULT_SAVE_PASSWORD
Default value of save password checkbox: false.
static final java.lang.String DEFAULT_APPLICATION
Default application name: "demo".
static final java.lang.String DEFAULT_ENCODING
Default encoding for the stream: EUC-JP.
static final java.lang.String DEFAULT_CACHE_PATH
Default cache directory: [value of System property user.home]/.monsiaj/cache
static final java.lang.String DEFAULT_STYLES
Default style definitions: empty string.
static final java.lang.String DEFAULT_STYLE_RESOURCE_NAME
Default style resource name: /org/montsuqi/client/style.properteis.
static final boolean DEFAULT_USE_SSL
Default value of use SSL checkbox: false.
static final boolean DEFAULT_SAVE_CLIENT_CERTIFICATE_PASSWORD
Default value of save client certificate password checkbox: false.
static final int DEFAULT_PROTOCOL_VERSION
Default protocol version: 1.
static final java.lang.String DEFAULT_LOOK_AND_FEEL_CLASS_NAME
Default look and feel class name: system look and feel.
static final boolean DEFAULT_USE_LOG_VIEWER
Default value of use log viewer checkbox: false.
protected static final Logger logger
| Constructor Detail |
|---|
public Configuration(java.lang.Class clazz)
Constructs a configuration object.
clazz - class object used to obtain user preference node.| Method Detail |
|---|
protected void save()
Ensures the configuration is saved.
public java.lang.String getPass()
Returns the password.
If save password is set to false, it always returns DEFAULT_PASSWORD("").
public void setPass(java.lang.String pass)
Sets the password.
It stores the new password into the member field.
If save password is set to true, it also store the password into the configuration, otherwise it sets the DEFAULT_PASSWORD("") to clear it.
pass - the new password.public boolean getSavePassword()
Returns the value of save password.
public void setSavePassword(boolean flag)
Sets the value of save password.
flag - new value of save password.public java.lang.String getClientCertificatePassword()
Returns the client certificate password.
If save password is set to false, it always returns DEFAULT_PASSWORD("").
public void setClientCertificatePassword(java.lang.String pass)
Sets the client certificate password.
It stores the new password into the member field.
If save client password is set to true, it also store the password into the configuration, otherwise it sets the DEFAULT_PASSWORD("") to clear it.
pass - the new password.public boolean getSaveClientCertificatePassword()
Returns the value of save client certificate password.
public void setSaveClientCertificatePassword(boolean flag)
Sets the value of save client certificate password.
flag - new value of save client certificate password.public int getPort()
Returns the port.
public void setPort(int port)
Sets the port.
port - new value of the port.public java.lang.String getHost()
Returns the host.
public void setHost(java.lang.String host)
Sets the host.
host - new value of the host.public java.lang.String getUser()
Returns the user.
public void setUser(java.lang.String user)
Sets the user.
user - new value of the user.public java.lang.String getCache()
Returns the cache directory.
public void setCache(java.lang.String cache)
Sets the cache directory.
cache - new value of the cache directory.public java.lang.String getEncoding()
Returns the encoding.
public void setEncoding(java.lang.String encoding)
Sets the encoding.
encoding - new value of the encoding.public java.net.URL getStyleURL()
Returns the style URL.
It first tries converting style file name specified in the configuration to URL. If it fails it falls back to default style resource.
public java.lang.String getStyleFileName()
Returns the style file name.
public void setStyleFileName(java.lang.String styles)
Sets the style file name.
styles - new value of style file name.public java.lang.String getApplication()
Returns the name of the application.
public void setApplication(java.lang.String app)
Sets the name of the application.
app - new value of the name of the pplication.public boolean getUseSSL()
Returns the value of use SSL.
public void setUseSSL(boolean flag)
Sets the value of use SSL.
flag - new value of use SSL.public java.lang.String getClientCertificateFileName()
Returns the name of client certificate file.
public void setClientCertificateFileName(java.lang.String fileName)
Sets the name of client certificate file.
fileName - new name of client certificate file.public int getProtocolVersion()
Returns the protocol version.
public void setProtocolVersion(int version)
Sets the protocol version.
version - version number(1 or 2).public java.lang.String getLookAndFeelClassName()
Returns the look and feel class name.
public void setLookAndFeelClassName(java.lang.String className)
Sets the look and feel class name.
className - look and feel class name.public boolean getUseLogViewer()
Returns the value of use log viewer.
public void setUseLogViewer(boolean flag)
Sets the value of use log viewer.
flag - new value of use log viewer.public java.lang.String getProperties()
Returns other properties as string.
public void setProperties(java.lang.String properties)
Sets other properties.
properties - new line separated property assignments.
protected java.lang.String getString(java.lang.String key,
java.lang.String defaultValue)
Returns configuration value(String).
key - configuration key.defaultValue - value if the configuration for the given key is missing.
protected int getInt(java.lang.String key,
int defaultValue)
Returns configuration value(int).
key - configuration key.defaultValue - value if the configuration for the given key is missing.
protected boolean getBoolean(java.lang.String key,
boolean defaultValue)
Returns configuration value(boolean).
key - configuration key.defaultValue - value if the configuration for the given key is missing.
protected void setString(java.lang.String key,
java.lang.String value)
Sets configuration value(String).
key - configuration key.value - the configuration value.
protected void setInt(java.lang.String key,
int value)
Sets configuration value(int).
key - configuration key.value - the configuration value.
protected void setBoolean(java.lang.String key,
boolean value)
Sets configuration value(boolean).
key - configuration key.value - the configuration value.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||