KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > sessions > ExternalTransactionController


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2005, Oracle. All rights reserved.
22
package oracle.toplink.essentials.sessions;
23
24 import oracle.toplink.essentials.internal.sessions.AbstractSession;
25 import oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl;
26 import oracle.toplink.essentials.exceptions.*;
27
28 /**
29  * <p>
30  * <b>Purpose</b>: Interface for external transaction management.
31  * <p>
32  * <b>Description</b>: This interface represents a delegate to be used for external
33  * transaction management. The implementing class may interface to an OMG OTS service,
34  * a Java JTA service or a manufacturer's specific implementation of these services.
35  * <p>
36  * <b>Responsibilities</b>:
37  * <ul>
38  * <li> Define the API for UnitOfWork to add a listener to the externally controlled transaction.
39  * </ul>
40  */

41 public interface ExternalTransactionController {
42
43     /**
44      * INTERNAL:
45      * Begin a transaction externally.
46      * This allows for TopLink to force a JTS transaction.
47      */

48     void beginTransaction(AbstractSession session);
49
50     /**
51      * INTERNAL:
52      * Commit a transaction externally.
53      * This allows for TopLink to force a JTS transaction.
54      */

55     void commitTransaction(AbstractSession session);
56
57     /**
58      * INTERNAL:
59      * Return the active unit of work for the current active external transaction.
60      */

61     UnitOfWorkImpl getActiveUnitOfWork();
62
63     /**
64      * INTERNAL:
65      * Return the manager's session.
66      */

67     AbstractSession getSession();
68
69     /**
70      * INTERNAL:
71      * Register a listener on the unit of work.
72      * The listener will callback to the unit of work to tell it to commit and merge.
73      */

74     void registerSynchronizationListener(UnitOfWorkImpl uow, AbstractSession session) throws DatabaseException;
75
76     /**
77      * INTERNAL:
78      * Rollback a transaction externally.
79      * This allows for TopLink to force a JTS transaction.
80      */

81     void rollbackTransaction(AbstractSession session);
82
83     /**
84      * INTERNAL:
85      * Marks the external transaction for rollback only.
86      */

87     void markTransactionForRollback();
88
89     /**
90      * INTERNAL:
91      * Set the manager's session.
92      */

93     void setSession(AbstractSession session);
94 }
95
Popular Tags