org.jboss.mq.pm.jdbc2
Class PersistenceManager

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.mq.pm.jdbc2.PersistenceManager
All Implemented Interfaces:
CacheStore (src) , MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , PersistenceManager (src) , Service (src) , ServiceMBean (src)

public class PersistenceManager
extends ServiceMBeanSupport (src)
implements PersistenceManager (src) , CacheStore (src)

This class manages all persistence related services for JDBC based persistence.


Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
PersistenceManager()
           
 
Method Summary
protected  void add(java.sql.Connection c, java.lang.String queue, SpyMessage (src)  message, Tx (src)  txId, java.lang.String mark)
           
 void add(MessageReference (src)  messageRef, Tx (src)  txId)
          Add a message to the persistent store.
 void addTXRecord(java.sql.Connection c, long txid)
           
 void closeQueue(JMSDestination (src)  jmsDest, SpyDestination (src)  dest)
          Close a queue
 void commitPersistentTx(Tx (src)  txId)
          Commit the transaction to the persistent store.
 Tx (src) createPersistentTx()
          Create and return a unique transaction id.
 ObjectName (src) getConnectionManager()
           
 int getConnectionRetryAttempts()
          Gets the ConnectionRetryAttempts.
 java.lang.Object getInstance()
          Describe getInstance method here.
 ObjectName (src) getMessageCache()
          Describe getMessageCache method here.
 MessageCache (src) getMessageCacheInstance()
          Get the message cache
 java.lang.String getSqlProperties()
          Gets the sqlProperties.
 TxManager (src) getTxManager()
          Get a transaction manager.
 void insertPersistentTx(org.jboss.mq.pm.jdbc2.PersistenceManager.TransactionManagerStrategy tms, java.sql.Connection c, Tx (src)  tx)
           
 SpyMessage (src) loadFromStorage(MessageReference (src)  messageRef)
          Reads the message refered to by the MessagReference back as a SpyMessage
 void markMessage(java.sql.Connection c, long messageid, java.lang.String destination, Tx (src)  txId, java.lang.String mark)
           
 void remove(MessageReference (src)  messageRef, Tx (src)  txId)
          Remove message from the persistent store.
 void removeFromStorage(MessageReference (src)  messageRef)
          Removes the message that was stored in secondary storage.
 void removeMarkedMessages(java.sql.Connection c, Tx (src)  txid, java.lang.String mark)
           
 void removeTXRecord(java.sql.Connection c, long txid)
           
 void resolveAllUncommitedTXs()
           
 void restoreQueue(JMSDestination (src)  jmsDest, SpyDestination (src)  dest)
          Restore a queue.
 void rollbackPersistentTx(Tx (src)  txId)
          Rollback the transaction.
 void saveToStorage(MessageReference (src)  messageRef, SpyMessage (src)  message)
          Stores the given message to secondary storeage.
 void setBlob(java.sql.PreparedStatement stmt, int column, SpyMessage (src)  message)
           
 void setConnectionManager(ObjectName (src)  connectionManagerName)
           
 void setConnectionRetryAttempts(int value)
          Sets the ConnectionRetryAttempts.
 void setMessageCache(ObjectName (src)  messageCache)
          Describe setMessageCache method here.
 void setSqlProperties(java.lang.String value)
          Sets the sqlProperties.
 void startService()
          Sub-classes should override this method to provide custum 'start' logic.
 void update(MessageReference (src)  messageRef, Tx (src)  txId)
          Update message in the persistent store.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
create, createService, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop, stopService
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistenceManager

public PersistenceManager()
                   throws JMSException (src) 
Method Detail

resolveAllUncommitedTXs

public void resolveAllUncommitedTXs()
                             throws JMSException (src) 
Throws:
JMSException (src)

restoreQueue

public void restoreQueue(JMSDestination (src)  jmsDest,
                         SpyDestination (src)  dest)
                  throws JMSException (src) 
Description copied from interface: PersistenceManager (src)
Restore a queue.

Specified by:
restoreQueue in interface PersistenceManager (src)
Parameters:
jmsDest - the jms destination
dest - the client destination
Throws:
JMSException (src) - for any error

commitPersistentTx

public void commitPersistentTx(Tx (src)  txId)
                        throws JMSException (src) 
Description copied from interface: PersistenceManager (src)
Commit the transaction to the persistent store.

Specified by:
commitPersistentTx in interface PersistenceManager (src)
Parameters:
txId - Description of Parameter
Throws:
JMSException (src) - for any error

removeMarkedMessages

public void removeMarkedMessages(java.sql.Connection c,
                                 Tx (src)  txid,
                                 java.lang.String mark)
                          throws java.sql.SQLException
Throws:
java.sql.SQLException

addTXRecord

public void addTXRecord(java.sql.Connection c,
                        long txid)
                 throws java.sql.SQLException
Throws:
java.sql.SQLException

removeTXRecord

public void removeTXRecord(java.sql.Connection c,
                           long txid)
                    throws java.sql.SQLException
Throws:
java.sql.SQLException

rollbackPersistentTx

public void rollbackPersistentTx(Tx (src)  txId)
                          throws JMSException (src) 
Description copied from interface: PersistenceManager (src)
Rollback the transaction.

Specified by:
rollbackPersistentTx in interface PersistenceManager (src)
Parameters:
txId - Description of Parameter
Throws:
JMSException (src) - for any error

createPersistentTx

public Tx (src)  createPersistentTx()
                      throws JMSException (src) 
Description copied from interface: PersistenceManager (src)
Create and return a unique transaction id.

