DODS 5.1 API

com.lutris.appserver.server.sql
Interface LogicalDatabase

All Known Implementing Classes:
StandardLogicalDatabase

public interface LogicalDatabase

Interface for a logical database. Each logical database must provide services for connection and object id allocation.

Since:
LBS1.8
Version:
$Revision: 1.2 $
Author:
Paul Morgan

Method Summary
 DBConnection allocateConnection()
          Return a connection to this logical database.
 ObjectId allocateObjectId()
          Return an object id for this logical database.
 void checkOId(ObjectId oid)
          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.
 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.
 java.lang.String getType()
          Return a description of the logical database type.
 void init(java.lang.String dbName, com.lutris.util.Config dbConfig)
          Initialize the logical database.
 void resetMaxConnectionCount()
          Reset the maximum connection count and date.
 void shutdown()
          Immediately shutdown the logical database.
 

Method Detail

init

public void init(java.lang.String dbName,
                 com.lutris.util.Config dbConfig)
          throws com.lutris.util.ConfigException,
                 java.sql.SQLException
Initialize the logical database.

Throws:
com.lutris.util.ConfigException - if there is an error in the configuration.
java.sql.SQLException - if a SQL error occurs.

allocateConnection

public DBConnection allocateConnection()
                                throws java.sql.SQLException
Return a connection to this logical database.

Returns:
The connection.
Throws:
java.sql.SQLException - if a SQL error occurs.

allocateObjectId

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

Returns:
The object id.
Throws:
ObjectIdException - if an object id cannot be allocated.

checkOId

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

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

createTransaction

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

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.

Returns:
The query object.
Throws:
java.sql.SQLException - if a SQL error occurs.

shutdown

public void shutdown()
Immediately shutdown the logical database. All connections should be closed and any other cleanup performed.


getName

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

Returns:
The symbolic name.

getType

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

Returns:
The type.

getActiveConnectionCount

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

Returns:
The number of connections.

getMaxConnectionCount

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

Returns:
The number of connections.

getMaxConnectionCountDate

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

Returns:
The Date when the maximum connection count occured.

resetMaxConnectionCount

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


getRequestCount

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

Returns:
The number of database requests (queries or transactions).

DODS 5.1 API