001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.mq.pm;
023:
024: import javax.jms.JMSException;
025:
026: import org.jboss.mq.SpyDestination;
027: import org.jboss.mq.server.JMSDestination;
028: import org.jboss.mq.server.MessageCache;
029: import org.jboss.mq.server.MessageReference;
030:
031: /**
032: * This class allows provides the base for user supplied persistence packages.
033: *
034: * @author Hiram Chirino (Cojonudo14@hotmail.com)
035: * @author Paul Kendall (paul.kendall@orion.co.nz)
036: * @author <a href="mailto:adrian@jboss.org">Adrian Brock</a>
037: * @version $Revision: 57198 $
038: */
039: public interface PersistenceManager {
040: // Constants -----------------------------------------------------
041:
042: // Public --------------------------------------------------------
043:
044: /**
045: * Get the message cache
046: *
047: * @return the instance of the message cache
048: */
049: MessageCache getMessageCacheInstance();
050:
051: /**
052: * Create and return a unique transaction id.
053: *
054: * @return the transaction
055: * @throws JMSException for any error
056: */
057: Tx createPersistentTx() throws javax.jms.JMSException;
058:
059: /**
060: * Commit the transaction to the persistent store.
061: *
062: * @param txId Description of Parameter
063: * @throws JMSException for any error
064: */
065: void commitPersistentTx(Tx txId) throws javax.jms.JMSException;
066:
067: /**
068: * Rollback the transaction.
069: *
070: * @param txId Description of Parameter
071: * @throws JMSException for any error
072: */
073: void rollbackPersistentTx(Tx txId) throws javax.jms.JMSException;
074:
075: /**
076: * Get a transaction manager.
077: *
078: * @return the transaction manager
079: * @throws JMSException for any error
080: */
081: TxManager getTxManager();
082:
083: /**
084: * Add a message to the persistent store. If the message is part of a
085: * transaction, txId is not null.
086: *
087: * @param message the message
088: * @param txId the transaction
089: * @throws JMSException for any error
090: */
091: void add(MessageReference message, Tx txId) throws JMSException;
092:
093: /**
094: * Restore a queue.
095: *
096: * @param jmsDest the jms destination
097: * @param dest the client destination
098: * @throws JMSException for any error
099: */
100: void restoreQueue(JMSDestination jmsDest, SpyDestination dest)
101: throws JMSException;
102:
103: /**
104: * Update message in the persistent store. If the message is part of a
105: * transaction, txId is not null (not currently supported).
106: *
107: * @param message
108: * @param txId Description of Parameter
109: * @throws JMSException for any error
110: */
111: void update(MessageReference message, Tx txId) throws JMSException;
112:
113: /**
114: * Remove message from the persistent store. If the message is part of a
115: * transaction, txId is not null.
116: *
117: * @param message the message
118: * @param txId the transaction
119: * @throws JMSException for any error
120: */
121: void remove(MessageReference message, Tx txId) throws JMSException;
122:
123: /**
124: * Close a queue
125: *
126: * @param jmsDest the jms destination
127: * @param dest the client destination
128: * @throws JMSException for any error
129: */
130: void closeQueue(JMSDestination jmsDest, SpyDestination dest)
131: throws JMSException;
132: }
|