01: /*
02: * $Id: FileSession.java 8077 2007-08-27 20:15:25Z aperepel $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
10:
11: package org.mule.util.file;
12:
13: import org.mule.util.xa.ResourceManagerException;
14:
15: import java.io.File;
16: import java.io.FileInputStream;
17: import java.io.FileOutputStream;
18: import java.io.IOException;
19: import java.io.RandomAccessFile;
20:
21: public interface FileSession {
22:
23: void begin() throws ResourceManagerException;
24:
25: void commit() throws ResourceManagerException;
26:
27: void rollback() throws ResourceManagerException;
28:
29: FileInputStream openInputStream(File f) throws IOException;
30:
31: FileOutputStream openOutputStream(File f, boolean append)
32: throws IOException;
33:
34: FileOutputStream openOutputStream(File f) throws IOException;
35:
36: boolean mkdir(File f) throws IOException;
37:
38: RandomAccessFile openRandomAccess(File f, String mode)
39: throws IOException;
40:
41: /**
42: * Delete the given file.
43: *
44: * @throw IllegalStateException if this transaction has already been committed or
45: * rolled back
46: * @throw FileNotFoundException if the file does not exist
47: * @throw DeleteException if the deletion fails
48: * @throw TransactionException if there is a problem maintaining transaction
49: * information
50: * @throw InconsistentStateException if this transaction cannot be restored to a
51: * consistent state (either no effect or all effects); failure of
52: * atomicity
53: */
54: void delete(File f) throws IOException;
55:
56: void copy(File source, File dest) throws IOException;
57:
58: void rename(File source, File dest) throws IOException;
59:
60: }
|