001package org.javasimon.jdbcx4;
002
003import java.sql.SQLException;
004import javax.sql.StatementEventListener;
005import javax.sql.XAConnection;
006import javax.transaction.xa.XAResource;
007
008/**
009 * Simon implementation of <code>XAConnection</code>, needed for
010 * Simon XADataSource implementation.
011 * <p/>
012 * All method invokes its real implementation.
013 * <p/>
014 * See the {@link org.javasimon.jdbcx4 package description} for more
015 * information.
016 *
017 * @author Radovan Sninsky
018 * @author <a href="mailto:virgo47@gmail.com">Richard "Virgo" Richter</a>
019 * @since 2.4
020 */
021public final class SimonXAConnection extends SimonPooledConnection implements XAConnection {
022        private final XAConnection realConn;
023
024        /**
025         * Class constructor.
026         *
027         * @param connection real xa connection
028         * @param prefix Simon prefix
029         */
030        public SimonXAConnection(XAConnection connection, String prefix) {
031                super(connection, prefix);
032
033                this.realConn = connection;
034        }
035
036        @Override
037        public XAResource getXAResource() throws SQLException {
038                return realConn.getXAResource();
039        }
040
041        @Override
042        public void addStatementEventListener(StatementEventListener listener) {
043                realConn.addStatementEventListener(listener);
044        }
045
046        @Override
047        public void removeStatementEventListener(StatementEventListener listener) {
048                realConn.removeStatementEventListener(listener);
049        }
050}