KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > scalagent > kjoram > TopicConnection


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.JMSException;
27 import com.scalagent.kjoram.excepts.IllegalStateException;
28
29 public class TopicConnection extends Connection
30 {
31   /**
32    * Creates a <code>TopicConnection</code> instance.
33    *
34    * @param factoryParameters The factory parameters.
35    * @param connectionImpl The actual connection to wrap.
36    *
37    * @exception JMSSecurityException If the user identification is incorrect.
38    * @exception IllegalStateException If the server is not listening.
39    */

40   public TopicConnection(FactoryParameters factoryParameters,
41                          ConnectionItf connectionImpl) throws JMSException
42   {
43     super(factoryParameters, connectionImpl);
44   }
45
46
47   /**
48    * API method.
49    *
50    * @exception IllegalStateException If the connection is closed.
51    * @exception InvalidSelectorException If the selector syntax is wrong.
52    * @exception InvalidDestinationException If the target destination does
53    * not exist.
54    * @exception JMSException If the method fails for any other reason.
55    */

56   public ConnectionConsumer
57          createConnectionConsumer(Topic topic, String JavaDoc selector,
58                                   ServerSessionPool sessionPool,
59                                   int maxMessages) throws JMSException
60   {
61     if (closed)
62       throw new IllegalStateException JavaDoc("Forbidden call on a closed"
63                                       + " connection.");
64
65     return new ConnectionConsumer(this, (Topic) topic, selector,
66                                   sessionPool, maxMessages);
67   }
68
69   /**
70    * API method.
71    *
72    * @exception IllegalStateException If the connection is closed.
73    * @exception InvalidSelectorException If the selector syntax is wrong.
74    * @exception InvalidDestinationException If the target topic does
75    * not exist.
76    * @exception JMSException If the method fails for any other reason.
77    */

78   public ConnectionConsumer
79          createDurableConnectionConsumer(Topic topic, String JavaDoc subName,
80                                          String JavaDoc selector,
81                                          ServerSessionPool sessPool,
82                                          int maxMessages) throws JMSException
83   {
84     if (closed)
85       throw new IllegalStateException JavaDoc("Forbidden call on a closed"
86                                       + " connection.");
87
88     return new ConnectionConsumer(this, (Topic) topic, subName, selector,
89                                   sessPool, maxMessages);
90   }
91
92   /**
93    * API method.
94    *
95    * @exception IllegalStateException If the connection is closed.
96    * @exception JMSException In case of an invalid acknowledge mode.
97    */

98   public TopicSession
99          createTopicSession(boolean transacted, int acknowledgeMode)
100          throws JMSException
101   {
102     if (closed)
103       throw new IllegalStateException JavaDoc("Forbidden call on a closed"
104                                       + " connection.");
105     
106     return new TopicSession(this, transacted, acknowledgeMode);
107   }
108 }
109
Popular Tags