org.qedeq.kernel.se.config
Class QedeqConfig

java.lang.Object
  extended by org.qedeq.kernel.se.config.QedeqConfig

public class QedeqConfig
extends java.lang.Object

This class gives a type save access to properties of the application.

Author:
Michael Meyling

Constructor Summary
QedeqConfig(java.io.File configFile, java.lang.String description, java.io.File basisDirectory)
          Constructor.
 
Method Summary
 java.io.File createAbsolutePath(java.lang.String path)
          Get file path starting from basis directory of this application.
 java.io.File getBasisDirectory()
          Get basis directory of this application.
 java.io.File getBufferDirectory()
          Get local file directory for module buffering.
 int getConnectionTimeout()
          Get connection timeout, especially for TCP/IP connections.
 java.io.File getGenerationDirectory()
          Get local file directory to save generated files in.
 java.lang.String getHttpNonProxyHosts()
          Get non http proxy hosts.
 java.lang.String getHttpProxyHost()
          Get http proxy host.
 java.lang.String getHttpProxyPort()
          Get http proxy port.
protected  java.lang.String getKeyValue(java.lang.String key)
          Get value for given key.
protected  boolean getKeyValue(java.lang.String key, boolean defaultValue)
          Get value for given key.
protected  int getKeyValue(java.lang.String key, int defaultValue)
          Get value for given key.
protected  java.lang.String getKeyValue(java.lang.String key, java.lang.String defaultValue)
          Get value for given key.
 java.io.File getLocalModulesDirectory()
          Get directory for newly created QEDEQ module files.
 java.io.File getLogFile()
          Get file location for log file.
 java.lang.String[] getModuleHistory()
          Get history of modules, which were tried to load.
 java.lang.String[] getPreviouslyLoadedModules()
          Get list of previously loaded modules.
 int getReadTimeout()
          Get read timeout, especially for TCP/IP connections.
 Parameters getServiceEntries(Service service)
          Get service properties from configuration file.
 boolean getServiceKeyValue(Service service, java.lang.String key, boolean defaultValue)
          Get value for given service key.
 int getServiceKeyValue(Service service, java.lang.String key, int defaultValue)
          Get value for given service key.
 java.lang.String getServiceKeyValue(Service service, java.lang.String key, java.lang.String defaultValue)
          Get value for given service key.
 boolean isAutoReloadLastSessionChecked()
          Get auto reload of last session successfully loaded modules.
 boolean isTraceOn()
          Is tracing on? If not, only business and fatal messages are logged.
 void saveModuleHistory(java.util.List modules)
          Save history of modules, which were tried to load.
 void setAutoReloadLastSessionChecked(boolean mode)
          Set auto reload checked modules of last session mode.
 void setBufferDirectory(java.io.File location)
          Set local file directory for module buffering.
 void setConnectionTimeout(int timeout)
          Set connection timeout, especially for TCP/IP connections.
 void setGenerationDirectory(java.io.File location)
          Set local file directory for generated files.
 void setHttpNonProxyHosts(java.lang.String httpNonProxyHosts)
          Set http non proxy hosts.
 void setHttpProxyHost(java.lang.String httpProxyHost)
          Set http proxy host.
 void setHttpProxyPort(java.lang.String httpProxyPort)
          Set http proxy port.
protected  void setKeyValue(java.lang.String key, boolean value)
          Set value for given key.
protected  void setKeyValue(java.lang.String key, int value)
          Set value for given key.
protected  void setKeyValue(java.lang.String key, java.lang.String value)
          Set value for given key.
 void setLocalModulesDirectory(java.io.File location)
          Set directory for newly created module files.
 void setPreviouslyLoadedModules(java.lang.String[] moduleAddresses)
          Set list of previously successfully loaded QEDEQ modules.
 void setReadTimeout(int timeout)
          Set read timeout, especially for TCP/IP connections.
 void setServiceKeyValue(Service service, java.lang.String key, boolean value)
          Set value for given service key.
 void setServiceKeyValue(Service service, java.lang.String key, int value)
          Set value for given service key.
 void setServiceKeyValue(Service service, java.lang.String key, java.lang.String value)
          Set value for given service key.
 void setServiceKeyValues(Service service, Parameters parameters)
          Set value for given service key.
 void setTraceOn(boolean traceOn)
          Set tracing on.
 void store()
          Store properties in configuration file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QedeqConfig

