EAF 7.6 Implementation

org.enhydra.server
Class DatabaseEdit

java.lang.Object
  extended by org.enhydra.server.DatabaseEdit

public class DatabaseEdit
extends java.lang.Object

Instances of this class are used in manipulation and editing of DatabaseManager section parameters, defined in application configuration file. Also this class contains method saveState which provides saving changed configuration onto disk.


Constructor Summary
DatabaseEdit(com.lutris.util.Config config)
          Construction of DatabaseEdit object for particular application with given configuration file.
 
Method Summary
 boolean addDatabase(java.lang.String dBname)
          Adds database name to list of databases used by application.
 boolean existDbName(java.lang.String dBname)
          Checks existence of given database name in the list of already defined databases for application.
 java.lang.String[] getDatabases()
          Gets list of available database names.
 java.lang.String getDBnameClassType(java.lang.String dBname)
          Gets value of ClassType parameter for given database name from Config object of application.
 java.lang.String getDBnameConnectionAllocationTimeout(java.lang.String dBname)
          Gets value of Connection.
 java.lang.String getDBnameConnectionLogging(java.lang.String dBname)
          Gets value of Connection.Logging parameter for given database name from Config object of application.
 java.lang.String getDBnameConnectionMaxPoolSize(java.lang.String dBname)
          Gets value of Connection.MaxPoolSize parameter for given database name from Config object of application.
 java.lang.String getDBnameConnectionPassword(java.lang.String dBname)
          Gets value of Connection.Password parameter for given database name from Config object of application.
 java.lang.String getDBnameConnectionUrl(java.lang.String dBname)
          Gets value of Connection.Url parameter for given database name from Config object of application.
 java.lang.String getDBnameConnectionUser(java.lang.String dBname)
          Gets value of Connection.User parameter for given database name from Config object of application.
 java.lang.String getDBnameJdbcDriver(java.lang.String dBname)
          Gets value of JdbcDriver parameter for given database name from Config object of application.
 java.lang.String getDBnameObjectIdCacheSize(java.lang.String dBname)
          Gets value of ObjectId.CacheSize parameter for given database name from Config object of application.
 java.lang.String getDBnameObjectIdMinValue(java.lang.String dBname)
          Gets value of ObjectId.MinValue parameter for given database name from Config object of application.
 java.lang.String getDebug()
          Gets value of Debug parameter in Config object of application.
 java.lang.String getDefaultDatabase()
          Gets value of DefaultDatabase parameter in Config object of application.
 void refreshAllDbParameters(java.lang.String dBname)
          Finds all parameters for specified database in configuration file and sets they to temporary object arguments.
 boolean removeDatabase(java.lang.String dBname)
          Removes database name from array of databases used by application.
 boolean saveState()
          Save state of DatabaseManager configuration parameters into application configuration file.
 void setDatabases(java.lang.String[] databases)
          Sets list of database names.
 void setDBnameClassType(java.lang.String value, java.lang.String dBname)
          Sets value of ClassType parameter for given database name in Config object of application.
 void setDBnameConnectionAllocationTimeout(java.lang.String value, java.lang.String dBname)
          Sets value of Connection.AllocationTimeout parameter for given database name in Config object of application.
 void setDBnameConnectionLogging(java.lang.String value, java.lang.String dBname)
          Sets value of Connection.Logging parameter for given database name in Config object of application.
 void setDBnameConnectionMaxPoolSize(java.lang.String value, java.lang.String dBname)
          Sets value of Connection.MaxPoolSize parameter for given database name in Config object of application.
 void setDBnameConnectionPassword(java.lang.String value, java.lang.String dBname)
          Sets value of Connection.Password parameter for given database name in Config object of application.
 void setDBnameConnectionUrl(java.lang.String value, java.lang.String dBname)
          Sets value of Connection.Url parameter for given database name in Config object of application.
 void setDBnameConnectionUser(java.lang.String value, java.lang.String dBname)
          Sets value of Connection.User parameter for given database name in Config object of application.
 void setDBnameJdbcDriver(java.lang.String value, java.lang.String dBname)
          Sets value of JdbcDriver parameter for given database name in Config object of application.
 void setDBnameObjectIdCacheSize(java.lang.String value, java.lang.String dBname)
          Sets value of ObjectId.CacheSize parameter for given database name in Config object of application.
 void setDBnameObjectIdMinValue(java.lang.String value, java.lang.String dBname)
          Sets value of ObjectId.MinValue parameter for given database name in Config object of application.
 void setDebug(java.lang.String debug)
          Sets value of Debug parameter in Config object of application.
 void setDefaultDatabase(java.lang.String dBname)
          Sets value of DefaultDatabase parameter in Config object of application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseEdit

