View Javadoc

1   /*
2    * $Id: TransactionConfig.java 12181 2008-06-26 20:05:55Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.api.transaction;
12  
13  import org.mule.transaction.constraints.ConstraintFilter;
14  
15  /**
16   * <code>TransactionConfig</code> defines transaction configuration for a
17   * transactional endpoint.
18   */
19  public interface TransactionConfig
20  {
21      /** 
22       * Whether there is a transaction available or not, ignore it 
23       * <p>
24       * J2EE: NotSupported
25       */
26      byte ACTION_NONE = 0;
27  
28      /** 
29       * Will ensure that a new transaction is created for each invocation 
30       * <p>
31       * J2EE RequiresNew
32       */
33      byte ACTION_ALWAYS_BEGIN = 1;
34  
35      /** 
36       * Will begin a new transaction if no transaction is already present 
37       * <p>
38       * J2EE: Required
39       */
40      byte ACTION_BEGIN_OR_JOIN = 2;
41  
42      /** 
43       * There must always be a transaction present for the invocation 
44       * <p>
45       * J2EE: Mandatory
46       */
47      byte ACTION_ALWAYS_JOIN = 3;
48  
49      /** 
50       * If there is a transaction available, then use it, otherwise continue processing 
51       * <p>
52       * J2EE: Supports
53       */
54      byte ACTION_JOIN_IF_POSSIBLE = 4;
55  
56      /**
57       * There must not be a transaction present for the invocation
58       * <p>
59       * J2EE Never
60       */
61      byte ACTION_NEVER = 5;
62  
63      /**
64       * Transaction action by default
65       * <p>
66       */
67      byte ACTION_DEFAULT = ACTION_NEVER;
68      
69      TransactionFactory getFactory();
70  
71      void setFactory(TransactionFactory factory);
72  
73      byte getAction();
74  
75      void setAction(byte action);
76  
77      boolean isTransacted();
78  
79      ConstraintFilter getConstraint();
80  
81      void setConstraint(ConstraintFilter constraint);
82  
83      void setTimeout(int timeout);
84  
85      int getTimeout();
86      
87      boolean isConfigured();
88  }