public QedeqConfig(java.io.File configFile,
                   java.lang.String description,
                   java.io.File basisDirectory)
            throws java.io.IOException
Constructor.

Parameters:
configFile - Config file.
description - Config file description.
basisDirectory - Basis directory of application for all variable data. Basis for all new relative paths
Throws:
java.io.IOException - Config file couldn't be loaded.
Method Detail

store

public final void store()
                 throws java.io.IOException
Store properties in configuration file.

Throws:
java.io.IOException - Writing failed.

getGenerationDirectory

public final java.io.File getGenerationDirectory()
Get local file directory to save generated files in.

Returns:
Generation directory.

setGenerationDirectory

public final void setGenerationDirectory(java.io.File location)
Set local file directory for generated files.

Parameters:
location - generation directory.

getBufferDirectory

public final java.io.File getBufferDirectory()
Get local file directory for module buffering.

Returns:
Buffer directory.

setBufferDirectory

public final void setBufferDirectory(java.io.File location)
Set local file directory for module buffering. After changing this location the buffer should eventually be cleared.

Parameters:
location - buffer directory.

getLocalModulesDirectory

public final java.io.File getLocalModulesDirectory()
Get directory for newly created QEDEQ module files.

Returns:
Directory for newly created QEDEQ modules.

setLocalModulesDirectory

public final void setLocalModulesDirectory(java.io.File location)
Set directory for newly created module files. After changing this location the buffer should eventually be cleared.

Parameters:
location - Buffer directory.

getLogFile

public final java.io.File getLogFile()
Get file location for log file.

Returns:
Log file path.

getModuleHistory

public final java.lang.String[] getModuleHistory()
Get history of modules, which were tried to load.

Returns:
list of modules.

saveModuleHistory

public final void saveModuleHistory(java.util.List modules)
Save history of modules, which were tried to load.

Parameters:
modules - list of modules.

getPreviouslyLoadedModules

public final java.lang.String[] getPreviouslyLoadedModules()
Get list of previously loaded modules.

Returns:
list of modules.

setPreviouslyLoadedModules

public final void setPreviouslyLoadedModules(java.lang.String[] moduleAddresses)
Set list of previously successfully loaded QEDEQ modules.

Parameters:
moduleAddresses - This modules were successfully loaded.

getBasisDirectory

public final java.io.File getBasisDirectory()
Get basis directory of this application.

Returns:
Basis directory of application for all variable data. Basis for all relative paths.

createAbsolutePath

public final java.io.File createAbsolutePath(java.lang.String path)
Get file path starting from basis directory of this application.

Parameters:
path - Go to this path starting from basis directory.
Returns:
File path resolved against basis application directory as an absolute path.

isAutoReloadLastSessionChecked

public boolean isAutoReloadLastSessionChecked()
Get auto reload of last session successfully loaded modules.

Returns:
auto reload enabled?

setAutoReloadLastSessionChecked

public final void setAutoReloadLastSessionChecked(boolean mode)
Set auto reload checked modules of last session mode.

Parameters:
mode - enable auto reload?

isTraceOn

public final boolean isTraceOn()
Is tracing on? If not, only business and fatal messages are logged. Otherwise all events are logged according to the log level settings.

Returns:
Is tracing on?

setTraceOn

public final void setTraceOn(boolean traceOn)
Set tracing on.

Parameters:
traceOn - Set trace on.

getConnectionTimeout

public int getConnectionTimeout()
Get connection timeout, especially for TCP/IP connections.

Returns:
Connection timeout (in milliseconds).

setConnectionTimeout

public final void setConnectionTimeout(int timeout)
Set connection timeout, especially for TCP/IP connections.

Parameters:
timeout - Connection timeout, especially for TCP/IP connections. In milliseconds.

getReadTimeout

public int getReadTimeout()
Get read timeout, especially for TCP/IP connections.

Returns:
Read timeout (in milliseconds).

setReadTimeout

public final void setReadTimeout(int timeout)
Set read timeout, especially for TCP/IP connections.

Parameters:
timeout - Read timeout, especially for TCP/IP connections. In milliseconds.

setHttpProxyHost

public final void setHttpProxyHost(java.lang.String httpProxyHost)
Set http proxy host.

Parameters:
httpProxyHost - Http proxy server.

getHttpProxyHost

public final java.lang.String getHttpProxyHost()
Get http proxy host. It might be a good idea to ignore this value, if the application was started via Java Webstart. If none is defined we take the value of the system property "http.proxyHost".

