org.apache.sandesha2.storage.jdbc
Class PersistentStorageManager

java.lang.Object
  extended by org.apache.sandesha2.storage.StorageManager
      extended by org.apache.sandesha2.storage.jdbc.PersistentStorageManager

public class PersistentStorageManager
extends StorageManager

A Storage Manager implementation for managing Sandesha2 beans.

Needs this parameter in module.xml or axis2.xml :

db.driver JDBC Driver class name db.connectionstring JDBC connection string db.user Data Base user name db.password Data Base user password

Transactions are supposed to be attached to a thread (see inMemoryStorageManager) hence the ThreadLocal threadTransaction variable (instead of the transactions HashMap used by inMemoryStorageManager).

MessageContexts are stored in a HashMap, as in inMemoryStorageManager, AND in DataBase as backup in case of failure.


Constructor Summary
PersistentStorageManager(org.apache.axis2.context.ConfigurationContext context)
           
 
Method Summary
 void acquireTransactionLock()
           
 java.sql.Connection dbConnect()
           
 java.sql.Connection getDbConnection()
          Returns the connection attached to the current transaction if exists or the "common" connection.
 SandeshaThread getInvoker()
          Get the invoker that hands inbound messages over to the application.
 InvokerBeanMgr getInvokerBeanMgr()
           
 PollingManager getPollingManager()
          Get the thread that generates polling requests to send to remote endpoints.
 RMDBeanMgr getRMDBeanMgr()
           
 RMSBeanMgr getRMSBeanMgr()
           
 SandeshaThread getSender()
           
 SenderBeanMgr getSenderBeanMgr()
           
 Transaction getTransaction()
           
 boolean hasUserTransaction(org.apache.axis2.context.MessageContext msg)
          If there is no user transaction in scope then we can optimize the sending / invoking of a message.
 void initStorage(org.apache.axis2.description.AxisModule moduleDesc)
           
 void releaseTransactionLock()
           
 void removeMessageContext(java.lang.String key)
           
 void removeTransaction()
           
 boolean requiresMessageSerialization()
           
 org.apache.axis2.context.MessageContext retrieveMessageContext(java.lang.String key, org.apache.axis2.context.ConfigurationContext configContext)
           
 void shutdown()
           
 void storeMessageContext(java.lang.String key, org.apache.axis2.context.MessageContext msgContext)
           
 void updateMessageContext(java.lang.String key, org.apache.axis2.context.MessageContext msgContext)
           
 
Methods inherited from class org.apache.sandesha2.storage.StorageManager
getContext, setContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentStorageManager

public PersistentStorageManager(org.apache.axis2.context.ConfigurationContext context)
                         throws SandeshaException
Throws:
SandeshaException
Method Detail

getInvoker

public SandeshaThread getInvoker()
Description copied from class: StorageManager
Get the invoker that hands inbound messages over to the application. This may be null, in which case the inbound messages will be dispatched directly to the application without switching them over to the invoker.

Specified by:
getInvoker in class StorageManager
Returns:
null if messages should be delivered directly to the application, otherwise return a SandeshaThread.

getPollingManager

public PollingManager getPollingManager()
Description copied from class: StorageManager
Get the thread that generates polling requests to send to remote endpoints. This may be null, in which case the storage manager does not support polling.

Specified by:
getPollingManager in class StorageManager
Returns:
null if polling is diabled, otherwise return a PollingManager.

getSender

public SandeshaThread getSender()
Specified by:
getSender in class StorageManager

shutdown

public void shutdown()
Overrides:
shutdown in class StorageManager

getInvokerBeanMgr

public InvokerBeanMgr getInvokerBeanMgr()
Specified by:
getInvokerBeanMgr in class StorageManager

getRMDBeanMgr

public RMDBeanMgr getRMDBeanMgr()
Specified by:
getRMDBeanMgr in class StorageManager

getRMSBeanMgr

public RMSBeanMgr getRMSBeanMgr()
Specified by:
getRMSBeanMgr in class StorageManager

getSenderBeanMgr

public SenderBeanMgr getSenderBeanMgr()
Specified by:
getSenderBeanMgr in class StorageManager

requiresMessageSerialization

public boolean requiresMessageSerialization()
Specified by:
requiresMessageSerialization in class StorageManager

hasUserTransaction

public boolean hasUserTransaction(org.apache.axis2.context.MessageContext msg)
Description copied from class: StorageManager
If there is no user transaction in scope then we can optimize the sending / invoking of a message. This method allows the StorageManager to tell the core Sandesha code if there is a transaction in scope.

Specified by:
hasUserTransaction in class StorageManager
Returns:
true, if there is a user transaction in scope.

getTransaction

public Transaction getTransaction()
Specified by:
getTransaction in class StorageManager

removeTransaction

public void removeTransaction()

getDbConnection

public java.sql.Connection getDbConnection()
Returns the connection attached to the current transaction if exists or the "common" connection.

Returns:
Data Base Connection

initStorage

public void initStorage(org.apache.axis2.description.AxisModule moduleDesc)
                 throws SandeshaStorageException
Specified by:
initStorage in class StorageManager
Throws:
SandeshaStorageException

dbConnect

public java.sql.Connection dbConnect()
                              throws SandeshaStorageException
Throws:
SandeshaStorageException

retrieveMessageContext

public org.apache.axis2.context.MessageContext retrieveMessageContext(java.lang.String key,
                                                                      org.apache.axis2.context.ConfigurationContext configContext)
                                                               throws SandeshaStorageException
Specified by:
retrieveMessageContext in class StorageManager
Throws:
SandeshaStorageException

storeMessageContext

public void storeMessageContext(java.lang.String key,
                                org.apache.axis2.context.MessageContext msgContext)
                         throws SandeshaStorageException
Specified by:
storeMessageContext in class StorageManager
Throws:
SandeshaStorageException

updateMessageContext

public void updateMessageContext(java.lang.String key,
                                 org.apache.axis2.context.MessageContext msgContext)
                          throws SandeshaStorageException
Specified by:
updateMessageContext in class StorageManager
Throws:
SandeshaStorageException

removeMessageContext

public void removeMessageContext(java.lang.String key)
                          throws SandeshaStorageException
Specified by:
removeMessageContext in class StorageManager
Throws:
SandeshaStorageException

acquireTransactionLock

public void acquireTransactionLock()

releaseTransactionLock

public void releaseTransactionLock()


Copyright © The Apache Software Foundation. All Rights Reserved.