|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| AbsTransactionInterceptor.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 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: AbsTransactionInterceptor.java 9 2006-02-19 18:53:32Z benoitf $ | |
| 23 | * -------------------------------------------------------------------------- | |
| 24 | */ | |
| 25 | ||
| 26 | package org.objectweb.easybeans.transaction.interceptors; | |
| 27 | ||
| 28 | import javax.transaction.TransactionManager; | |
| 29 | ||
| 30 | import org.objectweb.easybeans.api.EasyBeansInterceptor; | |
| 31 | import org.objectweb.easybeans.api.EasyBeansInvocationContext; | |
| 32 | import org.objectweb.easybeans.transaction.JTransactionManager; | |
| 33 | ||
| 34 | /** | |
| 35 | * Defines an abstract interceptor for transaction with common code used by all transaction interceptors. | |
| 36 | * @author Florent Benoit | |
| 37 | */ | |
| 38 | public abstract class AbsTransactionInterceptor implements EasyBeansInterceptor{ | |
| 39 | ||
| 40 | /** | |
| 41 | * Transaction manager. | |
| 42 | */ | |
| 43 | private TransactionManager transactionManager = null; | |
| 44 | ||
| 45 | /** | |
| 46 | * Constructor.<br> | |
| 47 | * Acquire the transaction manager. | |
| 48 | */ | |
| 49 | 0 | public AbsTransactionInterceptor() { |
| 50 | 0 | this.transactionManager = JTransactionManager.getTransactionManager(); |
| 51 | } | |
| 52 | ||
| 53 | ||
| 54 | /** | |
| 55 | * Defines the code used by the transaction interceptor on a given method. | |
| 56 | * @param invocationContext context with useful attributes on the current | |
| 57 | * invocation | |
| 58 | * @return result of the next invocation (to chain interceptors) | |
| 59 | * @throws Exception if interceptor fails | |
| 60 | */ | |
| 61 | public abstract Object intercept(final EasyBeansInvocationContext invocationContext) throws Exception; | |
| 62 | ||
| 63 | ||
| 64 | /** | |
| 65 | * Gets the transaction manager. | |
| 66 | * @return TM. | |
| 67 | */ | |
| 68 | 0 | public TransactionManager getTransactionManager() { |
| 69 | 0 | return transactionManager; |
| 70 | } | |
| 71 | ||
| 72 | } |
|
||||||||||