KickJava   Java API By Example, From Geeks To Geeks.

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


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): Nicolas Tachker (Bull SA)
23  */

24 package org.objectweb.joram.client.jms;
25
26 import javax.jms.IllegalStateException JavaDoc;
27 import javax.jms.JMSException JavaDoc;
28
29 import org.objectweb.joram.client.jms.connection.RequestMultiplexer;
30
31 /**
32  * Implements the <code>javax.jms.TopicSession</code> interface.
33  */

34 public class TopicSession extends Session implements javax.jms.TopicSession JavaDoc
35 {
36   /**
37    * Constructs a topic session.
38    *
39    * @param cnx The connection the session belongs to.
40    * @param transacted <code>true</code> for a transacted session.
41    * @param acknowledgeMode 1 (auto), 2 (client) or 3 (dups ok).
42    *
43    * @exception JMSException In case of an invalid acknowledge mode.
44    */

45   TopicSession(Connection cnx,
46                boolean transacted,
47                int acknowledgeMode,
48                RequestMultiplexer mtpx)
49     throws JMSException JavaDoc {
50     super(cnx, transacted, acknowledgeMode, mtpx);
51   }
52
53
54   /** Returns a String image of this session. */
55   public String JavaDoc toString()
56   {
57     return "TopicSess:" + getId();
58   }
59
60   /**
61    * API method.
62    *
63    * @exception IllegalStateException If the session is closed or if the
64    * connection is broken.
65    * @exception JMSException If the creation fails for any other reason.
66    */

67   public javax.jms.TopicPublisher JavaDoc
68          createPublisher(javax.jms.Topic JavaDoc topic) throws JMSException JavaDoc
69   {
70     checkClosed();
71     TopicPublisher tp = new TopicPublisher(this, (Destination) topic);
72     addProducer(tp);
73     return tp;
74   }
75
76   /**
77    * API method.
78    *
79    * @exception IllegalStateException If the session is closed or if the
80    * connection is broken.
81    * @exception JMSException If the creation fails for any other reason.
82    */

83   public javax.jms.TopicSubscriber JavaDoc
84          createSubscriber(javax.jms.Topic JavaDoc topic, String JavaDoc selector,
85                           boolean noLocal) throws JMSException JavaDoc
86   {
87     checkClosed();
88     TopicSubscriber ts = new TopicSubscriber(
89       this, (Destination) topic, null, selector, noLocal);
90     addConsumer(ts);
91     return ts;
92   }
93
94   /**
95    * API method.
96    *
97    * @exception IllegalStateException If the session is closed or if the
98    * connection is broken.
99    * @exception JMSException If the creation fails for any other reason.
100    */

101   public javax.jms.TopicSubscriber JavaDoc
102          createSubscriber(javax.jms.Topic JavaDoc topic) throws JMSException JavaDoc
103   {
104     checkClosed();
105     TopicSubscriber ts = new TopicSubscriber(
106       this, (Destination) topic, null, null, false);
107     addConsumer(ts);
108     return ts;
109   }
110
111   /**
112    * API method.
113    *
114    * @exception IllegalStateException Systematically.
115    */

116   public javax.jms.QueueBrowser JavaDoc
117          createBrowser(javax.jms.Queue JavaDoc queue, String JavaDoc selector)
118          throws JMSException JavaDoc
119   {
120     throw new IllegalStateException JavaDoc("Forbidden call on a TopicSession.");
121   }
122
123   /**
124    * API method.
125    *
126    * @exception IllegalStateException Systematically.
127    */

128   public javax.jms.QueueBrowser JavaDoc createBrowser(javax.jms.Queue JavaDoc queue)
129          throws JMSException JavaDoc
130   {
131     throw new IllegalStateException JavaDoc("Forbidden call on a TopicSession.");
132   }
133
134   /**
135    * API method.
136    *
137    * @exception IllegalStateException Systematically.
138    */

139   public javax.jms.Queue JavaDoc createQueue(String JavaDoc queueName) throws JMSException JavaDoc
140   {
141     throw new IllegalStateException JavaDoc("Forbidden call on a TopicSession.");
142   }
143
144   /**
145    * API method.
146    *
147    * @exception IllegalStateException Systematically.
148    */

149   public javax.jms.TemporaryQueue JavaDoc createTemporaryQueue() throws JMSException JavaDoc
150   {
151     throw new IllegalStateException JavaDoc("Forbidden call on a TopicSession.");
152   }
153
154 }
155
Popular Tags