public DatabaseEdit(com.lutris.util.Config config)
             throws com.lutris.util.ConfigException,
                    com.lutris.util.KeywordValueException
Construction of DatabaseEdit object for particular application with given configuration file.

Parameters:
config - configuration file of the application represented as Config object.
Throws:
com.lutris.util.ConfigException
com.lutris.util.KeywordValueException
Method Detail

refreshAllDbParameters

public void refreshAllDbParameters(java.lang.String dBname)
                            throws com.lutris.util.KeywordValueException
Finds all parameters for specified database in configuration file and sets they to temporary object arguments.

Parameters:
dBname - name of database which parameters are searched.
Throws:
com.lutris.util.KeywordValueException

existDbName

public boolean existDbName(java.lang.String dBname)
Checks existence of given database name in the list of already defined databases for application.

Parameters:
dBname - the name of the database.
Returns:
true = database name already exists, false = database name does not exist.

addDatabase

public boolean addDatabase(java.lang.String dBname)
                    throws com.lutris.util.KeywordValueException
Adds database name to list of databases used by application. This list is represented by "Datasbase" parameter in configuration file of the application.

Parameters:
dBname - the name of the database.
Returns:
true = database name is sucessfuly added, false = database name is not added.
Throws:
com.lutris.util.KeywordValueException

removeDatabase

public boolean removeDatabase(java.lang.String dBname)
                       throws com.lutris.util.KeywordValueException
Removes database name from array of databases used by application. This list is represented by "Datasbase" parameter in configuration file of the application.

Parameters:
dBname - the name of the database.
Returns:
true = database name is sucessfuly removed, false = database name is not removed.
Throws:
com.lutris.util.KeywordValueException

setDatabases

public void setDatabases(java.lang.String[] databases)
                  throws com.lutris.util.KeywordValueException
Sets list of database names. Old settings are remowed and are swapped with given new list. All corresponding database parameters, for given database names in list, with its default initial values will be added too

Parameters:
databases - list of database names.
Throws:
com.lutris.util.KeywordValueException

getDatabases

public java.lang.String[] getDatabases()
Gets list of available database names.

Returns:
list of available databases represented as String array
Throws:
com.lutris.util.KeywordValueException

setDBnameClassType

public void setDBnameClassType(java.lang.String value,
                               java.lang.String dBname)
                        throws com.lutris.util.KeywordValueException
Sets value of ClassType parameter for given database name in Config object of application.

Parameters:
value - given value of ClassType parameter represented as String
dBname - name of database which parameter's value is changed or set.
Throws:
com.lutris.util.KeywordValueException

getDBnameClassType

public java.lang.String getDBnameClassType(java.lang.String dBname)
                                    throws com.lutris.util.KeywordValueException
Gets value of ClassType parameter for given database name from Config object of application.

Parameters:
dBname - name of database which parameter's value is changed or set.
Returns:
value of parameter represented as String
Throws:
com.lutris.util.KeywordValueException

setDBnameConnectionAllocationTimeout

public void setDBnameConnectionAllocationTimeout(java.lang.String value,
                                                 java.lang.String dBname)
                                          throws com.lutris.util.KeywordValueException
Sets value of Connection.AllocationTimeout parameter for given database name in Config object of application.

Parameters:
value - given value of Connection.AllocationTimeout parameter represented as String.
dBname - name of database which parameter's value is changed or set.
Throws:
com.lutris.util.KeywordValueException

getDBnameConnectionAllocationTimeout

public java.lang.String getDBnameConnectionAllocationTimeout(java.lang.String dBname)
                                                      throws com.lutris.util.KeywordValueException
Gets value of Connection. AllocationTimeout parameter for given database name from Config object of application.

