KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

57   public ConnectionConsumer
58          createConnectionConsumer(Queue queue, String JavaDoc selector,
59                                   ServerSessionPool sessionPool,
60                                   int maxMessages) throws JMSException
61   {
62     if (closed)
63       throw new IllegalStateException JavaDoc("Forbidden call on a closed"
64                                       + " connection.");
65
66     return new ConnectionConsumer(this, (Queue) queue, selector,
67                                   sessionPool, maxMessages);
68   }
69
70   /**
71    * API method.
72    *
73    * @exception IllegalStateException If the connection is closed.
74    * @exception JMSException In case of an invalid acknowledge mode.
75    */

76   public QueueSession
77          createQueueSession(boolean transacted, int acknowledgeMode)
78          throws JMSException
79   {
80     if (closed)
81       throw new IllegalStateException JavaDoc("Forbidden call on a closed"
82                                       + " connection.");
83
84     return new QueueSession(this, transacted, acknowledgeMode);
85   }
86
87   /**
88    * API method.
89    *
90    * @exception IllegalStateException Systematically.
91    */

92   public ConnectionConsumer
93          createDurableConnectionConsumer(Topic topic, String JavaDoc name,
94                                          String JavaDoc selector,
95                                          ServerSessionPool sessPool,
96                                          int maxMessages) throws JMSException
97   {
98     throw new IllegalStateException JavaDoc("Forbidden call on a QueueConnection.");
99   }
100 }
101
Popular Tags