KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > stateless > 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.stateless.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 table test in the database using bean-managed transaction. This class
40  * uses differents combination of 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      * Inserts the table and makes an UserTransaction.begin() before create the
64      * table.
65      * @param callOnlyTransaction says if the table must be created or only the
66      * UserTransaction.begin() and UserTransaction.commit() must be
67      * called.
68      * @param dbName database where the table must be inserted.
69      * @throws SQLException if a database error occurs.
70      * @throws NamingException if a lookup error occurs.
71      * @throws SystemException if an unexpected error occurs.
72      * @throws NotSupportedException if the resquest cannot be made.
73      */

74     void insertTableWithoutCommit(final boolean callOnlyTransaction, final String JavaDoc dbName) throws SQLException JavaDoc,
75             NamingException JavaDoc, SystemException JavaDoc, NotSupportedException JavaDoc;
76
77     /**
78      * Inserts the table and makes an UserTransaction.begin() before create the
79      * table and an UserTransaction.commit() after create.
80      * @param callOnlyTransaction says if the table must be created or only the
81      * UserTransaction.begin() and UserTransaction.commit() must be
82      * called.
83      * @param dbName database where the table must be inserted.
84      * @throws SQLException if a database error occurs.
85      * @throws NamingException if a lookup error occurs.
86      * @throws SystemException if an unexpected error occurs.
87      * @throws NotSupportedException if the resquest cannot be made.
88      * @throws HeuristicRollbackException if a heuristic decision was made and
89      * some relevant update was rolled back.
90      * @throws RollbackException if the transaction was rolled back instead of
91      * committed.
92      * @throws HeuristicMixedException if a heuristic decision was made and some
93      * relevant update was commited and others rolled back.
94      * @throws TransactionException if the transaction must to make a rollback.
95      */

96     void insertTableWithBeginCommit(final boolean callOnlyTransaction, final String JavaDoc dbName) throws SQLException JavaDoc,
97             NamingException JavaDoc, SystemException JavaDoc, NotSupportedException JavaDoc, HeuristicRollbackException JavaDoc, RollbackException JavaDoc,
98             HeuristicMixedException JavaDoc, TransactionException;
99
100     /**
101      * Deletes the table and makes an UserTransaction.commit() after create.
102      * @param callOnlyTransaction says if the table must be created or only the
103      * UserTransaction.begin() and UserTransaction.commit() must be
104      * called.
105      * @param dbName database where the table must be inserted.
106      * @throws SQLException if a database error occurs.
107      * @throws NamingException if a lookup error occurs.
108      * @throws SystemException if an unexpected error occurs.
109      * @throws NotSupportedException if the resquest cannot be made.
110      * @throws HeuristicRollbackException if a heuristic decision was made and
111      * some relevant update was rolled back.
112      * @throws RollbackException if the transaction was rolled back instead of
113      * committed.
114      * @throws HeuristicMixedException if a heuristic decision was made and some
115      * relevant update was commited and others rolled back.
116      */

117     void deleteTableWithoutBegin(final boolean callOnlyTransaction, final String JavaDoc dbName) throws SQLException JavaDoc,
118             NamingException JavaDoc, SystemException JavaDoc, NotSupportedException JavaDoc, HeuristicRollbackException JavaDoc, RollbackException JavaDoc,
119             HeuristicMixedException JavaDoc;
120
121     /**
122      * Deletes the table and makes an UserTransaction.begin() before create the
123      * table and an UserTransaction.commit() after create.
124      * @param callOnlyTransaction says if the table must be created or only the
125      * UserTransaction.begin() and UserTransaction.commit() must be
126      * called.
127      * @param dbName database where the table must be inserted.
128      * @throws SQLException if a database error occurs.
129      * @throws NamingException if a lookup error occurs.
130      * @throws SystemException if an unexpected error occurs.
131      * @throws NotSupportedException if the resquest cannot be made.
132      * @throws HeuristicRollbackException if a heuristic decision was made and
133      * some relevant update was rolled back.
134      * @throws RollbackException if the transaction was rolled back instead of
135      * committed.
136      * @throws HeuristicMixedException if a heuristic decision was made and some
137      * relevant update was commited and others rolled back.
138      * @throws TransactionException if the transaction must to make a rollback.
139      */

140     void deleteTableWithBeginCommit(final boolean callOnlyTransaction, final String JavaDoc dbName) throws SQLException JavaDoc,
141             NamingException JavaDoc, SystemException JavaDoc, NotSupportedException JavaDoc, HeuristicRollbackException JavaDoc, RollbackException JavaDoc,
142             HeuristicMixedException JavaDoc, TransactionException;
143
144     /**
145      * Makes a setRollbackOnly that must to throw en exception.
146      * @throws NamingException if a lookup error occurs.
147      * @throws IllegalStateException if the bean try to call the setRollBackOnly
148      */

149     public void setRollbackOnly() throws NamingException JavaDoc, IllegalStateException JavaDoc;
150
151     /**
152      * Makes a getRollbackOnly that must to throw en exception.
153      * @throws NamingException if a lookup error occurs.
154      * @throws IllegalStateException if the bean try to call the getRollBackOnly
155      */

156     public void getRollbackOnly() throws NamingException JavaDoc, IllegalStateException JavaDoc;
157
158 }
159
Popular Tags