org.apache.ojb.broker.util.sequence
Class AbstractSequenceManager

java.lang.Object
  extended by org.apache.ojb.broker.util.sequence.AbstractSequenceManager
All Implemented Interfaces:
SequenceManager
Direct Known Subclasses:
SequenceManagerHighLowImpl, SequenceManagerInMemoryImpl, SequenceManagerMSSQLGuidImpl, SequenceManagerNativeImpl, SequenceManagerNextValImpl, SequenceManagerStoredProcedureImpl, SequenceManagerTransientImpl

public abstract class AbstractSequenceManager
extends Object
implements SequenceManager

A base class for sequence manager implementations.
All sequence manager implementations need a constructor with a PersistenceBroker argument used by the SequenceManagerFactory.

Version:
$Id: AbstractSequenceManager.java,v 1.1 2007-08-24 22:17:29 ewestfal Exp $
Author:
Armin Waibel

Field Summary
private  PersistenceBroker brokerForClass
           
private  Properties configurationProperties
           
protected static String GLOBAL_SEQUENCE_NAME
           
private  Platform platform
           
static String PROPERTY_AUTO_NAMING
           
 
Constructor Summary
AbstractSequenceManager(PersistenceBroker broker)
          Constructor used by SequenceManagerFactory
 
Method Summary
 void afterStore(JdbcAccess dbAccess, ClassDescriptor cld, Object obj)
          noop
 String calculateSequenceName(FieldDescriptor field)
           
 PersistenceBroker getBrokerForClass()
           
 Properties getConfigurationProperties()
           
 String getConfigurationProperty(String key, String defaultValue)
           
 Platform getPlatform()
           
protected abstract  long getUniqueLong(FieldDescriptor field)
          returns a unique long value for field.
 Object getUniqueValue(FieldDescriptor field)
          Returns a unique object for the given field attribute.
 void setConfigurationProperties(Properties prop)
           
 void setConfigurationProperty(String key, String value)
           
 void setReferenceFKs(Object obj, ClassDescriptor cld)
          noop
 boolean useAutoNaming()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_AUTO_NAMING

public static final String PROPERTY_AUTO_NAMING
See Also:
Constant Field Values

GLOBAL_SEQUENCE_NAME

protected static final String GLOBAL_SEQUENCE_NAME
See Also:
Constant Field Values

brokerForClass

private PersistenceBroker brokerForClass

platform

private Platform platform

configurationProperties

private Properties configurationProperties
Constructor Detail

AbstractSequenceManager

public AbstractSequenceManager(PersistenceBroker broker)
Constructor used by SequenceManagerFactory

Parameters:
broker - PB instance to perform the id generation.
Method Detail

getUniqueLong

protected abstract long getUniqueLong(FieldDescriptor field)
                               throws SequenceManagerException
returns a unique long value for field. the returned number is unique accross all tables in the extent of clazz.

Throws:
SequenceManagerException

getPlatform

public Platform getPlatform()

getBrokerForClass

public PersistenceBroker getBrokerForClass()

getConfigurationProperties

public Properties getConfigurationProperties()

setConfigurationProperties

public void setConfigurationProperties(Properties prop)

getConfigurationProperty

public String getConfigurationProperty(String key,
                                       String defaultValue)

setConfigurationProperty

public void setConfigurationProperty(String key,
                                     String value)

useAutoNaming

public boolean useAutoNaming()

calculateSequenceName

public String calculateSequenceName(FieldDescriptor field)
                             throws SequenceManagerException
Throws:
SequenceManagerException

getUniqueValue

public Object getUniqueValue(FieldDescriptor field)
                      throws SequenceManagerException
Returns a unique object for the given field attribute. The returned value takes in account the jdbc-type and the FieldConversion.sql2java() conversion defined for field. The returned object is unique accross all tables in the extent of class the field belongs to.

Specified by:
getUniqueValue in interface SequenceManager
Throws:
SequenceManagerException

afterStore

public void afterStore(JdbcAccess dbAccess,
                       ClassDescriptor cld,
                       Object obj)
                throws SequenceManagerException
noop

Specified by:
afterStore in interface SequenceManager
Parameters:
dbAccess - Current used JdbcAccess instance
cld - Descriptor for specified object
obj - The object to associate with identity value
Throws:
SequenceManagerException

setReferenceFKs

public void setReferenceFKs(Object obj,
                            ClassDescriptor cld)
                     throws SequenceManagerException
noop

Throws:
SequenceManagerException


Copyright © 2007-2012 The Kuali Foundation. All Rights Reserved.