KickJava   Java API By Example, From Geeks To Geeks.

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


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  * A <code>DenyRequest</code> instance is used by a client agent
31  * for denying one or many messages on a queue.
32  */

33 public class DenyRequest 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>DenyRequest</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 DenyRequest(int clientContext, int requestId, Vector JavaDoc msgIds)
49   {
50     super(clientContext, requestId);
51     this.msgIds = msgIds;
52   }
53
54   /**
55    * Constructs an <code>DenyRequest</code> instance.
56    *
57    * @param clientContext Identifies a client context.
58    * @param requestId Request identifier.
59    * @param msgIds Message identifier.
60    */

61   public DenyRequest(int clientContext, int requestId, String JavaDoc msgId)
62   {
63     super(clientContext, requestId);
64     this.msgId = msgId;
65   }
66
67   /**
68    * Constructs an <code>DenyRequest</code> instance.
69    *
70    * @param clientContext Identifies a client context.
71    */

72   public DenyRequest(int clientContext)
73   {
74     super(clientContext, -1);
75   }
76
77
78   /** Returns the denied messages' identifiers. */
79   public Enumeration JavaDoc getIds()
80   {
81     if (msgIds == null) {
82       msgIds = new Vector JavaDoc();
83       if (msgId != null)
84         msgIds.add(msgId);
85     }
86     return msgIds.elements();
87   }
88
89   /**
90    * Appends a string image for this object to the StringBuffer parameter.
91    *
92    * @param output
93    * buffer to fill in
94    * @return
95     <code>output</code> buffer is returned
96    */

97   public StringBuffer JavaDoc toString(StringBuffer JavaDoc output) {
98     output.append('(');
99     super.toString(output);
100     output.append(",msgId=").append(msgId);
101     output.append(",msgIds=").append(msgIds);
102     output.append(')');
103
104     return output;
105   }
106 }
107
108
109
Popular Tags