Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/activemq/ActiveMQXAConnection.java


1   /**
2    * 
3    * Copyright 2004 Protique Ltd
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License"); 
6    * you may not use this file except in compliance with the License. 
7    * You may obtain a copy of the License at 
8    * 
9    * http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, 
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
14   * See the License for the specific language governing permissions and 
15   * limitations under the License. 
16   * 
17   **/
18  package org.activemq;
19  
20  import javax.jms.JMSException;
21  import javax.jms.Session;
22  import javax.jms.XAConnection;
23  import javax.jms.XAQueueConnection;
24  import javax.jms.XAQueueSession;
25  import javax.jms.XASession;
26  import javax.jms.XATopicConnection;
27  import javax.jms.XATopicSession;
28  
29  import org.activemq.transport.TransportChannel;
30  
31  /**
32   * The XAConnection interface extends the capability of Connection by providing
33   * an XASession (optional).
34   * <p/>
35   * The XAConnection interface is optional. JMS providers are not required to
36   * support this interface. This interface is for use by JMS providers to
37   * support transactional environments. Client programs are strongly encouraged
38   * to use the transactional support  available in their environment, rather
39   * than use these XA  interfaces directly.
40   *
41   * @version $Revision: 1.1.1.1 $
42   * @see javax.jms.Connection
43   * @see javax.jms.ConnectionFactory
44   * @see javax.jms.QueueConnection
45   * @see javax.jms.TopicConnection
46   * @see javax.jms.TopicConnectionFactory
47   * @see javax.jms.QueueConnection
48   * @see javax.jms.QueueConnectionFactory
49   */
50  public class ActiveMQXAConnection extends ActiveMQConnection implements XATopicConnection, XAQueueConnection, XAConnection {
51  
52    public ActiveMQXAConnection(ActiveMQConnectionFactory factory, String theUserName, String thePassword, TransportChannel transportChannel) throws JMSException {
53          super(factory, theUserName, thePassword, transportChannel);
54      }
55  
56      public ActiveMQXAConnection(ActiveMQConnectionFactory factory, String theUserName, String thePassword) throws JMSException {
57          super(factory, theUserName, thePassword);
58      }
59  
60      public XASession createXASession() throws JMSException {
61          return (XASession) createSession(true, Session.SESSION_TRANSACTED);
62      }
63  
64      public XATopicSession createXATopicSession() throws JMSException {
65          return (XATopicSession) createSession(true, Session.SESSION_TRANSACTED);
66      }
67  
68      public XAQueueSession createXAQueueSession() throws JMSException {
69          return (XAQueueSession) createSession(true, Session.SESSION_TRANSACTED);
70      }
71  
72      public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException {
73          checkClosed();
74          sendConnectionInfoToBroker();
75          return new ActiveMQXASession(this, Session.SESSION_TRANSACTED);
76      }
77  }