DODS 7.6 API

com.lutris.appserver.server.sql.standard
Class StandardLogicalDatabase

java.lang.Object
  extended by com.lutris.appserver.server.sql.standard.StandardLogicalDatabase
All Implemented Interfaces:
LogicalDatabase, DriverSpecificConstants, CacheConstants
Direct Known Subclasses:
InformixLogicalDatabase, OracleLogicalDatabase

public class StandardLogicalDatabase
extends java.lang.Object
implements LogicalDatabase, CacheConstants, DriverSpecificConstants

Represents a logical database. Each logical database has a connection allocator and a object id allocator. The standard implementation of a local database is used when the database is described as of type Standard in DatabaseManager.DB.dbname.ClassType

The configuration data is specified in the section: DatabaseManager.DB.dbName

The following is a description of the sub fields:

Since:
LBS1.8
Version:
$Revision: 1.18 $
Author:
Paul Morgan, Kyle Clark

Field Summary
protected  ConnectionAllocator connectionAllocator
          Database connection allocator.
protected  java.lang.String dbName
          The symbolic name of this logical database.
protected  java.lang.String dbType
          The database vendor type.
protected  java.sql.Driver driver
          Driver object object.
protected  java.lang.String driverClassName
          DriverClassName
protected  ObjectIdAllocator objectIdAllocator
          Object id manager.
static java.lang.String PARAMNAME_DRIV_DEP_CLASS
           
protected  AbstractDBTransactionFactory transactionFactory
          Database Manager Transaction Factory.
 
