KickJava   Java API By Example, From Geeks To Geeks.

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


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

25 package org.objectweb.easybeans.tests.common.ejbs.base.transaction;
26
27 import javax.ejb.TransactionAttribute JavaDoc;
28 import javax.ejb.TransactionAttributeType JavaDoc;
29 import javax.ejb.TransactionManagement JavaDoc;
30 import javax.ejb.TransactionManagementType JavaDoc;
31 import javax.naming.NamingException JavaDoc;
32
33 import org.objectweb.easybeans.tests.common.exception.TransactionException;
34
35 /**
36  * Inserts the table test in two databases using the annotation @TransactionAttribute(SUPPORTS) in all methods.
37  * @author Gisele Pinheiro Souza
38  * @author Eduardo Studzinski Estima de Castro
39  *
40  */

41 @TransactionManagement JavaDoc(value = TransactionManagementType.CONTAINER)
42 public class ContainerTransactionSupports extends ContainerTransaction {
43
44     /**
45      * Inserts the table test in both database using supports transaction.
46      * @param db1 the first database name.
47      * @param db2 the second database name.
48      * @throws Exception if an error occurs.
49      */

50     @TransactionAttribute JavaDoc(value = TransactionAttributeType.SUPPORTS)
51     @Override JavaDoc
52     public void insertCorrectTableInBothDB(final String JavaDoc db1, final String JavaDoc db2) throws Exception JavaDoc {
53         super.insertCorrectTableInBothDB(db1, db2);
54     }
55
56     /**
57      * Inserts the table test in the first database and makes an incorrect query in the second database.
58      * The behavior depends of if the client has or does not has a transaction.
59      * if the client has a transaction, this method will makes a roll back.
60      * If the client does not have a transaction, this method will not do a roll back.
61      * @param db1 the first database name.
62      * @param db2 the second database name.
63      * @throws Exception if an error occurs.
64      */

65     @TransactionAttribute JavaDoc(value = TransactionAttributeType.SUPPORTS)
66     @Override JavaDoc
67     public void insertCorrectFirstErrorSecond(final String JavaDoc db1, final String JavaDoc db2) throws Exception JavaDoc {
68         super.insertCorrectFirstErrorSecond(db1, db2);
69     }
70
71     /**
72      * Calls the method EJBContext.getRollbackOnly().
73      * @return true if the rollback only is set, false otherwise.
74      * @throws TransactionException if an IllegalStateException occurs.
75      */

76     @Override JavaDoc
77     @TransactionAttribute JavaDoc(value = TransactionAttributeType.SUPPORTS)
78     public boolean getRollbackOnly() throws TransactionException {
79         return super.getRollbackOnly();
80     }
81
82     /**
83      * Calls the method SessionContext.setRollbackOnly().
84      * @param dbName1 the first database where the table should be inserted.
85      * @param dbName2 the second database where the table should be inserted.
86      * @throws Exception if an error occurs.
87      */

88     @Override JavaDoc
89     @TransactionAttribute JavaDoc(value = TransactionAttributeType.SUPPORTS)
90     public void setRollbackOnly(final String JavaDoc dbName1, final String JavaDoc dbName2) throws Exception JavaDoc, NamingException JavaDoc {
91         super.setRollbackOnly(dbName1, dbName2);
92     }
93
94     /**
95      * @see org.objectweb.easybeans.tests.common.ejbs.base.transaction.ContainerTransaction
96      * @param db1 the name of the first database.
97      * @param db2 the name of the second database.
98      * @throws Exception if an error during the execution occurs.
99      */

100     @Override JavaDoc
101     @TransactionAttribute JavaDoc(value = TransactionAttributeType.SUPPORTS)
102     public void insertTablesUsingAuxBeanReq(final String JavaDoc db1, final String JavaDoc db2) throws Exception JavaDoc {
103         super.insertTablesUsingAuxBeanReq(db1, db2);
104     }
105
106     /**
107      * @see org.objectweb.easybeans.tests.common.ejbs.base.transaction.ContainerTransaction
108      * @param db1 the name of the first database.
109      * @param db2 the name of the second database.
110      * @throws Exception if an error during the execution occurs.
111      */

112     @Override JavaDoc
113     @TransactionAttribute JavaDoc(value = TransactionAttributeType.SUPPORTS)
114     public void insertTablesUsingAuxBeanNotSup(final String JavaDoc db1, final String JavaDoc db2) throws Exception JavaDoc {
115         super.insertTablesUsingAuxBeanNotSup(db1, db2);
116     }
117
118     /**
119      * @see org.objectweb.easybeans.tests.common.ejbs.base.transaction.ContainerTransaction
120      * @throws Exception if an error occurs.
121      */

122     @Override JavaDoc
123     @TransactionAttribute JavaDoc(value = TransactionAttributeType.SUPPORTS)
124     public void getUserTransactionWithLookup() throws Exception JavaDoc {
125         super.getUserTransactionWithLookup();
126     }
127
128     /**
129      * @see org.objectweb.easybeans.tests.common.ejbs.base.transaction.ContainerTransaction
130      * @throws Exception if an error occurs.
131      */

132     @Override JavaDoc
133     @TransactionAttribute JavaDoc(value = TransactionAttributeType.SUPPORTS)
134     public void getUserTransactionWithEJBContext() throws Exception JavaDoc {
135         super.getUserTransactionWithEJBContext();
136     }
137
138 }
139
Popular Tags