org.jboss.mq.pm.none
Class PersistenceManager

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.mq.pm.none.PersistenceManager
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, CacheStore, CacheStoreMBean, PersistenceManager, PersistenceManagerMBean, org.jboss.system.Service, org.jboss.system.ServiceMBean
Direct Known Subclasses:
NewPersistenceManager

public class PersistenceManager
extends org.jboss.system.ServiceMBeanSupport
implements PersistenceManagerMBean, PersistenceManager, CacheStore

A persistence manager and cache store that does not persistence. It can do persistence by delegating to a real persistence manager, depending upon destination configuration.

Version:
$Revision: 57198 $
Author:
Adrian Brock (adrian@jboss.org)

Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Fields inherited from interface org.jboss.mq.pm.PersistenceManagerMBean
OBJECT_NAME
 
Constructor Summary
PersistenceManager()
           
 
Method Summary
 void add(MessageReference message, Tx txId)
          Add a message to the persistent store.
 void closeQueue(JMSDestination jmsDest, SpyDestination dest)
          Close a queue
 void commitPersistentTx(Tx txId)
          Commit the transaction to the persistent store.
 Tx createPersistentTx()
          Create and return a unique transaction id.
 javax.management.ObjectName getDelegatePM()
          Retrieve the delegate persistence manager
 Object getInstance()
          Get the instance
 javax.management.ObjectName getMessageCache()
          Unsupported operation
 MessageCache getMessageCacheInstance()
          Get the message cache
 TxManager getTxManager()
          Get a transaction manager.
 SpyMessage loadFromStorage(MessageReference mh)
          Reads the message refered to by the MessagReference back as a SpyMessage
 void remove(MessageReference message, Tx txId)
          Remove message from the persistent store.
 void removeFromStorage(MessageReference mh)
          Removes the message that was stored in secondary storage.
 void restoreQueue(JMSDestination jmsDest, SpyDestination dest)
          Restore a queue.
 void rollbackPersistentTx(Tx txId)
          Rollback the transaction.
 void saveToStorage(MessageReference mh, SpyMessage message)
          Stores the given message to secondary storeage.
 void setDelegatePM(javax.management.ObjectName delegateName)
          Set the delegate persistence manager
 void setMessageCache(javax.management.ObjectName messageCache)
          Unsupported operation
protected  void startService()
           
 void update(MessageReference message, Tx txId)
          Update message in the persistent store.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getDeploymentInfo, 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
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Constructor Detail

PersistenceManager

public PersistenceManager()
Method Detail

getDelegatePM

public javax.management.ObjectName getDelegatePM()
Retrieve the delegate persistence manager

Returns:
the object name of the delegate persistence manager

setDelegatePM

public void setDelegatePM(javax.management.ObjectName delegateName)
Set the delegate persistence manager

Parameters:
delegatePM - the delegate persistence manager

add

public void add(MessageReference message,
                Tx txId)
         throws javax.jms.JMSException
Description copied from interface: PersistenceManager
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
Parameters:
message - the message
txId - the transaction
Throws:
javax.jms.JMSException - for any error

closeQueue

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

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

commitPersistentTx

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

Specified by:
commitPersistentTx in interface PersistenceManager
Parameters:
txId - Description of Parameter
Throws:
javax.jms.JMSException - for any error

createPersistentTx

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

Specified by:
createPersistentTx in interface PersistenceManager
Returns:
the transaction
Throws:
javax.jms.JMSException - for any error

getMessageCacheInstance

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

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

getTxManager

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

Specified by:
getTxManager in interface PersistenceManager
Returns:
the transaction manager

remove

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

Specified by:
remove in interface PersistenceManager
Parameters:
message - the message
txId - the transaction
Throws:
javax.jms.JMSException - for any error

restoreQueue

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

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

rollbackPersistentTx

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

Specified by:
rollbackPersistentTx in interface PersistenceManager
Parameters:
txId - Description of Parameter
Throws:
javax.jms.JMSException - for any error

update

public void update(MessageReference message,
                   Tx txId)
            throws javax.jms.JMSException
Description copied from interface: PersistenceManager
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
txId - Description of Parameter
Throws:
javax.jms.JMSException - for any error

getInstance

public Object getInstance()
Description copied from interface: CacheStoreMBean
Get the instance

Specified by:
getInstance in interface CacheStoreMBean
Specified by:
getInstance in interface PersistenceManagerMBean
Returns:
the cache store

getMessageCache

public javax.management.ObjectName getMessageCache()
Unsupported operation

Specified by:
getMessageCache in interface PersistenceManagerMBean
Returns:
the object name of the cache

setMessageCache

public void setMessageCache(javax.management.ObjectName messageCache)
Unsupported operation

Specified by:
setMessageCache in interface PersistenceManagerMBean
Parameters:
messageCache - the object name

loadFromStorage

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

Specified by:
loadFromStorage in interface CacheStore
Parameters:
mh - the message reference
Returns:
the message
Throws:
javax.jms.JMSException - for any error

removeFromStorage

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

Specified by:
removeFromStorage in interface CacheStore
Parameters:
mh - the message reference
Throws:
javax.jms.JMSException - for any error

saveToStorage

public void saveToStorage(MessageReference mh,
                          SpyMessage message)
                   throws javax.jms.JMSException
Description copied from interface: CacheStore
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
Parameters:
mh - the message reference
message - the message
Throws:
javax.jms.JMSException - for any error

startService

protected void startService()
                     throws Exception
Overrides:
startService in class org.jboss.system.ServiceMBeanSupport
Throws:
Exception


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.