KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > joram > shared > client > SessCreateTDReply


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2001 - 2006 ScalAgent Distributed Technologies
4  * Copyright (C) 1996 - 2000 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): ScalAgent Distributed Technologies
23  */

24 package org.objectweb.joram.shared.client;
25
26 import java.io.Externalizable JavaDoc;
27 import java.io.InputStream JavaDoc;
28 import java.io.OutputStream JavaDoc;
29 import java.io.IOException JavaDoc;
30
31 import org.objectweb.joram.shared.stream.Streamable;
32 import org.objectweb.joram.shared.stream.StreamUtil;
33
34 /**
35  * A <code>SessCreateTDReply</code> is used by a JMS proxy for replying
36  * to a <code>SessCreate&lt;TQ/TT&gt;Request</code>.
37  */

38 public final class SessCreateTDReply extends AbstractJmsReply {
39   /** The string identifier of the temporary destination agent. */
40   private String JavaDoc agentId;
41
42   /** Sets the destination identifier. */
43   public void setAgentId(String JavaDoc agentId) {
44     this.agentId = agentId;
45   }
46
47   /** Returns the temporary destination's agent identifier. */
48   public String JavaDoc getAgentId() {
49     return agentId;
50   }
51
52   protected int getClassId() {
53     return SESS_CREATE_TDREPLY;
54   }
55
56   /**
57    * Constructs a <code>SessCreateTDReply</code> instance.
58    *
59    * @param request The replied request.
60    * @param agentId String identifier of the destination agent.
61    */

62   public SessCreateTDReply(AbstractJmsRequest request, String JavaDoc agentId) {
63     super(request.getRequestId());
64     this.agentId = agentId;
65   }
66
67   /**
68    * Constructs a <code>SessCreateTDReply</code> instance.
69    */

70   public SessCreateTDReply() {}
71
72   /* ***** ***** ***** ***** *****
73    * Streamable interface
74    * ***** ***** ***** ***** ***** */

75
76   /**
77    * The object implements the writeTo method to write its contents to
78    * the output stream.
79    *
80    * @param os the stream to write the object to
81    */

82   public void writeTo(OutputStream JavaDoc os) throws IOException JavaDoc {
83     super.writeTo(os);
84     StreamUtil.writeTo(agentId, os);
85   }
86
87   /**
88    * The object implements the readFrom method to restore its contents from
89    * the input stream.
90    *
91    * @param is the stream to read data from in order to restore the object
92    */

93   public void readFrom(InputStream JavaDoc is) throws IOException JavaDoc {
94     super.readFrom(is);
95     agentId = StreamUtil.readStringFrom(is);
96   }
97 }
98
Popular Tags