1 8 9 package com.sleepycat.je; 10 11 import java.io.File ; 12 import java.util.Properties ; 13 14 import com.sleepycat.je.dbi.CursorImpl; 15 import com.sleepycat.je.dbi.DatabaseImpl; 16 import com.sleepycat.je.dbi.EnvironmentImpl; 17 import com.sleepycat.je.dbi.GetMode; 18 import com.sleepycat.je.txn.Locker; 19 20 25 public class DbInternal { 26 27 30 public static void dbInvalidate(Database db) { 31 db.invalidate(); 32 } 33 34 37 public static void dbSetHandleLocker(Database db, Locker locker) { 38 db.setHandleLocker(locker); 39 } 40 41 44 public static EnvironmentImpl envGetEnvironmentImpl(Environment env) { 45 return env.getEnvironmentImpl(); 46 } 47 48 51 public static Cursor newCursor(DatabaseImpl dbImpl, 52 Locker locker, 53 CursorConfig cursorConfig) 54 throws DatabaseException { 55 56 return new Cursor(dbImpl, locker, cursorConfig); 57 } 58 59 62 public static OperationStatus position(Cursor cursor, 63 DatabaseEntry key, 64 DatabaseEntry data, 65 LockMode lockMode, 66 boolean first) 67 throws DatabaseException { 68 69 return cursor.position(key, data, lockMode, first); 70 } 71 72 75 public static OperationStatus retrieveNext(Cursor cursor, 76 DatabaseEntry key, 77 DatabaseEntry data, 78 LockMode lockMode, 79 GetMode getMode) 80 throws DatabaseException { 81 82 return cursor.retrieveNext(key, data, lockMode, getMode); 83 } 84 85 88 public static boolean advanceCursor(Cursor cursor, 89 DatabaseEntry key, 90 DatabaseEntry data) { 91 return cursor.advanceCursor(key, data); 92 } 93 94 97 public static CursorImpl getCursorImpl(Cursor cursor) { 98 return cursor.getCursorImpl(); 99 } 100 101 104 public static DatabaseImpl dbGetDatabaseImpl(Database db) { 105 return db.getDatabaseImpl(); 106 } 107 108 111 public static Cursor[] getSortedCursors(JoinCursor cursor) { 112 return cursor.getSortedCursors(); 113 } 114 115 118 public static void setLoadPropertyFile(EnvironmentConfig config, 119 boolean loadProperties) { 120 config.setLoadPropertyFile(loadProperties); 121 } 122 123 126 public static void setCreateUP(EnvironmentConfig config, 127 boolean checkpointUP) { 128 config.setCreateUP(checkpointUP); 129 } 130 131 134 public static boolean getCreateUP(EnvironmentConfig config) { 135 return config.getCreateUP(); 136 } 137 138 141 public static void setCheckpointUP(EnvironmentConfig config, 142 boolean checkpointUP) { 143 config.setCheckpointUP(checkpointUP); 144 } 145 146 149 public static boolean getCheckpointUP(EnvironmentConfig config) { 150 return config.getCheckpointUP(); 151 } 152 153 156 public static void setTxnReadCommitted(EnvironmentConfig config, 157 boolean txnReadCommitted) { 158 config.setTxnReadCommitted(txnReadCommitted); 159 } 160 161 164 public static boolean getTxnReadCommitted(EnvironmentConfig config) { 165 return config.getTxnReadCommitted(); 166 } 167 168 171 public static EnvironmentConfig cloneConfig(EnvironmentConfig config) { 172 return config.cloneConfig(); 173 } 174 175 178 public static 179 EnvironmentMutableConfig cloneMutableConfig(EnvironmentMutableConfig 180 config) { 181 return config.cloneMutableConfig(); 182 } 183 184 187 public static void 188 checkImmutablePropsForEquality(EnvironmentMutableConfig config, 189 EnvironmentMutableConfig passedConfig) 190 throws IllegalArgumentException { 191 192 config.checkImmutablePropsForEquality(passedConfig); 193 } 194 195 198 public static void copyMutablePropsTo(EnvironmentMutableConfig config, 199 EnvironmentMutableConfig toConfig) { 200 config.copyMutablePropsTo(toConfig); 201 } 202 203 206 public static void disableParameterValidation 207 (EnvironmentMutableConfig config) { 208 config.setValidateParams(false); 209 } 210 211 214 public static Properties getProps(EnvironmentMutableConfig config) { 215 return config.getProps(); 216 } 217 218 221 public static void setUseExistingConfig(DatabaseConfig config, 222 boolean useExistingConfig) { 223 config.setUseExistingConfig(useExistingConfig); 224 } 225 226 229 public static void databaseConfigValidate(DatabaseConfig config1, 230 DatabaseConfig config2) 231 throws DatabaseException { 232 233 config1.validate(config2); 234 } 235 236 239 public static Locker getLocker(Transaction txn) 240 throws DatabaseException { 241 242 return txn.getLocker(); 243 } 244 245 248 public static TransactionConfig getDefaultTxnConfig(Environment env) { 249 return env.getDefaultTxnConfig(); 250 } 251 252 258 public static Environment 259 getEnvironmentShell(File environmentHome) { 260 261 Environment env = null; 262 try { 263 env = new Environment(environmentHome); 264 265 266 if (env.getEnvironmentImpl() == null) { 267 env = null; 268 } 269 } catch (DatabaseException e) { 270 271 275 } 276 return env; 277 } 278 279 public static RunRecoveryException makeNoArgsRRE() { 280 return new RunRecoveryException(); 281 } 282 283 public static ExceptionEvent makeExceptionEvent(Exception e, String n) { 284 return new ExceptionEvent(e, n); 285 } 286 } 287 | Popular Tags |