00001 package org.gridlab.gat.io;
00002
00003 import java.io.FileNotFoundException;
00004
00005 import org.gridlab.gat.GATContext;
00006 import org.gridlab.gat.Preferences;
00007 import org.gridlab.gat.engine.GATEngine;
00008 import org.gridlab.gat.io.cpi.RandomAccessFileCpi;
00009 import org.gridlab.gat.monitoring.Monitorable;
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 public abstract class RandomAccessFile extends java.io.RandomAccessFile
00036 implements Monitorable, java.io.Serializable {
00037
00038 protected File file;
00039
00040 protected String mode;
00041
00042 protected GATContext gatContext;
00043
00044 protected Preferences preferences;
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 protected RandomAccessFile(GATContext gatContext, Preferences preferences,
00064 File file, String mode) throws FileNotFoundException {
00065 super(file, mode);
00066 this.file = file;
00067 this.mode = mode;
00068 this.gatContext = gatContext;
00069 this.preferences = preferences;
00070 }
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 public static RandomAccessFile create(GATContext gatContext, File file,
00087 String mode) throws FileNotFoundException {
00088 return create(gatContext, null, file, mode);
00089 }
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 public static RandomAccessFile create(GATContext gatContext,
00109 Preferences preferences, File file, String mode)
00110 throws FileNotFoundException {
00111 GATEngine gatEngine = GATEngine.getGATEngine();
00112 Object[] array = new Object[2];
00113 array[0] = file;
00114 array[1] = mode;
00115 RandomAccessFileCpi f = (RandomAccessFileCpi) gatEngine.getAdaptor(
00116 RandomAccessFileCpi.class, gatContext, preferences, array);
00117 return f;
00118 }
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135 public boolean equals(Object object) {
00136 if (!(object instanceof org.gridlab.gat.io.RandomAccessFile))
00137 return false;
00138
00139 org.gridlab.gat.io.RandomAccessFile other = (org.gridlab.gat.io.RandomAccessFile) object;
00140 return file.equals(other.file);
00141 }
00142 }