Fields inherited from interface org.enhydra.dods.cache.CacheConstants
COMPLEX_QUERY_CACHE, DATA_CACHE, DATA_CACHING, DEFAULT_All_READONLY, DEFAULT_APP_NAME, DEFAULT_ASYNCH_LOAD_PRIORITY, DEFAULT_ASYNCH_LOAD_THREAD_NUM, DEFAULT_AUTO_SAVE, DEFAULT_AUTO_SAVE_CREATE_VIRGIN, DEFAULT_AUTO_WRITE, DEFAULT_CACHE_PERCENTAGE, DEFAULT_CACHE_PERSISTENCE_ON_DISABLE_CACHING, DEFAULT_CACHE_PERSISTENCE_ON_SHUTDOWN, DEFAULT_CASE_SENSITIVE, DEFAULT_DEADLOCK_READ_TIME, DEFAULT_DEADLOCK_RETRY_NUMBER, DEFAULT_DEFAULT_FETCH_SIZE, DEFAULT_DELETE_CHECK_VERSION, DEFAULT_DODS_CACHE_FACTORY, DEFAULT_FULL_CACHE_COUNT_LIMIT, DEFAULT_INCREMENT_VERSIONS, DEFAULT_INITIAL_ALL_CACHES, DEFAULT_INITIAL_CACHE_FETCH_SIZE, DEFAULT_INITIAL_CONDITION, DEFAULT_INITIAL_DS_CACHE_SIZE, DEFAULT_LAZY_LOADING, DEFAULT_MAX_CACHE_SIZE, DEFAULT_MAX_COMPLEX_QUERY_CACHE_SIZE, DEFAULT_MAX_EXECUTE_TIME, DEFAULT_MAX_EXECUTE_TIME_CACHE_INIT, DEFAULT_MAX_MULTI_JOIN_QUERY_CACHE_SIZE, DEFAULT_MAX_SIMPLE_QUERY_CACHE_SIZE, DEFAULT_QUERY_TIME_LIMIT_CACHE_INIT, DEFAULT_QUERY_TIMEOUT, DEFAULT_QUERY_TIMEOUT_CACHE_INIT, DEFAULT_READONLY, DEFAULT_RESERVE_FACTOR, DEFAULT_SELECT_OIDS, DEFAULT_SIMPLE_CACHE_ROW_COUNT_LIMIT, DEFAULT_SYNCH_LOAD_ROW_COUNT_LIMIT, DEFAULT_TRANSACTION_CACHES, DEFAULT_TRANSACTION_CHECK, FULL_CACHE_COUNT_LIMIT, MULTI_JOIN_QUERY_CACHE, PARAMNAME_ALL_READ_ONLY, PARAMNAME_APP_NAME, PARAMNAME_ASYNCH_LOAD_PRIORITY, PARAMNAME_ASYNCH_LOAD_THREAD_NUM, PARAMNAME_AUTO_SAVE, PARAMNAME_AUTO_SAVE_CREATE_VIRGIN, PARAMNAME_AUTO_WRITE, PARAMNAME_CACHE_PERCENTAGE, PARAMNAME_CACHE_PERSISTENCE_ON_DISABLE_CACHING, PARAMNAME_CACHE_PERSISTENCE_ON_SHUTDOWN, PARAMNAME_CACHE_PERSISTENCE_ROOT, PARAMNAME_CASE_SENSITIVE, PARAMNAME_DEADLOCK_READ_TIME, PARAMNAME_DEADLOCK_RETRY_NUMBER, PARAMNAME_DEFAULT_FETCH_SIZE, PARAMNAME_DELETE_CHECK_VERSION, PARAMNAME_DODS_CACHE_FACTORY, PARAMNAME_INCREMENT_VERSIONS, PARAMNAME_INITIAL_ALL_CACHES, PARAMNAME_INITIAL_CACHE_FETCH_SIZE, PARAMNAME_INITIAL_CONDITION, PARAMNAME_INITIAL_DS_CACHE_SIZE, PARAMNAME_LAZY_LOADING, PARAMNAME_MAX_CACHE_SIZE, PARAMNAME_MAX_COMPLEX_CACHE_SIZE, PARAMNAME_MAX_EXECUTE_TIME, PARAMNAME_MAX_EXECUTE_TIME_CACHE_INIT, PARAMNAME_MAX_MULTI_JOIN_CACHE_SIZE, PARAMNAME_MAX_SIMPLE_CACHE_SIZE, PARAMNAME_QUERY_TIME_LIMIT_CACHE_INIT, PARAMNAME_QUERY_TIMEOUT, PARAMNAME_QUERY_TIMEOUT_CACHE_INIT, PARAMNAME_READ_ONLY, PARAMNAME_RESERVE_FACTOR, PARAMNAME_SELECT_OIDS, PARAMNAME_SIMPLE_CACHE_ROW_COUNT_LIMIT, PARAMNAME_SYNCH_LOAD_ROW_COUNT_LIMIT, PARAMNAME_TRANSACTION_CACHES, PARAMNAME_TRANSACTION_CHECK, QUERY_CACHING, SIMPLE_QUERY_CACHE
 
Fields inherited from interface com.lutris.appserver.server.sql.standard.DriverSpecificConstants
DEFAULT_CUSTOM_NOT_EQUAL_SQL_OPERATOR, DEFAULT_DISABLE_FETCH_SIZE_WITH_MAX_ROWS, DEFAULT_PREPARE_STATEMENT_CACHE_LATENCY, DEFAULT_RESULT_SET_CONCURRENCY, DEFAULT_RESULT_SET_TYPE, DEFAULT_SET_BOOLEAN_AS_STRING, DEFAULT_SET_BYTES_AS_BINARY_STREAM, DEFAULT_SET_BYTES_AS_LONGVARBINARY, DEFAULT_SET_NULL_AS_VARCHAR, DEFAULT_USE_BINARY_STREAM_FOR_LONGVARCHAR, DEFAULT_USE_CURSOR_NAME, DEFAULT_USE_PREFIX_WITH_UPDATE, DEFAULT_USE_TOP_SYNTAX, PARAMNAME_CUSTOM_NOT_EQUAL_SQL_OPERATOR, PARAMNAME_DISABLE_FETCH_SIZE_WITH_MAX_ROWS, PARAMNAME_PREPARE_STATEMENT_CACHE_LATENCY, PARAMNAME_RESULT_SET_CONCURRENCY, PARAMNAME_RESULT_SET_TYPE, PARAMNAME_SET_BOOLEAN_AS_STRING, PARAMNAME_SET_BYTES_AS_BINARY_STREAM, PARAMNAME_SET_BYTES_AS_LONGVARBINARY, PARAMNAME_SET_NULL_AS_VARCHAR, PARAMNAME_USE_BINARY_STREAM_FOR_LONGVARCHAR, PARAMNAME_USE_CURSOR_NAME, PARAMNAME_USE_PREFIX_WITH_UPDATE, PARAMNAME_USE_TOP_SYNTAX, UNDEFINED_PREPARE_STATEMENT_CACHE_LATENCY
 
