Class xaHelper

    • Constructor Summary

      Constructors 
      Constructor Description
      xaHelper()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void CommitStatement​(org.apache.derby.impl.tools.ij.ij parser, org.apache.derby.impl.tools.ij.Token onePhase, org.apache.derby.impl.tools.ij.Token twoPhase, int xid)  
      void CPConnectStatement​(org.apache.derby.impl.tools.ij.ij parser, org.apache.derby.impl.tools.ij.Token userT, org.apache.derby.impl.tools.ij.Token passT, java.lang.String n)  
      void CPDataSourceStatement​(org.apache.derby.impl.tools.ij.ij parser, org.apache.derby.impl.tools.ij.Token dbname, org.apache.derby.impl.tools.ij.Token protocol)  
      void CPDisconnectStatement​(org.apache.derby.impl.tools.ij.ij parser, java.lang.String n)  
      java.sql.Connection CPGetConnectionStatement​(org.apache.derby.impl.tools.ij.ij parser, java.lang.String n)  
      java.sql.Connection DataSourceStatement​(org.apache.derby.impl.tools.ij.ij parser, org.apache.derby.impl.tools.ij.Token dbname, org.apache.derby.impl.tools.ij.Token protocol, org.apache.derby.impl.tools.ij.Token userT, org.apache.derby.impl.tools.ij.Token passT, java.lang.String id)  
      void EndStatement​(org.apache.derby.impl.tools.ij.ij parser, int flag, int xid)  
      void ForgetStatement​(org.apache.derby.impl.tools.ij.ij parser, int xid)  
      private javax.sql.XADataSource getXADataSource()
      Get a DataSource that supports distributed transactions.
      private java.sql.SQLException handleException​(java.lang.Throwable t)
      Handles the given throwable.
      private javax.transaction.xa.Xid makeXid​(int xid)  
      void PrepareStatement​(org.apache.derby.impl.tools.ij.ij parser, int xid)  
      ijResult RecoverStatement​(org.apache.derby.impl.tools.ij.ij parser, int flag)  
      void RollbackStatement​(org.apache.derby.impl.tools.ij.ij parser, int xid)  
      private static void setDataSourceProperty​(java.lang.Object ds, java.lang.String property, boolean value)  
      private static void setDataSourceProperty​(java.lang.Object ds, java.lang.String property, int value)  
      private static void setDataSourceProperty​(java.lang.Object ds, java.lang.String property, java.lang.String value)  
      void setFramework​(java.lang.String fm)  
      void StartStatement​(org.apache.derby.impl.tools.ij.ij parser, int flag, int xid)  
      void XAConnectStatement​(org.apache.derby.impl.tools.ij.ij parser, org.apache.derby.impl.tools.ij.Token user, org.apache.derby.impl.tools.ij.Token pass, java.lang.String id)  
      void XADataSourceStatement​(org.apache.derby.impl.tools.ij.ij parser, org.apache.derby.impl.tools.ij.Token dbname, org.apache.derby.impl.tools.ij.Token shutdown, java.lang.String create)  
      void XADisconnectStatement​(org.apache.derby.impl.tools.ij.ij parser, java.lang.String n)  
      java.sql.Connection XAGetConnectionStatement​(org.apache.derby.impl.tools.ij.ij parser, java.lang.String n)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • currentXADataSource

        private javax.sql.XADataSource currentXADataSource
      • currentXAConnection

        private javax.sql.XAConnection currentXAConnection
      • databaseName

        private java.lang.String databaseName
      • currentDataSource

        private javax.sql.DataSource currentDataSource
      • currentCPDataSource

        private javax.sql.ConnectionPoolDataSource currentCPDataSource
      • currentPooledConnection

        private javax.sql.PooledConnection currentPooledConnection
      • isJCC

        private boolean isJCC
      • isNetClient

        private boolean isNetClient
      • framework

        private java.lang.String framework
      • STRING_P

        private static final java.lang.Class[] STRING_P
      • INT_P

        private static final java.lang.Class[] INT_P
      • BOOLEAN_P

        private static final java.lang.Class[] BOOLEAN_P
    • Constructor Detail

      • xaHelper

        public xaHelper()
    • Method Detail

      • makeXid

        private javax.transaction.xa.Xid makeXid​(int xid)
      • XADataSourceStatement

        public void XADataSourceStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                          org.apache.derby.impl.tools.ij.Token dbname,
                                          org.apache.derby.impl.tools.ij.Token shutdown,
                                          java.lang.String create)
                                   throws java.sql.SQLException
        Specified by:
        XADataSourceStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • XAConnectStatement

        public void XAConnectStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                       org.apache.derby.impl.tools.ij.Token user,
                                       org.apache.derby.impl.tools.ij.Token pass,
                                       java.lang.String id)
                                throws java.sql.SQLException
        Specified by:
        XAConnectStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • XADisconnectStatement

        public void XADisconnectStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                          java.lang.String n)
                                   throws java.sql.SQLException
        Specified by:
        XADisconnectStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • XAGetConnectionStatement

        public java.sql.Connection XAGetConnectionStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                                            java.lang.String n)
                                                     throws java.sql.SQLException
        Specified by:
        XAGetConnectionStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • CommitStatement

        public void CommitStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                    org.apache.derby.impl.tools.ij.Token onePhase,
                                    org.apache.derby.impl.tools.ij.Token twoPhase,
                                    int xid)
                             throws java.sql.SQLException
        Specified by:
        CommitStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • EndStatement

        public void EndStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                 int flag,
                                 int xid)
                          throws java.sql.SQLException
        Specified by:
        EndStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • ForgetStatement

        public void ForgetStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                    int xid)
                             throws java.sql.SQLException
        Specified by:
        ForgetStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • PrepareStatement

        public void PrepareStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                     int xid)
                              throws java.sql.SQLException
        Specified by:
        PrepareStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • RecoverStatement

        public ijResult RecoverStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                         int flag)
                                  throws java.sql.SQLException
        Specified by:
        RecoverStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • RollbackStatement

        public void RollbackStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                      int xid)
                               throws java.sql.SQLException
        Specified by:
        RollbackStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • StartStatement

        public void StartStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                   int flag,
                                   int xid)
                            throws java.sql.SQLException
        Specified by:
        StartStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • handleException

        private java.sql.SQLException handleException​(java.lang.Throwable t)
        Handles the given throwable.

        If possible, an SQLException is returned. Otherwise the appropriate actions are taken and a RuntimeException is thrown.

        Parameters:
        t - exception to handle
        Returns:
        An SQLException.
        Throws:
        java.lang.RuntimeException - if the throwable isn't an SQLException
      • DataSourceStatement

        public java.sql.Connection DataSourceStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                                       org.apache.derby.impl.tools.ij.Token dbname,
                                                       org.apache.derby.impl.tools.ij.Token protocol,
                                                       org.apache.derby.impl.tools.ij.Token userT,
                                                       org.apache.derby.impl.tools.ij.Token passT,
                                                       java.lang.String id)
                                                throws java.sql.SQLException
        Specified by:
        DataSourceStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • CPDataSourceStatement

        public void CPDataSourceStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                          org.apache.derby.impl.tools.ij.Token dbname,
                                          org.apache.derby.impl.tools.ij.Token protocol)
                                   throws java.sql.SQLException
        Specified by:
        CPDataSourceStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • CPConnectStatement

        public void CPConnectStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                       org.apache.derby.impl.tools.ij.Token userT,
                                       org.apache.derby.impl.tools.ij.Token passT,
                                       java.lang.String n)
                                throws java.sql.SQLException
        Specified by:
        CPConnectStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • CPGetConnectionStatement

        public java.sql.Connection CPGetConnectionStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                                            java.lang.String n)
                                                     throws java.sql.SQLException
        Specified by:
        CPGetConnectionStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • CPDisconnectStatement

        public void CPDisconnectStatement​(org.apache.derby.impl.tools.ij.ij parser,
                                          java.lang.String n)
                                   throws java.sql.SQLException
        Specified by:
        CPDisconnectStatement in interface xaAbstractHelper
        Throws:
        java.sql.SQLException
      • getXADataSource

        private javax.sql.XADataSource getXADataSource()
                                                throws java.lang.Exception
        Get a DataSource that supports distributed transactions.
        Returns:
        XADataSource object
        Throws:
        java.lang.Exception - if XaDataSource is not in class path.
      • setDataSourceProperty

        private static void setDataSourceProperty​(java.lang.Object ds,
                                                  java.lang.String property,
                                                  int value)
                                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • setDataSourceProperty

        private static void setDataSourceProperty​(java.lang.Object ds,
                                                  java.lang.String property,
                                                  java.lang.String value)
                                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • setDataSourceProperty

        private static void setDataSourceProperty​(java.lang.Object ds,
                                                  java.lang.String property,
                                                  boolean value)
                                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException