You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/12/02 11:32:21 UTC

[01/50] tinkerpop git commit: found a bug in GraphFilterStrategyTest that caused the bindings to get messed up. Basically, a ) was missing and until() was inside the repeat(). [Forced Update!]

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1562 90f427c8d -> aa4a70a47 (forced update)


found a bug in GraphFilterStrategyTest that caused the bindings to get messed up. Basically, a ) was missing and until() was inside the repeat().


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b70ba903
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b70ba903
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b70ba903

Branch: refs/heads/TINKERPOP-1562
Commit: b70ba903f40b3bffac0061c4a56f1992b55ee8ef
Parents: 84a82fb
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Nov 29 14:40:13 2016 -0700
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Nov 29 14:40:13 2016 -0700

----------------------------------------------------------------------
 .../gremlin/process/traversal/Bindings.java         | 14 +++++++++-----
 .../gremlin/process/traversal/Bytecode.java         | 16 +++++++---------
 .../optimization/GraphFilterStrategyTest.java       |  2 +-
 3 files changed, 17 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b70ba903/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
index ba31e21..3359942 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
@@ -19,6 +19,7 @@
 
 package org.apache.tinkerpop.gremlin.process.traversal;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -41,23 +42,26 @@ import java.util.Map;
  */
 public final class Bindings {
 
-    private final Map<Object, String> map = new HashMap<>();
+    private static final ThreadLocal<Map<Object, String>> MAP = new ThreadLocal<>();
 
     public <V> V of(final String variable, final V value) {
-        this.map.put(value, variable);
+        if (null == MAP.get())
+            MAP.set(new HashMap<>());
+        MAP.get().put(value, variable);
         return value;
     }
 
     protected <V> String getBoundVariable(final V value) {
-        return this.map.get(value);
+        return null == MAP.get() ? null : MAP.get().get(value);
     }
 
     protected void clear() {
-        this.map.clear();
+        if (null != MAP.get())
+            MAP.get().clear();
     }
 
     @Override
     public String toString() {
-        return this.map.toString();
+        return null == MAP.get() ? Collections.emptyMap().toString() : MAP.get().toString();
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b70ba903/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
index 567e282..11f6341 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
@@ -52,7 +52,7 @@ public final class Bytecode implements Cloneable, Serializable {
 
     private List<Instruction> sourceInstructions = new ArrayList<>();
     private List<Instruction> stepInstructions = new ArrayList<>();
-    private static transient ThreadLocal<Bindings> BINDINGS = new ThreadLocal<>();
+    private final transient Bindings bindings = new Bindings();
 
     /**
      * Add a {@link TraversalSource} instruction to the bytecode.
@@ -61,9 +61,7 @@ public final class Bytecode implements Cloneable, Serializable {
      * @param arguments  the traversal source method arguments
      */
     public void addSource(final String sourceName, final Object... arguments) {
-        if (sourceName.equals(TraversalSource.Symbols.withBindings)) {
-            BINDINGS.set((Bindings) arguments[0]);
-        } else if (sourceName.equals(TraversalSource.Symbols.withoutStrategies)) {
+        if (sourceName.equals(TraversalSource.Symbols.withoutStrategies)) {
             final Class<TraversalStrategy>[] classes = new Class[arguments.length];
             for (int i = 0; i < arguments.length; i++) {
                 classes[i] = arguments[i] instanceof TraversalStrategyProxy ?
@@ -71,10 +69,10 @@ public final class Bytecode implements Cloneable, Serializable {
                         (Class) arguments[i];
             }
             this.sourceInstructions.add(new Instruction(sourceName, classes));
-        } else {
+        } else if (!sourceName.equals(TraversalSource.Symbols.withBindings)) {
             this.sourceInstructions.add(new Instruction(sourceName, flattenArguments(arguments)));
         }
-        if (null != BINDINGS.get()) BINDINGS.get().clear();
+        this.bindings.clear();
     }
 
     /**
@@ -85,7 +83,7 @@ public final class Bytecode implements Cloneable, Serializable {
      */
     public void addStep(final String stepName, final Object... arguments) {
         this.stepInstructions.add(new Instruction(stepName, flattenArguments(arguments)));
-        if (null != BINDINGS.get()) BINDINGS.get().clear();
+        this.bindings.clear();
     }
 
     /**
@@ -272,8 +270,8 @@ public final class Bytecode implements Cloneable, Serializable {
     }
 
     private final Object convertArgument(final Object argument, final boolean searchBindings) {
-        if (searchBindings && null != BINDINGS.get()) {
-            final String variable = BINDINGS.get().getBoundVariable(argument);
+        if (searchBindings) {
+            final String variable = this.bindings.getBoundVariable(argument);
             if (null != variable)
                 return new Binding<>(variable, convertArgument(argument, false));
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b70ba903/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/GraphFilterStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/GraphFilterStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/GraphFilterStrategyTest.java
index e2deeed..cc38df9 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/GraphFilterStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/GraphFilterStrategyTest.java
@@ -61,7 +61,7 @@ public class GraphFilterStrategyTest {
                 {__.out("created"), __.outE("created")},
                 {__.in("created", "knows"), __.inE("created", "knows")},
                 {__.V().both("created"), __.bothE("created")},
-                {__.V().out("created").repeat(__.both("knows").until(__.inE("bought", "likes"))).outE("likes"), __.union(__.outE("created"), __.bothE("bought", "knows", "likes"))},
+                {__.V().out("created").repeat(__.both("knows")).until(__.inE("bought", "likes")).outE("likes"), __.union(__.outE("created"), __.bothE("bought", "knows", "likes"))},
                 {__.union(__.inE("created"), __.bothE()), null},
                 {__.union(__.inE("created"), __.outE("created")), __.bothE("created")},
                 {__.union(__.inE("knows"), __.outE("created")), __.union(__.outE("created"), __.bothE("knows"))},


[27/50] tinkerpop git commit: TINKERPOP-1562 Abstracted groovysh/io to GremlinShellEnvironment

Posted by sp...@apache.org.
TINKERPOP-1562 Abstracted groovysh/io to GremlinShellEnvironment

The GremlinShellEnvironment provides a way to abstract groovysh and io classes (i.e. groovy specific classes) so that plugins don't need to depend on gremlin-groovy at all.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/2efa2e4b
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2efa2e4b
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2efa2e4b

Branch: refs/heads/TINKERPOP-1562
Commit: 2efa2e4b75ea8032355677165097b492f2979aa8
Parents: 35c8fcd
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Nov 23 17:10:13 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../console/jsr223/GephiRemoteAcceptor.groovy   | 15 ++++----
 .../console/plugin/GephiRemoteAcceptor.groovy   |  2 ++
 .../gremlin/console/plugin/PluggedIn.groovy     | 26 +++++++++++++-
 .../console/jsr223/DriverGremlinPlugin.java     |  8 ++---
 .../console/jsr223/DriverRemoteAcceptor.java    | 16 ++++-----
 .../console/jsr223/GephiGremlinPlugin.java      | 10 ++----
 .../jsr223/console/ConsoleCustomizer.java       |  7 +---
 .../jsr223/console/GremlinShellEnvironment.java | 37 ++++++++++++++++++++
 .../hadoop/jsr223/HadoopGremlinPlugin.java      |  7 ++--
 .../hadoop/jsr223/HadoopRemoteAcceptor.java     | 22 ++++++------
 10 files changed, 99 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2efa2e4b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
index dbc1156..4e41fa4 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
@@ -29,14 +29,13 @@ import org.apache.http.impl.client.CloseableHttpClient
 import org.apache.http.impl.client.HttpClients
 import org.apache.http.util.EntityUtils
 import org.apache.tinkerpop.gremlin.console.plugin.GephiTraversalVisualizationStrategy
+import org.apache.tinkerpop.gremlin.jsr223.console.GremlinShellEnvironment
 import org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor
 import org.apache.tinkerpop.gremlin.jsr223.console.RemoteException
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource
 import org.apache.tinkerpop.gremlin.structure.Edge
 import org.apache.tinkerpop.gremlin.structure.Graph
 import org.apache.tinkerpop.gremlin.structure.Vertex
-import org.codehaus.groovy.tools.shell.Groovysh
-import org.codehaus.groovy.tools.shell.IO
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
@@ -48,8 +47,7 @@ class GephiRemoteAcceptor implements RemoteAcceptor {
     private int port = 8080
     private String workspace = "workspace1"
 
-    private final Groovysh shell
-    private final IO io
+    private final GremlinShellEnvironment shell
 
     private final Random rand = new Random();
     boolean traversalSubmittedForViz = false
@@ -64,9 +62,8 @@ class GephiRemoteAcceptor implements RemoteAcceptor {
 
     private CloseableHttpClient httpclient = HttpClients.createDefault();
 
-    public GephiRemoteAcceptor(final Groovysh shell, final IO io) {
+    public GephiRemoteAcceptor(final GremlinShellEnvironment shell) {
         this.shell = shell
-        this.io = io
 
         // traversal visualization defaults
         vizStepDelay = 1000;                 // 1 second pause between viz of steps
@@ -129,13 +126,13 @@ class GephiRemoteAcceptor implements RemoteAcceptor {
         else if (args[0] == "startSize")
             parseVizStartSize(args[1])
         else if (args[0] == "visualTraversal") {
-            def graphVar = shell.interp.context.getVariable(args[1])
+            def graphVar = shell.getVariable(args[1])
             if (!(graphVar instanceof Graph))
                 throw new RemoteException("Invalid argument to 'visualTraversal' - first parameter must be a Graph instance")
 
             def gVar = args.size() == 3 ? args[2] : "vg"
             def theG = GraphTraversalSource.build().with(new GephiTraversalVisualizationStrategy(this)).create(graphVar)
-            shell.interp.context.setVariable(gVar, theG)
+            shell.setVariable(gVar, theG)
         } else
             throw new RemoteException("Invalid config arguments - check syntax")
 
@@ -151,7 +148,7 @@ class GephiRemoteAcceptor implements RemoteAcceptor {
         final String line = String.join(" ", args)
         if (line.trim() == "clear") {
             clearGraph()
-            io.out.println("Gephi workspace cleared")
+            shell.println("Gephi workspace cleared")
             return
         }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2efa2e4b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy
index 4198444..902a479 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy
@@ -40,7 +40,9 @@ import org.codehaus.groovy.tools.shell.IO
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  * @author Randall Barnhart (randompi@gmail.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.console.jsr223.GephiRemoteAcceptor}
  */
+@Deprecated
 class GephiRemoteAcceptor implements RemoteAcceptor {
 
     private String host = "localhost"

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2efa2e4b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
index 7a08a9d..364e6ef 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
@@ -28,6 +28,7 @@ import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer
 import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer
 import org.apache.tinkerpop.gremlin.jsr223.ScriptCustomizer
 import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer
+import org.apache.tinkerpop.gremlin.jsr223.console.GremlinShellEnvironment
 import org.codehaus.groovy.tools.shell.Groovysh
 import org.codehaus.groovy.tools.shell.IO
 
@@ -111,7 +112,30 @@ class PluggedIn {
                 return Optional.empty()
 
             ConsoleCustomizer customizer = (ConsoleCustomizer) corePlugin.getCustomizers("gremlin-groovy").get().find{ it instanceof ConsoleCustomizer }
-            return Optional.of(new RemoteAcceptorAdapter(customizer.getRemoteAcceptor([(ConsoleCustomizer.ENV_CONSOLE_SHELL): shell, (ConsoleCustomizer.ENV_CONSOLE_IO): io])))
+            return Optional.of(new RemoteAcceptorAdapter(customizer.getRemoteAcceptor(new GroovyGremlinShellEnvironment())))
+        }
+
+        public class GroovyGremlinShellEnvironment implements GremlinShellEnvironment {
+
+            @Override
+            def <T> T getVariable(final String variableName) {
+                return (T) shell.interp.context.getVariable(variableName)
+            }
+
+            @Override
+            def <T> void setVariable(final String variableName, final T variableValue) {
+                shell.interp.context.setVariable(variableName, variableValue)
+            }
+
+            @Override
+            void println(final String line) {
+                io.println(line)
+            }
+
+            @Override
+            def <T> T execute(final String line) {
+                return (T) shell.execute(line)
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2efa2e4b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java
index 89cec10..fb78ee9 100644
--- a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java
+++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java
@@ -51,9 +51,7 @@ import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
 import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
 import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
 import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer;
-import org.codehaus.groovy.tools.shell.Groovysh;
-
-import java.util.Map;
+import org.apache.tinkerpop.gremlin.jsr223.console.GremlinShellEnvironment;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
@@ -99,8 +97,8 @@ public class DriverGremlinPlugin extends AbstractGremlinPlugin {
 
     private static class DriverConsoleCustomizer implements ConsoleCustomizer {
         @Override
-        public org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor getRemoteAcceptor(final Map<String, Object> environment) {
-            return new DriverRemoteAcceptor((Groovysh) environment.get(ConsoleCustomizer.ENV_CONSOLE_SHELL));
+        public org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor getRemoteAcceptor(final GremlinShellEnvironment environment) {
+            return new DriverRemoteAcceptor(environment);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2efa2e4b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverRemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverRemoteAcceptor.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverRemoteAcceptor.java
index 93ac184..aa02606 100644
--- a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverRemoteAcceptor.java
+++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverRemoteAcceptor.java
@@ -25,10 +25,10 @@ import org.apache.tinkerpop.gremlin.driver.Result;
 import org.apache.tinkerpop.gremlin.driver.ResultSet;
 import org.apache.tinkerpop.gremlin.driver.exception.ResponseException;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
+import org.apache.tinkerpop.gremlin.jsr223.console.GremlinShellEnvironment;
 import org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor;
 import org.apache.tinkerpop.gremlin.jsr223.console.RemoteException;
 import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
-import org.codehaus.groovy.tools.shell.Groovysh;
 
 import javax.security.sasl.SaslException;
 import java.io.FileNotFoundException;
@@ -75,10 +75,10 @@ public class DriverRemoteAcceptor implements RemoteAcceptor {
     private static final String TOKEN_SESSION_MANAGED = "session-managed";
     private static final List<String> POSSIBLE_TOKENS = Arrays.asList(TOKEN_TIMEOUT, TOKEN_ALIAS);
 
-    private final Groovysh shell;
+    private final GremlinShellEnvironment shellEnvironment;
 
-    public DriverRemoteAcceptor(final Groovysh shell) {
-        this.shell = shell;
+    public DriverRemoteAcceptor(final GremlinShellEnvironment shellEnvironment) {
+        this.shellEnvironment = shellEnvironment;
     }
 
     @Override
@@ -152,11 +152,11 @@ public class DriverRemoteAcceptor implements RemoteAcceptor {
 
     @Override
     public Object submit(final List<String> args) throws RemoteException {
-        final String line = getScript(String.join(" ", args), this.shell);
+        final String line = getScript(String.join(" ", args), this.shellEnvironment);
 
         try {
             final List<Result> resultSet = send(line);
-            this.shell.getInterp().getContext().setProperty(RESULT, resultSet);
+            this.shellEnvironment.setVariable(RESULT, resultSet);
             return resultSet.stream().map(result -> result.getObject()).iterator();
         } catch (SaslException sasl) {
             throw new RemoteException("Security error - check username/password and related settings", sasl);
@@ -232,7 +232,7 @@ public class DriverRemoteAcceptor implements RemoteAcceptor {
     /**
      * 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;
+    public static String getScript(final String submittedScript, final GremlinShellEnvironment shellEnvironment) {
+        return submittedScript.startsWith("@") ? shellEnvironment.getVariable(submittedScript.substring(1)).toString() : submittedScript;
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2efa2e4b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiGremlinPlugin.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiGremlinPlugin.java
index 7698112..c30f864 100644
--- a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiGremlinPlugin.java
+++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiGremlinPlugin.java
@@ -20,10 +20,7 @@ package org.apache.tinkerpop.gremlin.console.jsr223;
 
 import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
 import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer;
-import org.codehaus.groovy.tools.shell.Groovysh;
-import org.codehaus.groovy.tools.shell.IO;
-
-import java.util.Map;
+import org.apache.tinkerpop.gremlin.jsr223.console.GremlinShellEnvironment;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
@@ -37,9 +34,8 @@ public class GephiGremlinPlugin extends AbstractGremlinPlugin {
 
     private static class GephiConsoleCustomizer implements ConsoleCustomizer {
         @Override
-        public org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor getRemoteAcceptor(final Map<String, Object> environment) {
-            return new GephiRemoteAcceptor((Groovysh) environment.get(ConsoleCustomizer.ENV_CONSOLE_SHELL),
-                    (IO) environment.get(ConsoleCustomizer.ENV_CONSOLE_IO));
+        public org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor getRemoteAcceptor(final GremlinShellEnvironment gremlinShellEnvironment) {
+            return new GephiRemoteAcceptor(gremlinShellEnvironment);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2efa2e4b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/ConsoleCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/ConsoleCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/ConsoleCustomizer.java
index 7b3d788..9204488 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/ConsoleCustomizer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/ConsoleCustomizer.java
@@ -20,19 +20,14 @@ package org.apache.tinkerpop.gremlin.jsr223.console;
 
 import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 
-import java.util.Map;
-
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public interface ConsoleCustomizer extends Customizer {
-    public static final String ENV_CONSOLE_IO = "ConsolePluginAcceptor.io";
-    public static final String ENV_CONSOLE_SHELL = "ConsolePluginAcceptor.shell";
-
     /**
      * Allows a plugin to utilize features of the {@code :remote} and {@code :submit} commands of the Gremlin Console.
      * This method does not need to be implemented if the plugin is not meant for the Console for some reason or
      * if it does not intend to take advantage of those commands.
      */
-    public RemoteAcceptor getRemoteAcceptor(final Map<String, Object> environment);
+    public RemoteAcceptor getRemoteAcceptor(final GremlinShellEnvironment environment);
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2efa2e4b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/GremlinShellEnvironment.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/GremlinShellEnvironment.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/GremlinShellEnvironment.java
new file mode 100644
index 0000000..6fc1363
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/GremlinShellEnvironment.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223.console;
+
+/**
+ * Provides an abstraction over a "Gremlin Shell" (i.e. the core of a console), enabling the plugin to not have to
+ * be hardcoded specifically to any particular shell, like the Gremlin Groovy Console, and thus allowing it to
+ * not have to depend on the gremlin-groovy module itself.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface GremlinShellEnvironment {
+
+    public <T> T getVariable(final String variableName);
+
+    public <T> void setVariable(final String variableName, final T variableValue);
+
+    public void println(final String line);
+
+    public <T> T execute(final String line);
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2efa2e4b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopGremlinPlugin.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopGremlinPlugin.java
index 5e21027..b7403b6 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopGremlinPlugin.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopGremlinPlugin.java
@@ -53,14 +53,13 @@ import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
 import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
 import org.apache.tinkerpop.gremlin.jsr223.LazyBindingsCustomizer;
 import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.console.GremlinShellEnvironment;
 import org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor;
-import org.codehaus.groovy.tools.shell.Groovysh;
 
 import javax.script.Bindings;
 import javax.script.SimpleBindings;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 
@@ -147,8 +146,8 @@ public final class HadoopGremlinPlugin extends AbstractGremlinPlugin {
 
     private static class HadoopConsoleCustomizer implements ConsoleCustomizer {
         @Override
-        public RemoteAcceptor getRemoteAcceptor(final Map<String, Object> environment) {
-            return new HadoopRemoteAcceptor((Groovysh) environment.get(ConsoleCustomizer.ENV_CONSOLE_SHELL));
+        public RemoteAcceptor getRemoteAcceptor(final GremlinShellEnvironment environment) {
+            return new HadoopRemoteAcceptor(environment);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2efa2e4b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopRemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopRemoteAcceptor.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopRemoteAcceptor.java
index f2367bd..1fcdab1 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopRemoteAcceptor.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopRemoteAcceptor.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.hadoop.jsr223;
 
 import org.apache.tinkerpop.gremlin.groovy.loaders.SugarLoader;
 import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph;
+import org.apache.tinkerpop.gremlin.jsr223.console.GremlinShellEnvironment;
 import org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor;
 import org.apache.tinkerpop.gremlin.jsr223.console.RemoteException;
 import org.apache.tinkerpop.gremlin.process.computer.ComputerResult;
@@ -30,7 +31,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
 import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal;
-import org.codehaus.groovy.tools.shell.Groovysh;
 
 import java.io.IOException;
 import java.util.Collections;
@@ -47,12 +47,12 @@ public final class HadoopRemoteAcceptor implements RemoteAcceptor {
     private static final String SPACE = " ";
 
     private HadoopGraph hadoopGraph;
-    private Groovysh shell;
+    private GremlinShellEnvironment shellEnvironment;
     private boolean useSugar = false;
     private TraversalSource traversalSource;
 
-    public HadoopRemoteAcceptor(final Groovysh shell) {
-        this.shell = shell;
+    public HadoopRemoteAcceptor(final GremlinShellEnvironment shellEnvironment) {
+        this.shellEnvironment = shellEnvironment;
     }
 
     @Override
@@ -60,9 +60,9 @@ public final class HadoopRemoteAcceptor implements RemoteAcceptor {
         if (args.size() != 1 && args.size() != 2) {
             throw new IllegalArgumentException("Usage: :remote connect " + HadoopGremlinPlugin.NAME + " <variable name of graph> <optional variable name of traversal source>");
         }
-        this.hadoopGraph = (HadoopGraph) this.shell.getInterp().getContext().getVariable(args.get(0));
+        this.hadoopGraph = this.shellEnvironment.getVariable(args.get(0));
         if (args.size() == 2)
-            this.traversalSource = ((TraversalSource) this.shell.getInterp().getContext().getVariable(args.get(1)));
+            this.traversalSource = this.shellEnvironment.getVariable(args.get(1));
         else
             this.traversalSource = this.hadoopGraph.traversal();
         ///
@@ -78,7 +78,7 @@ public final class HadoopRemoteAcceptor implements RemoteAcceptor {
             if (args.get(i).equals(USE_SUGAR))
                 this.useSugar = Boolean.valueOf(args.get(i + 1));
             else if (args.get(i).equals(USE_TRAVERSAL_SOURCE)) {
-                this.traversalSource = ((TraversalSource) this.shell.getInterp().getContext().getVariable(args.get(i + 1)));
+                this.traversalSource = this.shellEnvironment.getVariable(args.get(i + 1));
             } else
                 throw new IllegalArgumentException("The provided configuration is unknown: " + args.get(i) + ":" + args.get(i + 1));
         }
@@ -92,12 +92,12 @@ public final class HadoopRemoteAcceptor implements RemoteAcceptor {
     @Override
     public Object submit(final List<String> args) throws RemoteException {
         try {
-            String script = getScript(String.join(SPACE, args), this.shell);
+            String script = getScript(String.join(SPACE, args), this.shellEnvironment);
             if (this.useSugar)
                 script = SugarLoader.class.getCanonicalName() + ".load()\n" + script;
             final TraversalVertexProgram program = TraversalVertexProgram.build().traversal(this.traversalSource, "gremlin-groovy", script).create(this.hadoopGraph);
             final ComputerResult computerResult = VertexProgramStrategy.getComputer(this.traversalSource.getStrategies()).get().apply(this.hadoopGraph).program(program).submit().get();
-            this.shell.getInterp().getContext().setVariable(RESULT, computerResult);
+            this.shellEnvironment.setVariable(RESULT, computerResult);
             ///
             final Traversal.Admin<ComputerResult, ?> traversal = new DefaultTraversal<>(computerResult.graph());
             traversal.addStep(new ComputerResultStep<>(traversal));
@@ -121,7 +121,7 @@ public final class HadoopRemoteAcceptor implements RemoteAcceptor {
     /**
      * 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;
+    public static String getScript(final String submittedScript, final GremlinShellEnvironment shell) {
+        return submittedScript.startsWith("@") ? shell.getVariable(submittedScript.substring(1)).toString() : submittedScript;
     }
 }


[21/50] tinkerpop git commit: TINKERPOP-1562 Added SparkGremlinPlugin

Posted by sp...@apache.org.
TINKERPOP-1562 Added SparkGremlinPlugin

SparkGremlinPlugin required binding injections so a BindingCustomizer was added along with two implementations - one for direct assignment and one for lazy assignment.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c41250ce
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c41250ce
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c41250ce

Branch: refs/heads/TINKERPOP-1562
Commit: c41250ce0a6c87242a974333dd97078a71be06b9
Parents: f5a1ebb
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 22 10:57:32 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../gremlin/console/plugin/PluggedIn.groovy     |  3 +
 .../groovy/plugin/GremlinPluginAdapterTest.java | 63 ++++++++++++++
 .../gremlin/jsr223/BindingsCustomizer.java      | 33 +++++++
 .../jsr223/DefaultBindingsCustomizer.java       | 40 +++++++++
 .../gremlin/jsr223/ImportGremlinPlugin.java     | 16 ++++
 .../jsr223/console/LazyBindingsCustomizer.java  | 41 +++++++++
 .../gremlin/groovy/engine/GremlinExecutor.java  |  6 +-
 .../spark/groovy/plugin/SparkGremlinPlugin.java |  2 +
 .../spark/jsr223/SparkGremlinPlugin.java        | 92 ++++++++++++++++++++
 .../jsr223/TinkerGraphGremlinPlugin.java        | 46 +++++-----
 10 files changed, 317 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c41250ce/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
index d298cd7..b707226 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
@@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.groovy.plugin.PluginAcceptor
 import org.apache.tinkerpop.gremlin.groovy.plugin.PluginInitializationException
 import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteAcceptor
 import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException
+import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer
 import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer
 import org.apache.tinkerpop.gremlin.jsr223.ScriptCustomizer
 import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer
@@ -88,6 +89,8 @@ class PluggedIn {
                     pluginAcceptor.addImports(imports)
                 } else if (it instanceof ScriptCustomizer) {
                     it.getScripts().collect { it.join(LINE_SEPARATOR) }.each { pluginAcceptor.eval(it) }
+                } else if (it instanceof BindingsCustomizer) {
+                    it.bindings.entrySet().each { k, v -> pluginAcceptor.addBinding(k,v) }
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c41250ce/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
new file mode 100644
index 0000000..77422da
--- /dev/null
+++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.console.groovy.plugin;
+
+import org.apache.tinkerpop.gremlin.console.plugin.PluggedIn;
+import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.ScriptCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin;
+import org.junit.Test;
+
+import java.time.DayOfWeek;
+import java.time.temporal.TemporalAccessor;
+import java.util.Set;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsCollectionContaining.hasItems;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GremlinPluginAdapterTest {
+
+    @Test
+    public void shouldAdaptForImportCustomizer() throws Exception {
+        final ImportGremlinPlugin plugin = ImportGremlinPlugin.build()
+                .classImports(java.awt.Color.class, java.sql.CallableStatement.class)
+                .enumImports(DayOfWeek.SATURDAY, DayOfWeek.SUNDAY)
+                .methodImports(DayOfWeek.class.getMethod("from", TemporalAccessor.class), DayOfWeek.class.getMethod("values")).create();
+        final PluggedIn.GremlinPluginAdapter adapter = new PluggedIn.GremlinPluginAdapter(plugin);
+
+        assertEquals(plugin.getName(), adapter.getName());
+
+        final SpyPluginAcceptor spy = new SpyPluginAcceptor();
+        adapter.pluginTo(spy);
+
+        final Set<String> imports = spy.getImports();
+        assertEquals(6, imports.size());
+        assertThat(imports, hasItems("import " + java.awt.Color.class.getCanonicalName()));
+        assertThat(imports, hasItems("import " + java.sql.CallableStatement.class.getCanonicalName()));
+        assertThat(imports, hasItems("import static " + DayOfWeek.class.getCanonicalName() + "." + DayOfWeek.SATURDAY.name()));
+        assertThat(imports, hasItems("import static " + DayOfWeek.class.getCanonicalName() + "." + DayOfWeek.SUNDAY.name()));
+        assertThat(imports, hasItems("import static " + DayOfWeek.class.getCanonicalName() + ".from"));
+        assertThat(imports, hasItems("import static " + DayOfWeek.class.getCanonicalName() + ".values"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c41250ce/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/BindingsCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/BindingsCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/BindingsCustomizer.java
new file mode 100644
index 0000000..02c129e
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/BindingsCustomizer.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import javax.script.Bindings;
+
+/**
+ * Provides a way to alter the bindings on a {@link GremlinScriptEngine}.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface BindingsCustomizer extends Customizer {
+    /**
+     * Gets the bindings to add to a {@link GremlinScriptEngine}.
+     */
+    public Bindings getBindings();
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c41250ce/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultBindingsCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultBindingsCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultBindingsCustomizer.java
new file mode 100644
index 0000000..0073d39
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultBindingsCustomizer.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import javax.script.Bindings;
+
+/**
+ * Default implementation of the {@link BindingsCustomizer}.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DefaultBindingsCustomizer implements BindingsCustomizer {
+
+    private final Bindings bindings;
+
+    public DefaultBindingsCustomizer(final Bindings bindings) {
+        this.bindings = bindings;
+    }
+
+    @Override
+    public Bindings getBindings() {
+        return bindings;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c41250ce/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
index a5ac278..26290d3 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.jsr223;
 
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
@@ -69,6 +70,11 @@ public final class ImportGremlinPlugin extends AbstractGremlinPlugin {
             return this;
         }
 
+        public Builder classImports(final Class<?>... classes) {
+            classImports.addAll(Arrays.asList(classes));
+            return this;
+        }
+
         public Builder classImports(final Collection<String> classes) {
             for (String clazz : classes) {
                 try {
@@ -108,6 +114,11 @@ public final class ImportGremlinPlugin extends AbstractGremlinPlugin {
             return this;
         }
 
+        public Builder methodImports(final Method... methods) {
+            methodImports.addAll(Arrays.asList(methods));
+            return this;
+        }
+
         public Builder enumImports(final Collection<String> enums) {
             for (String enumItem : enums) {
                 try {
@@ -138,6 +149,11 @@ public final class ImportGremlinPlugin extends AbstractGremlinPlugin {
             return this;
         }
 
+        public Builder enumImports(final Enum... enums) {
+            enumImports.addAll(Arrays.asList(enums));
+            return this;
+        }
+
         public ImportGremlinPlugin create() {
             if (enumImports.isEmpty() && classImports.isEmpty() && methodImports.isEmpty())
                 throw new IllegalStateException("At least one import must be specified");

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c41250ce/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/LazyBindingsCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/LazyBindingsCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/LazyBindingsCustomizer.java
new file mode 100644
index 0000000..f21a2ab
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/LazyBindingsCustomizer.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223.console;
+
+import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer;
+
+import javax.script.Bindings;
+import java.util.function.Supplier;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class LazyBindingsCustomizer implements BindingsCustomizer {
+
+    private final Supplier<Bindings> bindingsSupplier;
+
+    public LazyBindingsCustomizer(final Supplier<Bindings> bindingsSupplier) {
+        this.bindingsSupplier = bindingsSupplier;
+    }
+
+    @Override
+    public Bindings getBindings() {
+        return bindingsSupplier.get();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c41250ce/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index 84f1992..87d5728 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -447,7 +447,11 @@ public class GremlinExecutor implements AutoCloseable {
                         final Map<String, Object> customizerConfigs = pluginConfig.getValue();
                         final Method[] methods = builderClazz.getMethods();
                         for (Map.Entry<String, Object> customizerConfig : customizerConfigs.entrySet()) {
-                            final Method configMethod = Stream.of(methods).filter(m -> m.getName().equals(customizerConfig.getKey())).findFirst()
+                            final Method configMethod = Stream.of(methods).filter(m -> {
+                                final Class<?> type = customizerConfig.getValue().getClass();
+                                return m.getName().equals(customizerConfig.getKey()) && m.getParameters().length <= 1
+                                        && m.getParameters()[0].getType().isAssignableFrom(type);
+                            }).findFirst()
                                     .orElseThrow(() -> new IllegalStateException("Could not find builder method on " + builderClazz.getCanonicalName()));
                             if (null == customizerConfig.getValue())
                                 pluginBuilder = configMethod.invoke(pluginBuilder);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c41250ce/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/groovy/plugin/SparkGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/groovy/plugin/SparkGremlinPlugin.java b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/groovy/plugin/SparkGremlinPlugin.java
index 1fe23e3..c6eb682 100644
--- a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/groovy/plugin/SparkGremlinPlugin.java
+++ b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/groovy/plugin/SparkGremlinPlugin.java
@@ -34,7 +34,9 @@ import java.util.Set;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.spark.jsr223.SparkGremlinPlugin}.
  */
+@Deprecated
 public final class SparkGremlinPlugin extends AbstractGremlinPlugin {
 
     protected static String NAME = "tinkerpop.spark";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c41250ce/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/jsr223/SparkGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/jsr223/SparkGremlinPlugin.java b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/jsr223/SparkGremlinPlugin.java
new file mode 100644
index 0000000..840f593
--- /dev/null
+++ b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/jsr223/SparkGremlinPlugin.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.spark.jsr223;
+
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.console.LazyBindingsCustomizer;
+import org.apache.tinkerpop.gremlin.spark.process.computer.CombineIterator;
+import org.apache.tinkerpop.gremlin.spark.process.computer.MapIterator;
+import org.apache.tinkerpop.gremlin.spark.process.computer.MemoryAccumulator;
+import org.apache.tinkerpop.gremlin.spark.process.computer.ReduceIterator;
+import org.apache.tinkerpop.gremlin.spark.process.computer.SparkExecutor;
+import org.apache.tinkerpop.gremlin.spark.process.computer.SparkGraphComputer;
+import org.apache.tinkerpop.gremlin.spark.process.computer.SparkMemory;
+import org.apache.tinkerpop.gremlin.spark.process.computer.SparkMessenger;
+import org.apache.tinkerpop.gremlin.spark.structure.Spark;
+import org.apache.tinkerpop.gremlin.spark.structure.io.InputFormatRDD;
+import org.apache.tinkerpop.gremlin.spark.structure.io.InputOutputHelper;
+import org.apache.tinkerpop.gremlin.spark.structure.io.InputRDD;
+import org.apache.tinkerpop.gremlin.spark.structure.io.InputRDDFormat;
+import org.apache.tinkerpop.gremlin.spark.structure.io.OutputFormatRDD;
+import org.apache.tinkerpop.gremlin.spark.structure.io.OutputRDD;
+import org.apache.tinkerpop.gremlin.spark.structure.io.PersistedInputRDD;
+import org.apache.tinkerpop.gremlin.spark.structure.io.PersistedOutputRDD;
+import org.apache.tinkerpop.gremlin.spark.structure.io.SparkContextStorage;
+
+import javax.script.Bindings;
+import javax.script.SimpleBindings;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class SparkGremlinPlugin extends AbstractGremlinPlugin {
+
+    protected static String NAME = "tinkerpop.spark";
+
+    private static final ImportCustomizer imports = DefaultImportCustomizer.build().addClassImports(
+            SparkGraphComputer.class,
+            CombineIterator.class,
+            MapIterator.class,
+            MemoryAccumulator.class,
+            ReduceIterator.class,
+            SparkExecutor.class,
+            SparkGraphComputer.class,
+            SparkMemory.class,
+            SparkMessenger.class,
+            Spark.class,
+            InputFormatRDD.class,
+            InputOutputHelper.class,
+            InputRDD.class,
+            InputRDDFormat.class,
+            OutputFormatRDD.class,
+            OutputRDD.class,
+            PersistedInputRDD.class,
+            PersistedOutputRDD.class,
+            SparkContextStorage.class).create();
+
+    private static final BindingsCustomizer bindings = new LazyBindingsCustomizer(() -> {
+        final Bindings bindings = new SimpleBindings();
+        bindings.put("spark", SparkContextStorage.open());
+        return bindings;
+    });
+
+    public SparkGremlinPlugin() {
+        super(NAME, imports, bindings);
+    }
+
+    @Override
+    public boolean requireRestart() {
+        return true;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c41250ce/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java
index 16a6cb5..68e649c 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java
@@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.tinkergraph.jsr223;
 import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
 import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
 import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerGraphComputer;
 import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerGraphComputerView;
 import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerMapEmitter;
@@ -48,30 +49,27 @@ import java.util.Optional;
 public final class TinkerGraphGremlinPlugin extends AbstractGremlinPlugin {
     private static final String MODULE_NAME = "tinkerpop.tinkergraph";
 
-    public TinkerGraphGremlinPlugin() {
-        super(MODULE_NAME, DefaultImportCustomizer.build().addClassImports(
-                TinkerEdge.class,
-                TinkerElement.class,
-                TinkerFactory.class,
-                TinkerGraph.class,
-                TinkerGraphVariables.class,
-                TinkerHelper.class,
-                TinkerIoRegistry.class,
-                TinkerIoRegistryV2d0.class,
-                TinkerProperty.class,
-                TinkerVertex.class,
-                TinkerVertexProperty.class,
-                TinkerGraphComputer.class,
-                TinkerGraphComputerView.class,
-                TinkerMapEmitter.class,
-                TinkerMemory.class,
-                TinkerMessenger.class,
-                TinkerReduceEmitter.class,
-                TinkerWorkerPool.class).create());
-    }
+    private static final ImportCustomizer imports = DefaultImportCustomizer.build()
+            .addClassImports(TinkerEdge.class,
+                             TinkerElement.class,
+                             TinkerFactory.class,
+                             TinkerGraph.class,
+                             TinkerGraphVariables.class,
+                             TinkerHelper.class,
+                             TinkerIoRegistry.class,
+                             TinkerIoRegistryV2d0.class,
+                             TinkerProperty.class,
+                             TinkerVertex.class,
+                             TinkerVertexProperty.class,
+                             TinkerGraphComputer.class,
+                             TinkerGraphComputerView.class,
+                             TinkerMapEmitter.class,
+                             TinkerMemory.class,
+                             TinkerMessenger.class,
+                             TinkerReduceEmitter.class,
+                             TinkerWorkerPool.class).create();
 
-    @Override
-    public Optional<Customizer[]> getCustomizers() {
-        return null;
+    public TinkerGraphGremlinPlugin() {
+        super(MODULE_NAME, imports);
     }
 }


[08/50] tinkerpop git commit: TINKERPOP-1562 Bring back GremlinModule and deprecate it.

Posted by sp...@apache.org.
TINKERPOP-1562 Bring back GremlinModule and deprecate it.

GremlinModule was introduced in 3.2.3. Wasn't sure if GremlinModule was equal to a GremlinPlugin so I had named it differently. It was never promoted as a replacement for GremlinPlugin and it was never used in core infrastructure like Gremlin Console or Gremlin Server, but I figured it better to avoid breaking change and simply deprecate it for removal later.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c348a072
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c348a072
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c348a072

Branch: refs/heads/TINKERPOP-1562
Commit: c348a0722cfbcddd708ec8d640bd56244f5455db
Parents: 68487c2
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 13:34:27 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:50 2016 -0500

----------------------------------------------------------------------
 .../gremlin/jsr223/CoreGremlinModule.java       | 64 +++++++++++++++++
 .../DefaultGremlinScriptEngineManager.java      | 39 +++++++++--
 .../tinkerpop/gremlin/jsr223/GremlinModule.java | 72 ++++++++++++++++++++
 .../jsr223/GremlinScriptEngineManager.java      | 10 ++-
 .../gremlin/groovy/engine/GremlinExecutor.java  |  4 +-
 .../jsr223/GremlinEnabledScriptEngineTest.java  | 28 +++++++-
 6 files changed, 207 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c348a072/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
new file mode 100644
index 0000000..6869064
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import org.apache.tinkerpop.gremlin.util.CoreImports;
+
+import java.util.Optional;
+
+/**
+ * This module is required for a {@code ScriptEngine} to be Gremlin-enabled.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link CoreGremlinPlugin}.
+ */
+@Deprecated
+public final class CoreGremlinModule implements GremlinModule {
+
+    private static final String MODULE_NAME = "tinkerpop.core";
+
+    private static final ImportCustomizer gremlinCore = ImportCustomizer.build()
+            .addClassImports(CoreImports.getClassImports())
+            .addEnumImports(CoreImports.getEnumImports())
+            .addMethodImports(CoreImports.getMethodImports()).create();
+
+    private static final Customizer[] customizers = new Customizer[] {gremlinCore};
+
+    /**
+     * @deprecated As of 3.2.4, replaced by {@link #instance()} as this field will later become private.
+     */
+    @Deprecated
+    public static final CoreGremlinModule INSTANCE = new CoreGremlinModule();
+
+    private CoreGremlinModule() {}
+
+    public static CoreGremlinModule instance() {
+        return INSTANCE;
+    }
+
+    @Override
+    public Optional<Customizer[]> getCustomizers(final String scriptEngineName) {
+        return Optional.of(customizers);
+    }
+
+    @Override
+    public String getName() {
+        return MODULE_NAME;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c348a072/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
index 10bdfa3..1484f90 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
@@ -95,7 +95,15 @@ public class DefaultGremlinScriptEngineManager implements GremlinScriptEngineMan
      * List of extensions for the {@link GremlinScriptEngineManager} which will be used to supply
      * {@link Customizer} instances to {@link GremlinScriptEngineFactory} that are instantiated.
      */
-    private List<GremlinPlugin> modules = new ArrayList<>();
+    private List<GremlinPlugin> plugins = new ArrayList<>();
+
+    /**
+     * List of extensions for the {@link GremlinScriptEngineManager} which will be used to supply
+     * {@link Customizer} instances to {@link GremlinScriptEngineFactory} that are instantiated.
+     *
+     * @deprecated As of release 3.2.4, replaced by {@link #plugins}.
+     */
+    private List<GremlinModule> modules = new ArrayList<>();
 
     /**
      * The effect of calling this constructor is the same as calling
@@ -118,18 +126,37 @@ public class DefaultGremlinScriptEngineManager implements GremlinScriptEngineMan
 
     @Override
     public List<Customizer> getCustomizers(final String scriptEngineName) {
-        return modules.stream().flatMap(module -> {
-            final Optional<Customizer[]> moduleCustomizers = module.getCustomizers(scriptEngineName);
-            return Stream.of(moduleCustomizers.orElse(new Customizer[0]));
+        final List<Customizer> pluginCustomizers = plugins.stream().flatMap(plugin -> {
+            final Optional<Customizer[]> customizers = plugin.getCustomizers(scriptEngineName);
+            return Stream.of(customizers.orElse(new Customizer[0]));
         }).collect(Collectors.toList());
+
+        // modules are deprecated in favor of GremlinPlugin - this line will eventually be removed
+        pluginCustomizers.addAll(modules.stream().flatMap(plugin -> {
+            final Optional<Customizer[]> customizers = plugin.getCustomizers(scriptEngineName);
+            return Stream.of(customizers.orElse(new Customizer[0]));
+        }).collect(Collectors.toList()));
+
+
+        return pluginCustomizers;
     }
 
+    /**
+     * @deprecated As of release 3.2.4, replaced by {@link #addPlugin(GremlinPlugin)}.
+     */
     @Override
-    public void addModule(final GremlinPlugin module) {
+    @Deprecated
+    public void addModule(final GremlinModule module) {
         // TODO: should modules be a set based on "name" to ensure uniqueness? not sure what bad stuff can happen with dupes
         if (module != null) modules.add(module);
     }
 
+    @Override
+    public void addPlugin(final GremlinPlugin plugin) {
+        // TODO: should modules be a set based on "name" to ensure uniqueness? not sure what bad stuff can happen with dupes
+        if (plugin != null) plugins.add(plugin);
+    }
+
     /**
      * Stores the specified {@code Bindings} as a global for all {@link GremlinScriptEngine} objects created by it.
      * If the bindings are to be updated by multiple threads it is recommended that a {@link ConcurrentBindings}
@@ -378,7 +405,7 @@ public class DefaultGremlinScriptEngineManager implements GremlinScriptEngineMan
 
     private void initEngines(final ClassLoader loader) {
         // always need this module for a scriptengine to be "Gremlin-enabled"
-        modules.add(CoreGremlinPlugin.INSTANCE);
+        plugins.add(CoreGremlinPlugin.instance());
 
         Iterator<GremlinScriptEngineFactory> itty;
         try {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c348a072/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java
new file mode 100644
index 0000000..1345841
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import java.util.Optional;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link GremlinPlugin}.
+ */
+@Deprecated
+public interface GremlinModule {
+    /**
+     * The name of the module.  This name should be unique (use a namespaced approach) as naming clashes will
+     * prevent proper module operations. Modules developed by TinkerPop will be prefixed with "tinkerpop."
+     * For example, TinkerPop's implementation of Giraph would be named "tinkerpop.giraph".  If Facebook were
+     * to do their own implementation the implementation might be called "facebook.giraph".
+     */
+    public String getName();
+
+    /**
+     * Some modules may require a restart of the plugin host for the classloader to pick up the features.  This is
+     * typically true of modules that rely on {@code Class.forName()} to dynamically instantiate classes from the
+     * root classloader (e.g. JDBC drivers that instantiate via @{code DriverManager}).
+     */
+    public default boolean requireRestart() {
+        return false;
+    }
+
+    /**
+     * Gets the list of all {@link Customizer} implementations to assign to a new {@link GremlinScriptEngine}. This is
+     * the same as doing {@code getCustomizers(null)}.
+     */
+    public default Optional<Customizer[]> getCustomizers(){
+        return getCustomizers(null);
+    }
+
+    /**
+     * Gets the list of {@link Customizer} implementations to assign to a new {@link GremlinScriptEngine}. The
+     * implementation should filter the returned {@code Customizers} according to the supplied name of the
+     * Gremlin-enabled {@code ScriptEngine}. By providing a filter, {@code GremlinModule} developers can have the
+     * ability to target specific {@code ScriptEngines}.
+     *
+     * @param scriptEngineName The name of the {@code ScriptEngine} or null to get all the available {@code Customizers}
+     */
+    public Optional<Customizer[]> getCustomizers(final String scriptEngineName);
+
+    /**
+     * Allows a plugin to utilize features of the {@code :remote} and {@code :submit} commands of the Gremlin Console.
+     * This method does not need to be implemented if the plugin is not meant for the Console for some reason or
+     * if it does not intend to take advantage of those commands.
+     */
+    public default Optional<RemoteAcceptor> remoteAcceptor() {
+        return Optional.empty();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c348a072/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngineManager.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngineManager.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngineManager.java
index b2966c5..a48d761 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngineManager.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngineManager.java
@@ -118,9 +118,17 @@ public interface GremlinScriptEngineManager {
     public List<GremlinScriptEngineFactory> getEngineFactories();
 
     /**
+     * Add {@link GremlinModule} instances to customize newly created {@link GremlinScriptEngine} instances.
+     *
+     * @deprecated As of release 3.2.4, replaced by {@link #addPlugin(GremlinPlugin)}.
+     */
+    @Deprecated
+    public void addModule(final GremlinModule module);
+
+    /**
      * Add {@link GremlinPlugin} instances to customize newly created {@link GremlinScriptEngine} instances.
      */
-    public void addModule(final GremlinPlugin module);
+    public void addPlugin(final GremlinPlugin plugin);
 
     /**
      * Registers a {@link GremlinScriptEngineFactory} to handle a language name.  Overrides any such association found

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c348a072/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index 8659e24..4449e1b 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -438,7 +438,7 @@ public class GremlinExecutor implements AutoCloseable {
                     // first try instance() and if that fails try to use build()
                     try {
                         final Method instanceMethod = clazz.getMethod("instance");
-                        gremlinScriptEngineManager.addModule((GremlinPlugin) instanceMethod.invoke(null));
+                        gremlinScriptEngineManager.addPlugin((GremlinPlugin) instanceMethod.invoke(null));
                     } catch (Exception ex) {
                         final Method builderMethod = clazz.getMethod("build");
                         Object moduleBuilder = builderMethod.invoke(null);
@@ -463,7 +463,7 @@ public class GremlinExecutor implements AutoCloseable {
                         }
 
                         final Method create = builderClazz.getMethod("create");
-                        gremlinScriptEngineManager.addModule((GremlinPlugin) create.invoke(moduleBuilder));
+                        gremlinScriptEngineManager.addPlugin((GremlinPlugin) create.invoke(moduleBuilder));
                     }
                 } catch (Exception ex) {
                     throw new IllegalStateException(ex);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c348a072/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
index 76e8f55..34a37ae 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
@@ -25,7 +25,9 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.junit.Test;
 
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
+import java.util.Optional;
 
 import static org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngineSuite.ENGINE_TO_TEST;
 import static org.junit.Assert.assertEquals;
@@ -47,11 +49,35 @@ public class GremlinEnabledScriptEngineTest {
 
     @Test
     public void shouldHaveCoreImportsInPlace() throws Exception {
-        // TODO: delete this test - other tests will give us confidence on such things as we get further along
         final GremlinScriptEngine scriptEngine = manager.getEngineByName(ENGINE_TO_TEST);
         final List<Class> classesToCheck = Arrays.asList(Vertex.class, Edge.class, Graph.class, VertexProperty.class);
         for (Class clazz : classesToCheck) {
             assertEquals(clazz, scriptEngine.eval(clazz.getSimpleName()));
         }
     }
+
+    @Test
+    public void shouldSupportDeprecatedGremlinModules() throws Exception {
+        final GremlinScriptEngineManager mgr = new DefaultGremlinScriptEngineManager();
+        mgr.addModule(new GremlinModule() {
+            @Override
+            public String getName() {
+                return "test.junk";
+            }
+
+            @Override
+            public Optional<Customizer[]> getCustomizers(final String scriptEngineName) {
+                return Optional.of(new Customizer[] {ImportCustomizer.build()
+                        .addClassImports(java.awt.Color.class)
+                        .addClassImports(java.sql.CallableStatement.class)
+                        .create() });
+            }
+        });
+
+        final GremlinScriptEngine scriptEngine = mgr.getEngineByName(ENGINE_TO_TEST);
+        final List<Class> classesToCheck = Arrays.asList(java.awt.Color.class, java.sql.CallableStatement.class);
+        for (Class clazz : classesToCheck) {
+            assertEquals(clazz, scriptEngine.eval(clazz.getSimpleName()));
+        }
+    }
 }


[02/50] tinkerpop git commit: sorry for the late tweak. Here is the thing. With then new Bindings model, you don't need withBindings() in Gremlin-Java. And, moreoever, it was never used in Gremlin-Python (or any script-based GLV). Thus, its pointless. De

Posted by sp...@apache.org.
sorry for the late tweak. Here is the thing. With then new Bindings model, you don't need withBindings() in Gremlin-Java. And, moreoever, it was never used in Gremlin-Python (or any script-based GLV). Thus, its pointless. Deprecated it. Updated the docs accordingly. Also added more test cases to BytecodeTest and test_traversal.py to ensure that both Gremlin-Java bindings and Gremlin-Python bindings have the same look and feel to the user.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/987e6ab4
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/987e6ab4
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/987e6ab4

Branch: refs/heads/TINKERPOP-1562
Commit: 987e6ab4f2ca643a5eb181f4b52417bf9814fcbd
Parents: b70ba90
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Nov 30 10:14:01 2016 -0700
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Nov 30 10:14:01 2016 -0700

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../src/reference/gremlin-applications.asciidoc |  6 +--
 docs/src/reference/gremlin-variants.asciidoc    |  5 ---
 .../gremlin-language-variants/index.asciidoc    |  3 --
 .../gremlin/process/traversal/Bindings.java     | 41 ++++++++++++++------
 .../gremlin/process/traversal/Bytecode.java     | 10 ++---
 .../process/traversal/TraversalSource.java      |  7 ++--
 .../dsl/graph/GraphTraversalSource.java         |  4 +-
 .../gremlin/process/traversal/BytecodeTest.java |  8 ++--
 .../python/GraphTraversalSourceGenerator.groovy |  2 -
 .../python/TraversalSourceGenerator.groovy      |  6 +++
 .../gremlin_python/process/graph_traversal.py   |  2 -
 .../jython/gremlin_python/process/traversal.py  |  6 +++
 .../main/jython/tests/process/test_traversal.py | 13 +++++++
 14 files changed, 72 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 10a0604..237b7ce 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Deprecated `TraversalSource.withBindings()` as it is no longer needed in Gremlin-Java and never was needed for other variants.
 * Fixed a bug in Gremlin-Java `Bytecode` where anonymous traversals were not aware of parent bindings.
 * Fixed a bug in Gremlin-Java GraphSON deserialization around `P.within()` and `P.without()`.
 * Converted Spark process suite tests to "integration" tests.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/docs/src/reference/gremlin-applications.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc
index c452a0f..f7ba2b5 100644
--- a/docs/src/reference/gremlin-applications.asciidoc
+++ b/docs/src/reference/gremlin-applications.asciidoc
@@ -939,13 +939,13 @@ times and sizing) can be done in the Gremlin Server configuration file as descri
 Finally, Gremlin `Bytecode` supports the encoding of bindings which allow GremlinServer to cache traversals that will
 be reused over and over again save that some parameterization may change. Thus, instead of translating, compiling, and
 then executing each submitted bytecode, it is possible to simply execute. To express bindings in Gremlin-Java and
-Gremlin-Groovy, use the `withBindings()` traversal source method.
+Gremlin-Groovy, use `Bindings`.
 
 [gremlin-groovy]
 ----
 cluster = Cluster.open('conf/remote-objects.yaml')
-b = new Bindings()
-g = EmptyGraph.instance().traversal().withBindings(b).withRemote(DriverRemoteConnection.using(cluster, "g"))
+b = Bindings.instance()
+g = EmptyGraph.instance().traversal().withRemote(DriverRemoteConnection.using(cluster, "g"))
 g.V(b.of('id',1)).out('created').values('name')
 g.V(b.of('id',4)).out('created').values('name')
 g.V(b.of('id',4)).out('created').values('name').getBytecode()

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/docs/src/reference/gremlin-variants.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc
index 853b087..39b5558 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -265,11 +265,6 @@ g.V(('id',1)).out('created').name.toList()
 g.V(('id',4)).out('created').name.toList()
 ----
 
-NOTE: The Gremlin `withBindings()` traversal source step is not needed. Typically `withBindings()` is only required
-in statically typed languages where bindings need to have the same typing as the `Traversal` API. However, if desired,
-it is possible to use the `withBindings()`-model as Gremlin-Python's `Bindings.of()` simply returns a 2-tuple of `(str,object)`
-(see <<connecting-via-remotegraph,`Bindings`>>).
-
 Traversal Strategies
 ~~~~~~~~~~~~~~~~~~~~
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/docs/src/tutorials/gremlin-language-variants/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/tutorials/gremlin-language-variants/index.asciidoc b/docs/src/tutorials/gremlin-language-variants/index.asciidoc
index 533aa04..abd402b 100644
--- a/docs/src/tutorials/gremlin-language-variants/index.asciidoc
+++ b/docs/src/tutorials/gremlin-language-variants/index.asciidoc
@@ -346,7 +346,6 @@ class GraphTraversalSourceGenerator {
                 findAll { GraphTraversalSource.class.equals(it.returnType) }.
                 findAll {
                     !it.name.equals("clone") &&
-                            !it.name.equals(TraversalSource.Symbols.withBindings) &&
                             !it.name.equals(TraversalSource.Symbols.withRemote)
                 }.
                 collect { SymbolHelper.toPython(it.name) }.
@@ -365,8 +364,6 @@ class GraphTraversalSourceGenerator {
     source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
     source.traversal_strategies.add_strategies([RemoteStrategy(remote_connection)])
     return source
-  def withBindings(self, bindings):
-    return self
 """)
         GraphTraversalSource.getMethods(). // SPAWN STEPS
                 findAll { GraphTraversal.class.equals(it.returnType) }.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
index 3359942..d399bb2 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
@@ -19,7 +19,6 @@
 
 package org.apache.tinkerpop.gremlin.process.traversal;
 
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -30,8 +29,8 @@ import java.util.Map;
  * For instance:
  * <p>
  * <code>
- * b = new Bindings()
- * g = graph.traversal().withBindings(b)
+ * b = Bindings.instance()
+ * g = graph.traversal()
  * g.V().out(b.of("a","knows"))
  * // bindings can be reused over and over
  * g.V().out("knows").in(b.of("a","created"))
@@ -42,26 +41,44 @@ import java.util.Map;
  */
 public final class Bindings {
 
+    private static final Bindings INSTANCE = new Bindings();
     private static final ThreadLocal<Map<Object, String>> MAP = new ThreadLocal<>();
 
+    /**
+     * @deprecated Since 3.2.4. Instead, use {@link Bindings#instance()}.
+     */
+    @Deprecated
+    public Bindings() {
+
+    }
+
     public <V> V of(final String variable, final V value) {
-        if (null == MAP.get())
-            MAP.set(new HashMap<>());
-        MAP.get().put(value, variable);
+        Map<Object, String> map = MAP.get();
+        if (null == map) {
+            map = new HashMap<>();
+            MAP.set(map);
+        }
+        map.put(value, variable);
         return value;
     }
 
-    protected <V> String getBoundVariable(final V value) {
-        return null == MAP.get() ? null : MAP.get().get(value);
+    protected static <V> String getBoundVariable(final V value) {
+        final Map<Object, String> map = MAP.get();
+        return null == map ? null : map.get(value);
+    }
+
+    protected static void clear() {
+        final Map<Object, String> map = MAP.get();
+        if (null != map)
+            map.clear();
     }
 
-    protected void clear() {
-        if (null != MAP.get())
-            MAP.get().clear();
+    public static Bindings instance() {
+        return INSTANCE;
     }
 
     @Override
     public String toString() {
-        return null == MAP.get() ? Collections.emptyMap().toString() : MAP.get().toString();
+        return "bindings[" + Thread.currentThread().getName() + "]";
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
index 11f6341..7ea5f6f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
@@ -52,7 +52,6 @@ public final class Bytecode implements Cloneable, Serializable {
 
     private List<Instruction> sourceInstructions = new ArrayList<>();
     private List<Instruction> stepInstructions = new ArrayList<>();
-    private final transient Bindings bindings = new Bindings();
 
     /**
      * Add a {@link TraversalSource} instruction to the bytecode.
@@ -69,10 +68,9 @@ public final class Bytecode implements Cloneable, Serializable {
                         (Class) arguments[i];
             }
             this.sourceInstructions.add(new Instruction(sourceName, classes));
-        } else if (!sourceName.equals(TraversalSource.Symbols.withBindings)) {
+        } else
             this.sourceInstructions.add(new Instruction(sourceName, flattenArguments(arguments)));
-        }
-        this.bindings.clear();
+        Bindings.clear();
     }
 
     /**
@@ -83,7 +81,7 @@ public final class Bytecode implements Cloneable, Serializable {
      */
     public void addStep(final String stepName, final Object... arguments) {
         this.stepInstructions.add(new Instruction(stepName, flattenArguments(arguments)));
-        this.bindings.clear();
+        Bindings.clear();
     }
 
     /**
@@ -271,7 +269,7 @@ public final class Bytecode implements Cloneable, Serializable {
 
     private final Object convertArgument(final Object argument, final boolean searchBindings) {
         if (searchBindings) {
-            final String variable = this.bindings.getBoundVariable(argument);
+            final String variable = Bindings.getBoundVariable(argument);
             if (null != variable)
                 return new Binding<>(variable, convertArgument(argument, false));
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
index df1d89a..32c034a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
@@ -84,6 +84,7 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
             // static fields only
         }
 
+        @Deprecated
         public static final String withBindings = "withBindings";
         public static final String withSack = "withSack";
         public static final String withStrategies = "withStrategies";
@@ -133,11 +134,11 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
      *
      * @param bindings the bindings instance to use
      * @return a new traversal source with set bindings
+     * @deprecated Since 3.2.4, simply use {@link Bindings} without reference to a {@link TraversalSource}.
      */
+    @Deprecated
     public default TraversalSource withBindings(final Bindings bindings) {
-        final TraversalSource clone = this.clone();
-        clone.getBytecode().addSource(Symbols.withBindings, bindings);
-        return clone;
+        return this;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
index 362c571..af78add 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
@@ -45,7 +45,6 @@ import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 import java.util.Optional;
 import java.util.function.BinaryOperator;
 import java.util.function.Supplier;
@@ -134,10 +133,11 @@ public class GraphTraversalSource implements TraversalSource {
     }
 
     @Override
+    @Deprecated
     public GraphTraversalSource withBindings(final Bindings bindings) {
         return (GraphTraversalSource) TraversalSource.super.withBindings(bindings);
     }
-    
+
     @Override
     public GraphTraversalSource withComputer(final Computer computer) {
         return (GraphTraversalSource) TraversalSource.super.withComputer(computer);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
index ea81bdc..e1a31c4 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
@@ -82,8 +82,8 @@ public class BytecodeTest {
 
     @Test
     public void shouldIncludeBindingsInEquality() {
-        final Bindings b = new Bindings();
-        final GraphTraversalSource g = EmptyGraph.instance().traversal().withBindings(b);
+        final Bindings b = Bindings.instance();
+        final GraphTraversalSource g = EmptyGraph.instance().traversal();
 
         final Bytecode bytecode1 = g.V().out(b.of("a", "created")).asAdmin().getBytecode();
         final Bytecode bytecode2 = g.V().out(b.of("a", "knows")).asAdmin().getBytecode();
@@ -103,8 +103,8 @@ public class BytecodeTest {
 
     @Test
     public void shouldIncludeBindingsInNestedTraversals() {
-        final Bindings b = new Bindings();
-        final GraphTraversalSource g = EmptyGraph.instance().traversal().withBindings(b);
+        final Bindings b = Bindings.instance();
+        final GraphTraversalSource g = EmptyGraph.instance().traversal();
         final Bytecode bytecode = g.V().in(b.of("a","created")).where(__.out(b.of("b","knows")).has("age",b.of("c",P.gt(32))).map(__.values(b.of("d","name")))).asAdmin().getBytecode();
         assertEquals(4, bytecode.getBindings().size());
         assertEquals("created", bytecode.getBindings().get("a"));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
index ed377bd..0d36581 100644
--- a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
+++ b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
@@ -102,8 +102,6 @@ under the License.
     source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
     source.traversal_strategies.add_strategies([RemoteStrategy(remote_connection)])
     return source
-  def withBindings(self, bindings):
-    return self
   def withComputer(self,graph_computer=None, workers=None, result=None, persist=None, vertices=None, edges=None, configuration=None):
     return self.withStrategies(VertexProgramStrategy(graph_computer,workers,result,persist,vertices,edges,configuration))
 """)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
index a3684cb..b6f25e3 100644
--- a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
+++ b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
@@ -310,6 +310,12 @@ class Binding(object):
     def __init__(self,key,value):
         self.key = key
         self.value = value
+    def __eq__(self, other):
+        return isinstance(other, self.__class__) and self.key == other.key and self.value == other.value
+    def __hash__(self):
+        return hash(self.key) + hash(self.value)
+    def __repr__(self):
+        return "binding[" + self.key + "=" + str(self.value) + "]"
 
 """)
         //////////////

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
index 6165ed3..ceb4cb4 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
@@ -62,8 +62,6 @@ class GraphTraversalSource(object):
     source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
     source.traversal_strategies.add_strategies([RemoteStrategy(remote_connection)])
     return source
-  def withBindings(self, bindings):
-    return self
   def withComputer(self,graph_computer=None, workers=None, result=None, persist=None, vertices=None, edges=None, configuration=None):
     return self.withStrategies(VertexProgramStrategy(graph_computer,workers,result,persist,vertices,edges,configuration))
   def E(self, *args):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
index d30db35..a7b6118 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
@@ -373,4 +373,10 @@ class Binding(object):
     def __init__(self,key,value):
         self.key = key
         self.value = value
+    def __eq__(self, other):
+        return isinstance(other, self.__class__) and self.key == other.key and self.value == other.value
+    def __hash__(self):
+        return hash(self.key) + hash(self.value)
+    def __repr__(self):
+        return "binding[" + self.key + "=" + str(self.value) + "]"
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/gremlin-python/src/main/jython/tests/process/test_traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/process/test_traversal.py b/gremlin-python/src/main/jython/tests/process/test_traversal.py
index 0f25190..e68b1e2 100644
--- a/gremlin-python/src/main/jython/tests/process/test_traversal.py
+++ b/gremlin-python/src/main/jython/tests/process/test_traversal.py
@@ -24,6 +24,8 @@ from unittest import TestCase
 
 from gremlin_python.structure.graph import Graph
 from gremlin_python.process.traversal import P
+from gremlin_python.process.traversal import Binding
+from gremlin_python.process.graph_traversal import __
 
 
 class TestTraversal(TestCase):
@@ -52,6 +54,17 @@ class TestTraversal(TestCase):
         assert 1 == len(bytecode.step_instructions[0])
         assert 1 == len(bytecode.step_instructions[1])
         assert 2 == len(bytecode.step_instructions[2])
+        ##
+        bytecode = g.V(('a',[1,2,3])).out(('b','created')).where(__.in_(('c','created'),('d','knows')).count().is_(('e',P.gt(2)))).bytecode
+        assert 5 == len(bytecode.bindings.keys())
+        assert [1,2,3] == bytecode.bindings['a']
+        assert 'created' == bytecode.bindings['b']
+        assert 'created' == bytecode.bindings['c']
+        assert 'knows' == bytecode.bindings['d']
+        assert P.gt(2) == bytecode.bindings['e']
+        assert Binding('b','created') == bytecode.step_instructions[1][1]
+        assert 'binding[b=created]' == str(bytecode.step_instructions[1][1])
+        assert isinstance(hash(bytecode.step_instructions[1][1]),int)
 
     def test_P(self):
         # verify that the order of operations is respected


[34/50] tinkerpop git commit: TINKERPOP-1562 Deprecated Artifact

Posted by sp...@apache.org.
TINKERPOP-1562 Deprecated Artifact

Moved it to a new home as the hole plugin package is going to go away in 3.3.0


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/39e39652
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/39e39652
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/39e39652

Branch: refs/heads/TINKERPOP-1562
Commit: 39e39652a0d3e6a4f9ef480d16b08372774f2b30
Parents: a2a2359
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 29 09:39:10 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:50 2016 -0500

----------------------------------------------------------------------
 .../groovy/util/DependencyGrabber.groovy        | 15 ++--
 .../gremlin/groovy/plugin/Artifact.java         |  2 +
 .../tinkerpop/gremlin/groovy/util/Artifact.java | 86 ++++++++++++++++++++
 .../gremlin/groovy/plugin/ArtifactTest.java     |  2 -
 .../gremlin/groovy/util/ArtifactTest.java       | 85 +++++++++++++++++++
 5 files changed, 182 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/39e39652/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy b/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
index e7ab55b..f2bfe5c 100644
--- a/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
+++ b/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
@@ -20,11 +20,14 @@ package org.apache.tinkerpop.gremlin.groovy.util
 
 import groovy.grape.Grape
 import org.apache.commons.lang3.SystemUtils
-import org.apache.tinkerpop.gremlin.groovy.plugin.Artifact
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
-import java.nio.file.*
+import java.nio.file.DirectoryStream
+import java.nio.file.FileSystems
+import java.nio.file.Files
+import java.nio.file.Path
+import java.nio.file.StandardCopyOption
 import java.util.jar.JarFile
 import java.util.jar.Manifest
 
@@ -118,9 +121,9 @@ class DependencyGrabber {
                     .findAll {!filesAlreadyInPath.collect { it.getFileName().toString() }.contains(it.fileName.toFile().name)}
                     .each(copyTo(targetPluginPath))
             getAdditionalDependencies(targetPluginPath, artifact).collect(convertUriToPath(fs))
-                .findAll { !(it.fileName.toFile().name ==~ /(slf4j|logback\-classic)-.*\.jar/) }
-                .findAll { !filesAlreadyInPath.collect { it.getFileName().toString() }.contains(it.fileName.toFile().name)}
-                .each(copyTo(targetPluginPath))
+                    .findAll { !(it.fileName.toFile().name ==~ /(slf4j|logback\-classic)-.*\.jar/) }
+                    .findAll { !filesAlreadyInPath.collect { it.getFileName().toString() }.contains(it.fileName.toFile().name)}
+                    .each(copyTo(targetPluginPath))
 
             // get dependencies for the lib path.  the lib path should not filter out any jars - used for reference
             dependencyLocations.collect(convertUriToPath(fs)).each(copyTo(targetLibPath))
@@ -162,7 +165,7 @@ class DependencyGrabber {
      * Windows places a starting forward slash in the URI that needs to be stripped off or else the
      * {@code FileSystem} won't properly resolve it.
      */
-    private static Closure convertUriToPath(final FileSystem fs) {
+    private static Closure convertUriToPath(def fs) {
         return { URI uri ->
             def p = SystemUtils.IS_OS_WINDOWS ? uri.path.substring(1) : uri.path
             return fs.getPath(p)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/39e39652/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java
index 29ce7d6..7fb0bd3 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java
@@ -22,7 +22,9 @@ package org.apache.tinkerpop.gremlin.groovy.plugin;
  * A software artifact identified by its maven coordinates.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.groovy.util.Artifact}
  */
+@Deprecated
 public class Artifact {
     private final String group;
     private final String artifact;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/39e39652/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/util/Artifact.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/util/Artifact.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/util/Artifact.java
new file mode 100644
index 0000000..2e2554b
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/util/Artifact.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.util;
+
+/**
+ * A software artifact identified by its maven coordinates.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class Artifact {
+    private final String group;
+    private final String artifact;
+    private final String version;
+
+    /**
+     * Create a new instance.
+     *
+     * @param group the {@code groupId}
+     * @param artifact the {@code artifactId}
+     * @param version the {@code version}
+     */
+    public Artifact(final String group, final String artifact, final String version) {
+        if (group == null || group.isEmpty())
+            throw new IllegalArgumentException("group cannot be null or empty");
+
+        if (artifact == null || artifact.isEmpty())
+            throw new IllegalArgumentException("artifact cannot be null or empty");
+
+        if (version == null || version.isEmpty())
+            throw new IllegalArgumentException("version cannot be null or empty");
+
+        this.group = group;
+        this.artifact = artifact;
+        this.version = version;
+    }
+
+    public String getGroup() {
+        return group;
+    }
+
+    public String getArtifact() {
+        return artifact;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        final Artifact a = (Artifact) o;
+
+        if (group != null ? !group.equals(a.group) : a.group != null) return false;
+        if (artifact != null ? !artifact.equals(a.artifact) : a.artifact != null) return false;
+        if (version != null ? !version.equals(a.version) : a.version != null) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = group != null ? group.hashCode() : 0;
+        result = 31 * result + (artifact != null ? artifact.hashCode() : 0);
+        result = 31 * result + (version != null ? version.hashCode() : 0);
+        return result;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/39e39652/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/plugin/ArtifactTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/plugin/ArtifactTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/plugin/ArtifactTest.java
index a876df8..f3c96f9 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/plugin/ArtifactTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/plugin/ArtifactTest.java
@@ -18,13 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.groovy.plugin;
 
-
 import org.junit.Test;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.Is.is;
 
-
 /**
  * @author Nghia Tran (https://github.com/n-tran)
  */

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/39e39652/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/ArtifactTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/ArtifactTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/ArtifactTest.java
new file mode 100644
index 0000000..0e0c283
--- /dev/null
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/ArtifactTest.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.util;
+
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * @author Nghia Tran (https://github.com/n-tran)
+ */
+public class ArtifactTest {
+    @Test
+    public void shouldBeEqualIfSame() {
+        final Artifact a = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+        final Artifact b = a;
+
+        assertThat(a.equals(b), is(true));
+    }
+
+    @Test
+    public void shouldNotBeEqualIfArgumentIsNull() {
+        final Artifact a = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+        final Artifact b = null;
+
+        assertThat(a.equals(b), is(false));
+    }
+
+    @Test
+    public void shouldNotBeEqualIfArgumentIsNotAnArtifact() {
+        final Artifact a = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+        final String b = " ";
+
+        assertThat(a.equals(b), is(false));
+    }
+
+    @Test
+    public void shouldNotBeEqualIfTheGroupIsNotEqual() {
+        final Artifact a = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+        final Artifact b = new Artifact("com.apacheTest.tinkerpop2","tinkergraph-gremlin","3.0.0");
+
+        assertThat(a.equals(b), is(false));
+    }
+
+    @Test
+    public void shouldNotBeEqualIfTheArtifactIsNotEqual() {
+        final Artifact a = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+        final Artifact b = new Artifact("org.apache.tinkerpop","tinkergraph-artifact","3.0.0");
+
+        assertThat(a.equals(b), is(false));
+    }
+
+    @Test
+    public void shouldNotBeEqualIfTheVersionIsNotEqual() {
+        final Artifact a = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+        final Artifact b = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","4.0.0");
+
+        assertThat(a.equals(b), is(false));
+    }
+
+    @Test
+    public void shouldBeEqual() {
+        final Artifact a = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+        final Artifact b = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+
+        assertThat(a.equals(b), is(true));
+    }
+}


[29/50] tinkerpop git commit: TINKERPOP-1562 Rename "modules" as "plugin"

Posted by sp...@apache.org.
TINKERPOP-1562 Rename "modules" as "plugin"


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/aee85b12
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/aee85b12
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/aee85b12

Branch: refs/heads/TINKERPOP-1562
Commit: aee85b12f55c2a6b6426e6386677d6bec46513a8
Parents: e9e5cfe
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 22 06:59:49 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../gremlin/groovy/engine/GremlinExecutor.java  | 40 ++++++++++----------
 .../tinkerpop/gremlin/server/Settings.java      |  4 +-
 .../server/util/ServerGremlinExecutor.java      |  6 +--
 3 files changed, 25 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aee85b12/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index 4449e1b..84f1992 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -85,7 +85,7 @@ public class GremlinExecutor implements AutoCloseable {
     private GremlinScriptEngineManager gremlinScriptEngineManager;
 
     private final Map<String, EngineSettings> settings;
-    private final Map<String, Map<String, Map<String,Object>>> modules;
+    private final Map<String, Map<String, Map<String,Object>>> plugins;
     private final long scriptEvaluationTimeout;
     private final Bindings globalBindings;
     private final List<List<String>> use;
@@ -111,7 +111,7 @@ public class GremlinExecutor implements AutoCloseable {
         this.afterFailure = builder.afterFailure;
         this.use = builder.use;
         this.settings = builder.settings;
-        this.modules = builder.modules;
+        this.plugins = builder.plugins;
         this.scriptEvaluationTimeout = builder.scriptEvaluationTimeout;
         this.globalBindings = builder.globalBindings;
         this.enabledPlugins = builder.enabledPlugins;
@@ -426,14 +426,14 @@ public class GremlinExecutor implements AutoCloseable {
     }
 
     private void initializeGremlinScriptEngineManager() {
-        this.useGremlinScriptEngineManager = !modules.entrySet().isEmpty();
+        this.useGremlinScriptEngineManager = !plugins.entrySet().isEmpty();
 
-        for (Map.Entry<String, Map<String, Map<String,Object>>> config : modules.entrySet()) {
+        for (Map.Entry<String, Map<String, Map<String,Object>>> config : plugins.entrySet()) {
             final String language = config.getKey();
-            final Map<String, Map<String,Object>> moduleConfigs = config.getValue();
-            for (Map.Entry<String, Map<String,Object>> moduleConfig : moduleConfigs.entrySet()) {
+            final Map<String, Map<String,Object>> pluginConfigs = config.getValue();
+            for (Map.Entry<String, Map<String,Object>> pluginConfig : pluginConfigs.entrySet()) {
                 try {
-                    final Class<?> clazz = Class.forName(moduleConfig.getKey());
+                    final Class<?> clazz = Class.forName(pluginConfig.getKey());
 
                     // first try instance() and if that fails try to use build()
                     try {
@@ -441,29 +441,29 @@ public class GremlinExecutor implements AutoCloseable {
                         gremlinScriptEngineManager.addPlugin((GremlinPlugin) instanceMethod.invoke(null));
                     } catch (Exception ex) {
                         final Method builderMethod = clazz.getMethod("build");
-                        Object moduleBuilder = builderMethod.invoke(null);
+                        Object pluginBuilder = builderMethod.invoke(null);
 
-                        final Class<?> builderClazz = moduleBuilder.getClass();
-                        final Map<String, Object> customizerConfigs = moduleConfig.getValue();
+                        final Class<?> builderClazz = pluginBuilder.getClass();
+                        final Map<String, Object> customizerConfigs = pluginConfig.getValue();
                         final Method[] methods = builderClazz.getMethods();
                         for (Map.Entry<String, Object> customizerConfig : customizerConfigs.entrySet()) {
                             final Method configMethod = Stream.of(methods).filter(m -> m.getName().equals(customizerConfig.getKey())).findFirst()
                                     .orElseThrow(() -> new IllegalStateException("Could not find builder method on " + builderClazz.getCanonicalName()));
                             if (null == customizerConfig.getValue())
-                                moduleBuilder = configMethod.invoke(moduleBuilder);
+                                pluginBuilder = configMethod.invoke(pluginBuilder);
                             else
-                                moduleBuilder = configMethod.invoke(moduleBuilder, customizerConfig.getValue());
+                                pluginBuilder = configMethod.invoke(pluginBuilder, customizerConfig.getValue());
                         }
 
                         try {
                             final Method appliesTo = builderClazz.getMethod("appliesTo");
-                            moduleBuilder = appliesTo.invoke(moduleBuilder, language);
+                            pluginBuilder = appliesTo.invoke(pluginBuilder, language);
                         } catch (NoSuchMethodException ignored) {
 
                         }
 
                         final Method create = builderClazz.getMethod("create");
-                        gremlinScriptEngineManager.addPlugin((GremlinPlugin) create.invoke(moduleBuilder));
+                        gremlinScriptEngineManager.addPlugin((GremlinPlugin) create.invoke(pluginBuilder));
                     }
                 } catch (Exception ex) {
                     throw new IllegalStateException(ex);
@@ -569,7 +569,7 @@ public class GremlinExecutor implements AutoCloseable {
         private long scriptEvaluationTimeout = 8000;
         private Map<String, EngineSettings> settings = new HashMap<>();
 
-        private Map<String, Map<String, Map<String,Object>>> modules = new HashMap<>();
+        private Map<String, Map<String, Map<String,Object>>> plugins = new HashMap<>();
 
         private ExecutorService executorService = null;
         private ScheduledExecutorService scheduledExecutorService = null;
@@ -597,7 +597,7 @@ public class GremlinExecutor implements AutoCloseable {
          * @param scripts       A list of scripts to execute in the engine to initialize it.
          * @param config        Custom configuration map for the ScriptEngine
          *
-         * @deprecated As of release 3.2.4, replaced by {@link #addModules(String, Map)}.
+         * @deprecated As of release 3.2.4, replaced by {@link #addPlugins(String, Map)}.
          */
         @Deprecated
         public Builder addEngineSettings(final String engineName, final List<String> imports,
@@ -618,8 +618,8 @@ public class GremlinExecutor implements AutoCloseable {
          * is the name of a builder method on the {@link GremlinPlugin} and the value is some argument to pass to that
          * method.
          */
-        public Builder addModules(final String engineName, final Map<String, Map<String,Object>> modules) {
-            this.modules.put(engineName, modules);
+        public Builder addPlugins(final String engineName, final Map<String, Map<String,Object>> plugins) {
+            this.plugins.put(engineName, plugins);
             return this;
         }
 
@@ -649,7 +649,7 @@ public class GremlinExecutor implements AutoCloseable {
         /**
          * Replaces any settings provided.
          *
-         * @deprecated As of release 3.2.4, replaced by {@link #addModules(String, Map)}.
+         * @deprecated As of release 3.2.4, replaced by {@link #addPlugins(String, Map)}.
          */
         @Deprecated
         public Builder engineSettings(final Map<String, EngineSettings> settings) {
@@ -721,7 +721,7 @@ public class GremlinExecutor implements AutoCloseable {
         /**
          * Set of the names of plugins that should be enabled for the engine.
          *
-         * @deprecated As of release 3.2.4, replaced by {@link #addModules(String, Map)} though behavior is not quite
+         * @deprecated As of release 3.2.4, replaced by {@link #addPlugins(String, Map)} though behavior is not quite
          *             the same.
          */
         @Deprecated

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aee85b12/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java
index 75cff3b..97e2875 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java
@@ -260,7 +260,7 @@ public class Settings {
         scriptEngineSettingsDescription.putListPropertyType("staticImports", String.class);
         scriptEngineSettingsDescription.putListPropertyType("scripts", String.class);
         scriptEngineSettingsDescription.putMapPropertyType("config", String.class, Object.class);
-        scriptEngineSettingsDescription.putMapPropertyType("modules", String.class, Object.class);
+        scriptEngineSettingsDescription.putMapPropertyType("plugins", String.class, Object.class);
         constructor.addTypeDescription(scriptEngineSettingsDescription);
 
         final TypeDescription sslSettings = new TypeDescription(SslSettings.class);
@@ -343,7 +343,7 @@ public class Settings {
         /**
          * A set of configurations for {@link GremlinPlugin} instances to apply to this {@link GremlinScriptEngine}.
          */
-        public Map<String,Map<String,Object>> modules = new HashMap<>();
+        public Map<String,Map<String,Object>> plugins = new HashMap<>();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aee85b12/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
index 1204bee..2b2f1f1 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
@@ -127,8 +127,8 @@ public class ServerGremlinExecutor<T extends ScheduledExecutorService> {
                 .scheduledExecutorService(this.scheduledExecutorService);
 
         settings.scriptEngines.forEach((k, v) -> {
-            // use modules if they are present and the old approach if not
-            if (v.modules.isEmpty()) {
+            // use plugins if they are present and the old approach if not
+            if (v.plugins.isEmpty()) {
                 // make sure that server related classes are available at init - ultimately this body of code will be
                 // deleted when deprecation is removed
                 v.imports.add(LifeCycleHook.class.getCanonicalName());
@@ -137,7 +137,7 @@ public class ServerGremlinExecutor<T extends ScheduledExecutorService> {
             } else {
                 // make sure that server related classes are available at init - new approach. the LifeCycleHook stuff
                 // will be added explicitly via configuration using GremlinServerGremlinModule in the yaml
-                gremlinExecutorBuilder.addModules(k, v.modules);
+                gremlinExecutorBuilder.addPlugins(k, v.plugins);
             }
         });
 


[45/50] tinkerpop git commit: TINKERPOP-1562 Moved ScriptEngineCache to jsr223 package.

Posted by sp...@apache.org.
TINKERPOP-1562 Moved ScriptEngineCache to jsr223 package.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/ae45eca7
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/ae45eca7
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/ae45eca7

Branch: refs/heads/TINKERPOP-1562
Commit: ae45eca70de741a1a1872117e9f4f7dc3ddd6245
Parents: c2e71dc
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Dec 1 06:48:22 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:51 2016 -0500

----------------------------------------------------------------------
 .../gremlin/jsr223/ScriptEngineCache.java       | 54 ++++++++++++++++++++
 .../gremlin/util/ScriptEngineCache.java         |  4 +-
 .../gremlin/jsr223/ScriptEngineCacheTest.java   | 46 +++++++++++++++++
 .../python/jsr223/JythonScriptEngineSetup.java  |  2 +-
 .../python/jsr223/JythonTranslatorTest.java     | 10 ----
 .../jsr223/PythonGraphSONJavaTranslator.java    |  2 +-
 .../gremlin/python/jsr223/PythonProvider.java   |  5 +-
 7 files changed, 106 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ae45eca7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptEngineCache.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptEngineCache.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptEngineCache.java
new file mode 100644
index 0000000..9d2848d
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptEngineCache.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * A cache of standard {@code ScriptEngine} instances, instantiated by the standard {@code ScriptEngineManager}.
+ * These instances are NOT "Gremlin-enabled". See {@link SingleGremlinScriptEngineManager} for the analogous class
+ * that loads {@link GremlinScriptEngine} instances.
+ *
+ * @author Daniel Kuppitz (http://gremlin.guru)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class ScriptEngineCache {
+
+    private ScriptEngineCache() {}
+
+    public final static String DEFAULT_SCRIPT_ENGINE = "gremlin-groovy";
+
+    private final static ScriptEngineManager SCRIPT_ENGINE_MANAGER = new ScriptEngineManager();
+    private final static Map<String, ScriptEngine> CACHED_ENGINES = new ConcurrentHashMap<>();
+
+    public static ScriptEngine get(final String engineName) {
+        return CACHED_ENGINES.compute(engineName, (key, engine) -> {
+            if (null == engine) {
+                engine = SCRIPT_ENGINE_MANAGER.getEngineByName(engineName);
+                if (null == engine) {
+                    throw new IllegalArgumentException("There is no script engine with provided name: " + engineName);
+                }
+            }
+            return engine;
+        });
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ae45eca7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java
index 1ce7d05..dc4aeb7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java
@@ -28,12 +28,14 @@ import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * A cache of standard {@code ScriptEngine} instances, instantiated by the standard {@code ScriptEngineManager}.
- * These instances are not "Gremlin-enabled". See {@link SingleGremlinScriptEngineManager} for the analogous class
+ * These instances are NOT "Gremlin-enabled". See {@link SingleGremlinScriptEngineManager} for the analogous class
  * that loads {@link GremlinScriptEngine} instances.
  *
  * @author Daniel Kuppitz (http://gremlin.guru)
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.ScriptEngineCache}.
  */
+@Deprecated
 public final class ScriptEngineCache {
 
     private ScriptEngineCache() {}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ae45eca7/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptEngineCacheTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptEngineCacheTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptEngineCacheTest.java
new file mode 100644
index 0000000..7cdbdc2
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptEngineCacheTest.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import org.apache.tinkerpop.gremlin.TestHelper;
+import org.junit.Test;
+
+import static org.junit.Assert.assertSame;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class ScriptEngineCacheTest {
+
+    @Test
+    public void shouldBeUtilityClass() throws Exception {
+        TestHelper.assertIsUtilityClass(ScriptEngineCache.class);
+    }
+
+    @Test
+    public void shouldGetEngineFromCache() {
+        assertSame(ScriptEngineCache.get("nashorn"), ScriptEngineCache.get("nashorn"));
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void shouldThrowWhenScripEngineDoesNotExist() {
+        ScriptEngineCache.get("junk-that-no-one-would-ever-call-a-script-engine-83939473298432");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ae45eca7/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonScriptEngineSetup.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonScriptEngineSetup.java b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonScriptEngineSetup.java
index a16ce30..a4fe1ed 100644
--- a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonScriptEngineSetup.java
+++ b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonScriptEngineSetup.java
@@ -19,7 +19,7 @@
 
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
-import org.apache.tinkerpop.gremlin.util.ScriptEngineCache;
+import org.apache.tinkerpop.gremlin.jsr223.ScriptEngineCache;
 import org.python.jsr223.PyScriptEngine;
 
 import javax.script.ScriptException;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ae45eca7/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java
index 8bd3265..5a6e30d 100644
--- a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java
+++ b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java
@@ -19,26 +19,16 @@
 
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
-import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.TranslationStrategy;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
-import org.apache.tinkerpop.gremlin.util.ScriptEngineCache;
 import org.apache.tinkerpop.gremlin.util.function.Lambda;
 import org.junit.Test;
 
-import javax.script.Bindings;
-import javax.script.SimpleBindings;
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ae45eca7/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonGraphSONJavaTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonGraphSONJavaTranslator.java b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonGraphSONJavaTranslator.java
index cdeb407..740fe1f 100644
--- a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonGraphSONJavaTranslator.java
+++ b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonGraphSONJavaTranslator.java
@@ -20,6 +20,7 @@
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
 import org.apache.tinkerpop.gremlin.jsr223.JavaTranslator;
+import org.apache.tinkerpop.gremlin.jsr223.ScriptEngineCache;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
@@ -28,7 +29,6 @@ import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONVersion;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONXModuleV2d0;
-import org.apache.tinkerpop.gremlin.util.ScriptEngineCache;
 
 import javax.script.Bindings;
 import javax.script.ScriptContext;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ae45eca7/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonProvider.java b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonProvider.java
index fe04156..9e03884 100644
--- a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonProvider.java
+++ b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonProvider.java
@@ -23,12 +23,10 @@ import org.apache.commons.configuration.Configuration;
 import org.apache.tinkerpop.gremlin.AbstractGraphProvider;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.jsr223.JavaTranslator;
+import org.apache.tinkerpop.gremlin.jsr223.ScriptEngineCache;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionComputerTest;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionTest;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.PageRankTest;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.PeerPressureTest;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProfileTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProgramTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ElementIdStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest;
@@ -42,7 +40,6 @@ import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraphVariables;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerProperty;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertexProperty;
-import org.apache.tinkerpop.gremlin.util.ScriptEngineCache;
 
 import javax.script.ScriptException;
 import java.util.Arrays;


[48/50] tinkerpop git commit: TINKERPOP-1562 Deprecated the DependencyManager.

Posted by sp...@apache.org.
TINKERPOP-1562 Deprecated the DependencyManager.

This interface really isn't useful anymore. It is bound to ScriptEngines class which is also deprecated. The new model of the GremlinScriptEngine in gremlin-core sorta makes this obsolete.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/aa4a70a4
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/aa4a70a4
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/aa4a70a4

Branch: refs/heads/TINKERPOP-1562
Commit: aa4a70a47c9c7b400983fb2fd55730b686cceea9
Parents: 338002a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Dec 1 10:19:40 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:51 2016 -0500

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/groovy/jsr223/DependencyManager.java | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aa4a70a4/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/DependencyManager.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/DependencyManager.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/DependencyManager.java
index 5c1b8fe..4f1384d 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/DependencyManager.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/DependencyManager.java
@@ -22,6 +22,7 @@ import org.apache.tinkerpop.gremlin.groovy.ImportCustomizerProvider;
 import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin;
 import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPluginException;
 import org.apache.tinkerpop.gremlin.groovy.plugin.PluginAcceptor;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine;
 
 import java.util.List;
 import java.util.Map;
@@ -33,7 +34,9 @@ import java.util.Set;
  * so this interface makes that possible to expose.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, not replaced - no longer needed under the new {@link GremlinScriptEngine} model.
  */
+@Deprecated
 public interface DependencyManager {
     /**
      * Take maven coordinates and load the classes into the classloader used by the ScriptEngine.  Those ScriptEngines


[15/50] tinkerpop git commit: TINKERPOP-1562 Move RemoteAcceptor related stuff to gremlin-core.

Posted by sp...@apache.org.
TINKERPOP-1562 Move RemoteAcceptor related stuff to gremlin-core.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d7d6d5b2
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d7d6d5b2
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d7d6d5b2

Branch: refs/heads/TINKERPOP-1562
Commit: d7d6d5b2b8788fa420223d8986c27c535255494c
Parents: 8ee2225
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 13:13:30 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:50 2016 -0500

----------------------------------------------------------------------
 .../console/jsr223/GephiRemoteAcceptor.groovy   | 372 +++++++++++++++++++
 .../console/plugin/GephiRemoteAcceptor.groovy   |   1 +
 .../tinkerpop/gremlin/jsr223/GremlinModule.java |   9 +
 .../gremlin/jsr223/ImportGremlinModule.java     |   1 -
 .../gremlin/jsr223/RemoteAcceptor.java          |  81 ++++
 .../gremlin/jsr223/RemoteException.java         |  40 ++
 .../gremlin/groovy/plugin/RemoteAcceptor.java   |   2 +
 .../gremlin/groovy/plugin/RemoteException.java  |   2 +
 8 files changed, 507 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d7d6d5b2/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
new file mode 100644
index 0000000..11e1e5c
--- /dev/null
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
@@ -0,0 +1,372 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.console.jsr223
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import groovy.transform.CompileStatic
+import org.apache.http.client.methods.CloseableHttpResponse
+import org.apache.http.client.methods.HttpUriRequest
+import org.apache.http.client.methods.RequestBuilder
+import org.apache.http.entity.StringEntity
+import org.apache.http.impl.client.CloseableHttpClient
+import org.apache.http.impl.client.HttpClients
+import org.apache.http.util.EntityUtils
+import org.apache.tinkerpop.gremlin.console.plugin.GephiTraversalVisualizationStrategy
+import org.apache.tinkerpop.gremlin.jsr223.RemoteAcceptor
+import org.apache.tinkerpop.gremlin.jsr223.RemoteException
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource
+import org.apache.tinkerpop.gremlin.structure.Edge
+import org.apache.tinkerpop.gremlin.structure.Graph
+import org.apache.tinkerpop.gremlin.structure.Vertex
+import org.codehaus.groovy.tools.shell.Groovysh
+import org.codehaus.groovy.tools.shell.IO
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @author Randall Barnhart (randompi@gmail.com)
+ */
+class GephiRemoteAcceptor implements RemoteAcceptor {
+
+    private String host = "localhost"
+    private int port = 8080
+    private String workspace = "workspace1"
+
+    private final Groovysh shell
+    private final IO io
+
+    private final Random rand = new Random();
+    boolean traversalSubmittedForViz = false
+    long vizStepDelay
+    private float[] vizStartRGBColor
+    private float[] vizDefaultRGBColor
+    private char vizColorToFade
+    private float vizColorFadeRate
+    private float vizStartSize
+    private float vizSizeDecrementRate
+    private Map vertexAttributes = [:]
+
+    private CloseableHttpClient httpclient = HttpClients.createDefault();
+
+    public GephiRemoteAcceptor(final Groovysh shell, final IO io) {
+        this.shell = shell
+        this.io = io
+
+        // traversal visualization defaults
+        vizStepDelay = 1000;                 // 1 second pause between viz of steps
+        vizStartRGBColor = [0.0f, 1.0f, 0.5f]  // light aqua green
+        vizDefaultRGBColor = [0.6f, 0.6f, 0.6f]  // light grey
+        vizColorToFade = 'g'                 // will fade so blue is strongest
+        vizColorFadeRate = 0.7               // the multiplicative rate to fade visited vertices
+        vizStartSize = 10
+        vizSizeDecrementRate = 0.33f
+    }
+
+    @Override
+    connect(final List<String> args) throws RemoteException {
+        if (args.size() >= 1)
+            workspace = args[0]
+
+        if (args.size() >= 2)
+            host = args[1]
+
+        if (args.size() >= 3) {
+            try {
+                port = Integer.parseInt(args[2])
+            } catch (Exception ex) {
+                throw new RemoteException("Port must be an integer value")
+            }
+        }
+
+        def vizConfig = " with stepDelay:$vizStepDelay, startRGBColor:$vizStartRGBColor, " +
+                "colorToFade:$vizColorToFade, colorFadeRate:$vizColorFadeRate, startSize:$vizStartSize," +
+                "sizeDecrementRate:$vizSizeDecrementRate"
+
+        return "Connection to Gephi - http://$host:$port/$workspace" + vizConfig
+    }
+
+    @Override
+    Object configure(final List<String> args) throws RemoteException {
+        if (args.size() < 2)
+            throw new RemoteException("Invalid config arguments - check syntax")
+
+        if (args[0] == "host")
+            host = args[1]
+        else if (args[0] == "port") {
+            try {
+                port = Integer.parseInt(args[1])
+            } catch (Exception ignored) {
+                throw new RemoteException("Port must be an integer value")
+            }
+        } else if (args[0] == "workspace")
+            workspace = args[1]
+        else if (args[0] == "stepDelay")
+            parseVizStepDelay(args[1])
+        else if (args[0] == "startRGBColor")
+            parseVizStartRGBColor(args[1])
+        else if (args[0] == "colorToFade")
+            parseVizColorToFade(args[1])
+        else if (args[0] == "colorFadeRate")
+            parseVizColorFadeRate(args[1])
+        else if (args[0] == "sizeDecrementRate")
+            parseVizSizeDecrementRate(args[1])
+        else if (args[0] == "startSize")
+            parseVizStartSize(args[1])
+        else if (args[0] == "visualTraversal") {
+            def graphVar = shell.interp.context.getVariable(args[1])
+            if (!(graphVar instanceof Graph))
+                throw new RemoteException("Invalid argument to 'visualTraversal' - first parameter must be a Graph instance")
+
+            def gVar = args.size() == 3 ? args[2] : "vg"
+            def theG = GraphTraversalSource.build().with(new GephiTraversalVisualizationStrategy(this)).create(graphVar)
+            shell.interp.context.setVariable(gVar, theG)
+        } else
+            throw new RemoteException("Invalid config arguments - check syntax")
+
+        return "Connection to Gephi - http://$host:$port/$workspace" +
+                " with stepDelay:$vizStepDelay, startRGBColor:$vizStartRGBColor, " +
+                "colorToFade:$vizColorToFade, colorFadeRate:$vizColorFadeRate, startSize:$vizStartSize," +
+                "sizeDecrementRate:$vizSizeDecrementRate"
+    }
+
+    @Override
+    @CompileStatic
+    Object submit(final List<String> args) throws RemoteException {
+        final String line = String.join(" ", args)
+        if (line.trim() == "clear") {
+            clearGraph()
+            io.out.println("Gephi workspace cleared")
+            return
+        }
+
+        // need to clear the vertex attributes
+        vertexAttributes.clear()
+
+        // this tells the GraphTraversalVisualizationStrategy that if the line eval's to a traversal it should
+        // try to visualize it
+        traversalSubmittedForViz = true
+
+        // get the colors/sizes back to basics before trying visualize
+        resetColorsSizes()
+
+        final Object o = shell.execute(line)
+        if (o instanceof Graph) {
+            clearGraph()
+            def graph = (Graph) o
+            def g = graph.traversal()
+            g.V().sideEffect { addVertexToGephi(g, it.get()) }.iterate()
+        }
+
+        traversalSubmittedForViz = false
+    }
+
+    @Override
+    void close() throws IOException {
+        httpclient.close()
+    }
+
+    /**
+     * Visits the last set of vertices traversed and degrades their color and size.
+     */
+    def updateVisitedVertices(def List except = []) {
+        vertexAttributes.keySet().findAll{ vertexId -> !except.contains(vertexId) }.each { String vertexId ->
+            def attrs = vertexAttributes[vertexId]
+            float currentColor = attrs.color
+            currentColor *= vizColorFadeRate
+
+            int currentSize = attrs["size"]
+            currentSize = Math.max(vizStartSize, currentSize - (currentSize * vizSizeDecrementRate))
+
+            vertexAttributes.get(vertexId).color = currentColor
+            vertexAttributes.get(vertexId).size = currentSize
+
+            changeVertexAttributes(vertexId)
+        }
+    }
+
+    def changeVertexAttributes(def String vertexId) {
+        def props = [:]
+        props.put(vizColorToFade.toString(), vertexAttributes[vertexId].color)
+        props.put("size", vertexAttributes[vertexId].size)
+        updateGephiGraph([cn: [(vertexId): props]])
+    }
+
+    /**
+     * Visit a vertex traversed and initialize its color and size.
+     */
+    def visitVertexInGephi(def Vertex v) {
+        def props = [:]
+        props.put('r', vizStartRGBColor[0])
+        props.put('g', vizStartRGBColor[1])
+        props.put('b', vizStartRGBColor[2])
+        props.put('size', vizStartSize * 2.5)
+        props.put('visited', 1)
+
+        updateGephiGraph([cn: [(v.id().toString()): props]])
+
+        vertexAttributes[v.id().toString()] = [color: vizStartRGBColor[fadeColorIndex()], size: vizStartSize * 2.5, touch: 1]
+    }
+
+    def fadeColorIndex() {
+        if (vizColorToFade == 'r')
+            return 0
+        else if (vizColorToFade == 'g')
+            return 1
+        else if (vizColorToFade == 'b')
+            return 2
+    }
+
+    def addVertexToGephi(def GraphTraversalSource g, def Vertex v, def boolean ignoreEdges = false) {
+        // grab the first property value from the strategies of values
+        def props = g.V(v).valueMap().next().collectEntries { kv -> [(kv.key): kv.value[0]] }
+        props << [label: v.label()]
+        props.put('r', vizDefaultRGBColor[0])
+        props.put('g', vizDefaultRGBColor[1])
+        props.put('b', vizDefaultRGBColor[2])
+        props.put('x', rand.nextFloat())
+        props.put('y', rand.nextFloat())
+        props.put('size', 10)
+        props.put('visited', 0)
+
+        // only add if it does not exist in graph already
+        if (!getFromGephiGraph([operation: "getNode", id: v.id().toString()]).isPresent())
+            updateGephiGraph([an: [(v.id().toString()): props]])
+
+        if (!ignoreEdges) {
+            g.V(v).outE().sideEffect {
+                addEdgeToGephi(g, it.get())
+            }.iterate()
+        }
+    }
+
+    @CompileStatic
+    def addEdgeToGephi(def GraphTraversalSource g, def Edge e) {
+        def props = g.E(e).valueMap().next()
+        props.put('label', e.label())
+        props.put('source', e.outVertex().id().toString())
+        props.put('target', e.inVertex().id().toString())
+        props.put('directed', true)
+        props.put('visited', 0)
+
+        // make sure the in vertex is there but don't add its edges - that will happen later as we are looping
+        // all vertices in the graph
+        addVertexToGephi(g, e.inVertex(), true)
+
+        // both vertices are definitely there now, so add the edge
+        updateGephiGraph([ae: [(e.id().toString()): props]])
+    }
+
+    def clearGraph() {
+        updateGephiGraph([dn: [filter: "ALL"]])
+    }
+
+    def resetColorsSizes() {
+        updateGephiGraph([cn: [filter: [nodeAttribute: [attribute: "visited", value: 1]],
+                               attributes: [size: 1, r: vizDefaultRGBColor[0], g: vizDefaultRGBColor[1], b: vizDefaultRGBColor[2]]]])
+        updateGephiGraph([ce: [filter: [edgeAttribute: [attribute: "visited", value: 1]],
+                               attributes: [size: 1, r: vizDefaultRGBColor[0], g: vizDefaultRGBColor[1], b: vizDefaultRGBColor[2]]]])
+    }
+
+    def getFromGephiGraph(def Map queryArgs) {
+        def requestBuilder = RequestBuilder.get("http://$host:$port/$workspace")
+        queryArgs.each { requestBuilder = requestBuilder.addParameter(it.key, it.value) }
+
+        def httpResp = makeRequest(requestBuilder.build())
+        def resp = EntityUtils.toString(httpResp.entity)
+
+        // gephi streaming plugin does not set the content type or respect the Accept header - treat as text
+        if (resp.isEmpty())
+            return Optional.empty()
+        else
+            return Optional.of(new JsonSlurper().parseText(resp))
+    }
+
+    def updateGephiGraph(def Map postBody) {
+        def requestBuilder = RequestBuilder.post("http://$host:$port/$workspace")
+                                           .addParameter("format", "JSON")
+                                           .addParameter("operation", "updateGraph")
+                                           .setEntity(new StringEntity(JsonOutput.toJson(postBody)))
+        EntityUtils.consume(makeRequest(requestBuilder.build()).entity)
+    }
+
+    private CloseableHttpResponse makeRequest(HttpUriRequest request) {
+        def httpResp = httpclient.execute(request)
+        if (httpResp.getStatusLine().getStatusCode() == 200) {
+            return httpResp
+        } else {
+            def resp = EntityUtils.toString(httpResp.entity)
+            throw new RuntimeException("Unsuccessful request to Gephi - [${httpResp.getStatusLine().getStatusCode()}] ${httpResp.getStatusLine().getReasonPhrase()} - $resp")
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "Gephi - [$workspace]"
+    }
+
+    private void parseVizStepDelay(String arg) {
+        try {
+            vizStepDelay = Long.parseLong(arg)
+        } catch (Exception ignored) {
+            throw new RemoteException("The stepDelay must be a long value")
+        }
+    }
+
+    private void parseVizStartRGBColor(String arg) {
+        try {
+            vizStartRGBColor = arg[1..-2].tokenize(',')*.toFloat()
+            assert (vizStartRGBColor.length == 3)
+        } catch (Exception ignored) {
+            throw new RemoteException("The vizStartRGBColor must be an array of 3 float values, e.g. [0.0,1.0,0.5]")
+        }
+    }
+
+    private void parseVizColorToFade(String arg) {
+        try {
+            vizColorToFade = arg.charAt(0).toLowerCase();
+            assert (vizColorToFade == 'r' || vizColorToFade == 'g' || vizColorToFade == 'b')
+        } catch (Exception ignored) {
+            throw new RemoteException("The vizColorToFade must be one character value among: r, g, b, R, G, B")
+        }
+    }
+
+    private void parseVizColorFadeRate(String arg) {
+        try {
+            vizColorFadeRate = Float.parseFloat(arg)
+        } catch (Exception ignored) {
+            throw new RemoteException("The colorFadeRate must be a float value")
+        }
+    }
+
+    private void parseVizSizeDecrementRate(String arg) {
+        try {
+            vizSizeDecrementRate = Float.parseFloat(arg)
+        } catch (Exception ignored) {
+            throw new RemoteException("The sizeDecrementRate must be a float value")
+        }
+    }
+
+    private void parseVizStartSize(String arg) {
+        try {
+            vizStartSize = Float.parseFloat(arg)
+        } catch (Exception ignored) {
+            throw new RemoteException("The startSize must be a float value")
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d7d6d5b2/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy
index 4198444..30527a4 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy
@@ -40,6 +40,7 @@ import org.codehaus.groovy.tools.shell.IO
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  * @author Randall Barnhart (randompi@gmail.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.console.jsr223.GephiRemoteAcceptor}
  */
 class GephiRemoteAcceptor implements RemoteAcceptor {
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d7d6d5b2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java
index 20e9ff8..1077cf3 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java
@@ -58,4 +58,13 @@ public interface GremlinModule {
      * @param scriptEngineName The name of the {@code ScriptEngine} or null to get all the available {@code Customizers}
      */
     public Optional<Customizer[]> getCustomizers(final String scriptEngineName);
+
+    /**
+     * Allows a plugin to utilize features of the {@code :remote} and {@code :submit} commands of the Gremlin Console.
+     * This method does not need to be implemented if the plugin is not meant for the Console for some reason or
+     * if it does not intend to take advantage of those commands.
+     */
+    public default Optional<RemoteAcceptor> remoteAcceptor() {
+        return Optional.empty();
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d7d6d5b2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModule.java
index 9fcbbce..e9ca477 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModule.java
@@ -23,7 +23,6 @@ import java.lang.reflect.Modifier;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Optional;
 import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d7d6d5b2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteAcceptor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteAcceptor.java
new file mode 100644
index 0000000..f917c09
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteAcceptor.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import java.io.Closeable;
+import java.util.List;
+
+/**
+ * The Gremlin Console supports the {@code :remote} and {@code :submit} commands which provide standardized ways
+ * for plugins to provide "remote connections" to resources and a way to "submit" a command to those resources.
+ * A "remote connection" does not necessarily have to be a remote server.  It simply refers to a resource that is
+ * external to the console.
+ * <p/>
+ * By implementing this interface and returning an instance of it through {@link GremlinModule#remoteAcceptor()} a
+ * plugin can hook into those commands and provide remoting features.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface RemoteAcceptor extends Closeable {
+
+    public static final String RESULT = "result";
+
+    /**
+     * Gets called when {@code :remote} is used in conjunction with the "connect" option.  It is up to the
+     * implementation to decide how additional arguments on the line should be treated after "connect".
+     *
+     * @return an object to display as output to the user
+     * @throws RemoteException if there is a problem with connecting
+     */
+    public Object connect(final List<String> args) throws RemoteException;
+
+    /**
+     * Gets called when {@code :remote} is used in conjunction with the {@code config} option.  It is up to the
+     * implementation to decide how additional arguments on the line should be treated after {@code config}.
+     *
+     * @return an object to display as output to the user
+     * @throws RemoteException if there is a problem with configuration
+     */
+    public Object configure(final List<String> args) throws RemoteException;
+
+    /**
+     * Gets called when {@code :submit} is executed.  It is up to the implementation to decide how additional
+     * arguments on the line should be treated after {@code :submit}.
+     *
+     * @return an object to display as output to the user
+     * @throws RemoteException if there is a problem with submission
+     */
+    public Object submit(final List<String> args) throws RemoteException;
+
+    /**
+     * If the {@code RemoteAcceptor} is used in the Gremlin Console, then this method might be called to determine
+     * if it can be used in a fashion that supports the {@code :remote console} command.  By default, this value is
+     * set to {@code false}.
+     * <p/>
+     * A {@code RemoteAcceptor} should only return {@code true} for this method if it expects that all activities it
+     * supports are executed through the {@code :sumbit} command. If the users interaction with the remote requires
+     * working with both local and remote evaluation at the same time, it is likely best to keep this method return
+     * {@code false}. A good example of this type of plugin would be the Gephi Plugin which uses {@code :remote config}
+     * to configure a local {@code TraversalSource} to be used and expects calls to {@code :submit} for the same body
+     * of analysis.
+     */
+    public default boolean allowRemoteConsole() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d7d6d5b2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteException.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteException.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteException.java
new file mode 100644
index 0000000..a75e6d6
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteException.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+/**
+ * A mapper {@code Exception} to be thrown when there are problems with processing a command given to a
+ * {@link RemoteAcceptor}.  The message provided to the exception will
+ * be displayed to the user in the Console.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class RemoteException extends Exception {
+    public RemoteException(final String message) {
+        super(message);
+    }
+
+    public RemoteException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public RemoteException(final Throwable cause) {
+        super(cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d7d6d5b2/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteAcceptor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteAcceptor.java
index 0cf8bac..b3d03fe 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteAcceptor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteAcceptor.java
@@ -33,7 +33,9 @@ import java.util.List;
  * plugin can hook into those commands and provide remoting features.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.RemoteAcceptor};
  */
+@Deprecated
 public interface RemoteAcceptor extends Closeable {
 
     public static final String RESULT = "result";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d7d6d5b2/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteException.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteException.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteException.java
index 62efda5..f41d123 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteException.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteException.java
@@ -24,7 +24,9 @@ package org.apache.tinkerpop.gremlin.groovy.plugin;
  * be displayed to the user in the Console.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.RemoteException};
  */
+@Deprecated
 public class RemoteException extends Exception {
     public RemoteException(final String message) {
         super(message);


[35/50] tinkerpop git commit: TINKERPOP=1562 Loaded "gremlin" imports in the scriptengines

Posted by sp...@apache.org.
TINKERPOP=1562 Loaded "gremlin" imports in the scriptengines

Rather than load them in the DefaultGremlinScriptEngineManager it seemed better to get them loaded in the engines themselves that way if someone opted to construct the GremlinScriptEngine directly the imports would be present.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/80f79bcc
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/80f79bcc
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/80f79bcc

Branch: refs/heads/TINKERPOP-1562
Commit: 80f79bcc4d296662faf0e5296607f274ac9e3ab5
Parents: 9f33bee
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 28 16:51:12 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:50 2016 -0500

----------------------------------------------------------------------
 .../tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java      |  3 ++-
 .../jsr223/DefaultGremlinScriptEngineManager.java        |  3 ---
 .../gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java |  8 ++++++--
 .../gremlin/python/jsr223/GremlinJythonScriptEngine.java | 11 ++++++-----
 .../gremlin/jsr223/GremlinEnabledScriptEngineTest.java   |  5 ++---
 5 files changed, 16 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80f79bcc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
index d579691..a3063cf 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
@@ -24,7 +24,8 @@ import java.util.Optional;
 
 /**
  * This module is required for a {@code ScriptEngine} to be Gremlin-enabled. This {@link GremlinPlugin} is not enabled
- * for the {@code ServiceLoader}. It is designed to be instantiated manually.
+ * for the {@code ServiceLoader}. It is designed to be instantiated manually and compliant {@link GremlinScriptEngine}
+ * instances will automatically install it by default when created.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80f79bcc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
index 1484f90..34ef995 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
@@ -404,9 +404,6 @@ public class DefaultGremlinScriptEngineManager implements GremlinScriptEngineMan
     }
 
     private void initEngines(final ClassLoader loader) {
-        // always need this module for a scriptengine to be "Gremlin-enabled"
-        plugins.add(CoreGremlinPlugin.instance());
-
         Iterator<GremlinScriptEngineFactory> itty;
         try {
             final ServiceLoader<GremlinScriptEngineFactory> sl = AccessController.doPrivileged(

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80f79bcc/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 3ce400e..264587a 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -38,6 +38,7 @@ import org.apache.tinkerpop.gremlin.groovy.loaders.GremlinLoader;
 import org.apache.tinkerpop.gremlin.groovy.plugin.Artifact;
 import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin;
 import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPluginException;
+import org.apache.tinkerpop.gremlin.jsr223.CoreGremlinPlugin;
 import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngineFactory;
@@ -184,7 +185,7 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
      * Creates a new instance using the {@link DefaultImportCustomizerProvider}.
      */
     public GremlinGroovyScriptEngine() {
-        this((CompilerCustomizerProvider) new DefaultImportCustomizerProvider());
+        this(new Customizer[0]);
     }
 
     /**
@@ -196,7 +197,10 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
     }
 
     public GremlinGroovyScriptEngine(final Customizer... customizers) {
-        final List<Customizer> listOfCustomizers = Arrays.asList(customizers);
+        final List<Customizer> listOfCustomizers = new ArrayList<>(Arrays.asList(customizers));
+
+        // always need this plugin for a scriptengine to be "Gremlin-enabled"
+        CoreGremlinPlugin.instance().getCustomizers("gremlin-groovy").ifPresent(c -> listOfCustomizers.addAll(Arrays.asList(c)));
 
         GremlinLoader.load();
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80f79bcc/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
index 1b95a02..1a4b57a 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
@@ -19,6 +19,7 @@
 
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
+import org.apache.tinkerpop.gremlin.jsr223.CoreGremlinPlugin;
 import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngineFactory;
@@ -27,7 +28,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.util.CoreImports;
 import org.python.jsr223.PyScriptEngine;
 import org.python.jsr223.PyScriptEngineFactory;
@@ -37,12 +37,10 @@ import javax.script.ScriptContext;
 import javax.script.ScriptException;
 import java.io.Reader;
 import java.lang.reflect.Method;
+import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.stream.Collectors;
 
 /**
@@ -82,7 +80,10 @@ public class GremlinJythonScriptEngine implements GremlinScriptEngine {
 
     public GremlinJythonScriptEngine(final Customizer... customizers) {
         this.pyScriptEngine = (PyScriptEngine) new PyScriptEngineFactory().getScriptEngine();
-        final List<Customizer> listOfCustomizers = Arrays.asList(customizers);
+        final List<Customizer> listOfCustomizers = new ArrayList<>(Arrays.asList(customizers));
+
+        // always need this plugin for a scriptengine to be "Gremlin-enabled"
+        CoreGremlinPlugin.instance().getCustomizers("gremlin-groovy").ifPresent(c -> listOfCustomizers.addAll(Arrays.asList(c)));
 
         final List<ImportCustomizer> importCustomizers = listOfCustomizers.stream()
                 .filter(p -> p instanceof ImportCustomizer)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80f79bcc/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
index 8fa70b0..5a880f8 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
@@ -82,12 +82,11 @@ public class GremlinEnabledScriptEngineTest {
     }
 
     @Test
-    public void shouldReturnOneCustomizers() {
-        // just returns the core plugin as the other assigned plugin doesn't match the tested engine
+    public void shouldReturnNoCustomizers() {
         final GremlinScriptEngineManager mgr = new DefaultGremlinScriptEngineManager();
         mgr.addPlugin(ImportGremlinPlugin.build()
                 .classImports(java.awt.Color.class)
                 .appliesTo(Collections.singletonList("fake-script-engine")).create());
-        assertEquals(1, mgr.getCustomizers(ENGINE_TO_TEST).size());
+        assertEquals(0, mgr.getCustomizers(ENGINE_TO_TEST).size());
     }
 }


[09/50] tinkerpop git commit: TINKERPOP-1562 Moved GremlinServerGremlinModule to standard directory structure

Posted by sp...@apache.org.
TINKERPOP-1562 Moved GremlinServerGremlinModule to standard directory structure


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a596da34
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a596da34
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a596da34

Branch: refs/heads/TINKERPOP-1562
Commit: a596da3490f271ca6787d3c10444b6b2f099bb4d
Parents: 299ad1c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 07:55:27 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:50 2016 -0500

----------------------------------------------------------------------
 .../jsr223/GremlinServerGremlinModule.java      | 42 ++++++++++++++++++++
 .../server/util/GremlinServerGremlinModule.java | 41 -------------------
 2 files changed, 42 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a596da34/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinModule.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinModule.java
new file mode 100644
index 0000000..b161f69
--- /dev/null
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinModule.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.server.jsr223;
+
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinModule;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinModule;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.server.util.LifeCycleHook;
+
+/**
+ * A {@link GremlinModule} implementation that adds Gremlin Server specific classes to the imports.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class GremlinServerGremlinModule extends AbstractGremlinModule {
+    private static final String MODULE_NAME = "tinkerpop.server";
+    private static final GremlinServerGremlinModule instance = new GremlinServerGremlinModule();
+
+    private GremlinServerGremlinModule() {
+        super(MODULE_NAME, ImportCustomizer.build().addClassImports(LifeCycleHook.class, LifeCycleHook.Context.class).create());
+    }
+
+    public static GremlinServerGremlinModule instance() {
+        return instance;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a596da34/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/GremlinServerGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/GremlinServerGremlinModule.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/GremlinServerGremlinModule.java
deleted file mode 100644
index 863c640..0000000
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/GremlinServerGremlinModule.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.server.util;
-
-import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinModule;
-import org.apache.tinkerpop.gremlin.jsr223.GremlinModule;
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
-
-/**
- * A {@link GremlinModule} implementation that adds Gremlin Server specific classes to the imports.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public final class GremlinServerGremlinModule extends AbstractGremlinModule {
-    private static final String MODULE_NAME = "tinkerpop.server";
-    private static final GremlinServerGremlinModule instance = new GremlinServerGremlinModule();
-
-    public GremlinServerGremlinModule() {
-        super(MODULE_NAME, ImportCustomizer.build().addClassImports(LifeCycleHook.class, LifeCycleHook.Context.class).create());
-    }
-
-    public static GremlinServerGremlinModule instance() {
-        return instance;
-    }
-}


[43/50] tinkerpop git commit: TINKERPOP-1562 Hook up Console to do core imports under v3d3

Posted by sp...@apache.org.
TINKERPOP-1562 Hook up Console to do core imports under v3d3


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/83689211
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/83689211
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/83689211

Branch: refs/heads/TINKERPOP-1562
Commit: 83689211d05905fb4fd31375a8db225200a72ae5
Parents: 6d1b97e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Nov 30 07:28:37 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:50 2016 -0500

----------------------------------------------------------------------
 .../tinkerpop/gremlin/console/Console.groovy    | 21 +++++++++++++-------
 .../ConsoleImportCustomizerProvider.groovy      |  2 ++
 2 files changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/83689211/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
index d39e085..a2e518c 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
@@ -31,6 +31,8 @@ import org.apache.tinkerpop.gremlin.console.commands.UninstallCommand
 import org.apache.tinkerpop.gremlin.console.plugin.PluggedIn
 import org.apache.tinkerpop.gremlin.groovy.loaders.GremlinLoader
 import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin
+import org.apache.tinkerpop.gremlin.jsr223.CoreGremlinPlugin
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalExplanation
 import org.apache.tinkerpop.gremlin.structure.Edge
 import org.apache.tinkerpop.gremlin.structure.T
@@ -103,13 +105,18 @@ class Console {
         // hide output temporarily while imports execute
         showShellEvaluationOutput(false)
 
-        // TODO: register CoreGremlinPlugin if using v3d3
-
-        // add the default imports
-        new ConsoleImportCustomizerProvider().getCombinedImports().stream()
-                .collect { IMPORT_SPACE + it }.each { groovy.execute(it) }
-        new ConsoleImportCustomizerProvider().getCombinedStaticImports().stream()
-                .collect { IMPORT_STATIC_SPACE + it }.each { groovy.execute(it) }
+        if (Mediator.useV3d3) {
+            def imports = (ImportCustomizer) CoreGremlinPlugin.instance().getCustomizers("gremlin-groovy").get()[0]
+            imports.classImports.collect { IMPORT_SPACE + it.canonicalName }.each { groovy.execute(it) }
+            imports.methodImports.collect { IMPORT_STATIC_SPACE + it.getDeclaringClass().getCanonicalName() + "." + it.name}.each{ groovy.execute(it) }
+            imports.enumImports.collect { IMPORT_STATIC_SPACE + it.getDeclaringClass().getCanonicalName() + "." + it.name()}.each{ groovy.execute(it) }
+        } else {
+            // add the default imports
+            new ConsoleImportCustomizerProvider().getCombinedImports().stream()
+                    .collect { IMPORT_SPACE + it }.each { groovy.execute(it) }
+            new ConsoleImportCustomizerProvider().getCombinedStaticImports().stream()
+                    .collect { IMPORT_STATIC_SPACE + it }.each { groovy.execute(it) }
+        }
 
         final InteractiveShellRunner runner = new InteractiveShellRunner(groovy, handlePrompt)
         runner.setErrorHandler(handleError)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/83689211/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/ConsoleImportCustomizerProvider.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/ConsoleImportCustomizerProvider.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/ConsoleImportCustomizerProvider.groovy
index 0404e93..85fda8c 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/ConsoleImportCustomizerProvider.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/ConsoleImportCustomizerProvider.groovy
@@ -23,7 +23,9 @@ import groovy.sql.Sql
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, not replaced.
  */
+@Deprecated
 class ConsoleImportCustomizerProvider extends AbstractImportCustomizerProvider {
     public ConsoleImportCustomizerProvider() {
         // useful groovy bits that are good for the Console


[23/50] tinkerpop git commit: TINKERPOP-1562 Add new HadoopGremlinPlugin and deprecated the old.

Posted by sp...@apache.org.
TINKERPOP-1562 Add new HadoopGremlinPlugin and deprecated the old.

Had to add some capabilities to plugin system to allow for passing of console environment bits (like groovysh for example).


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d0c941e8
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d0c941e8
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d0c941e8

Branch: refs/heads/TINKERPOP-1562
Commit: d0c941e86ccd561576552cdda9c58424462def9d
Parents: 2e65a11
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 22 13:41:58 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../gremlin/console/plugin/PluggedIn.groovy     |   2 +-
 .../gremlin/jsr223/LazyBindingsCustomizer.java  |  41 +++++
 .../jsr223/console/ConsoleCustomizer.java       |   7 +-
 .../jsr223/console/LazyBindingsCustomizer.java  |  41 -----
 .../gremlin/jsr223/console/RemoteAcceptor.java  |   3 +-
 .../gremlin/groovy/plugin/PluginAcceptor.java   |   2 +-
 .../groovy/plugin/HadoopGremlinPlugin.java      |   2 +
 .../groovy/plugin/HadoopRemoteAcceptor.java     |   2 +
 .../hadoop/jsr223/HadoopGremlinPlugin.java      | 154 +++++++++++++++++++
 .../hadoop/jsr223/HadoopRemoteAcceptor.java     | 127 +++++++++++++++
 ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin |   1 +
 .../neo4j/groovy/plugin/Neo4jGremlinPlugin.java |   1 +
 .../spark/jsr223/SparkGremlinPlugin.java        |   2 +-
 13 files changed, 339 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
index b707226..dc63a2f 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
@@ -90,7 +90,7 @@ class PluggedIn {
                 } else if (it instanceof ScriptCustomizer) {
                     it.getScripts().collect { it.join(LINE_SEPARATOR) }.each { pluginAcceptor.eval(it) }
                 } else if (it instanceof BindingsCustomizer) {
-                    it.bindings.entrySet().each { k, v -> pluginAcceptor.addBinding(k,v) }
+                    it.bindings.entrySet().each { kv -> pluginAcceptor.addBinding(kv.key, kv.value) }
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java
new file mode 100644
index 0000000..4117ae5
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer;
+
+import javax.script.Bindings;
+import java.util.function.Supplier;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class LazyBindingsCustomizer implements BindingsCustomizer {
+
+    private final Supplier<Bindings> bindingsSupplier;
+
+    public LazyBindingsCustomizer(final Supplier<Bindings> bindingsSupplier) {
+        this.bindingsSupplier = bindingsSupplier;
+    }
+
+    @Override
+    public Bindings getBindings() {
+        return bindingsSupplier.get();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/ConsoleCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/ConsoleCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/ConsoleCustomizer.java
index 47771bc..7b3d788 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/ConsoleCustomizer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/ConsoleCustomizer.java
@@ -20,14 +20,19 @@ package org.apache.tinkerpop.gremlin.jsr223.console;
 
 import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 
+import java.util.Map;
+
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public interface ConsoleCustomizer extends Customizer {
+    public static final String ENV_CONSOLE_IO = "ConsolePluginAcceptor.io";
+    public static final String ENV_CONSOLE_SHELL = "ConsolePluginAcceptor.shell";
+
     /**
      * Allows a plugin to utilize features of the {@code :remote} and {@code :submit} commands of the Gremlin Console.
      * This method does not need to be implemented if the plugin is not meant for the Console for some reason or
      * if it does not intend to take advantage of those commands.
      */
-    public RemoteAcceptor getRemoteAcceptor();
+    public RemoteAcceptor getRemoteAcceptor(final Map<String, Object> environment);
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/LazyBindingsCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/LazyBindingsCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/LazyBindingsCustomizer.java
deleted file mode 100644
index f21a2ab..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/LazyBindingsCustomizer.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.jsr223.console;
-
-import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer;
-
-import javax.script.Bindings;
-import java.util.function.Supplier;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class LazyBindingsCustomizer implements BindingsCustomizer {
-
-    private final Supplier<Bindings> bindingsSupplier;
-
-    public LazyBindingsCustomizer(final Supplier<Bindings> bindingsSupplier) {
-        this.bindingsSupplier = bindingsSupplier;
-    }
-
-    @Override
-    public Bindings getBindings() {
-        return bindingsSupplier.get();
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java
index aee77ae..ab4c81d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.jsr223.console;
 
 import java.io.Closeable;
 import java.util.List;
+import java.util.Map;
 
 /**
  * The Gremlin Console supports the {@code :remote} and {@code :submit} commands which provide standardized ways
@@ -27,7 +28,7 @@ import java.util.List;
  * A "remote connection" does not necessarily have to be a remote server.  It simply refers to a resource that is
  * external to the console.
  * <p/>
- * By implementing this interface and returning an instance of it through {@link ConsoleCustomizer#getRemoteAcceptor()}
+ * By implementing this interface and returning an instance of it through {@link ConsoleCustomizer#getRemoteAcceptor(Map)}
  * a plugin can hook into those commands and provide remoting features.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginAcceptor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginAcceptor.java
index 9571381..9165237 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginAcceptor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginAcceptor.java
@@ -31,7 +31,7 @@ import java.util.Set;
  * and provides the abstractions required for a plugin to work regardless of the environmental implementations.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.console.PluginAcceptor}.
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.console.PluginAcceptor}.
  */
 @Deprecated
 public interface PluginAcceptor {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopGremlinPlugin.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopGremlinPlugin.java
index 021f9d3..ca446ef 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopGremlinPlugin.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopGremlinPlugin.java
@@ -43,7 +43,9 @@ import java.util.Set;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.hadoop.jsr223.HadoopGremlinPlugin}.
  */
+@Deprecated
 public final class HadoopGremlinPlugin extends AbstractGremlinPlugin {
 
     protected static String NAME = "tinkerpop.hadoop";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopRemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopRemoteAcceptor.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopRemoteAcceptor.java
index 558376e..acae442 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopRemoteAcceptor.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopRemoteAcceptor.java
@@ -39,7 +39,9 @@ import java.util.List;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.hadoop.jsr223.HadoopRemoteAcceptor}.
  */
+@Deprecated
 public final class HadoopRemoteAcceptor implements RemoteAcceptor {
 
     private static final String USE_SUGAR = "useSugar";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopGremlinPlugin.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopGremlinPlugin.java
new file mode 100644
index 0000000..5e21027
--- /dev/null
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopGremlinPlugin.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.hadoop.jsr223;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.io.IOUtils;
+import org.apache.hadoop.io.compress.CodecPool;
+import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat;
+import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;
+import org.apache.hadoop.util.ToolRunner;
+import org.apache.tinkerpop.gremlin.hadoop.Constants;
+import org.apache.tinkerpop.gremlin.hadoop.process.computer.mapreduce.MapReduceGraphComputer;
+import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopConfiguration;
+import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopEdge;
+import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopElement;
+import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph;
+import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopProperty;
+import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopVertex;
+import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopVertexProperty;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.FileSystemStorage;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.graphson.GraphSONInputFormat;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.graphson.GraphSONOutputFormat;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.graphson.GraphSONRecordReader;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.graphson.GraphSONRecordWriter;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoInputFormat;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoOutputFormat;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoRecordReader;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoRecordWriter;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.script.ScriptInputFormat;
+import org.apache.tinkerpop.gremlin.hadoop.structure.util.ConfUtil;
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.LazyBindingsCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor;
+import org.codehaus.groovy.tools.shell.Groovysh;
+
+import javax.script.Bindings;
+import javax.script.SimpleBindings;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class HadoopGremlinPlugin extends AbstractGremlinPlugin {
+
+    protected static String NAME = "tinkerpop.hadoop";
+
+    private static final BindingsCustomizer bindings;
+
+    private static final ImportCustomizer imports;
+
+    private static final Set<String> appliesTo = new HashSet<>(Collections.singletonList("gremlin-groovy"));
+
+    static {
+        try {
+            // TODO: most of the imports here were wildcarded, but we dont' allow that anymore - needs review
+            imports = DefaultImportCustomizer.build()
+                    .addClassImports(
+                            Configuration.class,
+                            org.apache.hadoop.hdfs.DFSClient.class,
+                            FileSystem.class,
+                            ToolRunner.class,
+                            IOUtils.class,
+                            CodecPool.class,
+                            SequenceFileInputFormat.class,
+                            SequenceFileOutputFormat.class,
+                            Constants.class,
+                            HadoopConfiguration.class,
+                            HadoopEdge.class,
+                            HadoopElement.class,
+                            HadoopGraph.class,
+                            HadoopProperty.class,
+                            HadoopVertex.class,
+                            HadoopVertexProperty.class,
+                            ConfUtil.class,
+                            VertexWritable.class,
+                            GraphSONInputFormat.class,
+                            GraphSONOutputFormat.class,
+                            GraphSONRecordReader.class,
+                            GraphSONRecordWriter.class,
+                            GryoInputFormat.class,
+                            GryoOutputFormat.class,
+                            GryoRecordReader.class,
+                            GryoRecordWriter.class,
+                            ScriptInputFormat.class,
+                            MapReduceGraphComputer.class).create();
+
+            bindings = new LazyBindingsCustomizer(() -> {
+                try {
+                    final Bindings bindings = new SimpleBindings();
+                    bindings.put("hdfs", FileSystemStorage.open(FileSystem.get(new Configuration())));
+                    bindings.put("fs", FileSystemStorage.open(FileSystem.getLocal(new Configuration())));
+                    return bindings;
+                } catch (Exception ex) {
+                    throw new RuntimeException(ex);
+                }
+            });
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    public HadoopGremlinPlugin() {
+        super(NAME, appliesTo, imports, bindings, new HadoopConsoleCustomizer());
+    }
+
+    @Override
+    public Optional<Customizer[]> getCustomizers(final String scriptEngineName) {
+        if (null == System.getenv(Constants.HADOOP_GREMLIN_LIBS))
+            HadoopGraph.LOGGER.warn("Be sure to set the environmental variable: " + Constants.HADOOP_GREMLIN_LIBS);
+        else
+            HadoopGraph.LOGGER.info(Constants.HADOOP_GREMLIN_LIBS + " is set to: " + System.getenv(Constants.HADOOP_GREMLIN_LIBS));
+
+        return super.getCustomizers(scriptEngineName);
+    }
+
+    @Override
+    public boolean requireRestart() {
+        return true;
+    }
+
+    private static class HadoopConsoleCustomizer implements ConsoleCustomizer {
+        @Override
+        public RemoteAcceptor getRemoteAcceptor(final Map<String, Object> environment) {
+            return new HadoopRemoteAcceptor((Groovysh) environment.get(ConsoleCustomizer.ENV_CONSOLE_SHELL));
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopRemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopRemoteAcceptor.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopRemoteAcceptor.java
new file mode 100644
index 0000000..f2367bd
--- /dev/null
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopRemoteAcceptor.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.hadoop.jsr223;
+
+import org.apache.tinkerpop.gremlin.groovy.loaders.SugarLoader;
+import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph;
+import org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor;
+import org.apache.tinkerpop.gremlin.jsr223.console.RemoteException;
+import org.apache.tinkerpop.gremlin.process.computer.ComputerResult;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.ComputerResultStep;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
+import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal;
+import org.codehaus.groovy.tools.shell.Groovysh;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class HadoopRemoteAcceptor implements RemoteAcceptor {
+
+    private static final String USE_SUGAR = "useSugar";
+    private static final String USE_TRAVERSAL_SOURCE = "useTraversalSource";
+    private static final String SPACE = " ";
+
+    private HadoopGraph hadoopGraph;
+    private Groovysh shell;
+    private boolean useSugar = false;
+    private TraversalSource traversalSource;
+
+    public HadoopRemoteAcceptor(final Groovysh shell) {
+        this.shell = shell;
+    }
+
+    @Override
+    public Object connect(final List<String> args) throws RemoteException {
+        if (args.size() != 1 && args.size() != 2) {
+            throw new IllegalArgumentException("Usage: :remote connect " + HadoopGremlinPlugin.NAME + " <variable name of graph> <optional variable name of traversal source>");
+        }
+        this.hadoopGraph = (HadoopGraph) this.shell.getInterp().getContext().getVariable(args.get(0));
+        if (args.size() == 2)
+            this.traversalSource = ((TraversalSource) this.shell.getInterp().getContext().getVariable(args.get(1)));
+        else
+            this.traversalSource = this.hadoopGraph.traversal();
+        ///
+        final HashMap<String, Object> configuration = new HashMap<>();
+        configuration.put(USE_SUGAR, this.useSugar);
+        configuration.put(USE_TRAVERSAL_SOURCE, this.traversalSource);
+        return Collections.unmodifiableMap(configuration);
+    }
+
+    @Override
+    public Object configure(final List<String> args) throws RemoteException {
+        for (int i = 0; i < args.size(); i = i + 2) {
+            if (args.get(i).equals(USE_SUGAR))
+                this.useSugar = Boolean.valueOf(args.get(i + 1));
+            else if (args.get(i).equals(USE_TRAVERSAL_SOURCE)) {
+                this.traversalSource = ((TraversalSource) this.shell.getInterp().getContext().getVariable(args.get(i + 1)));
+            } else
+                throw new IllegalArgumentException("The provided configuration is unknown: " + args.get(i) + ":" + args.get(i + 1));
+        }
+        ///
+        final HashMap<String, Object> configuration = new HashMap<>();
+        configuration.put(USE_SUGAR, this.useSugar);
+        configuration.put(USE_TRAVERSAL_SOURCE, this.traversalSource);
+        return Collections.unmodifiableMap(configuration);
+    }
+
+    @Override
+    public Object submit(final List<String> args) throws RemoteException {
+        try {
+            String script = getScript(String.join(SPACE, args), this.shell);
+            if (this.useSugar)
+                script = SugarLoader.class.getCanonicalName() + ".load()\n" + script;
+            final TraversalVertexProgram program = TraversalVertexProgram.build().traversal(this.traversalSource, "gremlin-groovy", script).create(this.hadoopGraph);
+            final ComputerResult computerResult = VertexProgramStrategy.getComputer(this.traversalSource.getStrategies()).get().apply(this.hadoopGraph).program(program).submit().get();
+            this.shell.getInterp().getContext().setVariable(RESULT, computerResult);
+            ///
+            final Traversal.Admin<ComputerResult, ?> traversal = new DefaultTraversal<>(computerResult.graph());
+            traversal.addStep(new ComputerResultStep<>(traversal));
+            traversal.addStart(traversal.getTraverserGenerator().generate(computerResult, EmptyStep.instance(), 1l));
+            return traversal;
+        } catch (final Exception e) {
+            throw new RemoteException(e);
+        }
+    }
+
+    @Override
+    public boolean allowRemoteConsole() {
+        return true;
+    }
+
+    @Override
+    public void close() throws IOException {
+        this.hadoopGraph.close();
+    }
+
+    /**
+     * 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;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/hadoop-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin b/hadoop-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
new file mode 100644
index 0000000..07223dd
--- /dev/null
+++ b/hadoop-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
@@ -0,0 +1 @@
+org.apache.tinkerpop.gremlin.hadoop.jsr223.HadoopGremlinPlugin
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java
index 9053cf3..68c0016 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java
@@ -32,6 +32,7 @@ import java.util.Set;
  * @author Stephen Mallette (http://stephen.genoprime.com)
  * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.neo4j.jsr223.Neo4jGremlinPlugin}.
  */
+@Deprecated
 public final class Neo4jGremlinPlugin extends AbstractGremlinPlugin {
 
     private static final Set<String> IMPORTS = new HashSet<String>() {{

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/jsr223/SparkGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/jsr223/SparkGremlinPlugin.java b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/jsr223/SparkGremlinPlugin.java
index 840f593..9403fa4 100644
--- a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/jsr223/SparkGremlinPlugin.java
+++ b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/jsr223/SparkGremlinPlugin.java
@@ -23,7 +23,7 @@ import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
 import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer;
 import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
 import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
-import org.apache.tinkerpop.gremlin.jsr223.console.LazyBindingsCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.LazyBindingsCustomizer;
 import org.apache.tinkerpop.gremlin.spark.process.computer.CombineIterator;
 import org.apache.tinkerpop.gremlin.spark.process.computer.MapIterator;
 import org.apache.tinkerpop.gremlin.spark.process.computer.MemoryAccumulator;


[28/50] tinkerpop git commit: TINKERPOP-1562 Added more tests for the GremlnPluginAdapter

Posted by sp...@apache.org.
TINKERPOP-1562 Added more tests for the GremlnPluginAdapter


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/35c8fcd6
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/35c8fcd6
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/35c8fcd6

Branch: refs/heads/TINKERPOP-1562
Commit: 35c8fcd651cf0f4788eb4e0435ed7fa966304d5c
Parents: 33460fc
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Nov 23 15:36:13 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../groovy/plugin/GremlinPluginAdapterTest.java | 70 ++++++++++++++++++++
 .../groovy/plugin/script-customizer-1.groovy    |  3 +
 .../groovy/plugin/script-customizer-2.groovy    |  2 +
 pom.xml                                         |  1 +
 4 files changed, 76 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/35c8fcd6/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
index dd582b1..c3ade04 100644
--- a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
+++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
@@ -18,12 +18,28 @@
  */
 package org.apache.tinkerpop.gremlin.console.groovy.plugin;
 
+import org.apache.tinkerpop.gremlin.TestHelper;
 import org.apache.tinkerpop.gremlin.console.plugin.PluggedIn;
+import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultBindingsCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultScriptCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
 import org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.ScriptCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin;
 import org.junit.Test;
 
+import javax.script.Bindings;
+import javax.script.SimpleBindings;
+import java.io.File;
 import java.time.DayOfWeek;
 import java.time.temporal.TemporalAccessor;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -57,4 +73,58 @@ public class GremlinPluginAdapterTest {
         assertThat(imports, hasItems("import static " + DayOfWeek.class.getCanonicalName() + ".from"));
         assertThat(imports, hasItems("import static " + DayOfWeek.class.getCanonicalName() + ".values"));
     }
+
+    @Test
+    public void shouldAdaptForScriptCustomizer() throws Exception {
+        final File scriptFile1 = TestHelper.generateTempFileFromResource(GremlinPluginAdapterTest.class, "script-customizer-1.groovy", ".groovy");
+        final File scriptFile2 = TestHelper.generateTempFileFromResource(GremlinPluginAdapterTest.class, "script-customizer-2.groovy", ".groovy");
+        final Set<String> files = new HashSet<>();
+        files.add(scriptFile1.getAbsolutePath());
+        files.add(scriptFile2.getAbsolutePath());
+        final ScriptFileGremlinPlugin plugin = ScriptFileGremlinPlugin.build().files(files).create();
+        final PluggedIn.GremlinPluginAdapter adapter = new PluggedIn.GremlinPluginAdapter(plugin, null, null);
+
+        assertEquals(plugin.getName(), adapter.getName());
+
+        final List<String> evals = new ArrayList<>();
+        final SpyPluginAcceptor spy = new SpyPluginAcceptor(evals::add);
+        adapter.pluginTo(spy);
+
+        assertEquals("x = 1 + 1\n" +
+                     "y = 10 * x\n" +
+                     "z = 1 + x + y", evals.get(0));
+        assertEquals("l = g.V(z).out()\n" +
+                     "        .group().by('name')", evals.get(1));
+    }
+
+    @Test
+    public void shouldAdaptForBindingsCustomizer() throws Exception {
+        final Bindings bindings = new SimpleBindings();
+        bindings.put("x", 1);
+        bindings.put("y", "yes");
+        bindings.put("z", true);
+        final BindingsCustomizer bindingsCustomizer = new DefaultBindingsCustomizer(bindings);
+        final GremlinPlugin plugin = new GremlinPlugin() {
+            @Override
+            public String getName() {
+                return "anon-bindings";
+            }
+
+            @Override
+            public Optional<Customizer[]> getCustomizers(final String scriptEngineName) {
+                return Optional.of(new Customizer[]{bindingsCustomizer});
+            }
+        };
+        final PluggedIn.GremlinPluginAdapter adapter = new PluggedIn.GremlinPluginAdapter(plugin, null, null);
+
+        assertEquals(plugin.getName(), adapter.getName());
+
+        final SpyPluginAcceptor spy = new SpyPluginAcceptor();
+        adapter.pluginTo(spy);
+
+        final Map<String,Object> bindingsFromSpy = spy.getBindings();
+        assertEquals(1, bindingsFromSpy.get("x"));
+        assertEquals("yes", bindingsFromSpy.get("y"));
+        assertEquals(true, bindingsFromSpy.get("z"));
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/35c8fcd6/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-1.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-1.groovy b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-1.groovy
new file mode 100644
index 0000000..c2cc784
--- /dev/null
+++ b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-1.groovy
@@ -0,0 +1,3 @@
+x = 1 + 1
+y = 10 * x
+z = 1 + x + y
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/35c8fcd6/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-2.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-2.groovy b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-2.groovy
new file mode 100644
index 0000000..1a4f9a9
--- /dev/null
+++ b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-2.groovy
@@ -0,0 +1,2 @@
+l = g.V(z).out()
+        .group().by('name')
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/35c8fcd6/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0bff1e7..37c7c7e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -287,6 +287,7 @@ limitations under the License.
                         <exclude>**/goal.txt</exclude>
                         <exclude>**/src/main/resources/META-INF/services/**</exclude>
                         <exclude>**/src/test/resources/META-INF/services/**</exclude>
+                        <exclude>**/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-*.groovy</exclude>
                         <exclude>**/src/test/resources/org/apache/tinkerpop/gremlin/jsr223/script-customizer-*.groovy</exclude>
                         <exclude>**/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/script/*.txt</exclude>
                         <exclude>**/src/main/ext/**</exclude>


[46/50] tinkerpop git commit: TINKERPOP-1562 Fixed the InstallCommand for new GremlinPlugin usage.

Posted by sp...@apache.org.
TINKERPOP-1562 Fixed the InstallCommand for new GremlinPlugin usage.

DependencyGrabber wasn't using the right Artifact implementation and wasn't taking into account -Dplugins=v3d3


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d68f6938
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d68f6938
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d68f6938

Branch: refs/heads/TINKERPOP-1562
Commit: d68f69383464f8f54b98acecf99a39587f2e4839
Parents: ae45eca
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Dec 1 08:25:19 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:51 2016 -0500

----------------------------------------------------------------------
 .../gremlin/console/commands/InstallCommand.groovy    | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d68f6938/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/InstallCommand.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/InstallCommand.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/InstallCommand.groovy
index a680757..c8a49df 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/InstallCommand.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/InstallCommand.groovy
@@ -21,9 +21,9 @@ package org.apache.tinkerpop.gremlin.console.commands
 import org.apache.tinkerpop.gremlin.console.ConsoleFs
 import org.apache.tinkerpop.gremlin.console.Mediator
 import org.apache.tinkerpop.gremlin.console.plugin.PluggedIn
-import org.apache.tinkerpop.gremlin.groovy.plugin.Artifact
 import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin
 import groovy.grape.Grape
+import org.apache.tinkerpop.gremlin.groovy.util.Artifact
 import org.apache.tinkerpop.gremlin.groovy.util.DependencyGrabber
 import org.codehaus.groovy.tools.shell.CommandSupport
 import org.codehaus.groovy.tools.shell.Groovysh
@@ -64,9 +64,17 @@ class InstallCommand extends CommandSupport {
 
         // note that the service loader utilized the classloader from the groovy shell as shell class are available
         // from within there given loading through Grape.
-        ServiceLoader.load(GremlinPlugin.class, shell.getInterp().getClassLoader()).forEach { plugin ->
+        def pluginClass = mediator.useV3d3 ? org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin : GremlinPlugin
+        ServiceLoader.load(pluginClass, shell.getInterp().getClassLoader()).forEach { plugin ->
             if (!mediator.availablePlugins.containsKey(plugin.class.name)) {
-                mediator.availablePlugins.put(plugin.class.name, new PluggedIn(plugin, shell, io, false))
+
+                if (Mediator.useV3d3) {
+                    mediator.availablePlugins.put(plugin.class.name, new PluggedIn(new PluggedIn.GremlinPluginAdapter((org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin) plugin, shell, io), shell, io, false))
+                } else {
+                    mediator.availablePlugins.put(plugin.class.name, new PluggedIn((GremlinPlugin) plugin, shell, io, false))
+                }
+
+                //mediator.availablePlugins.put(plugin.class.name, new PluggedIn(plugin, shell, io, false))
                 if (plugin.requireRestart())
                     pluginsThatNeedRestart << plugin.name
             }


[07/50] tinkerpop git commit: TINKERPOP-1562 Start getting Console working with new plugin stuff

Posted by sp...@apache.org.
TINKERPOP-1562 Start getting Console working with new plugin stuff

Built adapters to get new RemoteAcceptor to behave as the old RemoteAcceptor and to get new GremlinPlugin to work as the old GremlinPlugin. Deprecated some classes and undeprecated others - still a pretty big WIP commit at this point but nothing appears to be broken.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/1a7a3b37
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/1a7a3b37
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/1a7a3b37

Branch: refs/heads/TINKERPOP-1562
Commit: 1a7a3b37f895d31f9f4f441088353e0bfeb3d8d1
Parents: c348a07
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 17:15:53 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:50 2016 -0500

----------------------------------------------------------------------
 .../tinkerpop/gremlin/console/Console.groovy    |  14 +-
 .../tinkerpop/gremlin/console/Mediator.groovy   |   4 +-
 .../console/jsr223/GephiRemoteAcceptor.groovy   | 372 -------------------
 .../console/plugin/ConsolePluginAcceptor.groovy |   2 +-
 .../console/plugin/GephiRemoteAcceptor.groovy   |   1 -
 .../gremlin/console/plugin/PluggedIn.groovy     |  79 ++++
 .../tinkerpop/gremlin/jsr223/Customizer.java    |   4 +-
 .../tinkerpop/gremlin/jsr223/GremlinModule.java |   2 +
 .../tinkerpop/gremlin/jsr223/GremlinPlugin.java |   9 -
 .../gremlin/jsr223/GremlinPluginException.java  |  41 ++
 .../gremlin/jsr223/RemoteAcceptor.java          |  81 ----
 .../gremlin/jsr223/RemoteException.java         |  40 --
 .../jsr223/console/ConsoleCustomizer.java       |  33 ++
 .../gremlin/jsr223/console/PluginAcceptor.java  |  62 ++++
 .../gremlin/jsr223/console/RemoteAcceptor.java  |  81 ++++
 .../gremlin/jsr223/console/RemoteException.java |  40 ++
 .../gremlin/groovy/plugin/GremlinPlugin.java    |   1 +
 .../gremlin/groovy/plugin/PluginAcceptor.java   |   2 +
 .../gremlin/groovy/plugin/RemoteAcceptor.java   |   2 +-
 .../jsr223/GremlinEnabledScriptEngineTest.java  |   1 +
 20 files changed, 361 insertions(+), 510 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
index 69d6ba3..cb6e90f 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
@@ -103,6 +103,8 @@ class Console {
         // hide output temporarily while imports execute
         showShellEvaluationOutput(false)
 
+        // TODO: register CoreGremlinPlugin if using v3d3
+
         // add the default imports
         new ConsoleImportCustomizerProvider().getCombinedImports().stream()
                 .collect { IMPORT_SPACE + it }.each { groovy.execute(it) }
@@ -123,9 +125,17 @@ class Console {
 
         // check for available plugins.  if they are in the "active" plugins strategies then "activate" them
         def activePlugins = Mediator.readPluginState()
-        ServiceLoader.load(GremlinPlugin.class, groovy.getInterp().getClassLoader()).each { plugin ->
+        def pluginClass = mediator.useV3d3 ? org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin : GremlinPlugin
+        ServiceLoader.load(pluginClass, groovy.getInterp().getClassLoader()).each { plugin ->
             if (!mediator.availablePlugins.containsKey(plugin.class.name)) {
-                def pluggedIn = new PluggedIn(plugin, groovy, io, false)
+                def pluggedIn
+
+                if (Mediator.useV3d3) {
+                    pluggedIn = new PluggedIn(new PluggedIn.GremlinPluginAdapter(plugin), groovy, io, false)
+                } else {
+                    pluggedIn = new PluggedIn(plugin, groovy, io, false)
+                }
+
                 mediator.availablePlugins.put(plugin.class.name, pluggedIn)
 
                 if (activePlugins.contains(plugin.class.name)) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
index 047e3d7..396c563 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
@@ -21,8 +21,6 @@ package org.apache.tinkerpop.gremlin.console
 import org.apache.tinkerpop.gremlin.console.plugin.PluggedIn
 import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteAcceptor
 
-import java.util.concurrent.CompletableFuture
-
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
@@ -36,6 +34,8 @@ class Mediator {
 
     private static String LINE_SEP = System.getProperty("line.separator")
 
+    public static final boolean useV3d3 = System.getProperty("plugins", "v3d3") == "v3d3"
+
     public Mediator(final Console console) {
         this.console = console
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
deleted file mode 100644
index 11e1e5c..0000000
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.console.jsr223
-
-import groovy.json.JsonOutput
-import groovy.json.JsonSlurper
-import groovy.transform.CompileStatic
-import org.apache.http.client.methods.CloseableHttpResponse
-import org.apache.http.client.methods.HttpUriRequest
-import org.apache.http.client.methods.RequestBuilder
-import org.apache.http.entity.StringEntity
-import org.apache.http.impl.client.CloseableHttpClient
-import org.apache.http.impl.client.HttpClients
-import org.apache.http.util.EntityUtils
-import org.apache.tinkerpop.gremlin.console.plugin.GephiTraversalVisualizationStrategy
-import org.apache.tinkerpop.gremlin.jsr223.RemoteAcceptor
-import org.apache.tinkerpop.gremlin.jsr223.RemoteException
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource
-import org.apache.tinkerpop.gremlin.structure.Edge
-import org.apache.tinkerpop.gremlin.structure.Graph
-import org.apache.tinkerpop.gremlin.structure.Vertex
-import org.codehaus.groovy.tools.shell.Groovysh
-import org.codehaus.groovy.tools.shell.IO
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @author Randall Barnhart (randompi@gmail.com)
- */
-class GephiRemoteAcceptor implements RemoteAcceptor {
-
-    private String host = "localhost"
-    private int port = 8080
-    private String workspace = "workspace1"
-
-    private final Groovysh shell
-    private final IO io
-
-    private final Random rand = new Random();
-    boolean traversalSubmittedForViz = false
-    long vizStepDelay
-    private float[] vizStartRGBColor
-    private float[] vizDefaultRGBColor
-    private char vizColorToFade
-    private float vizColorFadeRate
-    private float vizStartSize
-    private float vizSizeDecrementRate
-    private Map vertexAttributes = [:]
-
-    private CloseableHttpClient httpclient = HttpClients.createDefault();
-
-    public GephiRemoteAcceptor(final Groovysh shell, final IO io) {
-        this.shell = shell
-        this.io = io
-
-        // traversal visualization defaults
-        vizStepDelay = 1000;                 // 1 second pause between viz of steps
-        vizStartRGBColor = [0.0f, 1.0f, 0.5f]  // light aqua green
-        vizDefaultRGBColor = [0.6f, 0.6f, 0.6f]  // light grey
-        vizColorToFade = 'g'                 // will fade so blue is strongest
-        vizColorFadeRate = 0.7               // the multiplicative rate to fade visited vertices
-        vizStartSize = 10
-        vizSizeDecrementRate = 0.33f
-    }
-
-    @Override
-    connect(final List<String> args) throws RemoteException {
-        if (args.size() >= 1)
-            workspace = args[0]
-
-        if (args.size() >= 2)
-            host = args[1]
-
-        if (args.size() >= 3) {
-            try {
-                port = Integer.parseInt(args[2])
-            } catch (Exception ex) {
-                throw new RemoteException("Port must be an integer value")
-            }
-        }
-
-        def vizConfig = " with stepDelay:$vizStepDelay, startRGBColor:$vizStartRGBColor, " +
-                "colorToFade:$vizColorToFade, colorFadeRate:$vizColorFadeRate, startSize:$vizStartSize," +
-                "sizeDecrementRate:$vizSizeDecrementRate"
-
-        return "Connection to Gephi - http://$host:$port/$workspace" + vizConfig
-    }
-
-    @Override
-    Object configure(final List<String> args) throws RemoteException {
-        if (args.size() < 2)
-            throw new RemoteException("Invalid config arguments - check syntax")
-
-        if (args[0] == "host")
-            host = args[1]
-        else if (args[0] == "port") {
-            try {
-                port = Integer.parseInt(args[1])
-            } catch (Exception ignored) {
-                throw new RemoteException("Port must be an integer value")
-            }
-        } else if (args[0] == "workspace")
-            workspace = args[1]
-        else if (args[0] == "stepDelay")
-            parseVizStepDelay(args[1])
-        else if (args[0] == "startRGBColor")
-            parseVizStartRGBColor(args[1])
-        else if (args[0] == "colorToFade")
-            parseVizColorToFade(args[1])
-        else if (args[0] == "colorFadeRate")
-            parseVizColorFadeRate(args[1])
-        else if (args[0] == "sizeDecrementRate")
-            parseVizSizeDecrementRate(args[1])
-        else if (args[0] == "startSize")
-            parseVizStartSize(args[1])
-        else if (args[0] == "visualTraversal") {
-            def graphVar = shell.interp.context.getVariable(args[1])
-            if (!(graphVar instanceof Graph))
-                throw new RemoteException("Invalid argument to 'visualTraversal' - first parameter must be a Graph instance")
-
-            def gVar = args.size() == 3 ? args[2] : "vg"
-            def theG = GraphTraversalSource.build().with(new GephiTraversalVisualizationStrategy(this)).create(graphVar)
-            shell.interp.context.setVariable(gVar, theG)
-        } else
-            throw new RemoteException("Invalid config arguments - check syntax")
-
-        return "Connection to Gephi - http://$host:$port/$workspace" +
-                " with stepDelay:$vizStepDelay, startRGBColor:$vizStartRGBColor, " +
-                "colorToFade:$vizColorToFade, colorFadeRate:$vizColorFadeRate, startSize:$vizStartSize," +
-                "sizeDecrementRate:$vizSizeDecrementRate"
-    }
-
-    @Override
-    @CompileStatic
-    Object submit(final List<String> args) throws RemoteException {
-        final String line = String.join(" ", args)
-        if (line.trim() == "clear") {
-            clearGraph()
-            io.out.println("Gephi workspace cleared")
-            return
-        }
-
-        // need to clear the vertex attributes
-        vertexAttributes.clear()
-
-        // this tells the GraphTraversalVisualizationStrategy that if the line eval's to a traversal it should
-        // try to visualize it
-        traversalSubmittedForViz = true
-
-        // get the colors/sizes back to basics before trying visualize
-        resetColorsSizes()
-
-        final Object o = shell.execute(line)
-        if (o instanceof Graph) {
-            clearGraph()
-            def graph = (Graph) o
-            def g = graph.traversal()
-            g.V().sideEffect { addVertexToGephi(g, it.get()) }.iterate()
-        }
-
-        traversalSubmittedForViz = false
-    }
-
-    @Override
-    void close() throws IOException {
-        httpclient.close()
-    }
-
-    /**
-     * Visits the last set of vertices traversed and degrades their color and size.
-     */
-    def updateVisitedVertices(def List except = []) {
-        vertexAttributes.keySet().findAll{ vertexId -> !except.contains(vertexId) }.each { String vertexId ->
-            def attrs = vertexAttributes[vertexId]
-            float currentColor = attrs.color
-            currentColor *= vizColorFadeRate
-
-            int currentSize = attrs["size"]
-            currentSize = Math.max(vizStartSize, currentSize - (currentSize * vizSizeDecrementRate))
-
-            vertexAttributes.get(vertexId).color = currentColor
-            vertexAttributes.get(vertexId).size = currentSize
-
-            changeVertexAttributes(vertexId)
-        }
-    }
-
-    def changeVertexAttributes(def String vertexId) {
-        def props = [:]
-        props.put(vizColorToFade.toString(), vertexAttributes[vertexId].color)
-        props.put("size", vertexAttributes[vertexId].size)
-        updateGephiGraph([cn: [(vertexId): props]])
-    }
-
-    /**
-     * Visit a vertex traversed and initialize its color and size.
-     */
-    def visitVertexInGephi(def Vertex v) {
-        def props = [:]
-        props.put('r', vizStartRGBColor[0])
-        props.put('g', vizStartRGBColor[1])
-        props.put('b', vizStartRGBColor[2])
-        props.put('size', vizStartSize * 2.5)
-        props.put('visited', 1)
-
-        updateGephiGraph([cn: [(v.id().toString()): props]])
-
-        vertexAttributes[v.id().toString()] = [color: vizStartRGBColor[fadeColorIndex()], size: vizStartSize * 2.5, touch: 1]
-    }
-
-    def fadeColorIndex() {
-        if (vizColorToFade == 'r')
-            return 0
-        else if (vizColorToFade == 'g')
-            return 1
-        else if (vizColorToFade == 'b')
-            return 2
-    }
-
-    def addVertexToGephi(def GraphTraversalSource g, def Vertex v, def boolean ignoreEdges = false) {
-        // grab the first property value from the strategies of values
-        def props = g.V(v).valueMap().next().collectEntries { kv -> [(kv.key): kv.value[0]] }
-        props << [label: v.label()]
-        props.put('r', vizDefaultRGBColor[0])
-        props.put('g', vizDefaultRGBColor[1])
-        props.put('b', vizDefaultRGBColor[2])
-        props.put('x', rand.nextFloat())
-        props.put('y', rand.nextFloat())
-        props.put('size', 10)
-        props.put('visited', 0)
-
-        // only add if it does not exist in graph already
-        if (!getFromGephiGraph([operation: "getNode", id: v.id().toString()]).isPresent())
-            updateGephiGraph([an: [(v.id().toString()): props]])
-
-        if (!ignoreEdges) {
-            g.V(v).outE().sideEffect {
-                addEdgeToGephi(g, it.get())
-            }.iterate()
-        }
-    }
-
-    @CompileStatic
-    def addEdgeToGephi(def GraphTraversalSource g, def Edge e) {
-        def props = g.E(e).valueMap().next()
-        props.put('label', e.label())
-        props.put('source', e.outVertex().id().toString())
-        props.put('target', e.inVertex().id().toString())
-        props.put('directed', true)
-        props.put('visited', 0)
-
-        // make sure the in vertex is there but don't add its edges - that will happen later as we are looping
-        // all vertices in the graph
-        addVertexToGephi(g, e.inVertex(), true)
-
-        // both vertices are definitely there now, so add the edge
-        updateGephiGraph([ae: [(e.id().toString()): props]])
-    }
-
-    def clearGraph() {
-        updateGephiGraph([dn: [filter: "ALL"]])
-    }
-
-    def resetColorsSizes() {
-        updateGephiGraph([cn: [filter: [nodeAttribute: [attribute: "visited", value: 1]],
-                               attributes: [size: 1, r: vizDefaultRGBColor[0], g: vizDefaultRGBColor[1], b: vizDefaultRGBColor[2]]]])
-        updateGephiGraph([ce: [filter: [edgeAttribute: [attribute: "visited", value: 1]],
-                               attributes: [size: 1, r: vizDefaultRGBColor[0], g: vizDefaultRGBColor[1], b: vizDefaultRGBColor[2]]]])
-    }
-
-    def getFromGephiGraph(def Map queryArgs) {
-        def requestBuilder = RequestBuilder.get("http://$host:$port/$workspace")
-        queryArgs.each { requestBuilder = requestBuilder.addParameter(it.key, it.value) }
-
-        def httpResp = makeRequest(requestBuilder.build())
-        def resp = EntityUtils.toString(httpResp.entity)
-
-        // gephi streaming plugin does not set the content type or respect the Accept header - treat as text
-        if (resp.isEmpty())
-            return Optional.empty()
-        else
-            return Optional.of(new JsonSlurper().parseText(resp))
-    }
-
-    def updateGephiGraph(def Map postBody) {
-        def requestBuilder = RequestBuilder.post("http://$host:$port/$workspace")
-                                           .addParameter("format", "JSON")
-                                           .addParameter("operation", "updateGraph")
-                                           .setEntity(new StringEntity(JsonOutput.toJson(postBody)))
-        EntityUtils.consume(makeRequest(requestBuilder.build()).entity)
-    }
-
-    private CloseableHttpResponse makeRequest(HttpUriRequest request) {
-        def httpResp = httpclient.execute(request)
-        if (httpResp.getStatusLine().getStatusCode() == 200) {
-            return httpResp
-        } else {
-            def resp = EntityUtils.toString(httpResp.entity)
-            throw new RuntimeException("Unsuccessful request to Gephi - [${httpResp.getStatusLine().getStatusCode()}] ${httpResp.getStatusLine().getReasonPhrase()} - $resp")
-        }
-    }
-
-    @Override
-    public String toString() {
-        return "Gephi - [$workspace]"
-    }
-
-    private void parseVizStepDelay(String arg) {
-        try {
-            vizStepDelay = Long.parseLong(arg)
-        } catch (Exception ignored) {
-            throw new RemoteException("The stepDelay must be a long value")
-        }
-    }
-
-    private void parseVizStartRGBColor(String arg) {
-        try {
-            vizStartRGBColor = arg[1..-2].tokenize(',')*.toFloat()
-            assert (vizStartRGBColor.length == 3)
-        } catch (Exception ignored) {
-            throw new RemoteException("The vizStartRGBColor must be an array of 3 float values, e.g. [0.0,1.0,0.5]")
-        }
-    }
-
-    private void parseVizColorToFade(String arg) {
-        try {
-            vizColorToFade = arg.charAt(0).toLowerCase();
-            assert (vizColorToFade == 'r' || vizColorToFade == 'g' || vizColorToFade == 'b')
-        } catch (Exception ignored) {
-            throw new RemoteException("The vizColorToFade must be one character value among: r, g, b, R, G, B")
-        }
-    }
-
-    private void parseVizColorFadeRate(String arg) {
-        try {
-            vizColorFadeRate = Float.parseFloat(arg)
-        } catch (Exception ignored) {
-            throw new RemoteException("The colorFadeRate must be a float value")
-        }
-    }
-
-    private void parseVizSizeDecrementRate(String arg) {
-        try {
-            vizSizeDecrementRate = Float.parseFloat(arg)
-        } catch (Exception ignored) {
-            throw new RemoteException("The sizeDecrementRate must be a float value")
-        }
-    }
-
-    private void parseVizStartSize(String arg) {
-        try {
-            vizStartSize = Float.parseFloat(arg)
-        } catch (Exception ignored) {
-            throw new RemoteException("The startSize must be a float value")
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/ConsolePluginAcceptor.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/ConsolePluginAcceptor.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/ConsolePluginAcceptor.groovy
index 54bd119..b7ff7d4 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/ConsolePluginAcceptor.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/ConsolePluginAcceptor.groovy
@@ -26,7 +26,7 @@ import org.codehaus.groovy.tools.shell.IO
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-class ConsolePluginAcceptor implements PluginAcceptor {
+class ConsolePluginAcceptor implements PluginAcceptor, org.apache.tinkerpop.gremlin.jsr223.console.PluginAcceptor {
 
     public static final String ENVIRONMENT_NAME = "console";
     public static final String ENVIRONMENT_SHELL = "ConsolePluginAcceptor.shell"

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy
index 30527a4..4198444 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/GephiRemoteAcceptor.groovy
@@ -40,7 +40,6 @@ import org.codehaus.groovy.tools.shell.IO
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  * @author Randall Barnhart (randompi@gmail.com)
- * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.console.jsr223.GephiRemoteAcceptor}
  */
 class GephiRemoteAcceptor implements RemoteAcceptor {
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
index f35d1ed..def49ed 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
@@ -19,6 +19,14 @@
 package org.apache.tinkerpop.gremlin.console.plugin
 
 import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin
+import org.apache.tinkerpop.gremlin.groovy.plugin.IllegalEnvironmentException
+import org.apache.tinkerpop.gremlin.groovy.plugin.PluginAcceptor
+import org.apache.tinkerpop.gremlin.groovy.plugin.PluginInitializationException
+import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteAcceptor
+import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer
+import org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin
+import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer
 import org.codehaus.groovy.tools.shell.Groovysh
 import org.codehaus.groovy.tools.shell.IO
 
@@ -55,4 +63,75 @@ class PluggedIn {
     void deactivate() {
         this.activated = false
     }
+
+    public static class GremlinPluginAdapter implements GremlinPlugin {
+        org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin corePlugin
+
+        public GremlinPluginAdapter(final org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin corePlugin) {
+            this.corePlugin = corePlugin
+        }
+
+        @Override
+        String getName() {
+            return corePlugin.getName()
+        }
+
+        @Override
+        void pluginTo(final PluginAcceptor pluginAcceptor) throws IllegalEnvironmentException, PluginInitializationException {
+            // TODO: handle script customizer
+            corePlugin.getCustomizers("gremlin-groovy").each {
+                if (it instanceof ImportCustomizer) {
+                    def imports = [] as Set
+                    it.classImports.each { imports.add("import " + it.canonicalName )}
+                    it.methodImports.each { imports.add("import static " + it.declaringClass.canonicalName + "." + it.name) }
+                    it.enumImports.each { imports.add("import static " + it.declaringClass.canonicalName + "." + it.name()) }
+                    pluginAcceptor.addImports(imports)
+                }
+            }
+        }
+
+        @Override
+        boolean requireRestart() {
+            return corePlugin.requireRestart()
+        }
+
+        @Override
+        Optional<RemoteAcceptor> remoteAcceptor() {
+            // find a consoleCustomizer if available
+            if (!corePlugin.getCustomizers("gremlin-groovy").any{ it instanceof ConsoleCustomizer })
+                Optional.empty()
+
+            ConsoleCustomizer customizer = (ConsoleCustomizer) corePlugin.getCustomizers("gremlin-groovy").find{ it instanceof ConsoleCustomizer }
+            return Optional.of(new RemoteAcceptorAdapter(customizer.remoteAcceptor))
+        }
+    }
+
+    public static class RemoteAcceptorAdapter implements RemoteAcceptor {
+
+        private org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor remoteAcceptor
+
+        public RemoteAcceptorAdapter(org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor remoteAcceptor) {
+            this.remoteAcceptor = remoteAcceptor
+        }
+
+        @Override
+        Object connect(final List<String> args) throws RemoteException {
+            return remoteAcceptor.connect(args)
+        }
+
+        @Override
+        Object configure(final List<String> args) throws RemoteException {
+            return remoteAcceptor.configure(args)
+        }
+
+        @Override
+        Object submit(final List<String> args) throws RemoteException {
+            return remoteAcceptor.submit(args)
+        }
+
+        @Override
+        void close() throws IOException {
+            remoteAcceptor.close()
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/Customizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/Customizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/Customizer.java
index 60dc810..ee3548c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/Customizer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/Customizer.java
@@ -19,7 +19,9 @@
 package org.apache.tinkerpop.gremlin.jsr223;
 
 /**
- * The {@code Customizer} provides a general way to provide configurations to a {@link GremlinScriptEngine}.
+ * The {@code Customizer} provides a general way to provide configurations to a {@link GremlinScriptEngine}. This is an
+ * "internal" interface that acts as a marker and should not be implemented directly. Those wishing to write a
+ * {@code Customizer} should use one of its sub-interfaces, like {@link ImportCustomizer}
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java
index 1345841..f05b51c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java
@@ -18,6 +18,8 @@
  */
 package org.apache.tinkerpop.gremlin.jsr223;
 
+import org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor;
+
 import java.util.Optional;
 
 /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPlugin.java
index 390c027..163e364 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPlugin.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPlugin.java
@@ -58,13 +58,4 @@ public interface GremlinPlugin {
      * @param scriptEngineName The name of the {@code ScriptEngine} or null to get all the available {@code Customizers}
      */
     public Optional<Customizer[]> getCustomizers(final String scriptEngineName);
-
-    /**
-     * Allows a plugin to utilize features of the {@code :remote} and {@code :submit} commands of the Gremlin Console.
-     * This method does not need to be implemented if the plugin is not meant for the Console for some reason or
-     * if it does not intend to take advantage of those commands.
-     */
-    public default Optional<RemoteAcceptor> remoteAcceptor() {
-        return Optional.empty();
-    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPluginException.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPluginException.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPluginException.java
new file mode 100644
index 0000000..ce4ab2f
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPluginException.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+/**
+ * Base exception for {@link GremlinPlugin}.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public abstract class GremlinPluginException extends Exception {
+    public GremlinPluginException() {
+    }
+
+    public GremlinPluginException(final String message) {
+        super(message);
+    }
+
+    public GremlinPluginException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public GremlinPluginException(final Throwable cause) {
+        super(cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteAcceptor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteAcceptor.java
deleted file mode 100644
index 9c96892..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteAcceptor.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.jsr223;
-
-import java.io.Closeable;
-import java.util.List;
-
-/**
- * The Gremlin Console supports the {@code :remote} and {@code :submit} commands which provide standardized ways
- * for plugins to provide "remote connections" to resources and a way to "submit" a command to those resources.
- * A "remote connection" does not necessarily have to be a remote server.  It simply refers to a resource that is
- * external to the console.
- * <p/>
- * By implementing this interface and returning an instance of it through {@link GremlinPlugin#remoteAcceptor()} a
- * plugin can hook into those commands and provide remoting features.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public interface RemoteAcceptor extends Closeable {
-
-    public static final String RESULT = "result";
-
-    /**
-     * Gets called when {@code :remote} is used in conjunction with the "connect" option.  It is up to the
-     * implementation to decide how additional arguments on the line should be treated after "connect".
-     *
-     * @return an object to display as output to the user
-     * @throws RemoteException if there is a problem with connecting
-     */
-    public Object connect(final List<String> args) throws RemoteException;
-
-    /**
-     * Gets called when {@code :remote} is used in conjunction with the {@code config} option.  It is up to the
-     * implementation to decide how additional arguments on the line should be treated after {@code config}.
-     *
-     * @return an object to display as output to the user
-     * @throws RemoteException if there is a problem with configuration
-     */
-    public Object configure(final List<String> args) throws RemoteException;
-
-    /**
-     * Gets called when {@code :submit} is executed.  It is up to the implementation to decide how additional
-     * arguments on the line should be treated after {@code :submit}.
-     *
-     * @return an object to display as output to the user
-     * @throws RemoteException if there is a problem with submission
-     */
-    public Object submit(final List<String> args) throws RemoteException;
-
-    /**
-     * If the {@code RemoteAcceptor} is used in the Gremlin Console, then this method might be called to determine
-     * if it can be used in a fashion that supports the {@code :remote console} command.  By default, this value is
-     * set to {@code false}.
-     * <p/>
-     * A {@code RemoteAcceptor} should only return {@code true} for this method if it expects that all activities it
-     * supports are executed through the {@code :sumbit} command. If the users interaction with the remote requires
-     * working with both local and remote evaluation at the same time, it is likely best to keep this method return
-     * {@code false}. A good example of this type of plugin would be the Gephi Plugin which uses {@code :remote config}
-     * to configure a local {@code TraversalSource} to be used and expects calls to {@code :submit} for the same body
-     * of analysis.
-     */
-    public default boolean allowRemoteConsole() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteException.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteException.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteException.java
deleted file mode 100644
index a75e6d6..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.jsr223;
-
-/**
- * A mapper {@code Exception} to be thrown when there are problems with processing a command given to a
- * {@link RemoteAcceptor}.  The message provided to the exception will
- * be displayed to the user in the Console.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class RemoteException extends Exception {
-    public RemoteException(final String message) {
-        super(message);
-    }
-
-    public RemoteException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public RemoteException(final Throwable cause) {
-        super(cause);
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/ConsoleCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/ConsoleCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/ConsoleCustomizer.java
new file mode 100644
index 0000000..47771bc
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/ConsoleCustomizer.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223.console;
+
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface ConsoleCustomizer extends Customizer {
+    /**
+     * Allows a plugin to utilize features of the {@code :remote} and {@code :submit} commands of the Gremlin Console.
+     * This method does not need to be implemented if the plugin is not meant for the Console for some reason or
+     * if it does not intend to take advantage of those commands.
+     */
+    public RemoteAcceptor getRemoteAcceptor();
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/PluginAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/PluginAcceptor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/PluginAcceptor.java
new file mode 100644
index 0000000..ce8b913
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/PluginAcceptor.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223.console;
+
+import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
+
+import javax.script.ScriptException;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A {@link GremlinPlugin} can be used in multiple environments (e.g. ScriptEngine implementation).  Any environment
+ * wishing to allow plugins should implement the {@code PluginAcceptor}.  It acts as an adapter to those environments
+ * and provides the abstractions required for a plugin to work regardless of the environmental implementations.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface PluginAcceptor {
+
+    public void addImports(final Set<String> importStatements);
+
+    /**
+     * Add a variable binding for the plugin host.
+     */
+    public void addBinding(final String key, final Object val);
+
+    /**
+     * Gets the list of bindings from the plugin host.  These bindings will represent the "global" binding list.
+     */
+    public Map<String, Object> getBindings();
+
+    /**
+     * Evaluate a script in the {@code PluginAcceptor}.
+     */
+    public Object eval(final String script) throws ScriptException;
+
+    /**
+     * Returns a map of implementation specific variables that can be referenced by the plugin. Those writing
+     * plugins should examine the details of the various {@code PluginAcceptor} implementations for the variables
+     * that they pass, as they may provide important information useful to the plugin itself.
+     */
+    public default Map<String, Object> environment() {
+        return Collections.emptyMap();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java
new file mode 100644
index 0000000..aee77ae
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223.console;
+
+import java.io.Closeable;
+import java.util.List;
+
+/**
+ * The Gremlin Console supports the {@code :remote} and {@code :submit} commands which provide standardized ways
+ * for plugins to provide "remote connections" to resources and a way to "submit" a command to those resources.
+ * A "remote connection" does not necessarily have to be a remote server.  It simply refers to a resource that is
+ * external to the console.
+ * <p/>
+ * By implementing this interface and returning an instance of it through {@link ConsoleCustomizer#getRemoteAcceptor()}
+ * a plugin can hook into those commands and provide remoting features.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface RemoteAcceptor extends Closeable {
+
+    public static final String RESULT = "result";
+
+    /**
+     * Gets called when {@code :remote} is used in conjunction with the "connect" option.  It is up to the
+     * implementation to decide how additional arguments on the line should be treated after "connect".
+     *
+     * @return an object to display as output to the user
+     * @throws RemoteException if there is a problem with connecting
+     */
+    public Object connect(final List<String> args) throws RemoteException;
+
+    /**
+     * Gets called when {@code :remote} is used in conjunction with the {@code config} option.  It is up to the
+     * implementation to decide how additional arguments on the line should be treated after {@code config}.
+     *
+     * @return an object to display as output to the user
+     * @throws RemoteException if there is a problem with configuration
+     */
+    public Object configure(final List<String> args) throws RemoteException;
+
+    /**
+     * Gets called when {@code :submit} is executed.  It is up to the implementation to decide how additional
+     * arguments on the line should be treated after {@code :submit}.
+     *
+     * @return an object to display as output to the user
+     * @throws RemoteException if there is a problem with submission
+     */
+    public Object submit(final List<String> args) throws RemoteException;
+
+    /**
+     * If the {@code RemoteAcceptor} is used in the Gremlin Console, then this method might be called to determine
+     * if it can be used in a fashion that supports the {@code :remote console} command.  By default, this value is
+     * set to {@code false}.
+     * <p/>
+     * A {@code RemoteAcceptor} should only return {@code true} for this method if it expects that all activities it
+     * supports are executed through the {@code :sumbit} command. If the users interaction with the remote requires
+     * working with both local and remote evaluation at the same time, it is likely best to keep this method return
+     * {@code false}. A good example of this type of plugin would be the Gephi Plugin which uses {@code :remote config}
+     * to configure a local {@code TraversalSource} to be used and expects calls to {@code :submit} for the same body
+     * of analysis.
+     */
+    public default boolean allowRemoteConsole() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteException.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteException.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteException.java
new file mode 100644
index 0000000..7f4850b
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteException.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223.console;
+
+/**
+ * A mapper {@code Exception} to be thrown when there are problems with processing a command given to a
+ * {@link RemoteAcceptor}.  The message provided to the exception will
+ * be displayed to the user in the Console.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class RemoteException extends Exception {
+    public RemoteException(final String message) {
+        super(message);
+    }
+
+    public RemoteException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public RemoteException(final Throwable cause) {
+        super(cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPlugin.java
index 9e2b94e..86fb0d8 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPlugin.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPlugin.java
@@ -28,6 +28,7 @@ import java.util.Optional;
  * of this interface to install.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As for 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin}
  */
 public interface GremlinPlugin {
     public static final String ENVIRONMENT = "GremlinPlugin.env";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginAcceptor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginAcceptor.java
index 292ba35..9571381 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginAcceptor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginAcceptor.java
@@ -31,7 +31,9 @@ import java.util.Set;
  * and provides the abstractions required for a plugin to work regardless of the environmental implementations.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.console.PluginAcceptor}.
  */
+@Deprecated
 public interface PluginAcceptor {
     /**
      * If the {@code PluginAcceptor} implements the {@link DependencyManager} interface it will try to import the

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteAcceptor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteAcceptor.java
index b3d03fe..2bb8663 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteAcceptor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteAcceptor.java
@@ -33,7 +33,7 @@ import java.util.List;
  * plugin can hook into those commands and provide remoting features.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.RemoteAcceptor};
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor};
  */
 @Deprecated
 public interface RemoteAcceptor extends Closeable {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
index 34a37ae..9910a4c 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
@@ -56,6 +56,7 @@ public class GremlinEnabledScriptEngineTest {
         }
     }
 
+    @org.junit.Ignore("TEMPORARY - until GremlinJythonScriptEngine supports this stuff")
     @Test
     public void shouldSupportDeprecatedGremlinModules() throws Exception {
         final GremlinScriptEngineManager mgr = new DefaultGremlinScriptEngineManager();


[05/50] tinkerpop git commit: Removed gremlin-benchmark from javadoc generation.

Posted by sp...@apache.org.
Removed gremlin-benchmark from javadoc generation.

There really doesn't seem to be much value for generating javadoc out of this as it is an internal tool and we don't even deploy it as an artifact. CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/7af8052a
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7af8052a
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7af8052a

Branch: refs/heads/TINKERPOP-1562
Commit: 7af8052ab8984e99e808bff0ee71aad5f2450442
Parents: 71dd939
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Dec 1 14:08:21 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Dec 1 14:08:21 2016 -0500

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7af8052a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e58bf07..e4d1ba7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1058,7 +1058,7 @@ limitations under the License.
                                     <overview>${basedir}/docs/javadoc/overview.html</overview>
                                     <quiet>true</quiet>
                                     <sourcepath>
-                                        giraph-gremlin/src/main/java:gremlin-core/src/main/java:gremlin-driver/src/main/java:gremlin-groovy/src/main/java:gremlin-groovy-test/src/main/java:gremlin-server/src/main/java:gremlin-test/src/main/java:hadoop-gremlin/src/main/java:neo4j-gremlin/src/main/java:spark-gremlin/src/main/java:tinkergraph-gremlin/src/main/java:gremlin-benchmark/src/main/java
+                                        giraph-gremlin/src/main/java:gremlin-core/src/main/java:gremlin-driver/src/main/java:gremlin-groovy/src/main/java:gremlin-groovy-test/src/main/java:gremlin-server/src/main/java:gremlin-test/src/main/java:hadoop-gremlin/src/main/java:neo4j-gremlin/src/main/java:spark-gremlin/src/main/java:tinkergraph-gremlin/src/main/java
                                     </sourcepath>
                                 </configuration>
                             </execution>


[11/50] tinkerpop git commit: TINKERPOP-1562 Add GremlinModule for Giraph.

Posted by sp...@apache.org.
TINKERPOP-1562 Add GremlinModule for Giraph.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/299ad1c7
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/299ad1c7
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/299ad1c7

Branch: refs/heads/TINKERPOP-1562
Commit: 299ad1c778657e4b80f36218f70ce6c998164070
Parents: 9f65e6a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 07:54:35 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:50 2016 -0500

----------------------------------------------------------------------
 .../giraph/jsr223/GiraphGremlinModule.java      | 58 ++++++++++++++++++++
 1 file changed, 58 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/299ad1c7/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinModule.java
----------------------------------------------------------------------
diff --git a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinModule.java b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinModule.java
new file mode 100644
index 0000000..69f3586
--- /dev/null
+++ b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinModule.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.giraph.jsr223;
+
+import org.apache.tinkerpop.gremlin.giraph.process.computer.EmptyOutEdges;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphComputation;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphGraphComputer;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphMemory;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphMessageCombiner;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphMessenger;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphVertex;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphWorkerContext;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.MemoryAggregator;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.PassThroughMemory;
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinModule;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class GiraphGremlinModule extends AbstractGremlinModule {
+    private static final String MODULE_NAME = "tinkerpop.giraph";
+    private static final GiraphGremlinModule instance = new GiraphGremlinModule();
+
+    private GiraphGremlinModule() {
+        super(MODULE_NAME, ImportCustomizer.build().addClassImports(
+                EmptyOutEdges.class,
+                GiraphComputation.class,
+                GiraphGraphComputer.class,
+                GiraphMemory.class,
+                GiraphMessageCombiner.class,
+                GiraphMessenger.class,
+                GiraphVertex.class,
+                GiraphWorkerContext.class,
+                MemoryAggregator.class,
+                PassThroughMemory.class).create());
+    }
+
+    public static GiraphGremlinModule instance() {
+        return instance;
+    }
+}
\ No newline at end of file


[10/50] tinkerpop git commit: TINKERPOP-1562 Initial effort to deprecate ScriptEngines.

Posted by sp...@apache.org.
TINKERPOP-1562 Initial effort to deprecate ScriptEngines.

This opens up some options for how to move plugins up to gremlin-core (or deprecate them completely - not surehow that will flow yet). Anyway, this is a wip commit and a nice stop point.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/ddafaef9
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/ddafaef9
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/ddafaef9

Branch: refs/heads/TINKERPOP-1562
Commit: ddafaef99a7a4dbf7d434b845f43e24e14deea19
Parents: 53e932b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Nov 17 16:47:31 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:50 2016 -0500

----------------------------------------------------------------------
 .../gremlin/jsr223/AbstractGremlinModule.java   |  48 +++++
 .../gremlin/jsr223/CoreGremlinModule.java       |  43 ++++-
 .../gremlin/jsr223/ImportCustomizer.java        |   4 +
 .../gremlin/jsr223/ImportGremlinModule.java     | 174 +++++++++++++++++++
 .../gremlin/jsr223/ScriptCustomizer.java        |  56 ++++++
 .../gremlin/jsr223/ScriptFileModule.java        |  71 ++++++++
 .../gremlin/jsr223/ImportGremlinModuleTest.java | 149 ++++++++++++++++
 .../gremlin/groovy/engine/GremlinExecutor.java  |  76 +++++++-
 .../gremlin/groovy/engine/ScriptEngines.java    |   2 +
 .../tinkerpop/gremlin/server/Settings.java      |   8 +
 .../server/util/ServerGremlinExecutor.java      |  28 ++-
 11 files changed, 648 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ddafaef9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java
new file mode 100644
index 0000000..36104f6
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import java.util.Optional;
+import java.util.Set;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public abstract class AbstractGremlinModule implements GremlinModule {
+    protected final String moduleName;
+    protected final Customizer[] customizers;
+    protected final Set<String> appliesTo;
+
+    public AbstractGremlinModule(final String moduleName, final Set<String> appliesTo, final Customizer... customizers) {
+        this.moduleName = moduleName;
+        this.appliesTo = appliesTo;
+        this.customizers = customizers;
+    }
+
+    @Override
+    public String getName() {
+        return moduleName;
+    }
+
+    @Override
+    public Optional<Customizer[]> getCustomizers(final String scriptEngineName) {
+        return null == scriptEngineName || appliesTo.isEmpty() || appliesTo.contains(scriptEngineName) ?
+                Optional.of(customizers) : Optional.empty();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ddafaef9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
index dfe9f93..f1fdbe4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
@@ -18,6 +18,8 @@
  */
 package org.apache.tinkerpop.gremlin.jsr223;
 
+import org.apache.tinkerpop.gremlin.util.CoreImports;
+
 import java.util.Optional;
 
 /**
@@ -25,21 +27,54 @@ import java.util.Optional;
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public class CoreGremlinModule implements GremlinModule {
+public final class CoreGremlinModule implements GremlinModule {
+
+    private static final String MODULE_NAME = "tinkerpop.core";
+
+    private static final ImportCustomizer gremlinCore = ImportCustomizer.build()
+            .addClassImports(CoreImports.getClassImports())
+            .addEnumImports(CoreImports.getEnumImports())
+            .addMethodImports(CoreImports.getMethodImports()).create();
 
-    private static final Optional<Customizer[]> CUSTOMIZERS = Optional.of(new Customizer[] { ImportCustomizer.GREMLIN_CORE });
+    private static final Customizer[] customizers = new Customizer[] {gremlinCore};
+    private static final Builder builder = new Builder();
 
+    /**
+     * @deprecated As of 3.2.4, replaced by {@link #instance()} as this field will later become private.
+     */
+    @Deprecated
     public static final CoreGremlinModule INSTANCE = new CoreGremlinModule();
 
     private CoreGremlinModule() {}
 
+    public static CoreGremlinModule instance() {
+        return INSTANCE;
+    }
+
     @Override
     public Optional<Customizer[]> getCustomizers(final String scriptEngineName) {
-        return CUSTOMIZERS;
+        return Optional.of(customizers);
     }
 
     @Override
     public String getName() {
-        return "tinkerpop.core";
+        return MODULE_NAME;
+    }
+
+    /**
+     * {@link GremlinModule} instances all use a builder pattern for instantiation via configuration. This method is
+     * just provided for consistency with that pattern. When instantiating programmatically, use {@link #instance()}.
+     */
+    public static Builder build() {
+        return builder;
+    }
+
+    public final static class Builder {
+
+        private Builder() {}
+
+        public CoreGremlinModule create() {
+            return instance();
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ddafaef9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
index 6070839..2f0e08c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
@@ -34,6 +34,10 @@ import java.util.Set;
  */
 public class ImportCustomizer implements Customizer {
 
+    /**
+     * @deprecated As of release 3.2.4, not replaced.
+     */
+    @Deprecated
     public static final ImportCustomizer GREMLIN_CORE = ImportCustomizer.build()
             .addClassImports(CoreImports.getClassImports())
             .addEnumImports(CoreImports.getEnumImports())

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ddafaef9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModule.java
new file mode 100644
index 0000000..9fcbbce
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModule.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Optional;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * A module that allows custom class, static method and enum imports (i.e. those that are statically defined by a
+ * module within itself). A user might utilize this class to supply their own imports. This module is not specific
+ * to any {@link GremlinScriptEngine} - the imports are supplied to all engines.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class ImportGremlinModule extends AbstractGremlinModule {
+    private static final String MODULE_NAME = "tinkerpop.import";
+
+    private ImportGremlinModule(final Builder builder) {
+        super(MODULE_NAME, builder.appliesTo, ImportCustomizer.build()
+                                                .addClassImports(builder.classImports)
+                                                .addEnumImports(builder.enumImports)
+                                                .addMethodImports(builder.methodImports).create());
+    }
+
+    public static Builder build() {
+        return new Builder();
+    }
+
+    public static final class Builder {
+        private static final Pattern METHOD_PATTERN = Pattern.compile("(.*)#(.*)\\((.*)\\)");
+        private static final Pattern ENUM_PATTERN = Pattern.compile("(.*)#(.*)");
+        private Set<Class> classImports = new HashSet<>();
+        private Set<Method> methodImports = new HashSet<>();
+        private Set<Enum> enumImports = new HashSet<>();
+        private final Set<String> appliesTo = new HashSet<>();
+
+        private Builder() {}
+
+        /**
+         * The name of the {@link GremlinScriptEngine} that this module will apply to. Setting no values here will
+         * make the module available to all the engines.
+         */
+        public Builder appliesTo(final Collection<String> scriptEngineName) {
+            this.appliesTo.addAll(scriptEngineName);
+            return this;
+        }
+
+        public Builder classImports(final Collection<String> classes) {
+            for (String clazz : classes) {
+                try {
+                    classImports.add(Class.forName(clazz));
+                } catch (Exception ex) {
+                    throw new IllegalStateException(ex);
+                }
+            }
+            return this;
+        }
+
+        public Builder methodImports(final Collection<String> methods) {
+            for (String method : methods) {
+                try {
+                    if (method.endsWith("#*")) {
+                        final String classString = method.substring(0, method.length() - 2);
+                        final Class<?> clazz = Class.forName(classString);
+                        methodImports.addAll(allStaticMethods(clazz));
+                    } else {
+                        final Matcher matcher = METHOD_PATTERN.matcher(method);
+
+                        if (!matcher.matches())
+                            throw new IllegalArgumentException(String.format("Could not read method descriptor - check format of: %s", method));
+
+                        final String classString = matcher.group(1);
+                        final String methodString = matcher.group(2);
+                        final String argString = matcher.group(3);
+                        final Class<?> clazz = Class.forName(classString);
+                        methodImports.add(clazz.getMethod(methodString, parse(argString)));
+                    }
+                } catch (IllegalArgumentException iae) {
+                    throw iae;
+                } catch (Exception ex) {
+                    throw new IllegalStateException(ex);
+                }
+            }
+            return this;
+        }
+
+        public Builder enumImports(final Collection<String> enums) {
+            for (String enumItem : enums) {
+                try {
+                    if (enumItem.endsWith("#*")) {
+                        final String classString = enumItem.substring(0, enumItem.length() - 2);
+                        final Class<?> clazz = Class.forName(classString);
+                        enumImports.addAll(allEnums(clazz));
+                    } else {
+                        final Matcher matcher = ENUM_PATTERN.matcher(enumItem);
+
+                        if (!matcher.matches())
+                            throw new IllegalArgumentException(String.format("Could not read enum descriptor - check format of: %s", enumItem));
+
+                        final String classString = matcher.group(1);
+                        final String enumValString = matcher.group(2);
+                        final Class<?> clazz = Class.forName(classString);
+
+                        Stream.of(clazz.getEnumConstants())
+                                .filter(e -> ((Enum) e).name().equals(enumValString))
+                                .findFirst().ifPresent(e -> enumImports.add((Enum) e));
+                    }
+                } catch (IllegalArgumentException iae) {
+                    throw iae;
+                } catch (Exception ex) {
+                    throw new IllegalStateException(ex);
+                }
+            }
+            return this;
+        }
+
+        public ImportGremlinModule create() {
+            if (enumImports.isEmpty() && classImports.isEmpty() && methodImports.isEmpty())
+                throw new IllegalStateException("At least one import must be specified");
+
+            return new ImportGremlinModule(this);
+        }
+
+        private static List<Enum> allEnums(final Class<?> clazz) {
+            return Stream.of(clazz.getEnumConstants()).map(e -> (Enum) e).collect(Collectors.toList());
+        }
+
+        private static List<Method> allStaticMethods(final Class<?> clazz) {
+            return Stream.of(clazz.getMethods()).filter(m -> Modifier.isStatic(m.getModifiers())).collect(Collectors.toList());
+        }
+
+        private static Class<?>[] parse(final String argString) {
+            if (null == argString || argString.isEmpty())
+                return new Class<?>[0];
+
+            final List<String> args = Stream.of(argString.split(",")).map(String::trim).collect(Collectors.toList());
+            final Class<?>[] classes = new Class<?>[args.size()];
+            for (int ix = 0; ix < args.size(); ix++) {
+                try {
+                    classes[ix] = Class.forName(args.get(ix));
+                } catch (Exception ex) {
+                    throw new IllegalStateException(ex);
+                }
+            }
+
+            return classes;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ddafaef9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptCustomizer.java
new file mode 100644
index 0000000..28603df
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptCustomizer.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class ScriptCustomizer implements Customizer {
+
+    private final Collection<List<String>> scripts;
+
+    public ScriptCustomizer(final Set<File> files) {
+        this(files.stream().map(f -> {
+            try {
+                return Files.lines(f.toPath(), StandardCharsets.UTF_8).collect(Collectors.toList());
+            } catch (IOException ioe) {
+                throw new IllegalStateException(ioe);
+            }
+        }).collect(Collectors.toList()));
+    }
+
+    public ScriptCustomizer(final Collection<List<String>> scripts) {
+        this.scripts = scripts;
+    }
+
+    public Collection<List<String>> scripts() {
+        return scripts;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ddafaef9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileModule.java
new file mode 100644
index 0000000..b5c0d0c
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileModule.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class ScriptFileModule extends AbstractGremlinModule {
+    private static final String MODULE_NAME = "tinkerpop.script";
+
+    public ScriptFileModule(final Builder builder) {
+        super(MODULE_NAME, builder.appliesTo, new ScriptCustomizer(builder.files));
+    }
+
+    public static Builder build() {
+        return new Builder();
+    }
+
+    public static final class Builder {
+
+        private final Set<String> appliesTo = new HashSet<>();
+        private Set<File> files = new HashSet<>();
+
+        private Builder() {}
+
+        /**
+         * The name of the {@link GremlinScriptEngine} that this module will apply to. Setting no values here will
+         * make the module available to all the engines.
+         */
+        public Builder appliesTo(final Collection<String> scriptEngineName) {
+            this.appliesTo.addAll(scriptEngineName);
+            return this;
+        }
+
+        public Builder files(final Set<String> files) {
+            for (String f : files) {
+                final File file = new File(f);
+                if (!file.exists()) throw new IllegalArgumentException(new FileNotFoundException(f));
+                this.files.add(file);
+            }
+
+            return this;
+        }
+
+        public ScriptFileModule create() {
+            return new ScriptFileModule(this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ddafaef9/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModuleTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModuleTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModuleTest.java
new file mode 100644
index 0000000..ce62357
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModuleTest.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.io.IoCore;
+import org.apache.tinkerpop.gremlin.util.Gremlin;
+import org.junit.Test;
+
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsCollectionContaining.hasItems;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class ImportGremlinModuleTest {
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldImportSomething() {
+        ImportGremlinModule.build().create();
+    }
+
+    @Test
+    public void shouldImportClass() {
+        final ImportGremlinModule module = ImportGremlinModule.build()
+                .classImports(Collections.singletonList(Graph.class.getCanonicalName())).create();
+
+        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        assertEquals(1, module.getCustomizers().get().length);
+        assertThat(customizer.getClassImports(), hasItems(Graph.class));
+        assertEquals(1, customizer.getClassImports().size());
+    }
+
+    @Test
+    public void shouldImportWildcardMethod() throws Exception {
+        final Method zeroArgs = Gremlin.class.getMethod("version");
+        final ImportGremlinModule module = ImportGremlinModule.build()
+                .methodImports(Collections.singletonList(Gremlin.class.getCanonicalName() + "#*")).create();
+
+        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        assertEquals(1, module.getCustomizers().get().length);
+        assertThat(customizer.getMethodImports(), hasItems(zeroArgs));
+
+        // will also have the static main() method
+        assertEquals(2, customizer.getMethodImports().size());
+    }
+
+    @Test
+    public void shouldImportZeroArgMethod() throws Exception {
+        final Method zeroArgs = Gremlin.class.getMethod("version");
+        final ImportGremlinModule module = ImportGremlinModule.build()
+                .methodImports(Collections.singletonList(toMethodDescriptor(zeroArgs))).create();
+
+        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        assertEquals(1, module.getCustomizers().get().length);
+        assertThat(customizer.getMethodImports(), hasItems(zeroArgs));
+        assertEquals(1, customizer.getMethodImports().size());
+    }
+
+    @Test
+    public void shouldImportSingleArgMethod() throws Exception {
+        final Method singleArg = IoCore.class.getMethod("createIoBuilder", String.class);
+        final ImportGremlinModule module = ImportGremlinModule.build()
+                .methodImports(Collections.singletonList(toMethodDescriptor(singleArg))).create();
+
+        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        assertEquals(1, module.getCustomizers().get().length);
+        assertThat(customizer.getMethodImports(), hasItems(singleArg));
+        assertEquals(1, customizer.getMethodImports().size());
+    }
+
+    @Test
+    public void shouldThrowExceptionIfInvalidMethodDescriptor() throws Exception {
+        final String badDescriptor = "Gremlin*version";
+        try {
+            ImportGremlinModule.build()
+                    .methodImports(Collections.singletonList(badDescriptor)).create();
+            fail("Should have failed parsing the method descriptor");
+        } catch (IllegalArgumentException iae) {
+            assertEquals(iae.getMessage(), "Could not read method descriptor - check format of: " + badDescriptor);
+        }
+    }
+
+    @Test
+    public void shouldImportWildcardEnum() throws Exception {
+        final ImportGremlinModule module = ImportGremlinModule.build()
+                .enumImports(Collections.singletonList(T.class.getCanonicalName() + "#*")).create();
+
+        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        assertEquals(1, module.getCustomizers().get().length);
+        assertThat(customizer.getEnumImports(), hasItems(T.id, T.key, T.label, T.value));
+        assertEquals(4, customizer.getEnumImports().size());
+    }
+
+    @Test
+    public void shouldImportEnum() throws Exception {
+        final ImportGremlinModule module = ImportGremlinModule.build()
+                .enumImports(Collections.singletonList(T.class.getCanonicalName() + "#" + T.id.name())).create();
+
+        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        assertEquals(1, module.getCustomizers().get().length);
+        assertThat(customizer.getEnumImports(), hasItems(T.id));
+    }
+
+    @Test
+    public void shouldThrowExceptionIfInvalidEnumDescriptor() throws Exception {
+        final String badDescriptor = "T*id";
+        try {
+            ImportGremlinModule.build()
+                    .enumImports(Collections.singletonList(badDescriptor)).create();
+            fail("Should have failed parsing the enum descriptor");
+        } catch (IllegalArgumentException iae) {
+            assertEquals("Could not read enum descriptor - check format of: " + badDescriptor, iae.getMessage());
+        }
+    }
+
+    private static String toMethodDescriptor(final Method method) {
+        return method.getDeclaringClass().getCanonicalName() +
+                "#" +
+                method.getName() +
+                '(' +
+                String.join(",", Stream.of(method.getParameters()).map(p -> p.getType().getCanonicalName()).collect(Collectors.toList())) +
+                ')';
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ddafaef9/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index cc30f99..90a3b43 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -22,6 +22,9 @@ import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine;
 import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin;
 import org.apache.commons.lang3.concurrent.BasicThreadFactory;
+import org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinModule;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngineManager;
 import org.javatuples.Pair;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -33,6 +36,7 @@ import javax.script.SimpleBindings;
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -51,11 +55,11 @@ import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.BiConsumer;
 import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * Execute Gremlin scripts against a {@code ScriptEngine} instance.  It is designed to host any JSR-223 enabled
@@ -79,7 +83,10 @@ public class GremlinExecutor implements AutoCloseable {
      */
     private ScriptEngines scriptEngines;
 
+    private GremlinScriptEngineManager manager;
+
     private final Map<String, EngineSettings> settings;
+    private final Map<String, Map<String, Map<String,Object>>> modules;
     private final long scriptEvaluationTimeout;
     private final Bindings globalBindings;
     private final List<List<String>> use;
@@ -92,6 +99,7 @@ public class GremlinExecutor implements AutoCloseable {
     private final Set<String> enabledPlugins;
     private final boolean suppliedExecutor;
     private final boolean suppliedScheduledExecutor;
+    private boolean useGremlinScriptEngineManager;
 
     private GremlinExecutor(final Builder builder, final boolean suppliedExecutor,
                             final boolean suppliedScheduledExecutor) {
@@ -104,10 +112,22 @@ public class GremlinExecutor implements AutoCloseable {
         this.afterFailure = builder.afterFailure;
         this.use = builder.use;
         this.settings = builder.settings;
+        this.modules = builder.modules;
         this.scriptEvaluationTimeout = builder.scriptEvaluationTimeout;
         this.globalBindings = builder.globalBindings;
         this.enabledPlugins = builder.enabledPlugins;
-        this.scriptEngines = createScriptEngines();
+
+        this.manager = new CachedGremlinScriptEngineManager();
+        initializeGremlinScriptEngineManager();
+
+        // this is temporary so that we can have backward compatibilty to the old plugin system and ScriptEngines
+        // approach to configuring Gremlin Server and GremlinExecutor. This code/check should be removed with the
+        // deprecated code around this is removed.
+        if (!useGremlinScriptEngineManager)
+            this.scriptEngines = createScriptEngines();
+        else
+            this.scriptEngines = null;
+
         this.suppliedExecutor = suppliedExecutor;
         this.suppliedScheduledExecutor = suppliedScheduledExecutor;
     }
@@ -284,7 +304,9 @@ public class GremlinExecutor implements AutoCloseable {
 
                 logger.debug("Evaluating script - {} - in thread [{}]", script, Thread.currentThread().getName());
 
-                final Object o = scriptEngines.eval(script, bindings, lang);
+                // do this weirdo check until the now deprecated ScriptEngines is gutted
+                final Object o = useGremlinScriptEngineManager ?
+                        manager.getEngineByName(lang).eval(script, bindings) : scriptEngines.eval(script, bindings, lang);
 
                 // apply a transformation before sending back the result - useful when trying to force serialization
                 // in the same thread that the eval took place given ThreadLocal nature of graphs as well as some
@@ -396,6 +418,46 @@ public class GremlinExecutor implements AutoCloseable {
         return future;
     }
 
+    private void initializeGremlinScriptEngineManager() {
+        this.useGremlinScriptEngineManager = !modules.entrySet().isEmpty();
+
+        for (Map.Entry<String, Map<String, Map<String,Object>>> config : modules.entrySet()) {
+            final String language = config.getKey();
+            final Map<String, Map<String,Object>> moduleConfigs = config.getValue();
+            for (Map.Entry<String, Map<String,Object>> moduleConfig : moduleConfigs.entrySet()) {
+                try {
+                    final Class<?> clazz = Class.forName(moduleConfig.getKey());
+                    final Method builderMethod = clazz.getMethod("build");
+                    Object moduleBuilder = builderMethod.invoke(null);
+
+                    final Class<?> builderClazz = moduleBuilder.getClass();
+                    final Map<String,Object> customizerConfigs = moduleConfig.getValue();
+                    final Method[] methods = builderClazz.getMethods();
+                    for (Map.Entry<String,Object> customizerConfig : customizerConfigs.entrySet()) {
+                        final Method configMethod = Stream.of(methods).filter(m -> m.getName().equals(customizerConfig.getKey())).findFirst()
+                                .orElseThrow(() -> new IllegalStateException("Could not find builder method on " + builderClazz.getCanonicalName()));
+                        if (null == customizerConfig.getValue())
+                            moduleBuilder = configMethod.invoke(moduleBuilder);
+                        else
+                            moduleBuilder = configMethod.invoke(moduleBuilder, customizerConfig.getValue());
+                    }
+
+                    try {
+                        final Method appliesTo = builderClazz.getMethod("appliesTo");
+                        moduleBuilder = appliesTo.invoke(moduleBuilder, language);
+                    } catch (NoSuchMethodException ignored) {
+
+                    }
+
+                    final Method create = builderClazz.getMethod("create");
+                    manager.addModule((GremlinModule) create.invoke(moduleBuilder));
+                } catch (Exception ex) {
+                    throw new IllegalStateException(ex);
+                }
+            }
+        }
+    }
+
     private ScriptEngines createScriptEngines() {
         // plugins already on the path - ones static to the classpath
         final List<GremlinPlugin> globalPlugins = new ArrayList<>();
@@ -490,6 +552,9 @@ public class GremlinExecutor implements AutoCloseable {
     public final static class Builder {
         private long scriptEvaluationTimeout = 8000;
         private Map<String, EngineSettings> settings = new HashMap<>();
+
+        private Map<String, Map<String, Map<String,Object>>> modules = new HashMap<>();
+
         private ExecutorService executorService = null;
         private ScheduledExecutorService scheduledExecutorService = null;
         private Set<String> enabledPlugins = new HashSet<>();
@@ -528,6 +593,11 @@ public class GremlinExecutor implements AutoCloseable {
             return this;
         }
 
+        public Builder addModules(final String engineName, final Map<String, Map<String,Object>> modules) {
+            this.modules.put(engineName, modules);
+            return this;
+        }
+
         /**
          * Bindings to apply to every script evaluated. Note that the entries of the supplied {@code Bindings} object
          * will be copied into a newly created {@link org.apache.tinkerpop.gremlin.jsr223.ConcurrentBindings} object

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ddafaef9/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/ScriptEngines.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/ScriptEngines.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/ScriptEngines.java
index 3984dbb..6911419 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/ScriptEngines.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/ScriptEngines.java
@@ -64,7 +64,9 @@ import java.util.stream.Stream;
  * Holds a batch of the configured {@code ScriptEngine} objects for the server.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, not directly replaced - see {@link GremlinScriptEngineManager}.
  */
+@Deprecated
 public class ScriptEngines implements AutoCloseable {
     private static final Logger logger = LoggerFactory.getLogger(ScriptEngines.class);
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ddafaef9/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java
index 4bb2089..a8395bb 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java
@@ -20,6 +20,8 @@ package org.apache.tinkerpop.gremlin.server;
 
 import io.netty.handler.ssl.SslContext;
 import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinModule;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.server.auth.AllowAllAuthenticator;
@@ -258,6 +260,7 @@ public class Settings {
         scriptEngineSettingsDescription.putListPropertyType("staticImports", String.class);
         scriptEngineSettingsDescription.putListPropertyType("scripts", String.class);
         scriptEngineSettingsDescription.putMapPropertyType("config", String.class, Object.class);
+        scriptEngineSettingsDescription.putMapPropertyType("modules", String.class, Object.class);
         constructor.addTypeDescription(scriptEngineSettingsDescription);
 
         final TypeDescription sslSettings = new TypeDescription(SslSettings.class);
@@ -336,6 +339,11 @@ public class Settings {
          * {@code ScriptEngine} implementation being used.
          */
         public Map<String, Object> config = null;
+
+        /**
+         * A set of configurations for {@link GremlinModule} instances to apply to this {@link GremlinScriptEngine}.
+         */
+        public Map<String,Map<String,Object>> modules = new HashMap<>();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ddafaef9/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
index c8870ed..eda1d8d 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
@@ -19,6 +19,7 @@
 package org.apache.tinkerpop.gremlin.server.util;
 
 import org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor;
+import org.apache.tinkerpop.gremlin.jsr223.ImportGremlinModule;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.server.Channelizer;
 import org.apache.tinkerpop.gremlin.server.GraphManager;
@@ -28,7 +29,9 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -127,10 +130,27 @@ public class ServerGremlinExecutor<T extends ScheduledExecutorService> {
                 .scheduledExecutorService(this.scheduledExecutorService);
 
         settings.scriptEngines.forEach((k, v) -> {
-            // make sure that server related classes are available at init
-            v.imports.add(LifeCycleHook.class.getCanonicalName());
-            v.imports.add(LifeCycleHook.Context.class.getCanonicalName());
-            gremlinExecutorBuilder.addEngineSettings(k, v.imports, v.staticImports, v.scripts, v.config);
+            // use modules if they are present and the old approach if not
+            if (v.modules.isEmpty()) {
+                // make sure that server related classes are available at init - ultimately this body of code will be
+                // deleted when deprecation is removed
+                v.imports.add(LifeCycleHook.class.getCanonicalName());
+                v.imports.add(LifeCycleHook.Context.class.getCanonicalName());
+                gremlinExecutorBuilder.addEngineSettings(k, v.imports, v.staticImports, v.scripts, v.config);
+            } else {
+                // make sure that server related classes are available at init - ultimately this is the right way to
+                // do things going forward.
+                // TODO: though this Import is kinda sketchy.
+                if (v.modules.containsKey(ImportGremlinModule.class.getName())) {
+                    final List<String> listToAddImportsTo = (List<String>) v.modules.get(ImportGremlinModule.class.getName()).get("classImports");
+                    listToAddImportsTo.addAll(Arrays.asList(LifeCycleHook.class.getName(), LifeCycleHook.Context.class.getName()));
+                } else {
+                    final Map<String,Object> imports = new HashMap<>();
+                    imports.put("classImports", Arrays.asList(LifeCycleHook.class.getName(), LifeCycleHook.Context.class.getName()));
+                    v.modules.put(ImportGremlinModule.class.getName(), imports);
+                }
+                gremlinExecutorBuilder.addModules(k, v.modules);
+            }
         });
 
         gremlinExecutor = gremlinExecutorBuilder.create();


[04/50] tinkerpop git commit: Make javadoc deprecation message consistent rest of code base CTR

Posted by sp...@apache.org.
Make javadoc deprecation message consistent rest of code base CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/71dd9393
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/71dd9393
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/71dd9393

Branch: refs/heads/TINKERPOP-1562
Commit: 71dd9393bc3ff407a9ef9e3a91d3e73fc61b17e7
Parents: 46888b1
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Dec 1 13:11:03 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Dec 1 13:11:03 2016 -0500

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/process/traversal/Bindings.java | 2 +-
 .../tinkerpop/gremlin/process/traversal/TraversalEngine.java | 2 +-
 .../gremlin/process/traversal/TraversalSideEffects.java      | 8 ++++----
 .../tinkerpop/gremlin/process/traversal/TraversalSource.java | 2 +-
 .../gremlin/process/traversal/step/map/GroupStepV3d0.java    | 2 +-
 .../traversal/step/map/LambdaCollectingBarrierStep.java      | 2 +-
 .../traversal/strategy/decoration/SubgraphStrategy.java      | 4 ++--
 .../gremlin/process/traversal/util/TraversalHelper.java      | 2 +-
 .../gremlin/hadoop/structure/HadoopConfiguration.java        | 4 ++--
 9 files changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/71dd9393/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
index d399bb2..37d2bb8 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
@@ -45,7 +45,7 @@ public final class Bindings {
     private static final ThreadLocal<Map<Object, String>> MAP = new ThreadLocal<>();
 
     /**
-     * @deprecated Since 3.2.4. Instead, use {@link Bindings#instance()}.
+     * @deprecated As of release 3.2.4, replaced by {@link Bindings#instance()}.
      */
     @Deprecated
     public Bindings() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/71dd9393/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalEngine.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalEngine.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalEngine.java
index 6003dc8..052b99b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalEngine.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalEngine.java
@@ -33,7 +33,7 @@ import java.util.Optional;
  * Every {@link TraversalSource} should be provided a {@link TraversalEngine.Builder} so it can construct an engine for each spawned {@link Traversal}.
  *
  * @author Marko A. Rodriguez (http://markorodriguez.com)
- * @deprecated Since 3.2.0. Please use `Computer`.
+ * @deprecated As of release 3.2.0, replaced by {@code Computer}.
  */
 @Deprecated
 public interface TraversalEngine extends Serializable {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/71dd9393/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java
index ae6ef54..108eb99 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java
@@ -240,7 +240,7 @@ public interface TraversalSideEffects extends Cloneable, Serializable, AutoClose
      *
      * @param key      the key to register the supplier with
      * @param supplier the supplier that will generate an object when get() is called if it hasn't already been created
-     * @deprecated Since 3.2.0 -- use {@link TraversalSideEffects#register(String, Supplier, BinaryOperator)}.
+     * @deprecated As of release 3.2.0, replaced by {@link TraversalSideEffects#register(String, Supplier, BinaryOperator)}.
      */
     @Deprecated
     public void registerSupplier(final String key, final Supplier supplier);
@@ -251,7 +251,7 @@ public interface TraversalSideEffects extends Cloneable, Serializable, AutoClose
      *
      * @param key      the key of the supplier to register
      * @param supplier the supplier to register if the key has not already been registered
-     * @deprecated Since 3.2.0 -- use {@link TraversalSideEffects#registerIfAbsent(String, Supplier, BinaryOperator)}.
+     * @deprecated As of release 3.2.0, replaced by {@link TraversalSideEffects#registerIfAbsent(String, Supplier, BinaryOperator)}.
      */
     @Deprecated
     public default void registerSupplierIfAbsent(final String key, final Supplier supplier) {
@@ -265,7 +265,7 @@ public interface TraversalSideEffects extends Cloneable, Serializable, AutoClose
      * @param key the key associated with the supplier
      * @param <V> The object type of the supplier
      * @return A non-empty optional if the supplier exists
-     * @deprecated Since 3.2.0 -- use {@link TraversalSideEffects#getSupplier(String)}.
+     * @deprecated As of release 3.2.0, replaced by {@link TraversalSideEffects#getSupplier(String)}.
      */
     @Deprecated
     public <V> Optional<Supplier<V>> getRegisteredSupplier(final String key);
@@ -281,7 +281,7 @@ public interface TraversalSideEffects extends Cloneable, Serializable, AutoClose
      * @param orCreate if the object doesn't exist as an object or suppliable object, then generate it with the specified supplier
      * @param <V>      the return type of the object
      * @return the object that is either retrieved, generated, or supplier via orCreate
-     * @deprecated Since 3.2.0 -- use {@link TraversalSideEffects#register(String, Supplier, BinaryOperator)} to register side-effects.
+     * @deprecated As of release 3.2.0, replaced by {@link TraversalSideEffects#register(String, Supplier, BinaryOperator)} to register side-effects.
      */
     @Deprecated
     public default <V> V getOrCreate(final String key, final Supplier<V> orCreate) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/71dd9393/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
index 32c034a..8fd8c99 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
@@ -134,7 +134,7 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
      *
      * @param bindings the bindings instance to use
      * @return a new traversal source with set bindings
-     * @deprecated Since 3.2.4, simply use {@link Bindings} without reference to a {@link TraversalSource}.
+     * @deprecated As of release 3.2.4, replaced by use of {@link Bindings} without reference to a {@link TraversalSource}.
      */
     @Deprecated
     public default TraversalSource withBindings(final Bindings bindings) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/71dd9393/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStepV3d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStepV3d0.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStepV3d0.java
index c630992..d27764a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStepV3d0.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStepV3d0.java
@@ -43,7 +43,7 @@ import java.util.function.BinaryOperator;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
- * @deprecated Since 3.1.0 -- use {@link GroupStep}
+ * @deprecated As of release 3.1.0, replaced by {@link GroupStep}.
  */
 public final class GroupStepV3d0<S, K, V, R> extends ReducingBarrierStep<S, Map<K, R>> implements TraversalParent, ByModulating {
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/71dd9393/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java
index 0019708..8ffe2b3 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java
@@ -33,7 +33,7 @@ import java.util.function.Consumer;
 public final class LambdaCollectingBarrierStep<S> extends CollectingBarrierStep<S> implements LambdaHolder {
 
     /**
-     * @deprecated Since 3.2.0 -- use {@link NoOpBarrierStep}.
+     * @deprecated As of release 3.2.0, replaced by use of {@link NoOpBarrierStep}.
      */
     @Deprecated
     public enum Consumers implements Consumer<TraverserSet<Object>> {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/71dd9393/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
index 8544a20..4747cd4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
@@ -340,14 +340,14 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
 
         @Deprecated
         /**
-         * @deprecated Since 3.2.2, use {@code Builder#vertices} instead.
+         * @deprecated As of release 3.2.2, replaced by {@code Builder#vertices}.
          */
         public Builder vertexCriterion(final Traversal<Vertex, ?> predicate) {
             return this.vertices(predicate);
         }
 
         /**
-         * @deprecated Since 3.2.2, use {@code Builder#edges} instead.
+         * @deprecated As of release 3.2.2, replaced by {@code Builder#edges}.
          */
         @Deprecated
         public Builder edgeCriterion(final Traversal<Edge, ?> predicate) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/71dd9393/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
index c8ec3f3..567ce53 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
@@ -480,7 +480,7 @@ public final class TraversalHelper {
     }
 
     /**
-     * @deprecated Since 3.2.3. Only used by {@link org.apache.tinkerpop.gremlin.process.traversal.step.map.GroupStepV3d0}.
+     * @deprecated As of release 3.2.3, not replaced - only used by {@link org.apache.tinkerpop.gremlin.process.traversal.step.map.GroupStepV3d0}.
      */
     @Deprecated
     public static <S> void addToCollectionUnrollIterator(final Collection<S> collection, final S s, final long bulk) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/71dd9393/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopConfiguration.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopConfiguration.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopConfiguration.java
index 9aac248..f505bbd 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopConfiguration.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopConfiguration.java
@@ -117,7 +117,7 @@ public final class HadoopConfiguration extends AbstractConfiguration implements
     }
 
     /**
-     * @deprecated Since 3.2.0, please use {@link HadoopConfiguration#getGraphReader()}.
+     * @deprecated As of release 3.2.0, replaced by {@link HadoopConfiguration#getGraphReader()}.
      */
     @Deprecated
     public Class<InputFormat<NullWritable, VertexWritable>> getGraphInputFormat() {
@@ -129,7 +129,7 @@ public final class HadoopConfiguration extends AbstractConfiguration implements
     }
 
     /**
-     * @deprecated Since 3.2.0, please use {@link HadoopConfiguration#getGraphWriter()}.
+     * @deprecated As of release 3.2.0, replaced by {@link HadoopConfiguration#getGraphWriter()}.
      */
     @Deprecated
     public Class<OutputFormat<NullWritable, VertexWritable>> getGraphOutputFormat() {


[50/50] tinkerpop git commit: TINKERPOP-1562 Moved CoreImports to jsr223 package.

Posted by sp...@apache.org.
TINKERPOP-1562 Moved CoreImports to jsr223 package.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c2e71dc0
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c2e71dc0
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c2e71dc0

Branch: refs/heads/TINKERPOP-1562
Commit: c2e71dc06279bb708111c264f33507f927f06b4d
Parents: a82c56f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Dec 1 06:40:59 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:51 2016 -0500

----------------------------------------------------------------------
 .../gremlin/jsr223/CoreGremlinModule.java       |   2 -
 .../gremlin/jsr223/CoreGremlinPlugin.java       |   2 -
 .../tinkerpop/gremlin/jsr223/CoreImports.java   | 250 +++++++++++++++++++
 .../DefaultGremlinScriptEngineManager.java      |   2 -
 .../gremlin/jsr223/ImportCustomizer.java        |   2 -
 .../tinkerpop/gremlin/util/CoreImports.java     |   1 +
 .../python/TraversalSourceGenerator.groovy      |   2 +-
 .../jsr223/GremlinJythonScriptEngine.java       |   2 +-
 8 files changed, 253 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c2e71dc0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
index d398f89..369e171 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
@@ -18,8 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.jsr223;
 
-import org.apache.tinkerpop.gremlin.util.CoreImports;
-
 import java.util.Optional;
 
 /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c2e71dc0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
index a3063cf..8882e36 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
@@ -18,8 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.jsr223;
 
-import org.apache.tinkerpop.gremlin.util.CoreImports;
-
 import java.util.Optional;
 
 /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c2e71dc0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
new file mode 100644
index 0000000..2244ae9
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
@@ -0,0 +1,250 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.computer.Computer;
+import org.apache.tinkerpop.gremlin.process.computer.ComputerResult;
+import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
+import org.apache.tinkerpop.gremlin.process.computer.Memory;
+import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.bulkdumping.BulkDumperVertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.bulkloading.BulkLoaderVertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.clustering.peerpressure.PeerPressureVertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankVertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.optimization.GraphFilterStrategy;
+import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
+import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph;
+import org.apache.tinkerpop.gremlin.process.traversal.Bindings;
+import org.apache.tinkerpop.gremlin.process.traversal.Operator;
+import org.apache.tinkerpop.gremlin.process.traversal.Order;
+import org.apache.tinkerpop.gremlin.process.traversal.P;
+import org.apache.tinkerpop.gremlin.process.traversal.Pop;
+import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
+import org.apache.tinkerpop.gremlin.process.traversal.Scope;
+import org.apache.tinkerpop.gremlin.process.traversal.Translator;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ConnectiveStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ElementIdStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.HaltedTraverserStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.MatchAlgorithmStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.ProfileStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.AdjacentToIncidentStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.FilterRankingStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.IdentityRemovalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.IncidentToAdjacentStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.LazyBarrierStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.MatchPredicateStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.OrderLimitStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.PathProcessorStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.RangeByIsCountStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ComputerVerificationStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.LambdaRestrictionStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.StandardVerificationStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMetrics;
+import org.apache.tinkerpop.gremlin.structure.Column;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Transaction;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
+import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Io;
+import org.apache.tinkerpop.gremlin.structure.io.IoCore;
+import org.apache.tinkerpop.gremlin.structure.io.Storage;
+import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
+import org.apache.tinkerpop.gremlin.util.Gremlin;
+import org.apache.tinkerpop.gremlin.util.TimeUtil;
+import org.javatuples.Pair;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Stream;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class CoreImports {
+
+    private final static Set<Class> CLASS_IMPORTS = new HashSet<>();
+    private final static Set<Method> METHOD_IMPORTS = new HashSet<>();
+    private final static Set<Enum> ENUM_IMPORTS = new HashSet<>();
+
+    static {
+        /////////////
+        // CLASSES //
+        /////////////
+
+        // graph
+        CLASS_IMPORTS.add(Edge.class);
+        CLASS_IMPORTS.add(Element.class);
+        CLASS_IMPORTS.add(Graph.class);
+        CLASS_IMPORTS.add(Property.class);
+        CLASS_IMPORTS.add(Transaction.class);
+        CLASS_IMPORTS.add(Vertex.class);
+        CLASS_IMPORTS.add(VertexProperty.class);
+        // tokens
+        CLASS_IMPORTS.add(SackFunctions.class);
+        CLASS_IMPORTS.add(SackFunctions.Barrier.class);
+        CLASS_IMPORTS.add(VertexProperty.Cardinality.class);
+        CLASS_IMPORTS.add(Column.class);
+        CLASS_IMPORTS.add(Direction.class);
+        CLASS_IMPORTS.add(Operator.class);
+        CLASS_IMPORTS.add(Order.class);
+        CLASS_IMPORTS.add(Pop.class);
+        CLASS_IMPORTS.add(Scope.class);
+        CLASS_IMPORTS.add(T.class);
+        CLASS_IMPORTS.add(TraversalOptionParent.class);
+        CLASS_IMPORTS.add(TraversalOptionParent.Pick.class);
+        CLASS_IMPORTS.add(P.class);
+        // remote
+        CLASS_IMPORTS.add(RemoteConnection.class);
+        CLASS_IMPORTS.add(RemoteGraph.class);
+        CLASS_IMPORTS.add(EmptyGraph.class);
+        // io
+        CLASS_IMPORTS.add(GraphReader.class);
+        CLASS_IMPORTS.add(GraphWriter.class);
+        CLASS_IMPORTS.add(Io.class);
+        CLASS_IMPORTS.add(IoCore.class);
+        CLASS_IMPORTS.add(Storage.class);
+        CLASS_IMPORTS.add(Configuration.class);
+        // strategies
+        CLASS_IMPORTS.add(ConnectiveStrategy.class);
+        CLASS_IMPORTS.add(ElementIdStrategy.class);
+        CLASS_IMPORTS.add(EventStrategy.class);
+        CLASS_IMPORTS.add(HaltedTraverserStrategy.class);
+        CLASS_IMPORTS.add(PartitionStrategy.class);
+        CLASS_IMPORTS.add(SubgraphStrategy.class);
+        CLASS_IMPORTS.add(LazyBarrierStrategy.class);
+        CLASS_IMPORTS.add(MatchAlgorithmStrategy.class);
+        CLASS_IMPORTS.add(ProfileStrategy.class);
+        CLASS_IMPORTS.add(AdjacentToIncidentStrategy.class);
+        CLASS_IMPORTS.add(FilterRankingStrategy.class);
+        CLASS_IMPORTS.add(IdentityRemovalStrategy.class);
+        CLASS_IMPORTS.add(IncidentToAdjacentStrategy.class);
+        CLASS_IMPORTS.add(MatchPredicateStrategy.class);
+        CLASS_IMPORTS.add(OrderLimitStrategy.class);
+        CLASS_IMPORTS.add(PathProcessorStrategy.class);
+        CLASS_IMPORTS.add(RangeByIsCountStrategy.class);
+        CLASS_IMPORTS.add(ComputerVerificationStrategy.class);
+        CLASS_IMPORTS.add(LambdaRestrictionStrategy.class);
+        CLASS_IMPORTS.add(ReadOnlyStrategy.class);
+        CLASS_IMPORTS.add(StandardVerificationStrategy.class);
+        // graph traversal
+        CLASS_IMPORTS.add(__.class);
+        CLASS_IMPORTS.add(GraphTraversal.class);
+        CLASS_IMPORTS.add(GraphTraversalSource.class);
+        CLASS_IMPORTS.add(TraversalMetrics.class);
+        CLASS_IMPORTS.add(Translator.class);
+        CLASS_IMPORTS.add(Bindings.class);
+        // graph computer
+        CLASS_IMPORTS.add(Computer.class);
+        CLASS_IMPORTS.add(ComputerResult.class);
+        CLASS_IMPORTS.add(GraphComputer.class);
+        CLASS_IMPORTS.add(Memory.class);
+        CLASS_IMPORTS.add(VertexProgram.class);
+        CLASS_IMPORTS.add(BulkDumperVertexProgram.class);
+        CLASS_IMPORTS.add(BulkLoaderVertexProgram.class);
+        CLASS_IMPORTS.add(PeerPressureVertexProgram.class);
+        CLASS_IMPORTS.add(PageRankVertexProgram.class);
+        CLASS_IMPORTS.add(GraphFilterStrategy.class);
+        CLASS_IMPORTS.add(VertexProgramStrategy.class);
+        // utils
+        CLASS_IMPORTS.add(Gremlin.class);
+        CLASS_IMPORTS.add(TimeUtil.class);
+
+        /////////////
+        // METHODS //
+        /////////////
+
+        uniqueMethods(IoCore.class).forEach(METHOD_IMPORTS::add);
+        uniqueMethods(P.class).forEach(METHOD_IMPORTS::add);
+        uniqueMethods(__.class).filter(m -> !m.getName().equals("__")).forEach(METHOD_IMPORTS::add);
+        uniqueMethods(Computer.class).forEach(METHOD_IMPORTS::add);
+        uniqueMethods(TimeUtil.class).forEach(METHOD_IMPORTS::add);
+
+        ///////////
+        // ENUMS //
+        ///////////
+
+        Collections.addAll(ENUM_IMPORTS, SackFunctions.Barrier.values());
+        Collections.addAll(ENUM_IMPORTS, VertexProperty.Cardinality.values());
+        Collections.addAll(ENUM_IMPORTS, Column.values());
+        Collections.addAll(ENUM_IMPORTS, Direction.values());
+        Collections.addAll(ENUM_IMPORTS, Operator.values());
+        Collections.addAll(ENUM_IMPORTS, Order.values());
+        Collections.addAll(ENUM_IMPORTS, Pop.values());
+        Collections.addAll(ENUM_IMPORTS, Scope.values());
+        Collections.addAll(ENUM_IMPORTS, T.values());
+        Collections.addAll(ENUM_IMPORTS, TraversalOptionParent.Pick.values());
+    }
+
+    private CoreImports() {
+        // static methods only, do not instantiate class
+    }
+
+    public static Set<Class> getClassImports() {
+        return Collections.unmodifiableSet(CLASS_IMPORTS);
+    }
+
+    public static Set<Method> getMethodImports() {
+        return Collections.unmodifiableSet(METHOD_IMPORTS);
+    }
+
+    public static Set<Enum> getEnumImports() {
+        return Collections.unmodifiableSet(ENUM_IMPORTS);
+    }
+
+    /**
+     * Filters to unique method names on each class.
+     */
+    private static Stream<Method> uniqueMethods(final Class<?> clazz) {
+        final Set<String> unique = new HashSet<>();
+        return Stream.of(clazz.getMethods())
+                .filter(m -> Modifier.isStatic(m.getModifiers()))
+                .map(m -> Pair.with(generateMethodDescriptor(m), m))
+                .filter(p -> {
+                    final boolean exists = unique.contains(p.getValue0());
+                    if (!exists) unique.add(p.getValue0());
+                    return !exists;
+                })
+                .map(Pair::getValue1);
+    }
+
+    private static String generateMethodDescriptor(final Method m) {
+        return m.getDeclaringClass().getCanonicalName() + "." + m.getName();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c2e71dc0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
index 34ef995..86b72f2 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
@@ -18,8 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.jsr223;
 
-import org.apache.tinkerpop.gremlin.util.CoreImports;
-
 import javax.script.Bindings;
 import javax.script.ScriptContext;
 import java.security.AccessController;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c2e71dc0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
index 7b056ff..54c5d0c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
@@ -18,8 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.jsr223;
 
-import org.apache.tinkerpop.gremlin.util.CoreImports;
-
 import java.lang.reflect.Method;
 import java.util.Set;
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c2e71dc0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java
index 1c6a6e6..d5ec418 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java
@@ -96,6 +96,7 @@ import java.util.stream.Stream;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.CoreImports}.
  */
 public final class CoreImports {
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c2e71dc0/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
index b6f25e3..73ffcb6 100644
--- a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
+++ b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
@@ -19,9 +19,9 @@
 
 package org.apache.tinkerpop.gremlin.python
 
+import org.apache.tinkerpop.gremlin.jsr223.CoreImports
 import org.apache.tinkerpop.gremlin.process.traversal.P
 import org.apache.tinkerpop.gremlin.python.jsr223.SymbolHelper
-import org.apache.tinkerpop.gremlin.util.CoreImports
 
 import java.lang.reflect.Modifier
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c2e71dc0/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
index 1a4b57a..f6ada6e 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
@@ -20,6 +20,7 @@
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
 import org.apache.tinkerpop.gremlin.jsr223.CoreGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.CoreImports;
 import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngineFactory;
@@ -28,7 +29,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import org.apache.tinkerpop.gremlin.util.CoreImports;
 import org.python.jsr223.PyScriptEngine;
 import org.python.jsr223.PyScriptEngineFactory;
 


[38/50] tinkerpop git commit: TINKERPOP-1562 Update upgrade docs with ScriptEngine changes.

Posted by sp...@apache.org.
TINKERPOP-1562 Update upgrade docs with ScriptEngine changes.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/00ccf0fe
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/00ccf0fe
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/00ccf0fe

Branch: refs/heads/TINKERPOP-1562
Commit: 00ccf0fe0b728bd742f9b6f9c1cf6936f4f07b27
Parents: 8368921
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Nov 30 18:42:49 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:50 2016 -0500

----------------------------------------------------------------------
 .../upgrade/release-3.2.x-incubating.asciidoc   | 50 ++++++++++++++++++++
 1 file changed, 50 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/00ccf0fe/docs/src/upgrade/release-3.2.x-incubating.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index 2b38906..8a184b4 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -55,6 +55,56 @@ This has been changed to a regular `NoSuchElementException` that includes the st
 
 See: link:https://issues.apache.org/jira/browse/TINKERPOP-1330[TINKERPOP-1330]
 
+ScriptEngine support in gremlin-core
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+`ScriptEngine` and `GremlinPlugin` infrastructure has been moved from gremlin-groovy to gremlin-core to allow for
+better re-use across different Gremlin Language Variants. At this point, this change is non-breaking as it was
+implemented through deprecation.
+
+The basic concept of a `ScriptEngine` has been replaced by the notion of a `GremlinScriptEngine` (i.e. a
+"ScriptEngine" that is specifically tuned for executing Gremlin-related scripts). "ScriptEngine" infrastructure has
+been developed to help support this new interface, specifically `GremlinScriptEngineFactory` and
+`GremlinScriptEngineManager`. Prefer use of this infrastructure when instantiating a `GremlinScriptEngine` rather
+than trying to instantiate directly.
+
+For example, rather than instantiate a `GremlinGroovyScriptEngine` with the constructor:
+
+[source,java]
+----
+GremlinScriptEngine engine = new GremlinGroovyScriptEngine();
+----
+
+prefer to instantiate it as follows:
+
+[source,java]
+----
+GremlinScriptEngineManager manager = new CachedGremlinScriptEngineManager();
+GremlinScriptEngine engine = manager.getEngineByName("gremlin-groovy");
+----
+
+Related to the addition of `GremlinScriptEngine`, `org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin` in
+gremlin-groovy has been deprecated and then replaced by `org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin`. The new
+version of `GremlinPlugin` is similar but does carry some new methods to implement that involves the new `Customizer`
+interface. The `Customizer` interface is the way in which `GremlinScriptEngine` instance can be configured with
+imports, initialization scripts, compiler options, etc.
+
+Note that a `GremlinPlugin` can be applied to a `GremlinScriptEngine` by adding it to the `GremlinScriptEngineManager`
+that creates it.
+
+[source,java]
+----
+GremlinScriptEngineManager manager = new CachedGremlinScriptEngineManager();
+manager.addPlugin(ImportGremlinPlugin.build().classImports(java.awt.Color.class).create());
+GremlinScriptEngine engine = manager.getEngineByName("gremlin-groovy");
+----
+
+All of this new infrastructure is currently optional on the 3.2.x line of code. More detailed documentation will for
+these changes will be supplied as part of 3.3.0 when these features become mandatory and the deprecated code is
+removed.
+
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-1562[TINKERPOP-1562]
+
 Upgrading for Providers
 ~~~~~~~~~~~~~~~~~~~~~~~
 


[03/50] tinkerpop git commit: Merge branch 'TINKERPOP-1573' into tp32

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1573' into tp32


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/46888b1a
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/46888b1a
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/46888b1a

Branch: refs/heads/TINKERPOP-1562
Commit: 46888b1a06f6d145dd8403b8e88280f111fd1539
Parents: ffd6543 987e6ab
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Dec 1 06:12:15 2016 -0700
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Dec 1 06:12:15 2016 -0700

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  2 +
 .../src/reference/gremlin-applications.asciidoc |  6 +--
 docs/src/reference/gremlin-variants.asciidoc    |  5 ---
 .../gremlin-language-variants/index.asciidoc    |  3 --
 .../gremlin/process/traversal/Bindings.java     | 39 +++++++++++++++-----
 .../gremlin/process/traversal/Bytecode.java     | 19 ++++------
 .../process/traversal/TraversalSource.java      |  7 ++--
 .../dsl/graph/GraphTraversalSource.java         |  4 +-
 .../optimization/GraphFilterStrategyTest.java   |  2 +-
 .../gremlin/process/traversal/BytecodeTest.java | 32 +++++++++++++++-
 .../python/GraphTraversalSourceGenerator.groovy |  2 -
 .../python/TraversalSourceGenerator.groovy      |  6 +++
 .../gremlin_python/process/graph_traversal.py   |  2 -
 .../jython/gremlin_python/process/traversal.py  |  6 +++
 .../main/jython/tests/process/test_traversal.py | 13 +++++++
 15 files changed, 104 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/46888b1a/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index a77ab20,237b7ce..ebcc318
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -26,7 -26,8 +26,9 @@@ image::https://raw.githubusercontent.co
  TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
 +* Fixed a bug around long serialization in Gremlin-Python when using Python3.
+ * Deprecated `TraversalSource.withBindings()` as it is no longer needed in Gremlin-Java and never was needed for other variants.
+ * Fixed a bug in Gremlin-Java `Bytecode` where anonymous traversals were not aware of parent bindings.
  * Fixed a bug in Gremlin-Java GraphSON deserialization around `P.within()` and `P.without()`.
  * Converted Spark process suite tests to "integration" tests.
  * Fixed a bug in `InlineFilterStrategy` having to do with folding `HasContainers` into `VertexStep`.


[26/50] tinkerpop git commit: TINKERPOP-1562 Added more tests for plugins/customizers

Posted by sp...@apache.org.
TINKERPOP-1562 Added more tests for plugins/customizers


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/33460fc1
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/33460fc1
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/33460fc1

Branch: refs/heads/TINKERPOP-1562
Commit: 33460fc159249a503a3ffa9439d0d8c3c72ef0cf
Parents: 03e931d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Nov 23 14:37:26 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../CachedGremlinScriptEngineManager.java       |  1 +
 .../gremlin/jsr223/DefaultImportCustomizer.java |  2 -
 .../gremlin/jsr223/LazyBindingsCustomizer.java  |  2 -
 .../SingleGremlinScriptEngineManager.java       |  2 +-
 .../jsr223/DefaultImportCustomizerTest.java     | 76 ++++++++++++++++++++
 .../jsr223/DefaultScriptCustomizerTest.java     | 56 +++++++++++++++
 .../jsr223/ScriptFileGremlinPluginTest.java     | 61 ++++++++++++++++
 .../jsr223/SingleScriptEngineManagerTest.java   | 45 ++++++++++++
 .../gremlin/jsr223/script-customizer-1.groovy   |  3 +
 .../gremlin/jsr223/script-customizer-2.groovy   |  2 +
 pom.xml                                         |  3 +-
 11 files changed, 247 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CachedGremlinScriptEngineManager.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CachedGremlinScriptEngineManager.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CachedGremlinScriptEngineManager.java
index 9839b1b..5798e1c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CachedGremlinScriptEngineManager.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CachedGremlinScriptEngineManager.java
@@ -92,6 +92,7 @@ public class CachedGremlinScriptEngineManager extends DefaultGremlinScriptEngine
     }
 
     private void registerLookUpInfo(final GremlinScriptEngine engine, final String shortName) {
+        if (null == engine) throw new IllegalArgumentException(String.format("%s is not an available GremlinScriptEngine", shortName));
         cache.putIfAbsent(shortName, engine);
         engine.getFactory().getExtensions().forEach(ext -> extensionToName.putIfAbsent(ext, shortName));
         engine.getFactory().getMimeTypes().forEach(mime -> mimeToName.putIfAbsent(mime, shortName));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
index fa0965d..3642f97 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
@@ -18,8 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.jsr223;
 
-import org.apache.tinkerpop.gremlin.util.CoreImports;
-
 import java.lang.reflect.Method;
 import java.util.Arrays;
 import java.util.Collection;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java
index 4117ae5..01ae662 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java
@@ -18,8 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.jsr223;
 
-import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer;
-
 import javax.script.Bindings;
 import java.util.function.Supplier;
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/SingleGremlinScriptEngineManager.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/SingleGremlinScriptEngineManager.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/SingleGremlinScriptEngineManager.java
index 9474368..f9022dc 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/SingleGremlinScriptEngineManager.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/SingleGremlinScriptEngineManager.java
@@ -23,7 +23,7 @@ package org.apache.tinkerpop.gremlin.jsr223;
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public class SingleGremlinScriptEngineManager {
+public final class SingleGremlinScriptEngineManager {
     private static final GremlinScriptEngineManager cached = new CachedGremlinScriptEngineManager();
 
     private SingleGremlinScriptEngineManager() {}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizerTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizerTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizerTest.java
new file mode 100644
index 0000000..c010aa5
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizerTest.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.junit.Test;
+
+import java.lang.reflect.Method;
+import java.time.DayOfWeek;
+import java.util.Arrays;
+import java.util.Collections;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsCollectionContaining.hasItems;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DefaultImportCustomizerTest {
+    @Test
+    public void shouldReturnAssignedImports() throws Exception {
+        final Method abs = Math.class.getMethod("abs", double.class);
+        final Enum dayOfWeekEnum = DayOfWeek.SATURDAY;
+        final Enum tEnum = T.id;
+        final ImportCustomizer imports = DefaultImportCustomizer.build()
+                .addClassImports(java.awt.Color.class, java.awt.AlphaComposite.class)
+                .addMethodImports(abs)
+                .addEnumImports(dayOfWeekEnum, tEnum).create();
+
+        assertEquals(2, imports.getClassImports().size());
+        assertThat(imports.getClassImports(), hasItems(java.awt.Color.class, java.awt.AlphaComposite.class));
+
+        assertEquals(1, imports.getMethodImports().size());
+        assertThat(imports.getMethodImports(), hasItems(abs));
+
+        assertEquals(2, imports.getEnumImports().size());
+        assertThat(imports.getEnumImports(), hasItems(dayOfWeekEnum, tEnum));
+    }
+
+    @Test
+    public void shouldReturnAssignedImportsWhenBuiltViaCollections() throws Exception {
+        final Method abs = Math.class.getMethod("abs", double.class);
+        final Enum dayOfWeekEnum = DayOfWeek.SATURDAY;
+        final Enum tEnum = T.id;
+        final ImportCustomizer imports = DefaultImportCustomizer.build()
+                .addClassImports(Arrays.asList(java.awt.Color.class, java.awt.AlphaComposite.class))
+                .addMethodImports(Collections.singletonList(abs))
+                .addEnumImports(Arrays.asList(dayOfWeekEnum, tEnum)).create();
+
+        assertEquals(2, imports.getClassImports().size());
+        assertThat(imports.getClassImports(), hasItems(java.awt.Color.class, java.awt.AlphaComposite.class));
+
+        assertEquals(1, imports.getMethodImports().size());
+        assertThat(imports.getMethodImports(), hasItems(abs));
+
+        assertEquals(2, imports.getEnumImports().size());
+        assertThat(imports.getEnumImports(), hasItems(dayOfWeekEnum, tEnum));
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java
new file mode 100644
index 0000000..3e4da13
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import org.apache.tinkerpop.gremlin.TestHelper;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DefaultScriptCustomizerTest {
+
+    @Test
+    public void shouldOpenViaPropertiesFileConfig() throws IOException {
+        final File scriptFile1 = TestHelper.generateTempFileFromResource(DefaultScriptCustomizerTest.class, "script-customizer-1.groovy", ".groovy");
+        final File scriptFile2 = TestHelper.generateTempFileFromResource(DefaultScriptCustomizerTest.class, "script-customizer-2.groovy", ".groovy");
+        final Set<File> files = new HashSet<>();
+        files.add(scriptFile1);
+        files.add(scriptFile2);
+        final ScriptCustomizer scripts = new DefaultScriptCustomizer(files);
+
+        final Collection<List<String>> linesInFiles = scripts.getScripts();
+        final String scriptCombined = linesInFiles.stream().flatMap(Collection::stream).map(s -> s + System.lineSeparator()).reduce("", String::concat);
+        assertEquals("x = 1 + 1" +  System.lineSeparator() +
+                     "y = 10 * x" +   System.lineSeparator() +
+                     "z = 1 + x + y" +  System.lineSeparator() +
+                     "l = g.V(z).out()" +  System.lineSeparator() +
+                     "        .group().by('name')" + System.lineSeparator(), scriptCombined);
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java
new file mode 100644
index 0000000..81cf9e6
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import org.apache.tinkerpop.gremlin.TestHelper;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class ScriptFileGremlinPluginTest {
+    @Test
+    public void shouldOpenViaPropertiesFileConfig() throws IOException {
+        final File scriptFile1 = TestHelper.generateTempFileFromResource(DefaultScriptCustomizerTest.class, "script-customizer-1.groovy", ".groovy");
+        final File scriptFile2 = TestHelper.generateTempFileFromResource(DefaultScriptCustomizerTest.class, "script-customizer-2.groovy", ".groovy");
+        final Set<String> files = new HashSet<>();
+        files.add(scriptFile1.getAbsolutePath());
+        files.add(scriptFile2.getAbsolutePath());
+        final GremlinPlugin plugin = ScriptFileGremlinPlugin.build().files(files).create();
+
+        assertThat(plugin.getCustomizers().isPresent(), is(true));
+        assertThat(plugin.getCustomizers().get()[0], instanceOf(ScriptCustomizer.class));
+        final ScriptCustomizer customizer = (ScriptCustomizer) plugin.getCustomizers().get()[0];
+        final Collection<List<String>> linesInFiles = customizer.getScripts();
+        final String scriptCombined = linesInFiles.stream().flatMap(Collection::stream).map(s -> s + System.lineSeparator()).reduce("", String::concat);
+        assertEquals("x = 1 + 1" +  System.lineSeparator() +
+                "y = 10 * x" +   System.lineSeparator() +
+                "z = 1 + x + y" +  System.lineSeparator() +
+                "l = g.V(z).out()" +  System.lineSeparator() +
+                "        .group().by('name')" + System.lineSeparator(), scriptCombined);
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/SingleScriptEngineManagerTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/SingleScriptEngineManagerTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/SingleScriptEngineManagerTest.java
new file mode 100644
index 0000000..6765c94
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/SingleScriptEngineManagerTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertSame;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class SingleScriptEngineManagerTest {
+    private static final GremlinScriptEngineManager mgr = SingleGremlinScriptEngineManager.instance();
+
+    @Test
+    public void shouldGetSameInstance() {
+        assertSame(mgr, SingleGremlinScriptEngineManager.instance());
+        assertSame(mgr, SingleGremlinScriptEngineManager.instance());
+        assertSame(mgr, SingleGremlinScriptEngineManager.instance());
+        assertSame(mgr, SingleGremlinScriptEngineManager.instance());
+        assertSame(mgr, SingleGremlinScriptEngineManager.instance());
+        assertSame(mgr, SingleGremlinScriptEngineManager.getInstance());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void shouldNotGetGremlinScriptEngineAsItIsNotRegistered() {
+        mgr.getEngineByName("gremlin-groovy");
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/jsr223/script-customizer-1.groovy
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/jsr223/script-customizer-1.groovy b/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/jsr223/script-customizer-1.groovy
new file mode 100644
index 0000000..c2cc784
--- /dev/null
+++ b/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/jsr223/script-customizer-1.groovy
@@ -0,0 +1,3 @@
+x = 1 + 1
+y = 10 * x
+z = 1 + x + y
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/jsr223/script-customizer-2.groovy
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/jsr223/script-customizer-2.groovy b/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/jsr223/script-customizer-2.groovy
new file mode 100644
index 0000000..1a4f9a9
--- /dev/null
+++ b/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/jsr223/script-customizer-2.groovy
@@ -0,0 +1,2 @@
+l = g.V(z).out()
+        .group().by('name')
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e4d1ba7..0bff1e7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -285,9 +285,10 @@ limitations under the License.
                         <exclude>**/*.xml</exclude>
                         <exclude>**/*.ldjson</exclude>
                         <exclude>**/goal.txt</exclude>
-                        <exclude>**/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/script/*.txt</exclude>
                         <exclude>**/src/main/resources/META-INF/services/**</exclude>
                         <exclude>**/src/test/resources/META-INF/services/**</exclude>
+                        <exclude>**/src/test/resources/org/apache/tinkerpop/gremlin/jsr223/script-customizer-*.groovy</exclude>
+                        <exclude>**/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/script/*.txt</exclude>
                         <exclude>**/src/main/ext/**</exclude>
                         <exclude>**/src/main/static/**</exclude>
                         <exclude>**/_bsp/**</exclude>


[33/50] tinkerpop git commit: TINKERPOP-1562 Added JSR-223 packages in gremin-core to core javadoc

Posted by sp...@apache.org.
TINKERPOP-1562 Added JSR-223 packages in gremin-core to core javadoc


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a2ac1f29
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a2ac1f29
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a2ac1f29

Branch: refs/heads/TINKERPOP-1562
Commit: a2ac1f29613576b3bf409c0c766d3eae66d45780
Parents: 2efa2e4
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Nov 23 17:22:58 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:49 2016 -0500

----------------------------------------------------------------------
 pom.xml | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2ac1f29/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 37c7c7e..3c5f8ed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1060,7 +1060,7 @@ limitations under the License.
                                     <overview>${basedir}/docs/javadoc/overview.html</overview>
                                     <quiet>true</quiet>
                                     <sourcepath>
-                                        giraph-gremlin/src/main/java:gremlin-core/src/main/java:gremlin-driver/src/main/java:gremlin-groovy/src/main/java:gremlin-groovy-test/src/main/java:gremlin-server/src/main/java:gremlin-test/src/main/java:hadoop-gremlin/src/main/java:neo4j-gremlin/src/main/java:spark-gremlin/src/main/java:tinkergraph-gremlin/src/main/java
+                                        giraph-gremlin/src/main/java:gremlin-core/src/main/java:gremlin-driver/src/main/java:gremlin-groovy/src/main/java:gremlin-groovy-test/src/main/java:gremlin-python/src/main/java:gremlin-server/src/main/java:gremlin-test/src/main/java:hadoop-gremlin/src/main/java:neo4j-gremlin/src/main/java:spark-gremlin/src/main/java:tinkergraph-gremlin/src/main/java
                                     </sourcepath>
                                 </configuration>
                             </execution>
@@ -1080,11 +1080,20 @@ limitations under the License.
                                         gremlin-core/src/main/java:gremlin-driver/src/main/java
                                     </sourcepath>
                                     <sourceFileIncludes>
+                                        <!-- jsr223 -->
+                                        <include>
+                                            org/apache/tinkerpop/gremlin/jsr223/*.java
+                                        </include>
+                                        <include>
+                                            org/apache/tinkerpop/gremlin/jsr223/console/*.java
+                                        </include>
                                         <!-- structure -->
-                                        <include>org/apache/tinkerpop/gremlin/structure/*.java
+                                        <include>
+                                            org/apache/tinkerpop/gremlin/structure/*.java
                                         </include>
                                         <!-- io -->
-                                        <include>org/apache/tinkerpop/gremlin/structure/io/*.java
+                                        <include>
+                                            org/apache/tinkerpop/gremlin/structure/io/*.java
                                         </include>
                                         <include>
                                             org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
@@ -1105,7 +1114,8 @@ limitations under the License.
                                             org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
                                         </include>
                                         <!-- process -->
-                                        <include>org/apache/tinkerpop/gremlin/process/*.java
+                                        <include>
+                                            org/apache/tinkerpop/gremlin/process/*.java
                                         </include>
                                         <!-- computer -->
                                         <include>org/apache/tinkerpop/gremlin/process/computer/*.java
@@ -1120,7 +1130,8 @@ limitations under the License.
                                             org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
                                         </include>
                                         <!-- traversal -->
-                                        <include>org/apache/tinkerpop/gremlin/process/traversal/*.java
+                                        <include>
+                                            org/apache/tinkerpop/gremlin/process/traversal/*.java
                                         </include>
                                         <include>
                                             org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java


[49/50] tinkerpop git commit: TINKERPOP-1562 Deprecated GremlinGroovyScriptEngine.close()

Posted by sp...@apache.org.
TINKERPOP-1562 Deprecated GremlinGroovyScriptEngine.close()

In the future GremlinGroovyScriptEngine will not implement AutoCloseable - there was never really a need for that.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/338002ab
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/338002ab
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/338002ab

Branch: refs/heads/TINKERPOP-1562
Commit: 338002ab79b7f651885ffd950f64f5d34655f0ef
Parents: d68f693
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Dec 1 10:15:49 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:51 2016 -0500

----------------------------------------------------------------------
 .../gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java        | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/338002ab/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 0f36dbf..1fb2efc 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -384,7 +384,12 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
         return (Traversal.Admin) this.eval(GroovyTranslator.of(traversalSource).translate(bytecode), bindings);
     }
 
+    /**
+     * @deprecated As of release 3.2.4, not replaced as this class will not implement {@code AutoCloseable} in the
+     * future.
+     */
     @Override
+    @Deprecated
     public void close() throws Exception {
     }
 


[06/50] tinkerpop git commit: Merge branch 'tp31' into tp32

Posted by sp...@apache.org.
Merge branch 'tp31' into tp32


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/53e932b4
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/53e932b4
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/53e932b4

Branch: refs/heads/TINKERPOP-1562
Commit: 53e932b48a59a89788433b577ed6457402fdafd9
Parents: 7af8052 d49f692
Author: Jason Plurad <pl...@us.ibm.com>
Authored: Thu Dec 1 21:49:34 2016 -0500
Committer: Jason Plurad <pl...@us.ibm.com>
Committed: Thu Dec 1 21:49:34 2016 -0500

----------------------------------------------------------------------
 .../groovy/util/DependencyGrabber.groovy        | 55 +++++++++++---------
 .../util/DependencyGrabberIntegrateTest.java    |  2 +-
 2 files changed, 32 insertions(+), 25 deletions(-)
----------------------------------------------------------------------



[31/50] tinkerpop git commit: TINKERPOP-1562 Hooked up GremlinJythonScriptEngine to Customizers

Posted by sp...@apache.org.
TINKERPOP-1562 Hooked up GremlinJythonScriptEngine to Customizers

GremlnJythonScriptEngine is now initialized the same way that GremlinGroovyScriptEngine is.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/05ff0c0f
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/05ff0c0f
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/05ff0c0f

Branch: refs/heads/TINKERPOP-1562
Commit: 05ff0c0fe957a9fe697c5b1a176c682837ee0c64
Parents: a2ac1f2
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Nov 24 08:11:35 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:49 2016 -0500

----------------------------------------------------------------------
 .../jsr223/GremlinJythonScriptEngine.java       | 167 ++++++++++++-------
 .../GremlinJythonScriptEngineFactory.java       |   5 +-
 .../jsr223/GremlinJythonScriptEngineTest.java   |  12 +-
 .../jsr223/GremlinEnabledScriptEngineTest.java  |   1 -
 4 files changed, 120 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/05ff0c0f/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
index 554d80a..1b95a02 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
@@ -19,8 +19,10 @@
 
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngineFactory;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
@@ -35,7 +37,13 @@ import javax.script.ScriptContext;
 import javax.script.ScriptException;
 import java.io.Reader;
 import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -44,6 +52,10 @@ public class GremlinJythonScriptEngine implements GremlinScriptEngine {
 
     private final PyScriptEngine pyScriptEngine;
 
+    /**
+     * @deprecated As of release 3.2.4, replaced by {@link #GremlinJythonScriptEngine(Customizer...)}.
+     */
+    @Deprecated
     public GremlinJythonScriptEngine() {
         this.pyScriptEngine = (PyScriptEngine) new PyScriptEngineFactory().getScriptEngine();
         try {
@@ -61,70 +73,48 @@ public class GremlinJythonScriptEngine implements GremlinScriptEngine {
                 this.pyScriptEngine.eval(SymbolHelper.toPython(x.name()) + " = " + x.getDeclaringClass().getSimpleName() + "." + x.name());
             }
 
-            // add sugar methods
-            this.pyScriptEngine.eval("def getitem_bypass(self, index):\n" +
-                    "  if isinstance(index,int):\n    return self.range(index,index+1)\n" +
-                    "  elif isinstance(index,slice):\n    return self.range(index.start,index.stop)\n" +
-                    "  else:\n    return TypeError('Index must be int or slice')");
-            this.pyScriptEngine.eval(GraphTraversal.class.getSimpleName() + ".__getitem__ = getitem_bypass");
-            this.pyScriptEngine.eval(GraphTraversal.class.getSimpleName() + ".__getattr__ = lambda self, key: self.values(key)\n");
-            this.pyScriptEngine.eval("\n" +
-                    "from java.lang import Long\n" +
-                    "import org.apache.tinkerpop.gremlin.util.function.Lambda\n" + // todo: remove or remove imported subclass names? (choose)
-                    "from org.apache.tinkerpop.gremlin.util.function.Lambda import AbstractLambda\n" +
-                    "from org.apache.tinkerpop.gremlin.util.function.Lambda import UnknownArgLambda\n" +
-                    "from org.apache.tinkerpop.gremlin.util.function.Lambda import ZeroArgLambda\n" +
-                    "from org.apache.tinkerpop.gremlin.util.function.Lambda import OneArgLambda\n" +
-                    "from org.apache.tinkerpop.gremlin.util.function.Lambda import TwoArgLambda\n\n" +
-
-                    "class JythonUnknownArgLambda(UnknownArgLambda):\n" +
-                    "  def __init__(self,func,script='none',lang='gremlin-jython'):\n" +
-                    "    UnknownArgLambda.__init__(self, script, lang, -1)\n" +
-                    "    self.func = func\n" +
-                    "  def __repr__(self):\n" +
-                    "    return self.getLambdaScript()\n\n" +
-
-                    "class JythonZeroArgLambda(ZeroArgLambda):\n" +
-                    "  def __init__(self,func,script='none',lang='gremlin-jython'):\n" +
-                    "    ZeroArgLambda.__init__(self, script, lang)\n" +
-                    "    self.func = func\n" +
-                    "  def __repr__(self):\n" +
-                    "    return self.getLambdaScript()\n" +
-                    "  def get(self):\n" +
-                    "    return self.func()\n\n" +
-
-                    "class JythonOneArgLambda(OneArgLambda):\n" +
-                    "  def __init__(self,func,script='none',lang='gremlin-jython'):\n" +
-                    "    OneArgLambda.__init__(self, script, lang)\n" +
-                    "    self.func = func\n" +
-                    "  def __repr__(self):\n" +
-                    "    return self.getLambdaScript()\n" +
-                    "  def test(self,a):\n" +
-                    "    return self.func(a)\n" +
-                    "  def apply(self,a):\n" +
-                    "    return self.func(a)\n" +
-                    "  def accept(self,a):\n" +
-                    "    self.func(a)\n" +
-                    "  def compare(self,a,b):\n" +
-                    "    return self.func(a,b)\n\n" +
-
-                    "class JythonTwoArgLambda(TwoArgLambda):\n" +
-                    "  def __init__(self,func,script='none',lang='gremlin-jython'):\n" +
-                    "    TwoArgLambda.__init__(self, script, lang)\n" +
-                    "    self.func = func\n" +
-                    "  def __repr__(self):\n" +
-                    "    return self.getLambdaScript()\n" +
-                    "  def apply(self,a,b):\n" +
-                    "    return self.func(a,b)\n" +
-                    "  def compare(self,a,b):\n" +
-                    "    return self.func(a,b)\n"
-            );
+            loadSugar();
 
         } catch (final ScriptException e) {
             throw new IllegalStateException(e.getMessage(), e);
         }
     }
 
+    public GremlinJythonScriptEngine(final Customizer... customizers) {
+        this.pyScriptEngine = (PyScriptEngine) new PyScriptEngineFactory().getScriptEngine();
+        final List<Customizer> listOfCustomizers = Arrays.asList(customizers);
+
+        final List<ImportCustomizer> importCustomizers = listOfCustomizers.stream()
+                .filter(p -> p instanceof ImportCustomizer)
+                .map(p -> (ImportCustomizer) p)
+                .collect(Collectors.toList());
+
+        try {
+            for (ImportCustomizer ic : importCustomizers) {
+                for (Class<?> c : ic.getClassImports()) {
+                    if (null == c.getDeclaringClass())
+                        this.pyScriptEngine.eval("from " + c.getPackage().getName() + " import " + c.getSimpleName());
+                    else
+                        this.pyScriptEngine.eval("from " + c.getPackage().getName() + "." + c.getDeclaringClass().getSimpleName() + " import " + c.getSimpleName());
+                }
+
+                for (Method m : ic.getMethodImports()) {
+                    this.pyScriptEngine.eval(SymbolHelper.toPython(m.getName()) + " = " + m.getDeclaringClass().getSimpleName() + "." + m.getName());
+                }
+
+                // enums need to import after methods for some reason or else label comes in as a PyReflectedFunction
+                for (Enum e : ic.getEnumImports()) {
+                    this.pyScriptEngine.eval(SymbolHelper.toPython(e.name()) + " = " + e.getDeclaringClass().getSimpleName() + "." + e.name());
+                }
+            }
+
+            loadSugar();
+
+        } catch (Exception ex) {
+            throw new IllegalStateException(ex);
+        }
+    }
+
     @Override
     public Traversal.Admin eval(final Bytecode bytecode, final Bindings bindings) throws ScriptException {
         bindings.putAll(bytecode.getBindings());
@@ -209,4 +199,65 @@ public class GremlinJythonScriptEngine implements GremlinScriptEngine {
     public GremlinScriptEngineFactory getFactory() {
         return new GremlinJythonScriptEngineFactory();
     }
+
+    private void loadSugar() throws ScriptException {
+        // add sugar methods
+        this.pyScriptEngine.eval("def getitem_bypass(self, index):\n" +
+                "  if isinstance(index,int):\n    return self.range(index,index+1)\n" +
+                "  elif isinstance(index,slice):\n    return self.range(index.start,index.stop)\n" +
+                "  else:\n    return TypeError('Index must be int or slice')");
+        this.pyScriptEngine.eval(GraphTraversal.class.getSimpleName() + ".__getitem__ = getitem_bypass");
+        this.pyScriptEngine.eval(GraphTraversal.class.getSimpleName() + ".__getattr__ = lambda self, key: self.values(key)\n");
+        this.pyScriptEngine.eval("\n" +
+                "from java.lang import Long\n" +
+                "import org.apache.tinkerpop.gremlin.util.function.Lambda\n" + // todo: remove or remove imported subclass names? (choose)
+                "from org.apache.tinkerpop.gremlin.util.function.Lambda import AbstractLambda\n" +
+                "from org.apache.tinkerpop.gremlin.util.function.Lambda import UnknownArgLambda\n" +
+                "from org.apache.tinkerpop.gremlin.util.function.Lambda import ZeroArgLambda\n" +
+                "from org.apache.tinkerpop.gremlin.util.function.Lambda import OneArgLambda\n" +
+                "from org.apache.tinkerpop.gremlin.util.function.Lambda import TwoArgLambda\n\n" +
+
+                "class JythonUnknownArgLambda(UnknownArgLambda):\n" +
+                "  def __init__(self,func,script='none',lang='gremlin-jython'):\n" +
+                "    UnknownArgLambda.__init__(self, script, lang, -1)\n" +
+                "    self.func = func\n" +
+                "  def __repr__(self):\n" +
+                "    return self.getLambdaScript()\n\n" +
+
+                "class JythonZeroArgLambda(ZeroArgLambda):\n" +
+                "  def __init__(self,func,script='none',lang='gremlin-jython'):\n" +
+                "    ZeroArgLambda.__init__(self, script, lang)\n" +
+                "    self.func = func\n" +
+                "  def __repr__(self):\n" +
+                "    return self.getLambdaScript()\n" +
+                "  def get(self):\n" +
+                "    return self.func()\n\n" +
+
+                "class JythonOneArgLambda(OneArgLambda):\n" +
+                "  def __init__(self,func,script='none',lang='gremlin-jython'):\n" +
+                "    OneArgLambda.__init__(self, script, lang)\n" +
+                "    self.func = func\n" +
+                "  def __repr__(self):\n" +
+                "    return self.getLambdaScript()\n" +
+                "  def test(self,a):\n" +
+                "    return self.func(a)\n" +
+                "  def apply(self,a):\n" +
+                "    return self.func(a)\n" +
+                "  def accept(self,a):\n" +
+                "    self.func(a)\n" +
+                "  def compare(self,a,b):\n" +
+                "    return self.func(a,b)\n\n" +
+
+                "class JythonTwoArgLambda(TwoArgLambda):\n" +
+                "  def __init__(self,func,script='none',lang='gremlin-jython'):\n" +
+                "    TwoArgLambda.__init__(self, script, lang)\n" +
+                "    self.func = func\n" +
+                "  def __repr__(self):\n" +
+                "    return self.getLambdaScript()\n" +
+                "  def apply(self,a,b):\n" +
+                "    return self.func(a,b)\n" +
+                "  def compare(self,a,b):\n" +
+                "    return self.func(a,b)\n"
+        );
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/05ff0c0f/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java
index c94e94f..696c2ea 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java
@@ -19,6 +19,7 @@
 
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngineFactory;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngineManager;
@@ -100,6 +101,8 @@ public class GremlinJythonScriptEngineFactory extends PyScriptEngineFactory impl
 
     @Override
     public GremlinScriptEngine getScriptEngine() {
-        return new GremlinJythonScriptEngine();
+        final List<Customizer> customizers =  manager.getCustomizers(GREMLIN_JYTHON);
+        return (customizers.isEmpty()) ? new GremlinJythonScriptEngine() :
+                new GremlinJythonScriptEngine(customizers.toArray(new Customizer[customizers.size()]));
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/05ff0c0f/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineTest.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineTest.java b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineTest.java
index 8bc60a5..8ec1cf4 100644
--- a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineTest.java
+++ b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineTest.java
@@ -36,6 +36,8 @@ import java.math.BigInteger;
 import java.util.Arrays;
 import java.util.HashSet;
 
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -56,11 +58,11 @@ public class GremlinJythonScriptEngineTest {
     @Test
     public void shouldHaveCoreImports() throws Exception {
         final ScriptEngine engine = new DefaultGremlinScriptEngineManager().getEngineByName("gremlin-jython");
-        assertTrue(engine.eval("Graph") instanceof Class);
-        assertTrue(engine.eval("__") instanceof Class);
-        assertTrue(engine.eval("T") instanceof Class);
-        assertTrue(engine.eval("label") instanceof T);
-        assertTrue(engine.eval("T.label") instanceof T);
+        assertThat(engine.eval("Graph"), instanceOf(Class.class));
+        assertThat(engine.eval("__"), instanceOf(Class.class));
+        assertThat(engine.eval("T"), instanceOf(Class.class));
+        assertThat(engine.eval("label"), instanceOf(T.class));
+        assertThat(engine.eval("T.label"), instanceOf(T.class));
         assertEquals(SackFunctions.Barrier.class, engine.eval("Barrier"));
         assertEquals(SackFunctions.Barrier.normSack, engine.eval("Barrier.normSack"));
         assertEquals(Column.class, engine.eval("Column"));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/05ff0c0f/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
index 723d898..f6bbcb8 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
@@ -55,7 +55,6 @@ public class GremlinEnabledScriptEngineTest {
         }
     }
 
-    @org.junit.Ignore("TEMPORARY - until GremlinJythonScriptEngine supports this stuff")
     @Test
     public void shouldSupportDeprecatedGremlinModules() throws Exception {
         final GremlinScriptEngineManager mgr = new DefaultGremlinScriptEngineManager();


[36/50] tinkerpop git commit: TINKERPOP-1562 Deprecated the CredentialGraph

Posted by sp...@apache.org.
TINKERPOP-1562 Deprecated the CredentialGraph

and moved it to a new home so tht the "plugin" package can go away completely.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/6439d709
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/6439d709
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/6439d709

Branch: refs/heads/TINKERPOP-1562
Commit: 6439d709c60a107b3e6a3b79231344f8a2ce2e7a
Parents: 39e3965
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 29 10:13:04 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:50 2016 -0500

----------------------------------------------------------------------
 .../dsl/credential/CredentialGraphTest.java     | 121 +++++++++++++++++++
 .../dsl/credential/CredentialGraphTest.java     |   2 +-
 .../groovy/util/DependencyGrabber.groovy        |  14 +++
 .../jsr223/dsl/credential/CredentialGraph.java  | 121 +++++++++++++++++++
 .../CredentialGraphGremlinPlugin.java           |  51 ++++++++
 .../dsl/credential/CredentialGraphTokens.java   |  31 +++++
 .../plugin/dsl/credential/CredentialGraph.java  |   2 +
 .../dsl/credential/CredentialGraphTokens.java   |   2 +
 .../jsr223/CredentialGraphGremlinPlugin.java    |  55 ---------
 ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin |   2 +-
 10 files changed, 344 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6439d709/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java
new file mode 100644
index 0000000..e3a713d
--- /dev/null
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential;
+
+import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
+import org.apache.tinkerpop.gremlin.FeatureRequirement;
+import org.apache.tinkerpop.gremlin.FeatureRequirementSet;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.hamcrest.MatcherAssert;
+import org.junit.Test;
+
+import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraph.credentials;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.greaterThan;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNull;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class CredentialGraphTest extends AbstractGremlinTest {
+
+    @Test
+    @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
+    public void shouldCreateUser() {
+        final Vertex v = credentials(graph).createUser("stephen", "secret");
+        assertEquals("stephen", v.value("username"));
+        assertEquals("user", v.label());
+        assertNotEquals("secret", v.value("password"));  // hashed to something
+        assertThat(v.value("password").toString().length(), greaterThan(0));
+    }
+
+    @Test
+    @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_REMOVE_VERTICES)
+    public void shouldRemoveUser() {
+        MatcherAssert.assertThat(graph.vertices().hasNext(), is(false));
+        credentials(graph).createUser("stephen", "secret");
+        MatcherAssert.assertThat(graph.vertices().hasNext(), is(true));
+
+        assertEquals(1, credentials(graph).removeUser("stephen"));
+        MatcherAssert.assertThat(graph.vertices().hasNext(), is(false));
+    }
+
+    @Test
+    @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
+    public void shouldNotRemoveUser() {
+        MatcherAssert.assertThat(graph.vertices().hasNext(), is(false));
+        credentials(graph).createUser("stephen", "secret");
+        MatcherAssert.assertThat(graph.vertices().hasNext(), is(true));
+
+        assertEquals(0, credentials(graph).removeUser("stephanie"));
+        MatcherAssert.assertThat(graph.vertices().hasNext(), is(true));
+    }
+
+    @Test
+    @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
+    public void shouldFindUser() {
+        MatcherAssert.assertThat(graph.vertices().hasNext(), is(false));
+        credentials(graph).createUser("marko", "secret");
+        final Vertex stephen = credentials(graph).createUser("stephen", "secret");
+        credentials(graph).createUser("daniel", "secret");
+        MatcherAssert.assertThat(graph.vertices().hasNext(), is(true));
+
+        assertEquals(stephen, credentials(graph).findUser("stephen"));
+    }
+
+    @Test
+    @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
+    public void shouldNotFindUser() {
+        MatcherAssert.assertThat(graph.vertices().hasNext(), is(false));
+        credentials(graph).createUser("marko", "secret");
+        credentials(graph).createUser("stephen", "secret");
+        credentials(graph).createUser("daniel", "secret");
+        MatcherAssert.assertThat(graph.vertices().hasNext(), is(true));
+
+        assertNull(credentials(graph).findUser("stephanie"));
+    }
+
+    @Test
+    @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
+    public void shouldCountUsers() {
+        MatcherAssert.assertThat(graph.vertices().hasNext(), is(false));
+        credentials(graph).createUser("marko", "secret");
+        credentials(graph).createUser("stephen", "secret");
+        credentials(graph).createUser("daniel", "secret");
+        MatcherAssert.assertThat(graph.vertices().hasNext(), is(true));
+
+        assertEquals(3, credentials(graph).countUsers());
+    }
+
+    @Test(expected = IllegalStateException.class)
+    @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
+    public void shouldThrowIfFindingMultipleUsers() {
+        MatcherAssert.assertThat(graph.vertices().hasNext(), is(false));
+        credentials(graph).createUser("stephen", "secret");
+        credentials(graph).createUser("stephen", "secret");
+        MatcherAssert.assertThat(graph.vertices().hasNext(), is(true));
+
+        assertNull(credentials(graph).findUser("stephen"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6439d709/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphTest.java
index d7d7f9d..7cdf329 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphTest.java
@@ -26,7 +26,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.hamcrest.MatcherAssert;
 import org.junit.Test;
 
-import static org.apache.tinkerpop.gremlin.groovy.plugin.dsl.credential.CredentialGraph.*;
+import static org.apache.tinkerpop.gremlin.groovy.plugin.dsl.credential.CredentialGraph.credentials;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.greaterThan;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6439d709/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy b/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
index f2bfe5c..4f895c8 100644
--- a/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
+++ b/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy
@@ -50,6 +50,13 @@ class DependencyGrabber {
         this.extensionDirectory = extensionDirectory
     }
 
+    /**
+     * @deprecated As of release 3.2.4, replaced by {@link #deleteDependenciesFromPath(Artifact)}
+     */
+    def String deleteDependenciesFromPath(final org.apache.tinkerpop.gremlin.groovy.plugin.Artifact artifact) {
+        deleteDependenciesFromPath(new Artifact(artifact.group, artifact.artifact, artifact.version))
+    }
+
     def String deleteDependenciesFromPath(final Artifact artifact) {
         final def dep = makeDepsMap(artifact)
         final String extClassPath = getPathFromDependency(dep)
@@ -63,6 +70,13 @@ class DependencyGrabber {
         }
     }
 
+    /**
+     * @deprecated As of release 3.2.4, replaced by {@link #copyDependenciesToPath(Artifact)}
+     */
+    def String copyDependenciesToPath(final org.apache.tinkerpop.gremlin.groovy.plugin.Artifact artifact) {
+        copyDependenciesToPath(new Artifact(artifact.group, artifact.artifact, artifact.version))
+    }
+
     def Set<String> copyDependenciesToPath(final Artifact artifact) {
         final def dep = makeDepsMap(artifact)
         final String extClassPath = getPathFromDependency(dep)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6439d709/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraph.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraph.java
new file mode 100644
index 0000000..707e816
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraph.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential;
+
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.mindrot.BCrypt;
+
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.drop;
+
+/**
+ * A DSL for managing a "credentials graph" used by Gremlin Server for simple authentication functions.  If the
+ * {@link Graph} is transactional, new transactions will be started for each method call.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class CredentialGraph {
+
+    private final int BCRYPT_ROUNDS = 4;
+    private final Graph graph;
+    private final GraphTraversalSource g;
+    private final boolean supportsTransactions;
+
+    public CredentialGraph(final Graph graph) {
+        this.graph = graph;
+        g = graph.traversal();
+        supportsTransactions = graph.features().graph().supportsTransactions();
+    }
+
+    /**
+     * Finds a user by username and return {@code null} if one could not be found.
+     *
+     * @throws IllegalStateException if there is more than one user with a particular username.
+     */
+    public Vertex findUser(final String username) {
+        if (supportsTransactions) g.tx().rollback();
+        final GraphTraversal<Vertex,Vertex> t = g.V().has(CredentialGraphTokens.PROPERTY_USERNAME, username);
+        final Vertex v = t.hasNext() ? t.next() : null;
+        if (t.hasNext()) throw new IllegalStateException(String.format("Multiple users with username %s", username));
+        return v;
+    }
+
+    /**
+     * Creates a new user.
+     *
+     * @return the newly created user vertex
+     */
+    public Vertex createUser(final String username, final String password) {
+        if (findUser(username) != null) throw new IllegalStateException("User with this name already exists");
+        if (supportsTransactions) graph.tx().rollback();
+
+        try {
+            final Vertex v =  graph.addVertex(T.label, CredentialGraphTokens.VERTEX_LABEL_USER,
+                                              CredentialGraphTokens.PROPERTY_USERNAME, username,
+                                              CredentialGraphTokens.PROPERTY_PASSWORD, BCrypt.hashpw(password, BCrypt.gensalt(BCRYPT_ROUNDS)));
+            if (supportsTransactions) graph.tx().commit();
+            return v;
+        } catch (Exception ex) {
+            if (supportsTransactions) graph.tx().rollback();
+            throw new RuntimeException(ex);
+        }
+    }
+
+    /**
+     * Removes a user by name.
+     *
+     * @return the number of users removed (which should be one or zero)
+     */
+    public long removeUser(final String username) {
+        if (supportsTransactions) graph.tx().rollback();
+        try {
+            final long count = g.V().has(CredentialGraphTokens.PROPERTY_USERNAME, username).sideEffect(drop()).count().next();
+            if (supportsTransactions) graph.tx().commit();
+            return count;
+        } catch (Exception ex) {
+            if (supportsTransactions) graph.tx().rollback();
+            throw new RuntimeException(ex);
+        }
+    }
+
+    /**
+     * Get a count of the number of users in the database.
+     */
+    public long countUsers() {
+        if (supportsTransactions) graph.tx().rollback();
+        return g.V().hasLabel(CredentialGraphTokens.VERTEX_LABEL_USER).count().next();
+    }
+
+    @Override
+    public String toString() {
+        return "CredentialGraph{" +
+                "graph=" + graph +
+                '}';
+    }
+
+    /**
+     * Wrap up any {@link Graph} instance in the {@code CredentialGraph} DSL.
+     */
+    public static CredentialGraph credentials(final Graph graph) {
+        return new CredentialGraph(graph);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6439d709/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphGremlinPlugin.java
new file mode 100644
index 0000000..7b6bd64
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphGremlinPlugin.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential;
+
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+/**
+ * Plugin for the "credentials graph".  This plugin imports the {@link CredentialGraph} to its environment.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class CredentialGraphGremlinPlugin extends AbstractGremlinPlugin {
+
+    private static final String NAME = "tinkerpop.credentials";
+
+    private static final ImportCustomizer imports;
+
+    static {
+        try {
+            imports = DefaultImportCustomizer.build()
+                    .addClassImports(CredentialGraph.class)
+                    .addMethodImports(CredentialGraph.class.getMethod("credentials", Graph.class))
+                    .create();
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    public CredentialGraphGremlinPlugin() {
+        super(NAME, imports);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6439d709/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTokens.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTokens.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTokens.java
new file mode 100644
index 0000000..ac16302
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTokens.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class CredentialGraphTokens {
+    public static final String PROPERTY_USERNAME = "username";
+    public static final String PROPERTY_PASSWORD = "password";
+
+    public static final String VERTEX_LABEL_USER = "user";
+
+    private CredentialGraphTokens() {}
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6439d709/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraph.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraph.java
index 8c0277c..6a90587 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraph.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraph.java
@@ -32,7 +32,9 @@ import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.drop;
  * {@link Graph} is transactional, new transactions will be started for each method call.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraph}.
  */
+@Deprecated
 public class CredentialGraph {
 
     private final int BCRYPT_ROUNDS = 4;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6439d709/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphTokens.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphTokens.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphTokens.java
index 0cb2543..1f0d8cf 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphTokens.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphTokens.java
@@ -20,7 +20,9 @@ package org.apache.tinkerpop.gremlin.groovy.plugin.dsl.credential;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens}.
  */
+@Deprecated
 public final class CredentialGraphTokens {
     public static final String PROPERTY_USERNAME = "username";
     public static final String PROPERTY_PASSWORD = "password";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6439d709/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/jsr223/CredentialGraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/jsr223/CredentialGraphGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/jsr223/CredentialGraphGremlinPlugin.java
deleted file mode 100644
index 761567b..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/jsr223/CredentialGraphGremlinPlugin.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.groovy.plugin.dsl.credential.jsr223;
-
-import org.apache.tinkerpop.gremlin.groovy.plugin.dsl.credential.CredentialGraph;
-import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
-import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Plugin for the "credentials graph".  This plugin imports the {@link CredentialGraph} to its environment.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class CredentialGraphGremlinPlugin extends AbstractGremlinPlugin {
-
-    private static final String NAME = "tinkerpop.credentials";
-
-    private static final ImportCustomizer imports;
-
-    static {
-        try {
-            imports = DefaultImportCustomizer.build()
-                    .addClassImports(CredentialGraph.class)
-                    .addMethodImports(CredentialGraph.class.getMethod("credentials", Graph.class))
-                    .create();
-        } catch (Exception ex) {
-            throw new RuntimeException(ex);
-        }
-    }
-
-    public CredentialGraphGremlinPlugin() {
-        super(NAME, imports);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6439d709/gremlin-groovy/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin b/gremlin-groovy/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
index 0004a80..251250b 100644
--- a/gremlin-groovy/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
+++ b/gremlin-groovy/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
@@ -1,2 +1,2 @@
 org.apache.tinkerpop.gremlin.groovy.jsr223.SugarGremlinPlugin
-org.apache.tinkerpop.gremlin.groovy.plugin.dsl.credential.jsr223.CredentialGraphGremlinPlugin
\ No newline at end of file
+org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphGremlinPlugin
\ No newline at end of file


[18/50] tinkerpop git commit: TINKERPOP-1562 Deprecated TinkerGraphGremlinPlugin.

Posted by sp...@apache.org.
TINKERPOP-1562 Deprecated TinkerGraphGremlinPlugin.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/f5a1ebb5
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/f5a1ebb5
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/f5a1ebb5

Branch: refs/heads/TINKERPOP-1562
Commit: f5a1ebb54f698b4957435e05297befcc2ab97ef9
Parents: a4fa9da
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 22 09:42:12 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../tinkergraph/groovy/plugin/TinkerGraphGremlinPlugin.java       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f5a1ebb5/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/groovy/plugin/TinkerGraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/groovy/plugin/TinkerGraphGremlinPlugin.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/groovy/plugin/TinkerGraphGremlinPlugin.java
index df35314..5c8231a 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/groovy/plugin/TinkerGraphGremlinPlugin.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/groovy/plugin/TinkerGraphGremlinPlugin.java
@@ -30,10 +30,11 @@ import java.util.Set;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin}.
  */
+@Deprecated
 public final class TinkerGraphGremlinPlugin extends AbstractGremlinPlugin {
 
-
     private static final Set<String> IMPORTS = new HashSet<String>() {{
         add(IMPORT_SPACE + TinkerGraph.class.getPackage().getName() + DOT_STAR);
         add(IMPORT_SPACE + TinkerGraphComputer.class.getPackage().getName() + DOT_STAR);


[17/50] tinkerpop git commit: TINKERPOP-1562 Add new Neo4j GremlinPlugin and deprecated old one

Posted by sp...@apache.org.
TINKERPOP-1562 Add new Neo4j GremlinPlugin and deprecated old one


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/2e65a113
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2e65a113
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2e65a113

Branch: refs/heads/TINKERPOP-1562
Commit: 2e65a113e2a9e0b56bcbdba4c124cb1590759cf3
Parents: c41250c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 22 11:15:57 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../groovy/plugin/AbstractGremlinPlugin.java    |  2 +
 .../neo4j/groovy/plugin/Neo4jGremlinPlugin.java |  1 +
 .../neo4j/jsr223/Neo4jGremlinPlugin.java        | 71 ++++++++++++++++++++
 ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin |  1 +
 ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin |  1 +
 .../jsr223/TinkerGraphGremlinPlugin.java        |  7 +-
 6 files changed, 78 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e65a113/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/AbstractGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/AbstractGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/AbstractGremlinPlugin.java
index fcc8d05..090da6e 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/AbstractGremlinPlugin.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/AbstractGremlinPlugin.java
@@ -30,7 +30,9 @@ import java.util.Map;
  * shell and io objects.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin}.
  */
+@Deprecated
 public abstract class AbstractGremlinPlugin implements GremlinPlugin {
     public static final String ENV_CONSOLE_IO = "ConsolePluginAcceptor.io";
     public static final String ENV_CONSOLE_SHELL = "ConsolePluginAcceptor.shell";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e65a113/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java
index f3fe37c..9053cf3 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java
@@ -30,6 +30,7 @@ import java.util.Set;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.neo4j.jsr223.Neo4jGremlinPlugin}.
  */
 public final class Neo4jGremlinPlugin extends AbstractGremlinPlugin {
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e65a113/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/jsr223/Neo4jGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/jsr223/Neo4jGremlinPlugin.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/jsr223/Neo4jGremlinPlugin.java
new file mode 100644
index 0000000..82a8d18
--- /dev/null
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/jsr223/Neo4jGremlinPlugin.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.neo4j.jsr223;
+
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.neo4j.process.traversal.LabelP;
+import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jEdge;
+import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jElement;
+import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph;
+import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraphVariables;
+import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jHelper;
+import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jProperty;
+import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jVertex;
+import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jVertexProperty;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class Neo4jGremlinPlugin extends AbstractGremlinPlugin {
+
+    private static final String NAME = "tinkerpop.neo4j";
+
+    private static final ImportCustomizer imports;
+
+    static {
+        try {
+            imports = DefaultImportCustomizer.build()
+                    .addClassImports(Neo4jEdge.class,
+                            Neo4jElement.class,
+                            Neo4jGraph.class,
+                            Neo4jGraphVariables.class,
+                            Neo4jHelper.class,
+                            Neo4jProperty.class,
+                            Neo4jVertex.class,
+                            Neo4jVertexProperty.class)
+                    .addMethodImports(LabelP.class.getMethod("of", String.class)).create();
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    public Neo4jGremlinPlugin() {
+        super(NAME, imports);
+    }
+
+    @Override
+    public boolean requireRestart() {
+        return true;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e65a113/neo4j-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin b/neo4j-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
new file mode 100644
index 0000000..cb86e57
--- /dev/null
+++ b/neo4j-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
@@ -0,0 +1 @@
+org.apache.tinkerpop.gremlin.neo4j.jsr223.Neo4jGremlinPlugin
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e65a113/spark-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
----------------------------------------------------------------------
diff --git a/spark-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin b/spark-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
new file mode 100644
index 0000000..939b6ff
--- /dev/null
+++ b/spark-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
@@ -0,0 +1 @@
+org.apache.tinkerpop.gremlin.spark.jsr223.SparkGremlinPlugin
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e65a113/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java
index 68e649c..19188d2 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java
@@ -19,7 +19,6 @@
 package org.apache.tinkerpop.gremlin.tinkergraph.jsr223;
 
 import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
-import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
 import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
 import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerGraphComputer;
@@ -41,13 +40,11 @@ import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerProperty;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertexProperty;
 
-import java.util.Optional;
-
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public final class TinkerGraphGremlinPlugin extends AbstractGremlinPlugin {
-    private static final String MODULE_NAME = "tinkerpop.tinkergraph";
+    private static final String NAME = "tinkerpop.tinkergraph";
 
     private static final ImportCustomizer imports = DefaultImportCustomizer.build()
             .addClassImports(TinkerEdge.class,
@@ -70,6 +67,6 @@ public final class TinkerGraphGremlinPlugin extends AbstractGremlinPlugin {
                              TinkerWorkerPool.class).create();
 
     public TinkerGraphGremlinPlugin() {
-        super(MODULE_NAME, imports);
+        super(NAME, imports);
     }
 }


[41/50] tinkerpop git commit: TINKERPOP-1562 Fix yet another compilation error.

Posted by sp...@apache.org.
TINKERPOP-1562 Fix yet another compilation error.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/9218e8a1
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9218e8a1
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9218e8a1

Branch: refs/heads/TINKERPOP-1562
Commit: 9218e8a1b4b532fbbfdcba00f005c8e9fdf95c59
Parents: 873ac61
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 29 17:03:34 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:50 2016 -0500

----------------------------------------------------------------------
 .../gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9218e8a1/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
index c3ade04..cb6fa60 100644
--- a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
+++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
@@ -78,7 +78,7 @@ public class GremlinPluginAdapterTest {
     public void shouldAdaptForScriptCustomizer() throws Exception {
         final File scriptFile1 = TestHelper.generateTempFileFromResource(GremlinPluginAdapterTest.class, "script-customizer-1.groovy", ".groovy");
         final File scriptFile2 = TestHelper.generateTempFileFromResource(GremlinPluginAdapterTest.class, "script-customizer-2.groovy", ".groovy");
-        final Set<String> files = new HashSet<>();
+        final List<String> files = new ArrayList<>();
         files.add(scriptFile1.getAbsolutePath());
         files.add(scriptFile2.getAbsolutePath());
         final ScriptFileGremlinPlugin plugin = ScriptFileGremlinPlugin.build().files(files).create();


[19/50] tinkerpop git commit: TINKERPOP-1562 Fixed problems related to loading new/old plugins

Posted by sp...@apache.org.
TINKERPOP-1562 Fixed problems related to loading new/old plugins

Tested in Gremlin Console and it looks like the flag that will tell it to load one plugin version or the other is working properly.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a4fa9da2
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a4fa9da2
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a4fa9da2

Branch: refs/heads/TINKERPOP-1562
Commit: a4fa9da27b4334141c3001f628883adbcad6ca19
Parents: aee85b1
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 22 09:39:37 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../tinkerpop/gremlin/console/Mediator.groovy   |  2 +-
 .../gremlin/console/plugin/PluggedIn.groovy     |  2 +-
 .../jsr223/TinkerGraphGremlinPlugin.java        | 77 ++++++++++++++++++++
 ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin |  1 +
 4 files changed, 80 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a4fa9da2/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
index 396c563..18e8d58 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy
@@ -34,7 +34,7 @@ class Mediator {
 
     private static String LINE_SEP = System.getProperty("line.separator")
 
-    public static final boolean useV3d3 = System.getProperty("plugins", "v3d3") == "v3d3"
+    public static final boolean useV3d3 = System.getProperty("plugins", "v3d2") == "v3d3"
 
     public Mediator(final Console console) {
         this.console = console

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a4fa9da2/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
index 54659fa..d298cd7 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
@@ -79,7 +79,7 @@ class PluggedIn {
 
         @Override
         void pluginTo(final PluginAcceptor pluginAcceptor) throws IllegalEnvironmentException, PluginInitializationException {
-            corePlugin.getCustomizers("gremlin-groovy").each {
+            corePlugin.getCustomizers("gremlin-groovy").get().each {
                 if (it instanceof ImportCustomizer) {
                     def imports = [] as Set
                     it.classImports.each { imports.add("import " + it.canonicalName )}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a4fa9da2/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java
new file mode 100644
index 0000000..16a6cb5
--- /dev/null
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.tinkergraph.jsr223;
+
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerGraphComputer;
+import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerGraphComputerView;
+import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerMapEmitter;
+import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerMemory;
+import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerMessenger;
+import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerReduceEmitter;
+import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerWorkerPool;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerEdge;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraphVariables;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerHelper;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistry;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV2d0;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerProperty;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertexProperty;
+
+import java.util.Optional;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class TinkerGraphGremlinPlugin extends AbstractGremlinPlugin {
+    private static final String MODULE_NAME = "tinkerpop.tinkergraph";
+
+    public TinkerGraphGremlinPlugin() {
+        super(MODULE_NAME, DefaultImportCustomizer.build().addClassImports(
+                TinkerEdge.class,
+                TinkerElement.class,
+                TinkerFactory.class,
+                TinkerGraph.class,
+                TinkerGraphVariables.class,
+                TinkerHelper.class,
+                TinkerIoRegistry.class,
+                TinkerIoRegistryV2d0.class,
+                TinkerProperty.class,
+                TinkerVertex.class,
+                TinkerVertexProperty.class,
+                TinkerGraphComputer.class,
+                TinkerGraphComputerView.class,
+                TinkerMapEmitter.class,
+                TinkerMemory.class,
+                TinkerMessenger.class,
+                TinkerReduceEmitter.class,
+                TinkerWorkerPool.class).create());
+    }
+
+    @Override
+    public Optional<Customizer[]> getCustomizers() {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a4fa9da2/tinkergraph-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin b/tinkergraph-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
new file mode 100644
index 0000000..f63b96f
--- /dev/null
+++ b/tinkergraph-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
@@ -0,0 +1 @@
+org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin
\ No newline at end of file


[44/50] tinkerpop git commit: TINKERPOP-1562 Deprecated plugin exceptions.

Posted by sp...@apache.org.
TINKERPOP-1562 Deprecated plugin exceptions.

These are needed anymore under the revised plugin model in gremlin-core.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a2a23596
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a2a23596
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a2a23596

Branch: refs/heads/TINKERPOP-1562
Commit: a2a23596322acf8201a67ac7d3baf8ef7dbb135d
Parents: 80f79bc
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 29 09:21:49 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:50 2016 -0500

----------------------------------------------------------------------
 .../gremlin/jsr223/GremlinPluginException.java  | 41 --------------------
 .../groovy/plugin/GremlinPluginException.java   |  2 +
 .../plugin/IllegalEnvironmentException.java     |  2 +
 .../plugin/PluginInitializationException.java   |  2 +
 4 files changed, 6 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2a23596/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPluginException.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPluginException.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPluginException.java
deleted file mode 100644
index ce4ab2f..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPluginException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.jsr223;
-
-/**
- * Base exception for {@link GremlinPlugin}.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public abstract class GremlinPluginException extends Exception {
-    public GremlinPluginException() {
-    }
-
-    public GremlinPluginException(final String message) {
-        super(message);
-    }
-
-    public GremlinPluginException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public GremlinPluginException(final Throwable cause) {
-        super(cause);
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2a23596/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPluginException.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPluginException.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPluginException.java
index d85c743..c8664c7 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPluginException.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPluginException.java
@@ -22,7 +22,9 @@ package org.apache.tinkerpop.gremlin.groovy.plugin;
  * Base exception for {@link GremlinPlugin}.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, not replaced.
  */
+@Deprecated
 public abstract class GremlinPluginException extends Exception {
     public GremlinPluginException() {
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2a23596/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/IllegalEnvironmentException.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/IllegalEnvironmentException.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/IllegalEnvironmentException.java
index 86dbcbc..8d6fbe2 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/IllegalEnvironmentException.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/IllegalEnvironmentException.java
@@ -23,7 +23,9 @@ package org.apache.tinkerpop.gremlin.groovy.plugin;
  * the needs of the {@link GremlinPlugin}.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, not replaced.
  */
+@Deprecated
 public class IllegalEnvironmentException extends GremlinPluginException {
     public IllegalEnvironmentException(final GremlinPlugin plugin, final String... expectedKeys) {
         super(String.format("The %s plugin may not be compatible with this environment - requires the follow ScriptEngine environment keys [%s]", plugin.getName(), String.join(",", expectedKeys)));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2a23596/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginInitializationException.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginInitializationException.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginInitializationException.java
index 7d87215..0dd6fc1 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginInitializationException.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginInitializationException.java
@@ -23,7 +23,9 @@ package org.apache.tinkerpop.gremlin.groovy.plugin;
  * {@code ScriptEngine}.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, not replaced.
  */
+@Deprecated
 public class PluginInitializationException extends GremlinPluginException {
     public PluginInitializationException(final String message) {
         super(message);


[24/50] tinkerpop git commit: TINKERPOP-1562 Minor changes to javadocs.

Posted by sp...@apache.org.
TINKERPOP-1562 Minor changes to javadocs.

Also, moved a public static field back to ImportCustomizer (after it became a interface).


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/03e931d1
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/03e931d1
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/03e931d1

Branch: refs/heads/TINKERPOP-1562
Commit: 03e931d151684e2186ae9b8b1f7887b93817157f
Parents: a91fb80
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Nov 23 11:31:06 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java |  7 ++++---
 .../gremlin/jsr223/DefaultImportCustomizer.java     |  8 --------
 .../tinkerpop/gremlin/jsr223/ImportCustomizer.java  | 10 ++++++++++
 .../gremlin/jsr223/ImportGremlinPlugin.java         |  7 ++++---
 .../gremlin/jsr223/ScriptFileGremlinPlugin.java     | 16 ++++++++++------
 5 files changed, 28 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/03e931d1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
index 410b222..d579691 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
@@ -23,13 +23,14 @@ import org.apache.tinkerpop.gremlin.util.CoreImports;
 import java.util.Optional;
 
 /**
- * This module is required for a {@code ScriptEngine} to be Gremlin-enabled.
+ * This module is required for a {@code ScriptEngine} to be Gremlin-enabled. This {@link GremlinPlugin} is not enabled
+ * for the {@code ServiceLoader}. It is designed to be instantiated manually.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public final class CoreGremlinPlugin implements GremlinPlugin {
 
-    private static final String MODULE_NAME = "tinkerpop.core";
+    private static final String NAME = "tinkerpop.core";
 
     private static final ImportCustomizer gremlinCore = DefaultImportCustomizer.build()
             .addClassImports(CoreImports.getClassImports())
@@ -57,6 +58,6 @@ public final class CoreGremlinPlugin implements GremlinPlugin {
 
     @Override
     public String getName() {
-        return MODULE_NAME;
+        return NAME;
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/03e931d1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
index 85d6531..fa0965d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
@@ -33,14 +33,6 @@ import java.util.Set;
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class DefaultImportCustomizer implements ImportCustomizer {
-    /**
-     * @deprecated As of release 3.2.4, not replaced.
-     */
-    @Deprecated
-    public static final ImportCustomizer GREMLIN_CORE = DefaultImportCustomizer.build()
-            .addClassImports(CoreImports.getClassImports())
-            .addEnumImports(CoreImports.getEnumImports())
-            .addMethodImports(CoreImports.getMethodImports()).create();
 
     private final Set<Class> classImports;
     private final Set<Method> methodImports;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/03e931d1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
index 7eced82..7b056ff 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
@@ -18,6 +18,8 @@
  */
 package org.apache.tinkerpop.gremlin.jsr223;
 
+import org.apache.tinkerpop.gremlin.util.CoreImports;
+
 import java.lang.reflect.Method;
 import java.util.Set;
 
@@ -27,6 +29,14 @@ import java.util.Set;
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public interface ImportCustomizer extends Customizer {
+    /**
+     * @deprecated As of release 3.2.4, not replaced.
+     */
+    @Deprecated
+    public static final ImportCustomizer GREMLIN_CORE = DefaultImportCustomizer.build()
+            .addClassImports(CoreImports.getClassImports())
+            .addEnumImports(CoreImports.getEnumImports())
+            .addMethodImports(CoreImports.getMethodImports()).create();
 
     public Set<Class> getClassImports();
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/03e931d1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
index 26290d3..0d446c0 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
@@ -33,15 +33,16 @@ import java.util.stream.Stream;
 /**
  * A module that allows custom class, static method and enum imports (i.e. those that are statically defined by a
  * module within itself). A user might utilize this class to supply their own imports. This module is not specific
- * to any {@link GremlinScriptEngine} - the imports are supplied to all engines.
+ * to any {@link GremlinScriptEngine} - the imports are supplied to all engines. This {@link GremlinPlugin} is not
+ * enabled for the {@code ServiceLoader}. It is designed to be instantiated manually.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public final class ImportGremlinPlugin extends AbstractGremlinPlugin {
-    private static final String MODULE_NAME = "tinkerpop.import";
+    private static final String NAME = "tinkerpop.import";
 
     private ImportGremlinPlugin(final Builder builder) {
-        super(MODULE_NAME, builder.appliesTo, DefaultImportCustomizer.build()
+        super(NAME, builder.appliesTo, DefaultImportCustomizer.build()
                                                 .addClassImports(builder.classImports)
                                                 .addEnumImports(builder.enumImports)
                                                 .addMethodImports(builder.methodImports).create());

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/03e931d1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
index 3fd811a..757001c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
@@ -25,13 +25,16 @@ import java.util.HashSet;
 import java.util.Set;
 
 /**
+ * Loads scripts from one or more files into the {@link GremlinScriptEngine} at startup. This {@link GremlinPlugin} is
+ * not enabled for the {@code ServiceLoader}. It is designed to be instantiated manually.
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public final class ScriptFileGremlinPlugin extends AbstractGremlinPlugin {
-    private static final String MODULE_NAME = "tinkerpop.script";
+    private static final String NAME = "tinkerpop.script";
 
-    public ScriptFileGremlinPlugin(final Builder builder) {
-        super(MODULE_NAME, builder.appliesTo, new DefaultScriptCustomizer(builder.files));
+    private ScriptFileGremlinPlugin(final Builder builder) {
+        super(NAME, builder.appliesTo, new DefaultScriptCustomizer(builder.files));
     }
 
     public static Builder build() {
@@ -47,10 +50,11 @@ public final class ScriptFileGremlinPlugin extends AbstractGremlinPlugin {
 
         /**
          * The name of the {@link GremlinScriptEngine} that this module will apply to. Setting no values here will
-         * make the module available to all the engines.
+         * make the module available to all the engines. Typically, this value should be set as a script's syntax will
+         * be bound to the {@link GremlinScriptEngine} language.
          */
-        public Builder appliesTo(final Collection<String> scriptEngineName) {
-            this.appliesTo.addAll(scriptEngineName);
+        public Builder appliesTo(final Collection<String> scriptEngineNames) {
+            this.appliesTo.addAll(scriptEngineNames);
             return this;
         }
 


[40/50] tinkerpop git commit: TINKERPOP-1562 Adapted CompilerCustomizerProvider to Customizer

Posted by sp...@apache.org.
TINKERPOP-1562 Adapted CompilerCustomizerProvider to Customizer

This hooks up all the groovy-specific configurations to the GremlinGroovyScriptEngine.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/8dc9b1fb
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/8dc9b1fb
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/8dc9b1fb

Branch: refs/heads/TINKERPOP-1562
Commit: 8dc9b1fbb3e0a6504b3d5d217dbb144031b30aab
Parents: 6439d70
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 29 16:15:12 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:50 2016 -0500

----------------------------------------------------------------------
 .../jsr223/CustomizerProviderCustomizer.java    |  40 ++++++
 .../jsr223/GremlinGroovyScriptEngine.java       |  20 ++-
 .../jsr223/GroovyCompilerGremlinPlugin.java     | 138 +++++++++++++++++++
 .../groovy/jsr223/SugarGremlinPlugin.java       |   8 +-
 .../CompileStaticCustomizerProvider.java        |   1 +
 .../ConfigurationCustomizerProvider.java        |   1 +
 .../InterpreterModeCustomizerProvider.java      |   1 +
 .../ThreadInterruptCustomizerProvider.java      |   1 +
 .../TimedInterruptCustomizerProvider.java       |   1 +
 .../TypeCheckedCustomizerProvider.java          |   1 +
 ...mlinGroovyScriptEngineCompileStaticTest.java |  72 +++++++++-
 .../GremlinGroovyScriptEngineConfigTest.java    |  14 +-
 .../jsr223/GremlinGroovyScriptEngineTest.java   |  50 ++++++-
 ...inGroovyScriptEngineThreadInterruptTest.java |  23 +++-
 ...linGroovyScriptEngineTimedInterruptTest.java |  69 +++++++++-
 ...remlinGroovyScriptEngineTypeCheckedTest.java |  72 +++++++++-
 .../jsr223/GroovyCompilerGremlinPluginTest.java | 128 +++++++++++++++++
 17 files changed, 617 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CustomizerProviderCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CustomizerProviderCustomizer.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CustomizerProviderCustomizer.java
new file mode 100644
index 0000000..73614a1
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CustomizerProviderCustomizer.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
+
+/**
+ * An adapter that allows existing {@link CompilerCustomizerProvider} instances to behave as a {#link Customizer}.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class CustomizerProviderCustomizer implements Customizer {
+
+    private final CompilerCustomizerProvider customizerProvider;
+
+    CustomizerProviderCustomizer(final CompilerCustomizerProvider customizerProvider) {
+        this.customizerProvider = customizerProvider;
+    }
+
+    CompilerCustomizerProvider getCustomizerProvider() {
+        return customizerProvider;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 264587a..2996792 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -70,7 +70,6 @@ import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -233,16 +232,31 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
             importCustomizerProvider = new EmptyImportCustomizerProvider(imports, staticImports);
         }
 
-        interpreterModeEnabled = false;
+        // this is a bit temporary - until CompilerCustomizerProvider is gone
+        final List<CompilerCustomizerProvider> customizerProviderCustomizer = listOfCustomizers.stream()
+                .filter(p -> p instanceof CustomizerProviderCustomizer)
+                .map(p -> ((CustomizerProviderCustomizer) p).getCustomizerProvider())
+                .collect(Collectors.toList());
 
-        customizerProviders = Collections.emptyList();
+        // determine if interpreter mode should be enabled
+        interpreterModeEnabled = customizerProviderCustomizer.stream()
+                .anyMatch(p -> p.getClass().equals(InterpreterModeCustomizerProvider.class));
+
+        // remove used providers as the rest will be applied directly
+        customizerProviders = customizerProviderCustomizer.stream()
+                .filter(p -> p != null &&
+                        !((p instanceof ImportCustomizerProvider)))
+                .collect(Collectors.toList());
 
         createClassLoader();
     }
 
     /**
      * Creates a new instance with the specified {@link CompilerCustomizerProvider} objects.
+     *
+     * @deprecated As of release 3.2.4, replaced by {@link #GremlinGroovyScriptEngine(Customizer...)}.
      */
+    @Deprecated
     public GremlinGroovyScriptEngine(final CompilerCustomizerProvider... compilerCustomizerProviders) {
         final List<CompilerCustomizerProvider> providers = Arrays.asList(compilerCustomizerProviders);
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPlugin.java
new file mode 100644
index 0000000..0d2e9c6
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPlugin.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.CompileStaticCustomizerProvider;
+import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.ConfigurationCustomizerProvider;
+import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.InterpreterModeCustomizerProvider;
+import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.ThreadInterruptCustomizerProvider;
+import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TimedInterruptCustomizerProvider;
+import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TypeCheckedCustomizerProvider;
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A {@link GremlinPlugin} that provides access to low-level configuration options of the {@code GroovyScriptEngine}
+ * itself.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GroovyCompilerGremlinPlugin extends AbstractGremlinPlugin {
+
+    public enum Compilation {
+        COMPILE_STATIC,
+        TYPE_CHECKED,
+        NONE
+    }
+
+    private static final String NAME = "tinkerpop.groovy";
+
+    private GroovyCompilerGremlinPlugin(final Builder builder) {
+        super(NAME, new HashSet<>(Collections.singletonList("gremlin-groovy")), builder.asCustomizers());
+    }
+
+    public static Builder build() {
+        return new Builder();
+    }
+
+    public static final class Builder {
+
+        private boolean interpreterMode;
+        private boolean threadInterrupt;
+        private long timeInMillis = 0;
+        private Compilation compilation = Compilation.NONE;
+        private String extensions = null;
+
+        private Map<String,Object> keyValues = Collections.emptyMap();
+
+        public Builder enableInterpreterMode(final boolean interpreterMode) {
+            this.interpreterMode = interpreterMode;
+            return this;
+        }
+
+        public Builder compilerConfigurationOptions(final Map<String,Object> keyValues) {
+            this.keyValues = keyValues;
+            return this;
+        }
+
+        public Builder enableThreadInterrupt(final boolean threadInterrupt) {
+            this.threadInterrupt = threadInterrupt;
+            return this;
+        }
+
+        public Builder timedInterrupt(final long timeInMillis) {
+            this.timeInMillis = timeInMillis;
+            return this;
+        }
+
+        public Builder compilation(final Compilation compilation) {
+            this.compilation = compilation;
+            return this;
+        }
+
+        public Builder compilation(final String compilation) {
+            return compilation(Compilation.valueOf(compilation));
+        }
+
+        public Builder extensions(final String extensions) {
+            this.extensions = extensions;
+            return this;
+        }
+
+        Customizer[] asCustomizers() {
+            final List<Customizer> list = new ArrayList<>();
+
+            if (interpreterMode)
+                list.add(new CustomizerProviderCustomizer(new InterpreterModeCustomizerProvider()));
+
+            if (!keyValues.isEmpty())
+                list.add(new CustomizerProviderCustomizer(new ConfigurationCustomizerProvider(keyValues)));
+
+            if (threadInterrupt)
+                list.add(new CustomizerProviderCustomizer(new ThreadInterruptCustomizerProvider()));
+
+            if (timeInMillis > 0)
+                list.add(new CustomizerProviderCustomizer(new TimedInterruptCustomizerProvider(timeInMillis)));
+
+            if (compilation == Compilation.COMPILE_STATIC)
+                list.add(new CustomizerProviderCustomizer(new CompileStaticCustomizerProvider(extensions)));
+            else if (compilation == Compilation.TYPE_CHECKED)
+                list.add(new CustomizerProviderCustomizer(new TypeCheckedCustomizerProvider(extensions)));
+            else if (compilation != Compilation.NONE)
+                throw new IllegalStateException("Use of unknown compilation type: " + compilation);
+
+            if (list.isEmpty()) throw new IllegalStateException("No customizer options have been selected for this plugin");
+
+            final Customizer[] customizers = new Customizer[list.size()];
+            list.toArray(customizers);
+            return customizers;
+        }
+
+        public GroovyCompilerGremlinPlugin create() {
+            return new GroovyCompilerGremlinPlugin(this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java
index 95c610f..82fbc8e 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
 import org.apache.tinkerpop.gremlin.jsr223.DefaultScriptCustomizer;
 
 import java.util.Collections;
+import java.util.HashSet;
 
 /**
  * A plugin implementation which allows for the usage of Gremlin Groovy's syntactic sugar.
@@ -34,12 +35,7 @@ public class SugarGremlinPlugin extends AbstractGremlinPlugin {
     private static final String NAME = "tinkerpop.sugar";
 
     public SugarGremlinPlugin() {
-        super(NAME, new DefaultScriptCustomizer(Collections.singletonList(
+        super(NAME, new HashSet<>(Collections.singletonList("gremlin-groovy")), new DefaultScriptCustomizer(Collections.singletonList(
                 Collections.singletonList(SugarLoader.class.getPackage().getName() + "." + SugarLoader.class.getSimpleName() + ".load()"))));
     }
-
-    @Override
-    public String getName() {
-        return "tinkerpop.sugar";
-    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/CompileStaticCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/CompileStaticCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/CompileStaticCustomizerProvider.java
index 65e1224..ab0bff5 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/CompileStaticCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/CompileStaticCustomizerProvider.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223.customizer;
 
 import groovy.transform.CompileStatic;
 import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
 import org.codehaus.groovy.control.customizers.CompilationCustomizer;
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ConfigurationCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ConfigurationCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ConfigurationCustomizerProvider.java
index ba9855c..78357cb 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ConfigurationCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ConfigurationCustomizerProvider.java
@@ -19,6 +19,7 @@
 package org.apache.tinkerpop.gremlin.groovy.jsr223.customizer;
 
 import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
 import org.codehaus.groovy.control.CompilerConfiguration;
 import org.codehaus.groovy.control.customizers.CompilationCustomizer;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/InterpreterModeCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/InterpreterModeCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/InterpreterModeCustomizerProvider.java
index e3f95f4..013ba8b 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/InterpreterModeCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/InterpreterModeCustomizerProvider.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223.customizer;
 
 import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
 import org.apache.tinkerpop.gremlin.groovy.jsr223.ast.InterpreterMode;
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
 import org.codehaus.groovy.control.customizers.CompilationCustomizer;
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ThreadInterruptCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ThreadInterruptCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ThreadInterruptCustomizerProvider.java
index 8c942c6..e46e9b7 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ThreadInterruptCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ThreadInterruptCustomizerProvider.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223.customizer;
 
 import groovy.transform.ThreadInterrupt;
 import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
 import org.codehaus.groovy.control.customizers.CompilationCustomizer;
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptCustomizerProvider.java
index e4bdc62..9913088 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptCustomizerProvider.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223.customizer;
 
 import groovy.transform.TimedInterrupt;
 import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 import org.codehaus.groovy.ast.tools.GeneralUtils;
 import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
 import org.codehaus.groovy.control.customizers.CompilationCustomizer;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TypeCheckedCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TypeCheckedCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TypeCheckedCustomizerProvider.java
index f0bc791..cf9147b 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TypeCheckedCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TypeCheckedCustomizerProvider.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223.customizer;
 
 import groovy.transform.TypeChecked;
 import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
 import org.codehaus.groovy.control.customizers.CompilationCustomizer;
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java
index 3ba3e0b..b62f3f3 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java
@@ -35,7 +35,7 @@ import static org.junit.Assert.fail;
  */
 public class GremlinGroovyScriptEngineCompileStaticTest {
     @Test
-    public void shouldCompileStatic() throws Exception {
+    public void shouldCompileStaticDeprecated() throws Exception {
         // with no type checking this should pass
         try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine()) {
             assertEquals(255, scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()"));
@@ -53,7 +53,25 @@ public class GremlinGroovyScriptEngineCompileStaticTest {
     }
 
     @Test
-    public void shouldCompileStaticWithExtension() throws Exception {
+    public void shouldCompileStatic() throws Exception {
+        // with no type checking this should pass
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine()) {
+            assertEquals(255, scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()"));
+        }
+
+        final CompileStaticCustomizerProvider provider = new CompileStaticCustomizerProvider();
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(provider))) {
+            scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()");
+            fail("Should have failed type checking");
+        } catch (ScriptException se) {
+            final Throwable root = ExceptionUtils.getRootCause(se);
+            assertEquals(MultipleCompilationErrorsException.class, root.getClass());
+            assertThat(se.getMessage(), containsString("[Static type checking] - Cannot find matching method java.lang.Object#getRed(). Please check if the declared type is right and if the method exists."));
+        }
+    }
+
+    @Test
+    public void shouldCompileStaticWithExtensionDeprecated() throws Exception {
         // with no type checking extension this should pass
         final CompileStaticCustomizerProvider providerNoExtension = new CompileStaticCustomizerProvider();
         try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension)) {
@@ -72,7 +90,26 @@ public class GremlinGroovyScriptEngineCompileStaticTest {
     }
 
     @Test
-    public void shouldCompileStaticWithMultipleExtension() throws Exception {
+    public void shouldCompileStaticWithExtension() throws Exception {
+        // with no type checking extension this should pass
+        final CompileStaticCustomizerProvider providerNoExtension = new CompileStaticCustomizerProvider();
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerNoExtension))) {
+            assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
+        }
+
+        final CompileStaticCustomizerProvider providerWithExtension = new CompileStaticCustomizerProvider(
+                PrecompiledExtensions.PreventColorUsageExtension.class.getName());
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerWithExtension))) {
+            scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red");
+            fail("Should have failed type checking");
+        } catch (ScriptException se) {
+            assertEquals(MultipleCompilationErrorsException.class, se.getCause().getClass());
+            assertThat(se.getMessage(), containsString("Method call is not allowed!"));
+        }
+    }
+
+    @Test
+    public void shouldCompileStaticWithMultipleExtensionDeprecated() throws Exception {
         // with no type checking extension this should pass
         final CompileStaticCustomizerProvider providerNoExtension = new CompileStaticCustomizerProvider();
         try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension)) {
@@ -99,4 +136,33 @@ public class GremlinGroovyScriptEngineCompileStaticTest {
             assertThat(se.getMessage(), containsString("Method call is not allowed!"));
         }
     }
+
+    @Test
+    public void shouldCompileStaticWithMultipleExtension() throws Exception {
+        // with no type checking extension this should pass
+        final CompileStaticCustomizerProvider providerNoExtension = new CompileStaticCustomizerProvider();
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerNoExtension))) {
+            assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
+            assertEquals(1l, scriptEngine.eval("def c = new java.util.concurrent.CountDownLatch(1); c.count"));
+        }
+
+        final CompileStaticCustomizerProvider providerWithExtension = new CompileStaticCustomizerProvider(
+                PrecompiledExtensions.PreventColorUsageExtension.class.getName() +
+                        "," + PrecompiledExtensions.PreventCountDownLatchUsageExtension.class.getName());
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerWithExtension))) {
+            scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red");
+            fail("Should have failed type checking");
+        } catch (ScriptException se) {
+            assertEquals(MultipleCompilationErrorsException.class, se.getCause().getClass());
+            assertThat(se.getMessage(), containsString("Method call is not allowed!"));
+        }
+
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension)) {
+            scriptEngine.eval("def c = new java.util.concurrent.CountDownLatch(1); c.count");
+            fail("Should have failed type checking");
+        } catch (ScriptException se) {
+            assertEquals(MultipleCompilationErrorsException.class, se.getCause().getClass());
+            assertThat(se.getMessage(), containsString("Method call is not allowed!"));
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineConfigTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineConfigTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineConfigTest.java
index d354ffa..6b18ece 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineConfigTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineConfigTest.java
@@ -31,9 +31,19 @@ import static org.junit.Assert.assertEquals;
  */
 public class GremlinGroovyScriptEngineConfigTest {
     @Test
-    public void shouldAddBaseScriptClass() throws Exception {
+    public void shouldAddBaseScriptClassDeprecated() throws Exception {
         final ScriptEngine engine = new GremlinGroovyScriptEngine(
-                new ConfigurationCustomizerProvider("ScriptBaseClass", BaseScriptForTesting.class.getName()), new DefaultImportCustomizerProvider());
+                new ConfigurationCustomizerProvider("ScriptBaseClass", BaseScriptForTesting.class.getName()),
+                new DefaultImportCustomizerProvider());
+
+        assertEquals("hello, stephen", engine.eval("hello('stephen')"));
+    }
+
+    @Test
+    public void shouldAddBaseScriptClass() throws Exception {
+        final ScriptEngine engine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(
+                new ConfigurationCustomizerProvider("ScriptBaseClass", BaseScriptForTesting.class.getName())),
+                new CustomizerProviderCustomizer(new DefaultImportCustomizerProvider()));
 
         assertEquals("hello, stephen", engine.eval("hello('stephen')"));
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
index b18c020..65dc56e 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
@@ -99,7 +99,7 @@ public class GremlinGroovyScriptEngineTest {
     }
 
     @Test
-    public void shouldPromoteDefinedVarsInInterpreterModeWithNoBindings() throws Exception {
+    public void shouldPromoteDefinedVarsInInterpreterModeWithNoBindingsDeprecated() throws Exception {
         final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(new InterpreterModeCustomizerProvider());
         engine.eval("def addItUp = { x, y -> x + y }");
         assertEquals(3, engine.eval("int xxx = 1 + 2"));
@@ -121,7 +121,29 @@ public class GremlinGroovyScriptEngineTest {
     }
 
     @Test
-    public void shouldPromoteDefinedVarsInInterpreterModeWithBindings() throws Exception {
+    public void shouldPromoteDefinedVarsInInterpreterModeWithNoBindings() throws Exception {
+        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(new InterpreterModeCustomizerProvider()));
+        engine.eval("def addItUp = { x, y -> x + y }");
+        assertEquals(3, engine.eval("int xxx = 1 + 2"));
+        assertEquals(4, engine.eval("yyy = xxx + 1"));
+        assertEquals(7, engine.eval("def zzz = yyy + xxx"));
+        assertEquals(4, engine.eval("zzz - xxx"));
+        assertEquals("accessible-globally", engine.eval("if (yyy > 0) { def inner = 'should-stay-local'; outer = 'accessible-globally' }\n outer"));
+        assertEquals("accessible-globally", engine.eval("outer"));
+
+        try {
+            engine.eval("inner");
+            fail("Should not have been able to access 'inner'");
+        } catch (Exception ex) {
+            final Throwable root = ExceptionUtils.getRootCause(ex);
+            assertThat(root, instanceOf(MissingPropertyException.class));
+        }
+
+        assertEquals(10, engine.eval("addItUp(zzz,xxx)"));
+    }
+
+    @Test
+    public void shouldPromoteDefinedVarsInInterpreterModeWithBindingsDeprecated() throws Exception {
         final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(new InterpreterModeCustomizerProvider());
         final Bindings b = new SimpleBindings();
         b.put("x", 2);
@@ -145,6 +167,30 @@ public class GremlinGroovyScriptEngineTest {
     }
 
     @Test
+    public void shouldPromoteDefinedVarsInInterpreterModeWithBindings() throws Exception {
+        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(new InterpreterModeCustomizerProvider()));
+        final Bindings b = new SimpleBindings();
+        b.put("x", 2);
+        engine.eval("def addItUp = { x, y -> x + y }", b);
+        assertEquals(3, engine.eval("int xxx = 1 + x", b));
+        assertEquals(4, engine.eval("yyy = xxx + 1", b));
+        assertEquals(7, engine.eval("def zzz = yyy + xxx", b));
+        assertEquals(4, engine.eval("zzz - xxx", b));
+        assertEquals("accessible-globally", engine.eval("if (yyy > 0) { def inner = 'should-stay-local'; outer = 'accessible-globally' }\n outer", b));
+        assertEquals("accessible-globally", engine.eval("outer", b));
+
+        try {
+            engine.eval("inner", b);
+            fail("Should not have been able to access 'inner'");
+        } catch (Exception ex) {
+            final Throwable root = ExceptionUtils.getRootCause(ex);
+            assertThat(root, instanceOf(MissingPropertyException.class));
+        }
+
+        assertEquals(10, engine.eval("addItUp(zzz,xxx)", b));
+    }
+
+    @Test
     public void shouldEvalWithBindings() throws Exception {
         final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine();
         final Bindings b = new SimpleBindings();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineThreadInterruptTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineThreadInterruptTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineThreadInterruptTest.java
index c002939..ea778c6 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineThreadInterruptTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineThreadInterruptTest.java
@@ -33,7 +33,7 @@ import static org.junit.Assert.assertTrue;
  */
 public class GremlinGroovyScriptEngineThreadInterruptTest {
     @Test
-    public void shouldInterruptWhile() throws Exception {
+    public void shouldInterruptWhileDeprecated() throws Exception {
         final ScriptEngine engine = new GremlinGroovyScriptEngine(new ThreadInterruptCustomizerProvider());
         final AtomicBoolean asserted = new AtomicBoolean(false);
 
@@ -54,6 +54,27 @@ public class GremlinGroovyScriptEngineThreadInterruptTest {
     }
 
     @Test
+    public void shouldInterruptWhile() throws Exception {
+        final ScriptEngine engine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(new ThreadInterruptCustomizerProvider()));
+        final AtomicBoolean asserted = new AtomicBoolean(false);
+
+        final Thread t = new Thread(() -> {
+            try {
+                engine.eval("s = System.currentTimeMillis();\nwhile((System.currentTimeMillis() - s) < 10000) {}");
+            } catch (ScriptException se) {
+                asserted.set(se.getCause().getCause() instanceof InterruptedException);
+            }
+        });
+
+        t.start();
+        Thread.sleep(100);
+        t.interrupt();
+        while(t.isAlive()) {}
+
+        assertTrue(asserted.get());
+    }
+
+    @Test
     public void shouldNotInterruptWhile() throws Exception {
         // companion to shouldInterruptWhile                                 t
         final ScriptEngine engine = new GremlinGroovyScriptEngine();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTimedInterruptTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTimedInterruptTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTimedInterruptTest.java
index c465732..fa8d4ef 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTimedInterruptTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTimedInterruptTest.java
@@ -36,21 +36,51 @@ import static org.junit.Assert.fail;
 public class GremlinGroovyScriptEngineTimedInterruptTest {
 
     @Test
+    public void shouldTimeoutScriptOnTimedWhileDeprecated() throws Exception {
+        final ScriptEngine engine = new GremlinGroovyScriptEngine(
+                new TimedInterruptCustomizerProvider(1000), new DefaultImportCustomizerProvider());
+        try {
+            engine.eval("s = System.currentTimeMillis();\nwhile((System.currentTimeMillis() - s) < 10000) {}");
+            fail("This should have timed out");
+        } catch (ScriptException se) {
+            assertEquals(TimedInterruptTimeoutException.class, se.getCause().getCause().getClass());
+        }
+    }
+
+    @Test
     public void shouldTimeoutScriptOnTimedWhile() throws Exception {
         final ScriptEngine engine = new GremlinGroovyScriptEngine(
+                new CustomizerProviderCustomizer(new TimedInterruptCustomizerProvider(1000)),
+                new CustomizerProviderCustomizer(new DefaultImportCustomizerProvider()));
+        try {
+            engine.eval("s = System.currentTimeMillis();\nwhile((System.currentTimeMillis() - s) < 10000) {}");
+            fail("This should have timed out");
+        } catch (ScriptException se) {
+            assertEquals(TimedInterruptTimeoutException.class, se.getCause().getCause().getClass());
+        }
+    }
+
+    @Test
+    public void shouldTimeoutScriptOnTimedWhileOnceEngineHasBeenAliveForLongerThanTimeoutDeprecated() throws Exception {
+        final ScriptEngine engine = new GremlinGroovyScriptEngine(
                 new TimedInterruptCustomizerProvider(1000), new DefaultImportCustomizerProvider());
+        Thread.sleep(2000);
         try {
             engine.eval("s = System.currentTimeMillis();\nwhile((System.currentTimeMillis() - s) < 10000) {}");
             fail("This should have timed out");
         } catch (ScriptException se) {
             assertEquals(TimedInterruptTimeoutException.class, se.getCause().getCause().getClass());
         }
+
+        assertEquals(2, engine.eval("1+1"));
     }
 
+
     @Test
     public void shouldTimeoutScriptOnTimedWhileOnceEngineHasBeenAliveForLongerThanTimeout() throws Exception {
         final ScriptEngine engine = new GremlinGroovyScriptEngine(
-                new TimedInterruptCustomizerProvider(1000), new DefaultImportCustomizerProvider());
+                new CustomizerProviderCustomizer(new TimedInterruptCustomizerProvider(1000)),
+                new CustomizerProviderCustomizer(new DefaultImportCustomizerProvider()));
         Thread.sleep(2000);
         try {
             engine.eval("s = System.currentTimeMillis();\nwhile((System.currentTimeMillis() - s) < 10000) {}");
@@ -63,7 +93,7 @@ public class GremlinGroovyScriptEngineTimedInterruptTest {
     }
 
     @Test
-    public void shouldContinueToEvalScriptsEvenWithTimedInterrupt() throws Exception {
+    public void shouldContinueToEvalScriptsEvenWithTimedInterruptDeprecated() throws Exception {
         final ScriptEngine engine = new GremlinGroovyScriptEngine(
                 new TimedInterruptCustomizerProvider(1000), new DefaultImportCustomizerProvider());
 
@@ -84,7 +114,29 @@ public class GremlinGroovyScriptEngineTimedInterruptTest {
     }
 
     @Test
-    public void shouldNotTimeoutStandaloneFunction() throws Exception {
+    public void shouldContinueToEvalScriptsEvenWithTimedInterrupt() throws Exception {
+        final ScriptEngine engine = new GremlinGroovyScriptEngine(
+                new CustomizerProviderCustomizer(new TimedInterruptCustomizerProvider(1000)),
+                new CustomizerProviderCustomizer(new DefaultImportCustomizerProvider()));
+
+        for (int ix = 0; ix < 5; ix++) {
+            try {
+                // this script takes 1000 ms longer than the interruptionTimeout
+                engine.eval("s = System.currentTimeMillis();\nwhile((System.currentTimeMillis() - s) < 2000) {}");
+                fail("This should have timed out");
+            } catch (ScriptException se) {
+                assertEquals(TimedInterruptTimeoutException.class, se.getCause().getCause().getClass());
+            }
+
+            // this script takes 500 ms less than the interruptionTimeout
+            assertEquals("test", engine.eval("s = System.currentTimeMillis();\nwhile((System.currentTimeMillis() - s) < 500) {};'test'"));
+        }
+
+        assertEquals(2, engine.eval("1+1"));
+    }
+
+    @Test
+    public void shouldNotTimeoutStandaloneFunctionDeprecated() throws Exception {
         // use a super fast timeout which should not prevent the call of a cached function
         final ScriptEngine engine = new GremlinGroovyScriptEngine(
                 new TimedInterruptCustomizerProvider(1), new DefaultImportCustomizerProvider());
@@ -92,4 +144,15 @@ public class GremlinGroovyScriptEngineTimedInterruptTest {
 
         assertEquals(3, engine.eval("addItUp(1,2)"));
     }
+
+    @Test
+    public void shouldNotTimeoutStandaloneFunction() throws Exception {
+        // use a super fast timeout which should not prevent the call of a cached function
+        final ScriptEngine engine = new GremlinGroovyScriptEngine(
+                new CustomizerProviderCustomizer(new TimedInterruptCustomizerProvider(1)),
+                new CustomizerProviderCustomizer(new DefaultImportCustomizerProvider()));
+        engine.eval("def addItUp(x,y) { x + y }");
+
+        assertEquals(3, engine.eval("addItUp(1,2)"));
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java
index a9062a8..0ca12d7 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java
@@ -36,7 +36,7 @@ import static org.junit.Assert.fail;
  */
 public class GremlinGroovyScriptEngineTypeCheckedTest {
     @Test
-    public void shouldTypeCheck() throws Exception {
+    public void shouldTypeCheckDeprecated() throws Exception {
         // with no type checking this should pass
         try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine()) {
             assertEquals(255, scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()"));
@@ -54,7 +54,25 @@ public class GremlinGroovyScriptEngineTypeCheckedTest {
     }
 
     @Test
-    public void shouldTypeCheckWithExtension() throws Exception {
+    public void shouldTypeCheck() throws Exception {
+        // with no type checking this should pass
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine()) {
+            assertEquals(255, scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()"));
+        }
+
+        final TypeCheckedCustomizerProvider provider = new TypeCheckedCustomizerProvider();
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(provider))) {
+            scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()");
+            fail("Should have failed type checking");
+        } catch (ScriptException se) {
+            final Throwable root = ExceptionUtils.getRootCause(se);
+            assertEquals(MultipleCompilationErrorsException.class, root.getClass());
+            assertThat(se.getMessage(), containsString("[Static type checking] - Cannot find matching method java.lang.Object#getRed(). Please check if the declared type is right and if the method exists."));
+        }
+    }
+
+    @Test
+    public void shouldTypeCheckWithExtensionDeprecated() throws Exception {
         // with no type checking extension this should pass
         final TypeCheckedCustomizerProvider providerNoExtension = new TypeCheckedCustomizerProvider();
         try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension)) {
@@ -73,7 +91,26 @@ public class GremlinGroovyScriptEngineTypeCheckedTest {
     }
 
     @Test
-    public void shouldTypeCheckWithMultipleExtension() throws Exception {
+    public void shouldTypeCheckWithExtension() throws Exception {
+        // with no type checking extension this should pass
+        final TypeCheckedCustomizerProvider providerNoExtension = new TypeCheckedCustomizerProvider();
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerNoExtension))) {
+            assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
+        }
+
+        final CompileStaticCustomizerProvider providerWithExtension = new CompileStaticCustomizerProvider(
+                PrecompiledExtensions.PreventColorUsageExtension.class.getName());
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerWithExtension))) {
+            scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red");
+            fail("Should have failed type checking");
+        } catch (ScriptException se) {
+            assertEquals(MultipleCompilationErrorsException.class, se.getCause().getClass());
+            assertThat(se.getMessage(), containsString("Method call is not allowed!"));
+        }
+    }
+
+    @Test
+    public void shouldTypeCheckWithMultipleExtensionDeprecated() throws Exception {
         // with no type checking extension this should pass
         final TypeCheckedCustomizerProvider providerNoExtension = new TypeCheckedCustomizerProvider();
         try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension)) {
@@ -100,4 +137,33 @@ public class GremlinGroovyScriptEngineTypeCheckedTest {
             assertThat(se.getMessage(), containsString("Method call is not allowed!"));
         }
     }
+
+    @Test
+    public void shouldTypeCheckWithMultipleExtension() throws Exception {
+        // with no type checking extension this should pass
+        final TypeCheckedCustomizerProvider providerNoExtension = new TypeCheckedCustomizerProvider();
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerNoExtension))) {
+            assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
+            assertEquals(1l, scriptEngine.eval("def c = new java.util.concurrent.CountDownLatch(1); c.count"));
+        }
+
+        final TypeCheckedCustomizerProvider providerWithExtension = new TypeCheckedCustomizerProvider(
+                PrecompiledExtensions.PreventColorUsageExtension.class.getName() +
+                        "," + PrecompiledExtensions.PreventCountDownLatchUsageExtension.class.getName());
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerWithExtension))) {
+            scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red");
+            fail("Should have failed type checking");
+        } catch (ScriptException se) {
+            assertEquals(MultipleCompilationErrorsException.class, se.getCause().getClass());
+            assertThat(se.getMessage(), containsString("Method call is not allowed!"));
+        }
+
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension)) {
+            scriptEngine.eval("def c = new java.util.concurrent.CountDownLatch(1); c.count");
+            fail("Should have failed type checking");
+        } catch (ScriptException se) {
+            assertEquals(MultipleCompilationErrorsException.class, se.getCause().getClass());
+            assertThat(se.getMessage(), containsString("Method call is not allowed!"));
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPluginTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPluginTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPluginTest.java
new file mode 100644
index 0000000..8d2178f
--- /dev/null
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPluginTest.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.CompileStaticCustomizerProvider;
+import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.ConfigurationCustomizerProvider;
+import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.InterpreterModeCustomizerProvider;
+import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.ThreadInterruptCustomizerProvider;
+import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TimedInterruptCustomizerProvider;
+import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TypeCheckedCustomizerProvider;
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
+import org.codehaus.groovy.control.CompilerConfiguration;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+
+import static org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyCompilerGremlinPlugin.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GroovyCompilerGremlinPluginTest {
+
+    @Test
+    public void shouldConfigureForGroovyOnly() {
+        final GroovyCompilerGremlinPlugin plugin = GroovyCompilerGremlinPlugin.build().
+                compilation(Compilation.COMPILE_STATIC).create();
+        final Optional<Customizer[]> customizers = plugin.getCustomizers("gremlin-not-real");
+        assertThat(customizers.isPresent(), is(false));
+    }
+
+    @Test
+    public void shouldConfigureWithCompileStatic() {
+        final GroovyCompilerGremlinPlugin plugin = GroovyCompilerGremlinPlugin.build().
+                compilation(Compilation.COMPILE_STATIC).create();
+        final Optional<Customizer[]> customizers = plugin.getCustomizers("gremlin-groovy");
+        assertThat(customizers.isPresent(), is(true));
+        assertEquals(1, customizers.get().length);
+        assertThat(((CustomizerProviderCustomizer) customizers.get()[0]).getCustomizerProvider(), instanceOf(CompileStaticCustomizerProvider.class));
+    }
+
+    @Test
+    public void shouldConfigureWithTypeChecked() {
+        final GroovyCompilerGremlinPlugin plugin = GroovyCompilerGremlinPlugin.build().
+                compilation(Compilation.TYPE_CHECKED).create();
+        final Optional<Customizer[]> customizers = plugin.getCustomizers("gremlin-groovy");
+        assertThat(customizers.isPresent(), is(true));
+        assertEquals(1, customizers.get().length);
+        assertThat(((CustomizerProviderCustomizer) customizers.get()[0]).getCustomizerProvider(), instanceOf(TypeCheckedCustomizerProvider.class));
+    }
+
+    @Test
+    public void shouldConfigureWithCustomCompilerConfigurations() {
+        final Map<String,Object> conf = new HashMap<>();
+        conf.put("Debug", true);
+        final GroovyCompilerGremlinPlugin plugin = GroovyCompilerGremlinPlugin.build().
+                compilerConfigurationOptions(conf).create();
+        final Optional<Customizer[]> customizers = plugin.getCustomizers("gremlin-groovy");
+        assertThat(customizers.isPresent(), is(true));
+        assertEquals(1, customizers.get().length);
+        assertThat(((CustomizerProviderCustomizer) customizers.get()[0]).getCustomizerProvider(), instanceOf(ConfigurationCustomizerProvider.class));
+
+        final CompilerConfiguration compilerConfiguration = new CompilerConfiguration();
+        assertThat(compilerConfiguration.getDebug(), is(false));
+
+        final ConfigurationCustomizerProvider provider = (ConfigurationCustomizerProvider) ((CustomizerProviderCustomizer) customizers.get()[0]).getCustomizerProvider();
+        provider.applyCustomization(compilerConfiguration);
+
+        assertThat(compilerConfiguration.getDebug(), is(true));
+    }
+
+    @Test
+    public void shouldConfigureWithInterpreterMode() {
+        final GroovyCompilerGremlinPlugin plugin = GroovyCompilerGremlinPlugin.build().
+                enableInterpreterMode(true).create();
+        final Optional<Customizer[]> customizers = plugin.getCustomizers("gremlin-groovy");
+        assertThat(customizers.isPresent(), is(true));
+        assertEquals(1, customizers.get().length);
+        assertThat(((CustomizerProviderCustomizer) customizers.get()[0]).getCustomizerProvider(), instanceOf(InterpreterModeCustomizerProvider.class));
+    }
+
+    @Test
+    public void shouldConfigureWithThreadInterrupt() {
+        final GroovyCompilerGremlinPlugin plugin = GroovyCompilerGremlinPlugin.build().
+                enableThreadInterrupt(true).create();
+        final Optional<Customizer[]> customizers = plugin.getCustomizers("gremlin-groovy");
+        assertThat(customizers.isPresent(), is(true));
+        assertEquals(1, customizers.get().length);
+        assertThat(((CustomizerProviderCustomizer) customizers.get()[0]).getCustomizerProvider(), instanceOf(ThreadInterruptCustomizerProvider.class));
+    }
+
+    @Test
+    public void shouldConfigureWithTimedInterrupt() {
+        final GroovyCompilerGremlinPlugin plugin = GroovyCompilerGremlinPlugin.build().
+                timedInterrupt(60000).create();
+        final Optional<Customizer[]> customizers = plugin.getCustomizers("gremlin-groovy");
+        assertThat(customizers.isPresent(), is(true));
+        assertEquals(1, customizers.get().length);
+        assertThat(((CustomizerProviderCustomizer) customizers.get()[0]).getCustomizerProvider(), instanceOf(TimedInterruptCustomizerProvider.class));
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotConfigureIfNoSettingsAreSupplied() {
+        GroovyCompilerGremlinPlugin.build().create();
+    }
+}


[42/50] tinkerpop git commit: TINKERPOP-1562 Fixed a bad javadoc link

Posted by sp...@apache.org.
TINKERPOP-1562 Fixed a bad javadoc link


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/6d1b97e0
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/6d1b97e0
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/6d1b97e0

Branch: refs/heads/TINKERPOP-1562
Commit: 6d1b97e0bb3f5567900124d3a549c066b7ff3605
Parents: 9218e8a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Nov 30 06:37:14 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:50 2016 -0500

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d1b97e0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java
index ab4c81d..9571b2c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java
@@ -28,8 +28,9 @@ import java.util.Map;
  * A "remote connection" does not necessarily have to be a remote server.  It simply refers to a resource that is
  * external to the console.
  * <p/>
- * By implementing this interface and returning an instance of it through {@link ConsoleCustomizer#getRemoteAcceptor(Map)}
- * a plugin can hook into those commands and provide remoting features.
+ * By implementing this interface and returning an instance of it through
+ * {@link ConsoleCustomizer#getRemoteAcceptor(GremlinShellEnvironment)} a plugin can hook into those commands and
+ * provide remoting features.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */


[47/50] tinkerpop git commit: TINKERPOP-1562 Make all groovy customizer providers straight Customizer instances

Posted by sp...@apache.org.
TINKERPOP-1562 Make all groovy customizer providers straight Customizer instances


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a82c56fa
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a82c56fa
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a82c56fa

Branch: refs/heads/TINKERPOP-1562
Commit: a82c56fad2500f49da265466d5e23f345749d348
Parents: 00ccf0f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Nov 30 18:43:13 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:51 2016 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../tinkerpop/gremlin/util/CoreImports.java     | 34 +++++--
 .../jsr223/CompileStaticGroovyCustomizer.java   | 60 ++++++++++++
 .../jsr223/ConfigurationGroovyCustomizer.java   | 82 +++++++++++++++++
 .../jsr223/CustomizerProviderCustomizer.java    | 40 --------
 .../jsr223/GremlinGroovyScriptEngine.java       | 97 ++++++++++----------
 .../jsr223/GroovyCompilerGremlinPlugin.java     | 18 ++--
 .../gremlin/groovy/jsr223/GroovyCustomizer.java | 33 +++++++
 .../groovy/jsr223/ImportGroovyCustomizer.java   | 66 +++++++++++++
 .../jsr223/InterpreterModeGroovyCustomizer.java | 36 ++++++++
 .../jsr223/ThreadInterruptGroovyCustomizer.java | 35 +++++++
 .../jsr223/TimedInterruptGroovyCustomizer.java  | 62 +++++++++++++
 .../jsr223/TimedInterruptTimeoutException.java  | 38 ++++++++
 .../jsr223/TypeCheckedGroovyCustomizer.java     | 65 +++++++++++++
 .../CompileStaticCustomizerProvider.java        |  2 +
 .../ConfigurationCustomizerProvider.java        |  2 +
 .../InterpreterModeCustomizerProvider.java      |  4 +
 .../ThreadInterruptCustomizerProvider.java      |  2 +
 .../TimedInterruptCustomizerProvider.java       |  2 +
 .../TimedInterruptTimeoutException.java         |  4 +
 .../TypeCheckedCustomizerProvider.java          |  2 +
 .../VariableIdentificationCustomizer.java       |  2 +
 ...mlinGroovyScriptEngineCompileStaticTest.java | 20 ++--
 .../GremlinGroovyScriptEngineConfigTest.java    |  5 +-
 .../jsr223/GremlinGroovyScriptEngineTest.java   |  6 +-
 ...inGroovyScriptEngineThreadInterruptTest.java |  2 +-
 ...linGroovyScriptEngineTimedInterruptTest.java | 22 ++---
 ...remlinGroovyScriptEngineTypeCheckedTest.java | 18 ++--
 .../jsr223/GroovyCompilerGremlinPluginTest.java | 14 +--
 .../server/op/AbstractEvalOpProcessor.java      |  5 +
 30 files changed, 625 insertions(+), 154 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index ebcc318..b4ba2a6 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -46,6 +46,7 @@ TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
 * Fixed a `NoSuchElementException` bug with `GroupXXXStep` where if the reduced `TraverserSet` is empty, don't add the key/value.
 * Fixed a `NullPointerException` bug with profiling `GroupSideEffectStep` in OLTP.
 * Improved ability to release resources in `GraphProvider` instances in the test suite.
+* Factored `GremlinPlugin` functionality out of gremlin-groovy and into gremlin-core - related classes were deprecated.
 * Added a `force` option for killing sessions without waiting for transaction close or timeout of a currently running job or multiple jobs.
 * Deprecated `Session.kill()` and `Session.manualKill()`.
 * Added `choose(predicate,traversal)` and `choose(traversal,traversal)` to effect if/then-semantics (no else). Equivalent to `choose(x,y,identity())`.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java
index e6c64fd..1c6a6e6 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java
@@ -83,12 +83,15 @@ import org.apache.tinkerpop.gremlin.structure.io.Io;
 import org.apache.tinkerpop.gremlin.structure.io.IoCore;
 import org.apache.tinkerpop.gremlin.structure.io.Storage;
 import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
+import org.javatuples.Pair;
 
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
+import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 /**
@@ -187,11 +190,11 @@ public final class CoreImports {
         // METHODS //
         /////////////
 
-        Stream.of(IoCore.class.getMethods()).filter(m -> Modifier.isStatic(m.getModifiers())).forEach(METHOD_IMPORTS::add);
-        Stream.of(P.class.getMethods()).filter(m -> Modifier.isStatic(m.getModifiers())).forEach(METHOD_IMPORTS::add);
-        Stream.of(__.class.getMethods()).filter(m -> Modifier.isStatic(m.getModifiers())).filter(m -> !m.getName().equals("__")).forEach(METHOD_IMPORTS::add);
-        Stream.of(Computer.class.getMethods()).filter(m -> Modifier.isStatic(m.getModifiers())).forEach(METHOD_IMPORTS::add);
-        Stream.of(TimeUtil.class.getMethods()).filter(m -> Modifier.isStatic(m.getModifiers())).forEach(METHOD_IMPORTS::add);
+        uniqueMethods(IoCore.class).forEach(METHOD_IMPORTS::add);
+        uniqueMethods(P.class).forEach(METHOD_IMPORTS::add);
+        uniqueMethods(__.class).filter(m -> !m.getName().equals("__")).forEach(METHOD_IMPORTS::add);
+        uniqueMethods(Computer.class).forEach(METHOD_IMPORTS::add);
+        uniqueMethods(TimeUtil.class).forEach(METHOD_IMPORTS::add);
 
         ///////////
         // ENUMS //
@@ -207,7 +210,6 @@ public final class CoreImports {
         Collections.addAll(ENUM_IMPORTS, Scope.values());
         Collections.addAll(ENUM_IMPORTS, T.values());
         Collections.addAll(ENUM_IMPORTS, TraversalOptionParent.Pick.values());
-
     }
 
     private CoreImports() {
@@ -225,4 +227,24 @@ public final class CoreImports {
     public static Set<Enum> getEnumImports() {
         return Collections.unmodifiableSet(ENUM_IMPORTS);
     }
+
+    /**
+     * Filters to unique method names on each class.
+     */
+    private static Stream<Method> uniqueMethods(final Class<?> clazz) {
+        final Set<String> unique = new HashSet<>();
+        return Stream.of(clazz.getMethods())
+                .filter(m -> Modifier.isStatic(m.getModifiers()))
+                .map(m -> Pair.with(generateMethodDescriptor(m), m))
+                .filter(p -> {
+                    final boolean exists = unique.contains(p.getValue0());
+                    if (!exists) unique.add(p.getValue0());
+                    return !exists;
+                })
+                .map(Pair::getValue1);
+    }
+
+    private static String generateMethodDescriptor(final Method m) {
+        return m.getDeclaringClass().getCanonicalName() + "." + m.getName();
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CompileStaticGroovyCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CompileStaticGroovyCustomizer.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CompileStaticGroovyCustomizer.java
new file mode 100644
index 0000000..c57e64b
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CompileStaticGroovyCustomizer.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import groovy.transform.CompileStatic;
+import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
+import org.codehaus.groovy.control.customizers.CompilationCustomizer;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * Injects the {@code CompileStatic} transformer to enable type validation on script execution.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class CompileStaticGroovyCustomizer implements GroovyCustomizer {
+
+    private final String extensions;
+
+    CompileStaticGroovyCustomizer() {
+        this(null);
+    }
+
+    CompileStaticGroovyCustomizer(final String extensions) {
+        this.extensions = extensions;
+    }
+
+    @Override
+    public CompilationCustomizer create() {
+        final Map<String, Object> annotationParams = new HashMap<>();
+        if (extensions != null && !extensions.isEmpty()) {
+            if (extensions.contains(","))
+                annotationParams.put("extensions", Stream.of(extensions.split(",")).collect(Collectors.toList()));
+            else
+                annotationParams.put("extensions", Collections.singletonList(extensions));
+        }
+
+        return new ASTTransformationCustomizer(annotationParams, CompileStatic.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ConfigurationGroovyCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ConfigurationGroovyCustomizer.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ConfigurationGroovyCustomizer.java
new file mode 100644
index 0000000..23fe002
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ConfigurationGroovyCustomizer.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+import org.codehaus.groovy.control.CompilerConfiguration;
+import org.codehaus.groovy.control.customizers.CompilationCustomizer;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Allows configurations to be directly supplied to a groovy {@code CompilerConfiguration} when a
+ * {@link GremlinGroovyScriptEngine} is initialized, providing fine-grained
+ * control over its internals.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class ConfigurationGroovyCustomizer implements GroovyCustomizer {
+
+    private final Map<String,Object> properties;
+
+    /**
+     * Creates a new instance using configuration values specified
+     */
+    ConfigurationGroovyCustomizer(final Object... keyValues) {
+        if (null == keyValues || keyValues.length == 0)
+            throw new IllegalArgumentException("ConfigurationCustomizerProvider must have key/values specified");
+
+        if (keyValues.length % 2 != 0)
+            throw new IllegalArgumentException("The keyValues must have an even number of values");
+
+        properties = ElementHelper.asMap(keyValues);
+    }
+
+    /**
+     * Creates a new instance using configuration values specified
+     */
+    ConfigurationGroovyCustomizer(final Map<String,Object> keyValues) {
+        properties = keyValues;
+    }
+
+    public CompilerConfiguration applyCustomization(final CompilerConfiguration compilerConfiguration) {
+        final Class<CompilerConfiguration> clazz = CompilerConfiguration.class;
+        final List<Method> methods = Arrays.asList(clazz.getMethods());
+        for (Map.Entry<String,Object> entry : properties.entrySet()) {
+            final Method method = methods.stream().filter(m -> m.getName().equals("set" + entry.getKey())).findFirst()
+                   .orElseThrow(() -> new IllegalStateException("Invalid setting [" + entry.getKey() + "] for CompilerConfiguration"));
+
+            try {
+                method.invoke(compilerConfiguration, entry.getValue());
+            } catch (Exception ex) {
+                throw new IllegalStateException(ex);
+            }
+        }
+
+        return compilerConfiguration;
+    }
+
+    @Override
+    public CompilationCustomizer create() {
+        throw new UnsupportedOperationException("This is a marker implementation that does not create a CompilationCustomizer instance");
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CustomizerProviderCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CustomizerProviderCustomizer.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CustomizerProviderCustomizer.java
deleted file mode 100644
index 73614a1..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CustomizerProviderCustomizer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.groovy.jsr223;
-
-import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
-import org.apache.tinkerpop.gremlin.jsr223.Customizer;
-
-/**
- * An adapter that allows existing {@link CompilerCustomizerProvider} instances to behave as a {#link Customizer}.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-class CustomizerProviderCustomizer implements Customizer {
-
-    private final CompilerCustomizerProvider customizerProvider;
-
-    CustomizerProviderCustomizer(final CompilerCustomizerProvider customizerProvider) {
-        this.customizerProvider = customizerProvider;
-    }
-
-    CompilerCustomizerProvider getCustomizerProvider() {
-        return customizerProvider;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 2996792..0f36dbf 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -70,6 +70,7 @@ import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -177,6 +178,9 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
     private ImportCustomizerProvider importCustomizerProvider;
     private final List<CompilerCustomizerProvider> customizerProviders;
 
+    private final ImportGroovyCustomizer importGroovyCustomizer;
+    private final List<GroovyCustomizer> groovyCustomizers;
+
     private final Set<Artifact> artifactsToUse = new HashSet<>();
     private final boolean interpreterModeEnabled;
 
@@ -207,46 +211,21 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
                 .filter(p -> p instanceof ImportCustomizer)
                 .map(p -> (ImportCustomizer) p)
                 .collect(Collectors.toList());
-        if (importCustomizers.isEmpty()) {
-            importCustomizerProvider = NoImportCustomizerProvider.INSTANCE;
-        } else {
-            final Set<String> imports = new HashSet<>();
-            final Set<String> staticImports = new HashSet<>();
-            importCustomizers.forEach(ic -> {
-                ic.getClassImports().forEach(c -> {
-                    final String importStatement = c.getName();
-                    imports.add(importStatement);
-                });
-
-                ic.getEnumImports().forEach(e -> {
-                    final String importStatement = e.getDeclaringClass().getCanonicalName() + ".*";
-                    staticImports.add(importStatement);
-                });
+        final ImportCustomizer[] importCustomizerArray = new ImportCustomizer[importCustomizers.size()];
+        importGroovyCustomizer = new ImportGroovyCustomizer(importCustomizers.toArray(importCustomizerArray));
 
-                ic.getMethodImports().forEach(m -> {
-                    final String importStatement = m.getDeclaringClass().getCanonicalName() + ".*";
-                    staticImports.add(importStatement);
-                });
-            });
-
-            importCustomizerProvider = new EmptyImportCustomizerProvider(imports, staticImports);
-        }
-
-        // this is a bit temporary - until CompilerCustomizerProvider is gone
-        final List<CompilerCustomizerProvider> customizerProviderCustomizer = listOfCustomizers.stream()
-                .filter(p -> p instanceof CustomizerProviderCustomizer)
-                .map(p -> ((CustomizerProviderCustomizer) p).getCustomizerProvider())
+        groovyCustomizers = listOfCustomizers.stream()
+                .filter(p -> p instanceof GroovyCustomizer)
+                .map(p -> ((GroovyCustomizer) p))
                 .collect(Collectors.toList());
 
         // determine if interpreter mode should be enabled
-        interpreterModeEnabled = customizerProviderCustomizer.stream()
-                .anyMatch(p -> p.getClass().equals(InterpreterModeCustomizerProvider.class));
+        interpreterModeEnabled = groovyCustomizers.stream()
+                .anyMatch(p -> p.getClass().equals(InterpreterModeGroovyCustomizer.class));
 
-        // remove used providers as the rest will be applied directly
-        customizerProviders = customizerProviderCustomizer.stream()
-                .filter(p -> p != null &&
-                        !((p instanceof ImportCustomizerProvider)))
-                .collect(Collectors.toList());
+        // not using the old provider model so set that to empty list so that when createClassLoader is called
+        // it knows to use groovyCustomizers instead
+        customizerProviders = Collections.emptyList();
 
         createClassLoader();
     }
@@ -273,10 +252,14 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
 
         // remove used providers as the rest will be applied directly
         customizerProviders = providers.stream()
-                .filter(p -> p != null &&
-                        !((p instanceof ImportCustomizerProvider)))
+                .filter(p -> p != null && !(p instanceof ImportCustomizerProvider))
                 .collect(Collectors.toList());
 
+        // groovy customizers are not used here - set to empty list so that the customizerProviders get used
+        // in createClassLoader
+        groovyCustomizers = Collections.emptyList();
+        importGroovyCustomizer = null;
+
         createClassLoader();
     }
 
@@ -350,7 +333,11 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
      */
     @Override
     public synchronized void addImports(final Set<String> importStatements) {
-        final Set<String> staticImports = new HashSet<>();
+        // can't use this feature because imports can't come in as String for the revised model
+        if (null == importCustomizerProvider)
+            throw new IllegalStateException("Imports cannot be added to a GremlinGroovyScriptEngine that uses Customizer instances");
+
+            final Set<String> staticImports = new HashSet<>();
         final Set<String> imports = new HashSet<>();
 
         importStatements.forEach(s -> {
@@ -362,9 +349,8 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
                 imports.add(s.substring(6).trim());
         });
 
-        // use the EmptyImportCustomizer because it doesn't come with static initializers containing
-        // existing imports.
         importCustomizerProvider = new EmptyImportCustomizerProvider(importCustomizerProvider, imports, staticImports);
+
         internalReset();
     }
 
@@ -697,17 +683,32 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
     }
 
     private synchronized void createClassLoader() {
-        final CompilerConfiguration conf = new CompilerConfiguration(CompilerConfiguration.DEFAULT);
-        conf.addCompilationCustomizers(this.importCustomizerProvider.create());
+        // check for customizerProviders temporarily until this deprecated stuff is gone
+        if (groovyCustomizers.isEmpty() && null == importGroovyCustomizer) {
+            final CompilerConfiguration conf = new CompilerConfiguration(CompilerConfiguration.DEFAULT);
+            conf.addCompilationCustomizers(this.importCustomizerProvider.create());
 
-        // ConfigurationCustomizerProvider is treated separately
-        customizerProviders.stream().filter(cp -> !(cp instanceof ConfigurationCustomizerProvider))
-                .forEach(p -> conf.addCompilationCustomizers(p.create()));
+            // ConfigurationCustomizerProvider is treated separately
+            customizerProviders.stream().filter(cp -> !(cp instanceof ConfigurationCustomizerProvider))
+                    .forEach(p -> conf.addCompilationCustomizers(p.create()));
 
-        customizerProviders.stream().filter(cp -> cp instanceof ConfigurationCustomizerProvider).findFirst()
-                .ifPresent(cp -> ((ConfigurationCustomizerProvider) cp).applyCustomization(conf));
+            customizerProviders.stream().filter(cp -> cp instanceof ConfigurationCustomizerProvider).findFirst()
+                    .ifPresent(cp -> ((ConfigurationCustomizerProvider) cp).applyCustomization(conf));
 
-        this.loader = new GremlinGroovyClassLoader(getParentLoader(), conf);
+            this.loader = new GremlinGroovyClassLoader(getParentLoader(), conf);
+        } else {
+            final CompilerConfiguration conf = new CompilerConfiguration(CompilerConfiguration.DEFAULT);
+            conf.addCompilationCustomizers(this.importGroovyCustomizer.create());
+
+            // ConfigurationCustomizerProvider is treated separately
+            groovyCustomizers.stream().filter(cp -> !(cp instanceof ConfigurationGroovyCustomizer))
+                    .forEach(p -> conf.addCompilationCustomizers(p.create()));
+
+            groovyCustomizers.stream().filter(cp -> cp instanceof ConfigurationGroovyCustomizer).findFirst()
+                    .ifPresent(cp -> ((ConfigurationGroovyCustomizer) cp).applyCustomization(conf));
+
+            this.loader = new GremlinGroovyClassLoader(getParentLoader(), conf);
+        }
     }
 
     private void use(final Artifact artifact) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPlugin.java
index 0d2e9c6..71f5dc7 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPlugin.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPlugin.java
@@ -18,12 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.groovy.jsr223;
 
-import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.CompileStaticCustomizerProvider;
-import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.ConfigurationCustomizerProvider;
-import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.InterpreterModeCustomizerProvider;
-import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.ThreadInterruptCustomizerProvider;
-import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TimedInterruptCustomizerProvider;
-import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TypeCheckedCustomizerProvider;
 import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
 import org.apache.tinkerpop.gremlin.jsr223.Customizer;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
@@ -106,21 +100,21 @@ public class GroovyCompilerGremlinPlugin extends AbstractGremlinPlugin {
             final List<Customizer> list = new ArrayList<>();
 
             if (interpreterMode)
-                list.add(new CustomizerProviderCustomizer(new InterpreterModeCustomizerProvider()));
+                list.add(new InterpreterModeGroovyCustomizer());
 
             if (!keyValues.isEmpty())
-                list.add(new CustomizerProviderCustomizer(new ConfigurationCustomizerProvider(keyValues)));
+                list.add(new ConfigurationGroovyCustomizer(keyValues));
 
             if (threadInterrupt)
-                list.add(new CustomizerProviderCustomizer(new ThreadInterruptCustomizerProvider()));
+                list.add(new ThreadInterruptGroovyCustomizer());
 
             if (timeInMillis > 0)
-                list.add(new CustomizerProviderCustomizer(new TimedInterruptCustomizerProvider(timeInMillis)));
+                list.add(new TimedInterruptGroovyCustomizer(timeInMillis));
 
             if (compilation == Compilation.COMPILE_STATIC)
-                list.add(new CustomizerProviderCustomizer(new CompileStaticCustomizerProvider(extensions)));
+                list.add(new CompileStaticGroovyCustomizer(extensions));
             else if (compilation == Compilation.TYPE_CHECKED)
-                list.add(new CustomizerProviderCustomizer(new TypeCheckedCustomizerProvider(extensions)));
+                list.add(new TypeCheckedGroovyCustomizer(extensions));
             else if (compilation != Compilation.NONE)
                 throw new IllegalStateException("Use of unknown compilation type: " + compilation);
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCustomizer.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCustomizer.java
new file mode 100644
index 0000000..94426c0
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCustomizer.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
+import org.codehaus.groovy.control.customizers.CompilationCustomizer;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface GroovyCustomizer extends Customizer {
+
+    /**
+     * Create a new instance of a {@code CompilationCustomizer} to add to the {@link GremlinGroovyScriptEngine}.
+     */
+    public CompilationCustomizer create();
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ImportGroovyCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ImportGroovyCustomizer.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ImportGroovyCustomizer.java
new file mode 100644
index 0000000..79243a0
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ImportGroovyCustomizer.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.codehaus.groovy.control.customizers.CompilationCustomizer;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class ImportGroovyCustomizer implements GroovyCustomizer {
+
+    private final List<ImportCustomizer> customizers;
+
+    ImportGroovyCustomizer(final ImportCustomizer... customizers) {
+        this.customizers = Arrays.asList(customizers);
+    }
+
+    ImportGroovyCustomizer(final ImportGroovyCustomizer ic, final ImportCustomizer... customizers) {
+        this.customizers = new ArrayList<>(Arrays.asList(customizers));
+        this.customizers.addAll(ic.customizers);
+    }
+
+    @Override
+    public CompilationCustomizer create() {
+        final org.codehaus.groovy.control.customizers.ImportCustomizer ic = new org.codehaus.groovy.control.customizers.ImportCustomizer();
+
+        // there's something weird in groovy about doing specific imports instead of wildcard imports. with wildcard
+        // imports groovy seems to allow methods to be overloaded with enums such that things like Column.values and
+        // __.values() can be resolved by the compiler. if they are both directly in the imports then one or the other
+        // can't be found. the temporary fix is to hardcode a wildcard import __ and then filter out the core imports
+        // from the incoming customizer. ultimately, the fix should be to resolve the naming conflicts to ensure a
+        // unique space somehow.
+        ic.addStaticStars(__.class.getCanonicalName());
+        for (ImportCustomizer customizer : customizers) {
+            customizer.getClassImports().forEach(i -> ic.addImports(i.getCanonicalName()));
+            customizer.getMethodImports().stream()
+                    .filter(m -> !m.getDeclaringClass().equals(__.class))
+                    .forEach(m -> ic.addStaticImport(m.getDeclaringClass().getCanonicalName(), m.getName()));
+            customizer.getEnumImports().forEach(m -> ic.addStaticImport(m.getDeclaringClass().getCanonicalName(), m.name()));
+        }
+
+        return ic;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/InterpreterModeGroovyCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/InterpreterModeGroovyCustomizer.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/InterpreterModeGroovyCustomizer.java
new file mode 100644
index 0000000..89b471e
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/InterpreterModeGroovyCustomizer.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import org.apache.tinkerpop.gremlin.groovy.jsr223.ast.InterpreterMode;
+import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
+import org.codehaus.groovy.control.customizers.CompilationCustomizer;
+
+/**
+ * Places the {@code ScriptEngine} in "interpreter mode" where local variables of a script are treated as global
+ * bindings. This implementation is technically not a true {@link GroovyCustomizer} instance as the
+ * "interpreter mode" feature does not require a {@code CompilerCustomizer}. This class merely acts as a flag that
+ * tells the {@link GremlinGroovyScriptEngine} to turn this feature on.
+ */
+class InterpreterModeGroovyCustomizer implements GroovyCustomizer {
+    @Override
+    public CompilationCustomizer create() {
+        return new ASTTransformationCustomizer(InterpreterMode.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ThreadInterruptGroovyCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ThreadInterruptGroovyCustomizer.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ThreadInterruptGroovyCustomizer.java
new file mode 100644
index 0000000..4492c3c
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ThreadInterruptGroovyCustomizer.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import groovy.transform.ThreadInterrupt;
+import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
+import org.codehaus.groovy.control.customizers.CompilationCustomizer;
+
+/**
+ * Injects checks for thread interruption into scripts.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class ThreadInterruptGroovyCustomizer implements GroovyCustomizer {
+    @Override
+    public CompilationCustomizer create() {
+        return new ASTTransformationCustomizer(ThreadInterrupt.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TimedInterruptGroovyCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TimedInterruptGroovyCustomizer.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TimedInterruptGroovyCustomizer.java
new file mode 100644
index 0000000..c432164
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TimedInterruptGroovyCustomizer.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import groovy.transform.TimedInterrupt;
+import org.codehaus.groovy.ast.tools.GeneralUtils;
+import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
+import org.codehaus.groovy.control.customizers.CompilationCustomizer;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Injects a check in loops and other areas of code to interrupt script execution if the run time exceeds the
+ * specified time.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class TimedInterruptGroovyCustomizer implements GroovyCustomizer {
+    private static final long DEFAULT_INTERRUPTION_TIMEOUT = 60000;
+
+    private final long interruptionTimeout;
+
+    TimedInterruptGroovyCustomizer() {
+        this(DEFAULT_INTERRUPTION_TIMEOUT);
+    }
+
+    TimedInterruptGroovyCustomizer(final Long interruptionTimeout) {
+        this.interruptionTimeout = interruptionTimeout;
+    }
+
+    TimedInterruptGroovyCustomizer(final Integer interruptionTimeout) {
+        this.interruptionTimeout = interruptionTimeout.longValue();
+    }
+
+    @Override
+    public CompilationCustomizer create() {
+        final Map<String, Object> timedInterruptAnnotationParams = new HashMap<>();
+        timedInterruptAnnotationParams.put("value", interruptionTimeout);
+        timedInterruptAnnotationParams.put("unit", GeneralUtils.propX(GeneralUtils.classX(TimeUnit.class), TimeUnit.MILLISECONDS.toString()));
+        timedInterruptAnnotationParams.put("checkOnMethodStart", false);
+        timedInterruptAnnotationParams.put("thrown", GeneralUtils.classX(TimedInterruptTimeoutException.class));
+        return new ASTTransformationCustomizer(timedInterruptAnnotationParams, TimedInterrupt.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TimedInterruptTimeoutException.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TimedInterruptTimeoutException.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TimedInterruptTimeoutException.java
new file mode 100644
index 0000000..bdd49b3
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TimedInterruptTimeoutException.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TimedInterruptCustomizerProvider;
+
+import java.util.concurrent.TimeoutException;
+
+/**
+ * An exception thrown from the {@link TimedInterruptCustomizerProvider} when the timeout is exceeded. This exception
+ * allows differentiation from other "timeout exceptions" that might occur.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class TimedInterruptTimeoutException extends TimeoutException {
+    public TimedInterruptTimeoutException() {
+    }
+
+    public TimedInterruptTimeoutException(final String message) {
+        super(message);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TypeCheckedGroovyCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TypeCheckedGroovyCustomizer.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TypeCheckedGroovyCustomizer.java
new file mode 100644
index 0000000..ac8dd1d
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TypeCheckedGroovyCustomizer.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import groovy.transform.TypeChecked;
+import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
+import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
+import org.codehaus.groovy.control.customizers.CompilationCustomizer;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * Injects the {@code TypeChecked} transformer to enable type validation on script execution.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class TypeCheckedGroovyCustomizer implements GroovyCustomizer {
+
+    private final String extensions;
+
+    TypeCheckedGroovyCustomizer() {
+        this(null);
+    }
+
+    /**
+     * Configures the {@code TypeChecked} annotation to use optional extensions.  The argument should be one or more
+     * groovy scripts on the classpath or the fully qualified classname of a precompiled extension.  If there are
+     * multiple extensions then extensions should be comma separated.
+     */
+    TypeCheckedGroovyCustomizer(final String extensions) {
+        this.extensions = extensions;
+    }
+
+    @Override
+    public CompilationCustomizer create() {
+        final Map<String, Object> annotationParams = new HashMap<>();
+        if (extensions != null && !extensions.isEmpty()) {
+            if (extensions.contains(","))
+                annotationParams.put("extensions", Stream.of(extensions.split(",")).collect(Collectors.toList()));
+            else
+                annotationParams.put("extensions", Collections.singletonList(extensions));
+        }
+        return new ASTTransformationCustomizer(annotationParams, TypeChecked.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/CompileStaticCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/CompileStaticCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/CompileStaticCustomizerProvider.java
index ab0bff5..4371e8a 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/CompileStaticCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/CompileStaticCustomizerProvider.java
@@ -34,7 +34,9 @@ import java.util.stream.Stream;
  * Injects the {@code CompileStatic} transformer to enable type validation on script execution.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, not replaced by a public class.
  */
+@Deprecated
 public class CompileStaticCustomizerProvider implements CompilerCustomizerProvider {
 
     private final String extensions;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ConfigurationCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ConfigurationCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ConfigurationCustomizerProvider.java
index 78357cb..3c8b673 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ConfigurationCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ConfigurationCustomizerProvider.java
@@ -35,7 +35,9 @@ import java.util.Map;
  * control over its internals.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, not replaced by a public class.
  */
+@Deprecated
 public class ConfigurationCustomizerProvider implements CompilerCustomizerProvider {
 
     private final Map<String,Object> properties;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/InterpreterModeCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/InterpreterModeCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/InterpreterModeCustomizerProvider.java
index 013ba8b..3044474 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/InterpreterModeCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/InterpreterModeCustomizerProvider.java
@@ -29,7 +29,11 @@ import org.codehaus.groovy.control.customizers.CompilationCustomizer;
  * bindings. This implementation is technically not a true {@link CompilerCustomizerProvider} instance as the
  * "interpreter mode" feature does not require a {@code CompilerCustomizer}. This class merely acts as a flag that
  * tells the {@link org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine} to turn this feature on.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, not replaced by a public class.
  */
+@Deprecated
 public class InterpreterModeCustomizerProvider implements CompilerCustomizerProvider {
     @Override
     public CompilationCustomizer create() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ThreadInterruptCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ThreadInterruptCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ThreadInterruptCustomizerProvider.java
index e46e9b7..c5fc60c 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ThreadInterruptCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ThreadInterruptCustomizerProvider.java
@@ -28,7 +28,9 @@ import org.codehaus.groovy.control.customizers.CompilationCustomizer;
  * Injects checks for thread interruption into scripts.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, not replaced by a public class.
  */
+@Deprecated
 public class ThreadInterruptCustomizerProvider implements CompilerCustomizerProvider {
     @Override
     public CompilationCustomizer create() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptCustomizerProvider.java
index 9913088..f0e1080 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptCustomizerProvider.java
@@ -34,7 +34,9 @@ import java.util.concurrent.TimeUnit;
  * specified time.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, not replaced by a public class.
  */
+@Deprecated
 public class TimedInterruptCustomizerProvider implements CompilerCustomizerProvider {
     public static final long DEFAULT_INTERRUPTION_TIMEOUT = 60000;
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptTimeoutException.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptTimeoutException.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptTimeoutException.java
index 40abd59..4063d4f 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptTimeoutException.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptTimeoutException.java
@@ -23,7 +23,11 @@ import java.util.concurrent.TimeoutException;
 /**
  * An exception thrown from the {@link TimedInterruptCustomizerProvider} when the timeout is exceeded. This exception
  * allows differentiation from other "timeout exceptions" that might occur.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.groovy.jsr223.TimedInterruptTimeoutException}.
  */
+@Deprecated
 public class TimedInterruptTimeoutException extends TimeoutException {
     public TimedInterruptTimeoutException() {
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TypeCheckedCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TypeCheckedCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TypeCheckedCustomizerProvider.java
index cf9147b..b5c2729 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TypeCheckedCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TypeCheckedCustomizerProvider.java
@@ -34,7 +34,9 @@ import java.util.stream.Stream;
  * Injects the {@code TypeChecked} transformer to enable type validation on script execution.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, not replaced by a public class.
  */
+@Deprecated
 public class TypeCheckedCustomizerProvider implements CompilerCustomizerProvider {
 
     private final String extensions;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/VariableIdentificationCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/VariableIdentificationCustomizer.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/VariableIdentificationCustomizer.java
index 79df578..2c216d7 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/VariableIdentificationCustomizer.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/VariableIdentificationCustomizer.java
@@ -35,7 +35,9 @@ import java.util.TreeSet;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, not replaced.
  */
+@Deprecated
 public class VariableIdentificationCustomizer extends CompilationCustomizer {
 
     private static final ThreadLocal<Set<String>> variables = new ThreadLocal<Set<String>>()  {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java
index b62f3f3..6f3383e 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java
@@ -59,8 +59,8 @@ public class GremlinGroovyScriptEngineCompileStaticTest {
             assertEquals(255, scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()"));
         }
 
-        final CompileStaticCustomizerProvider provider = new CompileStaticCustomizerProvider();
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(provider))) {
+        final CompileStaticGroovyCustomizer provider = new CompileStaticGroovyCustomizer();
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(provider)) {
             scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()");
             fail("Should have failed type checking");
         } catch (ScriptException se) {
@@ -92,14 +92,14 @@ public class GremlinGroovyScriptEngineCompileStaticTest {
     @Test
     public void shouldCompileStaticWithExtension() throws Exception {
         // with no type checking extension this should pass
-        final CompileStaticCustomizerProvider providerNoExtension = new CompileStaticCustomizerProvider();
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerNoExtension))) {
+        final CompileStaticGroovyCustomizer providerNoExtension = new CompileStaticGroovyCustomizer();
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension)) {
             assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
         }
 
-        final CompileStaticCustomizerProvider providerWithExtension = new CompileStaticCustomizerProvider(
+        final CompileStaticGroovyCustomizer providerWithExtension = new CompileStaticGroovyCustomizer(
                 PrecompiledExtensions.PreventColorUsageExtension.class.getName());
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerWithExtension))) {
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension)) {
             scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red");
             fail("Should have failed type checking");
         } catch (ScriptException se) {
@@ -140,16 +140,16 @@ public class GremlinGroovyScriptEngineCompileStaticTest {
     @Test
     public void shouldCompileStaticWithMultipleExtension() throws Exception {
         // with no type checking extension this should pass
-        final CompileStaticCustomizerProvider providerNoExtension = new CompileStaticCustomizerProvider();
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerNoExtension))) {
+        final CompileStaticGroovyCustomizer providerNoExtension = new CompileStaticGroovyCustomizer();
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension)) {
             assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
             assertEquals(1l, scriptEngine.eval("def c = new java.util.concurrent.CountDownLatch(1); c.count"));
         }
 
-        final CompileStaticCustomizerProvider providerWithExtension = new CompileStaticCustomizerProvider(
+        final CompileStaticGroovyCustomizer providerWithExtension = new CompileStaticGroovyCustomizer(
                 PrecompiledExtensions.PreventColorUsageExtension.class.getName() +
                         "," + PrecompiledExtensions.PreventCountDownLatchUsageExtension.class.getName());
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerWithExtension))) {
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension)) {
             scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red");
             fail("Should have failed type checking");
         } catch (ScriptException se) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineConfigTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineConfigTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineConfigTest.java
index 6b18ece..289b2ca 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineConfigTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineConfigTest.java
@@ -41,9 +41,8 @@ public class GremlinGroovyScriptEngineConfigTest {
 
     @Test
     public void shouldAddBaseScriptClass() throws Exception {
-        final ScriptEngine engine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(
-                new ConfigurationCustomizerProvider("ScriptBaseClass", BaseScriptForTesting.class.getName())),
-                new CustomizerProviderCustomizer(new DefaultImportCustomizerProvider()));
+        final ScriptEngine engine = new GremlinGroovyScriptEngine(
+                new ConfigurationGroovyCustomizer("ScriptBaseClass", BaseScriptForTesting.class.getName()));
 
         assertEquals("hello, stephen", engine.eval("hello('stephen')"));
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
index 65dc56e..eb0a44b 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
@@ -122,7 +122,7 @@ public class GremlinGroovyScriptEngineTest {
 
     @Test
     public void shouldPromoteDefinedVarsInInterpreterModeWithNoBindings() throws Exception {
-        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(new InterpreterModeCustomizerProvider()));
+        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(new InterpreterModeGroovyCustomizer());
         engine.eval("def addItUp = { x, y -> x + y }");
         assertEquals(3, engine.eval("int xxx = 1 + 2"));
         assertEquals(4, engine.eval("yyy = xxx + 1"));
@@ -168,7 +168,7 @@ public class GremlinGroovyScriptEngineTest {
 
     @Test
     public void shouldPromoteDefinedVarsInInterpreterModeWithBindings() throws Exception {
-        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(new InterpreterModeCustomizerProvider()));
+        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(new InterpreterModeGroovyCustomizer());
         final Bindings b = new SimpleBindings();
         b.put("x", 2);
         engine.eval("def addItUp = { x, y -> x + y }", b);
@@ -354,7 +354,7 @@ public class GremlinGroovyScriptEngineTest {
         final CountDownLatch latch = new CountDownLatch(1);
         final AtomicReference<Color> color = new AtomicReference<>(Color.RED);
 
-        final GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine();
+        final GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(NoImportCustomizerProvider.INSTANCE);
 
         try {
             scriptEngine.eval("Color.BLACK");

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineThreadInterruptTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineThreadInterruptTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineThreadInterruptTest.java
index ea778c6..499373f 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineThreadInterruptTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineThreadInterruptTest.java
@@ -55,7 +55,7 @@ public class GremlinGroovyScriptEngineThreadInterruptTest {
 
     @Test
     public void shouldInterruptWhile() throws Exception {
-        final ScriptEngine engine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(new ThreadInterruptCustomizerProvider()));
+        final ScriptEngine engine = new GremlinGroovyScriptEngine(new ThreadInterruptGroovyCustomizer());
         final AtomicBoolean asserted = new AtomicBoolean(false);
 
         final Thread t = new Thread(() -> {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTimedInterruptTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTimedInterruptTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTimedInterruptTest.java
index fa8d4ef..1745b5d 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTimedInterruptTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTimedInterruptTest.java
@@ -25,7 +25,6 @@ import org.junit.Test;
 
 import javax.script.ScriptEngine;
 import javax.script.ScriptException;
-import java.util.concurrent.TimeoutException;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
@@ -49,14 +48,12 @@ public class GremlinGroovyScriptEngineTimedInterruptTest {
 
     @Test
     public void shouldTimeoutScriptOnTimedWhile() throws Exception {
-        final ScriptEngine engine = new GremlinGroovyScriptEngine(
-                new CustomizerProviderCustomizer(new TimedInterruptCustomizerProvider(1000)),
-                new CustomizerProviderCustomizer(new DefaultImportCustomizerProvider()));
+        final ScriptEngine engine = new GremlinGroovyScriptEngine(new TimedInterruptGroovyCustomizer(1000));
         try {
             engine.eval("s = System.currentTimeMillis();\nwhile((System.currentTimeMillis() - s) < 10000) {}");
             fail("This should have timed out");
         } catch (ScriptException se) {
-            assertEquals(TimedInterruptTimeoutException.class, se.getCause().getCause().getClass());
+            assertEquals(org.apache.tinkerpop.gremlin.groovy.jsr223.TimedInterruptTimeoutException.class, se.getCause().getCause().getClass());
         }
     }
 
@@ -78,15 +75,13 @@ public class GremlinGroovyScriptEngineTimedInterruptTest {
 
     @Test
     public void shouldTimeoutScriptOnTimedWhileOnceEngineHasBeenAliveForLongerThanTimeout() throws Exception {
-        final ScriptEngine engine = new GremlinGroovyScriptEngine(
-                new CustomizerProviderCustomizer(new TimedInterruptCustomizerProvider(1000)),
-                new CustomizerProviderCustomizer(new DefaultImportCustomizerProvider()));
+        final ScriptEngine engine = new GremlinGroovyScriptEngine(new TimedInterruptGroovyCustomizer(1000));
         Thread.sleep(2000);
         try {
             engine.eval("s = System.currentTimeMillis();\nwhile((System.currentTimeMillis() - s) < 10000) {}");
             fail("This should have timed out");
         } catch (ScriptException se) {
-            assertEquals(TimedInterruptTimeoutException.class, se.getCause().getCause().getClass());
+            assertEquals(org.apache.tinkerpop.gremlin.groovy.jsr223.TimedInterruptTimeoutException.class, se.getCause().getCause().getClass());
         }
 
         assertEquals(2, engine.eval("1+1"));
@@ -116,8 +111,7 @@ public class GremlinGroovyScriptEngineTimedInterruptTest {
     @Test
     public void shouldContinueToEvalScriptsEvenWithTimedInterrupt() throws Exception {
         final ScriptEngine engine = new GremlinGroovyScriptEngine(
-                new CustomizerProviderCustomizer(new TimedInterruptCustomizerProvider(1000)),
-                new CustomizerProviderCustomizer(new DefaultImportCustomizerProvider()));
+                new TimedInterruptGroovyCustomizer(1000));
 
         for (int ix = 0; ix < 5; ix++) {
             try {
@@ -125,7 +119,7 @@ public class GremlinGroovyScriptEngineTimedInterruptTest {
                 engine.eval("s = System.currentTimeMillis();\nwhile((System.currentTimeMillis() - s) < 2000) {}");
                 fail("This should have timed out");
             } catch (ScriptException se) {
-                assertEquals(TimedInterruptTimeoutException.class, se.getCause().getCause().getClass());
+                assertEquals(org.apache.tinkerpop.gremlin.groovy.jsr223.TimedInterruptTimeoutException.class, se.getCause().getCause().getClass());
             }
 
             // this script takes 500 ms less than the interruptionTimeout
@@ -148,9 +142,7 @@ public class GremlinGroovyScriptEngineTimedInterruptTest {
     @Test
     public void shouldNotTimeoutStandaloneFunction() throws Exception {
         // use a super fast timeout which should not prevent the call of a cached function
-        final ScriptEngine engine = new GremlinGroovyScriptEngine(
-                new CustomizerProviderCustomizer(new TimedInterruptCustomizerProvider(1)),
-                new CustomizerProviderCustomizer(new DefaultImportCustomizerProvider()));
+        final ScriptEngine engine = new GremlinGroovyScriptEngine(new TimedInterruptGroovyCustomizer(1));
         engine.eval("def addItUp(x,y) { x + y }");
 
         assertEquals(3, engine.eval("addItUp(1,2)"));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java
index 0ca12d7..6c70e8e 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java
@@ -60,8 +60,8 @@ public class GremlinGroovyScriptEngineTypeCheckedTest {
             assertEquals(255, scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()"));
         }
 
-        final TypeCheckedCustomizerProvider provider = new TypeCheckedCustomizerProvider();
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(provider))) {
+        final TypeCheckedGroovyCustomizer provider = new TypeCheckedGroovyCustomizer();
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(provider)) {
             scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()");
             fail("Should have failed type checking");
         } catch (ScriptException se) {
@@ -93,14 +93,14 @@ public class GremlinGroovyScriptEngineTypeCheckedTest {
     @Test
     public void shouldTypeCheckWithExtension() throws Exception {
         // with no type checking extension this should pass
-        final TypeCheckedCustomizerProvider providerNoExtension = new TypeCheckedCustomizerProvider();
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerNoExtension))) {
+        final TypeCheckedGroovyCustomizer providerNoExtension = new TypeCheckedGroovyCustomizer();
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension)) {
             assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
         }
 
         final CompileStaticCustomizerProvider providerWithExtension = new CompileStaticCustomizerProvider(
                 PrecompiledExtensions.PreventColorUsageExtension.class.getName());
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerWithExtension))) {
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension)) {
             scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red");
             fail("Should have failed type checking");
         } catch (ScriptException se) {
@@ -141,16 +141,16 @@ public class GremlinGroovyScriptEngineTypeCheckedTest {
     @Test
     public void shouldTypeCheckWithMultipleExtension() throws Exception {
         // with no type checking extension this should pass
-        final TypeCheckedCustomizerProvider providerNoExtension = new TypeCheckedCustomizerProvider();
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerNoExtension))) {
+        final TypeCheckedGroovyCustomizer providerNoExtension = new TypeCheckedGroovyCustomizer();
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension)) {
             assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
             assertEquals(1l, scriptEngine.eval("def c = new java.util.concurrent.CountDownLatch(1); c.count"));
         }
 
-        final TypeCheckedCustomizerProvider providerWithExtension = new TypeCheckedCustomizerProvider(
+        final TypeCheckedGroovyCustomizer providerWithExtension = new TypeCheckedGroovyCustomizer(
                 PrecompiledExtensions.PreventColorUsageExtension.class.getName() +
                         "," + PrecompiledExtensions.PreventCountDownLatchUsageExtension.class.getName());
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(new CustomizerProviderCustomizer(providerWithExtension))) {
+        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension)) {
             scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red");
             fail("Should have failed type checking");
         } catch (ScriptException se) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPluginTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPluginTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPluginTest.java
index 8d2178f..f795fa7 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPluginTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPluginTest.java
@@ -58,7 +58,7 @@ public class GroovyCompilerGremlinPluginTest {
         final Optional<Customizer[]> customizers = plugin.getCustomizers("gremlin-groovy");
         assertThat(customizers.isPresent(), is(true));
         assertEquals(1, customizers.get().length);
-        assertThat(((CustomizerProviderCustomizer) customizers.get()[0]).getCustomizerProvider(), instanceOf(CompileStaticCustomizerProvider.class));
+        assertThat(customizers.get()[0], instanceOf(CompileStaticGroovyCustomizer.class));
     }
 
     @Test
@@ -68,7 +68,7 @@ public class GroovyCompilerGremlinPluginTest {
         final Optional<Customizer[]> customizers = plugin.getCustomizers("gremlin-groovy");
         assertThat(customizers.isPresent(), is(true));
         assertEquals(1, customizers.get().length);
-        assertThat(((CustomizerProviderCustomizer) customizers.get()[0]).getCustomizerProvider(), instanceOf(TypeCheckedCustomizerProvider.class));
+        assertThat(customizers.get()[0], instanceOf(TypeCheckedGroovyCustomizer.class));
     }
 
     @Test
@@ -80,12 +80,12 @@ public class GroovyCompilerGremlinPluginTest {
         final Optional<Customizer[]> customizers = plugin.getCustomizers("gremlin-groovy");
         assertThat(customizers.isPresent(), is(true));
         assertEquals(1, customizers.get().length);
-        assertThat(((CustomizerProviderCustomizer) customizers.get()[0]).getCustomizerProvider(), instanceOf(ConfigurationCustomizerProvider.class));
+        assertThat(customizers.get()[0], instanceOf(ConfigurationGroovyCustomizer.class));
 
         final CompilerConfiguration compilerConfiguration = new CompilerConfiguration();
         assertThat(compilerConfiguration.getDebug(), is(false));
 
-        final ConfigurationCustomizerProvider provider = (ConfigurationCustomizerProvider) ((CustomizerProviderCustomizer) customizers.get()[0]).getCustomizerProvider();
+        final ConfigurationGroovyCustomizer provider = (ConfigurationGroovyCustomizer) customizers.get()[0];
         provider.applyCustomization(compilerConfiguration);
 
         assertThat(compilerConfiguration.getDebug(), is(true));
@@ -98,7 +98,7 @@ public class GroovyCompilerGremlinPluginTest {
         final Optional<Customizer[]> customizers = plugin.getCustomizers("gremlin-groovy");
         assertThat(customizers.isPresent(), is(true));
         assertEquals(1, customizers.get().length);
-        assertThat(((CustomizerProviderCustomizer) customizers.get()[0]).getCustomizerProvider(), instanceOf(InterpreterModeCustomizerProvider.class));
+        assertThat(customizers.get()[0], instanceOf(InterpreterModeGroovyCustomizer.class));
     }
 
     @Test
@@ -108,7 +108,7 @@ public class GroovyCompilerGremlinPluginTest {
         final Optional<Customizer[]> customizers = plugin.getCustomizers("gremlin-groovy");
         assertThat(customizers.isPresent(), is(true));
         assertEquals(1, customizers.get().length);
-        assertThat(((CustomizerProviderCustomizer) customizers.get()[0]).getCustomizerProvider(), instanceOf(ThreadInterruptCustomizerProvider.class));
+        assertThat(customizers.get()[0], instanceOf(ThreadInterruptGroovyCustomizer.class));
     }
 
     @Test
@@ -118,7 +118,7 @@ public class GroovyCompilerGremlinPluginTest {
         final Optional<Customizer[]> customizers = plugin.getCustomizers("gremlin-groovy");
         assertThat(customizers.isPresent(), is(true));
         assertEquals(1, customizers.get().length);
-        assertThat(((CustomizerProviderCustomizer) customizers.get()[0]).getCustomizerProvider(), instanceOf(TimedInterruptCustomizerProvider.class));
+        assertThat(customizers.get()[0], instanceOf(TimedInterruptGroovyCustomizer.class));
     }
 
     @Test(expected = IllegalStateException.class)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
index b931b8c..d5fe62a 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
@@ -279,6 +279,11 @@ public abstract class AbstractEvalOpProcessor extends AbstractOpProcessor {
                     final String errorMessage = String.format("A timeout occurred within the script during evaluation of [%s] - consider increasing the limit given to TimedInterruptCustomizerProvider", msg);
                     logger.warn(errorMessage);
                     ctx.writeAndFlush(ResponseMessage.build(msg).code(ResponseStatusCode.SERVER_ERROR_TIMEOUT).statusMessage("Timeout during script evaluation triggered by TimedInterruptCustomizerProvider").create());
+                } else if (t instanceof org.apache.tinkerpop.gremlin.groovy.jsr223.TimedInterruptTimeoutException) {
+                    // occurs when the TimedInterruptCustomizerProvider is in play
+                    final String errorMessage = String.format("A timeout occurred within the script during evaluation of [%s] - consider increasing the limit given to TimedInterruptCustomizerProvider", msg);
+                    logger.warn(errorMessage);
+                    ctx.writeAndFlush(ResponseMessage.build(msg).code(ResponseStatusCode.SERVER_ERROR_TIMEOUT).statusMessage("Timeout during script evaluation triggered by TimedInterruptCustomizerProvider").create());
                 } else if (t instanceof TimeoutException) {
                     final String errorMessage = String.format("Response evaluation exceeded the configured threshold for request [%s] - %s", msg, t.getMessage());
                     logger.warn(errorMessage, t);


[32/50] tinkerpop git commit: TINKERPOP-1562 Get customizers for both python and jython.

Posted by sp...@apache.org.
TINKERPOP-1562 Get customizers for both python and jython.

The customizers are combined to a set and therefore should only apply once. Presumably there wouldn't be a different set of customizers for one versus the other. If there were and you wanted them separate I guess you'd have to build two separate script engine instances.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/9f33bee4
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9f33bee4
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9f33bee4

Branch: refs/heads/TINKERPOP-1562
Commit: 9f33bee4d75ee359c6687d4b777bb687a459925f
Parents: 05ff0c0
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Sat Nov 26 07:37:28 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:49 2016 -0500

----------------------------------------------------------------------
 .../python/jsr223/GremlinJythonScriptEngineFactory.java  |  6 +++++-
 .../gremlin/jsr223/GremlinEnabledScriptEngineTest.java   | 11 +++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9f33bee4/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java
index 696c2ea..34978a7 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java
@@ -29,7 +29,9 @@ import org.python.jsr223.PyScriptEngineFactory;
 import javax.script.ScriptEngine;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -101,7 +103,9 @@ public class GremlinJythonScriptEngineFactory extends PyScriptEngineFactory impl
 
     @Override
     public GremlinScriptEngine getScriptEngine() {
-        final List<Customizer> customizers =  manager.getCustomizers(GREMLIN_JYTHON);
+        final Set<Customizer> customizers = new HashSet<>(manager.getCustomizers(GREMLIN_JYTHON));
+        customizers.addAll(manager.getCustomizers(GREMLIN_PYTHON));
+
         return (customizers.isEmpty()) ? new GremlinJythonScriptEngine() :
                 new GremlinJythonScriptEngine(customizers.toArray(new Customizer[customizers.size()]));
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9f33bee4/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
index f6bbcb8..8fa70b0 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
@@ -25,6 +25,7 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.junit.Test;
 
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 
@@ -79,4 +80,14 @@ public class GremlinEnabledScriptEngineTest {
             assertEquals(clazz, scriptEngine.eval(clazz.getSimpleName()));
         }
     }
+
+    @Test
+    public void shouldReturnOneCustomizers() {
+        // just returns the core plugin as the other assigned plugin doesn't match the tested engine
+        final GremlinScriptEngineManager mgr = new DefaultGremlinScriptEngineManager();
+        mgr.addPlugin(ImportGremlinPlugin.build()
+                .classImports(java.awt.Color.class)
+                .appliesTo(Collections.singletonList("fake-script-engine")).create());
+        assertEquals(1, mgr.getCustomizers(ENGINE_TO_TEST).size());
+    }
 }


[22/50] tinkerpop git commit: TINKERPOP-1562 Added new plugins for gremlin-groovy to replace deprecated ones.

Posted by sp...@apache.org.
TINKERPOP-1562 Added new plugins for gremlin-groovy to replace deprecated ones.

Specifically did SugarGremlinPlugin and CredentialsGrpahGremlinPlugin.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/bb5b47dd
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/bb5b47dd
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/bb5b47dd

Branch: refs/heads/TINKERPOP-1562
Commit: bb5b47dd98aa936673b1588202dbcc378a83b718
Parents: d0c941e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 22 14:20:11 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../jsr223/ScriptEnginePluginAcceptor.java      |  2 +
 .../groovy/jsr223/SugarGremlinPlugin.java       | 45 ++++++++++++++++
 .../groovy/plugin/SugarGremlinPlugin.java       |  2 +
 .../CredentialGraphGremlinPlugin.java           |  2 +
 .../jsr223/CredentialGraphGremlinPlugin.java    | 55 ++++++++++++++++++++
 ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin |  2 +
 6 files changed, 108 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptEnginePluginAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptEnginePluginAcceptor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptEnginePluginAcceptor.java
index 0bd51c2..5832e0b 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptEnginePluginAcceptor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptEnginePluginAcceptor.java
@@ -34,7 +34,9 @@ import java.util.Set;
  * interact with them on initialization.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, not replaced.
  */
+@Deprecated
 public class ScriptEnginePluginAcceptor implements PluginAcceptor {
     private final ScriptEngine scriptEngine;
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java
new file mode 100644
index 0000000..95c610f
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import org.apache.tinkerpop.gremlin.groovy.loaders.SugarLoader;
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultScriptCustomizer;
+
+import java.util.Collections;
+
+/**
+ * A plugin implementation which allows for the usage of Gremlin Groovy's syntactic sugar.
+ *
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class SugarGremlinPlugin extends AbstractGremlinPlugin {
+
+    private static final String NAME = "tinkerpop.sugar";
+
+    public SugarGremlinPlugin() {
+        super(NAME, new DefaultScriptCustomizer(Collections.singletonList(
+                Collections.singletonList(SugarLoader.class.getPackage().getName() + "." + SugarLoader.class.getSimpleName() + ".load()"))));
+    }
+
+    @Override
+    public String getName() {
+        return "tinkerpop.sugar";
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/SugarGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/SugarGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/SugarGremlinPlugin.java
index 845ffc6..0666d71 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/SugarGremlinPlugin.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/SugarGremlinPlugin.java
@@ -24,7 +24,9 @@ import org.apache.tinkerpop.gremlin.groovy.loaders.SugarLoader;
  * A plugin implementation which allows for the usage of Gremlin Groovy's syntactic sugar.
  *
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.groovy.jsr223.SugarGremlinPlugin}.
  */
+@Deprecated
 public class SugarGremlinPlugin extends AbstractGremlinPlugin {
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphGremlinPlugin.java
index 8550615..72ca1d5 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphGremlinPlugin.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphGremlinPlugin.java
@@ -30,7 +30,9 @@ import java.util.Set;
  * Plugin for the "credentials graph".  This plugin imports the {@link CredentialGraph} to its environment.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.groovy.plugin.dsl.credential.CredentialGraphGremlinPlugin}.
  */
+@Deprecated
 public class CredentialGraphGremlinPlugin extends AbstractGremlinPlugin {
 
     private static final Set<String> IMPORTS = new HashSet<String>() {{

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/jsr223/CredentialGraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/jsr223/CredentialGraphGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/jsr223/CredentialGraphGremlinPlugin.java
new file mode 100644
index 0000000..761567b
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/jsr223/CredentialGraphGremlinPlugin.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.plugin.dsl.credential.jsr223;
+
+import org.apache.tinkerpop.gremlin.groovy.plugin.dsl.credential.CredentialGraph;
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Plugin for the "credentials graph".  This plugin imports the {@link CredentialGraph} to its environment.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class CredentialGraphGremlinPlugin extends AbstractGremlinPlugin {
+
+    private static final String NAME = "tinkerpop.credentials";
+
+    private static final ImportCustomizer imports;
+
+    static {
+        try {
+            imports = DefaultImportCustomizer.build()
+                    .addClassImports(CredentialGraph.class)
+                    .addMethodImports(CredentialGraph.class.getMethod("credentials", Graph.class))
+                    .create();
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    public CredentialGraphGremlinPlugin() {
+        super(NAME, imports);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/gremlin-groovy/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin b/gremlin-groovy/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
new file mode 100644
index 0000000..0004a80
--- /dev/null
+++ b/gremlin-groovy/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
@@ -0,0 +1,2 @@
+org.apache.tinkerpop.gremlin.groovy.jsr223.SugarGremlinPlugin
+org.apache.tinkerpop.gremlin.groovy.plugin.dsl.credential.jsr223.CredentialGraphGremlinPlugin
\ No newline at end of file


[39/50] tinkerpop git commit: TINKERPOP-1562 Use List of files to preserve order in script customzier

Posted by sp...@apache.org.
TINKERPOP-1562 Use List of files to preserve order in script customzier


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/2d49710b
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2d49710b
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2d49710b

Branch: refs/heads/TINKERPOP-1562
Commit: 2d49710b2f7a45453aa1165074440e704a007044
Parents: 8dc9b1f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 29 16:29:10 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:50 2016 -0500

----------------------------------------------------------------------
 .../tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java       | 3 +--
 .../tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java       | 4 +++-
 .../tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java   | 5 ++---
 3 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d49710b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java
index 9640f28..c996cae 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java
@@ -24,7 +24,6 @@ import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.util.Collection;
 import java.util.List;
-import java.util.Set;
 import java.util.stream.Collectors;
 
 /**
@@ -37,7 +36,7 @@ public class DefaultScriptCustomizer implements ScriptCustomizer {
 
     private final Collection<List<String>> scripts;
 
-    public DefaultScriptCustomizer(final Set<File> files) {
+    public DefaultScriptCustomizer(final List<File> files) {
         this(files.stream().map(f -> {
             try {
                 return Files.lines(f.toPath(), StandardCharsets.UTF_8).collect(Collectors.toList());

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d49710b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
index 757001c..93ad9d8 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
@@ -20,8 +20,10 @@ package org.apache.tinkerpop.gremlin.jsr223;
 
 import java.io.File;
 import java.io.FileNotFoundException;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -44,7 +46,7 @@ public final class ScriptFileGremlinPlugin extends AbstractGremlinPlugin {
     public static final class Builder {
 
         private final Set<String> appliesTo = new HashSet<>();
-        private Set<File> files = new HashSet<>();
+        private List<File> files = new ArrayList<>();
 
         private Builder() {}
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d49710b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java
index 3e4da13..07ab770 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java
@@ -23,10 +23,9 @@ import org.junit.Test;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 import static org.junit.Assert.assertEquals;
 
@@ -39,7 +38,7 @@ public class DefaultScriptCustomizerTest {
     public void shouldOpenViaPropertiesFileConfig() throws IOException {
         final File scriptFile1 = TestHelper.generateTempFileFromResource(DefaultScriptCustomizerTest.class, "script-customizer-1.groovy", ".groovy");
         final File scriptFile2 = TestHelper.generateTempFileFromResource(DefaultScriptCustomizerTest.class, "script-customizer-2.groovy", ".groovy");
-        final Set<File> files = new HashSet<>();
+        final List<File> files = new ArrayList<>();
         files.add(scriptFile1);
         files.add(scriptFile2);
         final ScriptCustomizer scripts = new DefaultScriptCustomizer(files);


[30/50] tinkerpop git commit: TINKERPOP-1562 Change ScriptCustomizer to an interface.

Posted by sp...@apache.org.
TINKERPOP-1562 Change ScriptCustomizer to an interface.

This class had been added as part of this branch so recasting it as an interface is non-breaking. Get PluggedIn to process the ScriptCustomizer.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/e9e5cfec
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/e9e5cfec
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/e9e5cfec

Branch: refs/heads/TINKERPOP-1562
Commit: e9e5cfec66bca5f8beb671625f7fe2fff0038907
Parents: 2537d5b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 22 06:49:14 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../gremlin/console/plugin/PluggedIn.groovy     |  7 ++-
 .../gremlin/jsr223/DefaultScriptCustomizer.java | 57 ++++++++++++++++++++
 .../gremlin/jsr223/ScriptCustomizer.java        | 36 +++----------
 .../gremlin/jsr223/ScriptFileGremlinPlugin.java |  2 +-
 4 files changed, 70 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e9e5cfec/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
index 053a072..54659fa 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
@@ -24,7 +24,8 @@ import org.apache.tinkerpop.gremlin.groovy.plugin.PluginAcceptor
 import org.apache.tinkerpop.gremlin.groovy.plugin.PluginInitializationException
 import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteAcceptor
 import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException
-import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer
+import org.apache.tinkerpop.gremlin.jsr223.ScriptCustomizer
 import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer
 import org.codehaus.groovy.tools.shell.Groovysh
 import org.codehaus.groovy.tools.shell.IO
@@ -33,6 +34,7 @@ import org.codehaus.groovy.tools.shell.IO
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 class PluggedIn {
+    private static final String LINE_SEPARATOR = System.getProperty("line.separator")
     private final GremlinPlugin plugin
     private boolean activated = false
 
@@ -77,7 +79,6 @@ class PluggedIn {
 
         @Override
         void pluginTo(final PluginAcceptor pluginAcceptor) throws IllegalEnvironmentException, PluginInitializationException {
-            // TODO: handle script customizer
             corePlugin.getCustomizers("gremlin-groovy").each {
                 if (it instanceof ImportCustomizer) {
                     def imports = [] as Set
@@ -85,6 +86,8 @@ class PluggedIn {
                     it.methodImports.each { imports.add("import static " + it.declaringClass.canonicalName + "." + it.name) }
                     it.enumImports.each { imports.add("import static " + it.declaringClass.canonicalName + "." + it.name()) }
                     pluginAcceptor.addImports(imports)
+                } else if (it instanceof ScriptCustomizer) {
+                    it.getScripts().collect { it.join(LINE_SEPARATOR) }.each { pluginAcceptor.eval(it) }
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e9e5cfec/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java
new file mode 100644
index 0000000..9640f28
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * Default implementation of the {@link ScriptCustomizer} that can create the script list from a list of files or
+ * from lines of script.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DefaultScriptCustomizer implements ScriptCustomizer {
+
+    private final Collection<List<String>> scripts;
+
+    public DefaultScriptCustomizer(final Set<File> files) {
+        this(files.stream().map(f -> {
+            try {
+                return Files.lines(f.toPath(), StandardCharsets.UTF_8).collect(Collectors.toList());
+            } catch (IOException ioe) {
+                throw new IllegalStateException(ioe);
+            }
+        }).collect(Collectors.toList()));
+    }
+
+    public DefaultScriptCustomizer(final Collection<List<String>> scripts) {
+        this.scripts = scripts;
+    }
+
+    public Collection<List<String>> getScripts() {
+        return scripts;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e9e5cfec/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptCustomizer.java
index 28603df..eb2f8bc 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptCustomizer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptCustomizer.java
@@ -18,39 +18,17 @@
  */
 package org.apache.tinkerpop.gremlin.jsr223;
 
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 /**
+ * A {@link Customizer} that executes scripts in a {@link GremlinScriptEngine} instance for purpose of initialization.
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public class ScriptCustomizer implements Customizer {
-
-    private final Collection<List<String>> scripts;
-
-    public ScriptCustomizer(final Set<File> files) {
-        this(files.stream().map(f -> {
-            try {
-                return Files.lines(f.toPath(), StandardCharsets.UTF_8).collect(Collectors.toList());
-            } catch (IOException ioe) {
-                throw new IllegalStateException(ioe);
-            }
-        }).collect(Collectors.toList()));
-    }
-
-    public ScriptCustomizer(final Collection<List<String>> scripts) {
-        this.scripts = scripts;
-    }
-
-    public Collection<List<String>> scripts() {
-        return scripts;
-    }
+public interface ScriptCustomizer extends Customizer {
+    /**
+     * Gets a collection of scripts where each is represented as a list of script lines.
+     */
+    public Collection<List<String>> getScripts();
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e9e5cfec/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
index 30e66ed..3fd811a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
@@ -31,7 +31,7 @@ public final class ScriptFileGremlinPlugin extends AbstractGremlinPlugin {
     private static final String MODULE_NAME = "tinkerpop.script";
 
     public ScriptFileGremlinPlugin(final Builder builder) {
-        super(MODULE_NAME, builder.appliesTo, new ScriptCustomizer(builder.files));
+        super(MODULE_NAME, builder.appliesTo, new DefaultScriptCustomizer(builder.files));
     }
 
     public static Builder build() {


[20/50] tinkerpop git commit: TINKERPOP-1562 ImportCustomizer has become an interface

Posted by sp...@apache.org.
TINKERPOP-1562 ImportCustomizer has become an interface

This is a breaking change unfortunately, but this was not a feature that was published or used in 3.2.3 so I don't expect wide usage.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/2537d5bb
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2537d5bb
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2537d5bb

Branch: refs/heads/TINKERPOP-1562
Commit: 2537d5bbd686f77449bb9d64148fecf2ad9d0d3a
Parents: 1a7a3b3
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 22 06:33:22 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../giraph/jsr223/GiraphGremlinPlugin.java      |   4 +-
 .../gremlin/console/plugin/PluggedIn.groovy     |   3 +-
 .../gremlin/jsr223/CoreGremlinModule.java       |   2 +-
 .../gremlin/jsr223/CoreGremlinPlugin.java       |   2 +-
 .../gremlin/jsr223/DefaultImportCustomizer.java | 112 +++++++++++++++++++
 .../gremlin/jsr223/ImportCustomizer.java        |  85 +-------------
 .../gremlin/jsr223/ImportGremlinPlugin.java     |   2 +-
 .../gremlin/jsr223/ImportGremlinPluginTest.java |  12 +-
 ...aultDefaultImportCustomizerProviderTest.java |  90 +++++++++++++++
 .../DefaultImportCustomizerProviderTest.java    |  90 ---------------
 .../jsr223/GremlinServerGremlinPlugin.java      |   4 +-
 .../jsr223/GremlinEnabledScriptEngineTest.java  |   3 +-
 12 files changed, 221 insertions(+), 188 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java
index a96ac86..ee49ed5 100644
--- a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java
+++ b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java
@@ -29,7 +29,7 @@ import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphWorkerContext;
 import org.apache.tinkerpop.gremlin.giraph.process.computer.MemoryAggregator;
 import org.apache.tinkerpop.gremlin.giraph.process.computer.PassThroughMemory;
 import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
@@ -39,7 +39,7 @@ public final class GiraphGremlinPlugin extends AbstractGremlinPlugin {
     private static final GiraphGremlinPlugin instance = new GiraphGremlinPlugin();
 
     private GiraphGremlinPlugin() {
-        super(MODULE_NAME, ImportCustomizer.build().addClassImports(
+        super(MODULE_NAME, DefaultImportCustomizer.build().addClassImports(
                 EmptyOutEdges.class,
                 GiraphComputation.class,
                 GiraphGraphComputer.class,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
index def49ed..053a072 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
@@ -24,8 +24,7 @@ import org.apache.tinkerpop.gremlin.groovy.plugin.PluginAcceptor
 import org.apache.tinkerpop.gremlin.groovy.plugin.PluginInitializationException
 import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteAcceptor
 import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer
-import org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer
 import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer
 import org.codehaus.groovy.tools.shell.Groovysh
 import org.codehaus.groovy.tools.shell.IO

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
index 6869064..d398f89 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
@@ -33,7 +33,7 @@ public final class CoreGremlinModule implements GremlinModule {
 
     private static final String MODULE_NAME = "tinkerpop.core";
 
-    private static final ImportCustomizer gremlinCore = ImportCustomizer.build()
+    private static final ImportCustomizer gremlinCore = DefaultImportCustomizer.build()
             .addClassImports(CoreImports.getClassImports())
             .addEnumImports(CoreImports.getEnumImports())
             .addMethodImports(CoreImports.getMethodImports()).create();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
index 3f5ac2c..410b222 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
@@ -31,7 +31,7 @@ public final class CoreGremlinPlugin implements GremlinPlugin {
 
     private static final String MODULE_NAME = "tinkerpop.core";
 
-    private static final ImportCustomizer gremlinCore = ImportCustomizer.build()
+    private static final ImportCustomizer gremlinCore = DefaultImportCustomizer.build()
             .addClassImports(CoreImports.getClassImports())
             .addEnumImports(CoreImports.getEnumImports())
             .addMethodImports(CoreImports.getMethodImports()).create();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
new file mode 100644
index 0000000..85d6531
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import org.apache.tinkerpop.gremlin.util.CoreImports;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Simple implementation of the {@link ImportCustomizer} which allows direct setting of all the different import types.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DefaultImportCustomizer implements ImportCustomizer {
+    /**
+     * @deprecated As of release 3.2.4, not replaced.
+     */
+    @Deprecated
+    public static final ImportCustomizer GREMLIN_CORE = DefaultImportCustomizer.build()
+            .addClassImports(CoreImports.getClassImports())
+            .addEnumImports(CoreImports.getEnumImports())
+            .addMethodImports(CoreImports.getMethodImports()).create();
+
+    private final Set<Class> classImports;
+    private final Set<Method> methodImports;
+    private final Set<Enum> enumImports;
+
+    private DefaultImportCustomizer(final Builder builder) {
+        classImports = builder.classImports;
+        methodImports = builder.methodImports;
+        enumImports = builder.enumImports;
+    }
+
+    public Set<Class> getClassImports() {
+        return Collections.unmodifiableSet(classImports);
+    }
+
+    public Set<Method> getMethodImports() {
+        return Collections.unmodifiableSet(methodImports);
+    }
+
+    public Set<Enum> getEnumImports() {
+        return Collections.unmodifiableSet(enumImports);
+    }
+
+    public static Builder build() {
+        return new Builder();
+    }
+
+    public static class Builder {
+        private Set<Class> classImports = new HashSet<>();
+        private Set<Method> methodImports = new HashSet<>();
+        private Set<Enum> enumImports = new HashSet<>();
+
+        private Builder() {}
+
+        public Builder addClassImports(final Class... clazz) {
+            classImports.addAll(Arrays.asList(clazz));
+            return this;
+        }
+
+        public Builder addClassImports(final Collection<Class> classes) {
+            classImports.addAll(classes);
+            return this;
+        }
+
+        public Builder addMethodImports(final Method... method) {
+            methodImports.addAll(Arrays.asList(method));
+            return this;
+        }
+
+        public Builder addMethodImports(final Collection<Method> methods) {
+            methodImports.addAll(methods);
+            return this;
+        }
+
+        public Builder addEnumImports(final Enum... e) {
+            enumImports.addAll(Arrays.asList(e));
+            return this;
+        }
+
+        public Builder addEnumImports(final Collection<Enum> enums) {
+            enumImports.addAll(enums);
+            return this;
+        }
+
+        public DefaultImportCustomizer create() {
+            return new DefaultImportCustomizer(this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
index 2f0e08c..7eced82 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
@@ -18,13 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.jsr223;
 
-import org.apache.tinkerpop.gremlin.util.CoreImports;
-
 import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
 import java.util.Set;
 
 /**
@@ -32,82 +26,11 @@ import java.util.Set;
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public class ImportCustomizer implements Customizer {
-
-    /**
-     * @deprecated As of release 3.2.4, not replaced.
-     */
-    @Deprecated
-    public static final ImportCustomizer GREMLIN_CORE = ImportCustomizer.build()
-            .addClassImports(CoreImports.getClassImports())
-            .addEnumImports(CoreImports.getEnumImports())
-            .addMethodImports(CoreImports.getMethodImports()).create();
-
-    private final Set<Class> classImports;
-    private final Set<Method> methodImports;
-    private final Set<Enum> enumImports;
-
-    private ImportCustomizer(final Builder builder) {
-        classImports = builder.classImports;
-        methodImports = builder.methodImports;
-        enumImports = builder.enumImports;
-    }
-
-    public Set<Class> getClassImports() {
-        return Collections.unmodifiableSet(classImports);
-    }
-
-    public Set<Method> getMethodImports() {
-        return Collections.unmodifiableSet(methodImports);
-    }
-
-    public Set<Enum> getEnumImports() {
-        return Collections.unmodifiableSet(enumImports);
-    }
-
-    public static Builder build() {
-        return new Builder();
-    }
-
-    public static class Builder {
-        private Set<Class> classImports = new HashSet<>();
-        private Set<Method> methodImports = new HashSet<>();
-        private Set<Enum> enumImports = new HashSet<>();
-
-        private Builder() {}
-
-        public Builder addClassImports(final Class... clazz) {
-            classImports.addAll(Arrays.asList(clazz));
-            return this;
-        }
-
-        public Builder addClassImports(final Collection<Class> classes) {
-            classImports.addAll(classes);
-            return this;
-        }
-
-        public Builder addMethodImports(final Method... method) {
-            methodImports.addAll(Arrays.asList(method));
-            return this;
-        }
-
-        public Builder addMethodImports(final Collection<Method> methods) {
-            methodImports.addAll(methods);
-            return this;
-        }
+public interface ImportCustomizer extends Customizer {
 
-        public Builder addEnumImports(final Enum... e) {
-            enumImports.addAll(Arrays.asList(e));
-            return this;
-        }
+    public Set<Class> getClassImports();
 
-        public Builder addEnumImports(final Collection<Enum> enums) {
-            enumImports.addAll(enums);
-            return this;
-        }
+    public Set<Method> getMethodImports();
 
-        public ImportCustomizer create() {
-            return new ImportCustomizer(this);
-        }
-    }
+    public Set<Enum> getEnumImports();
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
index f99ee68..a5ac278 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
@@ -40,7 +40,7 @@ public final class ImportGremlinPlugin extends AbstractGremlinPlugin {
     private static final String MODULE_NAME = "tinkerpop.import";
 
     private ImportGremlinPlugin(final Builder builder) {
-        super(MODULE_NAME, builder.appliesTo, ImportCustomizer.build()
+        super(MODULE_NAME, builder.appliesTo, DefaultImportCustomizer.build()
                                                 .addClassImports(builder.classImports)
                                                 .addEnumImports(builder.enumImports)
                                                 .addMethodImports(builder.methodImports).create());

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPluginTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPluginTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPluginTest.java
index 428fc57..59c64df 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPluginTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPluginTest.java
@@ -49,7 +49,7 @@ public class ImportGremlinPluginTest {
         final ImportGremlinPlugin module = ImportGremlinPlugin.build()
                 .classImports(Collections.singletonList(Graph.class.getCanonicalName())).create();
 
-        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        final DefaultImportCustomizer customizer = (DefaultImportCustomizer) module.getCustomizers().get()[0];
         assertEquals(1, module.getCustomizers().get().length);
         assertThat(customizer.getClassImports(), hasItems(Graph.class));
         assertEquals(1, customizer.getClassImports().size());
@@ -61,7 +61,7 @@ public class ImportGremlinPluginTest {
         final ImportGremlinPlugin module = ImportGremlinPlugin.build()
                 .methodImports(Collections.singletonList(Gremlin.class.getCanonicalName() + "#*")).create();
 
-        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        final DefaultImportCustomizer customizer = (DefaultImportCustomizer) module.getCustomizers().get()[0];
         assertEquals(1, module.getCustomizers().get().length);
         assertThat(customizer.getMethodImports(), hasItems(zeroArgs));
 
@@ -75,7 +75,7 @@ public class ImportGremlinPluginTest {
         final ImportGremlinPlugin module = ImportGremlinPlugin.build()
                 .methodImports(Collections.singletonList(toMethodDescriptor(zeroArgs))).create();
 
-        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        final DefaultImportCustomizer customizer = (DefaultImportCustomizer) module.getCustomizers().get()[0];
         assertEquals(1, module.getCustomizers().get().length);
         assertThat(customizer.getMethodImports(), hasItems(zeroArgs));
         assertEquals(1, customizer.getMethodImports().size());
@@ -87,7 +87,7 @@ public class ImportGremlinPluginTest {
         final ImportGremlinPlugin module = ImportGremlinPlugin.build()
                 .methodImports(Collections.singletonList(toMethodDescriptor(singleArg))).create();
 
-        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        final DefaultImportCustomizer customizer = (DefaultImportCustomizer) module.getCustomizers().get()[0];
         assertEquals(1, module.getCustomizers().get().length);
         assertThat(customizer.getMethodImports(), hasItems(singleArg));
         assertEquals(1, customizer.getMethodImports().size());
@@ -110,7 +110,7 @@ public class ImportGremlinPluginTest {
         final ImportGremlinPlugin module = ImportGremlinPlugin.build()
                 .enumImports(Collections.singletonList(T.class.getCanonicalName() + "#*")).create();
 
-        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        final DefaultImportCustomizer customizer = (DefaultImportCustomizer) module.getCustomizers().get()[0];
         assertEquals(1, module.getCustomizers().get().length);
         assertThat(customizer.getEnumImports(), hasItems(T.id, T.key, T.label, T.value));
         assertEquals(4, customizer.getEnumImports().size());
@@ -121,7 +121,7 @@ public class ImportGremlinPluginTest {
         final ImportGremlinPlugin module = ImportGremlinPlugin.build()
                 .enumImports(Collections.singletonList(T.class.getCanonicalName() + "#" + T.id.name())).create();
 
-        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        final DefaultImportCustomizer customizer = (DefaultImportCustomizer) module.getCustomizers().get()[0];
         assertEquals(1, module.getCustomizers().get().length);
         assertThat(customizer.getEnumImports(), hasItems(T.id));
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultDefaultImportCustomizerProviderTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultDefaultImportCustomizerProviderTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultDefaultImportCustomizerProviderTest.java
new file mode 100644
index 0000000..9a3785f
--- /dev/null
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultDefaultImportCustomizerProviderTest.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy;
+
+import org.apache.tinkerpop.gremlin.groovy.loaders.SugarLoader;
+import org.junit.Test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DefaultDefaultImportCustomizerProviderTest {
+    static {
+        SugarLoader.load();
+    }
+
+    @Test
+    public void shouldReturnDefaultImports() {
+        final DefaultImportCustomizerProvider provider = new DefaultImportCustomizerProvider();
+        assertImportsInProvider(provider);
+    }
+
+    @Test
+    public void shouldReturnWithExtraStaticImports() {
+        final Set<String> statics = new HashSet<>();
+        statics.add("com.test.This.*");
+        statics.add("com.test.That.OTHER");
+        final DefaultImportCustomizerProvider provider = new DefaultImportCustomizerProvider(new HashSet<>(), statics);
+        assertImportsInProvider(provider);
+    }
+
+    @Test
+    public void shouldReturnWithExtraImports() {
+        final Set<String> imports = new HashSet<>();
+        imports.add("com.test.that.*");
+        imports.add("com.test.that.That");
+        final DefaultImportCustomizerProvider provider = new DefaultImportCustomizerProvider(imports, new HashSet<>());
+        assertImportsInProvider(provider);
+    }
+
+    @Test
+    public void shouldReturnWithBothImportTypes() {
+        final Set<String> imports = new HashSet<>();
+        imports.add("com.test.that.*");
+        imports.add("com.test.that.That");
+
+        final Set<String> statics = new HashSet<>();
+        statics.add("com.test.This.*");
+        statics.add("com.test.That.OTHER");
+
+        final DefaultImportCustomizerProvider provider = new DefaultImportCustomizerProvider(imports, statics);
+        assertImportsInProvider(provider);
+    }
+
+    private static void assertImportsInProvider(DefaultImportCustomizerProvider provider) {
+        final Set<String> allImports = provider.getAllImports();
+
+        final Set<String> imports = provider.getImports();
+        final Set<String> staticImports = provider.getStaticImports();
+        final Set<String> extraImports = provider.getExtraImports();
+        final Set<String> extraStaticImports = provider.getExtraStaticImports();
+
+        assertEquals(imports.size() + staticImports.size() + extraImports.size() + extraStaticImports.size(), allImports.size());
+        assertTrue(allImports.containsAll(imports));
+        assertTrue(allImports.containsAll(staticImports));
+        assertTrue(allImports.containsAll(extraImports));
+        assertTrue(allImports.containsAll(extraStaticImports));
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultImportCustomizerProviderTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultImportCustomizerProviderTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultImportCustomizerProviderTest.java
deleted file mode 100644
index 74df889..0000000
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultImportCustomizerProviderTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.groovy;
-
-import org.apache.tinkerpop.gremlin.groovy.loaders.SugarLoader;
-import org.junit.Test;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class DefaultImportCustomizerProviderTest {
-    static {
-        SugarLoader.load();
-    }
-
-    @Test
-    public void shouldReturnDefaultImports() {
-        final DefaultImportCustomizerProvider provider = new DefaultImportCustomizerProvider();
-        assertImportsInProvider(provider);
-    }
-
-    @Test
-    public void shouldReturnWithExtraStaticImports() {
-        final Set<String> statics = new HashSet<>();
-        statics.add("com.test.This.*");
-        statics.add("com.test.That.OTHER");
-        final DefaultImportCustomizerProvider provider = new DefaultImportCustomizerProvider(new HashSet<>(), statics);
-        assertImportsInProvider(provider);
-    }
-
-    @Test
-    public void shouldReturnWithExtraImports() {
-        final Set<String> imports = new HashSet<>();
-        imports.add("com.test.that.*");
-        imports.add("com.test.that.That");
-        final DefaultImportCustomizerProvider provider = new DefaultImportCustomizerProvider(imports, new HashSet<>());
-        assertImportsInProvider(provider);
-    }
-
-    @Test
-    public void shouldReturnWithBothImportTypes() {
-        final Set<String> imports = new HashSet<>();
-        imports.add("com.test.that.*");
-        imports.add("com.test.that.That");
-
-        final Set<String> statics = new HashSet<>();
-        statics.add("com.test.This.*");
-        statics.add("com.test.That.OTHER");
-
-        final DefaultImportCustomizerProvider provider = new DefaultImportCustomizerProvider(imports, statics);
-        assertImportsInProvider(provider);
-    }
-
-    private static void assertImportsInProvider(DefaultImportCustomizerProvider provider) {
-        final Set<String> allImports = provider.getAllImports();
-
-        final Set<String> imports = provider.getImports();
-        final Set<String> staticImports = provider.getStaticImports();
-        final Set<String> extraImports = provider.getExtraImports();
-        final Set<String> extraStaticImports = provider.getExtraStaticImports();
-
-        assertEquals(imports.size() + staticImports.size() + extraImports.size() + extraStaticImports.size(), allImports.size());
-        assertTrue(allImports.containsAll(imports));
-        assertTrue(allImports.containsAll(staticImports));
-        assertTrue(allImports.containsAll(extraImports));
-        assertTrue(allImports.containsAll(extraStaticImports));
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinPlugin.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinPlugin.java
index e8826ae..a08aa76 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinPlugin.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinPlugin.java
@@ -20,7 +20,7 @@ package org.apache.tinkerpop.gremlin.server.jsr223;
 
 import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
 import org.apache.tinkerpop.gremlin.server.util.LifeCycleHook;
 
 /**
@@ -33,7 +33,7 @@ public final class GremlinServerGremlinPlugin extends AbstractGremlinPlugin {
     private static final GremlinServerGremlinPlugin instance = new GremlinServerGremlinPlugin();
 
     private GremlinServerGremlinPlugin() {
-        super(MODULE_NAME, ImportCustomizer.build().addClassImports(LifeCycleHook.class, LifeCycleHook.Context.class).create());
+        super(MODULE_NAME, DefaultImportCustomizer.build().addClassImports(LifeCycleHook.class, LifeCycleHook.Context.class).create());
     }
 
     public static GremlinServerGremlinPlugin instance() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
index 9910a4c..723d898 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
@@ -25,7 +25,6 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.junit.Test;
 
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 
@@ -68,7 +67,7 @@ public class GremlinEnabledScriptEngineTest {
 
             @Override
             public Optional<Customizer[]> getCustomizers(final String scriptEngineName) {
-                return Optional.of(new Customizer[] {ImportCustomizer.build()
+                return Optional.of(new Customizer[] {DefaultImportCustomizer.build()
                         .addClassImports(java.awt.Color.class)
                         .addClassImports(java.sql.CallableStatement.class)
                         .create() });


[12/50] tinkerpop git commit: TINKERPOP-1562 Add GreminServerGremlinModule for Gremlin Server specific imports

Posted by sp...@apache.org.
TINKERPOP-1562 Add GreminServerGremlinModule for Gremlin Server specific imports

Allow use of instance() as a way for GremlinModules to be instantiated.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/9f65e6aa
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9f65e6aa
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9f65e6aa

Branch: refs/heads/TINKERPOP-1562
Commit: 9f65e6aa3d32eab2ef76bb7e3ae1f60b8332268f
Parents: 42194b8
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 07:36:40 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:50 2016 -0500

----------------------------------------------------------------------
 .../gremlin/jsr223/AbstractGremlinModule.java   | 10 ++++
 .../gremlin/jsr223/CoreGremlinModule.java       | 18 -------
 .../gremlin/groovy/engine/GremlinExecutor.java  | 49 +++++++++++---------
 .../server/util/GremlinServerGremlinModule.java | 41 ++++++++++++++++
 .../server/util/ServerGremlinExecutor.java      | 13 +-----
 5 files changed, 81 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9f65e6aa/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java
index 36104f6..4b9cd2c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.jsr223;
 
+import java.util.Collections;
 import java.util.Optional;
 import java.util.Set;
 
@@ -29,6 +30,15 @@ public abstract class AbstractGremlinModule implements GremlinModule {
     protected final Customizer[] customizers;
     protected final Set<String> appliesTo;
 
+    /**
+     * Creates a base {@link GremlinModule} that will apply to all {@link GremlinScriptEngine} instances.
+     */
+    public AbstractGremlinModule(final String moduleName, final Customizer... customizers) {
+        this(moduleName, Collections.emptySet(), customizers);
+    }
+    /**
+     * Creates a base {@link GremlinModule} that will apply to specific {@link GremlinScriptEngine} instances.
+     */
     public AbstractGremlinModule(final String moduleName, final Set<String> appliesTo, final Customizer... customizers) {
         this.moduleName = moduleName;
         this.appliesTo = appliesTo;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9f65e6aa/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
index f1fdbe4..ff47767 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
@@ -37,7 +37,6 @@ public final class CoreGremlinModule implements GremlinModule {
             .addMethodImports(CoreImports.getMethodImports()).create();
 
     private static final Customizer[] customizers = new Customizer[] {gremlinCore};
-    private static final Builder builder = new Builder();
 
     /**
      * @deprecated As of 3.2.4, replaced by {@link #instance()} as this field will later become private.
@@ -60,21 +59,4 @@ public final class CoreGremlinModule implements GremlinModule {
     public String getName() {
         return MODULE_NAME;
     }
-
-    /**
-     * {@link GremlinModule} instances all use a builder pattern for instantiation via configuration. This method is
-     * just provided for consistency with that pattern. When instantiating programmatically, use {@link #instance()}.
-     */
-    public static Builder build() {
-        return builder;
-    }
-
-    public final static class Builder {
-
-        private Builder() {}
-
-        public CoreGremlinModule create() {
-            return instance();
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9f65e6aa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index 5f7ab09..1ad41c7 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -435,30 +435,37 @@ public class GremlinExecutor implements AutoCloseable {
             for (Map.Entry<String, Map<String,Object>> moduleConfig : moduleConfigs.entrySet()) {
                 try {
                     final Class<?> clazz = Class.forName(moduleConfig.getKey());
-                    final Method builderMethod = clazz.getMethod("build");
-                    Object moduleBuilder = builderMethod.invoke(null);
-
-                    final Class<?> builderClazz = moduleBuilder.getClass();
-                    final Map<String,Object> customizerConfigs = moduleConfig.getValue();
-                    final Method[] methods = builderClazz.getMethods();
-                    for (Map.Entry<String,Object> customizerConfig : customizerConfigs.entrySet()) {
-                        final Method configMethod = Stream.of(methods).filter(m -> m.getName().equals(customizerConfig.getKey())).findFirst()
-                                .orElseThrow(() -> new IllegalStateException("Could not find builder method on " + builderClazz.getCanonicalName()));
-                        if (null == customizerConfig.getValue())
-                            moduleBuilder = configMethod.invoke(moduleBuilder);
-                        else
-                            moduleBuilder = configMethod.invoke(moduleBuilder, customizerConfig.getValue());
-                    }
 
+                    // first try instance() and if that fails try to use build()
                     try {
-                        final Method appliesTo = builderClazz.getMethod("appliesTo");
-                        moduleBuilder = appliesTo.invoke(moduleBuilder, language);
-                    } catch (NoSuchMethodException ignored) {
-
+                        final Method instanceMethod = clazz.getMethod("instance");
+                        gremlinScriptEngineManager.addModule((GremlinModule) instanceMethod.invoke(null));
+                    } catch (Exception ex) {
+                        final Method builderMethod = clazz.getMethod("build");
+                        Object moduleBuilder = builderMethod.invoke(null);
+
+                        final Class<?> builderClazz = moduleBuilder.getClass();
+                        final Map<String, Object> customizerConfigs = moduleConfig.getValue();
+                        final Method[] methods = builderClazz.getMethods();
+                        for (Map.Entry<String, Object> customizerConfig : customizerConfigs.entrySet()) {
+                            final Method configMethod = Stream.of(methods).filter(m -> m.getName().equals(customizerConfig.getKey())).findFirst()
+                                    .orElseThrow(() -> new IllegalStateException("Could not find builder method on " + builderClazz.getCanonicalName()));
+                            if (null == customizerConfig.getValue())
+                                moduleBuilder = configMethod.invoke(moduleBuilder);
+                            else
+                                moduleBuilder = configMethod.invoke(moduleBuilder, customizerConfig.getValue());
+                        }
+
+                        try {
+                            final Method appliesTo = builderClazz.getMethod("appliesTo");
+                            moduleBuilder = appliesTo.invoke(moduleBuilder, language);
+                        } catch (NoSuchMethodException ignored) {
+
+                        }
+
+                        final Method create = builderClazz.getMethod("create");
+                        gremlinScriptEngineManager.addModule((GremlinModule) create.invoke(moduleBuilder));
                     }
-
-                    final Method create = builderClazz.getMethod("create");
-                    gremlinScriptEngineManager.addModule((GremlinModule) create.invoke(moduleBuilder));
                 } catch (Exception ex) {
                     throw new IllegalStateException(ex);
                 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9f65e6aa/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/GremlinServerGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/GremlinServerGremlinModule.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/GremlinServerGremlinModule.java
new file mode 100644
index 0000000..863c640
--- /dev/null
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/GremlinServerGremlinModule.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.server.util;
+
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinModule;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinModule;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+
+/**
+ * A {@link GremlinModule} implementation that adds Gremlin Server specific classes to the imports.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class GremlinServerGremlinModule extends AbstractGremlinModule {
+    private static final String MODULE_NAME = "tinkerpop.server";
+    private static final GremlinServerGremlinModule instance = new GremlinServerGremlinModule();
+
+    public GremlinServerGremlinModule() {
+        super(MODULE_NAME, ImportCustomizer.build().addClassImports(LifeCycleHook.class, LifeCycleHook.Context.class).create());
+    }
+
+    public static GremlinServerGremlinModule instance() {
+        return instance;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9f65e6aa/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
index eda1d8d..bb6c9ce 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
@@ -138,17 +138,8 @@ public class ServerGremlinExecutor<T extends ScheduledExecutorService> {
                 v.imports.add(LifeCycleHook.Context.class.getCanonicalName());
                 gremlinExecutorBuilder.addEngineSettings(k, v.imports, v.staticImports, v.scripts, v.config);
             } else {
-                // make sure that server related classes are available at init - ultimately this is the right way to
-                // do things going forward.
-                // TODO: though this Import is kinda sketchy.
-                if (v.modules.containsKey(ImportGremlinModule.class.getName())) {
-                    final List<String> listToAddImportsTo = (List<String>) v.modules.get(ImportGremlinModule.class.getName()).get("classImports");
-                    listToAddImportsTo.addAll(Arrays.asList(LifeCycleHook.class.getName(), LifeCycleHook.Context.class.getName()));
-                } else {
-                    final Map<String,Object> imports = new HashMap<>();
-                    imports.put("classImports", Arrays.asList(LifeCycleHook.class.getName(), LifeCycleHook.Context.class.getName()));
-                    v.modules.put(ImportGremlinModule.class.getName(), imports);
-                }
+                // make sure that server related classes are available at init - new approach. the LifeCycleHook stuff
+                // will be added explicitly via configuration using GremlinServerGremlinModule in the yaml
                 gremlinExecutorBuilder.addModules(k, v.modules);
             }
         });


[14/50] tinkerpop git commit: TINKERPOP-1562 Renamed GremlinModule to GremlinPlugin in gremlin-core

Posted by sp...@apache.org.
TINKERPOP-1562 Renamed GremlinModule to GremlinPlugin in gremlin-core


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/68487c2b
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/68487c2b
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/68487c2b

Branch: refs/heads/TINKERPOP-1562
Commit: 68487c2b89fd589256925af2750907ef8da3c07a
Parents: d7d6d5b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 13:15:02 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:50 2016 -0500

----------------------------------------------------------------------
 .../groovy/plugin/GiraphGremlinPlugin.java      |   3 +-
 .../giraph/jsr223/GiraphGremlinModule.java      |  58 -------
 .../giraph/jsr223/GiraphGremlinPlugin.java      |  58 +++++++
 .../gremlin/jsr223/AbstractGremlinModule.java   |  58 -------
 .../gremlin/jsr223/AbstractGremlinPlugin.java   |  58 +++++++
 .../gremlin/jsr223/CoreGremlinModule.java       |  62 -------
 .../gremlin/jsr223/CoreGremlinPlugin.java       |  62 +++++++
 .../DefaultGremlinScriptEngineManager.java      |   6 +-
 .../tinkerpop/gremlin/jsr223/GremlinModule.java |  70 --------
 .../tinkerpop/gremlin/jsr223/GremlinPlugin.java |  70 ++++++++
 .../jsr223/GremlinScriptEngineManager.java      |   4 +-
 .../gremlin/jsr223/ImportGremlinModule.java     | 173 -------------------
 .../gremlin/jsr223/ImportGremlinPlugin.java     | 173 +++++++++++++++++++
 .../gremlin/jsr223/RemoteAcceptor.java          |   2 +-
 .../gremlin/jsr223/ScriptFileGremlinPlugin.java |  71 ++++++++
 .../gremlin/jsr223/ScriptFileModule.java        |  71 --------
 .../gremlin/jsr223/ImportGremlinModuleTest.java | 149 ----------------
 .../gremlin/jsr223/ImportGremlinPluginTest.java | 149 ++++++++++++++++
 .../gremlin/groovy/engine/GremlinExecutor.java  |  19 +-
 .../tinkerpop/gremlin/server/Settings.java      |   4 +-
 .../jsr223/GremlinServerGremlinModule.java      |  42 -----
 .../jsr223/GremlinServerGremlinPlugin.java      |  42 +++++
 .../server/util/ServerGremlinExecutor.java      |   3 -
 23 files changed, 701 insertions(+), 706 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java
index 29f2455..80d98f9 100644
--- a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java
+++ b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java
@@ -19,7 +19,6 @@
 
 package org.apache.tinkerpop.gremlin.giraph.groovy.plugin;
 
-import org.apache.tinkerpop.gremlin.giraph.jsr223.GiraphGremlinModule;
 import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphGraphComputer;
 import org.apache.tinkerpop.gremlin.groovy.plugin.AbstractGremlinPlugin;
 import org.apache.tinkerpop.gremlin.groovy.plugin.IllegalEnvironmentException;
@@ -33,7 +32,7 @@ import java.util.Set;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
- * @deprecated As of release 3.2.4, replaced by {@link GiraphGremlinModule}.
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.giraph.jsr223.GiraphGremlinPlugin}.
  */
 @Deprecated
 public final class GiraphGremlinPlugin extends AbstractGremlinPlugin {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinModule.java
----------------------------------------------------------------------
diff --git a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinModule.java b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinModule.java
deleted file mode 100644
index 69f3586..0000000
--- a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinModule.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.giraph.jsr223;
-
-import org.apache.tinkerpop.gremlin.giraph.process.computer.EmptyOutEdges;
-import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphComputation;
-import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphGraphComputer;
-import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphMemory;
-import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphMessageCombiner;
-import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphMessenger;
-import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphVertex;
-import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphWorkerContext;
-import org.apache.tinkerpop.gremlin.giraph.process.computer.MemoryAggregator;
-import org.apache.tinkerpop.gremlin.giraph.process.computer.PassThroughMemory;
-import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinModule;
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public final class GiraphGremlinModule extends AbstractGremlinModule {
-    private static final String MODULE_NAME = "tinkerpop.giraph";
-    private static final GiraphGremlinModule instance = new GiraphGremlinModule();
-
-    private GiraphGremlinModule() {
-        super(MODULE_NAME, ImportCustomizer.build().addClassImports(
-                EmptyOutEdges.class,
-                GiraphComputation.class,
-                GiraphGraphComputer.class,
-                GiraphMemory.class,
-                GiraphMessageCombiner.class,
-                GiraphMessenger.class,
-                GiraphVertex.class,
-                GiraphWorkerContext.class,
-                MemoryAggregator.class,
-                PassThroughMemory.class).create());
-    }
-
-    public static GiraphGremlinModule instance() {
-        return instance;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java
new file mode 100644
index 0000000..a96ac86
--- /dev/null
+++ b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.giraph.jsr223;
+
+import org.apache.tinkerpop.gremlin.giraph.process.computer.EmptyOutEdges;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphComputation;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphGraphComputer;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphMemory;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphMessageCombiner;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphMessenger;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphVertex;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphWorkerContext;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.MemoryAggregator;
+import org.apache.tinkerpop.gremlin.giraph.process.computer.PassThroughMemory;
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class GiraphGremlinPlugin extends AbstractGremlinPlugin {
+    private static final String MODULE_NAME = "tinkerpop.giraph";
+    private static final GiraphGremlinPlugin instance = new GiraphGremlinPlugin();
+
+    private GiraphGremlinPlugin() {
+        super(MODULE_NAME, ImportCustomizer.build().addClassImports(
+                EmptyOutEdges.class,
+                GiraphComputation.class,
+                GiraphGraphComputer.class,
+                GiraphMemory.class,
+                GiraphMessageCombiner.class,
+                GiraphMessenger.class,
+                GiraphVertex.class,
+                GiraphWorkerContext.class,
+                MemoryAggregator.class,
+                PassThroughMemory.class).create());
+    }
+
+    public static GiraphGremlinPlugin instance() {
+        return instance;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java
deleted file mode 100644
index 4b9cd2c..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.jsr223;
-
-import java.util.Collections;
-import java.util.Optional;
-import java.util.Set;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public abstract class AbstractGremlinModule implements GremlinModule {
-    protected final String moduleName;
-    protected final Customizer[] customizers;
-    protected final Set<String> appliesTo;
-
-    /**
-     * Creates a base {@link GremlinModule} that will apply to all {@link GremlinScriptEngine} instances.
-     */
-    public AbstractGremlinModule(final String moduleName, final Customizer... customizers) {
-        this(moduleName, Collections.emptySet(), customizers);
-    }
-    /**
-     * Creates a base {@link GremlinModule} that will apply to specific {@link GremlinScriptEngine} instances.
-     */
-    public AbstractGremlinModule(final String moduleName, final Set<String> appliesTo, final Customizer... customizers) {
-        this.moduleName = moduleName;
-        this.appliesTo = appliesTo;
-        this.customizers = customizers;
-    }
-
-    @Override
-    public String getName() {
-        return moduleName;
-    }
-
-    @Override
-    public Optional<Customizer[]> getCustomizers(final String scriptEngineName) {
-        return null == scriptEngineName || appliesTo.isEmpty() || appliesTo.contains(scriptEngineName) ?
-                Optional.of(customizers) : Optional.empty();
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinPlugin.java
new file mode 100644
index 0000000..f25c611
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinPlugin.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Set;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public abstract class AbstractGremlinPlugin implements GremlinPlugin {
+    protected final String moduleName;
+    protected final Customizer[] customizers;
+    protected final Set<String> appliesTo;
+
+    /**
+     * Creates a base {@link GremlinPlugin} that will apply to all {@link GremlinScriptEngine} instances.
+     */
+    public AbstractGremlinPlugin(final String moduleName, final Customizer... customizers) {
+        this(moduleName, Collections.emptySet(), customizers);
+    }
+    /**
+     * Creates a base {@link GremlinPlugin} that will apply to specific {@link GremlinScriptEngine} instances.
+     */
+    public AbstractGremlinPlugin(final String moduleName, final Set<String> appliesTo, final Customizer... customizers) {
+        this.moduleName = moduleName;
+        this.appliesTo = appliesTo;
+        this.customizers = customizers;
+    }
+
+    @Override
+    public String getName() {
+        return moduleName;
+    }
+
+    @Override
+    public Optional<Customizer[]> getCustomizers(final String scriptEngineName) {
+        return null == scriptEngineName || appliesTo.isEmpty() || appliesTo.contains(scriptEngineName) ?
+                Optional.of(customizers) : Optional.empty();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
deleted file mode 100644
index ff47767..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.jsr223;
-
-import org.apache.tinkerpop.gremlin.util.CoreImports;
-
-import java.util.Optional;
-
-/**
- * This module is required for a {@code ScriptEngine} to be Gremlin-enabled.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public final class CoreGremlinModule implements GremlinModule {
-
-    private static final String MODULE_NAME = "tinkerpop.core";
-
-    private static final ImportCustomizer gremlinCore = ImportCustomizer.build()
-            .addClassImports(CoreImports.getClassImports())
-            .addEnumImports(CoreImports.getEnumImports())
-            .addMethodImports(CoreImports.getMethodImports()).create();
-
-    private static final Customizer[] customizers = new Customizer[] {gremlinCore};
-
-    /**
-     * @deprecated As of 3.2.4, replaced by {@link #instance()} as this field will later become private.
-     */
-    @Deprecated
-    public static final CoreGremlinModule INSTANCE = new CoreGremlinModule();
-
-    private CoreGremlinModule() {}
-
-    public static CoreGremlinModule instance() {
-        return INSTANCE;
-    }
-
-    @Override
-    public Optional<Customizer[]> getCustomizers(final String scriptEngineName) {
-        return Optional.of(customizers);
-    }
-
-    @Override
-    public String getName() {
-        return MODULE_NAME;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
new file mode 100644
index 0000000..3f5ac2c
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import org.apache.tinkerpop.gremlin.util.CoreImports;
+
+import java.util.Optional;
+
+/**
+ * This module is required for a {@code ScriptEngine} to be Gremlin-enabled.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class CoreGremlinPlugin implements GremlinPlugin {
+
+    private static final String MODULE_NAME = "tinkerpop.core";
+
+    private static final ImportCustomizer gremlinCore = ImportCustomizer.build()
+            .addClassImports(CoreImports.getClassImports())
+            .addEnumImports(CoreImports.getEnumImports())
+            .addMethodImports(CoreImports.getMethodImports()).create();
+
+    private static final Customizer[] customizers = new Customizer[] {gremlinCore};
+
+    /**
+     * @deprecated As of 3.2.4, replaced by {@link #instance()} as this field will later become private.
+     */
+    @Deprecated
+    public static final CoreGremlinPlugin INSTANCE = new CoreGremlinPlugin();
+
+    private CoreGremlinPlugin() {}
+
+    public static CoreGremlinPlugin instance() {
+        return INSTANCE;
+    }
+
+    @Override
+    public Optional<Customizer[]> getCustomizers(final String scriptEngineName) {
+        return Optional.of(customizers);
+    }
+
+    @Override
+    public String getName() {
+        return MODULE_NAME;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
index 25a0612..10bdfa3 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java
@@ -95,7 +95,7 @@ public class DefaultGremlinScriptEngineManager implements GremlinScriptEngineMan
      * List of extensions for the {@link GremlinScriptEngineManager} which will be used to supply
      * {@link Customizer} instances to {@link GremlinScriptEngineFactory} that are instantiated.
      */
-    private List<GremlinModule> modules = new ArrayList<>();
+    private List<GremlinPlugin> modules = new ArrayList<>();
 
     /**
      * The effect of calling this constructor is the same as calling
@@ -125,7 +125,7 @@ public class DefaultGremlinScriptEngineManager implements GremlinScriptEngineMan
     }
 
     @Override
-    public void addModule(final GremlinModule module) {
+    public void addModule(final GremlinPlugin module) {
         // TODO: should modules be a set based on "name" to ensure uniqueness? not sure what bad stuff can happen with dupes
         if (module != null) modules.add(module);
     }
@@ -378,7 +378,7 @@ public class DefaultGremlinScriptEngineManager implements GremlinScriptEngineMan
 
     private void initEngines(final ClassLoader loader) {
         // always need this module for a scriptengine to be "Gremlin-enabled"
-        modules.add(CoreGremlinModule.INSTANCE);
+        modules.add(CoreGremlinPlugin.INSTANCE);
 
         Iterator<GremlinScriptEngineFactory> itty;
         try {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java
deleted file mode 100644
index 1077cf3..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinModule.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.jsr223;
-
-import java.util.Optional;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public interface GremlinModule {
-    /**
-     * The name of the module.  This name should be unique (use a namespaced approach) as naming clashes will
-     * prevent proper module operations. Modules developed by TinkerPop will be prefixed with "tinkerpop."
-     * For example, TinkerPop's implementation of Giraph would be named "tinkerpop.giraph".  If Facebook were
-     * to do their own implementation the implementation might be called "facebook.giraph".
-     */
-    public String getName();
-
-    /**
-     * Some modules may require a restart of the plugin host for the classloader to pick up the features.  This is
-     * typically true of modules that rely on {@code Class.forName()} to dynamically instantiate classes from the
-     * root classloader (e.g. JDBC drivers that instantiate via @{code DriverManager}).
-     */
-    public default boolean requireRestart() {
-        return false;
-    }
-
-    /**
-     * Gets the list of all {@link Customizer} implementations to assign to a new {@link GremlinScriptEngine}. This is
-     * the same as doing {@code getCustomizers(null)}.
-     */
-    public default Optional<Customizer[]> getCustomizers(){
-        return getCustomizers(null);
-    }
-
-    /**
-     * Gets the list of {@link Customizer} implementations to assign to a new {@link GremlinScriptEngine}. The
-     * implementation should filter the returned {@code Customizers} according to the supplied name of the
-     * Gremlin-enabled {@code ScriptEngine}. By providing a filter, {@code GremlinModule} developers can have the
-     * ability to target specific {@code ScriptEngines}.
-     *
-     * @param scriptEngineName The name of the {@code ScriptEngine} or null to get all the available {@code Customizers}
-     */
-    public Optional<Customizer[]> getCustomizers(final String scriptEngineName);
-
-    /**
-     * Allows a plugin to utilize features of the {@code :remote} and {@code :submit} commands of the Gremlin Console.
-     * This method does not need to be implemented if the plugin is not meant for the Console for some reason or
-     * if it does not intend to take advantage of those commands.
-     */
-    public default Optional<RemoteAcceptor> remoteAcceptor() {
-        return Optional.empty();
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPlugin.java
new file mode 100644
index 0000000..390c027
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPlugin.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import java.util.Optional;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface GremlinPlugin {
+    /**
+     * The name of the module.  This name should be unique (use a namespaced approach) as naming clashes will
+     * prevent proper module operations. Modules developed by TinkerPop will be prefixed with "tinkerpop."
+     * For example, TinkerPop's implementation of Giraph would be named "tinkerpop.giraph".  If Facebook were
+     * to do their own implementation the implementation might be called "facebook.giraph".
+     */
+    public String getName();
+
+    /**
+     * Some modules may require a restart of the plugin host for the classloader to pick up the features.  This is
+     * typically true of modules that rely on {@code Class.forName()} to dynamically instantiate classes from the
+     * root classloader (e.g. JDBC drivers that instantiate via @{code DriverManager}).
+     */
+    public default boolean requireRestart() {
+        return false;
+    }
+
+    /**
+     * Gets the list of all {@link Customizer} implementations to assign to a new {@link GremlinScriptEngine}. This is
+     * the same as doing {@code getCustomizers(null)}.
+     */
+    public default Optional<Customizer[]> getCustomizers(){
+        return getCustomizers(null);
+    }
+
+    /**
+     * Gets the list of {@link Customizer} implementations to assign to a new {@link GremlinScriptEngine}. The
+     * implementation should filter the returned {@code Customizers} according to the supplied name of the
+     * Gremlin-enabled {@code ScriptEngine}. By providing a filter, {@code GremlinModule} developers can have the
+     * ability to target specific {@code ScriptEngines}.
+     *
+     * @param scriptEngineName The name of the {@code ScriptEngine} or null to get all the available {@code Customizers}
+     */
+    public Optional<Customizer[]> getCustomizers(final String scriptEngineName);
+
+    /**
+     * Allows a plugin to utilize features of the {@code :remote} and {@code :submit} commands of the Gremlin Console.
+     * This method does not need to be implemented if the plugin is not meant for the Console for some reason or
+     * if it does not intend to take advantage of those commands.
+     */
+    public default Optional<RemoteAcceptor> remoteAcceptor() {
+        return Optional.empty();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngineManager.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngineManager.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngineManager.java
index 270d136..b2966c5 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngineManager.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngineManager.java
@@ -118,9 +118,9 @@ public interface GremlinScriptEngineManager {
     public List<GremlinScriptEngineFactory> getEngineFactories();
 
     /**
-     * Add {@link GremlinModule} instances to customize newly created {@link GremlinScriptEngine} instances.
+     * Add {@link GremlinPlugin} instances to customize newly created {@link GremlinScriptEngine} instances.
      */
-    public void addModule(final GremlinModule module);
+    public void addModule(final GremlinPlugin module);
 
     /**
      * Registers a {@link GremlinScriptEngineFactory} to handle a language name.  Overrides any such association found

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModule.java
deleted file mode 100644
index e9ca477..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModule.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.jsr223;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * A module that allows custom class, static method and enum imports (i.e. those that are statically defined by a
- * module within itself). A user might utilize this class to supply their own imports. This module is not specific
- * to any {@link GremlinScriptEngine} - the imports are supplied to all engines.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public final class ImportGremlinModule extends AbstractGremlinModule {
-    private static final String MODULE_NAME = "tinkerpop.import";
-
-    private ImportGremlinModule(final Builder builder) {
-        super(MODULE_NAME, builder.appliesTo, ImportCustomizer.build()
-                                                .addClassImports(builder.classImports)
-                                                .addEnumImports(builder.enumImports)
-                                                .addMethodImports(builder.methodImports).create());
-    }
-
-    public static Builder build() {
-        return new Builder();
-    }
-
-    public static final class Builder {
-        private static final Pattern METHOD_PATTERN = Pattern.compile("(.*)#(.*)\\((.*)\\)");
-        private static final Pattern ENUM_PATTERN = Pattern.compile("(.*)#(.*)");
-        private Set<Class> classImports = new HashSet<>();
-        private Set<Method> methodImports = new HashSet<>();
-        private Set<Enum> enumImports = new HashSet<>();
-        private final Set<String> appliesTo = new HashSet<>();
-
-        private Builder() {}
-
-        /**
-         * The name of the {@link GremlinScriptEngine} that this module will apply to. Setting no values here will
-         * make the module available to all the engines.
-         */
-        public Builder appliesTo(final Collection<String> scriptEngineName) {
-            this.appliesTo.addAll(scriptEngineName);
-            return this;
-        }
-
-        public Builder classImports(final Collection<String> classes) {
-            for (String clazz : classes) {
-                try {
-                    classImports.add(Class.forName(clazz));
-                } catch (Exception ex) {
-                    throw new IllegalStateException(ex);
-                }
-            }
-            return this;
-        }
-
-        public Builder methodImports(final Collection<String> methods) {
-            for (String method : methods) {
-                try {
-                    if (method.endsWith("#*")) {
-                        final String classString = method.substring(0, method.length() - 2);
-                        final Class<?> clazz = Class.forName(classString);
-                        methodImports.addAll(allStaticMethods(clazz));
-                    } else {
-                        final Matcher matcher = METHOD_PATTERN.matcher(method);
-
-                        if (!matcher.matches())
-                            throw new IllegalArgumentException(String.format("Could not read method descriptor - check format of: %s", method));
-
-                        final String classString = matcher.group(1);
-                        final String methodString = matcher.group(2);
-                        final String argString = matcher.group(3);
-                        final Class<?> clazz = Class.forName(classString);
-                        methodImports.add(clazz.getMethod(methodString, parse(argString)));
-                    }
-                } catch (IllegalArgumentException iae) {
-                    throw iae;
-                } catch (Exception ex) {
-                    throw new IllegalStateException(ex);
-                }
-            }
-            return this;
-        }
-
-        public Builder enumImports(final Collection<String> enums) {
-            for (String enumItem : enums) {
-                try {
-                    if (enumItem.endsWith("#*")) {
-                        final String classString = enumItem.substring(0, enumItem.length() - 2);
-                        final Class<?> clazz = Class.forName(classString);
-                        enumImports.addAll(allEnums(clazz));
-                    } else {
-                        final Matcher matcher = ENUM_PATTERN.matcher(enumItem);
-
-                        if (!matcher.matches())
-                            throw new IllegalArgumentException(String.format("Could not read enum descriptor - check format of: %s", enumItem));
-
-                        final String classString = matcher.group(1);
-                        final String enumValString = matcher.group(2);
-                        final Class<?> clazz = Class.forName(classString);
-
-                        Stream.of(clazz.getEnumConstants())
-                                .filter(e -> ((Enum) e).name().equals(enumValString))
-                                .findFirst().ifPresent(e -> enumImports.add((Enum) e));
-                    }
-                } catch (IllegalArgumentException iae) {
-                    throw iae;
-                } catch (Exception ex) {
-                    throw new IllegalStateException(ex);
-                }
-            }
-            return this;
-        }
-
-        public ImportGremlinModule create() {
-            if (enumImports.isEmpty() && classImports.isEmpty() && methodImports.isEmpty())
-                throw new IllegalStateException("At least one import must be specified");
-
-            return new ImportGremlinModule(this);
-        }
-
-        private static List<Enum> allEnums(final Class<?> clazz) {
-            return Stream.of(clazz.getEnumConstants()).map(e -> (Enum) e).collect(Collectors.toList());
-        }
-
-        private static List<Method> allStaticMethods(final Class<?> clazz) {
-            return Stream.of(clazz.getMethods()).filter(m -> Modifier.isStatic(m.getModifiers())).collect(Collectors.toList());
-        }
-
-        private static Class<?>[] parse(final String argString) {
-            if (null == argString || argString.isEmpty())
-                return new Class<?>[0];
-
-            final List<String> args = Stream.of(argString.split(",")).map(String::trim).collect(Collectors.toList());
-            final Class<?>[] classes = new Class<?>[args.size()];
-            for (int ix = 0; ix < args.size(); ix++) {
-                try {
-                    classes[ix] = Class.forName(args.get(ix));
-                } catch (Exception ex) {
-                    throw new IllegalStateException(ex);
-                }
-            }
-
-            return classes;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
new file mode 100644
index 0000000..f99ee68
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * A module that allows custom class, static method and enum imports (i.e. those that are statically defined by a
+ * module within itself). A user might utilize this class to supply their own imports. This module is not specific
+ * to any {@link GremlinScriptEngine} - the imports are supplied to all engines.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class ImportGremlinPlugin extends AbstractGremlinPlugin {
+    private static final String MODULE_NAME = "tinkerpop.import";
+
+    private ImportGremlinPlugin(final Builder builder) {
+        super(MODULE_NAME, builder.appliesTo, ImportCustomizer.build()
+                                                .addClassImports(builder.classImports)
+                                                .addEnumImports(builder.enumImports)
+                                                .addMethodImports(builder.methodImports).create());
+    }
+
+    public static Builder build() {
+        return new Builder();
+    }
+
+    public static final class Builder {
+        private static final Pattern METHOD_PATTERN = Pattern.compile("(.*)#(.*)\\((.*)\\)");
+        private static final Pattern ENUM_PATTERN = Pattern.compile("(.*)#(.*)");
+        private Set<Class> classImports = new HashSet<>();
+        private Set<Method> methodImports = new HashSet<>();
+        private Set<Enum> enumImports = new HashSet<>();
+        private final Set<String> appliesTo = new HashSet<>();
+
+        private Builder() {}
+
+        /**
+         * The name of the {@link GremlinScriptEngine} that this module will apply to. Setting no values here will
+         * make the module available to all the engines.
+         */
+        public Builder appliesTo(final Collection<String> scriptEngineName) {
+            this.appliesTo.addAll(scriptEngineName);
+            return this;
+        }
+
+        public Builder classImports(final Collection<String> classes) {
+            for (String clazz : classes) {
+                try {
+                    classImports.add(Class.forName(clazz));
+                } catch (Exception ex) {
+                    throw new IllegalStateException(ex);
+                }
+            }
+            return this;
+        }
+
+        public Builder methodImports(final Collection<String> methods) {
+            for (String method : methods) {
+                try {
+                    if (method.endsWith("#*")) {
+                        final String classString = method.substring(0, method.length() - 2);
+                        final Class<?> clazz = Class.forName(classString);
+                        methodImports.addAll(allStaticMethods(clazz));
+                    } else {
+                        final Matcher matcher = METHOD_PATTERN.matcher(method);
+
+                        if (!matcher.matches())
+                            throw new IllegalArgumentException(String.format("Could not read method descriptor - check format of: %s", method));
+
+                        final String classString = matcher.group(1);
+                        final String methodString = matcher.group(2);
+                        final String argString = matcher.group(3);
+                        final Class<?> clazz = Class.forName(classString);
+                        methodImports.add(clazz.getMethod(methodString, parse(argString)));
+                    }
+                } catch (IllegalArgumentException iae) {
+                    throw iae;
+                } catch (Exception ex) {
+                    throw new IllegalStateException(ex);
+                }
+            }
+            return this;
+        }
+
+        public Builder enumImports(final Collection<String> enums) {
+            for (String enumItem : enums) {
+                try {
+                    if (enumItem.endsWith("#*")) {
+                        final String classString = enumItem.substring(0, enumItem.length() - 2);
+                        final Class<?> clazz = Class.forName(classString);
+                        enumImports.addAll(allEnums(clazz));
+                    } else {
+                        final Matcher matcher = ENUM_PATTERN.matcher(enumItem);
+
+                        if (!matcher.matches())
+                            throw new IllegalArgumentException(String.format("Could not read enum descriptor - check format of: %s", enumItem));
+
+                        final String classString = matcher.group(1);
+                        final String enumValString = matcher.group(2);
+                        final Class<?> clazz = Class.forName(classString);
+
+                        Stream.of(clazz.getEnumConstants())
+                                .filter(e -> ((Enum) e).name().equals(enumValString))
+                                .findFirst().ifPresent(e -> enumImports.add((Enum) e));
+                    }
+                } catch (IllegalArgumentException iae) {
+                    throw iae;
+                } catch (Exception ex) {
+                    throw new IllegalStateException(ex);
+                }
+            }
+            return this;
+        }
+
+        public ImportGremlinPlugin create() {
+            if (enumImports.isEmpty() && classImports.isEmpty() && methodImports.isEmpty())
+                throw new IllegalStateException("At least one import must be specified");
+
+            return new ImportGremlinPlugin(this);
+        }
+
+        private static List<Enum> allEnums(final Class<?> clazz) {
+            return Stream.of(clazz.getEnumConstants()).map(e -> (Enum) e).collect(Collectors.toList());
+        }
+
+        private static List<Method> allStaticMethods(final Class<?> clazz) {
+            return Stream.of(clazz.getMethods()).filter(m -> Modifier.isStatic(m.getModifiers())).collect(Collectors.toList());
+        }
+
+        private static Class<?>[] parse(final String argString) {
+            if (null == argString || argString.isEmpty())
+                return new Class<?>[0];
+
+            final List<String> args = Stream.of(argString.split(",")).map(String::trim).collect(Collectors.toList());
+            final Class<?>[] classes = new Class<?>[args.size()];
+            for (int ix = 0; ix < args.size(); ix++) {
+                try {
+                    classes[ix] = Class.forName(args.get(ix));
+                } catch (Exception ex) {
+                    throw new IllegalStateException(ex);
+                }
+            }
+
+            return classes;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteAcceptor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteAcceptor.java
index f917c09..9c96892 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteAcceptor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/RemoteAcceptor.java
@@ -27,7 +27,7 @@ import java.util.List;
  * A "remote connection" does not necessarily have to be a remote server.  It simply refers to a resource that is
  * external to the console.
  * <p/>
- * By implementing this interface and returning an instance of it through {@link GremlinModule#remoteAcceptor()} a
+ * By implementing this interface and returning an instance of it through {@link GremlinPlugin#remoteAcceptor()} a
  * plugin can hook into those commands and provide remoting features.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
new file mode 100644
index 0000000..30e66ed
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class ScriptFileGremlinPlugin extends AbstractGremlinPlugin {
+    private static final String MODULE_NAME = "tinkerpop.script";
+
+    public ScriptFileGremlinPlugin(final Builder builder) {
+        super(MODULE_NAME, builder.appliesTo, new ScriptCustomizer(builder.files));
+    }
+
+    public static Builder build() {
+        return new Builder();
+    }
+
+    public static final class Builder {
+
+        private final Set<String> appliesTo = new HashSet<>();
+        private Set<File> files = new HashSet<>();
+
+        private Builder() {}
+
+        /**
+         * The name of the {@link GremlinScriptEngine} that this module will apply to. Setting no values here will
+         * make the module available to all the engines.
+         */
+        public Builder appliesTo(final Collection<String> scriptEngineName) {
+            this.appliesTo.addAll(scriptEngineName);
+            return this;
+        }
+
+        public Builder files(final Set<String> files) {
+            for (String f : files) {
+                final File file = new File(f);
+                if (!file.exists()) throw new IllegalArgumentException(new FileNotFoundException(f));
+                this.files.add(file);
+            }
+
+            return this;
+        }
+
+        public ScriptFileGremlinPlugin create() {
+            return new ScriptFileGremlinPlugin(this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileModule.java
deleted file mode 100644
index b5c0d0c..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileModule.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.jsr223;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public final class ScriptFileModule extends AbstractGremlinModule {
-    private static final String MODULE_NAME = "tinkerpop.script";
-
-    public ScriptFileModule(final Builder builder) {
-        super(MODULE_NAME, builder.appliesTo, new ScriptCustomizer(builder.files));
-    }
-
-    public static Builder build() {
-        return new Builder();
-    }
-
-    public static final class Builder {
-
-        private final Set<String> appliesTo = new HashSet<>();
-        private Set<File> files = new HashSet<>();
-
-        private Builder() {}
-
-        /**
-         * The name of the {@link GremlinScriptEngine} that this module will apply to. Setting no values here will
-         * make the module available to all the engines.
-         */
-        public Builder appliesTo(final Collection<String> scriptEngineName) {
-            this.appliesTo.addAll(scriptEngineName);
-            return this;
-        }
-
-        public Builder files(final Set<String> files) {
-            for (String f : files) {
-                final File file = new File(f);
-                if (!file.exists()) throw new IllegalArgumentException(new FileNotFoundException(f));
-                this.files.add(file);
-            }
-
-            return this;
-        }
-
-        public ScriptFileModule create() {
-            return new ScriptFileModule(this);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModuleTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModuleTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModuleTest.java
deleted file mode 100644
index ce62357..0000000
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinModuleTest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.jsr223;
-
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.T;
-import org.apache.tinkerpop.gremlin.structure.io.IoCore;
-import org.apache.tinkerpop.gremlin.util.Gremlin;
-import org.junit.Test;
-
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.IsCollectionContaining.hasItems;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class ImportGremlinModuleTest {
-
-    @Test(expected = IllegalStateException.class)
-    public void shouldImportSomething() {
-        ImportGremlinModule.build().create();
-    }
-
-    @Test
-    public void shouldImportClass() {
-        final ImportGremlinModule module = ImportGremlinModule.build()
-                .classImports(Collections.singletonList(Graph.class.getCanonicalName())).create();
-
-        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
-        assertEquals(1, module.getCustomizers().get().length);
-        assertThat(customizer.getClassImports(), hasItems(Graph.class));
-        assertEquals(1, customizer.getClassImports().size());
-    }
-
-    @Test
-    public void shouldImportWildcardMethod() throws Exception {
-        final Method zeroArgs = Gremlin.class.getMethod("version");
-        final ImportGremlinModule module = ImportGremlinModule.build()
-                .methodImports(Collections.singletonList(Gremlin.class.getCanonicalName() + "#*")).create();
-
-        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
-        assertEquals(1, module.getCustomizers().get().length);
-        assertThat(customizer.getMethodImports(), hasItems(zeroArgs));
-
-        // will also have the static main() method
-        assertEquals(2, customizer.getMethodImports().size());
-    }
-
-    @Test
-    public void shouldImportZeroArgMethod() throws Exception {
-        final Method zeroArgs = Gremlin.class.getMethod("version");
-        final ImportGremlinModule module = ImportGremlinModule.build()
-                .methodImports(Collections.singletonList(toMethodDescriptor(zeroArgs))).create();
-
-        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
-        assertEquals(1, module.getCustomizers().get().length);
-        assertThat(customizer.getMethodImports(), hasItems(zeroArgs));
-        assertEquals(1, customizer.getMethodImports().size());
-    }
-
-    @Test
-    public void shouldImportSingleArgMethod() throws Exception {
-        final Method singleArg = IoCore.class.getMethod("createIoBuilder", String.class);
-        final ImportGremlinModule module = ImportGremlinModule.build()
-                .methodImports(Collections.singletonList(toMethodDescriptor(singleArg))).create();
-
-        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
-        assertEquals(1, module.getCustomizers().get().length);
-        assertThat(customizer.getMethodImports(), hasItems(singleArg));
-        assertEquals(1, customizer.getMethodImports().size());
-    }
-
-    @Test
-    public void shouldThrowExceptionIfInvalidMethodDescriptor() throws Exception {
-        final String badDescriptor = "Gremlin*version";
-        try {
-            ImportGremlinModule.build()
-                    .methodImports(Collections.singletonList(badDescriptor)).create();
-            fail("Should have failed parsing the method descriptor");
-        } catch (IllegalArgumentException iae) {
-            assertEquals(iae.getMessage(), "Could not read method descriptor - check format of: " + badDescriptor);
-        }
-    }
-
-    @Test
-    public void shouldImportWildcardEnum() throws Exception {
-        final ImportGremlinModule module = ImportGremlinModule.build()
-                .enumImports(Collections.singletonList(T.class.getCanonicalName() + "#*")).create();
-
-        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
-        assertEquals(1, module.getCustomizers().get().length);
-        assertThat(customizer.getEnumImports(), hasItems(T.id, T.key, T.label, T.value));
-        assertEquals(4, customizer.getEnumImports().size());
-    }
-
-    @Test
-    public void shouldImportEnum() throws Exception {
-        final ImportGremlinModule module = ImportGremlinModule.build()
-                .enumImports(Collections.singletonList(T.class.getCanonicalName() + "#" + T.id.name())).create();
-
-        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
-        assertEquals(1, module.getCustomizers().get().length);
-        assertThat(customizer.getEnumImports(), hasItems(T.id));
-    }
-
-    @Test
-    public void shouldThrowExceptionIfInvalidEnumDescriptor() throws Exception {
-        final String badDescriptor = "T*id";
-        try {
-            ImportGremlinModule.build()
-                    .enumImports(Collections.singletonList(badDescriptor)).create();
-            fail("Should have failed parsing the enum descriptor");
-        } catch (IllegalArgumentException iae) {
-            assertEquals("Could not read enum descriptor - check format of: " + badDescriptor, iae.getMessage());
-        }
-    }
-
-    private static String toMethodDescriptor(final Method method) {
-        return method.getDeclaringClass().getCanonicalName() +
-                "#" +
-                method.getName() +
-                '(' +
-                String.join(",", Stream.of(method.getParameters()).map(p -> p.getType().getCanonicalName()).collect(Collectors.toList())) +
-                ')';
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPluginTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPluginTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPluginTest.java
new file mode 100644
index 0000000..428fc57
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPluginTest.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.io.IoCore;
+import org.apache.tinkerpop.gremlin.util.Gremlin;
+import org.junit.Test;
+
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsCollectionContaining.hasItems;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class ImportGremlinPluginTest {
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldImportSomething() {
+        ImportGremlinPlugin.build().create();
+    }
+
+    @Test
+    public void shouldImportClass() {
+        final ImportGremlinPlugin module = ImportGremlinPlugin.build()
+                .classImports(Collections.singletonList(Graph.class.getCanonicalName())).create();
+
+        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        assertEquals(1, module.getCustomizers().get().length);
+        assertThat(customizer.getClassImports(), hasItems(Graph.class));
+        assertEquals(1, customizer.getClassImports().size());
+    }
+
+    @Test
+    public void shouldImportWildcardMethod() throws Exception {
+        final Method zeroArgs = Gremlin.class.getMethod("version");
+        final ImportGremlinPlugin module = ImportGremlinPlugin.build()
+                .methodImports(Collections.singletonList(Gremlin.class.getCanonicalName() + "#*")).create();
+
+        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        assertEquals(1, module.getCustomizers().get().length);
+        assertThat(customizer.getMethodImports(), hasItems(zeroArgs));
+
+        // will also have the static main() method
+        assertEquals(2, customizer.getMethodImports().size());
+    }
+
+    @Test
+    public void shouldImportZeroArgMethod() throws Exception {
+        final Method zeroArgs = Gremlin.class.getMethod("version");
+        final ImportGremlinPlugin module = ImportGremlinPlugin.build()
+                .methodImports(Collections.singletonList(toMethodDescriptor(zeroArgs))).create();
+
+        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        assertEquals(1, module.getCustomizers().get().length);
+        assertThat(customizer.getMethodImports(), hasItems(zeroArgs));
+        assertEquals(1, customizer.getMethodImports().size());
+    }
+
+    @Test
+    public void shouldImportSingleArgMethod() throws Exception {
+        final Method singleArg = IoCore.class.getMethod("createIoBuilder", String.class);
+        final ImportGremlinPlugin module = ImportGremlinPlugin.build()
+                .methodImports(Collections.singletonList(toMethodDescriptor(singleArg))).create();
+
+        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        assertEquals(1, module.getCustomizers().get().length);
+        assertThat(customizer.getMethodImports(), hasItems(singleArg));
+        assertEquals(1, customizer.getMethodImports().size());
+    }
+
+    @Test
+    public void shouldThrowExceptionIfInvalidMethodDescriptor() throws Exception {
+        final String badDescriptor = "Gremlin*version";
+        try {
+            ImportGremlinPlugin.build()
+                    .methodImports(Collections.singletonList(badDescriptor)).create();
+            fail("Should have failed parsing the method descriptor");
+        } catch (IllegalArgumentException iae) {
+            assertEquals(iae.getMessage(), "Could not read method descriptor - check format of: " + badDescriptor);
+        }
+    }
+
+    @Test
+    public void shouldImportWildcardEnum() throws Exception {
+        final ImportGremlinPlugin module = ImportGremlinPlugin.build()
+                .enumImports(Collections.singletonList(T.class.getCanonicalName() + "#*")).create();
+
+        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        assertEquals(1, module.getCustomizers().get().length);
+        assertThat(customizer.getEnumImports(), hasItems(T.id, T.key, T.label, T.value));
+        assertEquals(4, customizer.getEnumImports().size());
+    }
+
+    @Test
+    public void shouldImportEnum() throws Exception {
+        final ImportGremlinPlugin module = ImportGremlinPlugin.build()
+                .enumImports(Collections.singletonList(T.class.getCanonicalName() + "#" + T.id.name())).create();
+
+        final ImportCustomizer customizer = (ImportCustomizer) module.getCustomizers().get()[0];
+        assertEquals(1, module.getCustomizers().get().length);
+        assertThat(customizer.getEnumImports(), hasItems(T.id));
+    }
+
+    @Test
+    public void shouldThrowExceptionIfInvalidEnumDescriptor() throws Exception {
+        final String badDescriptor = "T*id";
+        try {
+            ImportGremlinPlugin.build()
+                    .enumImports(Collections.singletonList(badDescriptor)).create();
+            fail("Should have failed parsing the enum descriptor");
+        } catch (IllegalArgumentException iae) {
+            assertEquals("Could not read enum descriptor - check format of: " + badDescriptor, iae.getMessage());
+        }
+    }
+
+    private static String toMethodDescriptor(final Method method) {
+        return method.getDeclaringClass().getCanonicalName() +
+                "#" +
+                method.getName() +
+                '(' +
+                String.join(",", Stream.of(method.getParameters()).map(p -> p.getType().getCanonicalName()).collect(Collectors.toList())) +
+                ')';
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index 1ad41c7..8659e24 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -20,10 +20,9 @@ package org.apache.tinkerpop.gremlin.groovy.engine;
 
 import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine;
-import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin;
 import org.apache.commons.lang3.concurrent.BasicThreadFactory;
 import org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager;
-import org.apache.tinkerpop.gremlin.jsr223.GremlinModule;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngineManager;
 import org.javatuples.Pair;
 import org.slf4j.Logger;
@@ -439,7 +438,7 @@ public class GremlinExecutor implements AutoCloseable {
                     // first try instance() and if that fails try to use build()
                     try {
                         final Method instanceMethod = clazz.getMethod("instance");
-                        gremlinScriptEngineManager.addModule((GremlinModule) instanceMethod.invoke(null));
+                        gremlinScriptEngineManager.addModule((GremlinPlugin) instanceMethod.invoke(null));
                     } catch (Exception ex) {
                         final Method builderMethod = clazz.getMethod("build");
                         Object moduleBuilder = builderMethod.invoke(null);
@@ -464,7 +463,7 @@ public class GremlinExecutor implements AutoCloseable {
                         }
 
                         final Method create = builderClazz.getMethod("create");
-                        gremlinScriptEngineManager.addModule((GremlinModule) create.invoke(moduleBuilder));
+                        gremlinScriptEngineManager.addModule((GremlinPlugin) create.invoke(moduleBuilder));
                     }
                 } catch (Exception ex) {
                     throw new IllegalStateException(ex);
@@ -475,8 +474,8 @@ public class GremlinExecutor implements AutoCloseable {
 
     private ScriptEngines createScriptEngines() {
         // plugins already on the path - ones static to the classpath
-        final List<GremlinPlugin> globalPlugins = new ArrayList<>();
-        ServiceLoader.load(GremlinPlugin.class).forEach(globalPlugins::add);
+        final List<org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin> globalPlugins = new ArrayList<>();
+        ServiceLoader.load(org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin.class).forEach(globalPlugins::add);
 
         return new ScriptEngines(se -> {
             // this first part initializes the scriptengines Map
@@ -487,7 +486,7 @@ public class GremlinExecutor implements AutoCloseable {
             }
 
             // use grabs dependencies and returns plugins to load
-            final List<GremlinPlugin> pluginsToLoad = new ArrayList<>(globalPlugins);
+            final List<org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin> pluginsToLoad = new ArrayList<>(globalPlugins);
             use.forEach(u -> {
                 if (u.size() != 3)
                     logger.warn("Could not resolve dependencies for [{}].  Each entry for the 'use' configuration must include [groupId, artifactId, version]", u);
@@ -614,9 +613,9 @@ public class GremlinExecutor implements AutoCloseable {
         }
 
         /**
-         * Add a configuration for a {@link GremlinModule} to the executor. The key is the fully qualified class name
-         * of the {@link GremlinModule} instance and the value is a map of configuration values. In that map, the key
-         * is the name of a builder method on the {@link GremlinModule} and the value is some argument to pass to that
+         * Add a configuration for a {@link GremlinPlugin} to the executor. The key is the fully qualified class name
+         * of the {@link GremlinPlugin} instance and the value is a map of configuration values. In that map, the key
+         * is the name of a builder method on the {@link GremlinPlugin} and the value is some argument to pass to that
          * method.
          */
         public Builder addModules(final String engineName, final Map<String, Map<String,Object>> modules) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java
index a8395bb..75cff3b 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java
@@ -20,7 +20,7 @@ package org.apache.tinkerpop.gremlin.server;
 
 import io.netty.handler.ssl.SslContext;
 import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
-import org.apache.tinkerpop.gremlin.jsr223.GremlinModule;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
@@ -341,7 +341,7 @@ public class Settings {
         public Map<String, Object> config = null;
 
         /**
-         * A set of configurations for {@link GremlinModule} instances to apply to this {@link GremlinScriptEngine}.
+         * A set of configurations for {@link GremlinPlugin} instances to apply to this {@link GremlinScriptEngine}.
          */
         public Map<String,Map<String,Object>> modules = new HashMap<>();
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinModule.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinModule.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinModule.java
deleted file mode 100644
index b161f69..0000000
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinModule.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.server.jsr223;
-
-import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinModule;
-import org.apache.tinkerpop.gremlin.jsr223.GremlinModule;
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
-import org.apache.tinkerpop.gremlin.server.util.LifeCycleHook;
-
-/**
- * A {@link GremlinModule} implementation that adds Gremlin Server specific classes to the imports.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public final class GremlinServerGremlinModule extends AbstractGremlinModule {
-    private static final String MODULE_NAME = "tinkerpop.server";
-    private static final GremlinServerGremlinModule instance = new GremlinServerGremlinModule();
-
-    private GremlinServerGremlinModule() {
-        super(MODULE_NAME, ImportCustomizer.build().addClassImports(LifeCycleHook.class, LifeCycleHook.Context.class).create());
-    }
-
-    public static GremlinServerGremlinModule instance() {
-        return instance;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinPlugin.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinPlugin.java
new file mode 100644
index 0000000..e8826ae
--- /dev/null
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinPlugin.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.server.jsr223;
+
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.server.util.LifeCycleHook;
+
+/**
+ * A {@link GremlinPlugin} implementation that adds Gremlin Server specific classes to the imports.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class GremlinServerGremlinPlugin extends AbstractGremlinPlugin {
+    private static final String MODULE_NAME = "tinkerpop.server";
+    private static final GremlinServerGremlinPlugin instance = new GremlinServerGremlinPlugin();
+
+    private GremlinServerGremlinPlugin() {
+        super(MODULE_NAME, ImportCustomizer.build().addClassImports(LifeCycleHook.class, LifeCycleHook.Context.class).create());
+    }
+
+    public static GremlinServerGremlinPlugin instance() {
+        return instance;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
index bb6c9ce..1204bee 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
@@ -19,7 +19,6 @@
 package org.apache.tinkerpop.gremlin.server.util;
 
 import org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor;
-import org.apache.tinkerpop.gremlin.jsr223.ImportGremlinModule;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.server.Channelizer;
 import org.apache.tinkerpop.gremlin.server.GraphManager;
@@ -29,9 +28,7 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;


[13/50] tinkerpop git commit: TINKERPOP-1562 More deprecation around methods on building GremlinExecutor that used ScriptEngines.

Posted by sp...@apache.org.
TINKERPOP-1562 More deprecation around methods on building GremlinExecutor that used ScriptEngines.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/42194b8d
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/42194b8d
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/42194b8d

Branch: refs/heads/TINKERPOP-1562
Commit: 42194b8de19d74253277396099af8780052ea034
Parents: ddafaef
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Nov 18 05:34:00 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:50 2016 -0500

----------------------------------------------------------------------
 .../gremlin/groovy/engine/GremlinExecutor.java  | 37 +++++++++++++++++---
 1 file changed, 33 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/42194b8d/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index 90a3b43..5f7ab09 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -83,7 +83,7 @@ public class GremlinExecutor implements AutoCloseable {
      */
     private ScriptEngines scriptEngines;
 
-    private GremlinScriptEngineManager manager;
+    private GremlinScriptEngineManager gremlinScriptEngineManager;
 
     private final Map<String, EngineSettings> settings;
     private final Map<String, Map<String, Map<String,Object>>> modules;
@@ -117,7 +117,7 @@ public class GremlinExecutor implements AutoCloseable {
         this.globalBindings = builder.globalBindings;
         this.enabledPlugins = builder.enabledPlugins;
 
-        this.manager = new CachedGremlinScriptEngineManager();
+        this.gremlinScriptEngineManager = new CachedGremlinScriptEngineManager();
         initializeGremlinScriptEngineManager();
 
         // this is temporary so that we can have backward compatibilty to the old plugin system and ScriptEngines
@@ -306,7 +306,7 @@ public class GremlinExecutor implements AutoCloseable {
 
                 // do this weirdo check until the now deprecated ScriptEngines is gutted
                 final Object o = useGremlinScriptEngineManager ?
-                        manager.getEngineByName(lang).eval(script, bindings) : scriptEngines.eval(script, bindings, lang);
+                        gremlinScriptEngineManager.getEngineByName(lang).eval(script, bindings) : scriptEngines.eval(script, bindings, lang);
 
                 // apply a transformation before sending back the result - useful when trying to force serialization
                 // in the same thread that the eval took place given ThreadLocal nature of graphs as well as some
@@ -349,10 +349,18 @@ public class GremlinExecutor implements AutoCloseable {
         return evaluationFuture;
     }
 
+    /**
+     * @deprecated As of release 3.2.4, replaced by {@link #getScriptEngineManager()}.
+     */
+    @Deprecated
     public ScriptEngines getScriptEngines() {
         return this.scriptEngines;
     }
 
+    public GremlinScriptEngineManager getScriptEngineManager() {
+        return this.gremlinScriptEngineManager;
+    }
+
     public ExecutorService getExecutorService() {
         return executorService;
     }
@@ -450,7 +458,7 @@ public class GremlinExecutor implements AutoCloseable {
                     }
 
                     final Method create = builderClazz.getMethod("create");
-                    manager.addModule((GremlinModule) create.invoke(moduleBuilder));
+                    gremlinScriptEngineManager.addModule((GremlinModule) create.invoke(moduleBuilder));
                 } catch (Exception ex) {
                     throw new IllegalStateException(ex);
                 }
@@ -542,6 +550,8 @@ public class GremlinExecutor implements AutoCloseable {
 
     /**
      * Create a {@code Builder} and specify the first ScriptEngine to be included.
+     *
+     * @deprecated As of release 3.2.4, replaced by {@link #build()}.
      */
     public static Builder build(final String engineName, final List<String> imports,
                                 final List<String> staticImports, final List<String> scripts,
@@ -580,7 +590,10 @@ public class GremlinExecutor implements AutoCloseable {
          * @param staticImports A list of static imports for the engine.
          * @param scripts       A list of scripts to execute in the engine to initialize it.
          * @param config        Custom configuration map for the ScriptEngine
+         *
+         * @deprecated As of release 3.2.4, replaced by {@link #addModules(String, Map)}.
          */
+        @Deprecated
         public Builder addEngineSettings(final String engineName, final List<String> imports,
                                          final List<String> staticImports, final List<String> scripts,
                                          final Map<String, Object> config) {
@@ -593,6 +606,12 @@ public class GremlinExecutor implements AutoCloseable {
             return this;
         }
 
+        /**
+         * Add a configuration for a {@link GremlinModule} to the executor. The key is the fully qualified class name
+         * of the {@link GremlinModule} instance and the value is a map of configuration values. In that map, the key
+         * is the name of a builder method on the {@link GremlinModule} and the value is some argument to pass to that
+         * method.
+         */
         public Builder addModules(final String engineName, final Map<String, Map<String,Object>> modules) {
             this.modules.put(engineName, modules);
             return this;
@@ -623,7 +642,10 @@ public class GremlinExecutor implements AutoCloseable {
 
         /**
          * Replaces any settings provided.
+         *
+         * @deprecated As of release 3.2.4, replaced by {@link #addModules(String, Map)}.
          */
+        @Deprecated
         public Builder engineSettings(final Map<String, EngineSettings> settings) {
             this.settings = settings;
             return this;
@@ -681,7 +703,10 @@ public class GremlinExecutor implements AutoCloseable {
 
         /**
          * A set of maven coordinates for dependencies to be applied for the script engine instances.
+         *
+         * @deprecated As of release 3.2.4, not replaced.
          */
+        @Deprecated
         public Builder use(final List<List<String>> use) {
             this.use = use;
             return this;
@@ -689,7 +714,11 @@ public class GremlinExecutor implements AutoCloseable {
 
         /**
          * Set of the names of plugins that should be enabled for the engine.
+         *
+         * @deprecated As of release 3.2.4, replaced by {@link #addModules(String, Map)} though behavior is not quite
+         *             the same.
          */
+        @Deprecated
         public Builder enabledPlugins(final Set<String> enabledPlugins) {
             this.enabledPlugins = enabledPlugins;
             return this;


[37/50] tinkerpop git commit: TINKERPOP-1562 Change Set to List to preserve order in script execution.

Posted by sp...@apache.org.
TINKERPOP-1562 Change Set to List to preserve order in script execution.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/873ac619
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/873ac619
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/873ac619

Branch: refs/heads/TINKERPOP-1562
Commit: 873ac619e935e226505f75bd6caacd76d820531b
Parents: 2d49710
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 29 16:42:46 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:31:50 2016 -0500

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java  | 2 +-
 .../tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java     | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/873ac619/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
index 93ad9d8..0131ca2 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java
@@ -60,7 +60,7 @@ public final class ScriptFileGremlinPlugin extends AbstractGremlinPlugin {
             return this;
         }
 
-        public Builder files(final Set<String> files) {
+        public Builder files(final List<String> files) {
             for (String f : files) {
                 final File file = new File(f);
                 if (!file.exists()) throw new IllegalArgumentException(new FileNotFoundException(f));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/873ac619/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java
index 81cf9e6..681d2ac 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java
@@ -23,6 +23,7 @@ import org.junit.Test;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
@@ -41,7 +42,7 @@ public class ScriptFileGremlinPluginTest {
     public void shouldOpenViaPropertiesFileConfig() throws IOException {
         final File scriptFile1 = TestHelper.generateTempFileFromResource(DefaultScriptCustomizerTest.class, "script-customizer-1.groovy", ".groovy");
         final File scriptFile2 = TestHelper.generateTempFileFromResource(DefaultScriptCustomizerTest.class, "script-customizer-2.groovy", ".groovy");
-        final Set<String> files = new HashSet<>();
+        final List<String> files = new ArrayList<>();
         files.add(scriptFile1.getAbsolutePath());
         files.add(scriptFile2.getAbsolutePath());
         final GremlinPlugin plugin = ScriptFileGremlinPlugin.build().files(files).create();


[16/50] tinkerpop git commit: TINKERPOP-1562 Deprecated GiraphGremlinPlugin.

Posted by sp...@apache.org.
TINKERPOP-1562 Deprecated GiraphGremlinPlugin.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/8ee22256
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/8ee22256
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/8ee22256

Branch: refs/heads/TINKERPOP-1562
Commit: 8ee22256e9d833d00624666998376b7b6ba14a94
Parents: a596da3
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 10:56:21 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:50 2016 -0500

----------------------------------------------------------------------
 .../gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java         | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ee22256/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java
index ba882f5..29f2455 100644
--- a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java
+++ b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java
@@ -19,6 +19,7 @@
 
 package org.apache.tinkerpop.gremlin.giraph.groovy.plugin;
 
+import org.apache.tinkerpop.gremlin.giraph.jsr223.GiraphGremlinModule;
 import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphGraphComputer;
 import org.apache.tinkerpop.gremlin.groovy.plugin.AbstractGremlinPlugin;
 import org.apache.tinkerpop.gremlin.groovy.plugin.IllegalEnvironmentException;
@@ -32,7 +33,9 @@ import java.util.Set;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @deprecated As of release 3.2.4, replaced by {@link GiraphGremlinModule}.
  */
+@Deprecated
 public final class GiraphGremlinPlugin extends AbstractGremlinPlugin {
 
     protected static String NAME = "tinkerpop.giraph";


[25/50] tinkerpop git commit: TINKERPOP-1562 Added gremlin-console plugins under the new model.

Posted by sp...@apache.org.
TINKERPOP-1562 Added gremlin-console plugins under the new model.

Had to rework the PluggedIn adapters a bit so that they could better handle Console environment variable.s


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a91fb80e
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a91fb80e
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a91fb80e

Branch: refs/heads/TINKERPOP-1562
Commit: a91fb80e64ceb2e5c97b5f8c2ef20205d075ec18
Parents: bb5b47d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 22 16:35:16 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../tinkerpop/gremlin/console/Console.groovy    |   4 +-
 .../console/jsr223/GephiRemoteAcceptor.groovy   | 372 +++++++++++++++++++
 .../gremlin/console/plugin/PluggedIn.groovy     |  14 +-
 .../groovy/plugin/DriverGremlinPlugin.java      |   2 +
 .../groovy/plugin/DriverRemoteAcceptor.java     |   2 +
 .../groovy/plugin/GephiGremlinPlugin.java       |   1 +
 .../groovy/plugin/UtilitiesGremlinPlugin.java   |   1 +
 .../console/jsr223/DriverGremlinPlugin.java     | 106 ++++++
 .../console/jsr223/DriverRemoteAcceptor.java    | 238 ++++++++++++
 .../console/jsr223/GephiGremlinPlugin.java      |  45 +++
 .../console/jsr223/UtilitiesGremlinPlugin.java  | 106 ++++++
 ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin |   3 +
 .../jsr223/UtilitiesGremlinPluginScript.groovy  |  52 +++
 .../groovy/plugin/GremlinPluginAdapterTest.java |   5 +-
 14 files changed, 940 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
index cb6e90f..d39e085 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
@@ -131,9 +131,9 @@ class Console {
                 def pluggedIn
 
                 if (Mediator.useV3d3) {
-                    pluggedIn = new PluggedIn(new PluggedIn.GremlinPluginAdapter(plugin), groovy, io, false)
+                    pluggedIn = new PluggedIn(new PluggedIn.GremlinPluginAdapter((org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin) plugin, groovy, io), groovy, io, false)
                 } else {
-                    pluggedIn = new PluggedIn(plugin, groovy, io, false)
+                    pluggedIn = new PluggedIn((GremlinPlugin) plugin, groovy, io, false)
                 }
 
                 mediator.availablePlugins.put(plugin.class.name, pluggedIn)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
new file mode 100644
index 0000000..dbc1156
--- /dev/null
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
@@ -0,0 +1,372 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.console.jsr223
+
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
+import groovy.transform.CompileStatic
+import org.apache.http.client.methods.CloseableHttpResponse
+import org.apache.http.client.methods.HttpUriRequest
+import org.apache.http.client.methods.RequestBuilder
+import org.apache.http.entity.StringEntity
+import org.apache.http.impl.client.CloseableHttpClient
+import org.apache.http.impl.client.HttpClients
+import org.apache.http.util.EntityUtils
+import org.apache.tinkerpop.gremlin.console.plugin.GephiTraversalVisualizationStrategy
+import org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor
+import org.apache.tinkerpop.gremlin.jsr223.console.RemoteException
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource
+import org.apache.tinkerpop.gremlin.structure.Edge
+import org.apache.tinkerpop.gremlin.structure.Graph
+import org.apache.tinkerpop.gremlin.structure.Vertex
+import org.codehaus.groovy.tools.shell.Groovysh
+import org.codehaus.groovy.tools.shell.IO
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @author Randall Barnhart (randompi@gmail.com)
+ */
+class GephiRemoteAcceptor implements RemoteAcceptor {
+
+    private String host = "localhost"
+    private int port = 8080
+    private String workspace = "workspace1"
+
+    private final Groovysh shell
+    private final IO io
+
+    private final Random rand = new Random();
+    boolean traversalSubmittedForViz = false
+    long vizStepDelay
+    private float[] vizStartRGBColor
+    private float[] vizDefaultRGBColor
+    private char vizColorToFade
+    private float vizColorFadeRate
+    private float vizStartSize
+    private float vizSizeDecrementRate
+    private Map vertexAttributes = [:]
+
+    private CloseableHttpClient httpclient = HttpClients.createDefault();
+
+    public GephiRemoteAcceptor(final Groovysh shell, final IO io) {
+        this.shell = shell
+        this.io = io
+
+        // traversal visualization defaults
+        vizStepDelay = 1000;                 // 1 second pause between viz of steps
+        vizStartRGBColor = [0.0f, 1.0f, 0.5f]  // light aqua green
+        vizDefaultRGBColor = [0.6f, 0.6f, 0.6f]  // light grey
+        vizColorToFade = 'g'                 // will fade so blue is strongest
+        vizColorFadeRate = 0.7               // the multiplicative rate to fade visited vertices
+        vizStartSize = 10
+        vizSizeDecrementRate = 0.33f
+    }
+
+    @Override
+    connect(final List<String> args) throws RemoteException {
+        if (args.size() >= 1)
+            workspace = args[0]
+
+        if (args.size() >= 2)
+            host = args[1]
+
+        if (args.size() >= 3) {
+            try {
+                port = Integer.parseInt(args[2])
+            } catch (Exception ex) {
+                throw new RemoteException("Port must be an integer value")
+            }
+        }
+
+        def vizConfig = " with stepDelay:$vizStepDelay, startRGBColor:$vizStartRGBColor, " +
+                "colorToFade:$vizColorToFade, colorFadeRate:$vizColorFadeRate, startSize:$vizStartSize," +
+                "sizeDecrementRate:$vizSizeDecrementRate"
+
+        return "Connection to Gephi - http://$host:$port/$workspace" + vizConfig
+    }
+
+    @Override
+    Object configure(final List<String> args) throws RemoteException {
+        if (args.size() < 2)
+            throw new RemoteException("Invalid config arguments - check syntax")
+
+        if (args[0] == "host")
+            host = args[1]
+        else if (args[0] == "port") {
+            try {
+                port = Integer.parseInt(args[1])
+            } catch (Exception ignored) {
+                throw new RemoteException("Port must be an integer value")
+            }
+        } else if (args[0] == "workspace")
+            workspace = args[1]
+        else if (args[0] == "stepDelay")
+            parseVizStepDelay(args[1])
+        else if (args[0] == "startRGBColor")
+            parseVizStartRGBColor(args[1])
+        else if (args[0] == "colorToFade")
+            parseVizColorToFade(args[1])
+        else if (args[0] == "colorFadeRate")
+            parseVizColorFadeRate(args[1])
+        else if (args[0] == "sizeDecrementRate")
+            parseVizSizeDecrementRate(args[1])
+        else if (args[0] == "startSize")
+            parseVizStartSize(args[1])
+        else if (args[0] == "visualTraversal") {
+            def graphVar = shell.interp.context.getVariable(args[1])
+            if (!(graphVar instanceof Graph))
+                throw new RemoteException("Invalid argument to 'visualTraversal' - first parameter must be a Graph instance")
+
+            def gVar = args.size() == 3 ? args[2] : "vg"
+            def theG = GraphTraversalSource.build().with(new GephiTraversalVisualizationStrategy(this)).create(graphVar)
+            shell.interp.context.setVariable(gVar, theG)
+        } else
+            throw new RemoteException("Invalid config arguments - check syntax")
+
+        return "Connection to Gephi - http://$host:$port/$workspace" +
+                " with stepDelay:$vizStepDelay, startRGBColor:$vizStartRGBColor, " +
+                "colorToFade:$vizColorToFade, colorFadeRate:$vizColorFadeRate, startSize:$vizStartSize," +
+                "sizeDecrementRate:$vizSizeDecrementRate"
+    }
+
+    @Override
+    @CompileStatic
+    Object submit(final List<String> args) throws RemoteException {
+        final String line = String.join(" ", args)
+        if (line.trim() == "clear") {
+            clearGraph()
+            io.out.println("Gephi workspace cleared")
+            return
+        }
+
+        // need to clear the vertex attributes
+        vertexAttributes.clear()
+
+        // this tells the GraphTraversalVisualizationStrategy that if the line eval's to a traversal it should
+        // try to visualize it
+        traversalSubmittedForViz = true
+
+        // get the colors/sizes back to basics before trying visualize
+        resetColorsSizes()
+
+        final Object o = shell.execute(line)
+        if (o instanceof Graph) {
+            clearGraph()
+            def graph = (Graph) o
+            def g = graph.traversal()
+            g.V().sideEffect { addVertexToGephi(g, it.get()) }.iterate()
+        }
+
+        traversalSubmittedForViz = false
+    }
+
+    @Override
+    void close() throws IOException {
+        httpclient.close()
+    }
+
+    /**
+     * Visits the last set of vertices traversed and degrades their color and size.
+     */
+    def updateVisitedVertices(def List except = []) {
+        vertexAttributes.keySet().findAll{ vertexId -> !except.contains(vertexId) }.each { String vertexId ->
+            def attrs = vertexAttributes[vertexId]
+            float currentColor = attrs.color
+            currentColor *= vizColorFadeRate
+
+            int currentSize = attrs["size"]
+            currentSize = Math.max(vizStartSize, currentSize - (currentSize * vizSizeDecrementRate))
+
+            vertexAttributes.get(vertexId).color = currentColor
+            vertexAttributes.get(vertexId).size = currentSize
+
+            changeVertexAttributes(vertexId)
+        }
+    }
+
+    def changeVertexAttributes(def String vertexId) {
+        def props = [:]
+        props.put(vizColorToFade.toString(), vertexAttributes[vertexId].color)
+        props.put("size", vertexAttributes[vertexId].size)
+        updateGephiGraph([cn: [(vertexId): props]])
+    }
+
+    /**
+     * Visit a vertex traversed and initialize its color and size.
+     */
+    def visitVertexInGephi(def Vertex v) {
+        def props = [:]
+        props.put('r', vizStartRGBColor[0])
+        props.put('g', vizStartRGBColor[1])
+        props.put('b', vizStartRGBColor[2])
+        props.put('size', vizStartSize * 2.5)
+        props.put('visited', 1)
+
+        updateGephiGraph([cn: [(v.id().toString()): props]])
+
+        vertexAttributes[v.id().toString()] = [color: vizStartRGBColor[fadeColorIndex()], size: vizStartSize * 2.5, touch: 1]
+    }
+
+    def fadeColorIndex() {
+        if (vizColorToFade == 'r')
+            return 0
+        else if (vizColorToFade == 'g')
+            return 1
+        else if (vizColorToFade == 'b')
+            return 2
+    }
+
+    def addVertexToGephi(def GraphTraversalSource g, def Vertex v, def boolean ignoreEdges = false) {
+        // grab the first property value from the strategies of values
+        def props = g.V(v).valueMap().next().collectEntries { kv -> [(kv.key): kv.value[0]] }
+        props << [label: v.label()]
+        props.put('r', vizDefaultRGBColor[0])
+        props.put('g', vizDefaultRGBColor[1])
+        props.put('b', vizDefaultRGBColor[2])
+        props.put('x', rand.nextFloat())
+        props.put('y', rand.nextFloat())
+        props.put('size', 10)
+        props.put('visited', 0)
+
+        // only add if it does not exist in graph already
+        if (!getFromGephiGraph([operation: "getNode", id: v.id().toString()]).isPresent())
+            updateGephiGraph([an: [(v.id().toString()): props]])
+
+        if (!ignoreEdges) {
+            g.V(v).outE().sideEffect {
+                addEdgeToGephi(g, it.get())
+            }.iterate()
+        }
+    }
+
+    @CompileStatic
+    def addEdgeToGephi(def GraphTraversalSource g, def Edge e) {
+        def props = g.E(e).valueMap().next()
+        props.put('label', e.label())
+        props.put('source', e.outVertex().id().toString())
+        props.put('target', e.inVertex().id().toString())
+        props.put('directed', true)
+        props.put('visited', 0)
+
+        // make sure the in vertex is there but don't add its edges - that will happen later as we are looping
+        // all vertices in the graph
+        addVertexToGephi(g, e.inVertex(), true)
+
+        // both vertices are definitely there now, so add the edge
+        updateGephiGraph([ae: [(e.id().toString()): props]])
+    }
+
+    def clearGraph() {
+        updateGephiGraph([dn: [filter: "ALL"]])
+    }
+
+    def resetColorsSizes() {
+        updateGephiGraph([cn: [filter: [nodeAttribute: [attribute: "visited", value: 1]],
+                               attributes: [size: 1, r: vizDefaultRGBColor[0], g: vizDefaultRGBColor[1], b: vizDefaultRGBColor[2]]]])
+        updateGephiGraph([ce: [filter: [edgeAttribute: [attribute: "visited", value: 1]],
+                               attributes: [size: 1, r: vizDefaultRGBColor[0], g: vizDefaultRGBColor[1], b: vizDefaultRGBColor[2]]]])
+    }
+
+    def getFromGephiGraph(def Map queryArgs) {
+        def requestBuilder = RequestBuilder.get("http://$host:$port/$workspace")
+        queryArgs.each { requestBuilder = requestBuilder.addParameter(it.key, it.value) }
+
+        def httpResp = makeRequest(requestBuilder.build())
+        def resp = EntityUtils.toString(httpResp.entity)
+
+        // gephi streaming plugin does not set the content type or respect the Accept header - treat as text
+        if (resp.isEmpty())
+            return Optional.empty()
+        else
+            return Optional.of(new JsonSlurper().parseText(resp))
+    }
+
+    def updateGephiGraph(def Map postBody) {
+        def requestBuilder = RequestBuilder.post("http://$host:$port/$workspace")
+                                           .addParameter("format", "JSON")
+                                           .addParameter("operation", "updateGraph")
+                                           .setEntity(new StringEntity(JsonOutput.toJson(postBody)))
+        EntityUtils.consume(makeRequest(requestBuilder.build()).entity)
+    }
+
+    private CloseableHttpResponse makeRequest(HttpUriRequest request) {
+        def httpResp = httpclient.execute(request)
+        if (httpResp.getStatusLine().getStatusCode() == 200) {
+            return httpResp
+        } else {
+            def resp = EntityUtils.toString(httpResp.entity)
+            throw new RuntimeException("Unsuccessful request to Gephi - [${httpResp.getStatusLine().getStatusCode()}] ${httpResp.getStatusLine().getReasonPhrase()} - $resp")
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "Gephi - [$workspace]"
+    }
+
+    private void parseVizStepDelay(String arg) {
+        try {
+            vizStepDelay = Long.parseLong(arg)
+        } catch (Exception ignored) {
+            throw new RemoteException("The stepDelay must be a long value")
+        }
+    }
+
+    private void parseVizStartRGBColor(String arg) {
+        try {
+            vizStartRGBColor = arg[1..-2].tokenize(',')*.toFloat()
+            assert (vizStartRGBColor.length == 3)
+        } catch (Exception ignored) {
+            throw new RemoteException("The vizStartRGBColor must be an array of 3 float values, e.g. [0.0,1.0,0.5]")
+        }
+    }
+
+    private void parseVizColorToFade(String arg) {
+        try {
+            vizColorToFade = arg.charAt(0).toLowerCase();
+            assert (vizColorToFade == 'r' || vizColorToFade == 'g' || vizColorToFade == 'b')
+        } catch (Exception ignored) {
+            throw new RemoteException("The vizColorToFade must be one character value among: r, g, b, R, G, B")
+        }
+    }
+
+    private void parseVizColorFadeRate(String arg) {
+        try {
+            vizColorFadeRate = Float.parseFloat(arg)
+        } catch (Exception ignored) {
+            throw new RemoteException("The colorFadeRate must be a float value")
+        }
+    }
+
+    private void parseVizSizeDecrementRate(String arg) {
+        try {
+            vizSizeDecrementRate = Float.parseFloat(arg)
+        } catch (Exception ignored) {
+            throw new RemoteException("The sizeDecrementRate must be a float value")
+        }
+    }
+
+    private void parseVizStartSize(String arg) {
+        try {
+            vizStartSize = Float.parseFloat(arg)
+        } catch (Exception ignored) {
+            throw new RemoteException("The startSize must be a float value")
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
index dc63a2f..7a08a9d 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
@@ -68,9 +68,13 @@ class PluggedIn {
 
     public static class GremlinPluginAdapter implements GremlinPlugin {
         org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin corePlugin
+        private final Groovysh shell
+        private final IO io
 
-        public GremlinPluginAdapter(final org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin corePlugin) {
+        public GremlinPluginAdapter(final org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin corePlugin, final Groovysh shell, final IO io) {
             this.corePlugin = corePlugin
+            this.shell = shell
+            this.io = io
         }
 
         @Override
@@ -103,11 +107,11 @@ class PluggedIn {
         @Override
         Optional<RemoteAcceptor> remoteAcceptor() {
             // find a consoleCustomizer if available
-            if (!corePlugin.getCustomizers("gremlin-groovy").any{ it instanceof ConsoleCustomizer })
-                Optional.empty()
+            if (!corePlugin.getCustomizers("gremlin-groovy").isPresent() || !corePlugin.getCustomizers("gremlin-groovy").get().any{ it instanceof ConsoleCustomizer })
+                return Optional.empty()
 
-            ConsoleCustomizer customizer = (ConsoleCustomizer) corePlugin.getCustomizers("gremlin-groovy").find{ it instanceof ConsoleCustomizer }
-            return Optional.of(new RemoteAcceptorAdapter(customizer.remoteAcceptor))
+            ConsoleCustomizer customizer = (ConsoleCustomizer) corePlugin.getCustomizers("gremlin-groovy").get().find{ it instanceof ConsoleCustomizer }
+            return Optional.of(new RemoteAcceptorAdapter(customizer.getRemoteAcceptor([(ConsoleCustomizer.ENV_CONSOLE_SHELL): shell, (ConsoleCustomizer.ENV_CONSOLE_IO): io])))
         }
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverGremlinPlugin.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverGremlinPlugin.java
index 2c52bd5..2f8fc75 100644
--- a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverGremlinPlugin.java
+++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverGremlinPlugin.java
@@ -35,7 +35,9 @@ import java.util.Set;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.console.jsr223.DriverGremlinPlugin}.
  */
+@Deprecated
 public class DriverGremlinPlugin extends AbstractGremlinPlugin {
 
     private static final Set<String> IMPORTS = new HashSet<String>() {{

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java
index c346540..80e8194 100644
--- a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java
+++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java
@@ -50,7 +50,9 @@ import java.util.stream.Stream;
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.console.jsr223.DriverRemoteAcceptor}.
  */
+@Deprecated
 public class DriverRemoteAcceptor implements RemoteAcceptor {
     public static final int NO_TIMEOUT = 0;
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GephiGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GephiGremlinPlugin.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GephiGremlinPlugin.java
index 6977aa8..df0541f 100644
--- a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GephiGremlinPlugin.java
+++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GephiGremlinPlugin.java
@@ -29,6 +29,7 @@ import java.util.Optional;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.console.jsr223.GephiGremlinPlugin}.
  */
 public class GephiGremlinPlugin extends AbstractGremlinPlugin {
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPlugin.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPlugin.java
index 59c2b1a..d1c853d 100644
--- a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPlugin.java
+++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPlugin.java
@@ -34,6 +34,7 @@ import java.util.Set;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.console.jsr223.UtilitiesGremlinPlugin}.
  */
 public class UtilitiesGremlinPlugin extends AbstractGremlinPlugin {
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java
new file mode 100644
index 0000000..89cec10
--- /dev/null
+++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.console.jsr223;
+
+import org.apache.tinkerpop.gremlin.driver.Client;
+import org.apache.tinkerpop.gremlin.driver.Cluster;
+import org.apache.tinkerpop.gremlin.driver.Host;
+import org.apache.tinkerpop.gremlin.driver.LoadBalancingStrategy;
+import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
+import org.apache.tinkerpop.gremlin.driver.Result;
+import org.apache.tinkerpop.gremlin.driver.ResultSet;
+import org.apache.tinkerpop.gremlin.driver.Tokens;
+import org.apache.tinkerpop.gremlin.driver.exception.ConnectionException;
+import org.apache.tinkerpop.gremlin.driver.exception.ResponseException;
+import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
+import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
+import org.apache.tinkerpop.gremlin.driver.message.ResponseResult;
+import org.apache.tinkerpop.gremlin.driver.message.ResponseStatus;
+import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
+import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection;
+import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteTraversal;
+import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteTraversalSideEffects;
+import org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0;
+import org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0;
+import org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0;
+import org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0;
+import org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0;
+import org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0;
+import org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer;
+import org.apache.tinkerpop.gremlin.driver.ser.MessageTextSerializer;
+import org.apache.tinkerpop.gremlin.driver.ser.SerTokens;
+import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
+import org.apache.tinkerpop.gremlin.driver.ser.Serializers;
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer;
+import org.codehaus.groovy.tools.shell.Groovysh;
+
+import java.util.Map;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DriverGremlinPlugin extends AbstractGremlinPlugin {
+
+    private static final String NAME = "tinkerpop.server";
+
+    private static final ImportCustomizer imports = DefaultImportCustomizer.build()
+            .addClassImports(Cluster.class,
+                    Client.class,
+                    Host.class,
+                    LoadBalancingStrategy.class,
+                    MessageSerializer.class,
+                    Result.class,
+                    ResultSet.class,
+                    Tokens.class,
+                    ConnectionException.class,
+                    ResponseException.class,
+                    RequestMessage.class,
+                    ResponseMessage.class,
+                    ResponseResult.class,
+                    ResponseStatus.class,
+                    ResponseStatusCode.class,
+                    GraphSONMessageSerializerGremlinV1d0.class,
+                    GraphSONMessageSerializerGremlinV2d0.class,
+                    GraphSONMessageSerializerV1d0.class,
+                    GraphSONMessageSerializerV2d0.class,
+                    GryoLiteMessageSerializerV1d0.class,
+                    GryoMessageSerializerV1d0.class,
+                    JsonBuilderGryoSerializer.class,
+                    MessageTextSerializer.class,
+                    SerializationException.class,
+                    Serializers.class,
+                    SerTokens.class,
+                    DriverRemoteConnection.class,
+                    DriverRemoteTraversal.class,
+                    DriverRemoteTraversalSideEffects.class).create();
+
+    public DriverGremlinPlugin() {
+        super(NAME, imports, new DriverConsoleCustomizer());
+    }
+
+    private static class DriverConsoleCustomizer implements ConsoleCustomizer {
+        @Override
+        public org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor getRemoteAcceptor(final Map<String, Object> environment) {
+            return new DriverRemoteAcceptor((Groovysh) environment.get(ConsoleCustomizer.ENV_CONSOLE_SHELL));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverRemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverRemoteAcceptor.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverRemoteAcceptor.java
new file mode 100644
index 0000000..93ac184
--- /dev/null
+++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverRemoteAcceptor.java
@@ -0,0 +1,238 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.console.jsr223;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.apache.tinkerpop.gremlin.driver.Client;
+import org.apache.tinkerpop.gremlin.driver.Cluster;
+import org.apache.tinkerpop.gremlin.driver.Result;
+import org.apache.tinkerpop.gremlin.driver.ResultSet;
+import org.apache.tinkerpop.gremlin.driver.exception.ResponseException;
+import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
+import org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor;
+import org.apache.tinkerpop.gremlin.jsr223.console.RemoteException;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+import org.codehaus.groovy.tools.shell.Groovysh;
+
+import javax.security.sasl.SaslException;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.stream.Stream;
+
+/**
+ * A {@link RemoteAcceptor} that takes input from the console and sends it to Gremlin Server over the standard
+ * Java driver.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class DriverRemoteAcceptor implements RemoteAcceptor {
+    public static final int NO_TIMEOUT = 0;
+
+    private Cluster currentCluster;
+    private Client currentClient;
+    private int timeout = NO_TIMEOUT;
+    private Map<String,String> aliases = new HashMap<>();
+    private Optional<String> session = Optional.empty();
+
+    private static final String TOKEN_RESET = "reset";
+    private static final String TOKEN_SHOW = "show";
+
+    /**
+     * @deprecated As of 3.1.3, replaced by "none" option
+     */
+    @Deprecated
+    private static final String TOKEN_MAX = "max";
+    private static final String TOKEN_NONE = "none";
+    private static final String TOKEN_TIMEOUT = "timeout";
+    private static final String TOKEN_ALIAS = "alias";
+    private static final String TOKEN_SESSION = "session";
+    private static final String TOKEN_SESSION_MANAGED = "session-managed";
+    private static final List<String> POSSIBLE_TOKENS = Arrays.asList(TOKEN_TIMEOUT, TOKEN_ALIAS);
+
+    private final Groovysh shell;
+
+    public DriverRemoteAcceptor(final Groovysh shell) {
+        this.shell = shell;
+    }
+
+    @Override
+    public Object connect(final List<String> args) throws RemoteException {
+        if (args.size() < 1) throw new RemoteException("Expects the location of a configuration file as an argument");
+
+        try {
+            this.currentCluster = Cluster.open(args.get(0));
+            final boolean useSession = args.size() >= 2 && (args.get(1).equals(TOKEN_SESSION) || args.get(1).equals(TOKEN_SESSION_MANAGED));
+            if (useSession) {
+                final String sessionName = args.size() == 3 ? args.get(2) : UUID.randomUUID().toString();
+                session = Optional.of(sessionName);
+
+                final boolean managed = args.get(1).equals(TOKEN_SESSION_MANAGED);
+
+                this.currentClient = this.currentCluster.connect(sessionName, managed);
+            } else {
+                this.currentClient = this.currentCluster.connect();
+            }
+            this.currentClient.init();
+            return String.format("Configured %s", this.currentCluster) + getSessionStringSegment();
+        } catch (final FileNotFoundException ignored) {
+            throw new RemoteException("The 'connect' option must be accompanied by a valid configuration file");
+        } catch (final Exception ex) {
+            throw new RemoteException("Error during 'connect' - " + ex.getMessage(), ex);
+        }
+    }
+
+    @Override
+    public Object configure(final List<String> args) throws RemoteException {
+        final String option = args.size() == 0 ? "" : args.get(0);
+        if (!POSSIBLE_TOKENS.contains(option))
+            throw new RemoteException(String.format("The 'config' option expects one of ['%s'] as an argument", String.join(",", POSSIBLE_TOKENS)));
+
+        final List<String> arguments = args.subList(1, args.size());
+
+        if (option.equals(TOKEN_TIMEOUT)) {
+            final String errorMessage = "The timeout option expects a positive integer representing milliseconds or 'none' as an argument";
+            if (arguments.size() != 1) throw new RemoteException(errorMessage);
+            try {
+                // first check for MAX timeout then NONE and finally parse the config to int. "max" is now "deprecated"
+                // in the sense that it will no longer be promoted. support for it will be removed at a later date
+                timeout = arguments.get(0).equals(TOKEN_MAX) ? Integer.MAX_VALUE :
+                        arguments.get(0).equals(TOKEN_NONE) ? NO_TIMEOUT : Integer.parseInt(arguments.get(0));
+                if (timeout < NO_TIMEOUT) throw new RemoteException("The value for the timeout cannot be less than " + NO_TIMEOUT);
+                return timeout == NO_TIMEOUT ? "Remote timeout is disabled" : "Set remote timeout to " + timeout + "ms";
+            } catch (Exception ignored) {
+                throw new RemoteException(errorMessage);
+            }
+        } else if (option.equals(TOKEN_ALIAS)) {
+            if (arguments.size() == 1 && arguments.get(0).equals(TOKEN_RESET)) {
+                aliases.clear();
+                return "Aliases cleared";
+            }
+
+            if (arguments.size() == 1 && arguments.get(0).equals(TOKEN_SHOW)) {
+                return aliases;
+            }
+
+            if (arguments.size() % 2 != 0)
+                throw new RemoteException("Arguments to alias must be 'reset' to clear any existing alias settings or key/value alias/binding pairs");
+
+            final Map<String,Object> aliasMap = ElementHelper.asMap(arguments.toArray());
+            aliases.clear();
+            aliasMap.forEach((k,v) -> aliases.put(k, v.toString()));
+            return aliases;
+        }
+
+        return this.toString();
+    }
+
+    @Override
+    public Object submit(final List<String> args) throws RemoteException {
+        final String line = getScript(String.join(" ", args), this.shell);
+
+        try {
+            final List<Result> resultSet = send(line);
+            this.shell.getInterp().getContext().setProperty(RESULT, resultSet);
+            return resultSet.stream().map(result -> result.getObject()).iterator();
+        } catch (SaslException sasl) {
+            throw new RemoteException("Security error - check username/password and related settings", sasl);
+        } catch (Exception ex) {
+            final Optional<ResponseException> inner = findResponseException(ex);
+            if (inner.isPresent()) {
+                final ResponseException responseException = inner.get();
+                if (responseException.getResponseStatusCode() == ResponseStatusCode.SERVER_ERROR_SERIALIZATION)
+                    throw new RemoteException(String.format("Server could not serialize the result requested. Server error - %s. Note that the class must be serializable by the client and server for proper operation.", responseException.getMessage()));
+                else
+                    throw new RemoteException(responseException.getMessage());
+            } else if (ex.getCause() != null) {
+                final Throwable rootCause = ExceptionUtils.getRootCause(ex);
+                if (rootCause instanceof TimeoutException)
+                    throw new RemoteException("Host did not respond in a timely fashion - check the server status and submit again.");
+                else
+                    throw new RemoteException(rootCause.getMessage());
+            } else
+                throw new RemoteException(ex.getMessage());
+        }
+    }
+
+    @Override
+    public void close() throws IOException {
+        if (this.currentClient != null) this.currentClient.close();
+        if (this.currentCluster != null) this.currentCluster.close();
+    }
+
+    public int getTimeout() {
+        return timeout;
+    }
+
+    private List<Result> send(final String gremlin) throws SaslException {
+        try {
+            final ResultSet rs = this.currentClient.submitAsync(gremlin, aliases, Collections.emptyMap()).get();
+            return timeout > NO_TIMEOUT ? rs.all().get(timeout, TimeUnit.MILLISECONDS) : rs.all().get();
+        } catch(TimeoutException ignored) {
+            throw new IllegalStateException("Request timed out while processing - increase the timeout with the :remote command");
+        } catch (Exception e) {
+            // handle security error as-is and unwrapped
+            final Optional<Throwable> throwable  = Stream.of(ExceptionUtils.getThrowables(e)).filter(t -> t instanceof SaslException).findFirst();
+            if (throwable.isPresent())
+                throw (SaslException) throwable.get();
+
+            throw new IllegalStateException(e.getMessage(), e);
+        }
+    }
+
+    @Override
+    public boolean allowRemoteConsole() {
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "Gremlin Server - [" + this.currentCluster + "]" + getSessionStringSegment();
+    }
+
+    private Optional<ResponseException> findResponseException(final Throwable ex) {
+        if (ex instanceof ResponseException)
+            return Optional.of((ResponseException) ex);
+
+        if (null == ex.getCause())
+            return Optional.empty();
+
+        return findResponseException(ex.getCause());
+    }
+
+    private String getSessionStringSegment() {
+        return session.isPresent() ? String.format("-[%s]", session.get()) : "";
+    }
+
+    /**
+     * 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;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiGremlinPlugin.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiGremlinPlugin.java
new file mode 100644
index 0000000..7698112
--- /dev/null
+++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiGremlinPlugin.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.console.jsr223;
+
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer;
+import org.codehaus.groovy.tools.shell.Groovysh;
+import org.codehaus.groovy.tools.shell.IO;
+
+import java.util.Map;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GephiGremlinPlugin extends AbstractGremlinPlugin {
+    private static final String NAME = "tinkerpop.gephi";
+
+    public GephiGremlinPlugin() {
+        super(NAME, new GephiConsoleCustomizer());
+    }
+
+    private static class GephiConsoleCustomizer implements ConsoleCustomizer {
+        @Override
+        public org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor getRemoteAcceptor(final Map<String, Object> environment) {
+            return new GephiRemoteAcceptor((Groovysh) environment.get(ConsoleCustomizer.ENV_CONSOLE_SHELL),
+                    (IO) environment.get(ConsoleCustomizer.ENV_CONSOLE_IO));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/UtilitiesGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/UtilitiesGremlinPlugin.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/UtilitiesGremlinPlugin.java
new file mode 100644
index 0000000..57bacda
--- /dev/null
+++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/UtilitiesGremlinPlugin.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.console.jsr223;
+
+import groovyx.gbench.Benchmark;
+import groovyx.gbench.BenchmarkStaticExtension;
+import groovyx.gprof.ProfileStaticExtension;
+import groovyx.gprof.Profiler;
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultScriptCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.ScriptCustomizer;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class UtilitiesGremlinPlugin extends AbstractGremlinPlugin {
+
+    private static final String NAME = "tinkerpop.utilities";
+
+    private static final ImportCustomizer imports;
+
+    private static final ScriptCustomizer scripts;
+
+    static {
+        try {
+            imports = DefaultImportCustomizer.build()
+                    .addClassImports(groovyx.gbench.Benchmark.class,
+                            groovyx.gbench.BenchmarkBuilder.class,
+                            groovyx.gbench.BenchmarkConstants.class,
+                            groovyx.gbench.BenchmarkContext.class,
+                            groovyx.gbench.Benchmarker.class,
+                            groovyx.gbench.BenchmarkList.class,
+                            groovyx.gbench.BenchmarkLogger.class,
+                            groovyx.gbench.BenchmarkMath.class,
+                            groovyx.gbench.BenchmarkMeasure.class,
+                            groovyx.gbench.BenchmarkStaticExtension.class,
+                            groovyx.gbench.BenchmarkSystem.class,
+                            groovyx.gbench.BenchmarkTime.class,
+                            groovyx.gbench.BenchmarkWarmUp.class,
+                            groovyx.gprof.Profiler.class,
+                            groovyx.gprof.ProfileStaticExtension.class,
+                            groovyx.gprof.CallFilter.class,
+                            groovyx.gprof.CallInfo.class,
+                            groovyx.gprof.CallInterceptor.class,
+                            groovyx.gprof.CallMatcher.class,
+                            groovyx.gprof.CallTree.class,
+                            groovyx.gprof.MethodCallFilter.class,
+                            groovyx.gprof.MethodCallInfo.class,
+                            groovyx.gprof.MethodInfo.class,
+                            groovyx.gprof.ProfileMetaClass.class,
+                            groovyx.gprof.ProxyReport.class,
+                            groovyx.gprof.Report.class,
+                            groovyx.gprof.ReportElement.class,
+                            groovyx.gprof.ReportNormalizer.class,
+                            groovyx.gprof.ReportPrinter.class,
+                            groovyx.gprof.ThreadInfo.class,
+                            groovyx.gprof.ThreadRunFilter.class,
+                            groovyx.gprof.Utils.class)
+                    .addMethodImports(
+                            ProfileStaticExtension.class.getMethod("profile", Object.class, Callable.class),
+                            ProfileStaticExtension.class.getMethod("profile", Object.class, Map.class, Callable.class)).create();
+
+            final BufferedReader reader = new BufferedReader(new InputStreamReader(UtilitiesGremlinPlugin.class.getResourceAsStream("UtilitiesGremlinPluginScript.groovy")));
+            final List<String> lines = new ArrayList<>();
+            String line;
+            while ((line = reader.readLine()) != null) {
+                lines.add(line);
+            }
+            reader.close();
+
+            scripts = new DefaultScriptCustomizer(Collections.singletonList(lines));
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    public UtilitiesGremlinPlugin() {
+        super(NAME, imports, scripts);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin b/gremlin-console/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
new file mode 100644
index 0000000..631c889
--- /dev/null
+++ b/gremlin-console/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
@@ -0,0 +1,3 @@
+org.apache.tinkerpop.gremlin.console.jsr223.DriverGremlinPlugin
+org.apache.tinkerpop.gremlin.console.jsr223.GephiGremlinPlugin
+org.apache.tinkerpop.gremlin.console.jsr223.UtilitiesGremlinPlugin
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/jsr223/UtilitiesGremlinPluginScript.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/jsr223/UtilitiesGremlinPluginScript.groovy b/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/jsr223/UtilitiesGremlinPluginScript.groovy
new file mode 100644
index 0000000..5f5e3c6
--- /dev/null
+++ b/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/jsr223/UtilitiesGremlinPluginScript.groovy
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @author Daniel Kuppitz (http://thinkaurelius.com)
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+
+describeGraph = { Class<? extends org.apache.tinkerpop.gremlin.structure.Graph> c ->
+    def lf = System.getProperty("line.separator")
+    def optIns = c.getAnnotationsByType(org.apache.tinkerpop.gremlin.structure.Graph.OptIn)
+    def optOuts = c.getAnnotationsByType(org.apache.tinkerpop.gremlin.structure.Graph.OptOut)
+
+    def optInCount = optIns != null ? optIns.size() : 0
+    def optOutCount = optOuts != null ? optOuts.size() : 0
+    def suitesSupported = optIns != null && optIns.size() > 0 ? optIns.collect { "> " + it.value() }.join(lf) : "> none"
+    def testsOptedOut = optOuts != null && optOuts.size() > 0 ? optOuts.collect { "> " + it.test() + "#" + it.method() + "${lf}\t\"" + it.reason() + "\"" }.join(lf) : "> none";
+
+    // not the use of {lf} here rather than triple quoted string is that groovy 2.4.0 seems to have trouble
+    // parsing that into groovysh - note the bug report here: https://jira.codehaus.org/browse/GROOVY-7290
+    return "${lf}" +
+"IMPLEMENTATION - ${c.getCanonicalName()} ${lf}" +
+"TINKERPOP TEST SUITE ${lf}" +
+"- Compliant with ($optInCount of 10 suites) ${lf}" +
+"$suitesSupported ${lf}" +
+"- Opts out of $optOutCount individual tests ${lf}" +
+"$testsOptedOut ${lf}" +
+"- NOTE - ${lf}" +
+"The describeGraph() function shows information about a Graph implementation. ${lf}" +
+"It uses information found in Java Annotations on the implementation itself to ${lf}" +
+"determine this output and does not assess the actual code of the test cases of ${lf}" +
+"the implementation itself.  Compliant implementations will faithfully and ${lf}" +
+"honestly supply these Annotations to provide the most accurate depiction of ${lf}" +
+"their support."
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
index 77422da..dd582b1 100644
--- a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
+++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java
@@ -19,10 +19,7 @@
 package org.apache.tinkerpop.gremlin.console.groovy.plugin;
 
 import org.apache.tinkerpop.gremlin.console.plugin.PluggedIn;
-import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer;
 import org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin;
-import org.apache.tinkerpop.gremlin.jsr223.ScriptCustomizer;
-import org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin;
 import org.junit.Test;
 
 import java.time.DayOfWeek;
@@ -44,7 +41,7 @@ public class GremlinPluginAdapterTest {
                 .classImports(java.awt.Color.class, java.sql.CallableStatement.class)
                 .enumImports(DayOfWeek.SATURDAY, DayOfWeek.SUNDAY)
                 .methodImports(DayOfWeek.class.getMethod("from", TemporalAccessor.class), DayOfWeek.class.getMethod("values")).create();
-        final PluggedIn.GremlinPluginAdapter adapter = new PluggedIn.GremlinPluginAdapter(plugin);
+        final PluggedIn.GremlinPluginAdapter adapter = new PluggedIn.GremlinPluginAdapter(plugin, null, null);
 
         assertEquals(plugin.getName(), adapter.getName());