[3/3] tinkerpop git commit: Merge branch 'TINKERPOP-1363'
Merge branch 'TINKERPOP-1363' Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a8cec473 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a8cec473 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a8cec473 Branch: refs/heads/master Commit: a8cec47340868c3155b1246829205b197ffae1cf Parents: 0933189 dfe0be5 Author: Daniel KuppitzAuthored: Fri Dec 2 18:36:19 2016 +0100 Committer: Daniel Kuppitz Committed: Fri Dec 2 18:36:19 2016 +0100 -- CHANGELOG.asciidoc | 1 + docker/Dockerfile | 5 ++- docker/build/Dockerfile.template| 1 - docker/resources/groovy/grapeConfig.xml | 15 ++-- docker/scripts/build.sh | 14 +-- docs/preprocessor/install-plugins.sh| 6 ++- .../src/reference/gremlin-applications.asciidoc | 40 ++-- 7 files changed, 59 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a8cec473/CHANGELOG.asciidoc -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a8cec473/docs/src/reference/gremlin-applications.asciidoc --
[1/3] tinkerpop git commit: Installed Python and Subversion in the Docker base image and enable Python GLV for every Docker build.
Repository: tinkerpop Updated Branches: refs/heads/master 0933189f0 -> a8cec4734 Installed Python and Subversion in the Docker base image and enable Python GLV for every Docker build. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d4cf1f25 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d4cf1f25 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d4cf1f25 Branch: refs/heads/master Commit: d4cf1f2510ade945a2721857226c147540761ce2 Parents: 16180e1 Author: Daniel KuppitzAuthored: Tue Sep 13 02:30:34 2016 +0200 Committer: Daniel Kuppitz Committed: Wed Nov 30 01:23:35 2016 +0100 -- CHANGELOG.asciidoc | 1 + docker/Dockerfile| 5 - docker/build/Dockerfile.template | 1 - docker/scripts/build.sh | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d4cf1f25/CHANGELOG.asciidoc -- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 498ef23..272685a 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima TinkerPop 3.3.0 (Release Date: NOT OFFICIALLY RELEASED YET) ~~~ +* Updated Docker build scripts to include Python dependencies (NOTE: users should remove any previously generated TinkerPop Docker images). * Added "attachment requisite" `VertexProperty.element()` and `Property.element()` data in GraphSON serialization. * Added `Vertex`, `Edge`, `VertexProperty`, and `Property` serializers to Gremlin-Python and exposed tests that use graph object arguments. * `Bytecode.getSourceInstructions()` and `Bytecode.getStepInstructions()` now returns `List` instead of `Iterable`. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d4cf1f25/docker/Dockerfile -- diff --git a/docker/Dockerfile b/docker/Dockerfile index 87e8b07..ce3e62e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -24,7 +24,10 @@ RUN apt-get update \ && echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections \ && add-apt-repository -y ppa:webupd8team/java \ && apt-get update \ -&& apt-get install -y oracle-java8-installer curl gawk git maven openssh-server \ +&& apt-get install -y oracle-java8-installer curl gawk git maven openssh-server subversion \ +&& apt-get install -y python python-dev python-pip build-essential \ +&& pip install virtualenv virtualenvwrapper \ +&& pip install --upgrade pip \ && rm -rf /var/lib/apt/lists/* /var/cache/oracle-jdk8-installer RUN sed -i 's@PermitRootLogin without-password@PermitRootLogin yes@' /etc/ssh/sshd_config http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d4cf1f25/docker/build/Dockerfile.template -- diff --git a/docker/build/Dockerfile.template b/docker/build/Dockerfile.template index 8364884..84f551d 100644 --- a/docker/build/Dockerfile.template +++ b/docker/build/Dockerfile.template @@ -18,6 +18,5 @@ FROM tinkerpop:hadoop-HADOOP_VERSION RUN mkdir -p /usr/src/tinkerpop -RUN curl -s https://bootstrap.pypa.io/ez_setup.py | python WORKDIR /usr/src/tinkerpop COPY . /usr/src/tinkerpop http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d4cf1f25/docker/scripts/build.sh -- diff --git a/docker/scripts/build.sh b/docker/scripts/build.sh index 47da2b8..14e83c2 100755 --- a/docker/scripts/build.sh +++ b/docker/scripts/build.sh @@ -63,6 +63,8 @@ if [ -d "/usr/src/tinkermem" ]; then cd /usr/src/tinkermem fi +touch gremlin-python/.glv + mvn clean install process-resources ${TINKERPOP_BUILD_OPTIONS} || exit 1 [ -z "${BUILD_JAVA_DOCS}" ] || mvn process-resources -Djavadoc || exit 1
[2/3] tinkerpop git commit: Updated grapeConfig.xml for both - Docker's build script and the docs. Also fixed some issues in the plugin installation script.
Updated grapeConfig.xml for both - Docker's build script and the docs. Also fixed some issues in the plugin installation script. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/dfe0be59 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/dfe0be59 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/dfe0be59 Branch: refs/heads/master Commit: dfe0be596a8455c6caaceb01adf13a87720a5a9f Parents: d4cf1f2 Author: Daniel KuppitzAuthored: Mon Nov 28 19:22:05 2016 +0100 Committer: Daniel Kuppitz Committed: Wed Nov 30 01:24:31 2016 +0100 -- docker/resources/groovy/grapeConfig.xml | 15 ++-- docker/scripts/build.sh | 12 -- docs/preprocessor/install-plugins.sh| 6 ++- .../src/reference/gremlin-applications.asciidoc | 40 ++-- 4 files changed, 52 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dfe0be59/docker/resources/groovy/grapeConfig.xml -- diff --git a/docker/resources/groovy/grapeConfig.xml b/docker/resources/groovy/grapeConfig.xml index 1cdfeb4..fca3ba2 100644 --- a/docker/resources/groovy/grapeConfig.xml +++ b/docker/resources/groovy/grapeConfig.xml @@ -1,15 +1,22 @@ + + + + + + + + + - http://repository.codehaus.org/; m2compatible="true"/> - http://central.maven.org/maven2/; m2compatible="true"/> - http://download.java.net/maven/2/; m2compatible="true"/> - http://obelix.ics.uci.edu/nexus/content/groups/hyracks-public-releases/; m2compatible="true"/> + + https://jitpack.io; m2compatible="true"/> http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dfe0be59/docker/scripts/build.sh -- diff --git a/docker/scripts/build.sh b/docker/scripts/build.sh index 14e83c2..980b1db 100755 --- a/docker/scripts/build.sh +++ b/docker/scripts/build.sh @@ -57,10 +57,14 @@ TINKERPOP_BUILD_OPTIONS="" [ -z "${BUILD_JAVA_DOCS}" ] && TINKERPOP_BUILD_OPTIONS="${TINKERPOP_BUILD_OPTIONS} -Dmaven.javadoc.skip=true" # If the tmpfs (in-memory filesystem exists, use it) -if [ -d "/usr/src/tinkermem" ]; then - echo Copying source to in-memory tmpfs - rsync -a . /usr/src/tinkermem - cd /usr/src/tinkermem +TINKERMEM_PATH=$(cd .. ; echo `pwd`/tinkermem) +if [ -d "${TINKERMEM_PATH}" ]; then + echo "Moving source to in-memory tmpfs" + rsync --remove-source-files -a . ${TINKERMEM_PATH} + cd .. + rm -rf ${OLDPWD} + ln -s ${TINKERMEM_PATH} ${OLDPWD} + cd ${TINKERMEM_PATH} fi touch gremlin-python/.glv http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dfe0be59/docs/preprocessor/install-plugins.sh -- diff --git a/docs/preprocessor/install-plugins.sh b/docs/preprocessor/install-plugins.sh index d37489e..990dbe4 100755 --- a/docs/preprocessor/install-plugins.sh +++ b/docs/preprocessor/install-plugins.sh @@ -59,7 +59,11 @@ echo "System.exit(0)" >> ${INSTALL_FILE} echo -ne " * tinkerpop-sugar ... " pushd ${CONSOLE_HOME} > /dev/null -bin/gremlin.sh ${INSTALL_FILE} > /dev/null + +mkdir -p ~/.java/.userPrefs +chmod 700 ~/.java/.userPrefs + +bin/gremlin.sh -e ${INSTALL_FILE} > /dev/null if [ ${PIPESTATUS[0]} -ne 0 ]; then popd > /dev/null http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dfe0be59/docs/src/reference/gremlin-applications.asciidoc -- diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc index 7d14e46..9525fa0 100644 --- a/docs/src/reference/gremlin-applications.asciidoc +++ b/docs/src/reference/gremlin-applications.asciidoc @@ -31,12 +31,12 @@ Console and Server, where a universal plugin system makes it possible to extend important aspects of the plugin system is the ability to help the user install the plugins through the command line thus automating the process of gathering dependencies and other error prone activities. -The process of plugin installation is handled by link:http://groovy.codehaus.org/Grape[Grape], which helps resolve +The process of plugin installation is handled by link:http://www.groovy-lang.org/Grape[Grape], which helps resolve dependencies into the classpath. It is therefore important to ensure that Grape is properly configured in order to use the automated capabilities of plugin installation. Grape is configured by `~/.groovy/grapeConfig.xml` and generally speaking, if that file is not present, the
[38/50] tinkerpop git commit: TINKERPOP-1562 Update upgrade docs with ScriptEngine changes.
TINKERPOP-1562 Update upgrade docs with ScriptEngine changes. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/00ccf0fe Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/00ccf0fe Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/00ccf0fe Branch: refs/heads/TINKERPOP-1562 Commit: 00ccf0fe0b728bd742f9b6f9c1cf6936f4f07b27 Parents: 8368921 Author: Stephen MalletteAuthored: Wed Nov 30 18:42:49 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:50 2016 -0500 -- .../upgrade/release-3.2.x-incubating.asciidoc | 50 1 file changed, 50 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/00ccf0fe/docs/src/upgrade/release-3.2.x-incubating.asciidoc -- diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc index 2b38906..8a184b4 100644 --- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc +++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc @@ -55,6 +55,56 @@ This has been changed to a regular `NoSuchElementException` that includes the st See: link:https://issues.apache.org/jira/browse/TINKERPOP-1330[TINKERPOP-1330] +ScriptEngine support in gremlin-core + + +`ScriptEngine` and `GremlinPlugin` infrastructure has been moved from gremlin-groovy to gremlin-core to allow for +better re-use across different Gremlin Language Variants. At this point, this change is non-breaking as it was +implemented through deprecation. + +The basic concept of a `ScriptEngine` has been replaced by the notion of a `GremlinScriptEngine` (i.e. a +"ScriptEngine" that is specifically tuned for executing Gremlin-related scripts). "ScriptEngine" infrastructure has +been developed to help support this new interface, specifically `GremlinScriptEngineFactory` and +`GremlinScriptEngineManager`. Prefer use of this infrastructure when instantiating a `GremlinScriptEngine` rather +than trying to instantiate directly. + +For example, rather than instantiate a `GremlinGroovyScriptEngine` with the constructor: + +[source,java] + +GremlinScriptEngine engine = new GremlinGroovyScriptEngine(); + + +prefer to instantiate it as follows: + +[source,java] + +GremlinScriptEngineManager manager = new CachedGremlinScriptEngineManager(); +GremlinScriptEngine engine = manager.getEngineByName("gremlin-groovy"); + + +Related to the addition of `GremlinScriptEngine`, `org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin` in +gremlin-groovy has been deprecated and then replaced by `org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin`. The new +version of `GremlinPlugin` is similar but does carry some new methods to implement that involves the new `Customizer` +interface. The `Customizer` interface is the way in which `GremlinScriptEngine` instance can be configured with +imports, initialization scripts, compiler options, etc. + +Note that a `GremlinPlugin` can be applied to a `GremlinScriptEngine` by adding it to the `GremlinScriptEngineManager` +that creates it. + +[source,java] + +GremlinScriptEngineManager manager = new CachedGremlinScriptEngineManager(); +manager.addPlugin(ImportGremlinPlugin.build().classImports(java.awt.Color.class).create()); +GremlinScriptEngine engine = manager.getEngineByName("gremlin-groovy"); + + +All of this new infrastructure is currently optional on the 3.2.x line of code. More detailed documentation will for +these changes will be supplied as part of 3.3.0 when these features become mandatory and the deprecated code is +removed. + +See: link:https://issues.apache.org/jira/browse/TINKERPOP-1562[TINKERPOP-1562] + Upgrading for Providers ~~~
[35/50] tinkerpop git commit: TINKERPOP=1562 Loaded "gremlin" imports in the scriptengines
TINKERPOP=1562 Loaded "gremlin" imports in the scriptengines Rather than load them in the DefaultGremlinScriptEngineManager it seemed better to get them loaded in the engines themselves that way if someone opted to construct the GremlinScriptEngine directly the imports would be present. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/80f79bcc Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/80f79bcc Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/80f79bcc Branch: refs/heads/TINKERPOP-1562 Commit: 80f79bcc4d296662faf0e5296607f274ac9e3ab5 Parents: 9f33bee Author: Stephen MalletteAuthored: Mon Nov 28 16:51:12 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:50 2016 -0500 -- .../tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java | 3 ++- .../jsr223/DefaultGremlinScriptEngineManager.java| 3 --- .../gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java | 8 ++-- .../gremlin/python/jsr223/GremlinJythonScriptEngine.java | 11 ++- .../gremlin/jsr223/GremlinEnabledScriptEngineTest.java | 5 ++--- 5 files changed, 16 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80f79bcc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java index d579691..a3063cf 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java @@ -24,7 +24,8 @@ import java.util.Optional; /** * This module is required for a {@code ScriptEngine} to be Gremlin-enabled. This {@link GremlinPlugin} is not enabled - * for the {@code ServiceLoader}. It is designed to be instantiated manually. + * for the {@code ServiceLoader}. It is designed to be instantiated manually and compliant {@link GremlinScriptEngine} + * instances will automatically install it by default when created. * * @author Stephen Mallette (http://stephen.genoprime.com) */ http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80f79bcc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java index 1484f90..34ef995 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java @@ -404,9 +404,6 @@ public class DefaultGremlinScriptEngineManager implements GremlinScriptEngineMan } private void initEngines(final ClassLoader loader) { -// always need this module for a scriptengine to be "Gremlin-enabled" -plugins.add(CoreGremlinPlugin.instance()); - Iterator itty; try { final ServiceLoader sl = AccessController.doPrivileged( http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80f79bcc/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java -- diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java index 3ce400e..264587a 100644 --- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java +++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java @@ -38,6 +38,7 @@ import org.apache.tinkerpop.gremlin.groovy.loaders.GremlinLoader; import org.apache.tinkerpop.gremlin.groovy.plugin.Artifact; import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin; import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPluginException; +import org.apache.tinkerpop.gremlin.jsr223.CoreGremlinPlugin; import org.apache.tinkerpop.gremlin.jsr223.Customizer; import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine; import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngineFactory; @@ -184,7 +185,7 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
[28/50] tinkerpop git commit: TINKERPOP-1562 Added more tests for the GremlnPluginAdapter
TINKERPOP-1562 Added more tests for the GremlnPluginAdapter Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/35c8fcd6 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/35c8fcd6 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/35c8fcd6 Branch: refs/heads/TINKERPOP-1562 Commit: 35c8fcd651cf0f4788eb4e0435ed7fa966304d5c Parents: 33460fc Author: Stephen MalletteAuthored: Wed Nov 23 15:36:13 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:51 2016 -0500 -- .../groovy/plugin/GremlinPluginAdapterTest.java | 70 .../groovy/plugin/script-customizer-1.groovy| 3 + .../groovy/plugin/script-customizer-2.groovy| 2 + pom.xml | 1 + 4 files changed, 76 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/35c8fcd6/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java -- diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java index dd582b1..c3ade04 100644 --- a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java +++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java @@ -18,12 +18,28 @@ */ package org.apache.tinkerpop.gremlin.console.groovy.plugin; +import org.apache.tinkerpop.gremlin.TestHelper; import org.apache.tinkerpop.gremlin.console.plugin.PluggedIn; +import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer; +import org.apache.tinkerpop.gremlin.jsr223.Customizer; +import org.apache.tinkerpop.gremlin.jsr223.DefaultBindingsCustomizer; +import org.apache.tinkerpop.gremlin.jsr223.DefaultScriptCustomizer; +import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin; import org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin; +import org.apache.tinkerpop.gremlin.jsr223.ScriptCustomizer; +import org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin; import org.junit.Test; +import javax.script.Bindings; +import javax.script.SimpleBindings; +import java.io.File; import java.time.DayOfWeek; import java.time.temporal.TemporalAccessor; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; import java.util.Set; import static org.hamcrest.MatcherAssert.assertThat; @@ -57,4 +73,58 @@ public class GremlinPluginAdapterTest { assertThat(imports, hasItems("import static " + DayOfWeek.class.getCanonicalName() + ".from")); assertThat(imports, hasItems("import static " + DayOfWeek.class.getCanonicalName() + ".values")); } + +@Test +public void shouldAdaptForScriptCustomizer() throws Exception { +final File scriptFile1 = TestHelper.generateTempFileFromResource(GremlinPluginAdapterTest.class, "script-customizer-1.groovy", ".groovy"); +final File scriptFile2 = TestHelper.generateTempFileFromResource(GremlinPluginAdapterTest.class, "script-customizer-2.groovy", ".groovy"); +final Set files = new HashSet<>(); +files.add(scriptFile1.getAbsolutePath()); +files.add(scriptFile2.getAbsolutePath()); +final ScriptFileGremlinPlugin plugin = ScriptFileGremlinPlugin.build().files(files).create(); +final PluggedIn.GremlinPluginAdapter adapter = new PluggedIn.GremlinPluginAdapter(plugin, null, null); + +assertEquals(plugin.getName(), adapter.getName()); + +final List evals = new ArrayList<>(); +final SpyPluginAcceptor spy = new SpyPluginAcceptor(evals::add); +adapter.pluginTo(spy); + +assertEquals("x = 1 + 1\n" + + "y = 10 * x\n" + + "z = 1 + x + y", evals.get(0)); +assertEquals("l = g.V(z).out()\n" + + ".group().by('name')", evals.get(1)); +} + +@Test +public void shouldAdaptForBindingsCustomizer() throws Exception { +final Bindings bindings = new SimpleBindings(); +bindings.put("x", 1); +bindings.put("y", "yes"); +bindings.put("z", true); +final BindingsCustomizer bindingsCustomizer = new DefaultBindingsCustomizer(bindings); +final GremlinPlugin plugin = new GremlinPlugin() { +@Override +public String getName() { +return "anon-bindings"; +} + +@Override +public Optional
[09/50] tinkerpop git commit: TINKERPOP-1562 Moved GremlinServerGremlinModule to standard directory structure
TINKERPOP-1562 Moved GremlinServerGremlinModule to standard directory structure Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a596da34 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a596da34 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a596da34 Branch: refs/heads/TINKERPOP-1562 Commit: a596da3490f271ca6787d3c10444b6b2f099bb4d Parents: 299ad1c Author: Stephen MalletteAuthored: Mon Nov 21 07:55:27 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:50 2016 -0500 -- .../jsr223/GremlinServerGremlinModule.java | 42 .../server/util/GremlinServerGremlinModule.java | 41 --- 2 files changed, 42 insertions(+), 41 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a596da34/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinModule.java -- diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinModule.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinModule.java new file mode 100644 index 000..b161f69 --- /dev/null +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinModule.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tinkerpop.gremlin.server.jsr223; + +import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinModule; +import org.apache.tinkerpop.gremlin.jsr223.GremlinModule; +import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer; +import org.apache.tinkerpop.gremlin.server.util.LifeCycleHook; + +/** + * A {@link GremlinModule} implementation that adds Gremlin Server specific classes to the imports. + * + * @author Stephen Mallette (http://stephen.genoprime.com) + */ +public final class GremlinServerGremlinModule extends AbstractGremlinModule { +private static final String MODULE_NAME = "tinkerpop.server"; +private static final GremlinServerGremlinModule instance = new GremlinServerGremlinModule(); + +private GremlinServerGremlinModule() { +super(MODULE_NAME, ImportCustomizer.build().addClassImports(LifeCycleHook.class, LifeCycleHook.Context.class).create()); +} + +public static GremlinServerGremlinModule instance() { +return instance; +} +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a596da34/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/GremlinServerGremlinModule.java -- diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/GremlinServerGremlinModule.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/GremlinServerGremlinModule.java deleted file mode 100644 index 863c640..000 --- 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; -
[10/50] tinkerpop git commit: TINKERPOP-1562 Initial effort to deprecate ScriptEngines.
TINKERPOP-1562 Initial effort to deprecate ScriptEngines. This opens up some options for how to move plugins up to gremlin-core (or deprecate them completely - not surehow that will flow yet). Anyway, this is a wip commit and a nice stop point. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/ddafaef9 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/ddafaef9 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/ddafaef9 Branch: refs/heads/TINKERPOP-1562 Commit: ddafaef99a7a4dbf7d434b845f43e24e14deea19 Parents: 53e932b Author: Stephen MalletteAuthored: Thu Nov 17 16:47:31 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:50 2016 -0500 -- .../gremlin/jsr223/AbstractGremlinModule.java | 48 + .../gremlin/jsr223/CoreGremlinModule.java | 43 - .../gremlin/jsr223/ImportCustomizer.java| 4 + .../gremlin/jsr223/ImportGremlinModule.java | 174 +++ .../gremlin/jsr223/ScriptCustomizer.java| 56 ++ .../gremlin/jsr223/ScriptFileModule.java| 71 .../gremlin/jsr223/ImportGremlinModuleTest.java | 149 .../gremlin/groovy/engine/GremlinExecutor.java | 76 +++- .../gremlin/groovy/engine/ScriptEngines.java| 2 + .../tinkerpop/gremlin/server/Settings.java | 8 + .../server/util/ServerGremlinExecutor.java | 28 ++- 11 files changed, 648 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ddafaef9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java new file mode 100644 index 000..36104f6 --- /dev/null +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tinkerpop.gremlin.jsr223; + +import java.util.Optional; +import java.util.Set; + +/** + * @author Stephen Mallette (http://stephen.genoprime.com) + */ +public abstract class AbstractGremlinModule implements GremlinModule { +protected final String moduleName; +protected final Customizer[] customizers; +protected final Set appliesTo; + +public AbstractGremlinModule(final String moduleName, final Set appliesTo, final Customizer... customizers) { +this.moduleName = moduleName; +this.appliesTo = appliesTo; +this.customizers = customizers; +} + +@Override +public String getName() { +return moduleName; +} + +@Override +public Optional getCustomizers(final String scriptEngineName) { +return null == scriptEngineName || appliesTo.isEmpty() || appliesTo.contains(scriptEngineName) ? +Optional.of(customizers) : Optional.empty(); +} +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ddafaef9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java index dfe9f93..f1fdbe4 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java @@ -18,6 +18,8 @@ */ package org.apache.tinkerpop.gremlin.jsr223; +import org.apache.tinkerpop.gremlin.util.CoreImports; + import java.util.Optional; /** @@ -25,21 +27,54 @@ import java.util.Optional; * * @author Stephen Mallette (http://stephen.genoprime.com) */ -public
[49/50] tinkerpop git commit: TINKERPOP-1562 Deprecated GremlinGroovyScriptEngine.close()
TINKERPOP-1562 Deprecated GremlinGroovyScriptEngine.close() In the future GremlinGroovyScriptEngine will not implement AutoCloseable - there was never really a need for that. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/338002ab Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/338002ab Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/338002ab Branch: refs/heads/TINKERPOP-1562 Commit: 338002ab79b7f651885ffd950f64f5d34655f0ef Parents: d68f693 Author: Stephen MalletteAuthored: Thu Dec 1 10:15:49 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:51 2016 -0500 -- .../gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java| 5 + 1 file changed, 5 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/338002ab/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java -- diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java index 0f36dbf..1fb2efc 100644 --- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java +++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java @@ -384,7 +384,12 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl return (Traversal.Admin) this.eval(GroovyTranslator.of(traversalSource).translate(bytecode), bindings); } +/** + * @deprecated As of release 3.2.4, not replaced as this class will not implement {@code AutoCloseable} in the + * future. + */ @Override +@Deprecated public void close() throws Exception { }
[41/50] tinkerpop git commit: TINKERPOP-1562 Fix yet another compilation error.
TINKERPOP-1562 Fix yet another compilation error. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/9218e8a1 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9218e8a1 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9218e8a1 Branch: refs/heads/TINKERPOP-1562 Commit: 9218e8a1b4b532fbbfdcba00f005c8e9fdf95c59 Parents: 873ac61 Author: Stephen MalletteAuthored: Tue Nov 29 17:03:34 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:50 2016 -0500 -- .../gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9218e8a1/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java -- diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java index c3ade04..cb6fa60 100644 --- a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java +++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java @@ -78,7 +78,7 @@ public class GremlinPluginAdapterTest { public void shouldAdaptForScriptCustomizer() throws Exception { final File scriptFile1 = TestHelper.generateTempFileFromResource(GremlinPluginAdapterTest.class, "script-customizer-1.groovy", ".groovy"); final File scriptFile2 = TestHelper.generateTempFileFromResource(GremlinPluginAdapterTest.class, "script-customizer-2.groovy", ".groovy"); -final Set files = new HashSet<>(); +final List files = new ArrayList<>(); files.add(scriptFile1.getAbsolutePath()); files.add(scriptFile2.getAbsolutePath()); final ScriptFileGremlinPlugin plugin = ScriptFileGremlinPlugin.build().files(files).create();
[17/50] tinkerpop git commit: TINKERPOP-1562 Add new Neo4j GremlinPlugin and deprecated old one
TINKERPOP-1562 Add new Neo4j GremlinPlugin and deprecated old one Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/2e65a113 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2e65a113 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2e65a113 Branch: refs/heads/TINKERPOP-1562 Commit: 2e65a113e2a9e0b56bcbdba4c124cb1590759cf3 Parents: c41250c Author: Stephen MalletteAuthored: Tue Nov 22 11:15:57 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:51 2016 -0500 -- .../groovy/plugin/AbstractGremlinPlugin.java| 2 + .../neo4j/groovy/plugin/Neo4jGremlinPlugin.java | 1 + .../neo4j/jsr223/Neo4jGremlinPlugin.java| 71 ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin | 1 + ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin | 1 + .../jsr223/TinkerGraphGremlinPlugin.java| 7 +- 6 files changed, 78 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e65a113/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/AbstractGremlinPlugin.java -- diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/AbstractGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/AbstractGremlinPlugin.java index fcc8d05..090da6e 100644 --- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/AbstractGremlinPlugin.java +++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/AbstractGremlinPlugin.java @@ -30,7 +30,9 @@ import java.util.Map; * shell and io objects. * * @author Stephen Mallette (http://stephen.genoprime.com) + * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin}. */ +@Deprecated public abstract class AbstractGremlinPlugin implements GremlinPlugin { public static final String ENV_CONSOLE_IO = "ConsolePluginAcceptor.io"; public static final String ENV_CONSOLE_SHELL = "ConsolePluginAcceptor.shell"; http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e65a113/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java -- diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java index f3fe37c..9053cf3 100644 --- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java +++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/groovy/plugin/Neo4jGremlinPlugin.java @@ -30,6 +30,7 @@ import java.util.Set; /** * @author Stephen Mallette (http://stephen.genoprime.com) + * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.neo4j.jsr223.Neo4jGremlinPlugin}. */ public final class Neo4jGremlinPlugin extends AbstractGremlinPlugin { http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e65a113/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/jsr223/Neo4jGremlinPlugin.java -- diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/jsr223/Neo4jGremlinPlugin.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/jsr223/Neo4jGremlinPlugin.java new file mode 100644 index 000..82a8d18 --- /dev/null +++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/jsr223/Neo4jGremlinPlugin.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tinkerpop.gremlin.neo4j.jsr223; + +import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin; +import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
[39/50] tinkerpop git commit: TINKERPOP-1562 Use List of files to preserve order in script customzier
TINKERPOP-1562 Use List of files to preserve order in script customzier Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/2d49710b Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2d49710b Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2d49710b Branch: refs/heads/TINKERPOP-1562 Commit: 2d49710b2f7a45453aa1165074440e704a007044 Parents: 8dc9b1f Author: Stephen MalletteAuthored: Tue Nov 29 16:29:10 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:50 2016 -0500 -- .../tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java | 3 +-- .../tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java | 4 +++- .../tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d49710b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java index 9640f28..c996cae 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java @@ -24,7 +24,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.Collection; import java.util.List; -import java.util.Set; import java.util.stream.Collectors; /** @@ -37,7 +36,7 @@ public class DefaultScriptCustomizer implements ScriptCustomizer { private final Collection scripts; -public DefaultScriptCustomizer(final Set files) { +public DefaultScriptCustomizer(final List files) { this(files.stream().map(f -> { try { return Files.lines(f.toPath(), StandardCharsets.UTF_8).collect(Collectors.toList()); http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d49710b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java index 757001c..93ad9d8 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java @@ -20,8 +20,10 @@ package org.apache.tinkerpop.gremlin.jsr223; import java.io.File; import java.io.FileNotFoundException; +import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; +import java.util.List; import java.util.Set; /** @@ -44,7 +46,7 @@ public final class ScriptFileGremlinPlugin extends AbstractGremlinPlugin { public static final class Builder { private final Set appliesTo = new HashSet<>(); -private Set files = new HashSet<>(); +private List files = new ArrayList<>(); private Builder() {} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d49710b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java -- diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java index 3e4da13..07ab770 100644 --- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java +++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizerTest.java @@ -23,10 +23,9 @@ import org.junit.Test; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; -import java.util.HashSet; import java.util.List; -import java.util.Set; import static org.junit.Assert.assertEquals; @@ -39,7 +38,7 @@ public class DefaultScriptCustomizerTest { public void shouldOpenViaPropertiesFileConfig() throws IOException { final File scriptFile1 = TestHelper.generateTempFileFromResource(DefaultScriptCustomizerTest.class, "script-customizer-1.groovy", ".groovy"); final File scriptFile2 = TestHelper.generateTempFileFromResource(DefaultScriptCustomizerTest.class, "script-customizer-2.groovy", ".groovy"); -final Set files = new
[32/50] tinkerpop git commit: TINKERPOP-1562 Get customizers for both python and jython.
TINKERPOP-1562 Get customizers for both python and jython. The customizers are combined to a set and therefore should only apply once. Presumably there wouldn't be a different set of customizers for one versus the other. If there were and you wanted them separate I guess you'd have to build two separate script engine instances. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/9f33bee4 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9f33bee4 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9f33bee4 Branch: refs/heads/TINKERPOP-1562 Commit: 9f33bee4d75ee359c6687d4b777bb687a459925f Parents: 05ff0c0 Author: Stephen MalletteAuthored: Sat Nov 26 07:37:28 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:49 2016 -0500 -- .../python/jsr223/GremlinJythonScriptEngineFactory.java | 6 +- .../gremlin/jsr223/GremlinEnabledScriptEngineTest.java | 11 +++ 2 files changed, 16 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9f33bee4/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java -- diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java index 696c2ea..34978a7 100644 --- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java +++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngineFactory.java @@ -29,7 +29,9 @@ import org.python.jsr223.PyScriptEngineFactory; import javax.script.ScriptEngine; import java.util.Arrays; import java.util.Collections; +import java.util.HashSet; import java.util.List; +import java.util.Set; /** * @author Marko A. Rodriguez (http://markorodriguez.com) @@ -101,7 +103,9 @@ public class GremlinJythonScriptEngineFactory extends PyScriptEngineFactory impl @Override public GremlinScriptEngine getScriptEngine() { -final List customizers = manager.getCustomizers(GREMLIN_JYTHON); +final Set customizers = new HashSet<>(manager.getCustomizers(GREMLIN_JYTHON)); +customizers.addAll(manager.getCustomizers(GREMLIN_PYTHON)); + return (customizers.isEmpty()) ? new GremlinJythonScriptEngine() : new GremlinJythonScriptEngine(customizers.toArray(new Customizer[customizers.size()])); } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9f33bee4/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java -- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java index f6bbcb8..8fa70b0 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java @@ -25,6 +25,7 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty; import org.junit.Test; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Optional; @@ -79,4 +80,14 @@ public class GremlinEnabledScriptEngineTest { assertEquals(clazz, scriptEngine.eval(clazz.getSimpleName())); } } + +@Test +public void shouldReturnOneCustomizers() { +// just returns the core plugin as the other assigned plugin doesn't match the tested engine +final GremlinScriptEngineManager mgr = new DefaultGremlinScriptEngineManager(); +mgr.addPlugin(ImportGremlinPlugin.build() +.classImports(java.awt.Color.class) + .appliesTo(Collections.singletonList("fake-script-engine")).create()); +assertEquals(1, mgr.getCustomizers(ENGINE_TO_TEST).size()); +} }
[23/50] tinkerpop git commit: TINKERPOP-1562 Add new HadoopGremlinPlugin and deprecated the old.
TINKERPOP-1562 Add new HadoopGremlinPlugin and deprecated the old. Had to add some capabilities to plugin system to allow for passing of console environment bits (like groovysh for example). Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d0c941e8 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d0c941e8 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d0c941e8 Branch: refs/heads/TINKERPOP-1562 Commit: d0c941e86ccd561576552cdda9c58424462def9d Parents: 2e65a11 Author: Stephen MalletteAuthored: Tue Nov 22 13:41:58 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:51 2016 -0500 -- .../gremlin/console/plugin/PluggedIn.groovy | 2 +- .../gremlin/jsr223/LazyBindingsCustomizer.java | 41 + .../jsr223/console/ConsoleCustomizer.java | 7 +- .../jsr223/console/LazyBindingsCustomizer.java | 41 - .../gremlin/jsr223/console/RemoteAcceptor.java | 3 +- .../gremlin/groovy/plugin/PluginAcceptor.java | 2 +- .../groovy/plugin/HadoopGremlinPlugin.java | 2 + .../groovy/plugin/HadoopRemoteAcceptor.java | 2 + .../hadoop/jsr223/HadoopGremlinPlugin.java | 154 +++ .../hadoop/jsr223/HadoopRemoteAcceptor.java | 127 +++ ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin | 1 + .../neo4j/groovy/plugin/Neo4jGremlinPlugin.java | 1 + .../spark/jsr223/SparkGremlinPlugin.java| 2 +- 13 files changed, 339 insertions(+), 46 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy index b707226..dc63a2f 100644 --- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy +++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy @@ -90,7 +90,7 @@ class PluggedIn { } else if (it instanceof ScriptCustomizer) { it.getScripts().collect { it.join(LINE_SEPARATOR) }.each { pluginAcceptor.eval(it) } } else if (it instanceof BindingsCustomizer) { -it.bindings.entrySet().each { k, v -> pluginAcceptor.addBinding(k,v) } +it.bindings.entrySet().each { kv -> pluginAcceptor.addBinding(kv.key, kv.value) } } } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0c941e8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java new file mode 100644 index 000..4117ae5 --- /dev/null +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tinkerpop.gremlin.jsr223; + +import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer; + +import javax.script.Bindings; +import java.util.function.Supplier; + +/** + * @author Stephen Mallette (http://stephen.genoprime.com) + */ +public class LazyBindingsCustomizer implements BindingsCustomizer { + +private final Supplier bindingsSupplier; + +public LazyBindingsCustomizer(final Supplier bindingsSupplier) { +this.bindingsSupplier = bindingsSupplier; +} + +@Override +public Bindings getBindings() { +return bindingsSupplier.get(); +} +}
[18/50] tinkerpop git commit: TINKERPOP-1562 Deprecated TinkerGraphGremlinPlugin.
TINKERPOP-1562 Deprecated TinkerGraphGremlinPlugin. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/f5a1ebb5 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/f5a1ebb5 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/f5a1ebb5 Branch: refs/heads/TINKERPOP-1562 Commit: f5a1ebb54f698b4957435e05297befcc2ab97ef9 Parents: a4fa9da Author: Stephen MalletteAuthored: Tue Nov 22 09:42:12 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:51 2016 -0500 -- .../tinkergraph/groovy/plugin/TinkerGraphGremlinPlugin.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f5a1ebb5/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/groovy/plugin/TinkerGraphGremlinPlugin.java -- diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/groovy/plugin/TinkerGraphGremlinPlugin.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/groovy/plugin/TinkerGraphGremlinPlugin.java index df35314..5c8231a 100644 --- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/groovy/plugin/TinkerGraphGremlinPlugin.java +++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/groovy/plugin/TinkerGraphGremlinPlugin.java @@ -30,10 +30,11 @@ import java.util.Set; /** * @author Stephen Mallette (http://stephen.genoprime.com) + * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin}. */ +@Deprecated public final class TinkerGraphGremlinPlugin extends AbstractGremlinPlugin { - private static final Set IMPORTS = new HashSet() {{ add(IMPORT_SPACE + TinkerGraph.class.getPackage().getName() + DOT_STAR); add(IMPORT_SPACE + TinkerGraphComputer.class.getPackage().getName() + DOT_STAR);
[21/50] tinkerpop git commit: TINKERPOP-1562 Added SparkGremlinPlugin
TINKERPOP-1562 Added SparkGremlinPlugin SparkGremlinPlugin required binding injections so a BindingCustomizer was added along with two implementations - one for direct assignment and one for lazy assignment. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c41250ce Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c41250ce Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c41250ce Branch: refs/heads/TINKERPOP-1562 Commit: c41250ce0a6c87242a974333dd97078a71be06b9 Parents: f5a1ebb Author: Stephen MalletteAuthored: Tue Nov 22 10:57:32 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:51 2016 -0500 -- .../gremlin/console/plugin/PluggedIn.groovy | 3 + .../groovy/plugin/GremlinPluginAdapterTest.java | 63 ++ .../gremlin/jsr223/BindingsCustomizer.java | 33 +++ .../jsr223/DefaultBindingsCustomizer.java | 40 + .../gremlin/jsr223/ImportGremlinPlugin.java | 16 .../jsr223/console/LazyBindingsCustomizer.java | 41 + .../gremlin/groovy/engine/GremlinExecutor.java | 6 +- .../spark/groovy/plugin/SparkGremlinPlugin.java | 2 + .../spark/jsr223/SparkGremlinPlugin.java| 92 .../jsr223/TinkerGraphGremlinPlugin.java| 46 +- 10 files changed, 317 insertions(+), 25 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c41250ce/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy index d298cd7..b707226 100644 --- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy +++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy @@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.groovy.plugin.PluginAcceptor import org.apache.tinkerpop.gremlin.groovy.plugin.PluginInitializationException import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteAcceptor import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException +import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer import org.apache.tinkerpop.gremlin.jsr223.ScriptCustomizer import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer @@ -88,6 +89,8 @@ class PluggedIn { pluginAcceptor.addImports(imports) } else if (it instanceof ScriptCustomizer) { it.getScripts().collect { it.join(LINE_SEPARATOR) }.each { pluginAcceptor.eval(it) } +} else if (it instanceof BindingsCustomizer) { +it.bindings.entrySet().each { k, v -> pluginAcceptor.addBinding(k,v) } } } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c41250ce/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java -- diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java new file mode 100644 index 000..77422da --- /dev/null +++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/GremlinPluginAdapterTest.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tinkerpop.gremlin.console.groovy.plugin; + +import org.apache.tinkerpop.gremlin.console.plugin.PluggedIn; +import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer; +import
[14/50] tinkerpop git commit: TINKERPOP-1562 Renamed GremlinModule to GremlinPlugin in gremlin-core
TINKERPOP-1562 Renamed GremlinModule to GremlinPlugin in gremlin-core Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/68487c2b Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/68487c2b Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/68487c2b Branch: refs/heads/TINKERPOP-1562 Commit: 68487c2b89fd589256925af2750907ef8da3c07a Parents: d7d6d5b Author: Stephen MalletteAuthored: Mon Nov 21 13:15:02 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:50 2016 -0500 -- .../groovy/plugin/GiraphGremlinPlugin.java | 3 +- .../giraph/jsr223/GiraphGremlinModule.java | 58 --- .../giraph/jsr223/GiraphGremlinPlugin.java | 58 +++ .../gremlin/jsr223/AbstractGremlinModule.java | 58 --- .../gremlin/jsr223/AbstractGremlinPlugin.java | 58 +++ .../gremlin/jsr223/CoreGremlinModule.java | 62 --- .../gremlin/jsr223/CoreGremlinPlugin.java | 62 +++ .../DefaultGremlinScriptEngineManager.java | 6 +- .../tinkerpop/gremlin/jsr223/GremlinModule.java | 70 .../tinkerpop/gremlin/jsr223/GremlinPlugin.java | 70 .../jsr223/GremlinScriptEngineManager.java | 4 +- .../gremlin/jsr223/ImportGremlinModule.java | 173 --- .../gremlin/jsr223/ImportGremlinPlugin.java | 173 +++ .../gremlin/jsr223/RemoteAcceptor.java | 2 +- .../gremlin/jsr223/ScriptFileGremlinPlugin.java | 71 .../gremlin/jsr223/ScriptFileModule.java| 71 .../gremlin/jsr223/ImportGremlinModuleTest.java | 149 .../gremlin/jsr223/ImportGremlinPluginTest.java | 149 .../gremlin/groovy/engine/GremlinExecutor.java | 19 +- .../tinkerpop/gremlin/server/Settings.java | 4 +- .../jsr223/GremlinServerGremlinModule.java | 42 - .../jsr223/GremlinServerGremlinPlugin.java | 42 + .../server/util/ServerGremlinExecutor.java | 3 - 23 files changed, 701 insertions(+), 706 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java -- diff --git a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java index 29f2455..80d98f9 100644 --- a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java +++ b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/groovy/plugin/GiraphGremlinPlugin.java @@ -19,7 +19,6 @@ package org.apache.tinkerpop.gremlin.giraph.groovy.plugin; -import org.apache.tinkerpop.gremlin.giraph.jsr223.GiraphGremlinModule; import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphGraphComputer; import org.apache.tinkerpop.gremlin.groovy.plugin.AbstractGremlinPlugin; import org.apache.tinkerpop.gremlin.groovy.plugin.IllegalEnvironmentException; @@ -33,7 +32,7 @@ import java.util.Set; /** * @author Marko A. Rodriguez (http://markorodriguez.com) - * @deprecated As of release 3.2.4, replaced by {@link GiraphGremlinModule}. + * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.giraph.jsr223.GiraphGremlinPlugin}. */ @Deprecated public final class GiraphGremlinPlugin extends AbstractGremlinPlugin { http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68487c2b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinModule.java -- diff --git a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinModule.java b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinModule.java deleted file mode 100644 index 69f3586..000 --- 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
[12/50] tinkerpop git commit: TINKERPOP-1562 Add GreminServerGremlinModule for Gremlin Server specific imports
TINKERPOP-1562 Add GreminServerGremlinModule for Gremlin Server specific imports Allow use of instance() as a way for GremlinModules to be instantiated. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/9f65e6aa Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9f65e6aa Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9f65e6aa Branch: refs/heads/TINKERPOP-1562 Commit: 9f65e6aa3d32eab2ef76bb7e3ae1f60b8332268f Parents: 42194b8 Author: Stephen MalletteAuthored: Mon Nov 21 07:36:40 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:50 2016 -0500 -- .../gremlin/jsr223/AbstractGremlinModule.java | 10 .../gremlin/jsr223/CoreGremlinModule.java | 18 --- .../gremlin/groovy/engine/GremlinExecutor.java | 49 +++- .../server/util/GremlinServerGremlinModule.java | 41 .../server/util/ServerGremlinExecutor.java | 13 +- 5 files changed, 81 insertions(+), 50 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9f65e6aa/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java index 36104f6..4b9cd2c 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/AbstractGremlinModule.java @@ -18,6 +18,7 @@ */ package org.apache.tinkerpop.gremlin.jsr223; +import java.util.Collections; import java.util.Optional; import java.util.Set; @@ -29,6 +30,15 @@ public abstract class AbstractGremlinModule implements GremlinModule { protected final Customizer[] customizers; protected final Set 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 appliesTo, final Customizer... customizers) { this.moduleName = moduleName; this.appliesTo = appliesTo; http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9f65e6aa/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java index f1fdbe4..ff47767 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java @@ -37,7 +37,6 @@ public final class CoreGremlinModule implements GremlinModule { .addMethodImports(CoreImports.getMethodImports()).create(); private static final Customizer[] customizers = new Customizer[] {gremlinCore}; -private static final Builder builder = new Builder(); /** * @deprecated As of 3.2.4, replaced by {@link #instance()} as this field will later become private. @@ -60,21 +59,4 @@ public final class CoreGremlinModule implements GremlinModule { public String getName() { return MODULE_NAME; } - -/** - * {@link GremlinModule} instances all use a builder pattern for instantiation via configuration. This method is - * just provided for consistency with that pattern. When instantiating programmatically, use {@link #instance()}. - */ -public static Builder build() { -return builder; -} - -public final static class Builder { - -private Builder() {} - -public CoreGremlinModule create() { -return instance(); -} -} } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9f65e6aa/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java -- diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java index 5f7ab09..1ad41c7 100644 ---
[46/50] tinkerpop git commit: TINKERPOP-1562 Fixed the InstallCommand for new GremlinPlugin usage.
TINKERPOP-1562 Fixed the InstallCommand for new GremlinPlugin usage. DependencyGrabber wasn't using the right Artifact implementation and wasn't taking into account -Dplugins=v3d3 Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d68f6938 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d68f6938 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d68f6938 Branch: refs/heads/TINKERPOP-1562 Commit: d68f69383464f8f54b98acecf99a39587f2e4839 Parents: ae45eca Author: Stephen MalletteAuthored: Thu Dec 1 08:25:19 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:51 2016 -0500 -- .../gremlin/console/commands/InstallCommand.groovy| 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d68f6938/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/InstallCommand.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/InstallCommand.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/InstallCommand.groovy index a680757..c8a49df 100644 --- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/InstallCommand.groovy +++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/commands/InstallCommand.groovy @@ -21,9 +21,9 @@ package org.apache.tinkerpop.gremlin.console.commands import org.apache.tinkerpop.gremlin.console.ConsoleFs import org.apache.tinkerpop.gremlin.console.Mediator import org.apache.tinkerpop.gremlin.console.plugin.PluggedIn -import org.apache.tinkerpop.gremlin.groovy.plugin.Artifact import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin import groovy.grape.Grape +import org.apache.tinkerpop.gremlin.groovy.util.Artifact import org.apache.tinkerpop.gremlin.groovy.util.DependencyGrabber import org.codehaus.groovy.tools.shell.CommandSupport import org.codehaus.groovy.tools.shell.Groovysh @@ -64,9 +64,17 @@ class InstallCommand extends CommandSupport { // note that the service loader utilized the classloader from the groovy shell as shell class are available // from within there given loading through Grape. -ServiceLoader.load(GremlinPlugin.class, shell.getInterp().getClassLoader()).forEach { plugin -> +def pluginClass = mediator.useV3d3 ? org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin : GremlinPlugin +ServiceLoader.load(pluginClass, shell.getInterp().getClassLoader()).forEach { plugin -> if (!mediator.availablePlugins.containsKey(plugin.class.name)) { -mediator.availablePlugins.put(plugin.class.name, new PluggedIn(plugin, shell, io, false)) + +if (Mediator.useV3d3) { +mediator.availablePlugins.put(plugin.class.name, new PluggedIn(new PluggedIn.GremlinPluginAdapter((org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin) plugin, shell, io), shell, io, false)) +} else { +mediator.availablePlugins.put(plugin.class.name, new PluggedIn((GremlinPlugin) plugin, shell, io, false)) +} + +//mediator.availablePlugins.put(plugin.class.name, new PluggedIn(plugin, shell, io, false)) if (plugin.requireRestart()) pluginsThatNeedRestart << plugin.name }
[22/50] tinkerpop git commit: TINKERPOP-1562 Added new plugins for gremlin-groovy to replace deprecated ones.
TINKERPOP-1562 Added new plugins for gremlin-groovy to replace deprecated ones. Specifically did SugarGremlinPlugin and CredentialsGrpahGremlinPlugin. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/bb5b47dd Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/bb5b47dd Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/bb5b47dd Branch: refs/heads/TINKERPOP-1562 Commit: bb5b47dd98aa936673b1588202dbcc378a83b718 Parents: d0c941e Author: Stephen MalletteAuthored: Tue Nov 22 14:20:11 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:51 2016 -0500 -- .../jsr223/ScriptEnginePluginAcceptor.java | 2 + .../groovy/jsr223/SugarGremlinPlugin.java | 45 .../groovy/plugin/SugarGremlinPlugin.java | 2 + .../CredentialGraphGremlinPlugin.java | 2 + .../jsr223/CredentialGraphGremlinPlugin.java| 55 ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin | 2 + 6 files changed, 108 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptEnginePluginAcceptor.java -- diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptEnginePluginAcceptor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptEnginePluginAcceptor.java index 0bd51c2..5832e0b 100644 --- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptEnginePluginAcceptor.java +++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptEnginePluginAcceptor.java @@ -34,7 +34,9 @@ import java.util.Set; * interact with them on initialization. * * @author Stephen Mallette (http://stephen.genoprime.com) + * @deprecated As of release 3.2.4, not replaced. */ +@Deprecated public class ScriptEnginePluginAcceptor implements PluginAcceptor { private final ScriptEngine scriptEngine; http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java -- diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java new file mode 100644 index 000..95c610f --- /dev/null +++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tinkerpop.gremlin.groovy.jsr223; + +import org.apache.tinkerpop.gremlin.groovy.loaders.SugarLoader; +import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin; +import org.apache.tinkerpop.gremlin.jsr223.DefaultScriptCustomizer; + +import java.util.Collections; + +/** + * A plugin implementation which allows for the usage of Gremlin Groovy's syntactic sugar. + * + * @author Marko A. Rodriguez (http://markorodriguez.com) + */ +public class SugarGremlinPlugin extends AbstractGremlinPlugin { + +private static final String NAME = "tinkerpop.sugar"; + +public SugarGremlinPlugin() { +super(NAME, new DefaultScriptCustomizer(Collections.singletonList( + Collections.singletonList(SugarLoader.class.getPackage().getName() + "." + SugarLoader.class.getSimpleName() + ".load()"; +} + +@Override +public String getName() { +return "tinkerpop.sugar"; +} +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/SugarGremlinPlugin.java -- diff --git
[05/50] tinkerpop git commit: Removed gremlin-benchmark from javadoc generation.
Removed gremlin-benchmark from javadoc generation. There really doesn't seem to be much value for generating javadoc out of this as it is an internal tool and we don't even deploy it as an artifact. CTR Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/7af8052a Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7af8052a Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7af8052a Branch: refs/heads/TINKERPOP-1562 Commit: 7af8052ab8984e99e808bff0ee71aad5f2450442 Parents: 71dd939 Author: Stephen MalletteAuthored: Thu Dec 1 14:08:21 2016 -0500 Committer: Stephen Mallette Committed: Thu Dec 1 14:08:21 2016 -0500 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7af8052a/pom.xml -- diff --git a/pom.xml b/pom.xml index e58bf07..e4d1ba7 100644 --- a/pom.xml +++ b/pom.xml @@ -1058,7 +1058,7 @@ limitations under the License. ${basedir}/docs/javadoc/overview.html true - giraph-gremlin/src/main/java:gremlin-core/src/main/java:gremlin-driver/src/main/java:gremlin-groovy/src/main/java:gremlin-groovy-test/src/main/java:gremlin-server/src/main/java:gremlin-test/src/main/java:hadoop-gremlin/src/main/java:neo4j-gremlin/src/main/java:spark-gremlin/src/main/java:tinkergraph-gremlin/src/main/java:gremlin-benchmark/src/main/java + giraph-gremlin/src/main/java:gremlin-core/src/main/java:gremlin-driver/src/main/java:gremlin-groovy/src/main/java:gremlin-groovy-test/src/main/java:gremlin-server/src/main/java:gremlin-test/src/main/java:hadoop-gremlin/src/main/java:neo4j-gremlin/src/main/java:spark-gremlin/src/main/java:tinkergraph-gremlin/src/main/java
[04/50] tinkerpop git commit: Make javadoc deprecation message consistent rest of code base CTR
Make javadoc deprecation message consistent rest of code base CTR Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/71dd9393 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/71dd9393 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/71dd9393 Branch: refs/heads/TINKERPOP-1562 Commit: 71dd9393bc3ff407a9ef9e3a91d3e73fc61b17e7 Parents: 46888b1 Author: Stephen MalletteAuthored: Thu Dec 1 13:11:03 2016 -0500 Committer: Stephen Mallette Committed: Thu Dec 1 13:11:03 2016 -0500 -- .../apache/tinkerpop/gremlin/process/traversal/Bindings.java | 2 +- .../tinkerpop/gremlin/process/traversal/TraversalEngine.java | 2 +- .../gremlin/process/traversal/TraversalSideEffects.java | 8 .../tinkerpop/gremlin/process/traversal/TraversalSource.java | 2 +- .../gremlin/process/traversal/step/map/GroupStepV3d0.java| 2 +- .../traversal/step/map/LambdaCollectingBarrierStep.java | 2 +- .../traversal/strategy/decoration/SubgraphStrategy.java | 4 ++-- .../gremlin/process/traversal/util/TraversalHelper.java | 2 +- .../gremlin/hadoop/structure/HadoopConfiguration.java| 4 ++-- 9 files changed, 14 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/71dd9393/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java index d399bb2..37d2bb8 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java @@ -45,7 +45,7 @@ public final class Bindings { private static final ThreadLocal
[31/50] tinkerpop git commit: TINKERPOP-1562 Hooked up GremlinJythonScriptEngine to Customizers
TINKERPOP-1562 Hooked up GremlinJythonScriptEngine to Customizers GremlnJythonScriptEngine is now initialized the same way that GremlinGroovyScriptEngine is. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/05ff0c0f Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/05ff0c0f Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/05ff0c0f Branch: refs/heads/TINKERPOP-1562 Commit: 05ff0c0fe957a9fe697c5b1a176c682837ee0c64 Parents: a2ac1f2 Author: Stephen MalletteAuthored: Thu Nov 24 08:11:35 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:49 2016 -0500 -- .../jsr223/GremlinJythonScriptEngine.java | 167 --- .../GremlinJythonScriptEngineFactory.java | 5 +- .../jsr223/GremlinJythonScriptEngineTest.java | 12 +- .../jsr223/GremlinEnabledScriptEngineTest.java | 1 - 4 files changed, 120 insertions(+), 65 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/05ff0c0f/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java -- diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java index 554d80a..1b95a02 100644 --- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java +++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java @@ -19,8 +19,10 @@ package org.apache.tinkerpop.gremlin.python.jsr223; +import org.apache.tinkerpop.gremlin.jsr223.Customizer; import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine; import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngineFactory; +import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer; import org.apache.tinkerpop.gremlin.process.traversal.Bytecode; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource; @@ -35,7 +37,13 @@ import javax.script.ScriptContext; import javax.script.ScriptException; import java.io.Reader; import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; /** * @author Marko A. Rodriguez (http://markorodriguez.com) @@ -44,6 +52,10 @@ public class GremlinJythonScriptEngine implements GremlinScriptEngine { private final PyScriptEngine pyScriptEngine; +/** + * @deprecated As of release 3.2.4, replaced by {@link #GremlinJythonScriptEngine(Customizer...)}. + */ +@Deprecated public GremlinJythonScriptEngine() { this.pyScriptEngine = (PyScriptEngine) new PyScriptEngineFactory().getScriptEngine(); try { @@ -61,70 +73,48 @@ public class GremlinJythonScriptEngine implements GremlinScriptEngine { this.pyScriptEngine.eval(SymbolHelper.toPython(x.name()) + " = " + x.getDeclaringClass().getSimpleName() + "." + x.name()); } -// add sugar methods -this.pyScriptEngine.eval("def getitem_bypass(self, index):\n" + -" if isinstance(index,int):\nreturn self.range(index,index+1)\n" + -" elif isinstance(index,slice):\nreturn self.range(index.start,index.stop)\n" + -" else:\nreturn TypeError('Index must be int or slice')"); -this.pyScriptEngine.eval(GraphTraversal.class.getSimpleName() + ".__getitem__ = getitem_bypass"); -this.pyScriptEngine.eval(GraphTraversal.class.getSimpleName() + ".__getattr__ = lambda self, key: self.values(key)\n"); -this.pyScriptEngine.eval("\n" + -"from java.lang import Long\n" + -"import org.apache.tinkerpop.gremlin.util.function.Lambda\n" + // todo: remove or remove imported subclass names? (choose) -"from org.apache.tinkerpop.gremlin.util.function.Lambda import AbstractLambda\n" + -"from org.apache.tinkerpop.gremlin.util.function.Lambda import UnknownArgLambda\n" + -"from org.apache.tinkerpop.gremlin.util.function.Lambda import ZeroArgLambda\n" + -"from org.apache.tinkerpop.gremlin.util.function.Lambda import OneArgLambda\n" + -"from org.apache.tinkerpop.gremlin.util.function.Lambda import TwoArgLambda\n\n" + - -"class JythonUnknownArgLambda(UnknownArgLambda):\n" + -
[25/50] tinkerpop git commit: TINKERPOP-1562 Added gremlin-console plugins under the new model.
TINKERPOP-1562 Added gremlin-console plugins under the new model. Had to rework the PluggedIn adapters a bit so that they could better handle Console environment variable.s Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a91fb80e Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a91fb80e Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a91fb80e Branch: refs/heads/TINKERPOP-1562 Commit: a91fb80e64ceb2e5c97b5f8c2ef20205d075ec18 Parents: bb5b47d Author: Stephen MalletteAuthored: Tue Nov 22 16:35:16 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:51 2016 -0500 -- .../tinkerpop/gremlin/console/Console.groovy| 4 +- .../console/jsr223/GephiRemoteAcceptor.groovy | 372 +++ .../gremlin/console/plugin/PluggedIn.groovy | 14 +- .../groovy/plugin/DriverGremlinPlugin.java | 2 + .../groovy/plugin/DriverRemoteAcceptor.java | 2 + .../groovy/plugin/GephiGremlinPlugin.java | 1 + .../groovy/plugin/UtilitiesGremlinPlugin.java | 1 + .../console/jsr223/DriverGremlinPlugin.java | 106 ++ .../console/jsr223/DriverRemoteAcceptor.java| 238 .../console/jsr223/GephiGremlinPlugin.java | 45 +++ .../console/jsr223/UtilitiesGremlinPlugin.java | 106 ++ ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin | 3 + .../jsr223/UtilitiesGremlinPluginScript.groovy | 52 +++ .../groovy/plugin/GremlinPluginAdapterTest.java | 5 +- 14 files changed, 940 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy index cb6e90f..d39e085 100644 --- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy +++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy @@ -131,9 +131,9 @@ class Console { def pluggedIn if (Mediator.useV3d3) { -pluggedIn = new PluggedIn(new PluggedIn.GremlinPluginAdapter(plugin), groovy, io, false) +pluggedIn = new PluggedIn(new PluggedIn.GremlinPluginAdapter((org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin) plugin, groovy, io), groovy, io, false) } else { -pluggedIn = new PluggedIn(plugin, groovy, io, false) +pluggedIn = new PluggedIn((GremlinPlugin) plugin, groovy, io, false) } mediator.availablePlugins.put(plugin.class.name, pluggedIn) http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a91fb80e/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy new file mode 100644 index 000..dbc1156 --- /dev/null +++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy @@ -0,0 +1,372 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tinkerpop.gremlin.console.jsr223 + +import groovy.json.JsonOutput +import groovy.json.JsonSlurper +import groovy.transform.CompileStatic +import org.apache.http.client.methods.CloseableHttpResponse +import org.apache.http.client.methods.HttpUriRequest +import org.apache.http.client.methods.RequestBuilder +import org.apache.http.entity.StringEntity +import org.apache.http.impl.client.CloseableHttpClient +import
[08/50] tinkerpop git commit: TINKERPOP-1562 Bring back GremlinModule and deprecate it.
TINKERPOP-1562 Bring back GremlinModule and deprecate it. GremlinModule was introduced in 3.2.3. Wasn't sure if GremlinModule was equal to a GremlinPlugin so I had named it differently. It was never promoted as a replacement for GremlinPlugin and it was never used in core infrastructure like Gremlin Console or Gremlin Server, but I figured it better to avoid breaking change and simply deprecate it for removal later. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c348a072 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c348a072 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c348a072 Branch: refs/heads/TINKERPOP-1562 Commit: c348a0722cfbcddd708ec8d640bd56244f5455db Parents: 68487c2 Author: Stephen MalletteAuthored: Mon Nov 21 13:34:27 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:50 2016 -0500 -- .../gremlin/jsr223/CoreGremlinModule.java | 64 + .../DefaultGremlinScriptEngineManager.java | 39 +-- .../tinkerpop/gremlin/jsr223/GremlinModule.java | 72 .../jsr223/GremlinScriptEngineManager.java | 10 ++- .../gremlin/groovy/engine/GremlinExecutor.java | 4 +- .../jsr223/GremlinEnabledScriptEngineTest.java | 28 +++- 6 files changed, 207 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c348a072/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java new file mode 100644 index 000..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 getCustomizers(final String scriptEngineName) { +return Optional.of(customizers); +} + +@Override +public String getName() { +return MODULE_NAME; +} +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c348a072/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java index 10bdfa3..1484f90 100644 ---
[11/50] tinkerpop git commit: TINKERPOP-1562 Add GremlinModule for Giraph.
TINKERPOP-1562 Add GremlinModule for Giraph. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/299ad1c7 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/299ad1c7 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/299ad1c7 Branch: refs/heads/TINKERPOP-1562 Commit: 299ad1c778657e4b80f36218f70ce6c998164070 Parents: 9f65e6a Author: Stephen MalletteAuthored: Mon Nov 21 07:54:35 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:50 2016 -0500 -- .../giraph/jsr223/GiraphGremlinModule.java | 58 1 file changed, 58 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/299ad1c7/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinModule.java -- diff --git a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinModule.java b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinModule.java new file mode 100644 index 000..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
[37/50] tinkerpop git commit: TINKERPOP-1562 Change Set to List to preserve order in script execution.
TINKERPOP-1562 Change Set to List to preserve order in script execution. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/873ac619 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/873ac619 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/873ac619 Branch: refs/heads/TINKERPOP-1562 Commit: 873ac619e935e226505f75bd6caacd76d820531b Parents: 2d49710 Author: Stephen MalletteAuthored: Tue Nov 29 16:42:46 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:50 2016 -0500 -- .../apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java | 2 +- .../tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/873ac619/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java index 93ad9d8..0131ca2 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPlugin.java @@ -60,7 +60,7 @@ public final class ScriptFileGremlinPlugin extends AbstractGremlinPlugin { return this; } -public Builder files(final Set files) { +public Builder files(final List files) { for (String f : files) { final File file = new File(f); if (!file.exists()) throw new IllegalArgumentException(new FileNotFoundException(f)); http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/873ac619/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java -- diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java index 81cf9e6..681d2ac 100644 --- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java +++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ScriptFileGremlinPluginTest.java @@ -23,6 +23,7 @@ import org.junit.Test; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; @@ -41,7 +42,7 @@ public class ScriptFileGremlinPluginTest { public void shouldOpenViaPropertiesFileConfig() throws IOException { final File scriptFile1 = TestHelper.generateTempFileFromResource(DefaultScriptCustomizerTest.class, "script-customizer-1.groovy", ".groovy"); final File scriptFile2 = TestHelper.generateTempFileFromResource(DefaultScriptCustomizerTest.class, "script-customizer-2.groovy", ".groovy"); -final Set files = new HashSet<>(); +final List files = new ArrayList<>(); files.add(scriptFile1.getAbsolutePath()); files.add(scriptFile2.getAbsolutePath()); final GremlinPlugin plugin = ScriptFileGremlinPlugin.build().files(files).create();
[47/50] tinkerpop git commit: TINKERPOP-1562 Make all groovy customizer providers straight Customizer instances
TINKERPOP-1562 Make all groovy customizer providers straight Customizer instances Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a82c56fa Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a82c56fa Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a82c56fa Branch: refs/heads/TINKERPOP-1562 Commit: a82c56fad2500f49da265466d5e23f345749d348 Parents: 00ccf0f Author: Stephen MalletteAuthored: Wed Nov 30 18:43:13 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:51 2016 -0500 -- CHANGELOG.asciidoc | 1 + .../tinkerpop/gremlin/util/CoreImports.java | 34 +-- .../jsr223/CompileStaticGroovyCustomizer.java | 60 .../jsr223/ConfigurationGroovyCustomizer.java | 82 + .../jsr223/CustomizerProviderCustomizer.java| 40 .../jsr223/GremlinGroovyScriptEngine.java | 97 ++-- .../jsr223/GroovyCompilerGremlinPlugin.java | 18 ++-- .../gremlin/groovy/jsr223/GroovyCustomizer.java | 33 +++ .../groovy/jsr223/ImportGroovyCustomizer.java | 66 + .../jsr223/InterpreterModeGroovyCustomizer.java | 36 .../jsr223/ThreadInterruptGroovyCustomizer.java | 35 +++ .../jsr223/TimedInterruptGroovyCustomizer.java | 62 + .../jsr223/TimedInterruptTimeoutException.java | 38 .../jsr223/TypeCheckedGroovyCustomizer.java | 65 + .../CompileStaticCustomizerProvider.java| 2 + .../ConfigurationCustomizerProvider.java| 2 + .../InterpreterModeCustomizerProvider.java | 4 + .../ThreadInterruptCustomizerProvider.java | 2 + .../TimedInterruptCustomizerProvider.java | 2 + .../TimedInterruptTimeoutException.java | 4 + .../TypeCheckedCustomizerProvider.java | 2 + .../VariableIdentificationCustomizer.java | 2 + ...mlinGroovyScriptEngineCompileStaticTest.java | 20 ++-- .../GremlinGroovyScriptEngineConfigTest.java| 5 +- .../jsr223/GremlinGroovyScriptEngineTest.java | 6 +- ...inGroovyScriptEngineThreadInterruptTest.java | 2 +- ...linGroovyScriptEngineTimedInterruptTest.java | 22 ++--- ...remlinGroovyScriptEngineTypeCheckedTest.java | 18 ++-- .../jsr223/GroovyCompilerGremlinPluginTest.java | 14 +-- .../server/op/AbstractEvalOpProcessor.java | 5 + 30 files changed, 625 insertions(+), 154 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/CHANGELOG.asciidoc -- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index ebcc318..b4ba2a6 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -46,6 +46,7 @@ TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET) * Fixed a `NoSuchElementException` bug with `GroupXXXStep` where if the reduced `TraverserSet` is empty, don't add the key/value. * Fixed a `NullPointerException` bug with profiling `GroupSideEffectStep` in OLTP. * Improved ability to release resources in `GraphProvider` instances in the test suite. +* Factored `GremlinPlugin` functionality out of gremlin-groovy and into gremlin-core - related classes were deprecated. * Added a `force` option for killing sessions without waiting for transaction close or timeout of a currently running job or multiple jobs. * Deprecated `Session.kill()` and `Session.manualKill()`. * Added `choose(predicate,traversal)` and `choose(traversal,traversal)` to effect if/then-semantics (no else). Equivalent to `choose(x,y,identity())`. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a82c56fa/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java index e6c64fd..1c6a6e6 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java @@ -83,12 +83,15 @@ import org.apache.tinkerpop.gremlin.structure.io.Io; import org.apache.tinkerpop.gremlin.structure.io.IoCore; import org.apache.tinkerpop.gremlin.structure.io.Storage; import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; +import org.javatuples.Pair; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.Set; +import java.util.stream.Collectors; import java.util.stream.Stream; /** @@ -187,11 +190,11 @@ public final class CoreImports {
[20/50] tinkerpop git commit: TINKERPOP-1562 ImportCustomizer has become an interface
TINKERPOP-1562 ImportCustomizer has become an interface This is a breaking change unfortunately, but this was not a feature that was published or used in 3.2.3 so I don't expect wide usage. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/2537d5bb Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2537d5bb Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2537d5bb Branch: refs/heads/TINKERPOP-1562 Commit: 2537d5bbd686f77449bb9d64148fecf2ad9d0d3a Parents: 1a7a3b3 Author: Stephen MalletteAuthored: Tue Nov 22 06:33:22 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:51 2016 -0500 -- .../giraph/jsr223/GiraphGremlinPlugin.java | 4 +- .../gremlin/console/plugin/PluggedIn.groovy | 3 +- .../gremlin/jsr223/CoreGremlinModule.java | 2 +- .../gremlin/jsr223/CoreGremlinPlugin.java | 2 +- .../gremlin/jsr223/DefaultImportCustomizer.java | 112 +++ .../gremlin/jsr223/ImportCustomizer.java| 85 +- .../gremlin/jsr223/ImportGremlinPlugin.java | 2 +- .../gremlin/jsr223/ImportGremlinPluginTest.java | 12 +- ...aultDefaultImportCustomizerProviderTest.java | 90 +++ .../DefaultImportCustomizerProviderTest.java| 90 --- .../jsr223/GremlinServerGremlinPlugin.java | 4 +- .../jsr223/GremlinEnabledScriptEngineTest.java | 3 +- 12 files changed, 221 insertions(+), 188 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java -- diff --git a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java index a96ac86..ee49ed5 100644 --- a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java +++ b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java @@ -29,7 +29,7 @@ import org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphWorkerContext; import org.apache.tinkerpop.gremlin.giraph.process.computer.MemoryAggregator; import org.apache.tinkerpop.gremlin.giraph.process.computer.PassThroughMemory; import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin; -import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer; +import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer; /** * @author Stephen Mallette (http://stephen.genoprime.com) @@ -39,7 +39,7 @@ public final class GiraphGremlinPlugin extends AbstractGremlinPlugin { private static final GiraphGremlinPlugin instance = new GiraphGremlinPlugin(); private GiraphGremlinPlugin() { -super(MODULE_NAME, ImportCustomizer.build().addClassImports( +super(MODULE_NAME, DefaultImportCustomizer.build().addClassImports( EmptyOutEdges.class, GiraphComputation.class, GiraphGraphComputer.class, http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy index def49ed..053a072 100644 --- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy +++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy @@ -24,8 +24,7 @@ import org.apache.tinkerpop.gremlin.groovy.plugin.PluginAcceptor import org.apache.tinkerpop.gremlin.groovy.plugin.PluginInitializationException import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteAcceptor import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException -import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer -import org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin +import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer import org.codehaus.groovy.tools.shell.Groovysh import org.codehaus.groovy.tools.shell.IO http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2537d5bb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java -- diff --git
[50/50] tinkerpop git commit: TINKERPOP-1562 Moved CoreImports to jsr223 package.
TINKERPOP-1562 Moved CoreImports to jsr223 package. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c2e71dc0 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c2e71dc0 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c2e71dc0 Branch: refs/heads/TINKERPOP-1562 Commit: c2e71dc06279bb708111c264f33507f927f06b4d Parents: a82c56f Author: Stephen MalletteAuthored: Thu Dec 1 06:40:59 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:51 2016 -0500 -- .../gremlin/jsr223/CoreGremlinModule.java | 2 - .../gremlin/jsr223/CoreGremlinPlugin.java | 2 - .../tinkerpop/gremlin/jsr223/CoreImports.java | 250 +++ .../DefaultGremlinScriptEngineManager.java | 2 - .../gremlin/jsr223/ImportCustomizer.java| 2 - .../tinkerpop/gremlin/util/CoreImports.java | 1 + .../python/TraversalSourceGenerator.groovy | 2 +- .../jsr223/GremlinJythonScriptEngine.java | 2 +- 8 files changed, 253 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c2e71dc0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java index d398f89..369e171 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java @@ -18,8 +18,6 @@ */ package org.apache.tinkerpop.gremlin.jsr223; -import org.apache.tinkerpop.gremlin.util.CoreImports; - import java.util.Optional; /** http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c2e71dc0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java index a3063cf..8882e36 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java @@ -18,8 +18,6 @@ */ package org.apache.tinkerpop.gremlin.jsr223; -import org.apache.tinkerpop.gremlin.util.CoreImports; - import java.util.Optional; /** http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c2e71dc0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java new file mode 100644 index 000..2244ae9 --- /dev/null +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java @@ -0,0 +1,250 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tinkerpop.gremlin.jsr223; + +import org.apache.commons.configuration.Configuration; +import org.apache.tinkerpop.gremlin.process.computer.Computer; +import org.apache.tinkerpop.gremlin.process.computer.ComputerResult; +import org.apache.tinkerpop.gremlin.process.computer.GraphComputer; +import org.apache.tinkerpop.gremlin.process.computer.Memory; +import org.apache.tinkerpop.gremlin.process.computer.VertexProgram; +import org.apache.tinkerpop.gremlin.process.computer.bulkdumping.BulkDumperVertexProgram; +import org.apache.tinkerpop.gremlin.process.computer.bulkloading.BulkLoaderVertexProgram; +import org.apache.tinkerpop.gremlin.process.computer.clustering.peerpressure.PeerPressureVertexProgram; +import
[30/50] tinkerpop git commit: TINKERPOP-1562 Change ScriptCustomizer to an interface.
TINKERPOP-1562 Change ScriptCustomizer to an interface. This class had been added as part of this branch so recasting it as an interface is non-breaking. Get PluggedIn to process the ScriptCustomizer. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/e9e5cfec Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/e9e5cfec Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/e9e5cfec Branch: refs/heads/TINKERPOP-1562 Commit: e9e5cfec66bca5f8beb671625f7fe2fff0038907 Parents: 2537d5b Author: Stephen MalletteAuthored: Tue Nov 22 06:49:14 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:51 2016 -0500 -- .../gremlin/console/plugin/PluggedIn.groovy | 7 ++- .../gremlin/jsr223/DefaultScriptCustomizer.java | 57 .../gremlin/jsr223/ScriptCustomizer.java| 36 +++-- .../gremlin/jsr223/ScriptFileGremlinPlugin.java | 2 +- 4 files changed, 70 insertions(+), 32 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e9e5cfec/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy index 053a072..54659fa 100644 --- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy +++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy @@ -24,7 +24,8 @@ import org.apache.tinkerpop.gremlin.groovy.plugin.PluginAcceptor import org.apache.tinkerpop.gremlin.groovy.plugin.PluginInitializationException import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteAcceptor import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException -import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer +import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer +import org.apache.tinkerpop.gremlin.jsr223.ScriptCustomizer import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer import org.codehaus.groovy.tools.shell.Groovysh import org.codehaus.groovy.tools.shell.IO @@ -33,6 +34,7 @@ import org.codehaus.groovy.tools.shell.IO * @author Stephen Mallette (http://stephen.genoprime.com) */ class PluggedIn { +private static final String LINE_SEPARATOR = System.getProperty("line.separator") private final GremlinPlugin plugin private boolean activated = false @@ -77,7 +79,6 @@ class PluggedIn { @Override void pluginTo(final PluginAcceptor pluginAcceptor) throws IllegalEnvironmentException, PluginInitializationException { -// TODO: handle script customizer corePlugin.getCustomizers("gremlin-groovy").each { if (it instanceof ImportCustomizer) { def imports = [] as Set @@ -85,6 +86,8 @@ class PluggedIn { it.methodImports.each { imports.add("import static " + it.declaringClass.canonicalName + "." + it.name) } it.enumImports.each { imports.add("import static " + it.declaringClass.canonicalName + "." + it.name()) } pluginAcceptor.addImports(imports) +} else if (it instanceof ScriptCustomizer) { +it.getScripts().collect { it.join(LINE_SEPARATOR) }.each { pluginAcceptor.eval(it) } } } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e9e5cfec/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java new file mode 100644 index 000..9640f28 --- /dev/null +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultScriptCustomizer.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is
[42/50] tinkerpop git commit: TINKERPOP-1562 Fixed a bad javadoc link
TINKERPOP-1562 Fixed a bad javadoc link Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/6d1b97e0 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/6d1b97e0 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/6d1b97e0 Branch: refs/heads/TINKERPOP-1562 Commit: 6d1b97e0bb3f5567900124d3a549c066b7ff3605 Parents: 9218e8a Author: Stephen MalletteAuthored: Wed Nov 30 06:37:14 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:50 2016 -0500 -- .../apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d1b97e0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java index ab4c81d..9571b2c 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/console/RemoteAcceptor.java @@ -28,8 +28,9 @@ import java.util.Map; * A "remote connection" does not necessarily have to be a remote server. It simply refers to a resource that is * external to the console. * - * By implementing this interface and returning an instance of it through {@link ConsoleCustomizer#getRemoteAcceptor(Map)} - * a plugin can hook into those commands and provide remoting features. + * By implementing this interface and returning an instance of it through + * {@link ConsoleCustomizer#getRemoteAcceptor(GremlinShellEnvironment)} a plugin can hook into those commands and + * provide remoting features. * * @author Stephen Mallette (http://stephen.genoprime.com) */
[06/50] tinkerpop git commit: Merge branch 'tp31' into tp32
Merge branch 'tp31' into tp32 Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/53e932b4 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/53e932b4 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/53e932b4 Branch: refs/heads/TINKERPOP-1562 Commit: 53e932b48a59a89788433b577ed6457402fdafd9 Parents: 7af8052 d49f692 Author: Jason PluradAuthored: Thu Dec 1 21:49:34 2016 -0500 Committer: Jason Plurad Committed: Thu Dec 1 21:49:34 2016 -0500 -- .../groovy/util/DependencyGrabber.groovy| 55 +++- .../util/DependencyGrabberIntegrateTest.java| 2 +- 2 files changed, 32 insertions(+), 25 deletions(-) --
[02/50] tinkerpop git commit: sorry for the late tweak. Here is the thing. With then new Bindings model, you don't need withBindings() in Gremlin-Java. And, moreoever, it was never used in Gremlin-Pyt
sorry for the late tweak. Here is the thing. With then new Bindings model, you don't need withBindings() in Gremlin-Java. And, moreoever, it was never used in Gremlin-Python (or any script-based GLV). Thus, its pointless. Deprecated it. Updated the docs accordingly. Also added more test cases to BytecodeTest and test_traversal.py to ensure that both Gremlin-Java bindings and Gremlin-Python bindings have the same look and feel to the user. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/987e6ab4 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/987e6ab4 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/987e6ab4 Branch: refs/heads/TINKERPOP-1562 Commit: 987e6ab4f2ca643a5eb181f4b52417bf9814fcbd Parents: b70ba90 Author: Marko A. RodriguezAuthored: Wed Nov 30 10:14:01 2016 -0700 Committer: Marko A. Rodriguez Committed: Wed Nov 30 10:14:01 2016 -0700 -- CHANGELOG.asciidoc | 1 + .../src/reference/gremlin-applications.asciidoc | 6 +-- docs/src/reference/gremlin-variants.asciidoc| 5 --- .../gremlin-language-variants/index.asciidoc| 3 -- .../gremlin/process/traversal/Bindings.java | 41 ++-- .../gremlin/process/traversal/Bytecode.java | 10 ++--- .../process/traversal/TraversalSource.java | 7 ++-- .../dsl/graph/GraphTraversalSource.java | 4 +- .../gremlin/process/traversal/BytecodeTest.java | 8 ++-- .../python/GraphTraversalSourceGenerator.groovy | 2 - .../python/TraversalSourceGenerator.groovy | 6 +++ .../gremlin_python/process/graph_traversal.py | 2 - .../jython/gremlin_python/process/traversal.py | 6 +++ .../main/jython/tests/process/test_traversal.py | 13 +++ 14 files changed, 72 insertions(+), 42 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/CHANGELOG.asciidoc -- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 10a0604..237b7ce 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET) ~~~ +* Deprecated `TraversalSource.withBindings()` as it is no longer needed in Gremlin-Java and never was needed for other variants. * Fixed a bug in Gremlin-Java `Bytecode` where anonymous traversals were not aware of parent bindings. * Fixed a bug in Gremlin-Java GraphSON deserialization around `P.within()` and `P.without()`. * Converted Spark process suite tests to "integration" tests. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/docs/src/reference/gremlin-applications.asciidoc -- diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc index c452a0f..f7ba2b5 100644 --- a/docs/src/reference/gremlin-applications.asciidoc +++ b/docs/src/reference/gremlin-applications.asciidoc @@ -939,13 +939,13 @@ times and sizing) can be done in the Gremlin Server configuration file as descri Finally, Gremlin `Bytecode` supports the encoding of bindings which allow GremlinServer to cache traversals that will be reused over and over again save that some parameterization may change. Thus, instead of translating, compiling, and then executing each submitted bytecode, it is possible to simply execute. To express bindings in Gremlin-Java and -Gremlin-Groovy, use the `withBindings()` traversal source method. +Gremlin-Groovy, use `Bindings`. [gremlin-groovy] cluster = Cluster.open('conf/remote-objects.yaml') -b = new Bindings() -g = EmptyGraph.instance().traversal().withBindings(b).withRemote(DriverRemoteConnection.using(cluster, "g")) +b = Bindings.instance() +g = EmptyGraph.instance().traversal().withRemote(DriverRemoteConnection.using(cluster, "g")) g.V(b.of('id',1)).out('created').values('name') g.V(b.of('id',4)).out('created').values('name') g.V(b.of('id',4)).out('created').values('name').getBytecode() http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/987e6ab4/docs/src/reference/gremlin-variants.asciidoc -- diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc index 853b087..39b5558 100644 --- a/docs/src/reference/gremlin-variants.asciidoc +++ b/docs/src/reference/gremlin-variants.asciidoc @@ -265,11 +265,6 @@ g.V(('id',1)).out('created').name.toList() g.V(('id',4)).out('created').name.toList() -NOTE: The Gremlin
[48/50] tinkerpop git commit: TINKERPOP-1562 Deprecated the DependencyManager.
TINKERPOP-1562 Deprecated the DependencyManager. This interface really isn't useful anymore. It is bound to ScriptEngines class which is also deprecated. The new model of the GremlinScriptEngine in gremlin-core sorta makes this obsolete. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/aa4a70a4 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/aa4a70a4 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/aa4a70a4 Branch: refs/heads/TINKERPOP-1562 Commit: aa4a70a47c9c7b400983fb2fd55730b686cceea9 Parents: 338002a Author: Stephen MalletteAuthored: Thu Dec 1 10:19:40 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:51 2016 -0500 -- .../apache/tinkerpop/gremlin/groovy/jsr223/DependencyManager.java | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aa4a70a4/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/DependencyManager.java -- diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/DependencyManager.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/DependencyManager.java index 5c1b8fe..4f1384d 100644 --- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/DependencyManager.java +++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/DependencyManager.java @@ -22,6 +22,7 @@ import org.apache.tinkerpop.gremlin.groovy.ImportCustomizerProvider; import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin; import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPluginException; import org.apache.tinkerpop.gremlin.groovy.plugin.PluginAcceptor; +import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine; import java.util.List; import java.util.Map; @@ -33,7 +34,9 @@ import java.util.Set; * so this interface makes that possible to expose. * * @author Stephen Mallette (http://stephen.genoprime.com) + * @deprecated As of release 3.2.4, not replaced - no longer needed under the new {@link GremlinScriptEngine} model. */ +@Deprecated public interface DependencyManager { /** * Take maven coordinates and load the classes into the classloader used by the ScriptEngine. Those ScriptEngines
[07/50] tinkerpop git commit: TINKERPOP-1562 Start getting Console working with new plugin stuff
TINKERPOP-1562 Start getting Console working with new plugin stuff Built adapters to get new RemoteAcceptor to behave as the old RemoteAcceptor and to get new GremlinPlugin to work as the old GremlinPlugin. Deprecated some classes and undeprecated others - still a pretty big WIP commit at this point but nothing appears to be broken. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/1a7a3b37 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/1a7a3b37 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/1a7a3b37 Branch: refs/heads/TINKERPOP-1562 Commit: 1a7a3b37f895d31f9f4f441088353e0bfeb3d8d1 Parents: c348a07 Author: Stephen MalletteAuthored: Mon Nov 21 17:15:53 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:50 2016 -0500 -- .../tinkerpop/gremlin/console/Console.groovy| 14 +- .../tinkerpop/gremlin/console/Mediator.groovy | 4 +- .../console/jsr223/GephiRemoteAcceptor.groovy | 372 --- .../console/plugin/ConsolePluginAcceptor.groovy | 2 +- .../console/plugin/GephiRemoteAcceptor.groovy | 1 - .../gremlin/console/plugin/PluggedIn.groovy | 79 .../tinkerpop/gremlin/jsr223/Customizer.java| 4 +- .../tinkerpop/gremlin/jsr223/GremlinModule.java | 2 + .../tinkerpop/gremlin/jsr223/GremlinPlugin.java | 9 - .../gremlin/jsr223/GremlinPluginException.java | 41 ++ .../gremlin/jsr223/RemoteAcceptor.java | 81 .../gremlin/jsr223/RemoteException.java | 40 -- .../jsr223/console/ConsoleCustomizer.java | 33 ++ .../gremlin/jsr223/console/PluginAcceptor.java | 62 .../gremlin/jsr223/console/RemoteAcceptor.java | 81 .../gremlin/jsr223/console/RemoteException.java | 40 ++ .../gremlin/groovy/plugin/GremlinPlugin.java| 1 + .../gremlin/groovy/plugin/PluginAcceptor.java | 2 + .../gremlin/groovy/plugin/RemoteAcceptor.java | 2 +- .../jsr223/GremlinEnabledScriptEngineTest.java | 1 + 20 files changed, 361 insertions(+), 510 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy index 69d6ba3..cb6e90f 100644 --- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy +++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy @@ -103,6 +103,8 @@ class Console { // hide output temporarily while imports execute showShellEvaluationOutput(false) +// TODO: register CoreGremlinPlugin if using v3d3 + // add the default imports new ConsoleImportCustomizerProvider().getCombinedImports().stream() .collect { IMPORT_SPACE + it }.each { groovy.execute(it) } @@ -123,9 +125,17 @@ class Console { // check for available plugins. if they are in the "active" plugins strategies then "activate" them def activePlugins = Mediator.readPluginState() -ServiceLoader.load(GremlinPlugin.class, groovy.getInterp().getClassLoader()).each { plugin -> +def pluginClass = mediator.useV3d3 ? org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin : GremlinPlugin +ServiceLoader.load(pluginClass, groovy.getInterp().getClassLoader()).each { plugin -> if (!mediator.availablePlugins.containsKey(plugin.class.name)) { -def pluggedIn = new PluggedIn(plugin, groovy, io, false) +def pluggedIn + +if (Mediator.useV3d3) { +pluggedIn = new PluggedIn(new PluggedIn.GremlinPluginAdapter(plugin), groovy, io, false) +} else { +pluggedIn = new PluggedIn(plugin, groovy, io, false) +} + mediator.availablePlugins.put(plugin.class.name, pluggedIn) if (activePlugins.contains(plugin.class.name)) { http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a7a3b37/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy index 047e3d7..396c563 100644 --- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy +++
[03/50] tinkerpop git commit: Merge branch 'TINKERPOP-1573' into tp32
Merge branch 'TINKERPOP-1573' into tp32 Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/46888b1a Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/46888b1a Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/46888b1a Branch: refs/heads/TINKERPOP-1562 Commit: 46888b1a06f6d145dd8403b8e88280f111fd1539 Parents: ffd6543 987e6ab Author: Marko A. RodriguezAuthored: Thu Dec 1 06:12:15 2016 -0700 Committer: Marko A. Rodriguez Committed: Thu Dec 1 06:12:15 2016 -0700 -- CHANGELOG.asciidoc | 2 + .../src/reference/gremlin-applications.asciidoc | 6 +-- docs/src/reference/gremlin-variants.asciidoc| 5 --- .../gremlin-language-variants/index.asciidoc| 3 -- .../gremlin/process/traversal/Bindings.java | 39 +++- .../gremlin/process/traversal/Bytecode.java | 19 -- .../process/traversal/TraversalSource.java | 7 ++-- .../dsl/graph/GraphTraversalSource.java | 4 +- .../optimization/GraphFilterStrategyTest.java | 2 +- .../gremlin/process/traversal/BytecodeTest.java | 32 +++- .../python/GraphTraversalSourceGenerator.groovy | 2 - .../python/TraversalSourceGenerator.groovy | 6 +++ .../gremlin_python/process/graph_traversal.py | 2 - .../jython/gremlin_python/process/traversal.py | 6 +++ .../main/jython/tests/process/test_traversal.py | 13 +++ 15 files changed, 104 insertions(+), 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/46888b1a/CHANGELOG.asciidoc -- diff --cc CHANGELOG.asciidoc index a77ab20,237b7ce..ebcc318 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@@ -26,7 -26,8 +26,9 @@@ image::https://raw.githubusercontent.co TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET) ~~~ +* Fixed a bug around long serialization in Gremlin-Python when using Python3. + * Deprecated `TraversalSource.withBindings()` as it is no longer needed in Gremlin-Java and never was needed for other variants. + * Fixed a bug in Gremlin-Java `Bytecode` where anonymous traversals were not aware of parent bindings. * Fixed a bug in Gremlin-Java GraphSON deserialization around `P.within()` and `P.without()`. * Converted Spark process suite tests to "integration" tests. * Fixed a bug in `InlineFilterStrategy` having to do with folding `HasContainers` into `VertexStep`.
[40/50] tinkerpop git commit: TINKERPOP-1562 Adapted CompilerCustomizerProvider to Customizer
TINKERPOP-1562 Adapted CompilerCustomizerProvider to Customizer This hooks up all the groovy-specific configurations to the GremlinGroovyScriptEngine. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/8dc9b1fb Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/8dc9b1fb Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/8dc9b1fb Branch: refs/heads/TINKERPOP-1562 Commit: 8dc9b1fbb3e0a6504b3d5d217dbb144031b30aab Parents: 6439d70 Author: Stephen MalletteAuthored: Tue Nov 29 16:15:12 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:50 2016 -0500 -- .../jsr223/CustomizerProviderCustomizer.java| 40 ++ .../jsr223/GremlinGroovyScriptEngine.java | 20 ++- .../jsr223/GroovyCompilerGremlinPlugin.java | 138 +++ .../groovy/jsr223/SugarGremlinPlugin.java | 8 +- .../CompileStaticCustomizerProvider.java| 1 + .../ConfigurationCustomizerProvider.java| 1 + .../InterpreterModeCustomizerProvider.java | 1 + .../ThreadInterruptCustomizerProvider.java | 1 + .../TimedInterruptCustomizerProvider.java | 1 + .../TypeCheckedCustomizerProvider.java | 1 + ...mlinGroovyScriptEngineCompileStaticTest.java | 72 +- .../GremlinGroovyScriptEngineConfigTest.java| 14 +- .../jsr223/GremlinGroovyScriptEngineTest.java | 50 ++- ...inGroovyScriptEngineThreadInterruptTest.java | 23 +++- ...linGroovyScriptEngineTimedInterruptTest.java | 69 +- ...remlinGroovyScriptEngineTypeCheckedTest.java | 72 +- .../jsr223/GroovyCompilerGremlinPluginTest.java | 128 + 17 files changed, 617 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CustomizerProviderCustomizer.java -- diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CustomizerProviderCustomizer.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CustomizerProviderCustomizer.java new file mode 100644 index 000..73614a1 --- /dev/null +++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CustomizerProviderCustomizer.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tinkerpop.gremlin.groovy.jsr223; + +import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider; +import org.apache.tinkerpop.gremlin.jsr223.Customizer; + +/** + * An adapter that allows existing {@link CompilerCustomizerProvider} instances to behave as a {#link Customizer}. + * + * @author Stephen Mallette (http://stephen.genoprime.com) + */ +class CustomizerProviderCustomizer implements Customizer { + +private final CompilerCustomizerProvider customizerProvider; + +CustomizerProviderCustomizer(final CompilerCustomizerProvider customizerProvider) { +this.customizerProvider = customizerProvider; +} + +CompilerCustomizerProvider getCustomizerProvider() { +return customizerProvider; +} +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8dc9b1fb/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java -- diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java index 264587a..2996792 100644 --- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java +++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java @@ -70,7 +70,6 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy;
[01/50] tinkerpop git commit: found a bug in GraphFilterStrategyTest that caused the bindings to get messed up. Basically, a ) was missing and until() was inside the repeat(). [Forced Update!]
Repository: tinkerpop Updated Branches: refs/heads/TINKERPOP-1562 90f427c8d -> aa4a70a47 (forced update) found a bug in GraphFilterStrategyTest that caused the bindings to get messed up. Basically, a ) was missing and until() was inside the repeat(). Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b70ba903 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b70ba903 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b70ba903 Branch: refs/heads/TINKERPOP-1562 Commit: b70ba903f40b3bffac0061c4a56f1992b55ee8ef Parents: 84a82fb Author: Marko A. RodriguezAuthored: Tue Nov 29 14:40:13 2016 -0700 Committer: Marko A. Rodriguez Committed: Tue Nov 29 14:40:13 2016 -0700 -- .../gremlin/process/traversal/Bindings.java | 14 +- .../gremlin/process/traversal/Bytecode.java | 16 +++- .../optimization/GraphFilterStrategyTest.java | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b70ba903/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java index ba31e21..3359942 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java @@ -19,6 +19,7 @@ package org.apache.tinkerpop.gremlin.process.traversal; +import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -41,23 +42,26 @@ import java.util.Map; */ public final class Bindings { -private final Map
[45/50] tinkerpop git commit: TINKERPOP-1562 Moved ScriptEngineCache to jsr223 package.
TINKERPOP-1562 Moved ScriptEngineCache to jsr223 package. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/ae45eca7 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/ae45eca7 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/ae45eca7 Branch: refs/heads/TINKERPOP-1562 Commit: ae45eca70de741a1a1872117e9f4f7dc3ddd6245 Parents: c2e71dc Author: Stephen MalletteAuthored: Thu Dec 1 06:48:22 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:51 2016 -0500 -- .../gremlin/jsr223/ScriptEngineCache.java | 54 .../gremlin/util/ScriptEngineCache.java | 4 +- .../gremlin/jsr223/ScriptEngineCacheTest.java | 46 + .../python/jsr223/JythonScriptEngineSetup.java | 2 +- .../python/jsr223/JythonTranslatorTest.java | 10 .../jsr223/PythonGraphSONJavaTranslator.java| 2 +- .../gremlin/python/jsr223/PythonProvider.java | 5 +- 7 files changed, 106 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ae45eca7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptEngineCache.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptEngineCache.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptEngineCache.java new file mode 100644 index 000..9d2848d --- /dev/null +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ScriptEngineCache.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tinkerpop.gremlin.jsr223; + +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * A cache of standard {@code ScriptEngine} instances, instantiated by the standard {@code ScriptEngineManager}. + * These instances are NOT "Gremlin-enabled". See {@link SingleGremlinScriptEngineManager} for the analogous class + * that loads {@link GremlinScriptEngine} instances. + * + * @author Daniel Kuppitz (http://gremlin.guru) + * @author Stephen Mallette (http://stephen.genoprime.com) + */ +public final class ScriptEngineCache { + +private ScriptEngineCache() {} + +public final static String DEFAULT_SCRIPT_ENGINE = "gremlin-groovy"; + +private final static ScriptEngineManager SCRIPT_ENGINE_MANAGER = new ScriptEngineManager(); +private final static Map CACHED_ENGINES = new ConcurrentHashMap<>(); + +public static ScriptEngine get(final String engineName) { +return CACHED_ENGINES.compute(engineName, (key, engine) -> { +if (null == engine) { +engine = SCRIPT_ENGINE_MANAGER.getEngineByName(engineName); +if (null == engine) { +throw new IllegalArgumentException("There is no script engine with provided name: " + engineName); +} +} +return engine; +}); +} +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ae45eca7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java index 1ce7d05..dc4aeb7 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java @@ -28,12 +28,14 @@ import java.util.concurrent.ConcurrentHashMap; /** * A cache of standard {@code ScriptEngine} instances, instantiated by the standard {@code ScriptEngineManager}. - * These instances are not "Gremlin-enabled". See {@link SingleGremlinScriptEngineManager}
[26/50] tinkerpop git commit: TINKERPOP-1562 Added more tests for plugins/customizers
TINKERPOP-1562 Added more tests for plugins/customizers Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/33460fc1 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/33460fc1 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/33460fc1 Branch: refs/heads/TINKERPOP-1562 Commit: 33460fc159249a503a3ffa9439d0d8c3c72ef0cf Parents: 03e931d Author: Stephen MalletteAuthored: Wed Nov 23 14:37:26 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:51 2016 -0500 -- .../CachedGremlinScriptEngineManager.java | 1 + .../gremlin/jsr223/DefaultImportCustomizer.java | 2 - .../gremlin/jsr223/LazyBindingsCustomizer.java | 2 - .../SingleGremlinScriptEngineManager.java | 2 +- .../jsr223/DefaultImportCustomizerTest.java | 76 .../jsr223/DefaultScriptCustomizerTest.java | 56 +++ .../jsr223/ScriptFileGremlinPluginTest.java | 61 .../jsr223/SingleScriptEngineManagerTest.java | 45 .../gremlin/jsr223/script-customizer-1.groovy | 3 + .../gremlin/jsr223/script-customizer-2.groovy | 2 + pom.xml | 3 +- 11 files changed, 247 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CachedGremlinScriptEngineManager.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CachedGremlinScriptEngineManager.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CachedGremlinScriptEngineManager.java index 9839b1b..5798e1c 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CachedGremlinScriptEngineManager.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CachedGremlinScriptEngineManager.java @@ -92,6 +92,7 @@ public class CachedGremlinScriptEngineManager extends DefaultGremlinScriptEngine } private void registerLookUpInfo(final GremlinScriptEngine engine, final String shortName) { +if (null == engine) throw new IllegalArgumentException(String.format("%s is not an available GremlinScriptEngine", shortName)); cache.putIfAbsent(shortName, engine); engine.getFactory().getExtensions().forEach(ext -> extensionToName.putIfAbsent(ext, shortName)); engine.getFactory().getMimeTypes().forEach(mime -> mimeToName.putIfAbsent(mime, shortName)); http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java index fa0965d..3642f97 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java @@ -18,8 +18,6 @@ */ package org.apache.tinkerpop.gremlin.jsr223; -import org.apache.tinkerpop.gremlin.util.CoreImports; - import java.lang.reflect.Method; import java.util.Arrays; import java.util.Collection; http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java index 4117ae5..01ae662 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/LazyBindingsCustomizer.java @@ -18,8 +18,6 @@ */ package org.apache.tinkerpop.gremlin.jsr223; -import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer; - import javax.script.Bindings; import java.util.function.Supplier; http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33460fc1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/SingleGremlinScriptEngineManager.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/SingleGremlinScriptEngineManager.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/SingleGremlinScriptEngineManager.java index
[15/50] tinkerpop git commit: TINKERPOP-1562 Move RemoteAcceptor related stuff to gremlin-core.
TINKERPOP-1562 Move RemoteAcceptor related stuff to gremlin-core. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d7d6d5b2 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d7d6d5b2 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d7d6d5b2 Branch: refs/heads/TINKERPOP-1562 Commit: d7d6d5b2b8788fa420223d8986c27c535255494c Parents: 8ee2225 Author: Stephen MalletteAuthored: Mon Nov 21 13:13:30 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:50 2016 -0500 -- .../console/jsr223/GephiRemoteAcceptor.groovy | 372 +++ .../console/plugin/GephiRemoteAcceptor.groovy | 1 + .../tinkerpop/gremlin/jsr223/GremlinModule.java | 9 + .../gremlin/jsr223/ImportGremlinModule.java | 1 - .../gremlin/jsr223/RemoteAcceptor.java | 81 .../gremlin/jsr223/RemoteException.java | 40 ++ .../gremlin/groovy/plugin/RemoteAcceptor.java | 2 + .../gremlin/groovy/plugin/RemoteException.java | 2 + 8 files changed, 507 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d7d6d5b2/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy new file mode 100644 index 000..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 (rando...@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,
[24/50] tinkerpop git commit: TINKERPOP-1562 Minor changes to javadocs.
TINKERPOP-1562 Minor changes to javadocs. Also, moved a public static field back to ImportCustomizer (after it became a interface). Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/03e931d1 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/03e931d1 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/03e931d1 Branch: refs/heads/TINKERPOP-1562 Commit: 03e931d151684e2186ae9b8b1f7887b93817157f Parents: a91fb80 Author: Stephen MalletteAuthored: Wed Nov 23 11:31:06 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:51 2016 -0500 -- .../tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java | 7 --- .../gremlin/jsr223/DefaultImportCustomizer.java | 8 .../tinkerpop/gremlin/jsr223/ImportCustomizer.java | 10 ++ .../gremlin/jsr223/ImportGremlinPlugin.java | 7 --- .../gremlin/jsr223/ScriptFileGremlinPlugin.java | 16 ++-- 5 files changed, 28 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/03e931d1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java index 410b222..d579691 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java @@ -23,13 +23,14 @@ import org.apache.tinkerpop.gremlin.util.CoreImports; import java.util.Optional; /** - * This module is required for a {@code ScriptEngine} to be Gremlin-enabled. + * This module is required for a {@code ScriptEngine} to be Gremlin-enabled. This {@link GremlinPlugin} is not enabled + * for the {@code ServiceLoader}. It is designed to be instantiated manually. * * @author Stephen Mallette (http://stephen.genoprime.com) */ public final class CoreGremlinPlugin implements GremlinPlugin { -private static final String MODULE_NAME = "tinkerpop.core"; +private static final String NAME = "tinkerpop.core"; private static final ImportCustomizer gremlinCore = DefaultImportCustomizer.build() .addClassImports(CoreImports.getClassImports()) @@ -57,6 +58,6 @@ public final class CoreGremlinPlugin implements GremlinPlugin { @Override public String getName() { -return MODULE_NAME; +return NAME; } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/03e931d1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java index 85d6531..fa0965d 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java @@ -33,14 +33,6 @@ import java.util.Set; * @author Stephen Mallette (http://stephen.genoprime.com) */ public class DefaultImportCustomizer implements ImportCustomizer { -/** - * @deprecated As of release 3.2.4, not replaced. - */ -@Deprecated -public static final ImportCustomizer GREMLIN_CORE = DefaultImportCustomizer.build() -.addClassImports(CoreImports.getClassImports()) -.addEnumImports(CoreImports.getEnumImports()) -.addMethodImports(CoreImports.getMethodImports()).create(); private final Set classImports; private final Set methodImports; http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/03e931d1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java index 7eced82..7b056ff 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java @@ -18,6 +18,8 @@ */ package org.apache.tinkerpop.gremlin.jsr223; +import org.apache.tinkerpop.gremlin.util.CoreImports; + import java.lang.reflect.Method; import java.util.Set; @@ -27,6 +29,14 @@ import java.util.Set; * @author Stephen
[34/50] tinkerpop git commit: TINKERPOP-1562 Deprecated Artifact
TINKERPOP-1562 Deprecated Artifact Moved it to a new home as the hole plugin package is going to go away in 3.3.0 Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/39e39652 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/39e39652 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/39e39652 Branch: refs/heads/TINKERPOP-1562 Commit: 39e39652a0d3e6a4f9ef480d16b08372774f2b30 Parents: a2a2359 Author: Stephen MalletteAuthored: Tue Nov 29 09:39:10 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:50 2016 -0500 -- .../groovy/util/DependencyGrabber.groovy| 15 ++-- .../gremlin/groovy/plugin/Artifact.java | 2 + .../tinkerpop/gremlin/groovy/util/Artifact.java | 86 .../gremlin/groovy/plugin/ArtifactTest.java | 2 - .../gremlin/groovy/util/ArtifactTest.java | 85 +++ 5 files changed, 182 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/39e39652/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy -- diff --git a/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy b/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy index e7ab55b..f2bfe5c 100644 --- a/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy +++ b/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabber.groovy @@ -20,11 +20,14 @@ package org.apache.tinkerpop.gremlin.groovy.util import groovy.grape.Grape import org.apache.commons.lang3.SystemUtils -import org.apache.tinkerpop.gremlin.groovy.plugin.Artifact import org.slf4j.Logger import org.slf4j.LoggerFactory -import java.nio.file.* +import java.nio.file.DirectoryStream +import java.nio.file.FileSystems +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.StandardCopyOption import java.util.jar.JarFile import java.util.jar.Manifest @@ -118,9 +121,9 @@ class DependencyGrabber { .findAll {!filesAlreadyInPath.collect { it.getFileName().toString() }.contains(it.fileName.toFile().name)} .each(copyTo(targetPluginPath)) getAdditionalDependencies(targetPluginPath, artifact).collect(convertUriToPath(fs)) -.findAll { !(it.fileName.toFile().name ==~ /(slf4j|logback\-classic)-.*\.jar/) } -.findAll { !filesAlreadyInPath.collect { it.getFileName().toString() }.contains(it.fileName.toFile().name)} -.each(copyTo(targetPluginPath)) +.findAll { !(it.fileName.toFile().name ==~ /(slf4j|logback\-classic)-.*\.jar/) } +.findAll { !filesAlreadyInPath.collect { it.getFileName().toString() }.contains(it.fileName.toFile().name)} +.each(copyTo(targetPluginPath)) // get dependencies for the lib path. the lib path should not filter out any jars - used for reference dependencyLocations.collect(convertUriToPath(fs)).each(copyTo(targetLibPath)) @@ -162,7 +165,7 @@ class DependencyGrabber { * Windows places a starting forward slash in the URI that needs to be stripped off or else the * {@code FileSystem} won't properly resolve it. */ -private static Closure convertUriToPath(final FileSystem fs) { +private static Closure convertUriToPath(def fs) { return { URI uri -> def p = SystemUtils.IS_OS_WINDOWS ? uri.path.substring(1) : uri.path return fs.getPath(p) http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/39e39652/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java -- diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java index 29ce7d6..7fb0bd3 100644 --- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java +++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java @@ -22,7 +22,9 @@ package org.apache.tinkerpop.gremlin.groovy.plugin; * A software artifact identified by its maven coordinates. * * @author Stephen Mallette (http://stephen.genoprime.com) + * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.groovy.util.Artifact} */ +@Deprecated public class Artifact { private final String group; private final String
[19/50] tinkerpop git commit: TINKERPOP-1562 Fixed problems related to loading new/old plugins
TINKERPOP-1562 Fixed problems related to loading new/old plugins Tested in Gremlin Console and it looks like the flag that will tell it to load one plugin version or the other is working properly. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a4fa9da2 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a4fa9da2 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a4fa9da2 Branch: refs/heads/TINKERPOP-1562 Commit: a4fa9da27b4334141c3001f628883adbcad6ca19 Parents: aee85b1 Author: Stephen MalletteAuthored: Tue Nov 22 09:39:37 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:51 2016 -0500 -- .../tinkerpop/gremlin/console/Mediator.groovy | 2 +- .../gremlin/console/plugin/PluggedIn.groovy | 2 +- .../jsr223/TinkerGraphGremlinPlugin.java| 77 ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin | 1 + 4 files changed, 80 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a4fa9da2/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy index 396c563..18e8d58 100644 --- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy +++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Mediator.groovy @@ -34,7 +34,7 @@ class Mediator { private static String LINE_SEP = System.getProperty("line.separator") -public static final boolean useV3d3 = System.getProperty("plugins", "v3d3") == "v3d3" +public static final boolean useV3d3 = System.getProperty("plugins", "v3d2") == "v3d3" public Mediator(final Console console) { this.console = console http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a4fa9da2/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy index 54659fa..d298cd7 100644 --- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy +++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy @@ -79,7 +79,7 @@ class PluggedIn { @Override void pluginTo(final PluginAcceptor pluginAcceptor) throws IllegalEnvironmentException, PluginInitializationException { -corePlugin.getCustomizers("gremlin-groovy").each { +corePlugin.getCustomizers("gremlin-groovy").get().each { if (it instanceof ImportCustomizer) { def imports = [] as Set it.classImports.each { imports.add("import " + it.canonicalName )} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a4fa9da2/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java -- diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java new file mode 100644 index 000..16a6cb5 --- /dev/null +++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/jsr223/TinkerGraphGremlinPlugin.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tinkerpop.gremlin.tinkergraph.jsr223; + +import
[44/50] tinkerpop git commit: TINKERPOP-1562 Deprecated plugin exceptions.
TINKERPOP-1562 Deprecated plugin exceptions. These are needed anymore under the revised plugin model in gremlin-core. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a2a23596 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a2a23596 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a2a23596 Branch: refs/heads/TINKERPOP-1562 Commit: a2a23596322acf8201a67ac7d3baf8ef7dbb135d Parents: 80f79bc Author: Stephen MalletteAuthored: Tue Nov 29 09:21:49 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:50 2016 -0500 -- .../gremlin/jsr223/GremlinPluginException.java | 41 .../groovy/plugin/GremlinPluginException.java | 2 + .../plugin/IllegalEnvironmentException.java | 2 + .../plugin/PluginInitializationException.java | 2 + 4 files changed, 6 insertions(+), 41 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2a23596/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPluginException.java -- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPluginException.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPluginException.java deleted file mode 100644 index ce4ab2f..000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinPluginException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.jsr223; - -/** - * Base exception for {@link GremlinPlugin}. - * - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public abstract class GremlinPluginException extends Exception { -public GremlinPluginException() { -} - -public GremlinPluginException(final String message) { -super(message); -} - -public GremlinPluginException(final String message, final Throwable cause) { -super(message, cause); -} - -public GremlinPluginException(final Throwable cause) { -super(cause); -} -} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2a23596/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPluginException.java -- diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPluginException.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPluginException.java index d85c743..c8664c7 100644 --- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPluginException.java +++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPluginException.java @@ -22,7 +22,9 @@ package org.apache.tinkerpop.gremlin.groovy.plugin; * Base exception for {@link GremlinPlugin}. * * @author Stephen Mallette (http://stephen.genoprime.com) + * @deprecated As of release 3.2.4, not replaced. */ +@Deprecated public abstract class GremlinPluginException extends Exception { public GremlinPluginException() { } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2a23596/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/IllegalEnvironmentException.java -- diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/IllegalEnvironmentException.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/IllegalEnvironmentException.java index 86dbcbc..8d6fbe2 100644 --- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/IllegalEnvironmentException.java +++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/IllegalEnvironmentException.java @@ -23,7 +23,9 @@ package org.apache.tinkerpop.gremlin.groovy.plugin; * the needs of
[27/50] tinkerpop git commit: TINKERPOP-1562 Abstracted groovysh/io to GremlinShellEnvironment
TINKERPOP-1562 Abstracted groovysh/io to GremlinShellEnvironment The GremlinShellEnvironment provides a way to abstract groovysh and io classes (i.e. groovy specific classes) so that plugins don't need to depend on gremlin-groovy at all. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/2efa2e4b Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2efa2e4b Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2efa2e4b Branch: refs/heads/TINKERPOP-1562 Commit: 2efa2e4b75ea8032355677165097b492f2979aa8 Parents: 35c8fcd Author: Stephen MalletteAuthored: Wed Nov 23 17:10:13 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:51 2016 -0500 -- .../console/jsr223/GephiRemoteAcceptor.groovy | 15 .../console/plugin/GephiRemoteAcceptor.groovy | 2 ++ .../gremlin/console/plugin/PluggedIn.groovy | 26 +- .../console/jsr223/DriverGremlinPlugin.java | 8 ++--- .../console/jsr223/DriverRemoteAcceptor.java| 16 - .../console/jsr223/GephiGremlinPlugin.java | 10 ++ .../jsr223/console/ConsoleCustomizer.java | 7 +--- .../jsr223/console/GremlinShellEnvironment.java | 37 .../hadoop/jsr223/HadoopGremlinPlugin.java | 7 ++-- .../hadoop/jsr223/HadoopRemoteAcceptor.java | 22 ++-- 10 files changed, 99 insertions(+), 51 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2efa2e4b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy index dbc1156..4e41fa4 100644 --- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy +++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy @@ -29,14 +29,13 @@ import org.apache.http.impl.client.CloseableHttpClient import org.apache.http.impl.client.HttpClients import org.apache.http.util.EntityUtils import org.apache.tinkerpop.gremlin.console.plugin.GephiTraversalVisualizationStrategy +import org.apache.tinkerpop.gremlin.jsr223.console.GremlinShellEnvironment import org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor import org.apache.tinkerpop.gremlin.jsr223.console.RemoteException import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource import org.apache.tinkerpop.gremlin.structure.Edge import org.apache.tinkerpop.gremlin.structure.Graph import org.apache.tinkerpop.gremlin.structure.Vertex -import org.codehaus.groovy.tools.shell.Groovysh -import org.codehaus.groovy.tools.shell.IO /** * @author Stephen Mallette (http://stephen.genoprime.com) @@ -48,8 +47,7 @@ class GephiRemoteAcceptor implements RemoteAcceptor { private int port = 8080 private String workspace = "workspace1" -private final Groovysh shell -private final IO io +private final GremlinShellEnvironment shell private final Random rand = new Random(); boolean traversalSubmittedForViz = false @@ -64,9 +62,8 @@ class GephiRemoteAcceptor implements RemoteAcceptor { private CloseableHttpClient httpclient = HttpClients.createDefault(); -public GephiRemoteAcceptor(final Groovysh shell, final IO io) { +public GephiRemoteAcceptor(final GremlinShellEnvironment shell) { this.shell = shell -this.io = io // traversal visualization defaults vizStepDelay = 1000; // 1 second pause between viz of steps @@ -129,13 +126,13 @@ class GephiRemoteAcceptor implements RemoteAcceptor { else if (args[0] == "startSize") parseVizStartSize(args[1]) else if (args[0] == "visualTraversal") { -def graphVar = shell.interp.context.getVariable(args[1]) +def graphVar = shell.getVariable(args[1]) if (!(graphVar instanceof Graph)) throw new RemoteException("Invalid argument to 'visualTraversal' - first parameter must be a Graph instance") def gVar = args.size() == 3 ? args[2] : "vg" def theG = GraphTraversalSource.build().with(new GephiTraversalVisualizationStrategy(this)).create(graphVar) -shell.interp.context.setVariable(gVar, theG) +shell.setVariable(gVar, theG) } else throw new RemoteException("Invalid config arguments - check syntax") @@ -151,7 +148,7 @@ class GephiRemoteAcceptor implements RemoteAcceptor
[33/50] tinkerpop git commit: TINKERPOP-1562 Added JSR-223 packages in gremin-core to core javadoc
TINKERPOP-1562 Added JSR-223 packages in gremin-core to core javadoc Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a2ac1f29 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a2ac1f29 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a2ac1f29 Branch: refs/heads/TINKERPOP-1562 Commit: a2ac1f29613576b3bf409c0c766d3eae66d45780 Parents: 2efa2e4 Author: Stephen MalletteAuthored: Wed Nov 23 17:22:58 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:49 2016 -0500 -- pom.xml | 21 - 1 file changed, 16 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2ac1f29/pom.xml -- diff --git a/pom.xml b/pom.xml index 37c7c7e..3c5f8ed 100644 --- a/pom.xml +++ b/pom.xml @@ -1060,7 +1060,7 @@ limitations under the License. ${basedir}/docs/javadoc/overview.html true - giraph-gremlin/src/main/java:gremlin-core/src/main/java:gremlin-driver/src/main/java:gremlin-groovy/src/main/java:gremlin-groovy-test/src/main/java:gremlin-server/src/main/java:gremlin-test/src/main/java:hadoop-gremlin/src/main/java:neo4j-gremlin/src/main/java:spark-gremlin/src/main/java:tinkergraph-gremlin/src/main/java + giraph-gremlin/src/main/java:gremlin-core/src/main/java:gremlin-driver/src/main/java:gremlin-groovy/src/main/java:gremlin-groovy-test/src/main/java:gremlin-python/src/main/java:gremlin-server/src/main/java:gremlin-test/src/main/java:hadoop-gremlin/src/main/java:neo4j-gremlin/src/main/java:spark-gremlin/src/main/java:tinkergraph-gremlin/src/main/java @@ -1080,11 +1080,20 @@ limitations under the License. gremlin-core/src/main/java:gremlin-driver/src/main/java + + + org/apache/tinkerpop/gremlin/jsr223/*.java + + + org/apache/tinkerpop/gremlin/jsr223/console/*.java + - org/apache/tinkerpop/gremlin/structure/*.java + + org/apache/tinkerpop/gremlin/structure/*.java - org/apache/tinkerpop/gremlin/structure/io/*.java + + org/apache/tinkerpop/gremlin/structure/io/*.java org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java @@ -1105,7 +1114,8 @@ limitations under the License. org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java - org/apache/tinkerpop/gremlin/process/*.java + + org/apache/tinkerpop/gremlin/process/*.java org/apache/tinkerpop/gremlin/process/computer/*.java @@ -1120,7 +1130,8 @@ limitations under the License. org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java - org/apache/tinkerpop/gremlin/process/traversal/*.java + + org/apache/tinkerpop/gremlin/process/traversal/*.java org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
[29/50] tinkerpop git commit: TINKERPOP-1562 Rename "modules" as "plugin"
TINKERPOP-1562 Rename "modules" as "plugin" Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/aee85b12 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/aee85b12 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/aee85b12 Branch: refs/heads/TINKERPOP-1562 Commit: aee85b12f55c2a6b6426e6386677d6bec46513a8 Parents: e9e5cfe Author: Stephen MalletteAuthored: Tue Nov 22 06:59:49 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:28:51 2016 -0500 -- .../gremlin/groovy/engine/GremlinExecutor.java | 40 ++-- .../tinkerpop/gremlin/server/Settings.java | 4 +- .../server/util/ServerGremlinExecutor.java | 6 +-- 3 files changed, 25 insertions(+), 25 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aee85b12/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java -- diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java index 4449e1b..84f1992 100644 --- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java +++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java @@ -85,7 +85,7 @@ public class GremlinExecutor implements AutoCloseable { private GremlinScriptEngineManager gremlinScriptEngineManager; private final Map settings; -private final Map >> modules; +private final Map >> plugins; private final long scriptEvaluationTimeout; private final Bindings globalBindings; private final List use; @@ -111,7 +111,7 @@ public class GremlinExecutor implements AutoCloseable { this.afterFailure = builder.afterFailure; this.use = builder.use; this.settings = builder.settings; -this.modules = builder.modules; +this.plugins = builder.plugins; this.scriptEvaluationTimeout = builder.scriptEvaluationTimeout; this.globalBindings = builder.globalBindings; this.enabledPlugins = builder.enabledPlugins; @@ -426,14 +426,14 @@ public class GremlinExecutor implements AutoCloseable { } private void initializeGremlinScriptEngineManager() { -this.useGremlinScriptEngineManager = !modules.entrySet().isEmpty(); +this.useGremlinScriptEngineManager = !plugins.entrySet().isEmpty(); -for (Map.Entry
>> config : modules.entrySet()) { +for (Map.Entry >> config : plugins.entrySet()) { final String language = config.getKey(); -final Map > moduleConfigs = config.getValue(); -for (Map.Entry > moduleConfig : moduleConfigs.entrySet()) { +final Map > pluginConfigs = config.getValue(); +for (Map.Entry > pluginConfig : pluginConfigs.entrySet()) { try { -final Class clazz = Class.forName(moduleConfig.getKey()); +final Class clazz = Class.forName(pluginConfig.getKey()); // first try instance() and if that fails try to use build() try { @@ -441,29 +441,29 @@ public class GremlinExecutor implements AutoCloseable { gremlinScriptEngineManager.addPlugin((GremlinPlugin) instanceMethod.invoke(null)); } catch (Exception ex) { final Method builderMethod = clazz.getMethod("build"); -Object moduleBuilder = builderMethod.invoke(null); +Object pluginBuilder = builderMethod.invoke(null); -final Class builderClazz = moduleBuilder.getClass(); -final Map customizerConfigs = moduleConfig.getValue(); +final Class builderClazz = pluginBuilder.getClass(); +final Map customizerConfigs = pluginConfig.getValue(); final Method[] methods = builderClazz.getMethods(); for (Map.Entry customizerConfig : customizerConfigs.entrySet()) { final Method configMethod = Stream.of(methods).filter(m -> m.getName().equals(customizerConfig.getKey())).findFirst()
[36/50] tinkerpop git commit: TINKERPOP-1562 Deprecated the CredentialGraph
TINKERPOP-1562 Deprecated the CredentialGraph and moved it to a new home so tht the "plugin" package can go away completely. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/6439d709 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/6439d709 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/6439d709 Branch: refs/heads/TINKERPOP-1562 Commit: 6439d709c60a107b3e6a3b79231344f8a2ce2e7a Parents: 39e3965 Author: Stephen MalletteAuthored: Tue Nov 29 10:13:04 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:50 2016 -0500 -- .../dsl/credential/CredentialGraphTest.java | 121 +++ .../dsl/credential/CredentialGraphTest.java | 2 +- .../groovy/util/DependencyGrabber.groovy| 14 +++ .../jsr223/dsl/credential/CredentialGraph.java | 121 +++ .../CredentialGraphGremlinPlugin.java | 51 .../dsl/credential/CredentialGraphTokens.java | 31 + .../plugin/dsl/credential/CredentialGraph.java | 2 + .../dsl/credential/CredentialGraphTokens.java | 2 + .../jsr223/CredentialGraphGremlinPlugin.java| 55 - ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin | 2 +- 10 files changed, 344 insertions(+), 57 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6439d709/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java -- diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java new file mode 100644 index 000..e3a713d --- /dev/null +++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java @@ -0,0 +1,121 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential; + +import org.apache.tinkerpop.gremlin.AbstractGremlinTest; +import org.apache.tinkerpop.gremlin.FeatureRequirement; +import org.apache.tinkerpop.gremlin.FeatureRequirementSet; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.hamcrest.MatcherAssert; +import org.junit.Test; + +import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraph.credentials; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.greaterThan; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNull; + +/** + * @author Stephen Mallette (http://stephen.genoprime.com) + */ +public class CredentialGraphTest extends AbstractGremlinTest { + +@Test +@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) +public void shouldCreateUser() { +final Vertex v = credentials(graph).createUser("stephen", "secret"); +assertEquals("stephen", v.value("username")); +assertEquals("user", v.label()); +assertNotEquals("secret", v.value("password")); // hashed to something +assertThat(v.value("password").toString().length(), greaterThan(0)); +} + +@Test +@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) +@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_REMOVE_VERTICES) +public void shouldRemoveUser() { +MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); +credentials(graph).createUser("stephen", "secret"); +MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); + +assertEquals(1, credentials(graph).removeUser("stephen")); +
[43/50] tinkerpop git commit: TINKERPOP-1562 Hook up Console to do core imports under v3d3
TINKERPOP-1562 Hook up Console to do core imports under v3d3 Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/83689211 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/83689211 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/83689211 Branch: refs/heads/TINKERPOP-1562 Commit: 83689211d05905fb4fd31375a8db225200a72ae5 Parents: 6d1b97e Author: Stephen MalletteAuthored: Wed Nov 30 07:28:37 2016 -0500 Committer: Stephen Mallette Committed: Fri Dec 2 06:31:50 2016 -0500 -- .../tinkerpop/gremlin/console/Console.groovy| 21 +--- .../ConsoleImportCustomizerProvider.groovy | 2 ++ 2 files changed, 16 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/83689211/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy index d39e085..a2e518c 100644 --- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy +++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy @@ -31,6 +31,8 @@ import org.apache.tinkerpop.gremlin.console.commands.UninstallCommand import org.apache.tinkerpop.gremlin.console.plugin.PluggedIn import org.apache.tinkerpop.gremlin.groovy.loaders.GremlinLoader import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin +import org.apache.tinkerpop.gremlin.jsr223.CoreGremlinPlugin +import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalExplanation import org.apache.tinkerpop.gremlin.structure.Edge import org.apache.tinkerpop.gremlin.structure.T @@ -103,13 +105,18 @@ class Console { // hide output temporarily while imports execute showShellEvaluationOutput(false) -// TODO: register CoreGremlinPlugin if using v3d3 - -// add the default imports -new ConsoleImportCustomizerProvider().getCombinedImports().stream() -.collect { IMPORT_SPACE + it }.each { groovy.execute(it) } -new ConsoleImportCustomizerProvider().getCombinedStaticImports().stream() -.collect { IMPORT_STATIC_SPACE + it }.each { groovy.execute(it) } +if (Mediator.useV3d3) { +def imports = (ImportCustomizer) CoreGremlinPlugin.instance().getCustomizers("gremlin-groovy").get()[0] +imports.classImports.collect { IMPORT_SPACE + it.canonicalName }.each { groovy.execute(it) } +imports.methodImports.collect { IMPORT_STATIC_SPACE + it.getDeclaringClass().getCanonicalName() + "." + it.name}.each{ groovy.execute(it) } +imports.enumImports.collect { IMPORT_STATIC_SPACE + it.getDeclaringClass().getCanonicalName() + "." + it.name()}.each{ groovy.execute(it) } +} else { +// add the default imports +new ConsoleImportCustomizerProvider().getCombinedImports().stream() +.collect { IMPORT_SPACE + it }.each { groovy.execute(it) } +new ConsoleImportCustomizerProvider().getCombinedStaticImports().stream() +.collect { IMPORT_STATIC_SPACE + it }.each { groovy.execute(it) } +} final InteractiveShellRunner runner = new InteractiveShellRunner(groovy, handlePrompt) runner.setErrorHandler(handleError) http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/83689211/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/ConsoleImportCustomizerProvider.groovy -- diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/ConsoleImportCustomizerProvider.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/ConsoleImportCustomizerProvider.groovy index 0404e93..85fda8c 100644 --- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/ConsoleImportCustomizerProvider.groovy +++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/ConsoleImportCustomizerProvider.groovy @@ -23,7 +23,9 @@ import groovy.sql.Sql /** * @author Stephen Mallette (http://stephen.genoprime.com) + * @deprecated As of release 3.2.4, not replaced. */ +@Deprecated class ConsoleImportCustomizerProvider extends AbstractImportCustomizerProvider { public ConsoleImportCustomizerProvider() { // useful groovy bits that are good for the Console