KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > stateful > beanmanaged > transaction > ItfBeanManagedTransaction


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: ItfBeanManagedTransaction.java 808 2006-07-03 13:58:29Z pinheirg $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.stateful.beanmanaged.transaction;
26
27 import java.sql.SQLException JavaDoc;
28
29 import javax.naming.NamingException JavaDoc;
30 import javax.transaction.HeuristicMixedException JavaDoc;
31 import javax.transaction.HeuristicRollbackException JavaDoc;
32 import javax.transaction.NotSupportedException JavaDoc;
33 import javax.transaction.RollbackException JavaDoc;
34 import javax.transaction.SystemException JavaDoc;
35
36 import org.objectweb.easybeans.tests.common.exception.TransactionException;
37
38 /**
39  * Inserts a table called Test in the database.Creates differents combinations
40  * of transaction begin/commit.
41  * @author Gisele Pinheiro Souza
42  * @author Eduardo Studzinski Estima de Castro
43  */

44 public interface ItfBeanManagedTransaction {
45
46     /**
47      * Table used during the tests.
48      */

49     String JavaDoc TABLE = "BeanManaged";
50
51     /**
52      * Constants used to say that the table must not be created, only the
53      * transaction is called.
54      */

55     boolean CALL_TRANSACTION_ONLY = true;
56
57     /**
58      * Constants used to say that the table must be created.
59      */

60     boolean CREATE_TABLE = false;
61
62     /**
63      * Gets the transaction.
64      * @param callOnlyTransaction if only the transactions must be called.
65      * @param dbName the database where the table is inserted.
66      * @throws SQLException if a database error occurs.
67      * @throws NamingException if a lookup error occurs.
68      */

69     void startup(final boolean callOnlyTransaction, final String JavaDoc dbName) throws NamingException JavaDoc, SQLException JavaDoc;
70
71     /**
72      * Inserts the table called test. The transaction is open, but it is not
73      * commited in this method.
74      * @throws SQLException if a database error occurs.
75      * @throws NamingException if a lookup error occurs.
76      * @throws SystemException if an unexpected error occurs.
77      * @throws NotSupportedException if the resquest cannot be made.
78      */

79     void insertTableWithoutCommitTransaction() throws SQLException JavaDoc, NamingException JavaDoc, SystemException JavaDoc,
80             NotSupportedException JavaDoc;
81
82     /**
83      * Inserts the table called test. The transaction is open and commited in
84      * this method.
85      * @throws SQLException if a database error occurs.
86      * @throws NamingException if a lookup error occurs.
87      * @throws SystemException if an unexpected error occurs.
88      * @throws NotSupportedException if the resquest cannot be made.
89      * @throws HeuristicRollbackException if a heuristic decision was made and
90      * some relevant update was rolled back.
91      * @throws RollbackException if the transaction was rolled back instead of
92      * committed.
93      * @throws HeuristicMixedException if a heuristic decision was made and some
94      * relevant update was commited and others rolled back.
95      * @throws TransactionException if a rollback was made.
96      */

97     void insertTableWithBeginCommitTransaction() throws SQLException JavaDoc, NamingException JavaDoc, SystemException JavaDoc,
98             NotSupportedException JavaDoc, HeuristicRollbackException JavaDoc, RollbackException JavaDoc, HeuristicMixedException JavaDoc,
99             TransactionException;
100
101     /**
102      * Deletes the table called test. The transaction is not open, but it is
103      * commited in this method.
104      * @throws SQLException if a database error occurs.
105      * @throws NamingException if a lookup error occurs.
106      * @throws SystemException if an unexpected error occurs.
107      * @throws NotSupportedException if the resquest cannot be made.
108      * @throws HeuristicRollbackException if a heuristic decision was made and
109      * some relevant update was rolled back.
110      * @throws RollbackException if the transaction was rolled back instead of
111      * committed.
112      * @throws HeuristicMixedException if a heuristic decision was made and some
113      * relevant update was commited and others rolled back.
114      */

115     void dropTableWithoutBeginTransaction() throws SQLException JavaDoc, NamingException JavaDoc, SystemException JavaDoc,
116             NotSupportedException JavaDoc, HeuristicRollbackException JavaDoc, RollbackException JavaDoc, HeuristicMixedException JavaDoc,
117             TransactionException;
118
119     /**
120      * Deletes the table called test. The bean transaction is started and
121      * commited in this method.
122      * @throws SQLException if a database error occurs.
123      * @throws NamingException if a lookup error occurs.
124      * @throws SystemException if an unexpected error occurs.
125      * @throws NotSupportedException if the resquest cannot be made.
126      * @throws HeuristicRollbackException if a heuristic decision was made and
127      * some relevant update was rolled back.
128      * @throws RollbackException if the transaction was rolled back instead of
129      * committed.
130      * @throws HeuristicMixedException if a heuristic decision was made and some
131      * relevant update was commited and others rolled back.
132      */

133     void dropTableWithBeginCommitTransaction() throws SQLException JavaDoc, NamingException JavaDoc, SystemException JavaDoc,
134             NotSupportedException JavaDoc, HeuristicRollbackException JavaDoc, RollbackException JavaDoc, HeuristicMixedException JavaDoc,
135             TransactionException;
136
137     /**
138      * Creates the table called test.The bean transaction is started and
139      * commited in this method and, also, there is a nested transaction.
140      * @throws SQLException if a database error occurs.
141      * @throws NamingException if a lookup error occurs.
142      * @throws SystemException if an unexpected error occurs.
143      * @throws NotSupportedException if the resquest cannot be made.
144      * @throws HeuristicRollbackException if a heuristic decision was made and
145      * some relevant update was rolled back.
146      * @throws RollbackException if the transaction was rolled back instead of
147      * committed.
148      * @throws HeuristicMixedException if a heuristic decision was made and some
149      * relevant update was commited and others rolled back.
150      */

151     void insertTableWithNestedTrans() throws SQLException JavaDoc, NamingException JavaDoc, SystemException JavaDoc, NotSupportedException JavaDoc,
152             HeuristicRollbackException JavaDoc, RollbackException JavaDoc, HeuristicMixedException JavaDoc, TransactionException;
153
154     /**
155      * Creates the table called test.A new transaction is created and it makes
156      * the begin and commit transaction. The bean transaction is not started or
157      * commited in this method.
158      * @throws SQLException if a database error occurs.
159      * @throws NamingException if a lookup error occurs.
160      * @throws SystemException if an unexpected error occurs.
161      * @throws NotSupportedException if the resquest cannot be made.
162      * @throws HeuristicRollbackException if a heuristic decision was made and
163      * some relevant update was rolled back.
164      * @throws RollbackException if the transaction was rolled back instead of
165      * committed.
166      * @throws HeuristicMixedException if a heuristic decision was made and some
167      * relevant update was commited and others rolled back.
168      */

169     void insertTableWithNewTransaction() throws SQLException JavaDoc, NamingException JavaDoc, SystemException JavaDoc, NotSupportedException JavaDoc,
170             HeuristicRollbackException JavaDoc, RollbackException JavaDoc, HeuristicMixedException JavaDoc, TransactionException;
171
172     /**
173      * Obtains the bean transaction status.
174      * @return the bean transaction status.
175      * @throws SystemException if an unexpected error occurs.
176      */

177     int getTransactionStatus() throws SystemException JavaDoc;
178
179     /**
180      * Inserts the table called test. The transaction is openned and after
181      * insert the table, an rollback is called.
182      * @throws SQLException if a database error occurs.
183      * @throws NamingException if a lookup error occurs.
184      * @throws SystemException if an unexpected error occurs.
185      * @throws NotSupportedException if the resquest cannot be made.
186      */

187     void insertTableWithBeginRollback() throws SQLException JavaDoc, NamingException JavaDoc, SystemException JavaDoc, NotSupportedException JavaDoc;
188
189     /**
190      * Makes a rollback in the transaction
191      * @throws IllegalStateException if a transaction is not associated with a transaction.
192      * @throws SecurityException if the transaction is not allowed to make a rollback.
193      * @throws SystemException if an unexpected error occurs.
194      */

195     public void setRollback() throws IllegalStateException JavaDoc, SecurityException JavaDoc, SystemException JavaDoc;
196
197     /**
198      * Makes a setRollbackOnly that must to throw en exception.
199      * @throws NamingException if a lookup error occurs.
200      * @throws IllegalStateException if the bean try to call the setRollBackOnly
201      */

202     public void setRollbackOnly() throws NamingException JavaDoc, IllegalStateException JavaDoc;
203
204     /**
205      * Makes a getRollbackOnly that must to throw en exception.
206      * @throws NamingException if a lookup error occurs.
207      * @throws IllegalStateException if the bean try to call the getRollBackOnly
208      */

209     public void getRollbackOnly() throws NamingException JavaDoc, IllegalStateException JavaDoc;
210 }
211
Popular Tags