01: /**
02: * Copyright (C) 2001-2004 France Telecom R&D
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */package org.objectweb.speedo.jca;
18:
19: import org.objectweb.speedo.pm.api.POManagerItf;
20:
21: import javax.transaction.xa.Xid;
22:
23: /**
24: * It represents a XA context. A SpeedoXAContext is linked to a XA transaction
25: * represented by a XID. In a transaction the same POManagerItf is used.
26: *
27: * @author S.Chassande-Barrioz
28: */
29: public class SpeedoXAContext {
30: /**
31: * Is a possible status of the SpeedoXAContext.
32: * It represents the initial state when the SpeedoXAContext is not yet linked to a
33: * transaction. Then the PM must not be used in this state.
34: */
35: public final static byte UNKNOWN = -1;
36:
37: /**
38: * Is a possible status of the SpeedoXAContext.
39: * The start() method has been called in order to demarcate the begin of the
40: * PM use.
41: */
42: public final static byte STARTED = 1;
43:
44: /**
45: * Is a possible status of the SpeedoXAContext.
46: * The end() method has been called in order to demarcate the end of the
47: * PM use.
48: */
49: public final static byte ENDED = 2;
50:
51: /**
52: * Is a possible status of the SpeedoXAContext.
53: * The prepare() method has been called in order to launch the first step
54: * of the two phase commit. The PM must not be used in this state.
55: */
56: public final static byte PREPARED = 3;
57:
58: /**
59: * The XID of the transaction
60: */
61: public Xid xid = null;
62:
63: /**
64: * Is the POManagerItf to use in the SpeedoXAContext (~transaction)
65: */
66: public POManagerItf pm = null;
67:
68: /**
69: * is the status of the SpeedoXAContext. The possible values are UNKNOWN, STARTED,
70: * ENDED or PREPARED.
71: */
72: public byte status = UNKNOWN;
73:
74: /**
75: * This boolean indicates if the used PM has been registered as a
76: * java.transaction.Synchronization on the transaction.
77: */
78: public boolean synchroRegistred = false;
79:
80: public SpeedoXAContext(Xid xid) {
81: this.xid = xid;
82: }
83: }
|