KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > joram > mom > notifications > AcknowledgeRequest


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.mom.notifications;
25
26 import java.util.Enumeration JavaDoc;
27 import java.util.Vector JavaDoc;
28
29 /**
30  * An <code>AcknowledgeRequest</code> instance is used by a client agent
31  * for acknowledging one or many messages on a queue.
32  */

33 public class AcknowledgeRequest extends AbstractRequest
34 {
35   /** Message identifier. */
36   private String JavaDoc msgId = null;
37   /** Vector of message identifiers. */
38   private Vector JavaDoc msgIds = null;
39
40    
41   /**
42    * Constructs an <code>AcknowledgeRequest</code> instance.
43    *
44    * @param clientContext Identifies a client context.
45    * @param requestId Request identifier.
46    * @param msgIds Vector of message identifiers.
47    */

48   public AcknowledgeRequest(int clientContext, int requestId, Vector JavaDoc msgIds)
49   {
50     super(clientContext, requestId);
51     this.msgIds = msgIds;
52   }
53
54   /**
55    * Constructs an <code>AcknowledgeRequest</code> instance.
56    *
57    * @param clientContext Identifies a client context.
58    * @param requestId Request identifier.
59    * @param msgId Message identifier.
60    */

61   public AcknowledgeRequest(int clientContext, int requestId, String JavaDoc msgId)
62   {
63     super(clientContext, requestId);
64     this.msgId = msgId;
65   }
66
67
68   /** Returns the acknowledged messages' identifiers. */
69   public Enumeration JavaDoc getIds()
70   {
71     if (msgIds == null) {
72       msgIds = new Vector JavaDoc();
73       if (msgId != null)
74         msgIds.add(msgId);
75     }
76     return msgIds.elements();
77   }
78 }
79
Popular Tags