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

Method createSerialDataStore

src/main/java/gate/gui/MainFrame.java:2351–2380  ·  view source on GitHub ↗

Method is used in NewDSAction @return the new datastore or null if an error occurs

()

Source from the content-addressed store, hash-verified

2349 * @return the new datastore or null if an error occurs
2350 */
2351 protected DataStore createSerialDataStore() {
2352 DataStore ds = null;
2353
2354 // get the URL (a file in this case)
2355 fileChooser.setDialogTitle("Please create a new empty directory");
2356 fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
2357 fileChooser.setFileFilter(fileChooser.getAcceptAllFileFilter());
2358 fileChooser.setResource("gate.persist.SerialDataStore");
2359 if(fileChooser.showOpenDialog(MainFrame.this)
2360 == JFileChooser.APPROVE_OPTION) {
2361 try {
2362 URL dsURL = fileChooser.getSelectedFile().toURI().toURL();
2363 ds =
2364 Factory.createDataStore("gate.persist.SerialDataStore", dsURL
2365 .toExternalForm());
2366 }
2367 catch(MalformedURLException mue) {
2368 JOptionPane.showMessageDialog(MainFrame.this,
2369 "Invalid location for the datastore\n " + mue.toString(), "GATE",
2370 JOptionPane.ERROR_MESSAGE);
2371 }
2372 catch(PersistenceException pe) {
2373 JOptionPane.showMessageDialog(MainFrame.this,
2374 "Datastore creation error!\n " + pe.toString(), "GATE",
2375 JOptionPane.ERROR_MESSAGE);
2376 } // catch
2377 } // if
2378
2379 return ds;
2380 } // createSerialDataStore()
2381
2382 /**
2383 * Method is used in OpenDSAction

Callers 1

actionPerformedMethod · 0.80

Calls 7

createDataStoreMethod · 0.95
toURLMethod · 0.80
toURIMethod · 0.80
getSelectedFileMethod · 0.80
toExternalFormMethod · 0.80
toStringMethod · 0.65
setResourceMethod · 0.45

Tested by

no test coverage detected