KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
27  * An <code>AbstractReply</code> is a reply sent by a destination agent to
28  * a client agent.
29  */

30 public abstract class AbstractReply extends AbstractNotification
31 {
32   /**
33    * The <code>correlationId</code> field is equal to the request's
34    * identifier.
35    */

36   private int correlationId = -1;
37
38
39   /**
40    * Constructs an <code>AbstractReply</code>.
41    *
42    * @param clientContext Client context identifier.
43    * @param correlationId Identifier of the reply.
44    */

45   public AbstractReply(int clientContext, int correlationId)
46   {
47     super(clientContext);
48     this.correlationId = correlationId;
49   }
50
51   /**
52    * Constructs an <code>AbstractReply</code>.
53    */

54   public AbstractReply()
55   {}
56
57
58   /** Returns the reply identifier. */
59   public int getCorrelationId()
60   {
61     return correlationId;
62   }
63
64   /**
65    * Appends a string image for this object to the StringBuffer parameter.
66    *
67    * @param output
68    * buffer to fill in
69    * @return
70     <code>output</code> buffer is returned
71    */

72   public StringBuffer JavaDoc toString(StringBuffer JavaDoc output) {
73     output.append('(');
74     super.toString(output);
75     output.append(", correlationId=").append(correlationId);
76     output.append(')');
77
78     return output;
79   }
80 }
81
Popular Tags