com.irisel.util
Class Configuration

java.lang.Object
  extended by com.irisel.util.Configuration
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
PropertyFileConfiguration

public class Configuration
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
static java.lang.String DISABLE_LOGGING
          The 'disable logging' property key.
static java.lang.String DISABLE_LOGGING_DEFAULT
          The default 'disable logging' property value.
static java.lang.String KEY_APP_PASS
           
static java.lang.String KEY_APP_USER
           
static java.lang.String KEY_CONSOLE_CLASSNAME
           
static java.lang.String KEY_CONSOLE_DIRECTORY_CLASSNAME
           
static java.lang.String KEY_COUNTRY
           
static java.lang.String KEY_DB_AUTH_TYPE
           
static java.lang.String KEY_DB_DATABASE
           
static java.lang.String KEY_DB_INIT
           
static java.lang.String KEY_DB_INIT_PASS
           
static java.lang.String KEY_DB_PASS
           
static java.lang.String KEY_DB_PORT
           
static java.lang.String KEY_DB_SCHEMA
           
static java.lang.String KEY_DB_SERV
           
static java.lang.String KEY_DB_SYSTEM_USER
           
static java.lang.String KEY_DB_SYSTEM_XPASS
           
static java.lang.String KEY_DB_TYPE
           
static java.lang.String KEY_DB_USER
           
static java.lang.String KEY_LANG
           
static java.lang.String KEY_OL_DESC_FILE
           
static java.lang.String KEY_OL_SCH_FILE
           
static java.lang.String KEY_OL_SRV_DESC_FILE
           
static java.lang.String KEY_OL_SRV_SCH_FILE
           
static java.lang.String KEY_PLAF
          platform look and feel
static java.lang.String licpayload
           
static java.lang.String licsign
           
static java.lang.String LOGLEVEL
          The 'log level' property key.
static java.lang.String LOGLEVEL_DEFAULT
          The default 'log level' property value.
static java.lang.String LOGTARGET
          The 'log target' property key.
 
Constructor Summary
Configuration(Configuration globalConfig)
          Creates a new report configuration.
 
Method Summary
 java.util.Iterator findPropertyKeys(java.lang.String prefix)
          Searches all property keys that start with a given prefix.
static javax.swing.Icon getClassIcon(java.lang.String name)
           
 java.util.Enumeration getConfigProperties()
           
 java.lang.String getConfigProperty(java.lang.String key)
          Returns the configuration property with the specified key.
 java.lang.String getConfigProperty(java.lang.String key, java.lang.String defaultValue)
          Returns the configuration property with the specified key (or the specified default value if there is no such property).
 java.util.Properties getConfiguration()
          Returns the collection of properties for the configuration.
static Configuration getGlobalConfig()
          Deprecated.  
 java.lang.String getLogLevel()
          Returns the log level.
 java.lang.String getLogTarget()
          Returns the current log target.
 boolean isDisableLogging()
          Returns true if logging is disabled, and false otherwise.
 boolean isLocallyDefined(java.lang.String key)
          Checks, whether the given key is localy defined in this instance or whether the key's value is inherited.
static java.io.InputStream openFile(java.lang.Class cls, java.awt.Component comp, java.lang.String filename)
          Returns InputStreamm for given filename.
static java.io.InputStream openFile(java.lang.Class class1, java.lang.String filename)
           
 void setConfigProperty(java.lang.String key, java.lang.String value)
          Sets a configuration property.
static boolean setCurrentDirectory()
           
static boolean setCurrentDirectory(java.lang.String directory_name)
           
 void setDisableLogging(boolean disableLogging)
          Sets the flag that disables logging.
 void setLogLevel(java.lang.String level)
          Sets the log level, which is read from the global report configuration at the point that the classloader loads the Log class.
 void setLogTarget(java.lang.String logTarget)
          Sets the log target.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISABLE_LOGGING

public static final java.lang.String DISABLE_LOGGING
The 'disable logging' property key.

See Also:
Constant Field Values

DISABLE_LOGGING_DEFAULT

public static final java.lang.String DISABLE_LOGGING_DEFAULT
The default 'disable logging' property value.

See Also:
Constant Field Values

LOGLEVEL

public static final java.lang.String LOGLEVEL
The 'log level' property key.

See Also:
Constant Field Values

LOGLEVEL_DEFAULT

public static final java.lang.String LOGLEVEL_DEFAULT
The default 'log level' property value.

See Also:
Constant Field Values

LOGTARGET

public static final java.lang.String LOGTARGET
The 'log target' property key.

See Also:
Constant Field Values

KEY_LANG

public static final java.lang.String KEY_LANG
See Also:
Constant Field Values

KEY_COUNTRY

public static final java.lang.String KEY_COUNTRY
See Also:
Constant Field Values

KEY_PLAF

public static final java.lang.String KEY_PLAF
platform look and feel

See Also:
Constant Field Values

KEY_DB_TYPE

public static final java.lang.String KEY_DB_TYPE
See Also:
Constant Field Values

KEY_DB_SERV

public static final java.lang.String KEY_DB_SERV
See Also:
Constant Field Values

KEY_DB_PORT

public static final java.lang.String KEY_DB_PORT
See Also:
Constant Field Values

KEY_DB_DATABASE

public static final java.lang.String KEY_DB_DATABASE
See Also:
Constant Field Values

KEY_DB_SCHEMA

public static final java.lang.String KEY_DB_SCHEMA
See Also:
Constant Field Values

KEY_DB_INIT

public static final java.lang.String KEY_DB_INIT
See Also:
Constant Field Values

KEY_DB_INIT_PASS

