001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: ItfBeanManagedException.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.common.ejbs.stateful.beanmanaged.transaction;
025:
026: import java.sql.SQLException;
027:
028: import javax.naming.NamingException;
029: import javax.transaction.HeuristicMixedException;
030: import javax.transaction.HeuristicRollbackException;
031: import javax.transaction.NotSupportedException;
032: import javax.transaction.RollbackException;
033: import javax.transaction.SystemException;
034:
035: /**
036: * Used to test the Exceptions and the bean-managed transaction.
037: * @author Gisele Pinheiro Souza
038: * @author Eduardo Studzinski Estima de Castro
039: *
040: */
041: public interface ItfBeanManagedException {
042:
043: /**
044: * The table name.
045: */
046: String TABLE = "SFSBBeanManagedException";
047:
048: /**
049: * Creates an instance of the tableManager.
050: * @param dbName the database name.
051: * @throws NamingException if a lookup error occurs.
052: */
053: void startup(final String dbName) throws NamingException;
054:
055: /**
056: * Begins a transaction, inserts the data in the database, throws an
057: * application exception and tries to commit.
058: * @throws SQLException if a database error occurs.
059: * @throws NamingException if a lookup error occurs.
060: * @throws SystemException if an unexpected error occurs.
061: * @throws NotSupportedException if the resquest cannot be made.
062: * @throws HeuristicRollbackException if a heuristic decision was made and
063: * some relevant update was rolled back.
064: * @throws RollbackException if the transaction was rolled back instead of
065: * committed.
066: * @throws HeuristicMixedException if a heuristic decision was made and some
067: * relevant update was commited and others rolled back.
068: * @throws IllegalStateException if the bean is not associated with a
069: * transaction.
070: * @throws SecurityException if the bean is not allowed to commit.
071: */
072: void insertTableWithAppException() throws NamingException,
073: SQLException, NotSupportedException, SystemException,
074: IllegalStateException, SecurityException,
075: HeuristicMixedException, HeuristicRollbackException,
076: RollbackException;
077:
078: /**
079: * Begins a transaction, inserts the data in the database, throws a
080: * runtime exception and tries to commit.
081: * @throws SQLException if a database error occurs.
082: * @throws NamingException if a lookup error occurs.
083: * @throws SystemException if an unexpected error occurs.
084: * @throws NotSupportedException if the resquest cannot be made.
085: * @throws HeuristicRollbackException if a heuristic decision was made and
086: * some relevant update was rolled back.
087: * @throws RollbackException if the transaction was rolled back instead of
088: * committed.
089: * @throws HeuristicMixedException if a heuristic decision was made and some
090: * relevant update was commited and others rolled back.
091: * @throws IllegalStateException if the bean is not associated with a
092: * transaction.
093: * @throws SecurityException if the bean is not allowed to commit.
094:
095: */
096: void insertTableWithRuntimeException() throws NamingException,
097: SQLException, NotSupportedException, SystemException,
098: IllegalStateException, SecurityException,
099: HeuristicMixedException, HeuristicRollbackException,
100: RollbackException;
101:
102: /**
103: * Does nothing.
104: *
105: */
106: void emptyMethod();
107: }
|