org.apache.avalon.excalibur.datasource.ids
Class AbstractDataSourceBlockIdGenerator
java.lang.Object
|
+--org.apache.avalon.framework.logger.AbstractLogEnabled
|
+--org.apache.avalon.excalibur.datasource.ids.AbstractIdGenerator
|
+--org.apache.avalon.excalibur.datasource.ids.AbstractDataSourceIdGenerator
|
+--org.apache.avalon.excalibur.datasource.ids.AbstractDataSourceBlockIdGenerator
- All Implemented Interfaces:
- Component, Configurable, Disposable, IdGenerator, Initializable, LogEnabled, Serviceable, ThreadSafe
- Direct Known Subclasses:
- TableIdGenerator
- public abstract class AbstractDataSourceBlockIdGenerator
- extends AbstractDataSourceIdGenerator
The AbstractDataSourceBlockIdGenerator allocates blocks of ids from a DataSource
and then provides them as needed. This is useful in reducing communication with
the DataSource.
- Since:
- 4.1
- Version:
- CVS $Revision: 1.3 $ $Date: 2003/02/27 15:20:56 $
- Author:
- Leif Mortenson
Fields inherited from interface org.apache.avalon.excalibur.datasource.ids.IdGenerator |
ROLE |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractDataSourceBlockIdGenerator
public AbstractDataSourceBlockIdGenerator()
allocateBigDecimalIdBlock
protected abstract BigDecimal allocateBigDecimalIdBlock(int blockSize)
throws IdException
- Allocates a block, of the given size, of ids from the database.
- Parameters:
blockSize
- number of Ids which are to be allocated.
- Returns:
- The first id in the allocated block.
- Throws:
IdException
- if there it was not possible to allocate a block of ids.
allocateLongIdBlock
protected abstract long allocateLongIdBlock(int blockSize)
throws IdException
- Allocates a block, of the given size, of ids from the database.
- Parameters:
blockSize
- number of Ids which are to be allocated.
- Returns:
- The first id in the allocated block.
- Throws:
IdException
- if there it was not possible to allocate a block of ids.
getNextBigDecimalIdInner
protected BigDecimal getNextBigDecimalIdInner()
throws IdException
- Gets the next id as a Big Decimal. This method will only be called
when synchronized and when the data type is configured to be BigDecimal.
- Specified by:
getNextBigDecimalIdInner
in class AbstractIdGenerator
- Returns:
- the next id as a BigDecimal.
- Throws:
IdException
- if an Id could not be allocated for any reason.
getNextLongIdInner
protected long getNextLongIdInner()
throws IdException
- Gets the next id as a long. This method will only be called
when synchronized and when the data type is configured to be long.
- Specified by:
getNextLongIdInner
in class AbstractIdGenerator
- Returns:
- the next id as a long.
- Throws:
IdException
- if an Id could not be allocated for any reason.
configure
public void configure(Configuration configuration)
throws ConfigurationException
- Called by the Container to configure the component.
- Specified by:
configure
in interface Configurable
- Overrides:
configure
in class AbstractDataSourceIdGenerator
- Parameters:
configuration
- configuration info used to setup the component.
- Throws:
ConfigurationException
- if there are any problems with the configuration.
initialize
public void initialize()
throws Exception
- Called by the Container to initialize the component.
- Specified by:
initialize
in interface Initializable
- Overrides:
initialize
in class AbstractDataSourceIdGenerator
- Throws:
Exception
- if there were any problems durring initialization.
Copyright © 2000-2002 Apache Jakarta Project. All Rights Reserved.