public static final java.lang.String KEY_DB_INIT_PASS
See Also:
Constant Field Values

KEY_DB_USER

public static final java.lang.String KEY_DB_USER
See Also:
Constant Field Values

KEY_DB_AUTH_TYPE

public static final java.lang.String KEY_DB_AUTH_TYPE
See Also:
Constant Field Values

KEY_DB_SYSTEM_USER

public static final java.lang.String KEY_DB_SYSTEM_USER
See Also:
Constant Field Values

KEY_DB_SYSTEM_XPASS

public static final java.lang.String KEY_DB_SYSTEM_XPASS
See Also:
Constant Field Values

KEY_DB_PASS

public static final java.lang.String KEY_DB_PASS
See Also:
Constant Field Values

KEY_APP_USER

public static final java.lang.String KEY_APP_USER
See Also:
Constant Field Values

KEY_APP_PASS

public static final java.lang.String KEY_APP_PASS
See Also:
Constant Field Values

KEY_OL_SCH_FILE

public static final java.lang.String KEY_OL_SCH_FILE
See Also:
Constant Field Values

KEY_OL_DESC_FILE

public static final java.lang.String KEY_OL_DESC_FILE
See Also:
Constant Field Values

KEY_OL_SRV_SCH_FILE

public static final java.lang.String KEY_OL_SRV_SCH_FILE
See Also:
Constant Field Values

KEY_OL_SRV_DESC_FILE

public static final java.lang.String KEY_OL_SRV_DESC_FILE
See Also:
Constant Field Values

KEY_CONSOLE_CLASSNAME

public static final java.lang.String KEY_CONSOLE_CLASSNAME
See Also:
Constant Field Values

KEY_CONSOLE_DIRECTORY_CLASSNAME

public static final java.lang.String KEY_CONSOLE_DIRECTORY_CLASSNAME
See Also:
Constant Field Values

licpayload

public static java.lang.String licpayload

licsign

public static java.lang.String licsign
Constructor Detail

Configuration

public Configuration(Configuration globalConfig)
              throws ConfigException
Creates a new report configuration.

Parameters:
globalConfig - the global configuration.
Throws:
ConfigException
Method Detail

getConfigProperty

public java.lang.String getConfigProperty(java.lang.String key)
Returns the configuration property with the specified key.

Parameters:
key - the property key.
Returns:
the property value.

getConfigProperty

public java.lang.String getConfigProperty(java.lang.String key,
                                          java.lang.String defaultValue)
Returns the configuration property with the specified key (or the specified default value if there is no such property).

If the property is not defined in this configuration, the code will lookup the property in the parent configuration.

Parameters:
key - the property key.
defaultValue - the default value.
Returns:
the property value.

setConfigProperty

public void setConfigProperty(java.lang.String key,
                              java.lang.String value)
Sets a configuration property.

Parameters:
key - the property key.
value - the property value.

getLogLevel

public java.lang.String getLogLevel()
Returns the log level.

Returns:
the log level.

setLogLevel

public void setLogLevel(java.lang.String level)
Sets the log level, which is read from the global report configuration at the point that the classloader loads the Log class.

Parameters:
level - the new log level.

isDisableLogging

public boolean isDisableLogging()
Returns true if logging is disabled, and false otherwise.

Returns:
true, if logging is completly disabled, false otherwise.

setDisableLogging

public void setDisableLogging(boolean disableLogging)
Sets the flag that disables logging.

To switch off logging globally, you can use the following code:

Configuration.getGlobalConfig().setDisableLogging(true);

Parameters:
disableLogging - the flag.

getConfiguration

public java.util.Properties getConfiguration()
Returns the collection of properties for the configuration.

Returns:
the properties.

getGlobalConfig

public static Configuration getGlobalConfig()
                                     throws ConfigException
Deprecated. 

Returns the global configuration.

Returns:
the global configuration.
Throws:
ConfigException

getLogTarget

public java.lang.String getLogTarget()
Returns the current log target.

Returns:
the log target.

setLogTarget

public void setLogTarget(java.lang.String logTarget)
Sets the log target.

Parameters:
logTarget - the new log target.

getConfigProperties

public java.util.Enumeration getConfigProperties()

findPropertyKeys

public java.util.Iterator findPropertyKeys(java.lang.String prefix)
Searches all property keys that start with a given prefix.

Parameters:
prefix - the prefix that all selected property keys should share
Returns:
the properties as iterator.

isLocallyDefined

public boolean isLocallyDefined(java.lang.String key)
Checks, whether the given key is localy defined in this instance or whether the key's value is inherited.

Parameters:
key - the key that should be checked.
Returns:
true, if the key is defined locally, false otherwise.

getClassIcon

public static javax.swing.Icon getClassIcon(java.lang.String name)

openFile

public static java.io.InputStream openFile(java.lang.Class cls,
                                           java.awt.Component comp,
                                           java.lang.String filename)
Returns InputStreamm for given filename. The file is opened with cls.getResource(filename). If not successfull, then it tries to create a FileInputStream(filename). If not successfull a message dialog is shown using

Parameters:
cls - is Class used to get Resource in first instance
comp - determines the Frame in which the dialog is displayed (optional)
filename - name of the desired resource or file name.
Returns:
InputStream object
Throws:
java.io.IOException
See Also:
"java.lang.Class.getResource()"

openFile

public static java.io.InputStream openFile(java.lang.Class class1,
                                           java.lang.String filename)

setCurrentDirectory

public static boolean setCurrentDirectory(java.lang.String directory_name)

setCurrentDirectory

public static boolean setCurrentDirectory()