001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.activemq;
018
019import java.net.URI;
020
021import javax.jms.JMSException;
022import javax.jms.XAConnection;
023import javax.jms.XAConnectionFactory;
024import javax.jms.XAQueueConnection;
025import javax.jms.XAQueueConnectionFactory;
026import javax.jms.XATopicConnection;
027import javax.jms.XATopicConnectionFactory;
028
029import org.apache.activemq.management.JMSStatsImpl;
030import org.apache.activemq.transport.Transport;
031
032/**
033 * A factory of {@link XAConnection} instances
034 * 
035 * 
036 */
037public class ActiveMQXAConnectionFactory extends ActiveMQConnectionFactory implements XAConnectionFactory, XAQueueConnectionFactory, XATopicConnectionFactory {
038
039    public ActiveMQXAConnectionFactory() {
040    }
041
042    public ActiveMQXAConnectionFactory(String userName, String password, String brokerURL) {
043        super(userName, password, brokerURL);
044    }
045
046    public ActiveMQXAConnectionFactory(String userName, String password, URI brokerURL) {
047        super(userName, password, brokerURL);
048    }
049
050    public ActiveMQXAConnectionFactory(String brokerURL) {
051        super(brokerURL);
052    }
053
054    public ActiveMQXAConnectionFactory(URI brokerURL) {
055        super(brokerURL);
056    }
057
058    public XAConnection createXAConnection() throws JMSException {
059        return (XAConnection) createActiveMQConnection();
060    }
061
062    public XAConnection createXAConnection(String userName, String password) throws JMSException {
063        return (XAConnection) createActiveMQConnection(userName, password);
064    }
065
066    public XAQueueConnection createXAQueueConnection() throws JMSException {
067        return (XAQueueConnection) createActiveMQConnection();
068    }
069
070    public XAQueueConnection createXAQueueConnection(String userName, String password) throws JMSException {
071        return (XAQueueConnection) createActiveMQConnection(userName, password);
072    }
073
074    public XATopicConnection createXATopicConnection() throws JMSException {
075        return (XATopicConnection) createActiveMQConnection();
076    }
077
078    public XATopicConnection createXATopicConnection(String userName, String password) throws JMSException {
079        return (XATopicConnection) createActiveMQConnection(userName, password);
080    }
081
082    protected ActiveMQConnection createActiveMQConnection(Transport transport, JMSStatsImpl stats) throws Exception {
083        ActiveMQXAConnection connection = new ActiveMQXAConnection(transport, getClientIdGenerator(), getConnectionIdGenerator(), stats);
084        return connection;
085    }
086}