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/11/21 22:18:23 UTC

[1/7] tinkerpop git commit: TINKERPOP-1562 Add GremlinModule for Giraph.

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1562 492c8e160 -> bb4bcc7a0


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

Branch: refs/heads/TINKERPOP-1562
Commit: 996d2997a81359d6557dfd4f0ee656578c7ba31b
Parents: 492c8e1
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 07:54:35 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Nov 21 07:54:35 2016 -0500

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


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/996d2997/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


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

Branch: refs/heads/TINKERPOP-1562
Commit: e6acc00a634172a50cf327aa759fbbe594241253
Parents: 4694ab5
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 13:34:27 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Nov 21 13:34:27 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/e6acc00a/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/e6acc00a/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/e6acc00a/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/e6acc00a/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/e6acc00a/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/e6acc00a/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()));
+        }
+    }
 }


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

Branch: refs/heads/TINKERPOP-1562
Commit: bb4bcc7a0226950f818d035574b5dde1293199a4
Parents: e6acc00
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 17:15:53 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Nov 21 17:15:53 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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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/bb4bcc7a/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();


[4/7] 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/8d917fbb
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/8d917fbb
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/8d917fbb

Branch: refs/heads/TINKERPOP-1562
Commit: 8d917fbb3075a9750ff3ad210c4382e6bcd7e5ca
Parents: 9bcbda6
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 13:13:30 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Nov 21 13:13:30 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/8d917fbb/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/8d917fbb/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/8d917fbb/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/8d917fbb/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/8d917fbb/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/8d917fbb/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/8d917fbb/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/8d917fbb/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);


[5/7] 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/4694ab55
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/4694ab55
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/4694ab55

Branch: refs/heads/TINKERPOP-1562
Commit: 4694ab553234c295a130fdfad7260add5ef3d81a
Parents: 8d917fb
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 13:15:02 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Nov 21 13:15:02 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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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/4694ab55/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;


[3/7] 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/9bcbda63
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9bcbda63
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9bcbda63

Branch: refs/heads/TINKERPOP-1562
Commit: 9bcbda639218ce1ba2d0190fce5bb3b42067f610
Parents: b5aeff2
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 10:56:21 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Nov 21 10:56:21 2016 -0500

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


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bcbda63/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";


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

Branch: refs/heads/TINKERPOP-1562
Commit: b5aeff27565732470965f56bed517c735fadf5e6
Parents: 996d299
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 21 07:55:27 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Nov 21 07:55:27 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/b5aeff27/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/b5aeff27/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;
-    }
-}