KickJava   Java API By Example, From Geeks To Geeks.

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


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>QBrowseRequest</code> instance is sent by a
36  * <code>QueueBrowser</code> when requesting an enumeration.
37  */

38 public final class QBrowseRequest extends AbstractJmsRequest {
39   /** The selector for filtering messages. */
40   private String JavaDoc selector;
41
42   /** Sets the selector. */
43   public void setSelector(String JavaDoc selector) {
44     this.selector = selector;
45   }
46
47   /** Returns the selector for filtering the messages. */
48   public String JavaDoc getSelector() {
49     return selector;
50   }
51
52   protected int getClassId() {
53     return QBROWSE_REQUEST;
54   }
55
56   /**
57    * Constructs a <code>QBrowseRequest</code> instance.
58    *
59    * @param to Name of the queue to browse.
60    * @param selector The selector for filtering messages, if any.
61    */

62   public QBrowseRequest(String JavaDoc to, String JavaDoc selector) {
63     super(to);
64     this.selector = selector;
65   }
66
67   /**
68    * Constructs a <code>QBrowseRequest</code> instance.
69    */

70   public QBrowseRequest() {}
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(selector, 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     selector = StreamUtil.readStringFrom(is);
96   }
97 }
98
Popular Tags