You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2018/10/04 16:12:45 UTC

[accumulo] branch master updated: Make shell script commmand backwards compat (#671)

This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 95378a0  Make shell script commmand backwards compat (#671)
95378a0 is described below

commit 95378a0ed572692b3243f6f625e13f56f73d0184
Author: Keith Turner <kt...@apache.org>
AuthorDate: Thu Oct 4 12:12:32 2018 -0400

    Make shell script commmand backwards compat (#671)
---
 .../java/org/apache/accumulo/shell/commands/ScriptCommand.java   | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ScriptCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ScriptCommand.java
index 31767a2..6e2bc60 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ScriptCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ScriptCommand.java
@@ -38,6 +38,7 @@ import javax.script.ScriptEngineManager;
 import javax.script.ScriptException;
 import javax.script.SimpleScriptContext;
 
+import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.shell.Shell;
 import org.apache.accumulo.shell.Shell.Command;
 import org.apache.commons.cli.CommandLine;
@@ -87,7 +88,8 @@ public class ScriptCommand extends Command {
       // are available to the scripts
       // TODO: What else should go in here?
       Bindings b = engine.getBindings(ScriptContext.ENGINE_SCOPE);
-      b.put("connection", shellState.getAccumuloClient());
+      putConnector(b, shellState.getAccumuloClient());
+      b.put("client", shellState.getAccumuloClient());
 
       List<Object> argValues = new ArrayList<>();
       if (cl.hasOption(args.getOpt())) {
@@ -174,6 +176,11 @@ public class ScriptCommand extends Command {
     return 0;
   }
 
+  @SuppressWarnings("deprecation")
+  private void putConnector(Bindings b, AccumuloClient client) {
+    b.put("connection", org.apache.accumulo.core.client.Connector.from(client));
+  }
+
   @Override
   public String description() {
     return "execute JSR-223 scripts";