MCPcopy Create free account
hub / github.com/GateNLP/gate-core / open

Method open

src/main/java/gate/persist/SerialDataStore.java:316–346  ·  view source on GitHub ↗

Open a connection to the data store.

()

Source from the content-addressed store, hash-verified

314
315 /** Open a connection to the data store. */
316 @Override
317 public void open() throws PersistenceException {
318 if(storageDir == null)
319 throw new PersistenceException("Can't open: storage dir is null");
320
321 // check storage directory is readable
322 if(! storageDir.canRead()) {
323 throw new PersistenceException("Can't read " + storageDir);
324 }
325
326 // check storage directory is a valid serial datastore
327// if we want to support old style:
328// String versionInVersionFile = "1.0";
329// (but this means it will open *any* directory)
330 try {
331 FileReader fis = new FileReader(getVersionFile());
332 BufferedReader isr = new BufferedReader(fis);
333 currentProtocolVersion = isr.readLine();
334 if(DEBUG) Out.prln("opening SDS version " + currentProtocolVersion);
335 isr.close();
336 } catch(IOException e) {
337 throw new PersistenceException(
338 "Invalid storage directory: " + e
339 );
340 }
341 if(! isValidProtocolVersion(currentProtocolVersion))
342 throw new PersistenceException(
343 "Invalid protocol version number: " + currentProtocolVersion
344 );
345
346 } // open()
347
348 /** Close the data store. */
349 @Override

Callers 4

testSaveRestoreMethod · 0.95
testMultipleLrsMethod · 0.95
testDeleteMethod · 0.95
generateCorpusMethod · 0.95

Calls 5

getVersionFileMethod · 0.95
prlnMethod · 0.95
readLineMethod · 0.80
closeMethod · 0.65

Tested by 3

testSaveRestoreMethod · 0.76
testMultipleLrsMethod · 0.76
testDeleteMethod · 0.76