001    /*
002     * ============================================================================
003     * GNU Lesser General Public License
004     * ============================================================================
005     *
006     * Beanlet - JSE Application Container.
007     * Copyright (C) 2006  Leon van Zantvoort
008     * 
009     * This library is free software; you can redistribute it and/or
010     * modify it under the terms of the GNU Lesser General Public
011     * License as published by the Free Software Foundation; either
012     * version 2.1 of the License, or (at your option) any later version.
013     * 
014     * This library is distributed in the hope that it will be useful,
015     * but WITHOUT ANY WARRANTY; without even the implied warranty of
016     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017     * Lesser General Public License for more details.
018     * 
019     * You should have received a copy of the GNU Lesser General Public
020     * License along with this library; if not, write to the Free Software
021     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
022     * 
023     * Leon van Zantvoort
024     * 243 Acalanes Drive #11
025     * Sunnyvale, CA 94086
026     * USA
027     *
028     * zantvoort@users.sourceforge.net
029     * http://beanlet.org
030     */
031    package org.beanlet.transaction;
032    
033    /**
034     * Defines all possible transaction types.
035     *
036     * @author Leon van Zantvoort
037     */
038    public enum TransactionAttributeType {
039        
040        /**
041         * Business methods annotated with this attribute must not be called within
042         * the scope of an active transaction. An unchecked exception is thrown if
043         * the method is called within the scope of an active transaction.
044         * The method will be invoked in an unspecified transaction context, similar 
045         * to {@code NEVER_SUPPORTED}.
046         */
047        NEVER,
048        
049        /**
050         * This attribute indicates that a business method should never be executed
051         * in the context of a transaction by the container. If a transaction is
052         * already active for the running thread, the transaction is suspended
053         * during the lifetime of the underlying method. The business method runs
054         * in an unspecified transaction context.
055         */
056        NOT_SUPPORTED,
057        
058        /**
059         * The mandatory attribute indicates that the business method must be called
060         * in the context of an active transaction. If not, an unchecked exception
061         * is thrown.
062         */
063        MANDATORY,
064        
065        /**
066         * This attribute indicates that the container should defer the creation of
067         * a transaction to the caller. The container may allow the invocation of
068         * the business method within the transaction context of a caller. The 
069         * method may also be called with no transaction context associated with the 
070         * caller.
071         */
072        SUPPORTS,
073        
074        /**
075         * This attribute indicates that the business method must be invoked in the
076         * context of a transaction. If there is a transaction associated with the
077         * caller, that transaction is associated with the method invocation. If the
078         * caller does not have an associated transaction, the container starts a
079         * new transaction prior to invoking the business method, and subsequently
080         * terminates the transaction when the business method has returned.
081         */
082        REQUIRED,
083                
084        /**
085         * This attribute indicates that the business method will always be invoked
086         * in the context of a new transaction. If the caller invokes the method 
087         * within a transaction, the container will suspend that transaction and 
088         * start a new transaction before calling the actual business method. When
089         * the business method completes, the container will terminate the newly
090         * created transaction and resume the caller's transaction.
091         */
092        REQUIRES_NEW;
093    }