KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > joram > client > jms > MessageAcks


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2001 - ScalAgent Distributed Technologies
4  * Copyright (C) 1996 - Dyade
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA.
20  *
21  * Initial developer(s): Frederic Maistre (INRIA)
22  * Contributor(s):
23  */

24 package org.objectweb.joram.client.jms;
25
26 import java.util.Vector JavaDoc;
27
28 /**
29  * A <code>MessageAcks</code> instance holds the identifiers of messages to
30  * acknowledge on a queue or on a proxy subscription.
31  */

32 class MessageAcks
33 {
34   /** The vector of messages identifiers. */
35   private Vector JavaDoc ids;
36   /** <code>true</code> if the messages to acknowledge are on a queue. */
37   private boolean queueMode;
38
39   /**
40    * Constructs a <code>MessageAcks</code> instance.
41    *
42    * @param queueMode <code>true</code> for queue messages.
43    */

44   MessageAcks(boolean queueMode)
45   {
46     this.queueMode = queueMode;
47     ids = new Vector JavaDoc();
48   }
49
50   /** Adds a message identifier. */
51   void addId(String JavaDoc id)
52   {
53     ids.add(id);
54   }
55
56   /** Adds a vector of message identifiers. */
57   void addIds(Vector JavaDoc ids)
58   {
59     this.ids.addAll(ids);
60   }
61
62   /** Returns the vector of message identifiers. */
63   Vector JavaDoc getIds()
64   {
65     return ids;
66   }
67
68   /**
69    * Returns <code>true</code> if the messages to acknowledge are on a queue.
70    */

71   boolean getQueueMode()
72   {
73     return queueMode;
74   }
75
76   public String JavaDoc toString() {
77     return '(' + super.toString() +
78       ",ids=" + ids +
79       ",queueMode=" + queueMode + ')';
80   }
81 }
82
Popular Tags