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/3171ec11
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/3171ec11
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/3171ec11

Branch: refs/heads/TINKERPOP-1562
Commit: 3171ec11fb22d8e449b33777ed250f7a8744826d
Parents: 117c886
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Dec 1 08:25:19 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Dec 1 08:25:19 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/3171ec11/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
             }

Reply via email to