KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > joram > client > jms > TopicSubscriber


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.client.jms;
25
26 import javax.jms.IllegalStateException JavaDoc;
27 import javax.jms.JMSException JavaDoc;
28
29
30 /**
31  * Implements the <code>javax.jms.TopicSubscriber</code> interface.
32  */

33 public class TopicSubscriber extends MessageConsumer
34                              implements javax.jms.TopicSubscriber JavaDoc
35 {
36   /**
37    * Constructs a subscriber.
38    *
39    * @param sess The session the subscriber belongs to.
40    * @param topic The topic the subscriber subscribes to.
41    * @param name The subscription name, for durable subs only.
42    * @param selector The selector for filtering messages.
43    * @param noLocal <code>true</code> if the subscriber does not wish to
44    * consume messages published through the same connection.
45    *
46    * @exception IllegalStateException If the connection is broken.
47    * @exception JMSException If the creation fails for any other reason.
48    */

49   TopicSubscriber(Session sess, Destination topic, String JavaDoc name, String JavaDoc selector,
50                   boolean noLocal) throws JMSException JavaDoc {
51     super(sess, topic, selector, name, noLocal);
52   }
53
54    /** Returns a string view of this receiver. */
55   public String JavaDoc toString()
56   {
57     return "TopicSub:" + targetName;
58   }
59
60
61   /**
62    * API method.
63    *
64    * @exception IllegalStateException If the subscriber is closed.
65    */

66   public boolean getNoLocal() throws JMSException JavaDoc
67   {
68     checkClosed();
69     return noLocal;
70   }
71
72   /**
73    * API method.
74    *
75    * @exception IllegalStateException If the subscriber is closed.
76    */

77   public javax.jms.Topic JavaDoc getTopic() throws JMSException JavaDoc
78   {
79     checkClosed();
80     return (javax.jms.Topic JavaDoc) dest;
81   }
82 }
83
Popular Tags