KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > base > transaction > ItfContainerTransaction


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: ItfContainerTransaction.java 808 2006-07-03 13:58:29Z pinheirg $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.base.transaction;
26
27 import org.objectweb.easybeans.tests.common.exception.TransactionException;
28
29 /**
30  * Inserts table in two database and uses the annotation @TransactionAttribute(REQUIRED) in all methods.
31  * @author Gisele Pinheiro Souza
32  * @author Eduardo Studzinski Estima de Castro
33  */

34 public interface ItfContainerTransaction {
35
36     /**
37      * Table name used during the tests.
38      */

39     String JavaDoc TABLE = "test";
40
41     /**
42      * Inserts the table test in the both database using a correct statement.
43      * @param db1 the name of the first database.
44      * @param db2 the name of the second database.
45      * @throws Exception if an error occurs.
46      */

47     void insertCorrectTableInBothDB(final String JavaDoc db1, final String JavaDoc db2) throws Exception JavaDoc;
48
49     /**
50      * Inserts the table test in the first database and makes an incorrect query
51      * in the second database. This incorrect query forces a roll back.
52      * @param db1 the name of the first database.
53      * @param db2 the name of the second database.
54      * @throws Exception if an error occurs.
55      */

56     void insertCorrectFirstErrorSecond(final String JavaDoc db1, final String JavaDoc db2) throws Exception JavaDoc;
57
58     /**
59      * Calls the method SessionContext.setRollbackOnly().
60      * @param dbName1 the first database where the table should be inserted.
61      * @param dbName2 the second database where the table should be inserted.
62      * @throws TransactionException if an IllegalStateException occurs.
63      * @throws Exception if an error occurs.
64      */

65     public void setRollbackOnly(final String JavaDoc dbName1, final String JavaDoc dbName2) throws TransactionException, Exception JavaDoc;
66
67     /**
68      * Calls the method EJBContext.getRollbackOnly().
69      * @return true if the rollback only is set, false otherwise.
70      */

71     boolean getRollbackOnly() throws TransactionException;
72
73     /**
74      * Inserts a table in the first database,calls an auxiliary bean to create a
75      * table in the second database and makes an exception to force a rollback
76      * if the transaction attribute supports. The auxiliary bean uses the
77      * transaction attribute REQUIRED.
78      * @param db1 the name of the first database.
79      * @param db2 the name of the second database
80      * @throws Exception if an error during the execution occurs.
81      */

82     void insertTablesUsingAuxBeanReq(final String JavaDoc db1, final String JavaDoc db2) throws Exception JavaDoc;
83
84     /**
85      * Inserts a table in the first database,calls an auxiliary bean to create a
86      * table in the second database and makes an exception to force a rollback
87      * if the transaction attribute supports. The auxiliary bean uses the
88      * transaction attribute NOT_SUPPORTED.
89      * @param db1 the name of the first database.
90      * @param db2 the name of the second database
91      * @throws Exception if an error during the execution occurs.
92      */

93     void insertTablesUsingAuxBeanNotSup(final String JavaDoc db1, final String JavaDoc db2) throws Exception JavaDoc;
94
95     /**
96      * Makes a lookup in the registry to get an UserTransaction.An exception
97      * must be throwed because the bean with container-managed transaction
98      * cannot call a bean-managed transaction.
99      * @throws Exception if an error occurs.
100      */

101     void getUserTransactionWithLookup() throws Exception JavaDoc;
102
103     /**
104      * Call the method getUserTransaction() in the EJBContext to get an
105      * UserTransaction.An exception must be throwed because the bean with
106      * container-managed transaction cannot call a bean-managed transaction.
107      * @throws Exception if an error occurs.
108      */

109     void getUserTransactionWithEJBContext() throws Exception JavaDoc;
110
111 }
112
Popular Tags