KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: FileSession.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.mule.util.xa.ResourceManagerException;
14
15 import java.io.File JavaDoc;
16 import java.io.FileInputStream JavaDoc;
17 import java.io.FileOutputStream JavaDoc;
18 import java.io.IOException JavaDoc;
19 import java.io.RandomAccessFile JavaDoc;
20
21 /**
22  * @author <a HREF="mailto:gnt@codehaus.org">Guillaume Nodet</a>
23  * @version $Revision: 3798 $
24  */

25 public interface FileSession
26 {
27
28     void begin() throws ResourceManagerException;
29
30     void commit() throws ResourceManagerException;
31
32     void rollback() throws ResourceManagerException;
33
34     FileInputStream JavaDoc openInputStream(File JavaDoc f) throws IOException JavaDoc;
35
36     FileOutputStream JavaDoc openOutputStream(File JavaDoc f, boolean append) throws IOException JavaDoc;
37
38     FileOutputStream JavaDoc openOutputStream(File JavaDoc f) throws IOException JavaDoc;
39
40     boolean mkdir(File JavaDoc f) throws IOException JavaDoc;
41
42     RandomAccessFile JavaDoc openRandomAccess(File JavaDoc f, String JavaDoc mode) throws IOException JavaDoc;
43
44     /**
45      * Delete the given file.
46      *
47      * @throw IllegalStateException if this transaction has already been committed or
48      * rolled back
49      * @throw FileNotFoundException if the file does not exist
50      * @throw DeleteException if the deletion fails
51      * @throw TransactionException if there is a problem maintaining transaction
52      * information
53      * @throw InconsistentStateException if this transaction cannot be restored to a
54      * consistent state (either no effect or all effects); failure of
55      * atomicity
56      */

57     void delete(File JavaDoc f) throws IOException JavaDoc;
58
59     void copy(File JavaDoc source, File JavaDoc dest) throws IOException JavaDoc;
60
61     void rename(File JavaDoc source, File JavaDoc dest) throws IOException JavaDoc;
62
63 }
64
Popular Tags