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

Method openSearchableDataStore

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

Method is used in OpenDSAction @return the opened datastore or null if an error occurs

()

Source from the content-addressed store, hash-verified

3598 * @return the opened datastore or null if an error occurs
3599 */
3600 protected DataStore openSearchableDataStore() {
3601 DataStore ds = null;
3602
3603 // get the URL (a file in this case)
3604 fileChooser.setDialogTitle("Select the datastore directory");
3605 fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
3606 fileChooser.setResource("gate.DataStore.data");
3607 if(fileChooser.showOpenDialog(MainFrame.this)
3608 == JFileChooser.APPROVE_OPTION) {
3609 try {
3610 URL dsURL = fileChooser.getSelectedFile().toURI().toURL();
3611 ds =
3612 Factory.openDataStore("gate.persist.LuceneDataStoreImpl", dsURL
3613 .toExternalForm());
3614 }
3615 catch(MalformedURLException mue) {
3616 JOptionPane.showMessageDialog(MainFrame.this,
3617 "Invalid location for the datastore\n " + mue.toString(), "GATE",
3618 JOptionPane.ERROR_MESSAGE);
3619 }
3620 catch(PersistenceException pe) {
3621 JOptionPane.showMessageDialog(MainFrame.this,
3622 "Datastore opening error!\n " + pe.toString(), "GATE",
3623 JOptionPane.ERROR_MESSAGE);
3624 } // catch
3625 } // if
3626
3627 return ds;
3628 } // openSerialDataStore()
3629
3630 class NewDSAction extends AbstractAction {
3631 private static final long serialVersionUID = 1L;

Callers 1

actionPerformedMethod · 0.80

Calls 7

openDataStoreMethod · 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