uk.ac.ebi.intact.persistence
Class AbstractSequenceManager

java.lang.Object
  |
  +--uk.ac.ebi.intact.persistence.AbstractSequenceManager
All Implemented Interfaces:
org.apache.ojb.broker.util.sequence.SequenceManager
Direct Known Subclasses:
OracleSequenceManager, PostgresSequenceManager

public abstract class AbstractSequenceManager
extends java.lang.Object
implements org.apache.ojb.broker.util.sequence.SequenceManager

Version:
$Id: AbstractSequenceManager.java,v 1.1 2004/01/31 11:43:01 skerrien Exp $
Author:
Samuel Kerrien (skerrien@ebi.ac.uk)

Field Summary
protected static java.lang.String _sitePrefix
          The prefix for all ID strings
protected static java.sql.PreparedStatement _stmt
          Prepared SQL statement to get a new id from a database sequence object.
protected  org.apache.ojb.broker.PersistenceBroker broker
          reference to the PersistenceBroker
static java.lang.String CONFIG_FILE
           
 
Constructor Summary
AbstractSequenceManager(org.apache.ojb.broker.PersistenceBroker broker)
          Public constructor
 
Method Summary
protected abstract  java.lang.String getNextSequence()
          Called by the vendor specific implementation to obtain the SQL statement which allows to get the next unique ID.
 int getUniqueId(java.lang.Class clazz, java.lang.String fieldName)
          returns a unique int for class clazz and field fieldName.
 long getUniqueLong(java.lang.Class clazz, java.lang.String fieldName)
          Returns a long id unique across all classes.
 java.lang.Object getUniqueObject(java.lang.Class clazz, java.lang.String fieldName)
          Returns an id unique across all classes.
 java.lang.String getUniqueString(java.lang.Class clazz, java.lang.String fieldName)
          Returns an id unique across all classes.
protected  void prepareSequenceStm(java.lang.Class clazz)
          Prepare a statement to retrieve the next unique ID from a database sequence object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_FILE

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

broker

protected org.apache.ojb.broker.PersistenceBroker broker
reference to the PersistenceBroker


_stmt

protected static java.sql.PreparedStatement _stmt
Prepared SQL statement to get a new id from a database sequence object.


_sitePrefix

protected static java.lang.String _sitePrefix
The prefix for all ID strings

Constructor Detail

AbstractSequenceManager

public AbstractSequenceManager(org.apache.ojb.broker.PersistenceBroker broker)
                        throws IntactException
Public constructor

Method Detail

getNextSequence

protected abstract java.lang.String getNextSequence()
Called by the vendor specific implementation to obtain the SQL statement which allows to get the next unique ID.

Returns:
the SQL statement which allows to get the next unique ID

prepareSequenceStm

protected final void prepareSequenceStm(java.lang.Class clazz)
Prepare a statement to retrieve the next unique ID from a database sequence object.


getUniqueId

public int getUniqueId(java.lang.Class clazz,
                       java.lang.String fieldName)
returns a unique int for class clazz and field fieldName. the returned uid is unique accross all tables in the extent of clazz.

Specified by:
getUniqueId in interface org.apache.ojb.broker.util.sequence.SequenceManager

getUniqueString

public java.lang.String getUniqueString(java.lang.Class clazz,
                                        java.lang.String fieldName)
Returns an id unique across all classes. The clazz attribute is only maintained to implement the interface.

Specified by:
getUniqueString in interface org.apache.ojb.broker.util.sequence.SequenceManager

getUniqueLong

public long getUniqueLong(java.lang.Class clazz,
                          java.lang.String fieldName)
Returns a long id unique across all classes. The clazz attribute is only maintained to implement the interface.

Specified by:
getUniqueLong in interface org.apache.ojb.broker.util.sequence.SequenceManager

getUniqueObject

public java.lang.Object getUniqueObject(java.lang.Class clazz,
                                        java.lang.String fieldName)
Returns an id unique across all classes. The clazz attribute is only maintained to implement the interface.

Specified by:
getUniqueObject in interface org.apache.ojb.broker.util.sequence.SequenceManager


IntAct Project - EMBL-EBI 2004 - intact-help@ebi.ac.uk