Specified by:
createPersistentTx in interface PersistenceManager (src)
Returns:
the transaction
Throws:
JMSException (src) - for any error

insertPersistentTx

public void insertPersistentTx(org.jboss.mq.pm.jdbc2.PersistenceManager.TransactionManagerStrategy tms,
                               java.sql.Connection c,
                               Tx (src)  tx)
                        throws JMSException (src) 
Throws:
JMSException (src)

add

public void add(MessageReference (src)  messageRef,
                Tx (src)  txId)
         throws JMSException (src) 
Description copied from interface: PersistenceManager (src)
Add a message to the persistent store. If the message is part of a transaction, txId is not null.

Specified by:
add in interface PersistenceManager (src)
Parameters:
messageRef - the message
txId - the transaction
Throws:
JMSException (src) - for any error

add

protected void add(java.sql.Connection c,
                   java.lang.String queue,
                   SpyMessage (src)  message,
                   Tx (src)  txId,
                   java.lang.String mark)
            throws java.sql.SQLException,
                   java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

markMessage

public void markMessage(java.sql.Connection c,
                        long messageid,
                        java.lang.String destination,
                        Tx (src)  txId,
                        java.lang.String mark)
                 throws java.sql.SQLException
Throws:
java.sql.SQLException

setBlob

public void setBlob(java.sql.PreparedStatement stmt,
                    int column,
                    SpyMessage (src)  message)
             throws java.io.IOException,
                    java.sql.SQLException
Throws:
java.io.IOException
java.sql.SQLException

update

public void update(MessageReference (src)  messageRef,
                   Tx (src)  txId)
            throws JMSException (src) 
Description copied from interface: PersistenceManager (src)
Update message in the persistent store. If the message is part of a transaction, txId is not null (not currently supported).

Specified by:
update in interface PersistenceManager (src)
Parameters:
messageRef -
txId - Description of Parameter
Throws:
JMSException (src) - for any error

remove

public void remove(MessageReference (src)  messageRef,
                   Tx (src)  txId)
            throws JMSException (src) 
Description copied from interface: PersistenceManager (src)
Remove message from the persistent store. If the message is part of a transaction, txId is not null.

Specified by:
remove in interface PersistenceManager (src)
Parameters:
messageRef - the message
txId - the transaction
Throws:
JMSException (src) - for any error

getTxManager

public TxManager (src)  getTxManager()
Description copied from interface: PersistenceManager (src)
Get a transaction manager.

Specified by:
getTxManager in interface PersistenceManager (src)
Returns:
the transaction manager

closeQueue

public void closeQueue(JMSDestination (src)  jmsDest,
                       SpyDestination (src)  dest)
                throws JMSException (src) 
Description copied from interface: PersistenceManager (src)
Close a queue

Specified by:
closeQueue in interface PersistenceManager (src)
Parameters:
jmsDest - the jms destination
dest - the client destination
Throws:
JMSException (src) - for any error

loadFromStorage

public SpyMessage (src)  loadFromStorage(MessageReference (src)  messageRef)
                           throws JMSException (src) 
Description copied from interface: CacheStore (src)
Reads the message refered to by the MessagReference back as a SpyMessage

Specified by:
loadFromStorage in interface CacheStore (src)
Parameters:
messageRef - the message reference
Returns:
the message
Throws:
JMSException (src) - for any error

removeFromStorage

public void removeFromStorage(MessageReference (src)  messageRef)
                       throws JMSException (src) 
Description copied from interface: CacheStore (src)
Removes the message that was stored in secondary storage.

Specified by:
removeFromStorage in interface CacheStore (src)
Parameters:
messageRef - the message reference
Throws:
JMSException (src) - for any error

saveToStorage

public void saveToStorage(MessageReference (src)  messageRef,
                          SpyMessage (src)  message)
                   throws JMSException (src) 
Description copied from interface: CacheStore (src)
Stores the given message to secondary storeage. You should be able to use the MessagReference to load the message back later.

Specified by:
saveToStorage in interface CacheStore (src)
Parameters:
messageRef - the message reference
message - the message
Throws:
JMSException (src) - for any error

startService

public void startService()
                  throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'start' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
startService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

getInstance

public java.lang.Object getInstance()
Describe getInstance method here.

Returns:
an Object value

getMessageCache

public ObjectName (src)  getMessageCache()
Describe getMessageCache method here.

Returns:
an ObjectName value

setMessageCache

public void setMessageCache(ObjectName (src)  messageCache)
Describe setMessageCache method here.

Parameters:
messageCache - an ObjectName value

getConnectionManager

public ObjectName (src)  getConnectionManager()

setConnectionManager

public void setConnectionManager(ObjectName (src)  connectionManagerName)

getMessageCacheInstance

public MessageCache (src)  getMessageCacheInstance()
Description copied from interface: PersistenceManager (src)
Get the message cache

Specified by:
getMessageCacheInstance in interface PersistenceManager (src)
Returns:
the instance of the message cache

getSqlProperties

public java.lang.String getSqlProperties()
Gets the sqlProperties.

Returns:
Returns a Properties

setSqlProperties

public void setSqlProperties(java.lang.String value)
Sets the sqlProperties.


setConnectionRetryAttempts

public void setConnectionRetryAttempts(int value)
Sets the ConnectionRetryAttempts.


getConnectionRetryAttempts

public int getConnectionRetryAttempts()
Gets the ConnectionRetryAttempts.

Returns:
Returns a ConnectionRetryAttempt value