org.jboss.ejb.txtimer
Class GeneralPurposeDatabasePersistencePlugin

java.lang.Object
  extended byorg.jboss.ejb.txtimer.GeneralPurposeDatabasePersistencePlugin
All Implemented Interfaces:
DatabasePersistencePlugin (src)
Direct Known Subclasses:
OracleDatabasePersistencePlugin (src)

public class GeneralPurposeDatabasePersistencePlugin
extends java.lang.Object
implements DatabasePersistencePlugin (src)

This DatabasePersistencePlugin uses getBytes/setBytes to persist the serializable objects associated with the timer.

Since:
23-Sep-2004

Field Summary
protected  ObjectName (src) dataSourceName
           
protected  DataSource (src) ds
           
protected  ObjectName (src) metaDataName
           
protected  MBeanServer (src) server
           
 
Constructor Summary
GeneralPurposeDatabasePersistencePlugin()
           
 
Method Summary
 void clearTimers()
          Clear all persisted timers
 void createTableIfNotExists()
          Create the timer table if it does not exist already
 void deleteTimer(java.lang.String timerId, TimedObjectId (src)  timedObjectId)
          Delete a timer.
protected  java.lang.Object deserialize(byte[] bytes)
          Deserialize an object
protected  java.lang.Object deserialize(java.io.InputStream input)
          Deserialize an object
 java.lang.String getColumnInfo()
          Get the info column name
 java.lang.String getColumnInitialDate()
          Get the initial date column name
 java.lang.String getColumnInstancePK()
          Get the instance PK column name
 java.lang.String getColumnTargetID()
          Get the target ID column name
 java.lang.String getColumnTimerID()
          Get the timer ID column name
 java.lang.String getColumnTimerInterval()
          Get the timer interval column name
 java.lang.String getTableName()
          Get the timer table name
 void init(MBeanServer (src)  server, ObjectName (src)  dataSourceName)
          Initialize the plugin
 void insertTimer(java.lang.String timerId, TimedObjectId (src)  timedObjectId, java.util.Date initialExpiration, long intervalDuration, java.io.Serializable info)
          Insert a timer object
 java.util.List selectTimers()
          Select a list of currently persisted timer handles
protected  byte[] serialize(java.lang.Object obj)
          Serialize an object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataSourceName

protected ObjectName (src)  dataSourceName

server

protected MBeanServer (src)  server

ds

protected DataSource (src)  ds

metaDataName

protected ObjectName (src)  metaDataName
Constructor Detail

GeneralPurposeDatabasePersistencePlugin

public GeneralPurposeDatabasePersistencePlugin()
Method Detail

init

public void init(MBeanServer (src)  server,
                 ObjectName (src)  dataSourceName)
          throws java.sql.SQLException
Initialize the plugin

Specified by:
init in interface DatabasePersistencePlugin (src)
Throws:
java.sql.SQLException

createTableIfNotExists

public void createTableIfNotExists()
                            throws java.sql.SQLException
Create the timer table if it does not exist already

Specified by:
createTableIfNotExists in interface DatabasePersistencePlugin (src)
Throws:
java.sql.SQLException

insertTimer

public void insertTimer(java.lang.String timerId,
                        TimedObjectId (src)  timedObjectId,
                        java.util.Date initialExpiration,
                        long intervalDuration,
                        java.io.Serializable info)
                 throws java.sql.SQLException
Insert a timer object

Specified by:
insertTimer in interface DatabasePersistencePlugin (src)
Throws:
java.sql.SQLException

selectTimers

public java.util.List selectTimers()
                            throws java.sql.SQLException
Select a list of currently persisted timer handles

Specified by:
selectTimers in interface DatabasePersistencePlugin (src)
Returns:
List
Throws:
java.sql.SQLException

deleteTimer

public void deleteTimer(java.lang.String timerId,
                        TimedObjectId (src)  timedObjectId)
                 throws java.sql.SQLException
Delete a timer.

Specified by:
deleteTimer in interface DatabasePersistencePlugin (src)
Throws:
java.sql.SQLException

clearTimers

public void clearTimers()
                 throws java.sql.SQLException
Clear all persisted timers

Specified by:
clearTimers in interface DatabasePersistencePlugin (src)
Throws:
java.sql.SQLException

getTableName

public java.lang.String getTableName()
Get the timer table name

Specified by:
getTableName in interface DatabasePersistencePlugin (src)

getColumnTimerID

public java.lang.String getColumnTimerID()
Get the timer ID column name

Specified by:
getColumnTimerID in interface DatabasePersistencePlugin (src)

getColumnTargetID

public java.lang.String getColumnTargetID()
Get the target ID column name

Specified by:
getColumnTargetID in interface DatabasePersistencePlugin (src)

getColumnInitialDate

public java.lang.String getColumnInitialDate()
Get the initial date column name

Specified by:
getColumnInitialDate in interface DatabasePersistencePlugin (src)

getColumnTimerInterval

public java.lang.String getColumnTimerInterval()
Get the timer interval column name

Specified by:
getColumnTimerInterval in interface DatabasePersistencePlugin (src)

getColumnInstancePK

public java.lang.String getColumnInstancePK()
Get the instance PK column name

Specified by:
getColumnInstancePK in interface DatabasePersistencePlugin (src)

getColumnInfo

public java.lang.String getColumnInfo()
Get the info column name

Specified by:
getColumnInfo in interface DatabasePersistencePlugin (src)

serialize

protected byte[] serialize(java.lang.Object obj)
Serialize an object


deserialize

protected java.lang.Object deserialize(byte[] bytes)
Deserialize an object


deserialize

protected java.lang.Object deserialize(java.io.InputStream input)
Deserialize an object