KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2004 - Bull SA
4  * Copyright (C) 2001 - ScalAgent Distributed Technologies
5  * Copyright (C) 1996 - Dyade
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  * USA.
21  *
22  * Initial developer(s): Frederic Maistre (INRIA)
23  * Contributor(s): Nicolas Tachker (Bull SA)
24  */

25 package org.objectweb.joram.client.jms;
26
27 import javax.jms.IllegalStateException JavaDoc;
28 import javax.jms.JMSException JavaDoc;
29
30 import org.objectweb.util.monolog.api.BasicLevel;
31
32 import org.objectweb.joram.client.jms.connection.RequestChannel;
33
34 /**
35  * Connection used within global transactions; an instance of this class
36  * acts as a resource manager.
37  */

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

53   public XAConnection(FactoryParameters factoryParameters,
54                       RequestChannel requestChannel)
55     throws JMSException JavaDoc {
56     super(factoryParameters, requestChannel);
57     rm = new XAResourceMngr(this);
58   }
59
60   /**
61    * Creates a non-XA session.
62    *
63    * @exception IllegalStateException If the connection is closed.
64    * @exception JMSException In case of an invalid acknowledge mode.
65    */

66   public javax.jms.Session JavaDoc
67          createSession(boolean transacted, int acknowledgeMode)
68          throws JMSException JavaDoc
69   {
70     return super.createSession(transacted, acknowledgeMode);
71   }
72
73   /**
74    * Creates a XA session.
75    *
76    * @exception IllegalStateException If the connection is closed.
77    */

78   public javax.jms.XASession JavaDoc createXASession() throws JMSException JavaDoc
79   {
80     checkClosed();
81     Session s = new Session(this, true, 0, getRequestMultiplexer());
82     XASession xas = new XASession(this, s, rm);
83     addSession(s);
84     return xas;
85   }
86
87   /**
88    * return XAResourceMngr of this connection.
89    * see connector
90    */

91   public XAResourceMngr getXAResourceMngr() {
92     return rm;
93   }
94 }
95
Popular Tags