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
23
24
25
26 public class FileManager extends AbstractXAResourceManager
27 {
28
29 private static Log logger = LogFactory.getLog(FileManager.class);
30
31 public synchronized FileSession createSession()
32 {
33 return new TransactedFileSession(this);
34 }
35
36
37
38
39
40
41 protected Log getLogger()
42 {
43 return logger;
44 }
45
46
47
48
49
50
51 protected AbstractTransactionContext createTransactionContext(Object session)
52 {
53 return new FileTransactionContext();
54 }
55
56
57
58
59
60
61 protected void doBegin(AbstractTransactionContext context)
62 {
63
64 }
65
66
67
68
69
70
71 protected int doPrepare(AbstractTransactionContext context)
72 {
73 return XAResource.XA_OK;
74 }
75
76
77
78
79
80
81 protected void doCommit(AbstractTransactionContext context) throws ResourceManagerException
82 {
83
84 }
85
86
87
88
89
90
91 protected void doRollback(AbstractTransactionContext context) throws ResourceManagerException
92 {
93
94 }
95
96 protected class FileTransactionContext extends AbstractTransactionContext
97 {
98
99 }
100
101 }