You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by va...@apache.org on 2024/05/17 19:52:36 UTC
(tinkerpop) 01/01: remove outdated plugins
This is an automated email from the ASF dual-hosted git repository.
valentyn pushed a commit to branch valentyn/console
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit b87eab537673ee3021b65b42174183d914b216ff
Author: Valentyn Kahamlyk <Va...@improving.com>
AuthorDate: Fri May 17 12:52:23 2024 -0700
remove outdated plugins
---
.../console/jsr223/GephiRemoteAcceptor.groovy | 371 ---------------------
.../GephiTraversalVisualizationStrategy.groovy | 121 -------
.../gremlin/console/jsr223/GephiGremlinPlugin.java | 42 ---
...g.apache.tinkerpop.gremlin.jsr223.GremlinPlugin | 1 -
.../jsr223/GephiRemoteAcceptorIntegrateTest.java | 178 ----------
.../gremlin/jsr223/console/RemoteAcceptor.java | 4 +-
.../gremlin/neo4j/jsr223/Neo4jGremlinPlugin.java | 77 -----
7 files changed, 1 insertion(+), 793 deletions(-)
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
deleted file mode 100644
index b5f6ec3a00..0000000000
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptor.groovy
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.console.jsr223
-
-import groovy.json.JsonOutput
-import groovy.json.JsonSlurper
-import groovy.transform.CompileStatic
-import org.apache.http.client.methods.CloseableHttpResponse
-import org.apache.http.client.methods.HttpUriRequest
-import org.apache.http.client.methods.RequestBuilder
-import org.apache.http.entity.StringEntity
-import org.apache.http.impl.client.CloseableHttpClient
-import org.apache.http.impl.client.HttpClients
-import org.apache.http.util.EntityUtils
-import org.apache.tinkerpop.gremlin.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
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @author Randall Barnhart (randompi@gmail.com)
- */
-class GephiRemoteAcceptor implements RemoteAcceptor {
-
- private String host = "localhost"
- private int port = 8080
- private String workspace = "workspace1"
-
- private final GremlinShellEnvironment shell
-
- 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 GremlinShellEnvironment shell) {
- this.shell = shell
-
- // traversal visualization defaults
- vizStepDelay = 1000; // 1 second pause between viz of steps
- vizStartRGBColor = [0.0f, 1.0f, 0.5f] // light aqua green
- vizDefaultRGBColor = [0.6f, 0.6f, 0.6f] // light grey
- vizColorToFade = 'g' // will fade so blue is strongest
- vizColorFadeRate = 0.7 // the multiplicative rate to fade visited vertices
- vizStartSize = 10
- vizSizeDecrementRate = 0.33f
- }
-
- @Override
- connect(final List<String> args) throws RemoteException {
- if (args.size() >= 1)
- workspace = args[0]
-
- if (args.size() >= 2)
- host = args[1]
-
- if (args.size() >= 3) {
- try {
- port = Integer.parseInt(args[2])
- } catch (Exception ex) {
- throw new RemoteException("Port must be an integer value")
- }
- }
-
- def vizConfig = " with stepDelay:$vizStepDelay, startRGBColor:$vizStartRGBColor, " +
- "colorToFade:$vizColorToFade, colorFadeRate:$vizColorFadeRate, startSize:$vizStartSize," +
- "sizeDecrementRate:$vizSizeDecrementRate"
-
- return "Connection to Gephi - http://$host:$port/$workspace" + vizConfig
- }
-
- @Override
- Object configure(final List<String> args) throws RemoteException {
- if (args.size() < 2 && args[0] != "help")
- throw new RemoteException("Invalid config arguments - check syntax")
-
- if (args[0] == "help")
- return ":remote config [host <host>|port <port>|workspace <name>|stepDelay <ms>|startRGBColor <0.0,0.0,0.0>|colorToFade [r|g|b]|colorFadeRate <0.0>|sizeDecrementRate <0.0>|startSize <0.0>|visualTraversal <graph>|help]"
-
- if (args[0] == "host")
- host = args[1]
- else if (args[0] == "port") {
- try {
- port = Integer.parseInt(args[1])
- } catch (Exception ignored) {
- throw new RemoteException("Port must be an integer value")
- }
- } else if (args[0] == "workspace")
- workspace = args[1]
- else if (args[0] == "stepDelay")
- parseVizStepDelay(args[1])
- else if (args[0] == "startRGBColor")
- parseVizStartRGBColor(args[1])
- else if (args[0] == "colorToFade")
- parseVizColorToFade(args[1])
- else if (args[0] == "colorFadeRate")
- parseVizColorFadeRate(args[1])
- else if (args[0] == "sizeDecrementRate")
- parseVizSizeDecrementRate(args[1])
- else if (args[0] == "startSize")
- parseVizStartSize(args[1])
- else if (args[0] == "visualTraversal") {
- def graphVar = shell.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 = graphVar.traversal().withStrategies(new GephiTraversalVisualizationStrategy(this))
- shell.setVariable(gVar, theG)
- } else
- throw new RemoteException("Invalid config arguments - check syntax")
-
- return "Connection to Gephi - http://$host:$port/$workspace" +
- " with stepDelay:$vizStepDelay, startRGBColor:$vizStartRGBColor, " +
- "colorToFade:$vizColorToFade, colorFadeRate:$vizColorFadeRate, startSize:$vizStartSize," +
- "sizeDecrementRate:$vizSizeDecrementRate"
- }
-
- @Override
- @CompileStatic
- Object submit(final List<String> args) throws RemoteException {
- final String line = String.join(" ", args)
- if (line.trim() == "clear") {
- clearGraph()
- shell.println("Gephi workspace cleared")
- return
- }
-
- // need to clear the vertex attributes
- vertexAttributes.clear()
-
- // this tells the GraphTraversalVisualizationStrategy that if the line eval's to a traversal it should
- // try to visualize it
- traversalSubmittedForViz = true
-
- // get the colors/sizes back to basics before trying visualize
- resetColorsSizes()
-
- final Object o = shell.execute(line)
- if (o instanceof Graph) {
- clearGraph()
- def graph = (Graph) o
- def g = graph.traversal()
- g.V().sideEffect { addVertexToGephi(g, it.get()) }.iterate()
- }
-
- traversalSubmittedForViz = false
- }
-
- @Override
- void close() throws IOException {
- httpclient.close()
- }
-
- /**
- * Visits the last set of vertices traversed and degrades their color and size.
- */
- def updateVisitedVertices(def List except = []) {
- vertexAttributes.keySet().findAll{ vertexId -> !except.contains(vertexId) }.each { String vertexId ->
- def attrs = vertexAttributes[vertexId]
- float currentColor = attrs.color
- currentColor *= vizColorFadeRate
-
- int currentSize = attrs["size"]
- currentSize = Math.max(vizStartSize, currentSize - (currentSize * vizSizeDecrementRate))
-
- vertexAttributes.get(vertexId).color = currentColor
- vertexAttributes.get(vertexId).size = currentSize
-
- changeVertexAttributes(vertexId)
- }
- }
-
- def changeVertexAttributes(def String vertexId) {
- def props = [:]
- props.put(vizColorToFade.toString(), vertexAttributes[vertexId].color)
- props.put("size", vertexAttributes[vertexId].size)
- updateGephiGraph([cn: [(vertexId): props]])
- }
-
- /**
- * Visit a vertex traversed and initialize its color and size.
- */
- def visitVertexInGephi(def Vertex v) {
- def props = [:]
- props.put('r', vizStartRGBColor[0])
- props.put('g', vizStartRGBColor[1])
- props.put('b', vizStartRGBColor[2])
- props.put('size', vizStartSize * 2.5)
- props.put('visited', 1)
-
- updateGephiGraph([cn: [(v.id().toString()): props]])
-
- vertexAttributes[v.id().toString()] = [color: vizStartRGBColor[fadeColorIndex()], size: vizStartSize * 2.5, touch: 1]
- }
-
- def fadeColorIndex() {
- if (vizColorToFade == 'r')
- return 0
- else if (vizColorToFade == 'g')
- return 1
- else if (vizColorToFade == 'b')
- return 2
- }
-
- def addVertexToGephi(def GraphTraversalSource g, def Vertex v, def boolean ignoreEdges = false) {
- // grab the first property value from the strategies of values
- def props = g.V(v).valueMap().next().collectEntries { kv -> [(kv.key): kv.value[0]] }
- props << [label: v.label()]
- props.put('r', vizDefaultRGBColor[0])
- props.put('g', vizDefaultRGBColor[1])
- props.put('b', vizDefaultRGBColor[2])
- props.put('x', rand.nextFloat())
- props.put('y', rand.nextFloat())
- props.put('size', 10)
- props.put('visited', 0)
-
- // only add if it does not exist in graph already
- if (!getFromGephiGraph([operation: "getNode", id: v.id().toString()]).isPresent())
- updateGephiGraph([an: [(v.id().toString()): props]])
-
- if (!ignoreEdges) {
- g.V(v).outE().sideEffect {
- addEdgeToGephi(g, it.get())
- }.iterate()
- }
- }
-
- @CompileStatic
- def addEdgeToGephi(def GraphTraversalSource g, def Edge e) {
- def props = g.E(e).valueMap().next()
- props.put('label', e.label())
- props.put('source', e.outVertex().id().toString())
- props.put('target', e.inVertex().id().toString())
- props.put('directed', true)
- props.put('visited', 0)
-
- // make sure the in vertex is there but don't add its edges - that will happen later as we are looping
- // all vertices in the graph
- addVertexToGephi(g, e.inVertex(), true)
-
- // both vertices are definitely there now, so add the edge
- updateGephiGraph([ae: [(e.id().toString()): props]])
- }
-
- def clearGraph() {
- updateGephiGraph([dn: [filter: "ALL"]])
- }
-
- def resetColorsSizes() {
- updateGephiGraph([cn: [filter: [nodeAttribute: [attribute: "visited", value: 1]],
- attributes: [size: 1, r: vizDefaultRGBColor[0], g: vizDefaultRGBColor[1], b: vizDefaultRGBColor[2]]]])
- updateGephiGraph([ce: [filter: [edgeAttribute: [attribute: "visited", value: 1]],
- attributes: [size: 1, r: vizDefaultRGBColor[0], g: vizDefaultRGBColor[1], b: vizDefaultRGBColor[2]]]])
- }
-
- def getFromGephiGraph(def Map queryArgs) {
- def requestBuilder = RequestBuilder.get("http://$host:$port/$workspace")
- queryArgs.each { requestBuilder = requestBuilder.addParameter(it.key, it.value) }
-
- def httpResp = makeRequest(requestBuilder.build())
- def resp = EntityUtils.toString(httpResp.entity)
-
- // gephi streaming plugin does not set the content type or respect the Accept header - treat as text
- if (resp.isEmpty())
- return Optional.empty()
- else
- return Optional.of(new JsonSlurper().parseText(resp))
- }
-
- def updateGephiGraph(def Map postBody) {
- def requestBuilder = RequestBuilder.post("http://$host:$port/$workspace")
- .addParameter("format", "JSON")
- .addParameter("operation", "updateGraph")
- .setEntity(new StringEntity(JsonOutput.toJson(postBody)))
- EntityUtils.consume(makeRequest(requestBuilder.build()).entity)
- }
-
- private CloseableHttpResponse makeRequest(HttpUriRequest request) {
- def httpResp = httpclient.execute(request)
- if (httpResp.getStatusLine().getStatusCode() == 200) {
- return httpResp
- } else {
- def resp = EntityUtils.toString(httpResp.entity)
- throw new RuntimeException("Unsuccessful request to Gephi - [${httpResp.getStatusLine().getStatusCode()}] ${httpResp.getStatusLine().getReasonPhrase()} - $resp")
- }
- }
-
- @Override
- public String toString() {
- return "Gephi - [$workspace]"
- }
-
- private void parseVizStepDelay(String arg) {
- try {
- vizStepDelay = Long.parseLong(arg)
- } catch (Exception ignored) {
- throw new RemoteException("The stepDelay must be a long value")
- }
- }
-
- private void parseVizStartRGBColor(String arg) {
- try {
- vizStartRGBColor = arg[1..-2].tokenize(',')*.toFloat()
- assert (vizStartRGBColor.length == 3)
- } catch (Exception ignored) {
- throw new RemoteException("The vizStartRGBColor must be an array of 3 float values, e.g. [0.0,1.0,0.5]")
- }
- }
-
- private void parseVizColorToFade(String arg) {
- try {
- vizColorToFade = arg.charAt(0).toLowerCase();
- assert (vizColorToFade == 'r' || vizColorToFade == 'g' || vizColorToFade == 'b')
- } catch (Exception ignored) {
- throw new RemoteException("The vizColorToFade must be one character value among: r, g, b, R, G, B")
- }
- }
-
- private void parseVizColorFadeRate(String arg) {
- try {
- vizColorFadeRate = Float.parseFloat(arg)
- } catch (Exception ignored) {
- throw new RemoteException("The colorFadeRate must be a float value")
- }
- }
-
- private void parseVizSizeDecrementRate(String arg) {
- try {
- vizSizeDecrementRate = Float.parseFloat(arg)
- } catch (Exception ignored) {
- throw new RemoteException("The sizeDecrementRate must be a float value")
- }
- }
-
- private void parseVizStartSize(String arg) {
- try {
- vizStartSize = Float.parseFloat(arg)
- } catch (Exception ignored) {
- throw new RemoteException("The startSize must be a float value")
- }
- }
-}
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiTraversalVisualizationStrategy.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiTraversalVisualizationStrategy.groovy
deleted file mode 100644
index 4cb8ffd591..0000000000
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/jsr223/GephiTraversalVisualizationStrategy.groovy
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.console.jsr223
-
-import groovy.transform.CompileStatic
-import org.apache.tinkerpop.gremlin.process.traversal.Step
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser
-import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.EdgeOtherVertexStep
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.EdgeVertexStep
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep
-import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AggregateGlobalStep
-import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.LambdaSideEffectStep
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.ProfileStrategy
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper
-import org.apache.tinkerpop.gremlin.structure.Vertex
-
-import java.util.stream.Collectors
-
-/**
- * A strategy that works in conjunction with the {@link GephiRemoteAcceptor} to automatically inject visualization
- * steps after "vertex" steps to show the vertices traversed for a step. If the traversal was evaluated in the
- * console normally then the visualization strategy will not be applied. It must be {@code :submit} to the
- * console for the strategy to be applied.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-@CompileStatic
-class GephiTraversalVisualizationStrategy extends AbstractTraversalStrategy<TraversalStrategy.FinalizationStrategy>
- implements TraversalStrategy.FinalizationStrategy {
-
- private static final Set<Class<? extends TraversalStrategy.FinalizationStrategy>> POSTS = new HashSet<>();
-
- static {
- POSTS.add(ProfileStrategy.class);
- }
-
- private final GephiRemoteAcceptor acceptor
-
- private final String sideEffectKey = "viz-" + UUID.randomUUID()
-
- GephiTraversalVisualizationStrategy(final GephiRemoteAcceptor acceptor) {
- this.acceptor = acceptor
- }
-
- @Override
- void apply(final Traversal.Admin<?, ?> traversal) {
- if (TraversalHelper.onGraphComputer(traversal))
- return
-
- // only apply these strategies if the traversal was :submit to the acceptor - otherwise process as usual
- if (acceptor.traversalSubmittedForViz) {
- final List<GraphStep> graphSteps = TraversalHelper.getStepsOfAssignableClass(GraphStep.class, traversal)
- final List<VertexStep> vertexSteps = TraversalHelper.getStepsOfAssignableClass(VertexStep.class, traversal)
-
- def List<Step> addAfter = new ArrayList<>()
- addAfter.addAll(TraversalHelper.getStepsOfAssignableClass(EdgeOtherVertexStep.class, traversal))
- addAfter.addAll(TraversalHelper.getStepsOfAssignableClass(EdgeVertexStep.class, traversal))
- addAfter.addAll(vertexSteps.stream().filter { it.returnsVertex() }.collect(Collectors.toList()))
- addAfter.addAll(graphSteps.stream().filter { it.returnsVertex() }.collect(Collectors.toList()))
-
- // decay all vertices and visit each one to update their colors to the brightest
- addAfter.each { Step s ->
- TraversalHelper.insertAfterStep(new LambdaSideEffectStep(traversal, { Traverser traverser ->
- final BulkSet<Vertex> vertices = ((BulkSet<Vertex>) traverser.sideEffects(sideEffectKey))
- if (!vertices.isEmpty()) {
- acceptor.updateVisitedVertices()
- vertices.forEach { Vertex v, Long l -> acceptor.visitVertexInGephi(v) }
- vertices.clear()
- Thread.sleep(acceptor.vizStepDelay)
- }
- }), s, traversal)
- TraversalHelper.insertAfterStep(new AggregateGlobalStep(traversal, sideEffectKey), s, traversal)
- }
-
- // decay all vertices except those that made it through the filter - "this way you can watch
- // the Gremlins dying" - said daniel kuppitz. can't do this easily with generic FilterStep as
- // it creates odd behaviors when used with loop (extra decay that probably shouldn't be there.
- // todo: can this be better? maybe we shouldn't do this at all
- TraversalHelper.getStepsOfAssignableClass(HasStep.class, traversal).each { HasStep s ->
- TraversalHelper.insertAfterStep(new LambdaSideEffectStep(traversal, { Traverser traverser ->
- final BulkSet<Object> objects = ((BulkSet<Object>) traverser.sideEffects(sideEffectKey))
- if (!objects.isEmpty()) {
- final List<String> vertices = objects.findAll { Object o -> o instanceof Vertex }
- .collect { Object o -> ((Vertex) o).id().toString() }
- acceptor.updateVisitedVertices(vertices)
- objects.clear()
- Thread.sleep(acceptor.vizStepDelay)
- }
- }), s, traversal)
- TraversalHelper.insertAfterStep(new AggregateGlobalStep(traversal, sideEffectKey), s, traversal)
- }
- }
- }
-
- @Override
- public Set<Class<? extends TraversalStrategy.FinalizationStrategy>> applyPost() {
- return POSTS;
- }
-}
diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiGremlinPlugin.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiGremlinPlugin.java
deleted file mode 100644
index aa9f9a2dcd..0000000000
--- a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiGremlinPlugin.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.console.jsr223;
-
-import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
-import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer;
-import org.apache.tinkerpop.gremlin.jsr223.console.GremlinShellEnvironment;
-import org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class GephiGremlinPlugin extends AbstractGremlinPlugin {
- private static final String NAME = "tinkerpop.gephi";
-
- public GephiGremlinPlugin() {
- super(NAME, new GephiConsoleCustomizer());
- }
-
- private static class GephiConsoleCustomizer implements ConsoleCustomizer {
- @Override
- public RemoteAcceptor getRemoteAcceptor(final GremlinShellEnvironment gremlinShellEnvironment) {
- return new GephiRemoteAcceptor(gremlinShellEnvironment);
- }
- }
-}
diff --git a/gremlin-console/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin b/gremlin-console/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
index 631c889eec..a40d8c802e 100644
--- a/gremlin-console/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
+++ b/gremlin-console/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
@@ -1,3 +1,2 @@
org.apache.tinkerpop.gremlin.console.jsr223.DriverGremlinPlugin
-org.apache.tinkerpop.gremlin.console.jsr223.GephiGremlinPlugin
org.apache.tinkerpop.gremlin.console.jsr223.UtilitiesGremlinPlugin
\ No newline at end of file
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptorIntegrateTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptorIntegrateTest.java
deleted file mode 100644
index 7781d8721e..0000000000
--- a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/jsr223/GephiRemoteAcceptorIntegrateTest.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.console.jsr223;
-
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-import org.apache.commons.io.input.NullInputStream;
-import org.apache.groovy.groovysh.Groovysh;
-import org.apache.tinkerpop.gremlin.console.GremlinGroovysh;
-import org.apache.tinkerpop.gremlin.console.Mediator;
-import org.apache.tinkerpop.gremlin.jsr223.console.RemoteException;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
-import org.codehaus.groovy.tools.shell.IO;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.ServerSocket;
-import java.util.Arrays;
-import java.util.Collections;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static org.hamcrest.CoreMatchers.startsWith;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class GephiRemoteAcceptorIntegrateTest {
- private static final Groovysh groovysh = new GremlinGroovysh(new Mediator(null), new IO());
- private static int port = pickOpenPort();
-
- private GephiRemoteAcceptor acceptor;
-
- private final InputStream inputStream = new NullInputStream(0);
- private final OutputStream outputStream = new ByteArrayOutputStream();
- private final OutputStream errorStream = new ByteArrayOutputStream();
- private final IO io = new IO(inputStream, outputStream, errorStream);
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(port);
-
- static {
- final Graph graph = TinkerFactory.createModern();
- groovysh.getInterp().getContext().setProperty("graph", graph);
- }
-
- @Before
- public void before() throws Exception {
- acceptor = new GephiRemoteAcceptor(new MockGroovyGremlinShellEnvironment(groovysh, io));
- acceptor.configure(Arrays.asList("port", String.valueOf(port)));
- }
-
- @Test
- public void shouldConnectWithDefaults() throws RemoteException {
- assertThat(acceptor.connect(Collections.emptyList()).toString(), startsWith("Connection to Gephi - http://localhost:" + port + "/workspace1"));
- }
-
- @Test
- public void shouldSubmitGraph() throws RemoteException {
- stubFor(post(urlPathEqualTo("/workspace1"))
- .withQueryParam("format", equalTo("JSON"))
- .withQueryParam("operation", equalTo("updateGraph"))
- .willReturn(aResponse()
- .withStatus(200)));
-
- stubFor(get(urlPathEqualTo("/workspace1"))
- .withQueryParam("operation", equalTo("getNode"))
- .willReturn(aResponse()
- .withStatus(200)));
-
- acceptor.submit(Arrays.asList("g = org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph.open();g.addVertex();g"));
-
- wireMockRule.verify(4, postRequestedFor(urlPathEqualTo("/workspace1")));
- wireMockRule.verify(1, getRequestedFor(urlPathEqualTo("/workspace1")));
- }
-
- @Test
- public void shouldSubmitTraversalAfterConfigWithDefaultG() throws RemoteException {
- stubFor(post(urlPathEqualTo("/workspace1"))
- .withQueryParam("format", equalTo("JSON"))
- .withQueryParam("operation", equalTo("updateGraph"))
- .willReturn(aResponse()
- .withStatus(200)));
-
- acceptor.configure(Arrays.asList("visualTraversal", "graph"));
-
- // call iterate() as groovysh isn't rigged to auto-iterate
- acceptor.submit(Arrays.asList(
- "vg.V(2).in('knows').out('knows').has('age',org.apache.tinkerpop.gremlin.process.traversal.P.gt(30)).outE('created').has('weight',org.apache.tinkerpop.gremlin.process.traversal.P.gt(0.5d)).inV().iterate()"));
-
- wireMockRule.verify(18, postRequestedFor(urlPathEqualTo("/workspace1")));
- }
-
- @Test
- public void shouldSubmitTraversalAfterConfigWithDefinedG() throws RemoteException {
- stubFor(post(urlPathEqualTo("/workspace1"))
- .withQueryParam("format", equalTo("JSON"))
- .withQueryParam("operation", equalTo("updateGraph"))
- .willReturn(aResponse()
- .withStatus(200)));
-
- acceptor.configure(Arrays.asList("visualTraversal", "graph", "x"));
-
- // call iterate() as groovysh isn't rigged to auto-iterate
- acceptor.submit(Arrays.asList(
- "x.V(2).in('knows').out('knows').has('age',org.apache.tinkerpop.gremlin.process.traversal.P.gt(30)).outE('created').has('weight',org.apache.tinkerpop.gremlin.process.traversal.P.gt(0.5d)).inV().iterate()"));
-
- wireMockRule.verify(18, postRequestedFor(urlPathEqualTo("/workspace1")));
- }
-
- @Test
- public void shouldSubmitTraversalOverRepeat() throws RemoteException {
- stubFor(post(urlPathEqualTo("/workspace1"))
- .withQueryParam("format", equalTo("JSON"))
- .withQueryParam("operation", equalTo("updateGraph"))
- .willReturn(aResponse()
- .withStatus(200)));
-
- acceptor.configure(Arrays.asList("visualTraversal", "graph"));
-
- // call iterate() as groovysh isn't rigged to auto-iterate
- acceptor.submit(Arrays.asList(
- "vg.V(1).repeat(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.__().out()).times(2).iterate()"));
-
- wireMockRule.verify(13, postRequestedFor(urlPathEqualTo("/workspace1")));
- }
-
- @Test
- public void shouldClearGraph() throws RemoteException {
- stubFor(post(urlPathEqualTo("/workspace1"))
- .withQueryParam("format", equalTo("JSON"))
- .withQueryParam("operation", equalTo("updateGraph"))
- .withRequestBody(equalToJson("{\"dn\":{\"filter\":\"ALL\"}}"))
- .willReturn(aResponse()
- .withStatus(200)));
-
- acceptor.submit(Arrays.asList("clear"));
-
- wireMockRule.verify(1, postRequestedFor(urlPathEqualTo("/workspace1")));
- }
-
- private static int pickOpenPort() {
- try (final ServerSocket socket = new ServerSocket(0)) {
- return socket.getLocalPort();
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- }
-}
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 c1a8c913e7..976693bca7 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
@@ -73,9 +73,7 @@ public interface RemoteAcceptor extends Closeable {
* A {@code RemoteAcceptor} should only return {@code true} for this method if it expects that all activities it
* supports are executed through the {@code :submit} command. If the users interaction with the remote requires
* working with both local and remote evaluation at the same time, it is likely best to keep this method return
- * {@code false}. A good example of this type of plugin would be the Gephi Plugin which uses {@code :remote config}
- * to configure a local {@code TraversalSource} to be used and expects calls to {@code :submit} for the same body
- * of analysis.
+ * {@code false}.
*/
public default boolean allowRemoteConsole() {
return false;
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
deleted file mode 100644
index 536b18c990..0000000000
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/jsr223/Neo4jGremlinPlugin.java
+++ /dev/null
@@ -1,77 +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.neo4j.jsr223;
-
-import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
-import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
-import org.apache.tinkerpop.gremlin.neo4j.process.traversal.LabelP;
-import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jEdge;
-import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jElement;
-import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph;
-import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraphVariables;
-import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jHelper;
-import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jProperty;
-import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jVertex;
-import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jVertexProperty;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated See: https://tinkerpop.apache.org/docs/3.5.7/reference/#neo4j-gremlin
- */
-@Deprecated
-public final class Neo4jGremlinPlugin extends AbstractGremlinPlugin {
-
- private static final String NAME = "tinkerpop.neo4j";
-
- private static final ImportCustomizer imports;
-
- static {
- try {
- imports = DefaultImportCustomizer.build()
- .addClassImports(Neo4jEdge.class,
- Neo4jElement.class,
- Neo4jGraph.class,
- Neo4jGraphVariables.class,
- Neo4jHelper.class,
- Neo4jProperty.class,
- Neo4jVertex.class,
- Neo4jVertexProperty.class,
- LabelP.class)
- .addMethodImports(LabelP.class.getMethod("of", String.class)).create();
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
- }
-
- private static final Neo4jGremlinPlugin instance = new Neo4jGremlinPlugin();
-
- public Neo4jGremlinPlugin() {
- super(NAME, imports);
- }
-
- public static Neo4jGremlinPlugin instance() {
- return instance;
- }
-
- @Override
- public boolean requireRestart() {
- return true;
- }
-}
\ No newline at end of file