You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/04/30 18:40:06 UTC
[1/5] incubator-tinkerpop git commit: Name of class that generated
test/sample data changed.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master c41b199d2 -> 4203c81ff
Name of class that generated test/sample data changed.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/c14f3df3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/c14f3df3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/c14f3df3
Branch: refs/heads/master
Commit: c14f3df3ff82fcc5c6d25c50e784824a341df66d
Parents: cf1594c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 30 11:39:20 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 30 11:39:20 2015 -0400
----------------------------------------------------------------------
README.asciidoc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c14f3df3/README.asciidoc
----------------------------------------------------------------------
diff --git a/README.asciidoc b/README.asciidoc
index beaab05..9ed85d7 100644
--- a/README.asciidoc
+++ b/README.asciidoc
@@ -41,7 +41,7 @@ mvn -Dmaven.javadoc.skip=true --projects tinkergraph-gremlin test
----
** Clean the `.groovy/grapes/org.apache.tinkerpop` directory on build: `mvn clean install -DcleanGrapes`
* Regenerate test data (only necessary given changes to IO classes): `mvn clean install -Dio` from `tinkergraph-gremlin` directory
-** If there are changes to the Gryo format, it may be necessary to generate the Grateful Dead dataset from GraphSON (see `TinkerGraphTest.shouldWriteGratefulDead`)
+** If there are changes to the Gryo format, it may be necessary to generate the Grateful Dead dataset from GraphSON (see `IoDataGenerationTest.shouldWriteGratefulDead`)
* Check license headers are present: `mvn apache-rat:check`
* Build AsciiDocs: `docs/preprocessor/preprocess.sh && mvn process-resources -Dasciidoc`
* Build JavaDocs: `mvn process-resources -Djavadoc`
[4/5] incubator-tinkerpop git commit: Javadoc improvements for IO.
Posted by sp...@apache.org.
Javadoc improvements for IO.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/ff9d518c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/ff9d518c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/ff9d518c
Branch: refs/heads/master
Commit: ff9d518c97a533f6d7665a48fe886678a7fed0b6
Parents: 215c054
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 30 12:39:01 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 30 12:39:01 2015 -0400
----------------------------------------------------------------------
.../gremlin/structure/io/GraphMigrator.java | 28 ++++----
.../gremlin/structure/io/GraphReader.java | 2 +-
.../gremlin/structure/io/GraphWriter.java | 8 +--
.../tinkerpop/gremlin/structure/io/IoCore.java | 2 +-
.../structure/io/gryo/GryoClassResolver.java | 2 +-
.../gremlin/structure/io/gryo/GryoIo.java | 19 +++++-
.../gremlin/structure/io/gryo/GryoMapper.java | 28 +++++++-
.../gremlin/structure/io/gryo/GryoReader.java | 70 ++++++++++++++++++++
.../structure/io/gryo/GryoSerializers.java | 11 +--
.../gremlin/structure/io/gryo/GryoWriter.java | 31 ++++++++-
10 files changed, 164 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ff9d518c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphMigrator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphMigrator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphMigrator.java
index 618b519..641df3b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphMigrator.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphMigrator.java
@@ -26,37 +26,33 @@ import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
+import static org.apache.tinkerpop.gremlin.structure.io.IoCore.gryo;
+
/**
- * {@link GraphMigrator} takes the data in one graph and pipes it to another graph. Uses the {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader}
- * and {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter} by default.
+ * {@code GraphMigrator} takes the data in one graph and pipes it to another graph. Uses the {@link GryoReader}
+ * and {@link GryoWriter} by default. Note that this utility is meant as a convenience for "small" graph migrations.
*
* @author Alex Averbuch (alex.averbuch@gmail.com)
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public final class GraphMigrator {
-
- private static final GryoReader DEFAULT_GRYO_READER = GryoReader.build().create();
- private static final GryoWriter DEFAULT_GRYO_WRITER = GryoWriter.build().create();
-
/**
- * Use Gryo to pipe the data from one graph to another graph. Uses all default settings for reader/writers.
- * Refer to {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader} and {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter} for those settings. To use features like incremental
- * loading, construct the reader/writers manually and utilize
- * {@link #migrateGraph(org.apache.tinkerpop.gremlin.structure.Graph, org.apache.tinkerpop.gremlin.structure.Graph, GraphReader, GraphWriter)}
+ * Use Gryo to pipe the data from one graph to another graph. Uses readers and writers generated from each
+ * {@link Graph} via the {@link Graph#io(Io.Builder)} method.
*/
public static void migrateGraph(final Graph fromGraph, final Graph toGraph) throws IOException {
- migrateGraph(fromGraph, toGraph, DEFAULT_GRYO_READER, DEFAULT_GRYO_WRITER);
+ migrateGraph(fromGraph, toGraph, fromGraph.io(gryo()).reader().create(), toGraph.io(gryo()).writer().create());
}
/**
* Pipe the data from one graph to another graph. It is important that the reader and writer utilize the
* same format.
*
- * @param fromGraph the graph to take data from
- * @param toGraph the graph to take data to
- * @param reader reads from the graph written by the writer
- * @param writer writes the graph to be read by the reader
- * @throws java.io.IOException thrown if there is an error in steam between the two graphs
+ * @param fromGraph the graph to take data from.
+ * @param toGraph the graph to take data to.
+ * @param reader reads from the graph written by the writer.
+ * @param writer writes the graph to be read by the reader.
+ * @throws java.io.IOException thrown if there is an error in steam between the two graphs.
*/
public static void migrateGraph(final Graph fromGraph, final Graph toGraph,
final GraphReader reader, final GraphWriter writer) throws IOException {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ff9d518c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphReader.java
index dc4a1d7..a4c7a80 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphReader.java
@@ -139,7 +139,7 @@ public interface GraphReader {
*
* @param inputStream a stream containing at least one {@link Property} as written by the accompanying
* {@link GraphWriter#writeProperty(OutputStream, Property)} method.
- * @param propertyAttachMethod a function that creates re-attaches a {@link Property} to a {@link Host} object .
+ * @param propertyAttachMethod a function that creates re-attaches a {@link Property} to a {@link Host} object.
* @return the value returned by the attach method.
*/
public Property readProperty(final InputStream inputStream,
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ff9d518c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphWriter.java
index 8ae4b4e..946cdb8 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphWriter.java
@@ -34,7 +34,7 @@ import java.util.Iterator;
/**
* Functions for writing a graph and its elements to a serialized format. Implementations of this class do not need
* to explicitly guarantee that an object written with one method must have its format equivalent to another. In other
- * words calling {@link #writeVertex(OutputStream, Vertex)}} need not have equivalent output to
+ * words, calling {@link #writeVertex(OutputStream, Vertex)}} need not have equivalent output to
* {@link #writeObject(OutputStream, Object)}. Nor does the representation of an {@link Edge} within the output of
* {@link #writeVertex(OutputStream, Vertex, Direction)} need to match the representation of that same
* {@link Edge} when provided to {@link #writeEdge(OutputStream, Edge)}. In other words, implementations are free
@@ -80,8 +80,8 @@ public interface GraphWriter {
* defined by the requested direction.
*
* @param outputStream the stream to write to.
- * @param vertexIterator A traversal that returns a list of vertices.
- * @param direction the direction of edges to write or null if no edges are to be written.
+ * @param vertexIterator a traversal that returns a list of vertices.
+ * @param direction the direction of edges to write or null if no edges are to be written.
*/
public default void writeVertices(final OutputStream outputStream, final Iterator<Vertex> vertexIterator, final Direction direction) throws IOException {
while (vertexIterator.hasNext()) {
@@ -93,7 +93,7 @@ public interface GraphWriter {
* Write a vertex to a stream without writing its edges.
*
* @param outputStream the stream to write to.
- * @param vertexIterator A iterator that returns a list of vertices.
+ * @param vertexIterator a iterator that returns a list of vertices.
*/
public default void writeVertices(final OutputStream outputStream, final Iterator<Vertex> vertexIterator) throws IOException {
while (vertexIterator.hasNext()) {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ff9d518c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoCore.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoCore.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoCore.java
index e3a7680..993124e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoCore.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoCore.java
@@ -28,7 +28,7 @@ import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoIo;
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
-public class IoCore {
+public final class IoCore {
public static Io.Builder<GraphMLIo> graphml() {
return GraphMLIo.build();
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ff9d518c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoClassResolver.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoClassResolver.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoClassResolver.java
index 3676754..268da9c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoClassResolver.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoClassResolver.java
@@ -48,7 +48,7 @@ import static org.apache.tinkerpop.shaded.kryo.util.Util.getWrapperClass;
/**
* This mapper implementation of the {@code ClassResolver} helps ensure that all Vertex and Edge concrete classes
* get properly serialized and deserialized by stripping them of their concrete class name so that they are treated
- * generically.
+ * generically. See the {@link #getRegistration(Class)} method for the core of this logic.
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ff9d518c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoIo.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoIo.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoIo.java
index 42986ac..01ba531 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoIo.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoIo.java
@@ -29,6 +29,9 @@ import java.io.InputStream;
import java.io.OutputStream;
/**
+ * Constructs Gryo IO implementations given a {@link Graph} and {@link IoRegistry}. Implementers of the {@link Graph}
+ * interfaces should see the {@link GryoMapper} for information on the expectations for the {@link IoRegistry}.
+ *
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class GryoIo implements Io<GryoReader.Builder, GryoWriter.Builder, GryoMapper.Builder> {
@@ -41,21 +44,32 @@ public class GryoIo implements Io<GryoReader.Builder, GryoWriter.Builder, GryoMa
this.graph = graph;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public GryoReader.Builder reader() {
return GryoReader.build().mapper(mapper().create());
}
-
+ /**
+ * {@inheritDoc}
+ */
@Override
public GryoWriter.Builder writer() {
return GryoWriter.build().mapper(mapper().create());
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public GryoMapper.Builder mapper() {
return GryoMapper.build().addRegistry(this.registry);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void writeGraph(final String file) throws IOException {
try (final OutputStream out = new FileOutputStream(file)) {
@@ -63,6 +77,9 @@ public class GryoIo implements Io<GryoReader.Builder, GryoWriter.Builder, GryoMa
}
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void readGraph(final String file) throws IOException {
try (final InputStream in = new FileInputStream(file)) {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ff9d518c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
index 2f5453c..da8caff 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
@@ -34,6 +34,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.util.StandardTraversalMetr
import org.apache.tinkerpop.gremlin.structure.Contains;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -88,7 +89,19 @@ import java.util.function.Function;
import java.util.stream.Collectors;
/**
- * A {@link Mapper} implementation for Kryo.
+ * A {@link Mapper} implementation for Kryo. This implementation requires that all classes to be serialized by
+ * Kryo are registered to it.
+ * <br/>
+ * {@link Graph} implementations providing an {@link IoRegistry} should register their custom classs and/or
+ * serializers in one of three ways:
+ * <ol>
+ * <li>Register just the custom class with a {@code null} {@link Serializer} implementation</li>
+ * <li>Register the custom class with a {@link Serializer} implementation</li>
+ * <li>
+ * Register the custom class with a {@code Function<Kryo, Serializer>} for those cases where the
+ * {@link Serializer} requires the {@link Kryo} instance to get constructed.
+ * </li>
+ * </ol>
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
@@ -233,6 +246,9 @@ public final class GryoMapper implements Mapper<Kryo> {
private Builder() {
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public Builder addRegistry(final IoRegistry registry) {
this.registry = registry;
@@ -266,7 +282,11 @@ public final class GryoMapper implements Mapper<Kryo> {
return this;
}
+ /**
+ * Creates a {@code GryoMapper}.
+ */
public GryoMapper create() {
+ // consult the registry if provided and inject registry entries as custom classes.
if (registry != null) {
final List<Pair<Class, Object>> serializers = registry.find(GryoIo.class);
serializers.forEach(p -> {
@@ -277,7 +297,11 @@ public final class GryoMapper implements Mapper<Kryo> {
else if (p.getValue1() instanceof Function)
addCustom(p.getValue0(), (Function<Kryo, Serializer>) p.getValue1());
else
- throw new RuntimeException("Invalid serializer"); // todo: cleanup exception handling
+ throw new IllegalStateException(String.format(
+ "Unexpected value provided by the %s for %s - expects [null, %s implementation or Function<%s, %s>]",
+ IoRegistry.class.getSimpleName(), p.getValue0().getClass().getSimpleName(),
+ Serializer.class.getName(), Kryo.class.getSimpleName(),
+ Serializer.class.getSimpleName()));
});
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ff9d518c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
index 5ca61bf..dd3c995 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
@@ -20,7 +20,9 @@ package org.apache.tinkerpop.gremlin.structure.io.gryo;
import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
import org.apache.tinkerpop.gremlin.structure.util.Attachable;
+import org.apache.tinkerpop.gremlin.structure.util.Host;
import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedProperty;
import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexProperty;
import org.apache.tinkerpop.gremlin.structure.util.star.StarGraph;
@@ -38,6 +40,7 @@ import org.apache.tinkerpop.shaded.kryo.io.Input;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
@@ -65,6 +68,15 @@ public class GryoReader implements GraphReader {
this.batchSize = batchSize;
}
+ /**
+ * Read data into a {@link Graph} from output generated by any of the {@link GryoWriter} {@code writeVertex} or
+ * {@code writeVertices} methods or by {@link GryoWriter#writeGraph(OutputStream, Graph)}.
+ *
+ * @param inputStream a stream containing an entire graph of vertices and edges as defined by the accompanying
+ * {@link GraphWriter#writeGraph(OutputStream, Graph)}.
+ * @param graphToWriteTo the graph to write to when reading from the stream.
+ * @throws IOException
+ */
@Override
public void readGraph(final InputStream inputStream, final Graph graphToWriteTo) throws IOException {
// dual pass - create all vertices and store to cache the ids. then create edges. as long as we don't
@@ -87,6 +99,17 @@ public class GryoReader implements GraphReader {
if (supportsTx) graphToWriteTo.tx().commit();
}
+ /**
+ * Read {@link Vertex} objects from output generated by any of the {@link GryoWriter} {@code writeVertex} or
+ * {@code writeVertices} methods or by {@link GryoWriter#writeGraph(OutputStream, Graph)}.
+ *
+ * @param inputStream a stream containing at least one {@link Vertex} as defined by the accompanying
+ * {@link GraphWriter#writeVertices(OutputStream, Iterator, Direction)} or
+ * {@link GraphWriter#writeVertices(OutputStream, Iterator)} methods.
+ * @param vertexAttachMethod a function that creates re-attaches a {@link Vertex} to a {@link Host} object.
+ * @param edgeAttachMethod a function that creates re-attaches a {@link Edge} to a {@link Host} object.
+ * @param attachEdgesOfThisDirection only edges of this direction are passed to the {@code edgeMaker}.
+ */
@Override
public Iterator<Vertex> readVertices(final InputStream inputStream,
final Function<Attachable<Vertex>, Vertex> vertexAttachMethod,
@@ -95,11 +118,29 @@ public class GryoReader implements GraphReader {
return new VertexInputIterator(new Input(inputStream), vertexAttachMethod, attachEdgesOfThisDirection, edgeAttachMethod);
}
+ /**
+ * Read a {@link Vertex} from output generated by any of the {@link GryoWriter} {@code writeVertex} or
+ * {@code writeVertices} methods or by {@link GryoWriter#writeGraph(OutputStream, Graph)}.
+ *
+ * @param inputStream a stream containing at least a single vertex as defined by the accompanying
+ * {@link GraphWriter#writeVertex(OutputStream, Vertex)}.
+ * @param vertexAttachMethod a function that creates re-attaches a {@link Vertex} to a {@link Host} object.
+ */
@Override
public Vertex readVertex(final InputStream inputStream, final Function<Attachable<Vertex>, Vertex> vertexAttachMethod) throws IOException {
return readVertex(inputStream, vertexAttachMethod, null, null);
}
+ /**
+ * Read a {@link Vertex} from output generated by any of the {@link GryoWriter} {@code writeVertex} or
+ * {@code writeVertices} methods or by {@link GryoWriter#writeGraph(OutputStream, Graph)}.
+ *
+ * @param inputStream a stream containing at least one {@link Vertex} as defined by the accompanying
+ * {@link GraphWriter#writeVertices(OutputStream, Iterator, Direction)} method.
+ * @param vertexAttachMethod a function that creates re-attaches a {@link Vertex} to a {@link Host} object.
+ * @param edgeAttachMethod a function that creates re-attaches a {@link Edge} to a {@link Host} object.
+ * @param attachEdgesOfThisDirection only edges of this direction are passed to the {@code edgeMaker}.
+ */
@Override
public Vertex readVertex(final InputStream inputStream,
final Function<Attachable<Vertex>, Vertex> vertexAttachMethod,
@@ -109,6 +150,14 @@ public class GryoReader implements GraphReader {
return readVertexInternal(vertexAttachMethod, edgeAttachMethod, attachEdgesOfThisDirection, input);
}
+ /**
+ * Read an {@link Edge} from output generated by {@link GryoWriter#writeEdge(OutputStream, Edge)} or via
+ * an {@link Edge} passed to {@link GryoWriter#writeObject(OutputStream, Object)}.
+ *
+ * @param inputStream a stream containing at least one {@link Edge} as defined by the accompanying
+ * {@link GraphWriter#writeEdge(OutputStream, Edge)} method.
+ * @param edgeAttachMethod a function that creates re-attaches a {@link Edge} to a {@link Host} object.
+ */
@Override
public Edge readEdge(final InputStream inputStream, final Function<Attachable<Edge>, Edge> edgeAttachMethod) throws IOException {
final Input input = new Input(inputStream);
@@ -117,6 +166,16 @@ public class GryoReader implements GraphReader {
return edgeAttachMethod.apply(attachable);
}
+ /**
+ * Read a {@link VertexProperty} from output generated by
+ * {@link GryoWriter#writeVertexProperty(OutputStream, VertexProperty)} or via an {@link VertexProperty} passed
+ * to {@link GryoWriter#writeObject(OutputStream, Object)}.
+ *
+ * @param inputStream a stream containing at least one {@link VertexProperty} as written by the accompanying
+ * {@link GraphWriter#writeVertexProperty(OutputStream, VertexProperty)} method.
+ * @param vertexPropertyAttachMethod a function that creates re-attaches a {@link VertexProperty} to a
+ * {@link Host} object.
+ */
@Override
public VertexProperty readVertexProperty (final InputStream inputStream,
final Function<Attachable<VertexProperty>, VertexProperty> vertexPropertyAttachMethod) throws IOException {
@@ -126,6 +185,14 @@ public class GryoReader implements GraphReader {
return vertexPropertyAttachMethod.apply(attachable);
}
+ /**
+ * Read a {@link Property} from output generated by {@link GryoWriter#writeProperty(OutputStream, Property)} or
+ * via an {@link Property} passed to {@link GryoWriter#writeObject(OutputStream, Object)}.
+ *
+ * @param inputStream a stream containing at least one {@link Property} as written by the accompanying
+ * {@link GraphWriter#writeProperty(OutputStream, Property)} method.
+ * @param propertyAttachMethod a function that creates re-attaches a {@link Property} to a {@link Host} object.
+ */
@Override
public Property readProperty(final InputStream inputStream,
final Function<Attachable<Property>, Property> propertyAttachMethod) throws IOException {
@@ -135,6 +202,9 @@ public class GryoReader implements GraphReader {
return propertyAttachMethod.apply(attachable);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public <C> C readObject(final InputStream inputStream, final Class<? extends C> clazz) throws IOException{
return clazz.cast(this.kryo.readClassAndObject(new Input(inputStream)));
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ff9d518c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializers.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializers.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializers.java
index 59bc75e..fd63426 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializers.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializers.java
@@ -43,10 +43,9 @@ import org.apache.tinkerpop.shaded.kryo.io.Output;
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
class GryoSerializers {
+
/**
* Serializes any {@link Edge} implementation encountered to a {@link DetachedEdge}.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
*/
static class EdgeSerializer extends Serializer<Edge> {
@Override
@@ -63,8 +62,6 @@ class GryoSerializers {
/**
* Serializes any {@link Vertex} implementation encountered to an {@link DetachedVertex}.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
*/
static class VertexSerializer extends Serializer<Vertex> {
public VertexSerializer() {
@@ -83,8 +80,6 @@ class GryoSerializers {
/**
* Serializes any {@link Property} implementation encountered to an {@link DetachedProperty}.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
*/
static class PropertySerializer extends Serializer<Property> {
public PropertySerializer() {
@@ -103,8 +98,6 @@ class GryoSerializers {
/**
* Serializes any {@link VertexProperty} implementation encountered to an {@link DetachedVertexProperty}.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
*/
static class VertexPropertySerializer extends Serializer<VertexProperty> {
public VertexPropertySerializer() {
@@ -123,8 +116,6 @@ class GryoSerializers {
/**
* Serializes any {@link Path} implementation encountered to an {@link DetachedPath}.
- *
- * @author Marko A. Rodriguez (http://markorodriguez.com)
*/
static class PathSerializer extends Serializer<Path> {
public PathSerializer() {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ff9d518c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
index af7848b..3435718 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
@@ -39,7 +39,7 @@ import java.util.Iterator;
* The {@link GraphWriter} for the Gremlin Structure serialization format based on Kryo. The format is meant to be
* non-lossy in terms of Gremlin Structure to Gremlin Structure migrations (assuming both structure implementations
* support the same graph features).
- * <br/>
+ * <p/>
* This implementation is not thread-safe. Have one {@code GraphWriter} instance per thread.
*
* @author Stephen Mallette (http://stephen.genoprime.com)
@@ -51,11 +51,18 @@ public class GryoWriter implements GraphWriter {
this.kryo = gryoMapper.createMapper();
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void writeGraph(final OutputStream outputStream, final Graph g) throws IOException {
writeVertices(outputStream, g.vertices(), Direction.BOTH);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void writeVertices(final OutputStream outputStream, final Iterator<Vertex> vertexIterator, final Direction direction) throws IOException {
kryo.getRegistration(StarGraph.class).setSerializer(StarGraphGryoSerializer.with(direction));
final Output output = new Output(outputStream);
@@ -66,10 +73,17 @@ public class GryoWriter implements GraphWriter {
kryo.getRegistration(StarGraph.class).setSerializer(StarGraphGryoSerializer.with(Direction.BOTH));
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void writeVertices(final OutputStream outputStream, final Iterator<Vertex> vertexIterator) throws IOException {
writeVertices(outputStream, vertexIterator, null);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void writeVertex(final OutputStream outputStream, final Vertex v, final Direction direction) throws IOException {
kryo.getRegistration(StarGraph.class).setSerializer(StarGraphGryoSerializer.with(direction));
@@ -79,11 +93,17 @@ public class GryoWriter implements GraphWriter {
kryo.getRegistration(StarGraph.class).setSerializer(StarGraphGryoSerializer.with(Direction.BOTH));
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void writeVertex(final OutputStream outputStream, final Vertex v) throws IOException {
writeVertex(outputStream, v, null);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void writeEdge(final OutputStream outputStream, final Edge e) throws IOException {
final Output output = new Output(outputStream);
@@ -92,6 +112,9 @@ public class GryoWriter implements GraphWriter {
output.flush();
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void writeVertexProperty(final OutputStream outputStream, final VertexProperty vp) throws IOException {
final Output output = new Output(outputStream);
@@ -100,6 +123,9 @@ public class GryoWriter implements GraphWriter {
output.flush();
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void writeProperty(final OutputStream outputStream, final Property p) throws IOException {
final Output output = new Output(outputStream);
@@ -108,6 +134,9 @@ public class GryoWriter implements GraphWriter {
output.flush();
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void writeObject(final OutputStream outputStream, final Object object) {
final Output output = new Output(outputStream);
[2/5] incubator-tinkerpop git commit: Remove unused import.
Posted by sp...@apache.org.
Remove unused import.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/c18b67d5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/c18b67d5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/c18b67d5
Branch: refs/heads/master
Commit: c18b67d53521fcdb1c498d8690861eb70a96f05c
Parents: c14f3df
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 30 11:39:57 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 30 11:39:57 2015 -0400
----------------------------------------------------------------------
.../gremlin/tinkergraph/structure/IoDataGenerationTest.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c18b67d5/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/IoDataGenerationTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/IoDataGenerationTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/IoDataGenerationTest.java
index 51b3bc3..86fc733 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/IoDataGenerationTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/IoDataGenerationTest.java
@@ -23,7 +23,6 @@ import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
import org.apache.tinkerpop.gremlin.TestHelper;
import org.apache.tinkerpop.gremlin.algorithm.generator.DistributionGenerator;
import org.apache.tinkerpop.gremlin.algorithm.generator.PowerLawDistribution;
-import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.T;
[5/5] incubator-tinkerpop git commit: Merge remote-tracking branch
'origin/master'
Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/4203c81f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/4203c81f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/4203c81f
Branch: refs/heads/master
Commit: 4203c81ff21230b2c04ecb3936255314f0bddb63
Parents: ff9d518 c41b199
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 30 12:39:16 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 30 12:39:16 2015 -0400
----------------------------------------------------------------------
.../traversal/dsl/graph/GraphTraversal.java | 127 +++++++++++++++++--
.../gremlin/process/traversal/dsl/graph/__.java | 1 -
.../traversal/step/map/SelectOneStep.java | 6 +-
.../process/traversal/step/map/SelectStep.java | 26 ++--
.../optimization/RangeByIsCountStrategy.java | 7 +-
.../tinkerpop/gremlin/structure/Element.java | 2 +-
.../tinkerpop/gremlin/structure/Property.java | 4 +-
.../traversal/step/map/GroovySelectTest.groovy | 12 +-
.../process/AbstractGremlinProcessTest.java | 2 +-
.../process/traversal/step/map/SelectTest.java | 47 ++++++-
.../gremlin/structure/PropertyTest.java | 4 +-
.../tinkergraph/structure/TinkerGraphTest.java | 7 +-
12 files changed, 207 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
[3/5] incubator-tinkerpop git commit: Fix up filters for javadoc core.
Posted by sp...@apache.org.
Fix up filters for javadoc core.
They got messed up with some package renaming.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/215c0540
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/215c0540
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/215c0540
Branch: refs/heads/master
Commit: 215c0540e6bbbc4616c6676f44b926b83dc20d55
Parents: c18b67d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 30 12:38:18 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 30 12:38:18 2015 -0400
----------------------------------------------------------------------
pom.xml | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/215c0540/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 45244ae..a9f935d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -758,9 +758,7 @@ limitations under the License.
</sourceFileInclude>
<sourceFileInclude>org/apache/tinkerpop/gremlin/structure/io/graphson/*.java
</sourceFileInclude>
- <sourceFileInclude>org/apache/tinkerpop/gremlin/structure/io/kryo/*.java
- </sourceFileInclude>
- <sourceFileInclude>org/apache/tinkerpop/gremlin/structure/strategy/*.java
+ <sourceFileInclude>org/apache/tinkerpop/gremlin/structure/io/gryo/*.java
</sourceFileInclude>
<sourceFileInclude>org/apache/tinkerpop/gremlin/process/*.java</sourceFileInclude>
<sourceFileInclude>org/apache/tinkerpop/gremlin/process/computer/*.java