ojb.broker.util.sequence
Class SequenceManagerDefaultImpl

java.lang.Object
  |
  +--ojb.broker.util.sequence.SequenceManagerDefaultImpl
All Implemented Interfaces:
SequenceManager
Direct Known Subclasses:
SequenceManagerHighLowImpl

public class SequenceManagerDefaultImpl
extends java.lang.Object
implements SequenceManager

A simple SequenceManager. This class is responsible for creating new unique ID's for primary columns containing integer values. The SequenceManager is aware of extends, that is: if you ask for an uid for an Interface with several implementor classes, or a baseclass with several subclasses the returned uid will unique accross all tables representing objects of the extent in question.


Field Summary
protected  PersistenceBrokerImpl broker
          reference to the PersistenceBroker
 
Constructor Summary
SequenceManagerDefaultImpl(PersistenceBrokerImpl broker)
          Public constructor
 
Method Summary
protected  int getMaxForExtent(java.lang.Class clazz, java.lang.String fieldName)
          lookup all tables in extent clazz to find the current maximum value for fieldName
 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 unique long value for class clazz and field fieldName.
 java.lang.Object getUniqueObject(java.lang.Class clazz, java.lang.String fieldName)
          returns a unique Object for class clazz and field fieldName.
 java.lang.String getUniqueString(java.lang.Class clazz, java.lang.String fieldName)
          returns a unique String for class clazz and field fieldName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

broker

protected PersistenceBrokerImpl broker
reference to the PersistenceBroker

Constructor Detail

SequenceManagerDefaultImpl

public SequenceManagerDefaultImpl(PersistenceBrokerImpl broker)
Public constructor

Method Detail

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 SequenceManager

getMaxForExtent

protected int getMaxForExtent(java.lang.Class clazz,
                              java.lang.String fieldName)
                       throws PersistenceBrokerException
lookup all tables in extent clazz to find the current maximum value for fieldName

PersistenceBrokerException

getUniqueString

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

Specified by:
getUniqueString in interface SequenceManager

getUniqueLong

public long getUniqueLong(java.lang.Class clazz,
                          java.lang.String fieldName)
returns a unique long value for class clazz and field fieldName. the returned number is unique accross all tables in the extent of clazz.

Specified by:
getUniqueLong in interface SequenceManager

getUniqueObject

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

Specified by:
getUniqueObject in interface SequenceManager


Authors: Thomas Mahler and others. (C) 2000, 2001.
All rights reserved. Published under the Gnu Public License.
http://objectbridge.sourceforge.net
Version: 0.8.375, 2002-04-04