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/21 18:17:55 UTC

[01/12] incubator-tinkerpop git commit: Add revised Io interface with IoRegistry.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master e48fb044a -> 8562f50e9


Add revised Io interface with IoRegistry.

Allows implementers to register all their serialization classes with the IoRegistry which the Io implementations can consult for custom serializers.  This should get rid of the old Graph.Io interface which had tighter coupling to the Reader/Writer implementations.  At this point the two Io interfaces are still in there side-by-side.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/8a3b38ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/8a3b38ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/8a3b38ab

Branch: refs/heads/master
Commit: 8a3b38ab60b562c10d8f12f9d38b64748221f84e
Parents: f366285
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 16 08:08:20 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 16 08:08:20 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/Graph.java      |   5 +
 .../gremlin/structure/io/GraphReader.java       |   3 +
 .../gremlin/structure/io/GraphWriter.java       |   4 +
 .../tinkerpop/gremlin/structure/io/Io.java      |  71 +++++++++++++
 .../gremlin/structure/io/IoRegistry.java        |  62 ++++++++++++
 .../tinkerpop/gremlin/structure/io/Mapper.java  |   4 +
 .../gremlin/structure/io/graphml/GraphMLIo.java |  96 ++++++++++++++++++
 .../structure/io/graphml/GraphMLMapper.java     |  47 +++++++++
 .../structure/io/graphml/GraphMLReader.java     |   2 +-
 .../structure/io/graphml/GraphMLWriter.java     |   2 +-
 .../structure/io/graphson/GraphSONIo.java       |  99 ++++++++++++++++++
 .../structure/io/graphson/GraphSONMapper.java   |  16 ++-
 .../structure/io/graphson/GraphSONReader.java   |   2 +-
 .../structure/io/graphson/GraphSONWriter.java   |   2 +-
 .../gremlin/structure/io/gryo/GryoIo.java       | 100 +++++++++++++++++++
 .../gremlin/structure/io/gryo/GryoMapper.java   |  26 ++++-
 .../gremlin/structure/io/gryo/GryoReader.java   |   2 +-
 .../gremlin/structure/io/gryo/GryoWriter.java   |   3 +-
 18 files changed, 538 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
index f01441c..529f6bb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
@@ -26,6 +26,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.engine.StandardTraversalEngine;
 import org.apache.tinkerpop.gremlin.structure.io.DefaultIo;
+import org.apache.tinkerpop.gremlin.structure.io.Mapper;
 import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLReader;
 import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
@@ -252,6 +253,10 @@ public interface Graph extends AutoCloseable {
         return new DefaultIo(this);
     }
 
+    public default <I extends org.apache.tinkerpop.gremlin.structure.io.Io> I io(final org.apache.tinkerpop.gremlin.structure.io.Io.Builder<I> builder) {
+        return (I) builder.graph(this).create();
+    }
+
     /**
      * A collection of global {@link Variables} associated with the graph.
      * Variables are used for storing metadata about the graph.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/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 f2066d2..cf5ee04 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
@@ -96,4 +96,7 @@ public interface GraphReader {
      */
     public Edge readEdge(final InputStream inputStream, final Function<DetachedEdge, Edge> edgeMaker) throws IOException;
 
