DODS 7.1 API

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

java.lang.Object
  extended by com.lutris.appserver.server.sql.standard.StandardObjectIdAllocator
All Implemented Interfaces:
ObjectIdAllocator
Direct Known Subclasses:
GeronimoJTAObjectIdAllocator, InformixObjectIdAllocator, JTAObjectIdAllocator, OracleObjectIdAllocator

public class StandardObjectIdAllocator
extends java.lang.Object
implements ObjectIdAllocator

Object ids can only be created via this manager. Ensures that all object ids are unique across all objects in this logical database. Also ensures good performance for allocating object ids.

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

Configuration fields are:

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

Field Summary
protected  com.lutris.appserver.server.sql.LogicalDatabase logicalDatabase
          Reference to the logical database for easy access to the connection pool.
protected  java.lang.String primaryLogicalDatabaseName
          Name of primary logical database for access to the objectId table.
 
Constructor Summary
StandardObjectIdAllocator(com.lutris.appserver.server.sql.LogicalDatabase lDb, com.lutris.util.Config objIdConfig)
          Initialize the object id manager.
 
Method Summary
 com.lutris.appserver.server.sql.ObjectId allocate()
          Allocates a new object id.
 com.lutris.appserver.server.sql.ObjectId allocate(java.lang.String tableName)
          Allocate a new and unique object id for given database table.
protected  com.lutris.appserver.server.sql.DBConnection allocateConnection()
           
 void checkOId(com.lutris.appserver.server.sql.ObjectId oid)
          Check if oid belongs to Object id's range [minOId, currentOId]
 void checkOId(com.lutris.appserver.server.sql.ObjectId oid, java.lang.String tableName)
          Check does oid belong to Object id's range [minOId, currentOId]
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logicalDatabase

protected com.lutris.appserver.server.sql.LogicalDatabase logicalDatabase
Reference to the logical database for easy access to the connection pool.


primaryLogicalDatabaseName

protected java.lang.String primaryLogicalDatabaseName
Name of primary logical database for access to the objectId table.

Constructor Detail

StandardObjectIdAllocator

public StandardObjectIdAllocator(com.lutris.appserver.server.sql.LogicalDatabase lDb,
                                 com.lutris.util.Config objIdConfig)
                          throws com.lutris.util.ConfigException
Initialize the object id manager.

Parameters:
lDb - LogicalDatabase.
objIdConfig - LogicalDatabase Config object.
Throws:
com.lutris.util.ConfigException - if bad configuration information is given in the config file.
Method Detail

checkOId

public void checkOId(com.lutris.appserver.server.sql.ObjectId oid)
              throws com.lutris.appserver.server.sql.ObjectIdException
Check if oid belongs to Object id's range [minOId, currentOId]

Specified by:
checkOId in interface ObjectIdAllocator
Parameters:
oid - oid which will be checked.
Throws:
com.lutris.appserver.server.sql.ObjectIdException - If a oid does't belong to range.

checkOId

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

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

allocate

public com.lutris.appserver.server.sql.ObjectId allocate()
Allocates a new object id.

Specified by:
allocate in interface ObjectIdAllocator

allocate

public com.lutris.appserver.server.sql.ObjectId allocate(java.lang.String tableName)
Allocate a new and unique object id for given database table.

Parameters:
tableName - Database table name.
Returns:
new ObjectId

allocateConnection

protected com.lutris.appserver.server.sql.DBConnection allocateConnection()
                                                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

DODS 7.1 API