Constructor Summary
StandardLogicalDatabase()
          Default constructor to configure a single logical database.
StandardLogicalDatabase(java.lang.String dbName, Config dbConfig)
          Creates and configures a single logical database.
StandardLogicalDatabase(java.lang.String dbName, Config dbConfig, DatabaseManagerConfiguration DbManagerConf)
          Creates and configures a single logical database.
 
Method Summary
 DBConnection allocateConnection()
          Return the connection allocator object associated with this logical database.
 ObjectId allocateObjectId()
          Return an object id for this logical database.
 ObjectId allocateObjectId(java.lang.String tableName)
          Return an object id for this logical database.
 void checkOId(ObjectId oid)
          Check does oid belong to Object id's range [minOId, currentOId]
 void checkOId(ObjectId oid, java.lang.String tableName)
          Check does oid belong to Object id's range [minOId, currentOId]
 DBQuery createQuery()
          Return a query for use on this logical database.
 DBTransaction createTransaction()
          Return a transaction for use on this logical database.
 int getActiveConnectionCount()
          Return the number of currently active connections.
 DatabaseConfiguration getDatabaseConfiguration()
          Return conf parameters for current database
 boolean getDisableFetchSizeWithMaxRows()
          Return value of DisableFetchSizeWithMaxRows property
 java.lang.String getDriverClassName()
          Return a driver class of the logical database.
 DriverDependencies getDriverDependencies()
          Method getDriverDependencies
 java.lang.String getDriverProperty(java.lang.String paramName)
          Return a driver property from database vendor configutation file.
 int getMaxConnectionCount()
          Return the maximum number of connections active at one time.
 java.util.Date getMaxConnectionCountDate()
          Return the time when the maximum connection count occured.
 java.lang.String getName()
          Return the symbolic name of this logical database.
 long getRequestCount()
          Return the number of database requests.
 int getResultSetConcurrency()
          Return value of ResultSetType property
 int getResultSetType()
          Return value of ResultSetType property
 java.lang.String getType()
          Return a description of the logical database type.
 boolean getUseCursorName()
          Return value of UseCursorName property
 void init(java.lang.String dbName, Config dbConfig)
           
 void init(java.lang.String dbName, Config dbConfig, DatabaseManagerConfiguration DbManagerConf)
           
 ConnectionAllocator loadConnectionAllocator(Config connectionConfig)
          Return the connection allocator.
 ObjectIdAllocator loadObjectIdAllocator(Config objIdConfig)
          Return the object id allocator.
 void resetMaxConnectionCount()
          Reset the maximum connection count and date.
 void setUseCursorName(boolean use)
          Change value of UseCursorName property
 void setUseCursorName(java.lang.Boolean use)
          Change value of UseCursorName property
 void shutdown()
          Immediately shutdown the logical database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAMNAME_DRIV_DEP_CLASS

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

transactionFactory

protected AbstractDBTransactionFactory transactionFactory
Database Manager Transaction Factory.


