Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / derby-10.3.2.1 / java / engine / org / apache / derby / iapi / store / access / XATransactionController.java
diff --git a/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/iapi/store/access/XATransactionController.java b/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/iapi/store/access/XATransactionController.java
new file mode 100644 (file)
index 0000000..3f3e65c
--- /dev/null
@@ -0,0 +1,116 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.iapi.store.access.XATransactionController\r
+\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to you under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.iapi.store.access;\r
+\r
+import org.apache.derby.iapi.error.StandardException; \r
+\r
+import org.apache.derby.iapi.store.access.TransactionController;\r
+\r
+/**\r
+\r
+This interface allows access to commit,prepare,abort global transactions\r
+as part of a two phase commit protocol, during runtime.  \r
+These interfaces have been chosen to be exact implementations required to \r
+implement the XAResource interfaces as part of the JTA standard extension.\r
+<P>\r
+It is expected that the following interfaces are only used during the \r
+runtime portion of a 2 phase commit connection.\r
+<P>\r
+If a runtime exception causes a transaction abort (of a transaction that\r
+has not been successfully prepared), then the transaction will act as if \r
+xa_rollback() had been called.  The transaction will be aborted and any\r
+other call other than destroy will throw exceptions.\r
+<P>\r
+The XAResource interface is a Java mapping of the industry standard XA resource\r
+manager interface.  Please refer to: X/Open CAE Specification - Distributed \r
+Transaction Processing: The XA Specification, X/Open Document No. XO/CAE/91/300\r
+or ISBN 1 872630 24 3.\r
+<P>\r
+NOTE - all calls to this interface assume that the caller has insured that\r
+there is no active work being done on the local instance of the transaction \r
+in question.  RESOLVE - not sure whether this means that the connection \r
+associated with the transaction must be closed, or if it just means that\r
+synchronization has been provided to provide correct MT behavior from above.\r
+\r
+**/\r
+\r
+public interface XATransactionController extends TransactionController\r
+{\r
+    /**************************************************************************\r
+     * Public Methods of This class:\r
+     **************************************************************************\r
+     */\r
+    public static final int XA_RDONLY = 1;\r
+    public static final int XA_OK     = 2;\r
+\r
+    /**\r
+     * This method is called to commit the current XA global transaction.\r
+     * <p>\r
+     * Once this call has been made all other calls on this controller other\r
+     * than destroy will throw exceptions.\r
+     * <p>\r
+     *\r
+     * @param onePhase If true, the resource manager should use a one-phase\r
+     *                 commit protocol to commit the work done on behalf of \r
+     *                 current xid.\r
+     *\r
+        * @exception  StandardException  Standard exception policy.\r
+     **/\r
+    public void xa_commit(\r
+    boolean onePhase)\r
+               throws StandardException;\r
+\r
+    /**\r
+     * This method is called to ask the resource manager to prepare for\r
+     * a transaction commit of the transaction specified in xid.\r
+     * <p>\r
+     * If XA_OK is returned then any call other than xa_commit() or xa_abort()\r
+     * will throw exceptions.  If XA_RDONLY is returned then any call other\r
+     * than destroy() will throw exceptions.\r
+     *\r
+     * @return         A value indicating the resource manager's vote on the\r
+     *                 the outcome of the transaction.  The possible values\r
+     *                 are:  XA_RDONLY or XA_OK.  If the resource manager wants\r
+     *                 to roll back the transaction, it should do so by \r
+     *                 throwing an appropriate XAException in the prepare\r
+     *                 method.\r
+     *\r
+        * @exception  StandardException  Standard exception policy.\r
+     **/\r
+    public int xa_prepare()\r
+               throws StandardException;\r
+\r
+    /**\r
+     * rollback the current global transaction.\r
+     * <p>\r
+     * The given transaction is roll'ed back and it's history is not\r
+     * maintained in the transaction table or long term log.\r
+     * <p>\r
+     * Once this call has been made all other calls on this controller other\r
+     * than destroy will throw exceptions.\r
+     * <p>\r
+     *\r
+        * @exception  StandardException  Standard exception policy.\r
+     **/\r
+    public void xa_rollback()\r
+        throws StandardException;\r
+}\r