Parameters:
dBname - name of database which parameter's value is changed or set.
Returns:
value of parameter represented as String
Throws:
com.lutris.util.KeywordValueException

setDBnameConnectionLogging

public void setDBnameConnectionLogging(java.lang.String value,
                                       java.lang.String dBname)
                                throws com.lutris.util.KeywordValueException
Sets value of Connection.Logging parameter for given database name in Config object of application.

Parameters:
value - given value of Connection.Logging parameter represented as String. Allowable values for this parameter are "true" and "false". Any other value will be treated as N/A (not available).
dBname - name of database which parameter's value is changed or set.
Throws:
com.lutris.util.KeywordValueException

getDBnameConnectionLogging

public java.lang.String getDBnameConnectionLogging(java.lang.String dBname)
                                            throws com.lutris.util.KeywordValueException
Gets value of Connection.Logging parameter for given database name from Config object of application.

Parameters:
dBname - name of database which parameter's value is changed or set.
Returns:
value of parameter represented as String. It could has values "true", "false" or "N/A" in case of parameter absence.
Throws:
com.lutris.util.KeywordValueException

setDBnameConnectionMaxPoolSize

public void setDBnameConnectionMaxPoolSize(java.lang.String value,
                                           java.lang.String dBname)
                                    throws com.lutris.util.KeywordValueException
Sets value of Connection.MaxPoolSize parameter for given database name in Config object of application.

Parameters:
value - given value of Connection.MaxPoolSize parameter represented as String
dBname - name of database which parameter's value is changed or set.
Throws:
com.lutris.util.KeywordValueException

getDBnameConnectionMaxPoolSize

public java.lang.String getDBnameConnectionMaxPoolSize(java.lang.String dBname)
                                                throws com.lutris.util.KeywordValueException
Gets value of Connection.MaxPoolSize parameter for given database name from Config object of application.

Parameters:
dBname - name of database which parameter's value is changed or set.
Returns:
value of parameter represented as String
Throws:
com.lutris.util.KeywordValueException

setDBnameConnectionPassword

public void setDBnameConnectionPassword(java.lang.String value,
                                        java.lang.String dBname)
                                 throws com.lutris.util.KeywordValueException
Sets value of Connection.Password parameter for given database name in Config object of application.

Parameters:
value - given value of Connection.Password parameter represented as String
dBname - name of database which parameter's value is changed or set.
Throws:
com.lutris.util.KeywordValueException

getDBnameConnectionPassword

public java.lang.String getDBnameConnectionPassword(java.lang.String dBname)
                                             throws com.lutris.util.KeywordValueException
Gets value of Connection.Password parameter for given database name from Config object of application.

Parameters:
dBname - name of database which parameter's value is changed or set.
Returns:
value of parameter represented as String
Throws:
com.lutris.util.KeywordValueException

setDBnameConnectionUrl

public void setDBnameConnectionUrl(java.lang.String value,
                                   java.lang.String dBname)
                            throws com.lutris.util.KeywordValueException
Sets value of Connection.Url parameter for given database name in Config object of application.

Parameters:
value - given value of Connection.Url parameter represented as String
dBname - name of database which parameter's value is changed or set.
Throws:
com.lutris.util.KeywordValueException

getDBnameConnectionUrl

public java.lang.String getDBnameConnectionUrl(java.lang.String dBname)
                                        throws com.lutris.util.KeywordValueException
Gets value of Connection.Url parameter for given database name from Config object of application.

Parameters:
dBname - name of database which parameter's value is changed or set.
Returns:
value of parameter represented as String
Throws:
com.lutris.util.KeywordValueException

setDBnameConnectionUser

public void setDBnameConnectionUser(java.lang.String value,
                                    java.lang.String dBname)
                             throws com.lutris.util.KeywordValueException
Sets value of Connection.User parameter for given database name in Config object of application.

Parameters:
value - given value of Connection.User parameter represented as String
dBname - name of database which parameter's value is changed or set.
Throws:
com.lutris.util.KeywordValueException

getDBnameConnectionUser

public java.lang.String getDBnameConnectionUser(java.lang.String dBname)
                                         throws com.lutris.util.KeywordValueException
Gets value of Connection.User parameter for given database name from Config object of application.

