KickJava   Java API By Example, From Geeks To Geeks.

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


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>GetAdminTopicReply</code> is sent by an administrator proxy for
36  * notifying an administrator client of the identifier of the local admin
37  * topic.
38  */

39 public final class GetAdminTopicReply extends AbstractJmsReply {
40   /** Identifier of the admin topic. */
41   private String JavaDoc id;
42
43   /** Sets the identifier of the admin topic. */
44   public void setId(String JavaDoc id) {
45     this.id = id;
46   }
47
48   /** Returns the identifier of the admin topic. */
49   public String JavaDoc getId() {
50     return id;
51   }
52
53   /**
54    * Constructs a <code>GetAdminTopicReply</code> instance.
55    *
56    * @param request The <code>GetAdminTopicRequest</code> being answered.
57    * @param id The identifier of the admin topic.
58    */

59   public GetAdminTopicReply(GetAdminTopicRequest request, String JavaDoc id) {
60     super(request.getRequestId());
61     this.id = id;
62   }
63
64   protected int getClassId() {
65     return GET_ADMIN_TOPIC_REPLY;
66   }
67
68   /**
69    * Constructs a <code>GetAdminTopicReply</code> instance.
70    */

71   public GetAdminTopicReply() {}
72
73   public void toString(StringBuffer JavaDoc strbuf) {
74     super.toString(strbuf);
75     strbuf.append(",id=").append(id);
76     strbuf.append(')');
77   }
78
79   /* ***** ***** ***** ***** *****
80    * Streamable interface
81    * ***** ***** ***** ***** ***** */

82
83   /**
84    * The object implements the writeTo method to write its contents to
85    * the output stream.
86    *
87    * @param os the stream to write the object to
88    */

89   public void writeTo(OutputStream JavaDoc os) throws IOException JavaDoc {
90     super.writeTo(os);
91     StreamUtil.writeTo(id, os);
92   }
93
94   /**
95    * The object implements the readFrom method to restore its contents from
96    * the input stream.
97    *
98    * @param is the stream to read data from in order to restore the object
99    */

100   public void readFrom(InputStream JavaDoc is) throws IOException JavaDoc {
101     super.readFrom(is);
102     id = StreamUtil.readStringFrom(is);
103   }
104 }
105
Popular Tags