1 24 package fr.dyade.aaa.util; 25 26 import java.io.*; 27 28 public interface Transaction { 29 final int INIT = 0; final int FREE = 1; final int RUN = 2; final int COMMIT = 3; final int ROLLBACK = 4; final int GARBAGE = 5; final int FINALIZE = 6; 37 public static String [] PhaseInfo = {"init", "free", 38 "run", "commit", "rollback", 39 "garbage", "finalize"}; 40 41 final int Kb = 1024; 42 final int Mb = Kb * Kb; 43 44 void init(String path) throws IOException; 45 46 49 public int getPhase(); 50 51 public String getPhaseInfo(); 52 53 void begin() throws IOException; 54 55 File getDir(); 56 String [] getList(String prefix); 57 58 boolean isPersistent(); 59 60 void save(Serializable obj, String name) throws IOException; 61 void saveByteArray(byte[] buf, String name) throws IOException; 62 Object load(String name) throws IOException, ClassNotFoundException ; 63 byte[] loadByteArray(String name) throws IOException, ClassNotFoundException ; 64 void delete(String name); 65 66 void save(Serializable obj, String dirName, String name) throws IOException; 67 void saveByteArray(byte[] buf, String dirName, String name) throws IOException; 68 Object load(String dirName, String name) throws IOException, ClassNotFoundException ; 69 byte[] loadByteArray(String dirName, String name) throws IOException; 70 void delete(String dirName, String name); 71 72 void commit() throws IOException; 73 void rollback() throws IOException; 74 75 void release() throws IOException; 76 77 82 void stop(); 83 88 void close(); 89 } 90 | Popular Tags |