@Override public Object executeBlock() { return console.run(); } }
@Override public Object executeBlock() { return console.run(); } }
public static void main(final String[] args) { int result; try { boolean tty = false; try { if (setTerminalToCBreak()) tty = true; } catch (Exception e) { } final OConsoleDatabaseApp console = new OGremlinConsole(args); if (tty) console.setReader(new TTYConsoleReader(console.historyEnabled())); result = console.run(); } finally { try { stty("echo"); } catch (Exception e) { } } System.exit(result); }
public static void main(final String[] args) { int result = 0; try { boolean tty = false; try { if (setTerminalToCBreak()) tty = true; Runtime.getRuntime().addShutdownHook(new Thread(() -> restoreTerminal())); } catch (Exception ignored) { } new OSignalHandler().installDefaultSignals(signal -> restoreTerminal()); final OConsoleDatabaseApp console = new OConsoleDatabaseApp(args); if (tty) console.setReader(new TTYConsoleReader(console.historyEnabled())); result = console.run(); } finally { restoreTerminal(); } Orient.instance().shutdown(); System.exit(result); }
public void runImport(String inputFile, String dbURL) throws IOException, FileNotFoundException { if (inputFile == null) throw new OSystemException("needed an input file as first argument"); if (dbURL == null) throw new OSystemException("needed an database location as second argument"); ODatabaseDocumentInternal db = new ODatabaseDocumentTx(dbURL); ODatabaseHelper.deleteDatabase(db, db.getType()); OrientBaseGraph g = OrientGraphFactory.getNoTxGraphImplFactory().getGraph(dbURL); System.out.println("Importing graph from file '" + inputFile + "' into database: " + g + "..."); final long startTime = System.currentTimeMillis(); OConsoleDatabaseApp console = new OGremlinConsole(new String[] { "import database " + inputFile }) .setCurrentDatabase(g.getRawGraph()); console.run(); System.out.println("Imported in " + (System.currentTimeMillis() - startTime) + "ms. Vertexes: " + g.countVertices()); g.command(new OCommandSQL("alter database TIMEZONE 'GMT'")).execute(); g.command(new OCommandSQL("alter database LOCALECOUNTRY 'UK'")).execute(); g.command(new OCommandSQL("alter database LOCALELANGUAGE 'EN'")).execute(); g.shutdown(); } }