/** * Retrieve a script as defined in the shell context. This allows for multi-line scripts to be submitted. */ public static String getScript(final String submittedScript, final Groovysh shell) { return submittedScript.startsWith("@") ? shell.getInterp().getContext().getProperty(submittedScript.substring(1)).toString() : submittedScript; } }
@Override public Map<String, Object> getBindings() { return Collections.unmodifiableMap(this.shell.getInterp().getContext().getVariables()); }
@Override public Object connect(final List<String> args) throws RemoteException { if (args.size() != 1) { throw new IllegalArgumentException("Usage: :remote connect " + SparqlGremlinPlugin.NAME + " <variable name of graph or graph traversal source>"); } final Object graphOrTraversalSource = this.shell.getInterp().getContext().getVariable(args.get(0)); if (graphOrTraversalSource instanceof Graph) { this.g = ((Graph) graphOrTraversalSource).traversal(); } else { this.g = (GraphTraversalSource) graphOrTraversalSource; } return this; }
@Override public void addBinding(final String key, final Object val) { this.shell.getInterp().getContext().setVariable(key, val); }
SqlGremlinPlugin.NAME + " <variable name of graph or graph traversal source> <schema file>"); final Object graphOrTraversalSource = this.shell.getInterp().getContext().getVariable(args.get(0)); final String schemaFn = (String) this.shell.getInterp().getContext().getVariable(args.get(1)); if (graphOrTraversalSource instanceof Graph) { this.g = ((Graph) graphOrTraversalSource).traversal();