connectionAllocator

protected ConnectionAllocator connectionAllocator
Database connection allocator.


objectIdAllocator

protected ObjectIdAllocator objectIdAllocator
Object id manager.


driver

protected java.sql.Driver driver
Driver object object. Important: a reference to this must be maintained or the driver class might be garbage collected out from under us.


driverClassName

protected java.lang.String driverClassName
DriverClassName


dbName

protected java.lang.String dbName
The symbolic name of this logical database.


dbType

protected java.lang.String dbType
The database vendor type.

Constructor Detail

StandardLogicalDatabase

public StandardLogicalDatabase()
Default constructor to configure a single logical database. Note that the init() method must be called to configure the database.


StandardLogicalDatabase

public StandardLogicalDatabase(java.lang.String dbName,
                               Config dbConfig)
                        throws ConfigException,
                               java.sql.SQLException
Creates and configures a single logical database.

Parameters:
dbName - The logical name of the database. Used to
dbConfig - The configuration object for this logical database. get config parameters.
Throws:
ConfigException - If there is an error in the configuration file.
java.sql.SQLException - If a SQL error occurs.

StandardLogicalDatabase

public StandardLogicalDatabase(java.lang.String dbName,
                               Config dbConfig,
                               DatabaseManagerConfiguration DbManagerConf)
                        throws ConfigException,
                               java.sql.SQLException
Creates and configures a single logical database.

Parameters:
dbName - The logical name of the database. Used to
dbConfig - The configuration object for this logical database. get config parameters.
DbManagerConf - The configuration object of DatabaseManager
Throws:
ConfigException - If there is an error in the configuration file.
java.sql.SQLException - If a SQL error occurs.
Method Detail

init

public void init(java.lang.String dbName,
                 Config dbConfig)
          throws ConfigException,
                 java.sql.SQLException
Specified by:
init in interface LogicalDatabase
Throws:
ConfigException
java.sql.SQLException

init

public void init(java.lang.String dbName,
                 Config dbConfig,
                 DatabaseManagerConfiguration DbManagerConf)
          throws ConfigException,
                 java.sql.SQLException
Throws:
ConfigException
java.sql.SQLException

checkOId

public void checkOId(ObjectId oid)
              throws ObjectIdException
Check does oid belong to Object id's range [minOId, currentOId]

Specified by:
checkOId in interface LogicalDatabase
Parameters:
oid - oid which will be checked.
Throws:
ObjectIdException - If a oid does't belong to range.

checkOId

public void checkOId(ObjectId oid,
                     java.lang.String tableName)
              throws ObjectIdException
Check does oid belong to Object id's range [minOId, currentOId]

Parameters:
oid - oid which will be checked.
tableName - Database table name
Throws:
ObjectIdException - If a oid does't belong to range.

loadConnectionAllocator

public ConnectionAllocator loadConnectionAllocator(Config connectionConfig)
                                            throws ConfigException
Return the connection allocator.

Parameters:
connectionConfig - The configuration object for the connection allocator.
Returns:
The connection allocator.
Throws:
ConfigException - If there is an error in the configuration file.

loadObjectIdAllocator

public ObjectIdAllocator loadObjectIdAllocator(Config objIdConfig)
                                        throws ConfigException
Return the object id allocator.

Parameters:
objIdConfig - The configuration object for the object id allocator.
Returns:
The object id allocator.
Throws:
ConfigException - If there is an error in the configuration file.

allocateConnection

public DBConnection allocateConnection()
                                throws java.sql.SQLException
Return the connection allocator object associated with this logical database.

Specified by:
allocateConnection in interface LogicalDatabase
Returns:
The connection allocator.
Throws:
java.sql.SQLException - if SQL error occurs allocating connection.

allocateObjectId

public ObjectId allocateObjectId()
                          throws ObjectIdException
Return an object id for this logical database.