Returns:
Http proxy host. Might be null.

setHttpProxyPort

public final void setHttpProxyPort(java.lang.String httpProxyPort)
Set http proxy port.

Parameters:
httpProxyPort - Http proxy port.

getHttpProxyPort

public final java.lang.String getHttpProxyPort()
Get http proxy port. It might be a good idea to ignore this value, if the application was started via Java Webstart. If none is defined we take the value of the system property "http.proxyPort".

Returns:
Http proxy port. Might be null.

setHttpNonProxyHosts

public final void setHttpNonProxyHosts(java.lang.String httpNonProxyHosts)
Set http non proxy hosts.

Parameters:
httpNonProxyHosts - Http non proxy hosts. Might be null.

getHttpNonProxyHosts

public final java.lang.String getHttpNonProxyHosts()
Get non http proxy hosts. It might be a good idea to ignore this value, if the application was started via Java Webstart. If none is defined we take the value of the system property "http.nonProxyHosts".

Returns:
Http non proxy hosts. Might be null.

getKeyValue

protected java.lang.String getKeyValue(java.lang.String key)
Get value for given key.

Parameters:
key - Get value for this key.
Returns:
Value, maybe null.

getKeyValue

protected java.lang.String getKeyValue(java.lang.String key,
                                       java.lang.String defaultValue)
Get value for given key.

Parameters:
key - Get value for this key.
defaultValue - Default value..
Returns:
Value. If value for key is originally null defaultValue is returned..

setKeyValue

protected void setKeyValue(java.lang.String key,
                           java.lang.String value)
Set value for given key.

Parameters:
key - For this key.
value - Set this value.

getKeyValue

protected int getKeyValue(java.lang.String key,
                          int defaultValue)
Get value for given key.

Parameters:
key - Get value for this key.
defaultValue - Default value..
Returns:
Value. If value for key is originally null defaultValue is returned..

setKeyValue

protected void setKeyValue(java.lang.String key,
                           int value)
Set value for given key.

Parameters:
key - For this key.
value - Set this value.

getKeyValue

protected boolean getKeyValue(java.lang.String key,
                              boolean defaultValue)
Get value for given key.

Parameters:
key - Get value for this key.
defaultValue - Default value..
Returns:
Value. If value for key is originally null defaultValue is returned.

setKeyValue

protected void setKeyValue(java.lang.String key,
                           boolean value)
Set value for given key.

Parameters:
key - For this key.
value - Set this value.

getServiceEntries

public Parameters getServiceEntries(Service service)
Get service properties from configuration file.

Parameters:
service - We want to know properties for this service
Returns:
Map with properties for this service.

getServiceKeyValue

public java.lang.String getServiceKeyValue(Service service,
                                           java.lang.String key,
                                           java.lang.String defaultValue)
Get value for given service key.

Parameters:
service - Setting for this service.
key - Get value for this key.
defaultValue - Default value..
Returns:
Value. If value for key is originally null defaultValue is returned.

setServiceKeyValue

public void setServiceKeyValue(Service service,
                               java.lang.String key,
                               java.lang.String value)
Set value for given service key.

Parameters:
service - Setting for this service.
key - For this key.
value - Set this value.

setServiceKeyValues

public void setServiceKeyValues(Service service,
                                Parameters parameters)
Set value for given service key.

Parameters:
service - Setting for this service.
parameters - Parameters for this service.

getServiceKeyValue

public int getServiceKeyValue(Service service,
                              java.lang.String key,
                              int defaultValue)
Get value for given service key.

Parameters:
service - Setting for this service.
key - Get value for this key.
defaultValue - Default value..
Returns:
Value. If value for key is originally null defaultValue is returned.

setServiceKeyValue

public void setServiceKeyValue(Service service,
                               java.lang.String key,
                               int value)
Set value for given service key.

Parameters:
service - Setting for this service.
key - For this key.
value - Set this value.

getServiceKeyValue

public boolean getServiceKeyValue(Service service,
                                  java.lang.String key,
                                  boolean defaultValue)
Get value for given service key.

Parameters:
service - Setting for this service.
key - Get value for this key.
defaultValue - Default value..
Returns:
Value. If value for key is originally null defaultValue is returned.

setServiceKeyValue

public void setServiceKeyValue(Service service,
                               java.lang.String key,
                               boolean value)
Set value for given service key.

Parameters:
service - Setting for this service.
key - For this key.
value - Set this value.


Copyright © 2014. All Rights Reserved.