1 18 19 package sync4j.syncclient.sps.pocketpc; 20 21 import java.util.Hashtable ; 22 23 import sync4j.syncclient.sps.pocketpc.RapiConstants; 24 import sync4j.syncclient.sps.common.DataAccessException; 25 import sync4j.syncclient.sps.common.RecordMetadata; 26 27 34 public class RapiDB implements RapiConstants{ 35 36 37 39 private String dbName; 40 private String volume; 41 private long dbHandle; 42 private long dbOid; 43 private byte[] volOid; 44 private int keyField; 45 private int statusField; 46 private int sortField; 47 48 49 51 57 public RapiDB(String volume, String dbName) { 58 try { 59 System.load(new java.io.File ("jrapi.dll").getAbsolutePath()); 60 } catch (RuntimeException e) { 61 e.printStackTrace(); 62 throw e; 63 } 64 65 if (volume == null) { 66 throw new NullPointerException ("volume is null!"); 67 } 68 if (dbName == null) { 69 throw new NullPointerException ("dbName is null!"); 70 } 71 72 this.volume = volume; 73 this.dbName = dbName; 74 } 75 76 87 public native boolean createDB(int keyField, int statusField) 88 throws DataAccessException; 89 90 99 public native boolean openDB(int keyField, int statusField, int sortField) 100 throws DataAccessException; 101 102 107 public native void closeDB() 108 throws DataAccessException; 109 110 115 public native void deleteDB() 116 throws DataAccessException; 117 118 128 public native Object [] readRecord(String key) 129 throws DataAccessException; 130 131 140 public native Object [] storeRecord(Object key, Object [] fields) 141 throws DataAccessException; 142 143 152 public native void setRecordField(Object key, int pos, Object value) 153 throws DataAccessException; 154 155 162 public native void deleteRecord(Object key) 163 throws DataAccessException; 164 165 175 public native Object [][] getAllRecords() 176 throws DataAccessException; 177 178 187 public native Object [] getNextRecord(char state) 188 throws DataAccessException; 189 } | Popular Tags |