KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > scalagent > kjoram > 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 (ScalAgent)
23  */

24 package com.scalagent.kjoram;
25
26 import com.scalagent.kjoram.excepts.IllegalStateException;
27 import com.scalagent.kjoram.excepts.JMSException;
28
29
30 public class TopicSession extends Session
31 {
32   /**
33    * Constructs a topic session.
34    *
35    * @param cnx The connection the session belongs to.
36    * @param transacted <code>true</code> for a transacted session.
37    * @param acknowledgeMode 1 (auto), 2 (client) or 3 (dups ok).
38    *
39    * @exception JMSException In case of an invalid acknowledge mode.
40    */

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

61   public TopicPublisher
62          createPublisher(Topic topic) throws JMSException
63   {
64     return new TopicPublisher(this, (Topic) topic);
65   }
66
67   /**
68    * API method.
69    *
70    * @exception IllegalStateException If the session is closed or if the
71    * connection is broken.
72    * @exception JMSException If the creation fails for any other reason.
73    */

74   public TopicSubscriber
75          createSubscriber(Topic topic, String JavaDoc selector,
76                           boolean noLocal) throws JMSException
77   {
78     if (closed)
79       throw new IllegalStateException JavaDoc("Forbidden call on a closed session.");
80
81     return new TopicSubscriber(this, (Topic) topic, null, selector, noLocal);
82   }
83
84   /**
85    * API method.
86    *
87    * @exception IllegalStateException If the session is closed or if the
88    * connection is broken.
89    * @exception JMSException If the creation fails for any other reason.
90    */

91   public TopicSubscriber
92          createSubscriber(Topic topic) throws JMSException
93   {
94     if (closed)
95       throw new IllegalStateException JavaDoc("Forbidden call on a closed session.");
96
97     return new TopicSubscriber(this, (Topic) topic, null, null, false);
98   }
99
100   /**
101    * API method.
102    *
103    * @exception IllegalStateException Systematically.
104    */

105   public QueueBrowser
106          createBrowser(Queue queue, String JavaDoc selector)
107          throws JMSException
108   {
109     throw new IllegalStateException JavaDoc("Forbidden call on a TopicSession.");
110   }
111
112   /**
113    * API method.
114    *
115    * @exception IllegalStateException Systematically.
116    */

117   public QueueBrowser createBrowser(Queue queue)
118          throws JMSException
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 Queue createQueue(String JavaDoc queueName) throws JMSException
129   {
130     throw new IllegalStateException JavaDoc("Forbidden call on a TopicSession.");
131   }
132
133   /**
134    * API method.
135    *
136    * @exception IllegalStateException Systematically.
137    */

138   public TemporaryQueue createTemporaryQueue() throws JMSException
139   {
140     throw new IllegalStateException JavaDoc("Forbidden call on a TopicSession.");
141   }
142
143 }
144
Popular Tags