KickJava   Java API By Example, From Geeks To Geeks.

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


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.RequestChannel;
30
31 /**
32  * Implements the <code>javax.jms.XAQueueConnection</code> interface.
33  */

34 public class XAQueueConnection extends QueueConnection
35     implements javax.jms.XAQueueConnection JavaDoc {
36
37   /** Resource manager instance. */
38   private XAResourceMngr rm;
39
40   /**
41    * Creates an <code>XAQueueConnection</code> instance.
42    *
43    * @param factoryParameters The factory parameters.
44    * @param connectionImpl The actual connection to wrap.
45    *
46    * @exception JMSSecurityException If the user identification is incorrect.
47    * @exception IllegalStateException If the server is not listening.
48    */

49   public XAQueueConnection(FactoryParameters factoryParameters,
50                            RequestChannel requestChannel) throws JMSException JavaDoc
51   {
52     super(factoryParameters, requestChannel);
53     rm = new XAResourceMngr(this);
54   }
55   
56   /**
57    * API method.
58    *
59    * @exception IllegalStateException If the connection is closed.
60    * @exception JMSException In case of an invalid acknowledge mode.
61    */

62   public javax.jms.QueueSession JavaDoc
63          createQueueSession(boolean transacted, int acknowledgeMode)
64     throws JMSException JavaDoc {
65     return super.createQueueSession(transacted, acknowledgeMode);
66   }
67
68   /**
69    * API method.
70    *
71    * @exception IllegalStateException If the connection is closed.
72    */

73   public javax.jms.XAQueueSession JavaDoc createXAQueueSession() throws JMSException JavaDoc
74   {
75     checkClosed();
76     QueueSession s = new QueueSession(this, true, 0, getRequestMultiplexer());
77     XAQueueSession xas = new XAQueueSession(this, s, rm);
78     addSession(s);
79     return xas;
80   }
81
82   /**
83    * Method inherited from interface <code>XAConnection</code>.
84    *
85    * @exception IllegalStateException If the connection is closed.
86    * @exception JMSException In case of an invalid acknowledge mode.
87    */

88   public javax.jms.Session JavaDoc
89          createSession(boolean transacted, int acknowledgeMode)
90          throws JMSException JavaDoc
91   {
92     return super.createSession(transacted, acknowledgeMode);
93   }
94
95   /**
96    * Method inherited from interface <code>XAConnection</code>.
97    *
98    * @exception IllegalStateException If the connection is closed.
99    */

100   public javax.jms.XASession JavaDoc createXASession() throws JMSException JavaDoc
101   {
102     checkClosed();
103     Session s = new Session(this, true, 0, getRequestMultiplexer());
104     XASession xas = new XASession(this, s, rm);
105     addSession(s);
106     return xas;
107   }
108
109   /**
110    * return XAResourceMngr of this connection.
111    * see connector
112    */

113   public XAResourceMngr getXAResourceMngr() {
114     return rm;
115   }
116 }
117
Popular Tags