Parameters:
dBname - name of database which parameter's value is changed or set.
Returns:
value of parameter represented as String
Throws:
com.lutris.util.KeywordValueException

setDBnameJdbcDriver

public void setDBnameJdbcDriver(java.lang.String value,
                                java.lang.String dBname)
                         throws com.lutris.util.KeywordValueException
Sets value of JdbcDriver parameter for given database name in Config object of application.

Parameters:
value - given value of JdbcDriver parameter represented as String.
dBname - name of database which parameter's value is changed or set.
Throws:
com.lutris.util.KeywordValueException

getDBnameJdbcDriver

public java.lang.String getDBnameJdbcDriver(java.lang.String dBname)
                                     throws com.lutris.util.KeywordValueException
Gets value of JdbcDriver parameter for given database name from Config object of application.

Parameters:
dBname - name of database which parameter's value is changed or set.
Returns:
value of parameter represented as String
Throws:
com.lutris.util.KeywordValueException

setDBnameObjectIdCacheSize

public void setDBnameObjectIdCacheSize(java.lang.String value,
                                       java.lang.String dBname)
                                throws com.lutris.util.KeywordValueException
Sets value of ObjectId.CacheSize parameter for given database name in Config object of application.

Parameters:
value - given value of ObjectId.CacheSize parameter represented as String.
dBname - name of database which parameter's value is changed or set.
Throws:
com.lutris.util.KeywordValueException

getDBnameObjectIdCacheSize

public java.lang.String getDBnameObjectIdCacheSize(java.lang.String dBname)
                                            throws com.lutris.util.KeywordValueException
Gets value of ObjectId.CacheSize parameter for given database name from Config object of application.

Parameters:
dBname - name of database which parameter's value is changed or set.
Returns:
value of parameter represented as String
Throws:
com.lutris.util.KeywordValueException

setDBnameObjectIdMinValue

public void setDBnameObjectIdMinValue(java.lang.String value,
                                      java.lang.String dBname)
                               throws com.lutris.util.KeywordValueException
Sets value of ObjectId.MinValue parameter for given database name in Config object of application.

Parameters:
value - given value of ObjectId.MinValue parameter represented as String
dBname - name of database which parameter's value is changed or set.
Throws:
com.lutris.util.KeywordValueException

getDBnameObjectIdMinValue

public java.lang.String getDBnameObjectIdMinValue(java.lang.String dBname)
                                           throws com.lutris.util.KeywordValueException
Gets value of ObjectId.MinValue parameter for given database name from Config object of application.

Parameters:
dBname - name of database which parameter's value is changed or set.
Returns:
value of parameter represented as String
Throws:
com.lutris.util.KeywordValueException

setDebug

public void setDebug(java.lang.String debug)
              throws com.lutris.util.KeywordValueException
Sets value of Debug parameter in Config object of application.

Parameters:
debug - value of parameter represented as String. It can takes values "true" or "false". If wrong value is specified, it will be treated as "false". Also if values are null or empty String, or "N/A" DatabaseManager.Debug parameter will be removed.
Throws:
com.lutris.util.KeywordValueException

getDebug

public java.lang.String getDebug()
                          throws com.lutris.util.KeywordValueException
Gets value of Debug parameter in Config object of application.

Returns:
value of parameter represented as String. It could has values "true", "false" or "N/A" in case of parameter absence.
Throws:
com.lutris.util.KeywordValueException

setDefaultDatabase

public void setDefaultDatabase(java.lang.String dBname)
                        throws com.lutris.util.KeywordValueException
Sets value of DefaultDatabase parameter in Config object of application.

Parameters:
dBname - given value of parameter DefaultDatabase represented as String.
Throws:
com.lutris.util.KeywordValueException

getDefaultDatabase

public java.lang.String getDefaultDatabase()
                                    throws com.lutris.util.KeywordValueException
Gets value of DefaultDatabase parameter in Config object of application.

Returns:
value of parameter represented as String.
Throws:
com.lutris.util.KeywordValueException

saveState

public boolean saveState()
Save state of DatabaseManager configuration parameters into application configuration file.

Returns:
true = state is successfully saved, false = otherwise

EAF 7.6 Implementation