+    public interface ReaderBuilder<T extends GraphReader> {
+        T create();
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/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 d3075f3..c63476f 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
@@ -86,4 +86,8 @@ public interface GraphWriter {
      * Write an edge to a stream.
      */
     public void writeEdge(final OutputStream outputStream, final Edge e) throws IOException;
+
+    public interface WriterBuilder<T extends GraphWriter> {
+        T create();
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Io.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Io.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Io.java
new file mode 100644
index 0000000..5abcc1f
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Io.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.structure.io;
+
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+import java.io.IOException;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface Io<R extends GraphReader.ReaderBuilder, W extends GraphWriter.WriterBuilder, M extends Mapper.Builder> {
+
+    /**
+     * Creates a {@link GraphReader.ReaderBuilder} implementation . Implementers should call the
+     * {@link #mapper()} function to feed its result to the builder.  In this way, custom class serializers
+     * registered to the {@link Mapper.Builder} by {@link Graph} implementations will end up being used for
+     * the serialization process.
+     */
+    public R reader();
+
+    /**
+     * Creates a {@link GraphWriter.WriterBuilder} implementation . Implementers should call the
+     * {@link #mapper()} function to feed its result to the builder.  In this way, custom class serializers
+     * registered to the {@link Mapper.Builder} by {@link Graph} implementations will end up being used for
+     * the serialization process.
+     */
+    public W writer();
+
+    /**
+     * Constructs a {@link Mapper.Builder} which is responsible for constructing the abstraction over different
+     * serialization methods.  Implementations should set defaults as required, but most importantly need to
+     * make the appropriate call to {@link Mapper.Builder#addRegistry(IoRegistry)} which will provide the
+     * builder with any required custom serializers of the {@link Graph}.
+     */
+    public M mapper();
+
+    /**
+     * Write a {@link Graph} to file using the default configuration of the {@link #writer()} and its supplied
+     * {@link #mapper()}.
+     */
+    public void write(final String file) throws IOException;
+
+    /**
+     * Read a {@link Graph} from file using the default configuration of the {@link #reader()} and its supplied
+     * {@link #mapper()}.
+     */
+    public void read(final String file) throws IOException;
+
+    public interface Builder<I extends Io> {
+        public Builder<? extends Io> registry(final IoRegistry registry);
+        public Builder<? extends Io> graph(final Graph g);
+        public I create();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
new file mode 100644
index 0000000..7bd8560
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.structure.io;
+
+import org.javatuples.Pair;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class IoRegistry {
+    private final Map<Class<? extends Io.Builder>, List<Pair<Class, Object>>> registeredSerializers = new HashMap<>();
+
+    /**
+     * Add a "serializer" for the {@code Mapper}.  Note that what is accepted as a "serializer" is implementation
+     * specific.  Note that the {@link Io.Builder} implementation will consult this registry for "serializer" classes
+     * it expects so consult the {@link Io.Builder} implementation to understand what is expected for these values.
+     *
+     * @param clazz usually this is the class that is to be serialized - may be {@code null}
+     * @param serializer a serializer implementation
+     */
+    public void register(final Class<? extends Io.Builder> builderClass, final Class clazz, final Object serializer) {
+        if (registeredSerializers.containsKey(builderClass))
+            registeredSerializers.get(builderClass).add(Pair.with(clazz, serializer));
+        else
+            registeredSerializers.put(builderClass, Arrays.asList(Pair.with(clazz, serializer)));
+    }
+
+    public List<Pair<Class,Object>> find(final Class<? extends Io> builderClass) {
+        return Collections.unmodifiableList(registeredSerializers.get(builderClass).stream()
+                .collect(Collectors.toList()));
+    }
+
+    public <S> List<Pair<Class,S>> find(final Class<? extends Io> builderClass, final Class<S> c) {
+        return Collections.unmodifiableList(registeredSerializers.get(builderClass).stream()
+                .filter(p -> p.getValue1().getClass().isAssignableFrom(c))
+                .map(p -> Pair.with(p.getValue0(), (S) p.getValue1()))
+                .collect(Collectors.toList()));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Mapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Mapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Mapper.java
index 64f23f3..1e11028 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Mapper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Mapper.java
@@ -29,4 +29,8 @@ public interface Mapper<T> {
      * Create a new instance of the internal object mapper that an implementation represents.
      */
     public T createMapper();
+
+    public interface Builder<B extends Builder> {
+        public B addRegistry(final IoRegistry registry);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLIo.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLIo.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLIo.java
new file mode 100644
index 0000000..aa99d5c
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLIo.java
@@ -0,0 +1,96 @@
+/*
+ * 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.structure.io.graphml;
+
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.Io;
+import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GraphMLIo implements Io<GraphMLReader.Builder, GraphMLWriter.Builder, GraphMLMapper.Builder> {
+    private final Graph graph;
+
+    public GraphMLIo(final Graph graph) {
+        this.graph = graph;
+    }
+
+    @Override
+    public GraphMLReader.Builder reader() {
+        return GraphMLReader.build();
+    }
+
+    @Override
+    public GraphMLWriter.Builder writer() {
+        return GraphMLWriter.build();
+    }
+
+    @Override
+    public GraphMLMapper.Builder mapper() {
+        return GraphMLMapper.build();
+    }
+
+    @Override
+    public void write(final String file) throws IOException {
+        try (final OutputStream out = new FileOutputStream(file)) {
+            writer().create().writeGraph(out, graph);
+        }
+    }
+
+    @Override
+    public void read(final String file) throws IOException {
+        try (final InputStream in = new FileInputStream(file)) {
+            reader().create().readGraph(in, graph);
+        }
+    }
+
+    public static Io.Builder<GraphMLIo> build() {
+        return new Builder();
+    }
+
+    public static class Builder implements Io.Builder<GraphMLIo> {
+
+        private Graph graph;
+
+        @Override
+        public Io.Builder<GraphMLIo> registry(final IoRegistry registry) {
+            // GraphML doesn't make use of a registry but the contract should simply exist
+            return this;
+        }
+
+        @Override
+        public Io.Builder<GraphMLIo> graph(final Graph g) {
+            this.graph = g;
+            return this;
+        }
+
+        @Override
+        public GraphMLIo create() {
+            if (null == graph) throw new IllegalArgumentException("The graph argument was not specified");
+            return new GraphMLIo(graph);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLMapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLMapper.java
new file mode 100644
index 0000000..1443c19
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLMapper.java
@@ -0,0 +1,47 @@
+/*
+ * 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.structure.io.graphml;
+
+import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
+import org.apache.tinkerpop.gremlin.structure.io.Mapper;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GraphMLMapper implements Mapper<Object> {
+    @Override
+    public Object createMapper() {
+        throw new UnsupportedOperationException("GraphML does not have an object mapper - it is a format for full Graph serialization");
+    }
+
+    public static Builder build() {
+        return new Builder();
+    }
+
+    public static class Builder implements Mapper.Builder<Builder> {
+        @Override
+        public Builder addRegistry(final IoRegistry registry) {
+            throw new UnsupportedOperationException("GraphML does not accept custom serializers - it is a format for full Graph serialization");
+        }
+
+        public GraphMLMapper create() {
+            return new GraphMLMapper();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
index e93b804..13450c4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
@@ -251,7 +251,7 @@ public class GraphMLReader implements GraphReader {
     /**
      * Allows configuration and construction of the GraphMLReader instance.
      */
-    public static final class Builder {
+    public static final class Builder implements ReaderBuilder<GraphMLReader> {
         private String vertexIdKey = T.id.getAccessor();
         private String edgeIdKey = T.id.getAccessor();
         private String edgeLabelKey = GraphMLTokens.LABEL_E;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java
index 87ee99d..21b1f3d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java
@@ -374,7 +374,7 @@ public class GraphMLWriter implements GraphWriter {
         return new Builder();
     }
 
-    public static final class Builder {
+    public static final class Builder implements WriterBuilder<GraphMLWriter> {
         private boolean normalize = false;
         private Map<String, String> vertexKeyTypes = null;
         private Map<String, String> edgeKeyTypes = null;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONIo.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONIo.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONIo.java
new file mode 100644
index 0000000..d4deb6b
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONIo.java
@@ -0,0 +1,99 @@
+/*
+ * 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.structure.io.graphson;
+
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.Io;
+import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GraphSONIo implements Io<GraphSONReader.Builder, GraphSONWriter.Builder, GraphSONMapper.Builder> {
+    private final IoRegistry registry;
+    private final Graph graph;
+
+    public GraphSONIo(final IoRegistry registry, final Graph graph) {
+        this.registry = registry;
+        this.graph = graph;
+    }
+
+    @Override
+    public GraphSONReader.Builder reader() {
+        return GraphSONReader.build().mapper(mapper().create());
+    }
+
+    @Override
+    public GraphSONWriter.Builder writer() {
+        return GraphSONWriter.build().mapper(mapper().create());
+    }
+
+    @Override
+    public GraphSONMapper.Builder mapper() {
+        return GraphSONMapper.build().addRegistry(this.registry);
+    }
+
+    @Override
+    public void write(final String file) throws IOException {
+        try (final OutputStream out = new FileOutputStream(file)) {
+            writer().create().writeGraph(out, graph);
+        }
+    }
+
+    @Override
+    public void read(final String file) throws IOException {
+        try (final InputStream in = new FileInputStream(file)) {
+            reader().create().readGraph(in, graph);
+        }
+    }
+
+    public static Io.Builder<GraphSONIo> build() {
+        return new Builder();
+    }
+
+    public static class Builder implements Io.Builder<GraphSONIo> {
+
+        private IoRegistry registry = null;
+        private Graph graph;
+
+        @Override
+        public Io.Builder<GraphSONIo> registry(final IoRegistry registry) {
+            this.registry = registry;
+            return this;
+        }
+
+        @Override
+        public Io.Builder<GraphSONIo> graph(final Graph g) {
+            this.graph = g;
+            return this;
+        }
+
+        @Override
+        public GraphSONIo create() {
+            if (null == graph) throw new IllegalArgumentException("The graph argument was not specified");
+            return new GraphSONIo(registry, graph);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
index 5613ed9..2c589f3 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
@@ -23,7 +23,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
 import com.fasterxml.jackson.databind.module.SimpleModule;
 import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
+import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
 import org.apache.tinkerpop.gremlin.structure.io.Mapper;
+import org.javatuples.Pair;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -83,15 +85,22 @@ public class GraphSONMapper implements Mapper<ObjectMapper> {
         return new Builder();
     }
 
-    public static class Builder {
+    public static class Builder implements Mapper.Builder<Builder> {
         private List<SimpleModule> customModules = new ArrayList<>();
         private boolean loadCustomModules = false;
         private boolean normalize = false;
         private boolean embedTypes = false;
+        private IoRegistry registry = null;
 
         private Builder() {
         }
 
+        @Override
+        public Builder addRegistry(final IoRegistry registry) {
+            this.registry = registry;
+            return this;
+        }
+
         /**
          * Supply a mapper module for serialization/deserialization.
          */
@@ -126,6 +135,11 @@ public class GraphSONMapper implements Mapper<ObjectMapper> {
         }
 
         public GraphSONMapper create() {
+            if (registry != null) {
+                final List<Pair<Class, SimpleModule>> simpleModules = registry.find(GraphSONIo.class, SimpleModule.class);
+                simpleModules.stream().map(Pair::getValue1).forEach(this.customModules::add);
+            }
+
             return new GraphSONMapper(customModules, loadCustomModules, normalize, embedTypes);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
index 470bfe3..67c8da0 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
@@ -210,7 +210,7 @@ public class GraphSONReader implements GraphReader {
         return new Builder();
     }
 
-    public static class Builder {
+    public static class Builder implements ReaderBuilder<GraphSONReader> {
         private long batchSize = BatchGraph.DEFAULT_BUFFER_SIZE;
         private String vertexIdKey = T.id.getAccessor();
         private String edgeIdKey = T.id.getAccessor();

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java
index 0a11d45..c480037 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONWriter.java
@@ -99,7 +99,7 @@ public class GraphSONWriter implements GraphWriter {
         return new Builder();
     }
 
-    public static class Builder {
+    public static class Builder implements WriterBuilder<GraphSONWriter> {
 
         private GraphSONMapper mapper = GraphSONMapper.build().create();
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/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
new file mode 100644
index 0000000..f5570d9
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoIo.java
@@ -0,0 +1,100 @@
+/*
+ * 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.structure.io.gryo;
+
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.Io;
+import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GryoIo implements Io<GryoReader.Builder, GryoWriter.Builder, GryoMapper.Builder> {
+
+    private final IoRegistry registry;
+    private final Graph graph;
+
+    public GryoIo(final IoRegistry registry, final Graph graph) {
+        this.registry = registry;
+        this.graph = graph;
+    }
+
+    @Override
+    public GryoReader.Builder reader() {
+        return GryoReader.build().mapper(mapper().create());
+    }
+
+    @Override
+    public GryoWriter.Builder writer() {
+        return GryoWriter.build().mapper(mapper().create());
+    }
+
+    @Override
+    public GryoMapper.Builder mapper() {
+        return GryoMapper.build().addRegistry(this.registry);
+    }
+
+    @Override
+    public void write(final String file) throws IOException {
+        try (final OutputStream out = new FileOutputStream(file)) {
+            writer().create().writeGraph(out, graph);
+        }
+    }
+
+    @Override
+    public void read(final String file) throws IOException {
+        try (final InputStream in = new FileInputStream(file)) {
+            reader().create().readGraph(in, graph);
+        }
+    }
+
+    public static Io.Builder<GryoIo> build() {
+        return new Builder();
+    }
+
+    public static class Builder implements Io.Builder<GryoIo> {
+
+        private IoRegistry registry = null;
+        private Graph graph;
+
+        @Override
+        public Io.Builder<GryoIo> registry(final IoRegistry registry) {
+            this.registry = registry;
+            return this;
+        }
+
+        @Override
+        public Io.Builder<GryoIo> graph(final Graph g) {
+            this.graph = g;
+            return this;
+        }
+
+        @Override
+        public GryoIo create() {
+            if (null == graph) throw new IllegalArgumentException("The graph argument was not specified");
+            return new GryoIo(registry, graph);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/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 5ab18e6..f50198f 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
@@ -38,6 +38,7 @@ import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Property;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
 import org.apache.tinkerpop.gremlin.structure.io.Mapper;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedPath;
@@ -56,6 +57,7 @@ import org.apache.tinkerpop.shaded.kryo.io.Input;
 import org.apache.tinkerpop.shaded.kryo.io.Output;
 import org.apache.tinkerpop.shaded.kryo.util.DefaultStreamFactory;
 import org.apache.tinkerpop.shaded.kryo.util.MapReferenceResolver;
+import org.javatuples.Pair;
 import org.javatuples.Triplet;
 
 import java.io.IOException;
@@ -177,7 +179,7 @@ public final class GryoMapper implements Mapper<Kryo> {
         return Version.V_1_0_0.getBuilder();
     }
 
-    public static interface Builder {
+    public static interface Builder extends Mapper.Builder<Builder> {
         /**
          * Add mapper classes to serializes with gryo using standard serialization.
          */
@@ -335,11 +337,19 @@ public final class GryoMapper implements Mapper<Kryo> {
         private byte extendedVersion = DEFAULT_EXTENDED_VERSION;
         private BiPredicate<Byte, Byte> compliant = (readExt, serExt) -> readExt.equals(serExt);
 
+        private IoRegistry registry = null;
+
         /**
          * Starts numbering classes for Gryo serialization at 65536 to leave room for future usage by TinkerPop.
          */
         private final AtomicInteger currentSerializationId = new AtomicInteger(65536);
 
+        @Override
+        public Builder addRegistry(final IoRegistry registry) {
+            this.registry = registry;
+            return this;
+        }
+
         /**
          * {@inheritDoc}
          */
@@ -396,6 +406,20 @@ public final class GryoMapper implements Mapper<Kryo> {
 
         @Override
         public GryoMapper create() {
+            if (registry != null) {
+                final List<Pair<Class, Object>> serializers = registry.find(GryoIo.class);
+                serializers.forEach(p -> {
+                    if (null == p.getValue1())
+                        addCustom(p.getValue0());
+                    else if (p.getValue1() instanceof Serializer)
+                        addCustom(p.getValue0(), (Serializer) p.getValue1());
+                    else if (p.getValue1() instanceof Function)
+                        addCustom(p.getValue0(), (Function<Kryo, Serializer>) p.getValue1());
+                    else
+                        throw new RuntimeException("Invalid serializer"); // todo: cleanup exception handling
+                });
+            }
+
             return new GryoMapper(serializationList, this::writeHeader, this::readHeader);
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/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 08ca97a..f64b53e 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
@@ -340,7 +340,7 @@ public class GryoReader implements GraphReader {
         return new Builder();
     }
 
-    public static class Builder {
+    public static class Builder implements ReaderBuilder<GryoReader> {
         private File tempFile;
         private long batchSize = BatchGraph.DEFAULT_BUFFER_SIZE;
         private String vertexIdKey = T.id.getAccessor();

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8a3b38ab/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 642e7d8..7e51676 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
@@ -30,6 +30,7 @@ import org.apache.tinkerpop.shaded.kryo.io.Output;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.io.Writer;
 import java.nio.ByteBuffer;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -159,7 +160,7 @@ public class GryoWriter implements GraphWriter {
         return new Builder();
     }
 
-    public static class Builder {
+    public static class Builder implements WriterBuilder<GryoWriter> {
         /**
          * Always creates the most current version available.
          */


[12/12] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/refactor-io'

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/refactor-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/8562f50e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/8562f50e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/8562f50e

Branch: refs/heads/master
Commit: 8562f50e9492c645b92f536306456019576adaa0
Parents: e48fb04 e4301a8
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Apr 21 12:13:46 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Apr 21 12:13:46 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/Graph.java      | 168 ++------------
 .../gremlin/structure/io/DefaultIo.java         |  82 -------
 .../gremlin/structure/io/GraphReader.java       |  10 +
 .../gremlin/structure/io/GraphWriter.java       |  11 +
 .../tinkerpop/gremlin/structure/io/Io.java      |  98 +++++++++
 .../gremlin/structure/io/IoRegistry.java        |  81 +++++++
 .../tinkerpop/gremlin/structure/io/Mapper.java  |  15 ++
 .../gremlin/structure/io/graphml/GraphMLIo.java |  96 ++++++++
 .../structure/io/graphml/GraphMLMapper.java     |  47 ++++
 .../structure/io/graphml/GraphMLReader.java     |   2 +-
 .../structure/io/graphml/GraphMLWriter.java     |   2 +-
 .../structure/io/graphson/GraphSONIo.java       |  99 +++++++++
 .../structure/io/graphson/GraphSONMapper.java   |  16 +-
 .../structure/io/graphson/GraphSONReader.java   |   2 +-
 .../structure/io/graphson/GraphSONWriter.java   |   2 +-
 .../gremlin/structure/io/gryo/GryoIo.java       | 100 +++++++++
 .../gremlin/structure/io/gryo/GryoMapper.java   |  32 ++-
 .../gremlin/structure/io/gryo/GryoReader.java   |   2 +-
 .../gremlin/structure/io/gryo/GryoWriter.java   |   4 +-
 .../gremlin/structure/io/IoRegistryTest.java    |  99 +++++++++
 .../ser/AbstractJsonMessageSerializerV1d0.java  |   3 +-
 .../driver/ser/GryoMessageSerializerV1d0.java   |   3 +-
 .../gremlin/AbstractGraphProvider.java          |   3 +-
 .../structure/GraphWritePerformanceTest.java    |   9 +-
 .../tinkerpop/gremlin/structure/IoTest.java     | 220 ++++++++++---------
 .../gremlin/structure/SerializationTest.java    |  51 +++--
 .../tinkergraph/structure/TinkerGraphTest.java  |   5 +-
 27 files changed, 883 insertions(+), 379 deletions(-)
----------------------------------------------------------------------



[05/12] incubator-tinkerpop git commit: Add more javadoc around refactored Io.

Posted by sp...@apache.org.
Add more javadoc around refactored 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/478a44d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/478a44d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/478a44d6

Branch: refs/heads/master
Commit: 478a44d6f0d20c26bb932108c58862daf9bbaa57
Parents: 69d7761
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 16 12:55:44 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 16 12:55:44 2015 -0400

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/structure/io/Mapper.java    | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/478a44d6/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Mapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Mapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Mapper.java
index 1e11028..16f7a9a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Mapper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Mapper.java
@@ -18,6 +18,8 @@
  */
 package org.apache.tinkerpop.gremlin.structure.io;
 
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
 /**
  * Represents a low-level serialization class that can be used to map classes to serializers.  These implementation
  * create instances of serializers from other libraries (e.g. creating a {@code Kryo} instance).
@@ -30,7 +32,16 @@ public interface Mapper<T> {
      */
     public T createMapper();
 
+    /**
+     * Largely a marker interface for builders that construct {@link Mapper} instances.
+     */
     public interface Builder<B extends Builder> {
+
+        /**
+         * Adds a vendor supplied {@link IoRegistry} to the {@code Mapper.Builder} which enables it to check for
+         * vendor custom serializers to add to the {@link Mapper}.  All {@link Io} implementations should expose
+         * this method via this {@link Builder} so that it is compatible with {@link Graph#io}.
+         */
         public B addRegistry(final IoRegistry registry);
     }
 }


[03/12] incubator-tinkerpop git commit: Add javadoc around the revised Io interface and its revised method on Graph.

Posted by sp...@apache.org.
Add javadoc around the revised Io interface and its revised method on Graph.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/3d38e2e3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/3d38e2e3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/3d38e2e3

Branch: refs/heads/master
Commit: 3d38e2e3a91ff4706ff202aa4e3c718ad4b5f7c9
Parents: b28252a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 16 12:36:06 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 16 12:36:06 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/Graph.java      | 12 +++++++++
 .../tinkerpop/gremlin/structure/io/Io.java      | 27 ++++++++++++++++++++
 2 files changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3d38e2e3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
index 8f2414b..fedda5b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
@@ -26,6 +26,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.engine.StandardTraversalEngine;
 import org.apache.tinkerpop.gremlin.structure.io.Io;
+import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
 import org.apache.tinkerpop.gremlin.structure.util.FeatureDescriptor;
 import org.javatuples.Pair;
 
@@ -236,6 +237,17 @@ public interface Graph extends AutoCloseable {
      */
     public Transaction tx();
 
+    /**
+     * Construct a particular {@link Io} implementation for reading and writing the {@code Graph} and other data.
+     * End-users will "select" the {@link Io} implementation that they want to use by supplying the {@link Io.Builder}
+     * that constructs it.  In this way, {@code Graph} vendors can supply their {@link IoRegistry} to that builder
+     * thus allowing for custom serializers to be auto-configured into the {@link Io} instance.  Registering custom
+     * serializers is particularly useful for those graphs that have complex types for {@link Element} identifiers.
+     * </br>
+     * For those graphs that do not need to register any custom serializers, the default implementation should suffice.
+     * If the default is overriden, take care to register the current graph to the {@link Io.Builder} via the
+     * {@link Io.Builder#graph(Graph)} method.
+     */
     public default <I extends Io> I io(final Io.Builder<I> builder) {
         return (I) builder.graph(this).create();
     }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3d38e2e3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Io.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Io.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Io.java
index 5abcc1f..c5ca654 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Io.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Io.java
@@ -23,6 +23,12 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
 import java.io.IOException;
 
 /**
+ * Ties together the core interfaces of an IO format: {@link GraphReader}, {@link GraphWriter} and {@link Mapper}.
+ * The {@link Builder} of an {@code Io} instance is supplied to {@link Graph#io(Builder)} and the {@link Graph}
+ * implementation can then chose to supply an {@link IoRegistry} to it before returning it.  An {@link Io}
+ * implementation should use that {@link IoRegistry} to lookup custom serializers to use and register them to the
+ * internal {@link Mapper} (if the format has such capability).
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public interface Io<R extends GraphReader.ReaderBuilder, W extends GraphWriter.WriterBuilder, M extends Mapper.Builder> {
@@ -63,9 +69,30 @@ public interface Io<R extends GraphReader.ReaderBuilder, W extends GraphWriter.W
      */
     public void read(final String file) throws IOException;
 
+    /**
+     * Helps to construct an {@link Io} implementation and should be implemented by every such implementation as
+     * that class will be passed to {@link Graph#io(Builder)} by the user.
+     */
     public interface Builder<I extends Io> {
+
+        /**
+         * Vendors use this method to supply an {@link IoRegistry} to the {@link Io} implementation.  End-users
+         * should not use this method directly.  If a user wants to register custom serializers, then such things
+         * can be done via calls to {@link Io#mapper()} after the {@link Io} is constructed via
+         * {@link Graph#io(Builder)}.
+         */
         public Builder<? extends Io> registry(final IoRegistry registry);
+
+        /**
+         * Vendors use this method to supply the current instance of their {@link Graph} to the builder.  End-users
+         * should not call this method directly.
+         */
         public Builder<? extends Io> graph(final Graph g);
+
+        /**
+         * Vendors call this method in the {@link Graph#io(Builder)} method to construct the {@link Io} instance
+         * and return the value.  End-users will typically not call this method.
+         */
         public I create();
     }
 }


[09/12] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/master' into refactor-io

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master' into refactor-io

Conflicts:
	gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
	gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
	gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/6ffd5b4c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/6ffd5b4c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/6ffd5b4c

Branch: refs/heads/master
Commit: 6ffd5b4ce740a5be1e8cf4eacaac66a8420e0981
Parents: 42f367a 19f83de
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 17 12:33:44 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 17 12:33:44 2015 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   2 +
 README.asciidoc                                 |   1 +
 data/grateful-dead-vertices.kryo                | Bin 1028298 -> 975214 bytes
 data/grateful-dead-vertices.ldjson              | 422 +++++++++----------
 data/grateful-dead.kryo                         | Bin 515409 -> 493339 bytes
 data/tinkerpop-classic-typed.json               |   2 +-
 data/tinkerpop-classic-vertices.kryo            | Bin 1323 -> 1179 bytes
 data/tinkerpop-classic-vertices.ldjson          |  12 +-
 data/tinkerpop-classic.json                     |   2 +-
 data/tinkerpop-classic.kryo                     | Bin 817 -> 765 bytes
 data/tinkerpop-crew-vertices.kryo               | Bin 2743 -> 2575 bytes
 data/tinkerpop-crew.kryo                        | Bin 1916 -> 1858 bytes
 data/tinkerpop-modern-vertices.kryo             | Bin 1439 -> 1295 bytes
 data/tinkerpop-modern.kryo                      | Bin 877 -> 825 bytes
 .../gremlin/structure/io/gryo/GryoMapper.java   | 212 +---------
 .../gremlin/structure/io/gryo/GryoReader.java   |  18 +-
 .../gremlin/structure/io/gryo/GryoWriter.java   |  25 +-
 .../structure/io/gryo/GryoReaderWriterTest.java | 102 +++++
 .../driver/ser/GryoMessageSerializerV1d0.java   |  19 +-
 .../structure/io/graphml/grateful-dead.xml      |  18 +-
 .../structure/io/graphml/tinkerpop-classic.xml  |  18 +-
 .../structure/io/graphml/tinkerpop-modern.xml   |  18 +-
 .../graphson/tinkerpop-classic-normalized.json  |   2 +-
 .../io/graphson/tinkerpop-classic-typed.json    |   2 +-
 .../io/graphson/tinkerpop-classic.json          |   2 +-
 .../io/gryo/grateful-dead-vertices.kryo         | Bin 1028298 -> 975214 bytes
 .../structure/io/gryo/grateful-dead.kryo        | Bin 515409 -> 493339 bytes
 .../io/gryo/tinkerpop-classic-vertices.kryo     | Bin 1323 -> 1179 bytes
 .../structure/io/gryo/tinkerpop-classic.kryo    | Bin 817 -> 765 bytes
 .../io/gryo/tinkerpop-crew-vertices.kryo        | Bin 2743 -> 2575 bytes
 .../structure/io/gryo/tinkerpop-crew.kryo       | Bin 1916 -> 1858 bytes
 .../io/gryo/tinkerpop-modern-vertices.kryo      | Bin 1439 -> 1295 bytes
 .../structure/io/gryo/tinkerpop-modern.kryo     | Bin 877 -> 825 bytes
 .../structure/io/gryo/GryoRecordReader.java     |   8 +-
 tinkergraph-gremlin/pom.xml                     |   2 +-
 .../tinkergraph/structure/TinkerGraphTest.java  |   4 +-
 36 files changed, 384 insertions(+), 507 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6ffd5b4c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
----------------------------------------------------------------------
diff --cc gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
index f50198f,9bdf9d4..f6ee967
--- 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
@@@ -53,14 -52,10 +53,11 @@@ import org.apache.tinkerpop.gremlin.str
  import org.apache.tinkerpop.shaded.kryo.Kryo;
  import org.apache.tinkerpop.shaded.kryo.KryoSerializable;
  import org.apache.tinkerpop.shaded.kryo.Serializer;
- import org.apache.tinkerpop.shaded.kryo.io.Input;
- import org.apache.tinkerpop.shaded.kryo.io.Output;
  import org.apache.tinkerpop.shaded.kryo.util.DefaultStreamFactory;
  import org.apache.tinkerpop.shaded.kryo.util.MapReferenceResolver;
 +import org.javatuples.Pair;
  import org.javatuples.Triplet;
  
- import java.io.IOException;
  import java.math.BigDecimal;
  import java.math.BigInteger;
  import java.net.URI;
@@@ -173,69 -121,9 +123,9 @@@ public final class GryoMapper implement
      }
  
      /**
-      * Use the most current version of Gryo.
+      * A builder to construct a {@link GryoMapper} instance.
       */
-     public static Builder build() {
-         return Version.V_1_0_0.getBuilder();
-     }
- 
-     public static interface Builder extends Mapper.Builder<Builder> {
-         /**
-          * Add mapper classes to serializes with gryo using standard serialization.
-          */
-         public Builder addCustom(final Class... custom);
- 
-         /**
-          * Add mapper class to serializes with mapper serialization.
-          */
-         public Builder addCustom(final Class clazz, final Serializer serializer);
- 
-         /**
-          * Add mapper class to serializes with mapper serialization as returned from a {@link Function}.
-          */
-         public Builder addCustom(final Class clazz, final Function<Kryo, Serializer> serializer);
- 
-         /**
-          * If using mapper classes it might be useful to tag the version stamped to the serialization with a mapper
-          * value, such that Gryo serialization at 1.0.0 would have a fourth byte for an extended version.  The user
-          * supplied fourth byte can then be used to ensure the right deserializer is used to read the data. If this
-          * value is not supplied then it is written as {@link Byte#MIN_VALUE}. The value supplied here should be greater
-          * than or equal to zero.
-          */
-         public Builder extendedVersion(final byte extendedVersion);
- 
-         /**
-          * By default the {@link #extendedVersion(byte)} is checked against what is read from an input source and if
-          * those values are equal the version being read is considered "compliant".  To alter this behavior, supply a
-          * mapper compliance {@link Predicate} to evaluate the value read from the input source (i.e. first argument)
-          * and the value marked in the {@code GryoMapper} instance {i.e. second argument}.  Supplying this function is
-          * useful when versions require backward compatibility or other more complex checks.  This function is only used
-          * if the {@link #extendedVersion(byte)} is set to something other than its default.
-          */
-         public Builder compliant(final BiPredicate<Byte, Byte> compliant);
- 
-         public GryoMapper create();
-     }
- 
-     public enum Version {
-         V_1_0_0(BuilderV1d0.class);
- 
-         private final Class<? extends Builder> builder;
- 
-         private Version(final Class<? extends Builder> builder) {
-             this.builder = builder;
-         }
- 
-         Builder getBuilder() {
-             try {
-                 return builder.newInstance();
-             } catch (Exception x) {
-                 throw new RuntimeException("Gryo Builder implementation cannot be instantiated", x);
-             }
-         }
-     }
- 
-     public static class BuilderV1d0 implements Builder {
 -    public static class Builder {
++    public static class Builder implements Mapper.Builder<Builder> {
  
          /**
           * Map with one entry that is used so that it is possible to get the class of LinkedHashMap.Entry.
@@@ -330,30 -218,16 +220,24 @@@
              add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DependantMutableMetrics.class, null, 80));
          }};
  
-         private static final byte major = 1;
-         private static final byte minor = 0;
-         private static final byte patchLevel = 0;
- 
-         private byte extendedVersion = DEFAULT_EXTENDED_VERSION;
-         private BiPredicate<Byte, Byte> compliant = (readExt, serExt) -> readExt.equals(serExt);
- 
 +        private IoRegistry registry = null;
 +
          /**
           * Starts numbering classes for Gryo serialization at 65536 to leave room for future usage by TinkerPop.
           */
          private final AtomicInteger currentSerializationId = new AtomicInteger(65536);
--
++        
+         private Builder() {}
++        
 +        @Override
 +        public Builder addRegistry(final IoRegistry registry) {
 +            this.registry = registry;
 +            return this;
 +        }
  
          /**
-          * {@inheritDoc}
-          */
-         @Override
+          * Register custom classes to serializes with gryo using default serialization.
 -         */
++         */        
          public Builder addCustom(final Class... custom) {
              if (custom != null && custom.length > 0)
                  serializationList.addAll(Arrays.asList(custom).stream()
@@@ -372,92 -245,15 +255,29 @@@
          }
  
          /**
-          * {@inheritDoc}
-          */
-         @Override
+          * Register a custom class to serialize with a custom serializer as returned from a {@link Function}.
 -         */
++         */        
          public Builder addCustom(final Class clazz, final Function<Kryo, Serializer> serializer) {
              serializationList.add(Triplet.with(clazz, serializer, currentSerializationId.getAndIncrement()));
              return this;
          }
  
-         /**
-          * {@inheritDoc}
-          */
-         @Override
-         public Builder extendedVersion(final byte extendedVersion) {
-             if (extendedVersion > DEFAULT_EXTENDED_VERSION && extendedVersion < 0)
-                 throw new IllegalArgumentException("The extendedVersion must be greater than zero");
- 
-             this.extendedVersion = extendedVersion;
-             return this;
-         }
- 
-         /**
-          * {@inheritDoc}
-          */
-         @Override
-         public Builder compliant(final BiPredicate<Byte, Byte> compliant) {
-             if (null == compliant)
-                 throw new IllegalArgumentException("compliant");
- 
-             this.compliant = compliant;
-             return this;
-         }
- 
-         @Override
          public GryoMapper create() {
 +            if (registry != null) {
 +                final List<Pair<Class, Object>> serializers = registry.find(GryoIo.class);
 +                serializers.forEach(p -> {
 +                    if (null == p.getValue1())
 +                        addCustom(p.getValue0());
 +                    else if (p.getValue1() instanceof Serializer)
 +                        addCustom(p.getValue0(), (Serializer) p.getValue1());
 +                    else if (p.getValue1() instanceof Function)
 +                        addCustom(p.getValue0(), (Function<Kryo, Serializer>) p.getValue1());
 +                    else
 +                        throw new RuntimeException("Invalid serializer"); // todo: cleanup exception handling
 +                });
 +            }
 +
-             return new GryoMapper(serializationList, this::writeHeader, this::readHeader);
-         }
- 
-         private void writeHeader(final Kryo kryo, final Output output) throws IOException {
-             // 32 byte header total
-             output.writeBytes(GIO);
- 
-             // some space for later
-             output.writeBytes(new byte[25]);
- 
-             // version x.y.z
-             output.writeByte(major);
-             output.writeByte(minor);
-             output.writeByte(patchLevel);
-             output.writeByte(extendedVersion);
-         }
- 
-         private void readHeader(final Kryo kryo, final Input input) throws IOException {
-             if (!Arrays.equals(GIO, input.readBytes(3)))
-                 throw new IOException("Invalid format - first three bytes of header do not match expected value");
- 
-             // skip the next 25 bytes in v1
-             input.readBytes(25);
- 
-             // final three bytes of header are the version which should be 1.0.0
-             final byte[] version = input.readBytes(3);
-             final byte extension = input.readByte();
- 
-             // direct match on version for now
-             if (version[0] != major || version[1] != minor || version[2] != patchLevel)
-                 throw new IOException(String.format(
-                         "The version [%s.%s.%s] in the stream cannot be understood by this reader",
-                         version[0], version[1], version[2]));
- 
-             if (extendedVersion >= 0 && !compliant.test(extension, extendedVersion))
-                 throw new IOException(String.format(
-                         "The extension [%s] in the input source is not compliant with this configuration of Gryo - [%s]",
-                         extension, extendedVersion));
+             return new GryoMapper(serializationList);
          }
      }
  }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6ffd5b4c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6ffd5b4c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
----------------------------------------------------------------------
diff --cc gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
index b7c82a7,3b011ef..25204a9
--- 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
@@@ -30,11 -30,8 +30,10 @@@ import org.apache.tinkerpop.shaded.kryo
  
  import java.io.IOException;
  import java.io.OutputStream;
 +import java.io.Writer;
 +import java.nio.ByteBuffer;
  import java.util.HashMap;
  import java.util.Iterator;
- import java.util.UUID;
  
  /**
   * The {@link GraphWriter} for the Gremlin Structure serialization format based on Kryo.  The format is meant to be

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6ffd5b4c/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
----------------------------------------------------------------------
diff --cc gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
index ff50d6a,9d44eae..8586bda
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
@@@ -110,7 -101,7 +102,7 @@@ public class GryoMessageSerializerV1d0 
  
              // a graph was found so use the mapper it constructs.  this allows gryo to be auto-configured with any
              // custom classes that the implementation allows for
-             initialBuilder = g.io(GryoIo.build()).mapper();
 -            builder = g.io().gryoMapper();
++            builder = g.io(GryoIo.build()).mapper();
          } else {
              // no graph was supplied so just use the default - this will likely be the case when using a graph
              // with no custom classes or a situation where the user needs complete control like when using two

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6ffd5b4c/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
----------------------------------------------------------------------


[10/12] incubator-tinkerpop git commit: Centralized creation of Io.Builder instances in IoTest.

Posted by sp...@apache.org.
Centralized creation of Io.Builder instances in IoTest.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/4d8c4384
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/4d8c4384
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/4d8c4384

Branch: refs/heads/master
Commit: 4d8c4384300289588ce61b9b8094205d052f25f3
Parents: 6ffd5b4
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Apr 20 08:00:41 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Apr 20 08:00:41 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/IoTest.java     | 217 ++++++++++---------
 1 file changed, 115 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4d8c4384/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
index 0b9765a..0efc264 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
@@ -39,6 +39,7 @@ import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexPropertyFeatu
 import org.apache.tinkerpop.gremlin.structure.io.GraphMigrator;
 import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
 import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Io;
 import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLIo;
 import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLReader;
 import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter;
@@ -57,6 +58,7 @@ import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
 import org.apache.tinkerpop.gremlin.util.StreamFactory;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -104,6 +106,10 @@ public class IoTest extends AbstractGremlinTest {
 
     private static String tempPath;
 
+    private Io.Builder<GraphMLIo> graphml;
+    private Io.Builder<GraphSONIo> graphson;
+    private Io.Builder<GryoIo> gryo;
+
     static {
         tempPath = TestHelper.makeTestDataPath(IoTest.class, "iotest").getPath() + File.separator;
     }
@@ -115,6 +121,13 @@ public class IoTest extends AbstractGremlinTest {
         if (!tempDir.mkdirs()) throw new IOException(String.format("Could not create %s", tempDir));
     }
 
+    @Before
+    public void setupBeforeEachTest() {
+        graphml = GraphMLIo.build();
+        graphson = GraphSONIo.build();
+        gryo = GryoIo.build();
+    }
+
     @Test
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@@ -161,11 +174,11 @@ public class IoTest extends AbstractGremlinTest {
     public void shouldReadWriteClassicToGraphMLToFileWithHelpers() throws Exception {
         final File f = TestHelper.generateTempFile(this.getClass(), name.getMethodName(), ".xml");
         try {
-            graph.io(GraphMLIo.build()).write(f.getAbsolutePath());
+            graph.io(graphml).write(f.getAbsolutePath());
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CLASSIC);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            g1.io(GraphMLIo.build()).read(f.getAbsolutePath());
+            g1.io(graphml).read(f.getAbsolutePath());
 
             assertClassicGraph(graph, false, true);
 
@@ -213,8 +226,8 @@ public class IoTest extends AbstractGremlinTest {
     @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
     public void shouldWriteNormalizedGraphSON() throws Exception {
         try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
-            final GraphSONMapper mapper = graph.io(GraphSONIo.build()).mapper().normalize(true).create();
-            final GraphSONWriter w = graph.io(GraphSONIo.build()).writer().mapper(mapper).create();
+            final GraphSONMapper mapper = graph.io(graphson).mapper().normalize(true).create();
+            final GraphSONWriter w = graph.io(graphson).writer().mapper(mapper).create();
             w.writeGraph(bos, graph);
 
             final String expected = streamToString(IoTest.class.getResourceAsStream(GRAPHSON_RESOURCE_PATH_PREFIX + "tinkerpop-classic-normalized.json"));
@@ -277,8 +290,8 @@ public class IoTest extends AbstractGremlinTest {
 
         final SimpleModule module = new SimpleModule();
         module.addSerializer(CustomId.class, new CustomId.CustomIdJacksonSerializer());
-        final GraphWriter writer = graph.io(GraphSONIo.build()).writer().mapper(
-                graph.io(GraphSONIo.build()).mapper().addCustomModule(module).embedTypes(true).create()).create();
+        final GraphWriter writer = graph.io(graphson).writer().mapper(
+                graph.io(graphson).mapper().addCustomModule(module).embedTypes(true).create()).create();
 
         try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
             writer.writeGraph(baos, graph);
@@ -297,8 +310,8 @@ public class IoTest extends AbstractGremlinTest {
             final Graph g2 = graphProvider.openTestGraph(configuration);
 
             try (final InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
-                final GraphReader reader = graph.io(GraphSONIo.build()).reader()
-                        .mapper(graph.io(GraphSONIo.build()).mapper().embedTypes(true).addCustomModule(module).create()).create();
+                final GraphReader reader = graph.io(graphson).reader()
+                        .mapper(graph.io(graphson).mapper().embedTypes(true).addCustomModule(module).create()).create();
                 reader.readGraph(is, g2);
             }
 
@@ -347,8 +360,8 @@ public class IoTest extends AbstractGremlinTest {
         graphProvider.clear(configuration);
         final Graph g1 = graphProvider.openTestGraph(configuration);
 
-        final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
-        final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+        final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
+        final GryoWriter writer = graph.io(gryo).writer().create();
 
         GraphMigrator.migrateGraph(graph, g1, reader, writer);
 
@@ -367,8 +380,8 @@ public class IoTest extends AbstractGremlinTest {
         graphProvider.clear(configuration);
         final Graph g1 = graphProvider.openTestGraph(configuration);
 
-        final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
-        final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+        final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
+        final GryoWriter writer = graph.io(gryo).writer().create();
 
         GraphMigrator.migrateGraph(graph, g1, reader, writer);
 
@@ -387,13 +400,13 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldReadWriteModernToGryo() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeGraph(os, graph);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.MODERN);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
             }
@@ -415,11 +428,11 @@ public class IoTest extends AbstractGremlinTest {
     public void shouldReadWriteModernToGryoToFileWithHelpers() throws Exception {
         final File f = TestHelper.generateTempFile(this.getClass(), name.getMethodName(), ".kryo");
         try {
-            graph.io(GryoIo.build()).write(f.getAbsolutePath());
+            graph.io(gryo).write(f.getAbsolutePath());
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.MODERN);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            g1.io(GryoIo.build()).read(f.getAbsolutePath());
+            g1.io(gryo).read(f.getAbsolutePath());
 
             // by making this lossy for float it will assert floats for doubles
             assertModernGraph(g1, true, false);
@@ -441,14 +454,14 @@ public class IoTest extends AbstractGremlinTest {
     public void shouldReadWriteCrewToGryo() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
 
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeGraph(os, graph);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CREW);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
             final GryoReader reader = GryoReader.build()
-                    .mapper(graph.io(GryoIo.build()).mapper().create())
+                    .mapper(graph.io(gryo).mapper().create())
                     .workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
@@ -471,13 +484,13 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldReadWriteClassicToGryo() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeGraph(os, graph);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CLASSIC);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
             }
@@ -495,13 +508,13 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldReadWriteClassicToGraphSON() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             writer.writeGraph(os, graph);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CLASSIC);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
             }
@@ -519,13 +532,13 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldReadWriteModernToGraphSON() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             writer.writeGraph(os, graph);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.MODERN);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
             }
@@ -544,12 +557,12 @@ public class IoTest extends AbstractGremlinTest {
     public void shouldReadWriteModernToGraphSONWithHelpers() throws Exception {
         final File f = TestHelper.generateTempFile(this.getClass(), name.getMethodName(), ".json");
         try {
-            graph.io(GraphSONIo.build()).write(f.getAbsolutePath());
+            graph.io(graphson).write(f.getAbsolutePath());
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.MODERN);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            g1.io(GraphSONIo.build()).read(f.getAbsolutePath());
+            g1.io(graphson).read(f.getAbsolutePath());
 
             assertModernGraph(g1, true, false);
 
@@ -569,13 +582,13 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldReadWriteCrewToGraphSON() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             writer.writeGraph(os, graph);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CREW);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
             }
@@ -597,11 +610,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friend", v2, "weight", 0.5f, "acl", "rw");
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -633,11 +646,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friend", v2, "weight", 0.5d, "acl", "rw");
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -667,11 +680,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = DetachedFactory.detach(v1.addEdge("friend", v2, "weight", 0.5d, "acl", "rw"), false);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -701,11 +714,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = DetachedFactory.detach(v1.addEdge("friend", v2, "weight", 0.5d, "acl", "rw"), true);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -736,11 +749,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friend", v2, "weight", 0.5f, "acl", "rw");
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), graph.edges(detachedEdge.id().toString()).next().id());
@@ -771,11 +784,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = DetachedFactory.detach(v1.addEdge("friend", v2, "weight", 0.5f, "acl", "rw"), false);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), graph.edges(detachedEdge.id().toString()).next().id());
@@ -805,11 +818,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = DetachedFactory.detach(v1.addEdge("friend", v2, "weight", 0.5f, "acl", "rw"), true);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), graph.edges(detachedEdge.id().toString()).next().id());
@@ -841,11 +854,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friend", v2, "weight", 0.5f, "acl", "rw");
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().mapper(graph.io(GraphSONIo.build()).mapper().embedTypes(true).create()).create();
+            final GraphSONWriter writer = graph.io(graphson).writer().mapper(graph.io(graphson).mapper().embedTypes(true).create()).create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().mapper(graph.io(GraphSONIo.build()).mapper().embedTypes(true).create()).create();
+            final GraphSONReader reader = graph.io(graphson).reader().mapper(graph.io(graphson).mapper().embedTypes(true).create()).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -877,11 +890,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friend", v2, "uuid", id);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().mapper(graph.io(GraphSONIo.build()).mapper().embedTypes(true).create()).create();
+            final GraphSONWriter writer = graph.io(graphson).writer().mapper(graph.io(graphson).mapper().embedTypes(true).create()).create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().mapper(graph.io(GraphSONIo.build()).mapper().embedTypes(true).create()).create();
+            final GraphSONReader reader = graph.io(graphson).reader().mapper(graph.io(graphson).mapper().embedTypes(true).create()).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     // a quick reminder here that the purpose of these id assertions is to ensure that those with
@@ -917,11 +930,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friend", v2, "uuid", id);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -955,11 +968,11 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeVertex(os, v1);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -986,11 +999,11 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeVertex(os, v1);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -1017,12 +1030,12 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             final DetachedVertex dv = DetachedFactory.detach(v1, true);
             writer.writeVertex(os, dv);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -1049,12 +1062,12 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             final DetachedVertex dv = DetachedFactory.detach(v1, false);
             writer.writeVertex(os, dv);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -1082,11 +1095,11 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeVertex(os, v1);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -1117,11 +1130,11 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             writer.writeVertex(os, v1);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1150,12 +1163,12 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             final DetachedVertex dv = DetachedFactory.detach(v1, true);
             writer.writeVertex(os, dv);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1184,12 +1197,12 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             final DetachedVertex dv = DetachedFactory.detach(v1, false);
             writer.writeVertex(os, dv);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1219,11 +1232,11 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             writer.writeVertex(os, v1);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1246,11 +1259,11 @@ public class IoTest extends AbstractGremlinTest {
     @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
     public void shouldReadWriteVerticesNoEdgesToGryoManual() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeVertices(os, g.V().has("age", Compare.gt, 30));
 
             final AtomicInteger called = new AtomicInteger(0);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
 
             try (final VertexByteArrayInputStream vbais = new VertexByteArrayInputStream(new ByteArrayInputStream(os.toByteArray()))) {
                 reader.readVertex(new ByteArrayInputStream(vbais.readVertexBytes().toByteArray()),
@@ -1274,11 +1287,11 @@ public class IoTest extends AbstractGremlinTest {
     @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldReadWriteVerticesNoEdgesToGryo() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeVertices(os, g.V().has("age", Compare.gt, 30));
 
             final AtomicInteger called = new AtomicInteger(0);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
 
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 final Iterator<Vertex> itty = reader.readVertices(bais, null,
@@ -1300,11 +1313,11 @@ public class IoTest extends AbstractGremlinTest {
     @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
     public void shouldReadWriteVerticesNoEdgesToGraphSONManual() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             writer.writeVertices(os, g.V().has("age", Compare.gt, 30));
 
             final AtomicInteger called = new AtomicInteger(0);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             final BufferedReader br = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(os.toByteArray())));
             String line = br.readLine();
             reader.readVertex(new ByteArrayInputStream(line.getBytes()),
@@ -1337,12 +1350,12 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeVertex(os, v1, Direction.OUT);
 
             final AtomicBoolean calledVertex = new AtomicBoolean(false);
             final AtomicBoolean calledEdge = new AtomicBoolean(false);
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
 
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.OUT, detachedVertex -> {
@@ -1386,12 +1399,12 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friends", v2, "weight", 0.5f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             writer.writeVertex(os, v1, Direction.OUT);
 
             final AtomicBoolean calledVertex = new AtomicBoolean(false);
             final AtomicBoolean calledEdge = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.OUT, detachedVertex -> {
                             assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1433,13 +1446,13 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v2.addEdge("friends", v1, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeVertex(os, v1, Direction.IN);
 
             final AtomicBoolean calledVertex = new AtomicBoolean(false);
             final AtomicBoolean calledEdge = new AtomicBoolean(false);
 
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.IN, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -1482,13 +1495,13 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v2.addEdge("friends", v1, "weight", 0.5f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             writer.writeVertex(os, v1, Direction.IN);
             os.close();
 
             final AtomicBoolean calledVertex = new AtomicBoolean(false);
             final AtomicBoolean calledEdge = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.IN, detachedVertex -> {
                             assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1531,14 +1544,14 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e2 = v1.addEdge("friends", v2, "weight", 1.0d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean calledVertex = new AtomicBoolean(false);
             final AtomicBoolean calledEdge1 = new AtomicBoolean(false);
             final AtomicBoolean calledEdge2 = new AtomicBoolean(false);
 
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.BOTH, detachedVertex -> {
                             assertEquals(v1.id(), detachedVertex.id());
@@ -1595,14 +1608,14 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e2 = v1.addEdge("friends", v2, "weight", 1.0f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean vertexCalled = new AtomicBoolean(false);
             final AtomicBoolean edge1Called = new AtomicBoolean(false);
             final AtomicBoolean edge2Called = new AtomicBoolean(false);
 
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.BOTH, detachedVertex -> {
                             assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1660,14 +1673,14 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e2 = v1.addEdge("friends", v2, "weight", 1.0f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().mapper(graph.io(GraphSONIo.build()).mapper().embedTypes(true).create()).create();
+            final GraphSONWriter writer = graph.io(graphson).writer().mapper(graph.io(graphson).mapper().embedTypes(true).create()).create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean vertexCalled = new AtomicBoolean(false);
             final AtomicBoolean edge1Called = new AtomicBoolean(false);
             final AtomicBoolean edge2Called = new AtomicBoolean(false);
 
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().mapper(graph.io(GraphSONIo.build()).mapper().embedTypes(true).create()).create();
+            final GraphSONReader reader = graph.io(graphson).reader().mapper(graph.io(graphson).mapper().embedTypes(true).create()).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.BOTH, detachedVertex -> {
                     // a quick reminder here that the purpose of these id assertions is to ensure that those with
@@ -1728,13 +1741,13 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 1.0d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean vertexCalled = new AtomicBoolean(false);
             final AtomicBoolean edge1Called = new AtomicBoolean(false);
 
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.IN, detachedVertex -> {
                             assertEquals(v1.id(), detachedVertex.id());
@@ -1781,13 +1794,13 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 1.0f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean vertexCalled = new AtomicBoolean(false);
             final AtomicBoolean edgeCalled = new AtomicBoolean(false);
 
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.IN, detachedVertex -> {
                     assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1834,13 +1847,13 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e2 = v1.addEdge("friends", v2, "weight", 1.0d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean vertexCalled = new AtomicBoolean(false);
             final AtomicBoolean edgeCalled = new AtomicBoolean(false);
 
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.OUT, detachedVertex -> {
                             assertEquals(v1.id(), detachedVertex.id());
@@ -1888,13 +1901,13 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e2 = v1.addEdge("friends", v2, "weight", 1.0f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
+            final GraphSONWriter writer = graph.io(graphson).writer().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean vertexCalled = new AtomicBoolean(false);
             final AtomicBoolean edgeCalled = new AtomicBoolean(false);
 
-            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
+            final GraphSONReader reader = graph.io(graphson).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.OUT, detachedVertex -> {
                     assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1938,10 +1951,10 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeVertex(os, v1, Direction.OUT);
 
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais,
                         Direction.BOTH,
@@ -1962,10 +1975,10 @@ public class IoTest extends AbstractGremlinTest {
         v2.addEdge("friends", v1, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeVertex(os, v1, Direction.IN);
 
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais,
                         Direction.BOTH,
@@ -1986,10 +1999,10 @@ public class IoTest extends AbstractGremlinTest {
         v2.addEdge("friends", v1, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeVertex(os, v1, Direction.IN);
 
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais,
                         Direction.OUT,
@@ -2010,10 +2023,10 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
+            final GryoWriter writer = graph.io(gryo).writer().create();
             writer.writeVertex(os, v1, Direction.IN);
 
-            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(gryo).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais,
                         Direction.OUT,


[08/12] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/master' into refactor-io

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master' into refactor-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/42f367a3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/42f367a3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/42f367a3

Branch: refs/heads/master
Commit: 42f367a367f8c41eb4669b4814137bec9ffca37d
Parents: 4a7a2a5 9990579
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 17 08:53:58 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 17 08:53:58 2015 -0400

----------------------------------------------------------------------
 .../gremlin/process/traversal/Path.java         |  9 +--
 .../process/traversal/TraversalStrategies.java  |  4 --
 .../gremlin/process/traversal/Traverser.java    | 12 ++--
 .../gremlin/process/traversal/util/Metrics.java | 10 ---
 .../gremlin/structure/io/gryo/GryoWriter.java   |  8 ---
 .../structure/util/batch/BatchGraph.java        | 21 +++----
 .../driver/message/ResponseStatusCode.java      |  6 +-
 .../tinkerpop/gremlin/AbstractGremlinSuite.java | 19 +++---
 .../apache/tinkerpop/gremlin/GraphProvider.java | 64 ++++++++++----------
 .../gremlin/process/ProcessComputerSuite.java   |  2 +-
 .../structure/StructureStandardSuite.java       | 10 +--
 .../tinkergraph/structure/TinkerGraph.java      | 36 +++++------
 12 files changed, 90 insertions(+), 111 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/42f367a3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
----------------------------------------------------------------------


[11/12] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/master' into refactor-io

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master' into refactor-io

Conflicts:
	tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/e4301a8c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/e4301a8c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/e4301a8c

Branch: refs/heads/master
Commit: e4301a8c205412eacefdaaa6544cda9d17a30687
Parents: 4d8c438 8df91fc
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Apr 21 06:43:08 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Apr 21 06:43:08 2015 -0400

----------------------------------------------------------------------
 LICENSE                                         |   33 +-
 NOTICE                                          |   12 +-
 README.asciidoc                                 |    3 +-
 data/grateful-dead-vertices.kryo                |  Bin 975214 -> 975214 bytes
 data/grateful-dead-vertices.ldjson              |  422 +++---
 data/script-input.groovy                        |   39 +
 data/tinkerpop-classic.txt                      |    6 +
 docs/src/implementations.asciidoc               |  117 +-
 docs/src/the-graph.asciidoc                     |    3 +-
 docs/src/the-traversal.asciidoc                 |    3 +
 docs/static/images/adjacency-list.png           |  Bin 0 -> 36192 bytes
 docs/static/images/tinkerpop3.graffle           | 1334 +++++++++++++++++-
 docs/stylesheets/asciidoctor.css                |  656 ---------
 docs/stylesheets/colony.css                     |  662 ---------
 docs/stylesheets/foundation-lime.css            |  659 ---------
 docs/stylesheets/foundation-potion.css          |  659 ---------
 docs/stylesheets/foundation.css                 |  650 ---------
 docs/stylesheets/github.css                     |  671 ---------
 docs/stylesheets/golo.css                       |  673 ---------
 docs/stylesheets/iconic.css                     |  694 ---------
 docs/stylesheets/maker.css                      |  670 ---------
 docs/stylesheets/readthedocs.css                |  671 ---------
 docs/stylesheets/riak.css                       |  691 ---------
 docs/stylesheets/rocket-panda.css               |  664 ---------
 docs/stylesheets/rubygems.css                   |  652 ---------
 docs/stylesheets/tinkerpop.css                  |   19 +
 docs/stylesheets/tinkerpop.scss                 |   83 --
 gremlin-console/bin/gremlin.sh                  |    4 +-
 gremlin-console/pom.xml                         |    2 +-
 gremlin-console/src/assembly/distribution.xml   |   16 +-
 gremlin-console/src/assembly/standalone.xml     |    3 +
 gremlin-console/src/main/LICENSE                |    2 +-
 .../ser/AbstractJsonMessageSerializerV1d0.java  |   37 +-
 .../driver/ser/GryoMessageSerializerV1d0.java   |    1 -
 .../driver/ser/JsonMessageSerializerV1d0.java   |   16 +-
 .../step/filter/GroovyExceptTest.groovy         |   16 +-
 gremlin-server/data/sample.kryo                 |  Bin 4781783 -> 4781767 bytes
 gremlin-server/pom.xml                          |  178 +--
 gremlin-server/src/assembly/distribution.xml    |   16 +-
 gremlin-server/src/assembly/standalone.xml      |    3 +
 gremlin-server/src/main/LICENSE                 |    2 +-
 .../handler/HttpGremlinEndpointHandler.java     |    4 +-
 .../gremlin/server/handler/IteratorHandler.java |    6 +-
 .../handler/NioGremlinResponseEncoder.java      |   20 +-
 .../server/handler/OpExecutorHandler.java       |    6 +-
 .../server/handler/OpSelectorHandler.java       |    6 +-
 .../handler/WsGremlinResponseEncoder.java       |   22 +-
 .../src/test/resources/application.conf         |   26 -
 gremlin-server/src/test/resources/gatling.conf  |  109 --
 .../src/test/resources/logback-test.xml         |   39 -
 .../GremlinServerAdditionSimulation.scala       |   96 --
 .../traversal/step/filter/ExceptTest.java       |   31 +-
 .../io/gryo/grateful-dead-vertices.kryo         |  Bin 975214 -> 975214 bytes
 hadoop-gremlin/conf/hadoop-script.properties    |   52 +
 pom.xml                                         |   17 +-
 tinkergraph-gremlin/pom.xml                     |   28 +
 .../tinkergraph/structure/TinkerGraphTest.java  |   19 +
 57 files changed, 1935 insertions(+), 9588 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e4301a8c/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/AbstractJsonMessageSerializerV1d0.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e4301a8c/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e4301a8c/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
----------------------------------------------------------------------
diff --cc tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
index 6707ce2,107b3a7..f27787c
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
@@@ -21,7 -21,8 +21,9 @@@ package org.apache.tinkerpop.gremlin.ti
  import org.apache.commons.io.FileUtils;
  import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
  import org.apache.tinkerpop.gremlin.TestHelper;
 +import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLIo;
+ import org.apache.tinkerpop.gremlin.algorithm.generator.DistributionGenerator;
+ import org.apache.tinkerpop.gremlin.algorithm.generator.PowerLawDistribution;
  import org.apache.tinkerpop.gremlin.structure.util.star.StarGraph;
  import org.apache.tinkerpop.gremlin.process.traversal.T;
  import org.apache.tinkerpop.gremlin.process.traversal.Traversal;


[06/12] incubator-tinkerpop git commit: Add tests for IoRegistry.

Posted by sp...@apache.org.
Add tests for IoRegistry.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/267e1c00
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/267e1c00
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/267e1c00

Branch: refs/heads/master
Commit: 267e1c006e389bb99131669a0cdbfa869be5dd7f
Parents: 478a44d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 16 13:51:01 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 16 13:51:01 2015 -0400

----------------------------------------------------------------------
 .../gremlin/structure/io/IoRegistry.java        | 12 ++-
 .../gremlin/structure/io/IoRegistryTest.java    | 99 ++++++++++++++++++++
 2 files changed, 106 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/267e1c00/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
index baf2668..ffbcc38 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONIo;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoIo;
 import org.javatuples.Pair;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
@@ -52,16 +53,16 @@ public class IoRegistry {
      * @param serializer a serializer implementation
      */
     public void register(final Class<? extends Io> ioClass, final Class clazz, final Object serializer) {
-        if (registeredSerializers.containsKey(ioClass))
-            registeredSerializers.get(ioClass).add(Pair.with(clazz, serializer));
-        else
-            registeredSerializers.put(ioClass, Arrays.asList(Pair.with(clazz, serializer)));
+        if (!registeredSerializers.containsKey(ioClass))
+            registeredSerializers.put(ioClass, new ArrayList<>());
+        registeredSerializers.get(ioClass).add(Pair.with(clazz, serializer));
     }
 
     /**
      * Find a list of all the serializers registered to an {@link Io} class by the {@link Graph}.
      */
     public List<Pair<Class,Object>> find(final Class<? extends Io> builderClass) {
+        if (!registeredSerializers.containsKey(builderClass)) return Collections.emptyList();
         return Collections.unmodifiableList(registeredSerializers.get(builderClass).stream()
                 .collect(Collectors.toList()));
     }
@@ -71,8 +72,9 @@ public class IoRegistry {
      * {@link Graph}.
      */
     public <S> List<Pair<Class,S>> find(final Class<? extends Io> builderClass, final Class<S> serializerType) {
+        if (!registeredSerializers.containsKey(builderClass)) return Collections.emptyList();
         return Collections.unmodifiableList(registeredSerializers.get(builderClass).stream()
-                .filter(p -> p.getValue1().getClass().isAssignableFrom(serializerType))
+                .filter(p -> serializerType.isAssignableFrom(p.getValue1().getClass()))
                 .map(p -> Pair.with(p.getValue0(), (S) p.getValue1()))
                 .collect(Collectors.toList()));
     }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/267e1c00/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistryTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistryTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistryTest.java
new file mode 100644
index 0000000..61b4da4
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistryTest.java
@@ -0,0 +1,99 @@
+/*
+ * 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.structure.io;
+
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONIo;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoIo;
+import org.javatuples.Pair;
+import org.junit.Test;
+
+import java.util.Date;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class IoRegistryTest {
+    @Test
+    public void shouldFindRegisteredClassesByIoImplementation() {
+        // note that this is a non-standard usage of IoRegistry strictly for testing purposes - refer to javadocs
+        // for proper usage
+        final IoRegistry registry = new IoRegistry();
+        registry.register(GryoIo.class, Long.class, "test");
+        registry.register(GryoIo.class, Integer.class, 1);
+        registry.register(GryoIo.class, String.class, 1L);
+        registry.register(GraphSONIo.class, Short.class, 100);
+
+        final List<Pair<Class, Object>> foundGryo = registry.find(GryoIo.class);
+        assertEquals(3, foundGryo.size());
+        assertEquals("test", foundGryo.get(0).getValue1());
+        assertEquals(String.class, foundGryo.get(2).getValue0());
+        assertEquals(1L, foundGryo.get(2).getValue1());
+        assertEquals(Long.class, foundGryo.get(0).getValue0());
+        assertEquals(1, foundGryo.get(1).getValue1());
+        assertEquals(Integer.class, foundGryo.get(1).getValue0());
+
+        final List<Pair<Class, Object>> foundGraphSON = registry.find(GraphSONIo.class);
+        assertEquals(1, foundGraphSON.size());
+        assertEquals(100, foundGraphSON.get(0).getValue1());
+        assertEquals(Short.class, foundGraphSON.get(0).getValue0());
+    }
+
+    @Test
+    public void shouldFindRegisteredClassesByIoImplementationAndSerializer() {
+        // note that this is a non-standard usage of IoRegistry strictly for testing purposes - refer to javadocs
+        // for proper usage
+        final IoRegistry registry = new IoRegistry();
+        registry.register(GryoIo.class, Long.class, "test");
+        registry.register(GryoIo.class, Integer.class, 1);
+        registry.register(GryoIo.class, String.class, 1L);
+        registry.register(GraphSONIo.class, Short.class, 100);
+
+        final List<Pair<Class, Number>> foundGryo = registry.find(GryoIo.class, Number.class);
+        assertEquals(2, foundGryo.size());
+        assertEquals(String.class, foundGryo.get(1).getValue0());
+        assertEquals(1L, foundGryo.get(1).getValue1());
+        assertEquals(1, foundGryo.get(0).getValue1());
+        assertEquals(Integer.class, foundGryo.get(0).getValue0());
+
+        final List<Pair<Class, Date>> foundGraphSON = registry.find(GraphSONIo.class, Date.class);
+        assertEquals(0, foundGraphSON.size());
+    }
+
+    @Test
+    public void shouldReturnEmptyListIfIoKeyNotPresentOnFindByImplementation() {
+        final IoRegistry registry = new IoRegistry();
+        assertEquals(0, registry.find(GryoIo.class).size());
+    }
+
+    @Test
+    public void shouldReturnEmptyListIfIoKeyNotPresentOnFindByImplementationAndSerializer() {
+        final IoRegistry registry = new IoRegistry();
+        assertEquals(0, registry.find(GryoIo.class, String.class).size());
+    }
+
+    @Test
+    public void shouldReturnEmptyListIfIoKeyPresentButNoSerializer() {
+        final IoRegistry registry = new IoRegistry();
+        registry.register(GryoIo.class, Long.class, String.class);
+        assertEquals(0, registry.find(GryoIo.class, Number.class).size());
+    }
+}


[04/12] incubator-tinkerpop git commit: Add javadoc around refactored Io.

Posted by sp...@apache.org.
Add javadoc around refactored 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/69d7761c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/69d7761c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/69d7761c

Branch: refs/heads/master
Commit: 69d7761c164bff5e28eb261248043559dc8ec9e8
Parents: 3d38e2e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 16 12:52:38 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 16 12:52:38 2015 -0400

----------------------------------------------------------------------
 .../gremlin/structure/io/GraphReader.java       |  7 ++++
 .../gremlin/structure/io/GraphWriter.java       |  7 ++++
 .../gremlin/structure/io/IoRegistry.java        | 35 +++++++++++++++-----
 3 files changed, 40 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/69d7761c/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 cf5ee04..157ee29 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
@@ -96,7 +96,14 @@ public interface GraphReader {
      */
     public Edge readEdge(final InputStream inputStream, final Function<DetachedEdge, Edge> edgeMaker) throws IOException;
 
+    /**
+     * Largely a marker interface for builder classes that construct a {@link GraphReader}.
+     */
     public interface ReaderBuilder<T extends GraphReader> {
+        /**
+         * Creates the {@link GraphReader} implementation given options provided to the {@link ReaderBuilder}
+         * implementation.
+         */
         T create();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/69d7761c/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 c63476f..0eb9f65 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
@@ -87,7 +87,14 @@ public interface GraphWriter {
      */
     public void writeEdge(final OutputStream outputStream, final Edge e) throws IOException;
 
+    /**
+     * Largely a marker interface for builder classes that construct a {@link GraphWriter}.
+     */
     public interface WriterBuilder<T extends GraphWriter> {
+        /**
+         * Creates the {@link GraphWriter} implementation given options provided to the {@link WriterBuilder}
+         * implementation.
+         */
         T create();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/69d7761c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
index 7bd8560..baf2668 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
@@ -18,6 +18,9 @@
  */
 package org.apache.tinkerpop.gremlin.structure.io;
 
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONIo;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoIo;
 import org.javatuples.Pair;
 
 import java.util.Arrays;
@@ -28,34 +31,48 @@ import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
+ * A generalized custom serializer registry for vendors implementing a {@link Graph}.  Vendors should register
+ * custom serializers to this registry via the {@link #register(Class, Class, Object)} method.  The serializers
+ * registered depend on the {@link Io} implementations that are expected to be supported.  There are currently
+ * just two core implementations in {@link GryoIo} and {@link GraphSONIo}.  Both of these should be supported
+ * for full compliance with the test suite.  There is no need to use this class if the {@link Graph} does not
+ * have custom classes that require serialization.
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class IoRegistry {
-    private final Map<Class<? extends Io.Builder>, List<Pair<Class, Object>>> registeredSerializers = new HashMap<>();
+    private final Map<Class<? extends Io>, List<Pair<Class, Object>>> registeredSerializers = new HashMap<>();
 
     /**
      * Add a "serializer" for the {@code Mapper}.  Note that what is accepted as a "serializer" is implementation
-     * specific.  Note that the {@link Io.Builder} implementation will consult this registry for "serializer" classes
-     * it expects so consult the {@link Io.Builder} implementation to understand what is expected for these values.
+     * specific.  An {@link Io} implementation will consult this registry for "serializer" classes
+     * it expects so refer to the {@link Io} implementation to understand what is expected for these values.
      *
      * @param clazz usually this is the class that is to be serialized - may be {@code null}
      * @param serializer a serializer implementation
      */
-    public void register(final Class<? extends Io.Builder> builderClass, final Class clazz, final Object serializer) {
-        if (registeredSerializers.containsKey(builderClass))
-            registeredSerializers.get(builderClass).add(Pair.with(clazz, serializer));
+    public void register(final Class<? extends Io> ioClass, final Class clazz, final Object serializer) {
+        if (registeredSerializers.containsKey(ioClass))
+            registeredSerializers.get(ioClass).add(Pair.with(clazz, serializer));
         else
-            registeredSerializers.put(builderClass, Arrays.asList(Pair.with(clazz, serializer)));
+            registeredSerializers.put(ioClass, Arrays.asList(Pair.with(clazz, serializer)));
     }
 
+    /**
+     * Find a list of all the serializers registered to an {@link Io} class by the {@link Graph}.
+     */
     public List<Pair<Class,Object>> find(final Class<? extends Io> builderClass) {
         return Collections.unmodifiableList(registeredSerializers.get(builderClass).stream()
                 .collect(Collectors.toList()));
     }
 
-    public <S> List<Pair<Class,S>> find(final Class<? extends Io> builderClass, final Class<S> c) {
+    /**
+     * Find a list of all the serializers, of a particular type, registered to an {@link Io} class by the
+     * {@link Graph}.
+     */
+    public <S> List<Pair<Class,S>> find(final Class<? extends Io> builderClass, final Class<S> serializerType) {
         return Collections.unmodifiableList(registeredSerializers.get(builderClass).stream()
-                .filter(p -> p.getValue1().getClass().isAssignableFrom(c))
+                .filter(p -> p.getValue1().getClass().isAssignableFrom(serializerType))
                 .map(p -> Pair.with(p.getValue0(), (S) p.getValue1()))
                 .collect(Collectors.toList()));
     }


[07/12] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/master' into refactor-io

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master' into refactor-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/4a7a2a52
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/4a7a2a52
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/4a7a2a52

Branch: refs/heads/master
Commit: 4a7a2a52139f817d83232ab845c236ef9a2a31c4
Parents: 267e1c0 7bd47a8
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 16 16:38:51 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 16 16:38:51 2015 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../driver/ser/GryoMessageSerializerV1d0.java   | 77 +++++++++++---------
 .../ser/GryoMessageSerializerV1D0Test.java      | 21 ++++++
 3 files changed, 63 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4a7a2a52/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
----------------------------------------------------------------------


[02/12] incubator-tinkerpop git commit: Drop the old Graph.Io interface and refactor tests to work with the new Graph.io() method

Posted by sp...@apache.org.
Drop the old Graph.Io interface and refactor tests to work with the new Graph.io() method


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/b28252a1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/b28252a1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/b28252a1

Branch: refs/heads/master
Commit: b28252a1ed82b88a5205dd7960ad2ef34386c593
Parents: 8a3b38a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 16 09:03:19 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 16 09:03:19 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/Graph.java      | 163 +--------------
 .../gremlin/structure/io/DefaultIo.java         |  82 --------
 .../ser/AbstractJsonMessageSerializerV1d0.java  |   3 +-
 .../driver/ser/GryoMessageSerializerV1d0.java   |   3 +-
 .../gremlin/AbstractGraphProvider.java          |   3 +-
 .../structure/GraphWritePerformanceTest.java    |   9 +-
 .../tinkerpop/gremlin/structure/IoTest.java     | 207 ++++++++++---------
 .../gremlin/structure/SerializationTest.java    |  51 +++--
 .../tinkergraph/structure/TinkerGraphTest.java  |   5 +-
 9 files changed, 152 insertions(+), 374 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b28252a1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
index 529f6bb..8f2414b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
@@ -25,20 +25,10 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.engine.StandardTraversalEngine;
-import org.apache.tinkerpop.gremlin.structure.io.DefaultIo;
-import org.apache.tinkerpop.gremlin.structure.io.Mapper;
-import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLReader;
-import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter;
-import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
-import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
-import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
-import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper;
-import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
-import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
+import org.apache.tinkerpop.gremlin.structure.io.Io;
 import org.apache.tinkerpop.gremlin.structure.util.FeatureDescriptor;
 import org.javatuples.Pair;
 
-import java.io.IOException;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Inherited;
 import java.lang.annotation.Repeatable;
@@ -246,14 +236,7 @@ public interface Graph extends AutoCloseable {
      */
     public Transaction tx();
 
-    /**
-     * Provide input/output methods for serializing graph data.
-     */
-    public default Io io() {
-        return new DefaultIo(this);
-    }
-
-    public default <I extends org.apache.tinkerpop.gremlin.structure.io.Io> I io(final org.apache.tinkerpop.gremlin.structure.io.Io.Builder<I> builder) {
+    public default <I extends Io> I io(final Io.Builder<I> builder) {
         return (I) builder.graph(this).create();
     }
 
@@ -275,148 +258,6 @@ public interface Graph extends AutoCloseable {
     public Configuration configuration();
 
     /**
-     * Provides access to functions related to reading and writing graph data.  Implementers can override these
-     * methods to provider mapper configurations to the default {@link org.apache.tinkerpop.gremlin.structure.io.GraphReader}
-     * and {@link org.apache.tinkerpop.gremlin.structure.io.GraphWriter} implementations (i.e. to register mapper
-     * serialization classes).
-     */
-    public interface Io {
-        /**
-         * Creates a {@link org.apache.tinkerpop.gremlin.structure.io.GraphReader} builder for Gryo serializations. This
-         * method calls the {@link Io#gryoMapper} method to supply to
-         * {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader.Builder#mapper} which means that implementers
-         * should usually just override {@link Io#gryoMapper} to append in their mapper classes.
-         */
-        public default GryoReader.Builder gryoReader() {
-            return GryoReader.build().mapper(gryoMapper().create());
-        }
-
-        /**
-         * Creates a {@link org.apache.tinkerpop.gremlin.structure.io.GraphWriter} builder for Gryo serializations. This
-         * method calls the {@link Io#gryoMapper} method to supply to
-         * {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter.Builder#mapper} which means that implementers
-         * should usually just override {@link Io#gryoMapper} to append in their mapper classes.
-         */
-        public default GryoWriter.Builder gryoWriter() {
-            return GryoWriter.build().mapper(gryoMapper().create());
-        }
-
-        /**
-         * Write a gryo file using the default configuration of the {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter}.
-         */
-        public void writeGryo(final String file) throws IOException;
-
-        /**
-         * Read a gryo file using the default configuration of the {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader}.
-         */
-        public void readGryo(final String file) throws IOException;
-
-        /**
-         * By default, this method creates an instance of the most current version of {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper} which is
-         * used to serialize data to and from the graph.   Implementers with mapper classes (e.g. a non-primitive
-         * class returned from {@link Element#id}) should override this method with those classes automatically
-         * registered to the returned {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper}.
-         * <br/>
-         * Implementers should respect versions.  Once a class is registered, the order of its registration should be
-         * maintained. Note that registering such classes will reduce the portability of the graph data as data
-         * written with {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper} will not be readable without this serializer configuration.  It is
-         * considered good practice to make serialization classes generally available so that users may
-         * register these classes themselves if necessary when building up a mapper {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper}
-         * instance.
-         * <br/>
-         * Note that this method is meant to return current versions for serialization operations.  Users wishing
-         * to use an "older" version should construct this instance as well as their readers and writers manually.
-         */
-        public default GryoMapper.Builder gryoMapper() {
-            return GryoMapper.build();
-        }
-
-        /**
-         * Creates a {@link org.apache.tinkerpop.gremlin.structure.io.GraphReader} builder for GraphML serializations. GraphML
-         * is the most portable of all the formats, but comes at the price of the least flexibility.
-         * {@code Graph} implementations that have mapper classes that need to be serialized will not be able
-         * to properly use this format effectively.
-         */
-        public default GraphMLReader.Builder graphMLReader() {
-            return GraphMLReader.build();
-        }
-
-        /**
-         * Creates a {@link org.apache.tinkerpop.gremlin.structure.io.GraphWriter} builder for GraphML serializations. GraphML
-         * is the most portable of all the formats, but comes at the price of the least flexibility.
-         * {@code Graph} implementations that have mapper classes that need to be serialized will not be able
-         * to properly use this format effectively.
-         */
-        public default GraphMLWriter.Builder graphMLWriter() {
-            return GraphMLWriter.build();
-        }
-
-        /**
-         * Write a GraphML file using the default configuration of the {@link GraphMLWriter}.
-         */
-        public void writeGraphML(final String file) throws IOException;
-
-        /**
-         * Read a GraphML file using the default configuration of the {@link GraphMLReader}.
-         */
-        public void readGraphML(final String file) throws IOException;
-
-        /**
-         * Creates a {@link org.apache.tinkerpop.gremlin.structure.io.GraphReader} builder for GraphSON serializations.
-         * GraphSON is forgiving for implementers and will typically do a "reasonable" job in serializing most
-         * mapper classes.  This method by default uses the {@link org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper} created by
-         * {@link #graphSONMapper}.  That method enables implementers to register mapper serialization
-         * modules for classes that do not serialize nicely by the default JSON serializers or completely
-         * fail to do so.
-         */
-        public default GraphSONReader.Builder graphSONReader() {
-            return GraphSONReader.build().mapper(graphSONMapper().create());
-        }
-
-        /**
-         * Creates a {@link org.apache.tinkerpop.gremlin.structure.io.GraphWriter} builder for GraphML serializations.
-         * GraphSON is forgiving for implementers and will typically do a "reasonable" job in serializing most
-         * mapper classes.  This method by default uses the {@link org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper} created by
-         * {@link #graphSONMapper}. That method enables implementers to register mapper serialization
-         * modules for classes that do not serialize nicely by the default JSON serializers or completely
-         * fail to do so.
-         */
-        public default GraphSONWriter.Builder graphSONWriter() {
-            return GraphSONWriter.build().mapper(graphSONMapper().create());
-        }
-
-        /**
-         * Write a GraphSON file using the default configuration of the {@link GraphSONWriter}.
-         */
-        public void writeGraphSON(final String file) throws IOException;
-
-        /**
-         * Read a GraphSON file using the default configuration of the {@link GraphSONReader}.
-         */
-        public void readGraphSON(final String file) throws IOException;
-
-        /**
-         * By default, this method creates an instance of the most current version of
-         * {@link org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper.Builder} which is can produce a
-         * {@link org.apache.tinkerpop.gremlin.structure.io.Mapper} implementation for GraphSON to
-         * serialize data to and from the graph.   Implementers with custom classes (e.g. a
-         * non-primitive class returned from {@link Element#id}) should override this method with serialization
-         * modules added.
-         * <br/>
-         * It is considered good practice to make serialization classes generally available so that users may
-         * register these classes themselves if necessary when building up a mapper {@link org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper}
-         * instance.
-         * <br/>
-         * Note that this method is meant to return a {@link org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper.Builder} with default configuration
-         * for the current {@link Graph}.  Users can adjust and override such settings by altering the builder
-         * settings.
-         */
-        public default GraphSONMapper.Builder graphSONMapper() {
-            return GraphSONMapper.build();
-        }
-    }
-
-    /**
      * Graph variables are a set of key/value pairs associated with the graph.The keys are String and the values
      * are Objects.
      */

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b28252a1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/DefaultIo.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/DefaultIo.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/DefaultIo.java
deleted file mode 100644
index 7ef6434..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/DefaultIo.java
+++ /dev/null
@@ -1,82 +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.structure.io;
-
-import org.apache.tinkerpop.gremlin.structure.Graph;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * Default implementation of the {@link Graph.Io} interface which overrides none of the default methods.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class DefaultIo implements Graph.Io {
-    private final Graph g;
-
-    public DefaultIo(final Graph g) {
-        this.g = g;
-    }
-
-    @Override
-    public void writeGryo(final String file) throws IOException {
-        try (final OutputStream out = new FileOutputStream(file)) {
-            gryoWriter().create().writeGraph(out, g);
-        }
-    }
-
-    @Override
-    public void readGryo(final String file) throws IOException {
-        try (final InputStream in = new FileInputStream(file)) {
-            gryoReader().create().readGraph(in, g);
-        }
-    }
-
-    @Override
-    public void writeGraphML(final String file) throws IOException {
-        try (final OutputStream out = new FileOutputStream(file)) {
-            graphMLWriter().create().writeGraph(out, g);
-        }
-    }
-
-    @Override
-    public void readGraphML(final String file) throws IOException {
-        try (final InputStream in = new FileInputStream(file)) {
-            graphMLReader().create().readGraph(in, g);
-        }
-    }
-
-    @Override
-    public void writeGraphSON(final String file) throws IOException {
-        try (final OutputStream out = new FileOutputStream(file)) {
-            graphSONWriter().create().writeGraph(out, g);
-        }
-    }
-
-    @Override
-    public void readGraphSON(final String file) throws IOException {
-        try (final InputStream in = new FileInputStream(file)) {
-            graphSONReader().create().readGraph(in, g);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b28252a1/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/AbstractJsonMessageSerializerV1d0.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/AbstractJsonMessageSerializerV1d0.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/AbstractJsonMessageSerializerV1d0.java
index 518f242..8c1980d 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/AbstractJsonMessageSerializerV1d0.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/AbstractJsonMessageSerializerV1d0.java
@@ -30,6 +30,7 @@ import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
 import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONIo;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
 import groovy.json.JsonBuilder;
 import io.netty.buffer.ByteBuf;
@@ -84,7 +85,7 @@ public abstract class AbstractJsonMessageSerializerV1d0 implements MessageSerial
 
             // a graph was found so use the mapper it constructs.  this allows graphson to be auto-configured with any
             // custom classes that the implementation allows for
-            initialBuilder = g.io().graphSONMapper();
+            initialBuilder = g.io(GraphSONIo.build()).mapper();
         } else {
             // no graph was supplied so just use the default - this will likely be the case when using a graph
             // with no custom classes or a situation where the user needs complete control like when using two

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b28252a1/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
index 40e23bd..479a740 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
@@ -26,6 +26,7 @@ import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
 import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoIo;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper;
 import org.apache.tinkerpop.shaded.kryo.Kryo;
 import org.apache.tinkerpop.shaded.kryo.Serializer;
@@ -109,7 +110,7 @@ public class GryoMessageSerializerV1d0 implements MessageSerializer {
 
             // a graph was found so use the mapper it constructs.  this allows gryo to be auto-configured with any
             // custom classes that the implementation allows for
-            initialBuilder = g.io().gryoMapper();
+            initialBuilder = g.io(GryoIo.build()).mapper();
         } else {
             // no graph was supplied so just use the default - this will likely be the case when using a graph
             // with no custom classes or a situation where the user needs complete control like when using two

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b28252a1/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
index e439d29..1b7a016 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin;
 
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoIo;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
 import org.apache.commons.configuration.BaseConfiguration;
 import org.apache.commons.configuration.Configuration;
@@ -123,7 +124,7 @@ public abstract class AbstractGraphProvider implements GraphProvider {
         if (!workingDirectory.exists()) workingDirectory.mkdirs();
         final GraphReader reader = GryoReader.build()
                 .workingDirectory(workingDirectory.getAbsolutePath())
-                .mapper(g.io().gryoMapper().create())
+                .mapper(g.io(GryoIo.build()).mapper().create())
                 .create();
         try (final InputStream stream = AbstractGremlinTest.class.getResourceAsStream(path)) {
             reader.readGraph(stream, g);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b28252a1/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java
index 28171be..2d1f2df 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java
@@ -27,8 +27,11 @@ import com.carrotsearch.junitbenchmarks.annotation.LabelType;
 import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLIo;
 import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONIo;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoIo;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
 import org.junit.Rule;
 import org.junit.Test;
@@ -95,7 +98,7 @@ public class GraphWritePerformanceTest {
         @LoadGraphWith(LoadGraphWith.GraphData.GRATEFUL)
         @BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 0, concurrency = BenchmarkOptions.CONCURRENCY_SEQUENTIAL)
         public void writeGryo() throws Exception {
-            final GraphWriter writer = graph.io().gryoWriter().create();
+            final GraphWriter writer = graph.io(GryoIo.build()).writer().create();
             final OutputStream os = new ByteArrayOutputStream();
             writer.writeGraph(os, graph);
         }
@@ -104,7 +107,7 @@ public class GraphWritePerformanceTest {
         @LoadGraphWith(LoadGraphWith.GraphData.GRATEFUL)
         @BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 0, concurrency = BenchmarkOptions.CONCURRENCY_SEQUENTIAL)
         public void writeGraphML() throws Exception {
-            final GraphWriter writer = graph.io().graphMLWriter().create();
+            final GraphWriter writer = graph.io(GraphMLIo.build()).writer().create();
             final OutputStream os = new ByteArrayOutputStream();
             writer.writeGraph(os, graph);
         }
@@ -113,7 +116,7 @@ public class GraphWritePerformanceTest {
         @LoadGraphWith(LoadGraphWith.GraphData.GRATEFUL)
         @BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 0, concurrency = BenchmarkOptions.CONCURRENCY_SEQUENTIAL)
         public void writeGraphSON() throws Exception {
-            final GraphWriter writer = graph.io().graphSONWriter().create();
+            final GraphWriter writer = graph.io(GraphSONIo.build()).writer().create();
             final OutputStream os = new ByteArrayOutputStream();
             writer.writeGraph(os, graph);
         }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b28252a1/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
index 61dfcda..0b9765a 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
@@ -39,13 +39,16 @@ import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexPropertyFeatu
 import org.apache.tinkerpop.gremlin.structure.io.GraphMigrator;
 import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
 import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLIo;
 import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLReader;
 import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONIo;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONTokens;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.LegacyGraphSONReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoIo;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
@@ -158,11 +161,11 @@ public class IoTest extends AbstractGremlinTest {
     public void shouldReadWriteClassicToGraphMLToFileWithHelpers() throws Exception {
         final File f = TestHelper.generateTempFile(this.getClass(), name.getMethodName(), ".xml");
         try {
-            graph.io().writeGraphML(f.getAbsolutePath());
+            graph.io(GraphMLIo.build()).write(f.getAbsolutePath());
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CLASSIC);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            g1.io().readGraphML(f.getAbsolutePath());
+            g1.io(GraphMLIo.build()).read(f.getAbsolutePath());
 
             assertClassicGraph(graph, false, true);
 
@@ -210,8 +213,8 @@ public class IoTest extends AbstractGremlinTest {
     @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
     public void shouldWriteNormalizedGraphSON() throws Exception {
         try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
-            final GraphSONMapper mapper = graph.io().graphSONMapper().normalize(true).create();
-            final GraphSONWriter w = graph.io().graphSONWriter().mapper(mapper).create();
+            final GraphSONMapper mapper = graph.io(GraphSONIo.build()).mapper().normalize(true).create();
+            final GraphSONWriter w = graph.io(GraphSONIo.build()).writer().mapper(mapper).create();
             w.writeGraph(bos, graph);
 
             final String expected = streamToString(IoTest.class.getResourceAsStream(GRAPHSON_RESOURCE_PATH_PREFIX + "tinkerpop-classic-normalized.json"));
@@ -274,8 +277,8 @@ public class IoTest extends AbstractGremlinTest {
 
         final SimpleModule module = new SimpleModule();
         module.addSerializer(CustomId.class, new CustomId.CustomIdJacksonSerializer());
-        final GraphWriter writer = graph.io().graphSONWriter().mapper(
-                graph.io().graphSONMapper().addCustomModule(module).embedTypes(true).create()).create();
+        final GraphWriter writer = graph.io(GraphSONIo.build()).writer().mapper(
+                graph.io(GraphSONIo.build()).mapper().addCustomModule(module).embedTypes(true).create()).create();
 
         try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
             writer.writeGraph(baos, graph);
@@ -294,8 +297,8 @@ public class IoTest extends AbstractGremlinTest {
             final Graph g2 = graphProvider.openTestGraph(configuration);
 
             try (final InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
-                final GraphReader reader = graph.io().graphSONReader()
-                        .mapper(graph.io().graphSONMapper().embedTypes(true).addCustomModule(module).create()).create();
+                final GraphReader reader = graph.io(GraphSONIo.build()).reader()
+                        .mapper(graph.io(GraphSONIo.build()).mapper().embedTypes(true).addCustomModule(module).create()).create();
                 reader.readGraph(is, g2);
             }
 
@@ -344,8 +347,8 @@ public class IoTest extends AbstractGremlinTest {
         graphProvider.clear(configuration);
         final Graph g1 = graphProvider.openTestGraph(configuration);
 
-        final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
-        final GryoWriter writer = graph.io().gryoWriter().create();
+        final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+        final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
 
         GraphMigrator.migrateGraph(graph, g1, reader, writer);
 
@@ -364,8 +367,8 @@ public class IoTest extends AbstractGremlinTest {
         graphProvider.clear(configuration);
         final Graph g1 = graphProvider.openTestGraph(configuration);
 
-        final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
-        final GryoWriter writer = graph.io().gryoWriter().create();
+        final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
+        final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
 
         GraphMigrator.migrateGraph(graph, g1, reader, writer);
 
@@ -384,13 +387,13 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldReadWriteModernToGryo() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeGraph(os, graph);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.MODERN);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
             }
@@ -412,11 +415,11 @@ public class IoTest extends AbstractGremlinTest {
     public void shouldReadWriteModernToGryoToFileWithHelpers() throws Exception {
         final File f = TestHelper.generateTempFile(this.getClass(), name.getMethodName(), ".kryo");
         try {
-            graph.io().writeGryo(f.getAbsolutePath());
+            graph.io(GryoIo.build()).write(f.getAbsolutePath());
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.MODERN);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            g1.io().readGryo(f.getAbsolutePath());
+            g1.io(GryoIo.build()).read(f.getAbsolutePath());
 
             // by making this lossy for float it will assert floats for doubles
             assertModernGraph(g1, true, false);
@@ -438,14 +441,14 @@ public class IoTest extends AbstractGremlinTest {
     public void shouldReadWriteCrewToGryo() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
 
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeGraph(os, graph);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CREW);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
             final GryoReader reader = GryoReader.build()
-                    .mapper(graph.io().gryoMapper().create())
+                    .mapper(graph.io(GryoIo.build()).mapper().create())
                     .workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
@@ -468,13 +471,13 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldReadWriteClassicToGryo() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeGraph(os, graph);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CLASSIC);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
             }
@@ -492,13 +495,13 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldReadWriteClassicToGraphSON() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             writer.writeGraph(os, graph);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CLASSIC);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
             }
@@ -516,13 +519,13 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldReadWriteModernToGraphSON() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             writer.writeGraph(os, graph);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.MODERN);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
             }
@@ -541,12 +544,12 @@ public class IoTest extends AbstractGremlinTest {
     public void shouldReadWriteModernToGraphSONWithHelpers() throws Exception {
         final File f = TestHelper.generateTempFile(this.getClass(), name.getMethodName(), ".json");
         try {
-            graph.io().writeGraphSON(f.getAbsolutePath());
+            graph.io(GraphSONIo.build()).write(f.getAbsolutePath());
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.MODERN);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            g1.io().readGraphSON(f.getAbsolutePath());
+            g1.io(GraphSONIo.build()).read(f.getAbsolutePath());
 
             assertModernGraph(g1, true, false);
 
@@ -566,13 +569,13 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldReadWriteCrewToGraphSON() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             writer.writeGraph(os, graph);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CREW);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
             }
@@ -594,11 +597,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friend", v2, "weight", 0.5f, "acl", "rw");
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -630,11 +633,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friend", v2, "weight", 0.5d, "acl", "rw");
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -664,11 +667,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = DetachedFactory.detach(v1.addEdge("friend", v2, "weight", 0.5d, "acl", "rw"), false);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -698,11 +701,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = DetachedFactory.detach(v1.addEdge("friend", v2, "weight", 0.5d, "acl", "rw"), true);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -733,11 +736,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friend", v2, "weight", 0.5f, "acl", "rw");
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), graph.edges(detachedEdge.id().toString()).next().id());
@@ -768,11 +771,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = DetachedFactory.detach(v1.addEdge("friend", v2, "weight", 0.5f, "acl", "rw"), false);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), graph.edges(detachedEdge.id().toString()).next().id());
@@ -802,11 +805,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = DetachedFactory.detach(v1.addEdge("friend", v2, "weight", 0.5f, "acl", "rw"), true);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), graph.edges(detachedEdge.id().toString()).next().id());
@@ -838,11 +841,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friend", v2, "weight", 0.5f, "acl", "rw");
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().mapper(graph.io().graphSONMapper().embedTypes(true).create()).create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().mapper(graph.io(GraphSONIo.build()).mapper().embedTypes(true).create()).create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io().graphSONReader().mapper(graph.io().graphSONMapper().embedTypes(true).create()).create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().mapper(graph.io(GraphSONIo.build()).mapper().embedTypes(true).create()).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -874,11 +877,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friend", v2, "uuid", id);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().mapper(graph.io().graphSONMapper().embedTypes(true).create()).create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().mapper(graph.io(GraphSONIo.build()).mapper().embedTypes(true).create()).create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io().graphSONReader().mapper(graph.io().graphSONMapper().embedTypes(true).create()).create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().mapper(graph.io(GraphSONIo.build()).mapper().embedTypes(true).create()).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     // a quick reminder here that the purpose of these id assertions is to ensure that those with
@@ -914,11 +917,11 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friend", v2, "uuid", id);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -952,11 +955,11 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeVertex(os, v1);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -983,11 +986,11 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeVertex(os, v1);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -1014,12 +1017,12 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             final DetachedVertex dv = DetachedFactory.detach(v1, true);
             writer.writeVertex(os, dv);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -1046,12 +1049,12 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             final DetachedVertex dv = DetachedFactory.detach(v1, false);
             writer.writeVertex(os, dv);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -1079,11 +1082,11 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeVertex(os, v1);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -1114,11 +1117,11 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             writer.writeVertex(os, v1);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1147,12 +1150,12 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             final DetachedVertex dv = DetachedFactory.detach(v1, true);
             writer.writeVertex(os, dv);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1181,12 +1184,12 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             final DetachedVertex dv = DetachedFactory.detach(v1, false);
             writer.writeVertex(os, dv);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1216,11 +1219,11 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             writer.writeVertex(os, v1);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1243,11 +1246,11 @@ public class IoTest extends AbstractGremlinTest {
     @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
     public void shouldReadWriteVerticesNoEdgesToGryoManual() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeVertices(os, g.V().has("age", Compare.gt, 30));
 
             final AtomicInteger called = new AtomicInteger(0);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
 
             try (final VertexByteArrayInputStream vbais = new VertexByteArrayInputStream(new ByteArrayInputStream(os.toByteArray()))) {
                 reader.readVertex(new ByteArrayInputStream(vbais.readVertexBytes().toByteArray()),
@@ -1271,11 +1274,11 @@ public class IoTest extends AbstractGremlinTest {
     @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldReadWriteVerticesNoEdgesToGryo() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeVertices(os, g.V().has("age", Compare.gt, 30));
 
             final AtomicInteger called = new AtomicInteger(0);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
 
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 final Iterator<Vertex> itty = reader.readVertices(bais, null,
@@ -1297,11 +1300,11 @@ public class IoTest extends AbstractGremlinTest {
     @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
     public void shouldReadWriteVerticesNoEdgesToGraphSONManual() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             writer.writeVertices(os, g.V().has("age", Compare.gt, 30));
 
             final AtomicInteger called = new AtomicInteger(0);
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             final BufferedReader br = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(os.toByteArray())));
             String line = br.readLine();
             reader.readVertex(new ByteArrayInputStream(line.getBytes()),
@@ -1334,12 +1337,12 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeVertex(os, v1, Direction.OUT);
 
             final AtomicBoolean calledVertex = new AtomicBoolean(false);
             final AtomicBoolean calledEdge = new AtomicBoolean(false);
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
 
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.OUT, detachedVertex -> {
@@ -1383,12 +1386,12 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v1.addEdge("friends", v2, "weight", 0.5f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             writer.writeVertex(os, v1, Direction.OUT);
 
             final AtomicBoolean calledVertex = new AtomicBoolean(false);
             final AtomicBoolean calledEdge = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.OUT, detachedVertex -> {
                             assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1430,13 +1433,13 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v2.addEdge("friends", v1, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeVertex(os, v1, Direction.IN);
 
             final AtomicBoolean calledVertex = new AtomicBoolean(false);
             final AtomicBoolean calledEdge = new AtomicBoolean(false);
 
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.IN, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -1479,13 +1482,13 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e = v2.addEdge("friends", v1, "weight", 0.5f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             writer.writeVertex(os, v1, Direction.IN);
             os.close();
 
             final AtomicBoolean calledVertex = new AtomicBoolean(false);
             final AtomicBoolean calledEdge = new AtomicBoolean(false);
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.IN, detachedVertex -> {
                             assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1528,14 +1531,14 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e2 = v1.addEdge("friends", v2, "weight", 1.0d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean calledVertex = new AtomicBoolean(false);
             final AtomicBoolean calledEdge1 = new AtomicBoolean(false);
             final AtomicBoolean calledEdge2 = new AtomicBoolean(false);
 
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.BOTH, detachedVertex -> {
                             assertEquals(v1.id(), detachedVertex.id());
@@ -1592,14 +1595,14 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e2 = v1.addEdge("friends", v2, "weight", 1.0f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean vertexCalled = new AtomicBoolean(false);
             final AtomicBoolean edge1Called = new AtomicBoolean(false);
             final AtomicBoolean edge2Called = new AtomicBoolean(false);
 
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.BOTH, detachedVertex -> {
                             assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1657,14 +1660,14 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e2 = v1.addEdge("friends", v2, "weight", 1.0f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().mapper(graph.io().graphSONMapper().embedTypes(true).create()).create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().mapper(graph.io(GraphSONIo.build()).mapper().embedTypes(true).create()).create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean vertexCalled = new AtomicBoolean(false);
             final AtomicBoolean edge1Called = new AtomicBoolean(false);
             final AtomicBoolean edge2Called = new AtomicBoolean(false);
 
-            final GraphSONReader reader = graph.io().graphSONReader().mapper(graph.io().graphSONMapper().embedTypes(true).create()).create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().mapper(graph.io(GraphSONIo.build()).mapper().embedTypes(true).create()).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.BOTH, detachedVertex -> {
                     // a quick reminder here that the purpose of these id assertions is to ensure that those with
@@ -1725,13 +1728,13 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 1.0d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean vertexCalled = new AtomicBoolean(false);
             final AtomicBoolean edge1Called = new AtomicBoolean(false);
 
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.IN, detachedVertex -> {
                             assertEquals(v1.id(), detachedVertex.id());
@@ -1778,13 +1781,13 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 1.0f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean vertexCalled = new AtomicBoolean(false);
             final AtomicBoolean edgeCalled = new AtomicBoolean(false);
 
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.IN, detachedVertex -> {
                     assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1831,13 +1834,13 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e2 = v1.addEdge("friends", v2, "weight", 1.0d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean vertexCalled = new AtomicBoolean(false);
             final AtomicBoolean edgeCalled = new AtomicBoolean(false);
 
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.OUT, detachedVertex -> {
                             assertEquals(v1.id(), detachedVertex.id());
@@ -1885,13 +1888,13 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e2 = v1.addEdge("friends", v2, "weight", 1.0f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GraphSONWriter writer = graph.io().graphSONWriter().create();
+            final GraphSONWriter writer = graph.io(GraphSONIo.build()).writer().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean vertexCalled = new AtomicBoolean(false);
             final AtomicBoolean edgeCalled = new AtomicBoolean(false);
 
-            final GraphSONReader reader = graph.io().graphSONReader().create();
+            final GraphSONReader reader = graph.io(GraphSONIo.build()).reader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.OUT, detachedVertex -> {
                     assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
@@ -1935,10 +1938,10 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeVertex(os, v1, Direction.OUT);
 
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais,
                         Direction.BOTH,
@@ -1959,10 +1962,10 @@ public class IoTest extends AbstractGremlinTest {
         v2.addEdge("friends", v1, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeVertex(os, v1, Direction.IN);
 
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais,
                         Direction.BOTH,
@@ -1983,10 +1986,10 @@ public class IoTest extends AbstractGremlinTest {
         v2.addEdge("friends", v1, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeVertex(os, v1, Direction.IN);
 
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais,
                         Direction.OUT,
@@ -2007,10 +2010,10 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final GryoWriter writer = graph.io().gryoWriter().create();
+            final GryoWriter writer = graph.io(GryoIo.build()).writer().create();
             writer.writeVertex(os, v1, Direction.IN);
 
-            final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
+            final GryoReader reader = graph.io(GryoIo.build()).reader().workingDirectory(tempPath).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais,
                         Direction.OUT,

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b28252a1/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
index 6ad96d1..5b6b475 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
@@ -24,7 +24,9 @@ import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMetrics;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONIo;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONTokens;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoIo;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
 import org.junit.Test;
@@ -53,8 +55,9 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializeVertexAsDetached() throws Exception {
-            final GryoWriter gryoWriter = graph.io().gryoWriter().create();
-            final GryoReader gryoReader = graph.io().gryoReader().create();
+            final GryoIo gryoIo = graph.io(GryoIo.build());
+            final GryoWriter gryoWriter = gryoIo.writer().create();
+            final GryoReader gryoReader = gryoIo.reader().create();
 
             final Vertex v = graph.vertices(convertToVertexId("marko")).next();
             final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -72,8 +75,9 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializeEdgeAsDetached() throws Exception {
-            final GryoWriter gryoWriter = graph.io().gryoWriter().create();
-            final GryoReader gryoReader = graph.io().gryoReader().create();
+            final GryoIo gryoIo = graph.io(GryoIo.build());
+            final GryoWriter gryoWriter = gryoIo.writer().create();
+            final GryoReader gryoReader = gryoIo.reader().create();
 
             final Edge e = g.E(convertToEdgeId("marko", "knows", "vadas")).next();
             final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -90,8 +94,9 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializePropertyAsDetached() throws Exception {
-            final GryoWriter gryoWriter = graph.io().gryoWriter().create();
-            final GryoReader gryoReader = graph.io().gryoReader().create();
+            final GryoIo gryoIo = graph.io(GryoIo.build());
+            final GryoWriter gryoWriter = gryoIo.writer().create();
+            final GryoReader gryoReader = gryoIo.reader().create();
 
             final Property property = g.E(convertToEdgeId("marko", "knows", "vadas")).next().property("weight");
             final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -107,8 +112,9 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializeVertexPropertyAsDetached() throws Exception {
-            final GryoWriter gryoWriter = graph.io().gryoWriter().create();
-            final GryoReader gryoReader = graph.io().gryoReader().create();
+            final GryoIo gryoIo = graph.io(GryoIo.build());
+            final GryoWriter gryoWriter = gryoIo.writer().create();
+            final GryoReader gryoReader = gryoIo.reader().create();
 
             final VertexProperty vertexProperty = graph.vertices(convertToVertexId("marko")).next().property("name");
             final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -125,8 +131,9 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.CREW)
         public void shouldSerializeVertexPropertyWithPropertiesAsDetached() throws Exception {
-            final GryoWriter gryoWriter = graph.io().gryoWriter().create();
-            final GryoReader gryoReader = graph.io().gryoReader().create();
+            final GryoIo gryoIo = graph.io(GryoIo.build());
+            final GryoWriter gryoWriter = gryoIo.writer().create();
+            final GryoReader gryoReader = gryoIo.reader().create();
 
             final VertexProperty<?> vertexProperty = graph.vertices(convertToVertexId("marko")).next().properties("location").next();
             final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -148,8 +155,9 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializePathAsDetached() throws Exception {
-            final GryoWriter gryoWriter = graph.io().gryoWriter().create();
-            final GryoReader gryoReader = graph.io().gryoReader().create();
+            final GryoIo gryoIo = graph.io(GryoIo.build());
+            final GryoWriter gryoWriter = gryoIo.writer().create();
+            final GryoReader gryoReader = gryoIo.reader().create();
 
             final Path p = g.V(convertToVertexId("marko")).as("a").outE().as("b").inV().as("c").path()
                     .filter(t -> ((Vertex) t.get().objects().get(2)).value("name").equals("lop")).next();
@@ -193,8 +201,9 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializeTraversalMetrics() throws Exception {
-            final GryoWriter gryoWriter = graph.io().gryoWriter().create();
-            final GryoReader gryoReader = graph.io().gryoReader().create();
+            final GryoIo gryoIo = graph.io(GryoIo.build());
+            final GryoWriter gryoWriter = gryoIo.writer().create();
+            final GryoReader gryoReader = gryoIo.reader().create();
 
             final TraversalMetrics before = (TraversalMetrics) g.V().both().profile().cap(TraversalMetrics.METRICS_KEY).next();
             final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -216,7 +225,7 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializeVertex() throws Exception {
-            final ObjectMapper mapper = graph.io().graphSONMapper().create().createMapper();
+            final ObjectMapper mapper = graph.io(GraphSONIo.build()).mapper().create().createMapper();
             final Vertex v = graph.vertices(convertToVertexId("marko")).next();
             final String json = mapper.writeValueAsString(v);
             final Map<String, Object> m = mapper.readValue(json, mapTypeReference);
@@ -231,7 +240,7 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializeEdge() throws Exception {
-            final ObjectMapper mapper = graph.io().graphSONMapper().create().createMapper();
+            final ObjectMapper mapper = graph.io(GraphSONIo.build()).mapper().create().createMapper();
             final Edge e = g.E(convertToEdgeId("marko", "knows", "vadas")).next();
             final String json = mapper.writeValueAsString(e);
             final Map<String, Object> m = mapper.readValue(json, mapTypeReference);
@@ -245,7 +254,7 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializeProperty() throws Exception {
-            final ObjectMapper mapper = graph.io().graphSONMapper().create().createMapper();
+            final ObjectMapper mapper = graph.io(GraphSONIo.build()).mapper().create().createMapper();
             final Property p = g.E(convertToEdgeId("marko", "knows", "vadas")).next().property("weight");
             final String json = mapper.writeValueAsString(p);
             final Map<String, Object> m = mapper.readValue(json, mapTypeReference);
@@ -256,7 +265,7 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializeVertexProperty() throws Exception {
-            final ObjectMapper mapper = graph.io().graphSONMapper().create().createMapper();
+            final ObjectMapper mapper = graph.io(GraphSONIo.build()).mapper().create().createMapper();
             final VertexProperty vp = graph.vertices(convertToVertexId("marko")).next().property("name");
             final String json = mapper.writeValueAsString(vp);
             final Map<String, Object> m = mapper.readValue(json, mapTypeReference);
@@ -269,7 +278,7 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.CREW)
         public void shouldSerializeVertexPropertyWithProperties() throws Exception {
-            final ObjectMapper mapper = graph.io().graphSONMapper().create().createMapper();
+            final ObjectMapper mapper = graph.io(GraphSONIo.build()).mapper().create().createMapper();
             final VertexProperty vp = graph.vertices(convertToVertexId("marko")).next().properties("location").next();
             final String json = mapper.writeValueAsString(vp);
             final Map<String, Object> m = mapper.readValue(json, mapTypeReference);
@@ -284,7 +293,7 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializePath() throws Exception {
-            final ObjectMapper mapper = graph.io().graphSONMapper().create().createMapper();
+            final ObjectMapper mapper = graph.io(GraphSONIo.build()).mapper().create().createMapper();
             final Path p = g.V(convertToVertexId("marko")).as("a").outE().as("b").inV().as("c").path()
                     .filter(t -> ((Vertex) t.get().objects().get(2)).value("name").equals("lop")).next();
             final String json = mapper.writeValueAsString(p);
@@ -311,7 +320,7 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializeTraversalMetrics() throws Exception {
-            final ObjectMapper mapper = graph.io().graphSONMapper().create().createMapper();
+            final ObjectMapper mapper = graph.io(GraphSONIo.build()).mapper().create().createMapper();
             final TraversalMetrics tm = (TraversalMetrics) g.V().both().profile().cap(TraversalMetrics.METRICS_KEY).next();
             final String json = mapper.writeValueAsString(tm);
             final Map<String, Object> m = mapper.readValue(json, mapTypeReference);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b28252a1/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
index 291dddd..1cbc830 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
@@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.tinkergraph.structure;
 import org.apache.commons.io.FileUtils;
 import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
 import org.apache.tinkerpop.gremlin.TestHelper;
+import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLIo;
 import org.apache.tinkerpop.gremlin.structure.util.star.StarGraph;
 import org.apache.tinkerpop.gremlin.process.traversal.T;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
@@ -117,7 +118,7 @@ public class TinkerGraphTest {
     public void benchmarkStandardTraversals() throws Exception {
         Graph graph = TinkerGraph.open();
         GraphTraversalSource g = graph.traversal();
-        graph.io().readGraphML("data/grateful-dead.xml");
+        graph.io(GraphMLIo.build()).read("data/grateful-dead.xml");
         final List<Supplier<Traversal>> traversals = Arrays.asList(
                 () -> g.V().outE().inV().outE().inV().outE().inV(),
                 () -> g.V().out().out().out(),
@@ -153,7 +154,7 @@ public class TinkerGraphTest {
     @Ignore
     public void testPlay4() throws Exception {
         Graph graph = TinkerGraph.open();
-        graph.io().readGraphML("/Users/marko/software/tinkerpop/tinkerpop3/data/grateful-dead.xml");
+        graph.io(GraphMLIo.build()).read("/Users/marko/software/tinkerpop/tinkerpop3/data/grateful-dead.xml");
         GraphTraversalSource g = graph.traversal();
         final List<Supplier<Traversal>> traversals = Arrays.asList(
                 () -> g.V().has(T.label, "song").out().groupCount().<Vertex>by(t ->