KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > util > file > FileManager


1 /*
2  * $Id: FileManager.java 3798 2006-11-04 04:07:14Z aperepel $
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 MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.util.file;
12
13 import org.apache.commons.logging.Log;
14 import org.apache.commons.logging.LogFactory;
15 import org.mule.util.xa.AbstractTransactionContext;
16 import org.mule.util.xa.AbstractXAResourceManager;
17 import org.mule.util.xa.ResourceManagerException;
18
19 import javax.transaction.xa.XAResource JavaDoc;
20
21 /**
22  * @author <a HREF="mailto:gnt@codehaus.org">Guillaume Nodet</a>
23  * @version $Revision: 3798 $
24  */

25 public class FileManager extends AbstractXAResourceManager
26 {
27
28     private static Log logger = LogFactory.getLog(FileManager.class);
29
30     public synchronized FileSession createSession()
31     {
32         return new TransactedFileSession(this);
33     }
34
35     /*
36      * (non-Javadoc)
37      *
38      * @see org.mule.transaction.xa.AbstractResourceManager#getLogger()
39      */

40     protected Log getLogger()
41     {
42         return logger;
43     }
44
45     /*
46      * (non-Javadoc)
47      *
48      * @see org.mule.transaction.xa.AbstractResourceManager#createTransactionContext(java.lang.Object)
49      */

50     protected AbstractTransactionContext createTransactionContext(Object JavaDoc session)
51     {
52         return new FileTransactionContext();
53     }
54
55     /*
56      * (non-Javadoc)
57      *
58      * @see org.mule.transaction.xa.AbstractResourceManager#doBegin(org.mule.transaction.xa.AbstractTransactionContext)
59      */

60     protected void doBegin(AbstractTransactionContext context)
61     {
62         // template method
63
}
64
65     /*
66      * (non-Javadoc)
67      *
68      * @see org.mule.transaction.xa.AbstractResourceManager#doPrepare(org.mule.transaction.xa.AbstractTransactionContext)
69      */

70     protected int doPrepare(AbstractTransactionContext context)
71     {
72         return XAResource.XA_OK;
73     }
74
75     /*
76      * (non-Javadoc)
77      *
78      * @see org.mule.transaction.xa.AbstractResourceManager#doCommit(org.mule.transaction.xa.AbstractTransactionContext)
79      */

80     protected void doCommit(AbstractTransactionContext context) throws ResourceManagerException
81     {
82         // template method
83
}
84
85     /*
86      * (non-Javadoc)
87      *
88      * @see org.mule.transaction.xa.AbstractResourceManager#doRollback(org.mule.transaction.xa.AbstractTransactionContext)
89      */

90     protected void doRollback(AbstractTransactionContext context) throws ResourceManagerException
91     {
92         // template method
93
}
94
95     protected class FileTransactionContext extends AbstractTransactionContext
96     {
97         // nothing here yet
98
}
99
100 }
101
Popular Tags