This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/master by this push:
new 2dc81c9 Reverted TINKERPOP-2080 which got rid of
TraversalSource.withRemote()
2dc81c9 is described below
commit 2dc81c9148b791ecb7b904e8a9bdbe78ea9983f4
Author: Stephen Mallette <[email protected]>
AuthorDate: Fri Dec 14 12:01:12 2018 -0500
Reverted TINKERPOP-2080 which got rid of TraversalSource.withRemote()
It was a bit too hasty to get rid of this i think. It was just deprecated
in 3.3.5 - it probably needs to hang around longer. CTR
---
CHANGELOG.asciidoc | 1 -
docs/src/upgrade/release-3.4.x.asciidoc | 3 --
.../gremlin/process/traversal/TraversalSource.java | 52 ++++++++++++++++++++++
.../traversal/dsl/graph/GraphTraversalSource.java | 45 +++++++++++++++++++
.../dsl/sparql/SparqlTraversalSource.java | 28 ++++++++++++
5 files changed, 125 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 0c39110..1ab6403 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -77,7 +77,6 @@ This release also includes changes from <<release-3-3-3,
3.3.3>>.
* `MutationListener#vertexPropertyChanged(Vertex, VertexProperty, Object,
Object...)` no longer has a default implementation.
* Deprecated `GraphSONMessageSerializerV2d0` as it is now analogous to
`GraphSONMessageSerializerGremlinV2d0`.
* Moved previously deprecated `RemoteGraph` to `gremlin-test` as it is now
just a testing component.
-* Removed previously deprecated `TraversalSource.withRemote()`.
* Removed previously deprecated `RemoteStrategy.instance()` and the strategy
no longer has any connection to `RemoteGraph`.
* Removed previously deprecated methods in `SubgraphStrategy` and
`PartitionStrategy` builders.
* Removed previously deprecated Credentials DSL infrastructure.
diff --git a/docs/src/upgrade/release-3.4.x.asciidoc
b/docs/src/upgrade/release-3.4.x.asciidoc
index f885335..c739616 100644
--- a/docs/src/upgrade/release-3.4.x.asciidoc
+++ b/docs/src/upgrade/release-3.4.x.asciidoc
@@ -492,9 +492,7 @@ The following deprecated classes, methods or fields have
been removed in this ve
**
`org.apache.tinkerpop.gremlin.process.remote.RemoteConnection.submit(Bytecode)`
**
`org.apache.tinkerpop.gremlin.process.remote.traversal.strategy.decoration.RemoteStrategy#identity()`
** `org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine`
-**
`org.apache.tinkerpop.gremlin.process.traversal.TraversalSource#withRemote(*)`
** `org.apache.tinkerpop.gremlin.process.traversal.engine.*`
-**
`org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource#withRemote(*)`
**
`org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategy.Builder#addReadPartition(String)`
**
`org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy.Builder#edgeCriterion(Traversal)`
**
`org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy.Builder#vertexCriterion(Traversal)`
@@ -531,7 +529,6 @@
link:https://issues.apache.org/jira/browse/TINKERPOP-1707[TINKERPOP-1707],
link:https://issues.apache.org/jira/browse/TINKERPOP-1954[TINKERPOP-1954],
link:https://issues.apache.org/jira/browse/TINKERPOP-1986[TINKERPOP-1986],
link:https://issues.apache.org/jira/browse/TINKERPOP-2079[TINKERPOP-2079],
-link:https://issues.apache.org/jira/browse/TINKERPOP-2080[TINKERPOP-2080],
link:https://issues.apache.org/jira/browse/TINKERPOP-2103[TINKERPOP-2103]
==== Deprecated GraphSONMessageSerializerGremlinV2d0
diff --git
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
index a909edf..61d8606 100644
---
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
+++
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
@@ -18,20 +18,26 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.tinkerpop.gremlin.process.computer.Computer;
import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
import
org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
+import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
import
org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.OptionsStrategy;
import
org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SackStrategy;
import
org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SideEffectStrategy;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.util.function.ConstantSupplier;
+import java.lang.reflect.Constructor;
import java.util.Optional;
import java.util.function.BinaryOperator;
import java.util.function.Supplier;
import java.util.function.UnaryOperator;
+import static
org.apache.tinkerpop.gremlin.process.remote.RemoteConnection.GREMLIN_REMOTE_CONNECTION_CLASS;
+
/**
* A {@code TraversalSource} is used to create {@link Traversal} instances.
* A traversal source can generate any number of {@link Traversal} instances.
@@ -367,6 +373,52 @@ public interface TraversalSource extends Cloneable,
AutoCloseable {
return clone;
}
+ /**
+ * Configures the {@code TraversalSource} as a "remote" to issue the
{@link Traversal} for execution elsewhere.
+ * Expects key for {@link #GREMLIN_REMOTE_CONNECTION_CLASS} as well as any
configuration required by
+ * the underlying {@link RemoteConnection} which will be instantiated.
Note that the {@code Configuration} object
+ * is passed down without change to the creation of the {@link
RemoteConnection} instance.
+ *
+ * @deprecated As of release 3.3.5, replaced by {@link
AnonymousTraversalSource#withRemote(Configuration)}.
+ * @see <a
href="https://issues.apache.org/jira/browse/TINKERPOP-2078">TINKERPOP-2078</a>
+ */
+ @Deprecated
+ public default TraversalSource withRemote(final Configuration conf) {
+ if (!conf.containsKey(GREMLIN_REMOTE_CONNECTION_CLASS))
+ throw new IllegalArgumentException("Configuration must contain the
'" + GREMLIN_REMOTE_CONNECTION_CLASS + "' key");
+ final RemoteConnection remoteConnection;
+ try {
+ final Class<? extends RemoteConnection> clazz =
Class.forName(conf.getString(GREMLIN_REMOTE_CONNECTION_CLASS)).asSubclass(RemoteConnection.class);
+ final Constructor<? extends RemoteConnection> ctor =
clazz.getConstructor(Configuration.class);
+ remoteConnection = ctor.newInstance(conf);
+ } catch (Exception ex) {
+ throw new IllegalStateException(ex);
+ }
+ return withRemote(remoteConnection);
+ }
+ /**
+ * Configures the {@code TraversalSource} as a "remote" to issue the
{@link Traversal} for execution elsewhere.
+ * Calls {@link #withRemote(Configuration)} after reading the properties
file specified.
+ *
+ * @deprecated As of release 3.3.5, replaced by {@link
AnonymousTraversalSource#withRemote(String)}.
+ * @see <a
href="https://issues.apache.org/jira/browse/TINKERPOP-2078">TINKERPOP-2078</a>
+ */
+ @Deprecated
+ public default TraversalSource withRemote(final String configFile) throws
Exception {
+ return withRemote(new PropertiesConfiguration(configFile));
+ }
+ /**
+ * Configures the {@code TraversalSource} as a "remote" to issue the
{@link Traversal} for execution elsewhere.
+ * Implementations should track {@link RemoteConnection} instances that
are created and call
+ * {@link RemoteConnection#close()} on them when the {@code
TraversalSource} itself is closed.
+ *
+ * @param connection the {@link RemoteConnection} instance to use to
submit the {@link Traversal}.
+ * @deprecated As of release 3.3.5, replaced by {@link
AnonymousTraversalSource#withRemote(RemoteConnection)}.
+ * @see <a
href="https://issues.apache.org/jira/browse/TINKERPOP-2078">TINKERPOP-2078</a>
+ */
+ @Deprecated
+ public TraversalSource withRemote(final RemoteConnection connection);
+
public default Optional<Class> getAnonymousTraversalClass() {
return Optional.empty();
}
diff --git
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
index e0f0857..b60006d 100644
---
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
+++
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
@@ -18,10 +18,12 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.dsl.graph;
+import org.apache.commons.configuration.Configuration;
import org.apache.tinkerpop.gremlin.process.computer.Computer;
import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
import
org.apache.tinkerpop.gremlin.process.remote.traversal.strategy.decoration.RemoteStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
@@ -293,6 +295,49 @@ public class GraphTraversalSource implements
TraversalSource {
return clone;
}
+ /**
+ * {@inheritDoc}
+ *
+ * @deprecated As of release 3.3.5, replaced by {@link
AnonymousTraversalSource#withRemote(Configuration)}.
+ * @see <a
href="https://issues.apache.org/jira/browse/TINKERPOP-2078">TINKERPOP-2078</a>
+ */
+ @Override
+ @Deprecated
+ public GraphTraversalSource withRemote(final Configuration conf) {
+ return (GraphTraversalSource) TraversalSource.super.withRemote(conf);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @deprecated As of release 3.3.5, replaced by {@link
AnonymousTraversalSource#withRemote(String)}.
+ * @see <a
href="https://issues.apache.org/jira/browse/TINKERPOP-2078">TINKERPOP-2078</a>
+ */
+ @Override
+ @Deprecated
+ public GraphTraversalSource withRemote(final String configFile) throws
Exception {
+ return (GraphTraversalSource)
TraversalSource.super.withRemote(configFile);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @deprecated As of release 3.3.5, replaced by {@link
AnonymousTraversalSource#withRemote(RemoteConnection)}.
+ * @see <a
href="https://issues.apache.org/jira/browse/TINKERPOP-2078">TINKERPOP-2078</a>
+ */
+ @Override
+ @Deprecated
+ public GraphTraversalSource withRemote(final RemoteConnection connection) {
+ // check if someone called withRemote() more than once, so just
release resources on the initial
+ // connection as you can't have more than one. maybe better to toss
IllegalStateException??
+ if (this.connection != null)
+ throw new IllegalStateException(String.format("TraversalSource
already configured with a RemoteConnection [%s]", connection));
+ final GraphTraversalSource clone = this.clone();
+ clone.connection = connection;
+ clone.getStrategies().addStrategies(new RemoteStrategy(connection));
+ return clone;
+ }
+
//// SPAWNS
diff --git
a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
index fd3e8e9..c02442e 100644
---
a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
+++
b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
@@ -18,7 +18,9 @@
*/
package org.apache.tinkerpop.gremlin.sparql.process.traversal.dsl.sparql;
+import org.apache.commons.configuration.Configuration;
import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
+import
org.apache.tinkerpop.gremlin.process.remote.traversal.strategy.decoration.RemoteStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
@@ -90,6 +92,32 @@ public class SparqlTraversalSource implements
TraversalSource {
return (SparqlTraversalSource)
TraversalSource.super.withoutStrategies(traversalStrategyClasses);
}
+ @Override
+ public SparqlTraversalSource withRemote(final Configuration conf) {
+ return (SparqlTraversalSource) TraversalSource.super.withRemote(conf);
+ }
+
+ @Override
+ public SparqlTraversalSource withRemote(final String configFile) throws
Exception {
+ return (SparqlTraversalSource)
TraversalSource.super.withRemote(configFile);
+ }
+
+ @Override
+ public SparqlTraversalSource withRemote(final RemoteConnection connection)
{
+ try {
+ // check if someone called withRemote() more than once, so just
release resources on the initial
+ // connection as you can't have more than one. maybe better to
toss IllegalStateException??
+ if (this.connection != null)
+ this.connection.close();
+ } catch (Exception ignored) {
+ // not sure there's anything to do here
+ }
+ this.connection = connection;
+ final TraversalSource clone = this.clone();
+ clone.getStrategies().addStrategies(new RemoteStrategy(connection));
+ return (SparqlTraversalSource) clone;
+ }
+
/**
* The start step for a SPARQL based traversal that accepts a string
representation of the query to execute.
*/