Repository: tinkerpop Updated Branches: refs/heads/TINKERPOP-1989 [created] 6c75ceb25
TINKERPOP-1989 Enforce order of plugin load in Gremlin Console Use the order presented in the configuration file to enforce the load order. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/6c75ceb2 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/6c75ceb2 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/6c75ceb2 Branch: refs/heads/TINKERPOP-1989 Commit: 6c75ceb25d6a828489f29b883be99ae7739e09e0 Parents: 7c7dddb Author: Stephen Mallette <sp...@genoprime.com> Authored: Wed Jun 20 11:24:34 2018 -0400 Committer: Stephen Mallette <sp...@genoprime.com> Committed: Wed Jun 20 11:24:34 2018 -0400 ---------------------------------------------------------------------- CHANGELOG.asciidoc | 1 + .../apache/tinkerpop/gremlin/console/Console.groovy | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6c75ceb2/CHANGELOG.asciidoc ---------------------------------------------------------------------- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 05b74da..33fe5c4 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -31,6 +31,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima * Improved performance of `TraversalVertexProgram` and related infrastructure. * Added `createGratefulDead()`to `TinkerFactory` to help make it easier to try to instantiate that toy graph. * Added identifiers to edges in the Kitchen Sink toy graph. +* Ordered the loading of plugins in the Gremlin Console by their position in the configuration file. * Refactored the Gremlin Server integration testing framework and streamlined that infrastructure. * Fixed bug in `GroovyTranslator` that didn't properly handle empty `Map` objects. * Added concrete configuration methods to `SparkGraphComputer` to make a more clear API for configuring it. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6c75ceb2/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 4e54a42..ad41d6c 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 @@ -127,7 +127,7 @@ class Console { GremlinLoader.load() - // check for available plugins. if they are in the "active" plugins strategies then "activate" them + // check for available plugins on the path and track them by plugin class name def activePlugins = Mediator.readPluginState() def pluginClass = mediator.useV3d3 ? org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin : GremlinPlugin ServiceLoader.load(pluginClass, groovy.getInterp().getClassLoader()).each { plugin -> @@ -141,14 +141,16 @@ class Console { } mediator.availablePlugins.put(plugin.class.name, pluggedIn) + } + } - if (activePlugins.contains(plugin.class.name)) { - pluggedIn.activate() + // if there are active plugins then initialize them in the order that they are listed + activePlugins.each { pluginName -> + def pluggedIn = mediator.availablePlugins[pluginName] + pluggedIn.activate() - if (!io.quiet) - io.out.println(Colorizer.render(Preferences.infoColor, "plugin activated: " + plugin.getName())) - } - } + if (!io.quiet) + io.out.println(Colorizer.render(Preferences.infoColor, "plugin activated: " + pluggedIn.getPlugin().getName())) } // remove any "uninstalled" plugins from plugin state as it means they were installed, activated, but not