org.apache.avalon.excalibur.datasource.ids
Class AbstractDataSourceIdGenerator

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.avalon.excalibur.datasource.ids.AbstractIdGenerator
          extended byorg.apache.avalon.excalibur.datasource.ids.AbstractDataSourceIdGenerator
All Implemented Interfaces:
Component, Configurable, Disposable, IdGenerator, Initializable, LogEnabled, Serviceable, ThreadSafe
Direct Known Subclasses:
AbstractDataSourceBlockIdGenerator, SequenceIdGenerator

public abstract class AbstractDataSourceIdGenerator
extends AbstractIdGenerator
implements Serviceable, Configurable, Initializable, Disposable

Since:
4.1
Version:
CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:17 $
Author:
Avalon Development Team

Field Summary
protected  int m_allocated
          Number of allocated Ids remaining before another block must be allocated.
protected  DataSourceComponent m_dataSource
           
protected  long m_nextId
           
 
Fields inherited from interface org.apache.avalon.excalibur.datasource.ids.IdGenerator
ROLE
 
Constructor Summary
AbstractDataSourceIdGenerator()
           
 
Method Summary
 void configure(Configuration configuration)
          Called by the Container to configure the component.
 void dispose()
          Called by the Container to dispose the component.
protected  java.sql.Connection getConnection()
          Allocates a connection for the caller.
 void initialize()
          Called by the Container to initialize the component.
 void service(ServiceManager manager)
          Called by the Container to tell the component which ComponentLocator is controlling it.
 
Methods inherited from class org.apache.avalon.excalibur.datasource.ids.AbstractIdGenerator
getNextBigDecimalId, getNextBigDecimalIdInner, getNextByteId, getNextIntegerId, getNextLongId, getNextLongIdChecked, getNextLongIdInner, getNextShortId, isUsingBigDecimals, setUseBigDecimals
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_dataSource

protected DataSourceComponent m_dataSource

m_allocated

protected int m_allocated
Number of allocated Ids remaining before another block must be allocated.


m_nextId

protected long m_nextId
Constructor Detail

AbstractDataSourceIdGenerator

public AbstractDataSourceIdGenerator()
Method Detail

getConnection

protected java.sql.Connection getConnection()
                                     throws java.sql.SQLException
Allocates a connection for the caller. The connection must be closed by the caller when no longer needed.

Returns:
an open DB connection.
Throws:
java.sql.SQLException - if the connection can not be obtained for any reason.

service

public void service(ServiceManager manager)
             throws ServiceException
Called by the Container to tell the component which ComponentLocator is controlling it.

Specified by:
service in interface Serviceable
Parameters:
manager - which curently owns the component.
Throws:
ServiceException - if an error occurs

configure

public void configure(Configuration configuration)
               throws ConfigurationException
Called by the Container to configure the component.

Specified by:
configure in interface Configurable
Parameters:
configuration - configuration info used to setup the component.
Throws:
ConfigurationException - if there are any problems with the configuration.

initialize

public void initialize()
                throws java.lang.Exception
Called by the Container to initialize the component.

Specified by:
initialize in interface Initializable
Throws:
java.lang.Exception - if there were any problems durring initialization.

dispose

public void dispose()
Called by the Container to dispose the component.

Specified by:
dispose in interface Disposable


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.