Specified by:
allocateObjectId in interface LogicalDatabase
Returns:
The object id.
Throws:
ObjectIdException - if an error occurs allocating an object id.

allocateObjectId

public ObjectId allocateObjectId(java.lang.String tableName)
                          throws ObjectIdException
Return an object id for this logical database.

Parameters:
tableName - Database table name
Returns:
The object id.
Throws:
ObjectIdException - if an error occurs allocating an object id.

createTransaction

public DBTransaction createTransaction()
                                throws java.sql.SQLException
Return a transaction for use on this logical database.

Specified by:
createTransaction in interface LogicalDatabase
Returns:
The transaction object.
Throws:
java.sql.SQLException - if a SQL error occurs.

createQuery

public DBQuery createQuery()
                    throws java.sql.SQLException
Return a query for use on this logical database.

Specified by:
createQuery in interface LogicalDatabase
Returns:
The query object.
Throws:
java.sql.SQLException - if a SQL error occurs.

shutdown

public void shutdown()
Immediately shutdown the logical database. This is normally only called by the database manager on shutdown.

Specified by:
shutdown in interface LogicalDatabase

getName

public java.lang.String getName()
Return the symbolic name of this logical database.

Specified by:
getName in interface LogicalDatabase
Returns:
The symbolic name.

getType

public java.lang.String getType()
Return a description of the logical database type.

Specified by:
getType in interface LogicalDatabase
Returns:
The type.

getDriverClassName

public java.lang.String getDriverClassName()
Return a driver class of the logical database.

Returns:
Driver Class Name.

getDriverProperty

public java.lang.String getDriverProperty(java.lang.String paramName)
Return a driver property from database vendor configutation file.

Parameters:
paramName - Parameter Name
Returns:
Driver Class Name.

getActiveConnectionCount

public int getActiveConnectionCount()
Return the number of currently active connections.

Specified by:
getActiveConnectionCount in interface LogicalDatabase
Returns:
The number of connections.

getMaxConnectionCount

public int getMaxConnectionCount()
Return the maximum number of connections active at one time.

Specified by:
getMaxConnectionCount in interface LogicalDatabase
Returns:
The number of connections.

getMaxConnectionCountDate

public java.util.Date getMaxConnectionCountDate()
Return the time when the maximum connection count occured.

Specified by:
getMaxConnectionCountDate in interface LogicalDatabase
Returns:
The Date when the maximum connection count occured.

resetMaxConnectionCount

public void resetMaxConnectionCount()
Reset the maximum connection count and date.

Specified by:
resetMaxConnectionCount in interface LogicalDatabase

getRequestCount

public long getRequestCount()
Return the number of database requests.

Specified by:
getRequestCount in interface LogicalDatabase
Returns:
The number of database requests (queries or transactions).

getDatabaseConfiguration

public DatabaseConfiguration getDatabaseConfiguration()
Return conf parameters for current database

Returns:
values for DODS default values for current database

getDisableFetchSizeWithMaxRows

public boolean getDisableFetchSizeWithMaxRows()
Return value of DisableFetchSizeWithMaxRows property

Returns:
Value of DisableFetchSizeWithMaxRows property

getUseCursorName

public boolean getUseCursorName()
Return value of UseCursorName property

Returns:
Value of UseCursorName property

setUseCursorName

public void setUseCursorName(boolean use)
Change value of UseCursorName property

Parameters:
use -

setUseCursorName

public void setUseCursorName(java.lang.Boolean use)
Change value of UseCursorName property

Parameters:
use -

getResultSetType

public int getResultSetType()
Return value of ResultSetType property

Returns:
Value of ResultSetType property

getResultSetConcurrency

public int getResultSetConcurrency()
Return value of ResultSetType property

Returns:
Value of ResultSetType property

getDriverDependencies

public DriverDependencies getDriverDependencies()
Method getDriverDependencies

Returns:
a DriverDependencies

DODS 7.6 API