1
2
3
4
5
6
7
8
9
10
11 package org.mule.util.file;
12
13 import org.mule.util.xa.AbstractTransactionContext;
14 import org.mule.util.xa.AbstractXAResourceManager;
15 import org.mule.util.xa.ResourceManagerException;
16
17 import javax.transaction.xa.XAResource;
18
19 import org.apache.commons.logging.Log;
20 import org.apache.commons.logging.LogFactory;
21
22 public class FileManager extends AbstractXAResourceManager
23 {
24
25 private static Log logger = LogFactory.getLog(FileManager.class);
26
27 public synchronized FileSession createSession()
28 {
29 return new TransactedFileSession(this);
30 }
31
32
33
34
35
36
37 protected Log getLogger()
38 {
39 return logger;
40 }
41
42
43
44
45
46
47 protected AbstractTransactionContext createTransactionContext(Object session)
48 {
49 return new FileTransactionContext();
50 }
51
52
53
54
55
56
57 protected void doBegin(AbstractTransactionContext context)
58 {
59
60 }
61
62
63
64
65
66
67 protected int doPrepare(AbstractTransactionContext context)
68 {
69 return XAResource.XA_OK;
70 }
71
72
73
74
75
76
77 protected void doCommit(AbstractTransactionContext context) throws ResourceManagerException
78 {
79
80 }
81
82
83
84
85
86
87 protected void doRollback(AbstractTransactionContext context) throws ResourceManagerException
88 {
89
90 }
91
92 protected class FileTransactionContext extends AbstractTransactionContext
93 {
94
95 }
96
97 }