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

Branch: refs/heads/TINKERPOP-1562
Commit: 1c052e69046c6691d65649cc54f19bfa0ef5094f
Parents: 32275a9
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 22 09:39:37 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Dec 1 06:41:42 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/1c052e69/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/1c052e69/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/1c052e69/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/1c052e69/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

Reply via email to