KickJava   Java API By Example, From Geeks To Geeks.

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


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.InputStream JavaDoc;
27 import java.io.OutputStream JavaDoc;
28 import java.io.IOException JavaDoc;
29
30 import org.objectweb.joram.shared.stream.StreamUtil;
31
32 public final class ActivateConsumerRequest extends AbstractJmsRequest {
33   private boolean activate;
34
35   public boolean getActivate() {
36     return activate;
37   }
38
39   protected int getClassId() {
40     return ACTIVATE_CONSUMER_REQUEST;
41   }
42
43   public ActivateConsumerRequest(String JavaDoc targetName, boolean activate) {
44     super(targetName);
45     this.activate = activate;
46   }
47
48   /**
49    * Public no-arg constructor needed by Externalizable.
50    */

51   public ActivateConsumerRequest() {}
52
53   /* ***** ***** ***** ***** *****
54    * Streamable interface
55    * ***** ***** ***** ***** ***** */

56
57   /**
58    * The object implements the writeTo method to write its contents to
59    * the output stream.
60    *
61    * @param os the stream to write the object to
62    */

63   public void writeTo(OutputStream JavaDoc os) throws IOException JavaDoc {
64     super.writeTo(os);
65     StreamUtil.writeTo(activate, os);
66   }
67
68   /**
69    * The object implements the readFrom method to restore its contents from
70    * the input stream.
71    *
72    * @param is the stream to read data from in order to restore the object
73    */

74   public void readFrom(InputStream JavaDoc is) throws IOException JavaDoc {
75     super.readFrom(is);
76     activate = StreamUtil.readBooleanFrom(is);
77   }
78 }
79
Popular Tags