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:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Disposable, IdGenerator, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.thread.ThreadSafe
Direct Known Subclasses:
AbstractDataSourceBlockIdGenerator, SequenceIdGenerator

public abstract class AbstractDataSourceIdGenerator
extends AbstractIdGenerator
implements org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.activity.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(org.apache.avalon.framework.configuration.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(org.apache.avalon.framework.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(org.apache.avalon.framework.service.ServiceManager manager)
             throws org.apache.avalon.framework.service.ServiceException
Called by the Container to tell the component which ComponentLocator is controlling it.

Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Parameters:
manager - which curently owns the component.
Throws:
org.apache.avalon.framework.service.ServiceException

configure

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

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Parameters:
configuration - configuration info used to setup the component.
Throws:
org.apache.avalon.framework.configuration.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 org.apache.avalon.framework.activity.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 org.apache.avalon.framework.activity.Disposable


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.