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/05/18 18:13:12 UTC

[2/2] incubator-tinkerpop git commit: Renamed JSON related serializer classes for consistency with GraphSON.

Renamed JSON related serializer classes for consistency with GraphSON.


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

Branch: refs/heads/master
Commit: 3918972c5d838948011653e63b3e8bcb8d96af0a
Parents: 847a5d3
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon May 18 12:12:48 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon May 18 12:12:48 2015 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   1 +
 docs/src/gremlin-applications.asciidoc          |   6 +-
 .../gremlin/driver/MessageSerializer.java       |   3 +-
 .../tinkerpop/gremlin/driver/Settings.java      |   4 +-
 .../AbstractGraphSONMessageSerializerV1d0.java  | 242 +++++++++++++++++++
 .../ser/AbstractJsonMessageSerializerV1d0.java  | 242 -------------------
 .../GraphSONMessageSerializerGremlinV1D0.java   |  66 +++++
 .../ser/GraphSONMessageSerializerV1D0.java      | 122 ++++++++++
 .../ser/JsonMessageSerializerGremlinV1d0.java   |  66 -----
 .../driver/ser/JsonMessageSerializerV1d0.java   | 123 ----------
 .../tinkerpop/gremlin/driver/ser/SerTokens.java |   2 +-
 .../gremlin/driver/ser/Serializers.java         |  12 +-
 .../JsonMessageSerializerGremlinV1d0Test.java   |   3 +-
 .../ser/JsonMessageSerializerV1d0Test.java      |   2 +-
 14 files changed, 447 insertions(+), 447 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3918972c/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index caf2db0..ae54bff 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ TinkerPop 3.0.0.M9 (NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 * Moved the string methods of `TraversalHelper` to `StringFactory`.
+* Renamed JSON-related serializers for Gremlin Server to be more consistent with GraphSON naming.
 * Removed `HasTraversalStep` in favor of new `P.traversal` model with `HasStep`.
 * Fixed bug in `WsGremlinTextRequestDecoder` where custom serializers from graphs were not being used.
 * Added `AndP` which allows for the `and()`-ing of `P` predicates.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3918972c/docs/src/gremlin-applications.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/gremlin-applications.asciidoc b/docs/src/gremlin-applications.asciidoc
index 709c30d..6c4501a 100644
--- a/docs/src/gremlin-applications.asciidoc
+++ b/docs/src/gremlin-applications.asciidoc
@@ -525,7 +525,7 @@ GraphSON
 The GraphSON serializer produces human readable output in JSON format and is a good configuration choice for those trying to use TinkerPop from non-JVM languages.  JSON obviously has wide support across virtually all major programming languages and can be consumed by a wide variety of tools.
 
 [source,yaml]
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.JsonMessageSerializerV1d0 }
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0 }
 
 The above configuration represents the default serialization under the `application/json` MIME type and produces JSON consistent with standard JSON data types.  It has the following configuration option:
 
@@ -536,7 +536,7 @@ The above configuration represents the default serialization under the `applicat
 |=========================================================
 
 [source,yaml]
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.JsonMessageSerializerGremlinV1d0 }
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0 }
 
 When the standard JSON data types are not enough (e.g. need to identify the difference between `double` and `float` data types), the above configuration will embed types into the JSON itself.  The type embedding uses standard Java type names, so interpretation from non-JVM languages will be required.  It has the MIME type of `application/vnd.gremlin-v1.0+json` and the following configuration options:
 
@@ -552,7 +552,7 @@ Gryo
 The Gryo serializer utilizes Kryo-based serialization which produces a binary output.  This format is best consumed by JVM-based languages.
 
 [source,yaml]
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.JsonMessageSerializerGremlinV1d0 }
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerGremlinV1d0 }
 
 It has the MIME type of `application/vnd.gremlin-v1.0+gryo` and the following configuration options:
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3918972c/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/MessageSerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/MessageSerializer.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/MessageSerializer.java
index 922781c..cf4e12c 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/MessageSerializer.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/MessageSerializer.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.driver;
 
 import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
+import org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1D0;
 import org.apache.tinkerpop.gremlin.driver.ser.SerializationException;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import io.netty.buffer.ByteBuf;
@@ -36,7 +37,7 @@ import java.util.ServiceLoader;
  * {@link MessageSerializer} instances are instantiated to a cache via {@link ServiceLoader} and indexed based on
  * the mime types they support.  If a mime type is supported more than once, the last {@link MessageSerializer}
  * instance loaded for that mime type is assigned. If a mime type is not found the default
- * {@link org.apache.tinkerpop.gremlin.driver.ser.JsonMessageSerializerV1d0} is used to return the results.
+ * {@link GraphSONMessageSerializerV1D0} is used to return the results.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3918972c/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
index a8c51cf..6ca887f 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
@@ -18,7 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.driver;
 
-import org.apache.tinkerpop.gremlin.driver.ser.JsonMessageSerializerV1d0;
+import org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1D0;
 import org.yaml.snakeyaml.TypeDescription;
 import org.yaml.snakeyaml.Yaml;
 import org.yaml.snakeyaml.constructor.Constructor;
@@ -86,7 +86,7 @@ class Settings {
     }
 
     public static class SerializerSettings {
-        public String className = JsonMessageSerializerV1d0.class.getCanonicalName();
+        public String className = GraphSONMessageSerializerV1D0.class.getCanonicalName();
         public Map<String, Object> config = null;
 
         public MessageSerializer create() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3918972c/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/AbstractGraphSONMessageSerializerV1d0.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/AbstractGraphSONMessageSerializerV1d0.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/AbstractGraphSONMessageSerializerV1d0.java
new file mode 100644
index 0000000..4382da7
--- /dev/null
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/AbstractGraphSONMessageSerializerV1d0.java
@@ -0,0 +1,242 @@
+/*
+ * 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.driver.ser;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
+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;
+import io.netty.buffer.ByteBufAllocator;
+import io.netty.util.ReferenceCountUtil;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONTokens;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public abstract class AbstractGraphSONMessageSerializerV1d0 implements MessageSerializer {
+    private static final Logger logger = LoggerFactory.getLogger(AbstractGraphSONMessageSerializerV1d0.class);
+
+    protected ObjectMapper mapper;
+
+    protected static final String TOKEN_USE_MAPPER_FROM_GRAPH = "useMapperFromGraph";
+
+    protected final TypeReference<Map<String, Object>> mapTypeReference = new TypeReference<Map<String, Object>>() {
+    };
+
+    public AbstractGraphSONMessageSerializerV1d0() {
+        final GraphSONMapper.Builder builder = configureBuilder(GraphSONMapper.build());
+        mapper = builder.create().createMapper();
+    }
+
+    public AbstractGraphSONMessageSerializerV1d0(final GraphSONMapper mapper) {
+        this.mapper = mapper.createMapper();
+    }
+
+    abstract byte[] obtainHeader();
+
+    abstract GraphSONMapper.Builder configureBuilder(final GraphSONMapper.Builder builder);
+
+    @Override
+    public void configure(final Map<String, Object> config, final Map<String, Graph> graphs) {
+        final GraphSONMapper.Builder initialBuilder;
+        final Object graphToUseForMapper = config.get(TOKEN_USE_MAPPER_FROM_GRAPH);
+        if (graphToUseForMapper != null) {
+            if (null == graphs) throw new IllegalStateException(String.format(
+                    "No graphs have been provided to the serializer and therefore %s is not a valid configuration", TOKEN_USE_MAPPER_FROM_GRAPH));
+
+            final Graph g = graphs.get(graphToUseForMapper.toString());
+            if (null == g) throw new IllegalStateException(String.format(
+                    "There is no graph named [%s] configured to be used in the %s setting",
+                    graphToUseForMapper, TOKEN_USE_MAPPER_FROM_GRAPH));
+
+            // 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(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
+            // distinct implementations each with their own custom classes.
+            initialBuilder = GraphSONMapper.build();
+        }
+
+        mapper = configureBuilder(initialBuilder).create().createMapper();
+    }
+
+    @Override
+    public ByteBuf serializeResponseAsBinary(final ResponseMessage responseMessage, final ByteBufAllocator allocator) throws SerializationException {
+        ByteBuf encodedMessage = null;
+        try {
+            final byte[] payload = mapper.writeValueAsBytes(responseMessage);
+            encodedMessage = allocator.buffer(payload.length);
+            encodedMessage.writeBytes(payload);
+
+            return encodedMessage;
+        } catch (Exception ex) {
+            if (encodedMessage != null) ReferenceCountUtil.release(encodedMessage);
+
+            logger.warn("Response [{}] could not be serialized by {}.", responseMessage.toString(), AbstractGraphSONMessageSerializerV1d0.class.getName());
+            throw new SerializationException(ex);
+        }
+    }
+
+    @Override
+    public ByteBuf serializeRequestAsBinary(final RequestMessage requestMessage, final ByteBufAllocator allocator) throws SerializationException {
+        ByteBuf encodedMessage = null;
+        try {
+            final byte[] header = obtainHeader();
+            final byte[] payload = mapper.writeValueAsBytes(requestMessage);
+
+            encodedMessage = allocator.buffer(header.length + payload.length);
+            encodedMessage.writeBytes(header);
+            encodedMessage.writeBytes(payload);
+
+            return encodedMessage;
+        } catch (Exception ex) {
+            if (encodedMessage != null) ReferenceCountUtil.release(encodedMessage);
+
+            logger.warn("Request [{}] could not be serialized by {}.", requestMessage.toString(), AbstractGraphSONMessageSerializerV1d0.class.getName());
+            throw new SerializationException(ex);
+        }
+    }
+
+    @Override
+    public RequestMessage deserializeRequest(final ByteBuf msg) throws SerializationException {
+        try {
+            final byte[] payload = new byte[msg.readableBytes()];
+            msg.readBytes(payload);
+            return mapper.readValue(payload, RequestMessage.class);
+        } catch (Exception ex) {
+            logger.warn("Request [{}] could not be deserialized by {}.", msg, AbstractGraphSONMessageSerializerV1d0.class.getName());
+            throw new SerializationException(ex);
+        }
+    }
+
+    @Override
+    public ResponseMessage deserializeResponse(final ByteBuf msg) throws SerializationException {
+        try {
+            final byte[] payload = new byte[msg.readableBytes()];
+            msg.readBytes(payload);
+            final Map<String, Object> responseData = mapper.readValue(payload, mapTypeReference);
+            final Map<String, Object> status = (Map<String, Object>) responseData.get(SerTokens.TOKEN_STATUS);
+            final Map<String, Object> result = (Map<String, Object>) responseData.get(SerTokens.TOKEN_RESULT);
+            return ResponseMessage.build(UUID.fromString(responseData.get(SerTokens.TOKEN_REQUEST).toString()))
+                    .code(ResponseStatusCode.getFromValue((Integer) status.get(SerTokens.TOKEN_CODE)))
+                    .statusMessage(status.get(SerTokens.TOKEN_MESSAGE).toString())
+                    .statusAttributes((Map<String, Object>) status.get(SerTokens.TOKEN_ATTRIBUTES))
+                    .result(result.get(SerTokens.TOKEN_DATA))
+                    .responseMetaData((Map<String, Object>) result.get(SerTokens.TOKEN_META))
+                    .create();
+        } catch (Exception ex) {
+            logger.warn("Response [{}] could not be deserialized by {}.", msg, AbstractGraphSONMessageSerializerV1d0.class.getName());
+            throw new SerializationException(ex);
+        }
+    }
+
+    public static class GremlinServerModule extends SimpleModule {
+        public GremlinServerModule() {
+            super("graphson-gremlin-server");
+            addSerializer(JsonBuilder.class, new JsonBuilderJacksonSerializer());
+            addSerializer(ResponseMessage.class, new ResponseMessageSerializer());
+        }
+    }
+
+    public static class JsonBuilderJacksonSerializer extends StdSerializer<JsonBuilder> {
+        public JsonBuilderJacksonSerializer() {
+            super(JsonBuilder.class);
+        }
+
+        @Override
+        public void serialize(final JsonBuilder json, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
+                throws IOException, JsonGenerationException {
+            // the JSON from the builder will already be started/ended as array or object...just need to surround it
+            // with appropriate chars to fit into the serialization pattern.
+            jsonGenerator.writeRaw(":");
+            jsonGenerator.writeRaw(json.toString());
+            jsonGenerator.writeRaw(",");
+        }
+    }
+
+    public static class ResponseMessageSerializer extends StdSerializer<ResponseMessage> {
+        public ResponseMessageSerializer() {
+            super(ResponseMessage.class);
+        }
+
+        @Override
+        public void serialize(final ResponseMessage responseMessage, final JsonGenerator jsonGenerator,
+                              final SerializerProvider serializerProvider) throws IOException, JsonGenerationException {
+            ser(responseMessage, jsonGenerator, serializerProvider, null);
+        }
+
+        @Override
+        public void serializeWithType(final ResponseMessage responseMessage, final JsonGenerator jsonGenerator,
+                                      final SerializerProvider serializerProvider,
+                                      final TypeSerializer typeSerializer) throws IOException, JsonProcessingException {
+            ser(responseMessage, jsonGenerator, serializerProvider, typeSerializer);
+        }
+
+        public void ser(final ResponseMessage responseMessage, final JsonGenerator jsonGenerator,
+                        final SerializerProvider serializerProvider,
+                        final TypeSerializer typeSerializer) throws IOException, JsonProcessingException {
+            jsonGenerator.writeStartObject();
+            if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
+
+            jsonGenerator.writeStringField(SerTokens.TOKEN_REQUEST, responseMessage.getRequestId() != null ? responseMessage.getRequestId().toString() : null);
+            jsonGenerator.writeObjectFieldStart(SerTokens.TOKEN_STATUS);
+
+            if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
+            jsonGenerator.writeStringField(SerTokens.TOKEN_MESSAGE, responseMessage.getStatus().getMessage());
+            jsonGenerator.writeNumberField(SerTokens.TOKEN_CODE, responseMessage.getStatus().getCode().getValue());
+            jsonGenerator.writeObjectField(SerTokens.TOKEN_ATTRIBUTES, responseMessage.getStatus().getAttributes());
+            jsonGenerator.writeEndObject();
+
+            jsonGenerator.writeObjectFieldStart(SerTokens.TOKEN_RESULT);
+            if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
+            if (null == responseMessage.getResult().getData())
+                jsonGenerator.writeNullField(SerTokens.TOKEN_DATA);
+            else
+                GraphSONUtil.writeWithType(SerTokens.TOKEN_DATA, responseMessage.getResult().getData(), jsonGenerator, serializerProvider, typeSerializer);
+            jsonGenerator.writeObjectField(SerTokens.TOKEN_META, responseMessage.getResult().getMeta());
+            jsonGenerator.writeEndObject();
+
+            jsonGenerator.writeEndObject();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3918972c/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
deleted file mode 100644
index 9f3fe23..0000000
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/AbstractJsonMessageSerializerV1d0.java
+++ /dev/null
@@ -1,242 +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.driver.ser;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-import com.fasterxml.jackson.databind.ser.std.StdSerializer;
-import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
-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;
-import io.netty.buffer.ByteBufAllocator;
-import io.netty.util.ReferenceCountUtil;
-import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONTokens;
-import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public abstract class AbstractJsonMessageSerializerV1d0 implements MessageSerializer {
-    private static final Logger logger = LoggerFactory.getLogger(AbstractJsonMessageSerializerV1d0.class);
-
-    protected ObjectMapper mapper;
-
-    protected static final String TOKEN_USE_MAPPER_FROM_GRAPH = "useMapperFromGraph";
-
-    protected final TypeReference<Map<String, Object>> mapTypeReference = new TypeReference<Map<String, Object>>() {
-    };
-
-    public AbstractJsonMessageSerializerV1d0() {
-        final GraphSONMapper.Builder builder = configureBuilder(GraphSONMapper.build());
-        mapper = builder.create().createMapper();
-    }
-
-    public AbstractJsonMessageSerializerV1d0(final GraphSONMapper mapper) {
-        this.mapper = mapper.createMapper();
-    }
-
-    abstract byte[] obtainHeader();
-
-    abstract GraphSONMapper.Builder configureBuilder(final GraphSONMapper.Builder builder);
-
-    @Override
-    public void configure(final Map<String, Object> config, final Map<String, Graph> graphs) {
-        final GraphSONMapper.Builder initialBuilder;
-        final Object graphToUseForMapper = config.get(TOKEN_USE_MAPPER_FROM_GRAPH);
-        if (graphToUseForMapper != null) {
-            if (null == graphs) throw new IllegalStateException(String.format(
-                    "No graphs have been provided to the serializer and therefore %s is not a valid configuration", TOKEN_USE_MAPPER_FROM_GRAPH));
-
-            final Graph g = graphs.get(graphToUseForMapper.toString());
-            if (null == g) throw new IllegalStateException(String.format(
-                    "There is no graph named [%s] configured to be used in the %s setting",
-                    graphToUseForMapper, TOKEN_USE_MAPPER_FROM_GRAPH));
-
-            // 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(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
-            // distinct implementations each with their own custom classes.
-            initialBuilder = GraphSONMapper.build();
-        }
-
-        mapper = configureBuilder(initialBuilder).create().createMapper();
-    }
-
-    @Override
-    public ByteBuf serializeResponseAsBinary(final ResponseMessage responseMessage, final ByteBufAllocator allocator) throws SerializationException {
-        ByteBuf encodedMessage = null;
-        try {
-            final byte[] payload = mapper.writeValueAsBytes(responseMessage);
-            encodedMessage = allocator.buffer(payload.length);
-            encodedMessage.writeBytes(payload);
-
-            return encodedMessage;
-        } catch (Exception ex) {
-            if (encodedMessage != null) ReferenceCountUtil.release(encodedMessage);
-
-            logger.warn("Response [{}] could not be serialized by {}.", responseMessage.toString(), AbstractJsonMessageSerializerV1d0.class.getName());
-            throw new SerializationException(ex);
-        }
-    }
-
-    @Override
-    public ByteBuf serializeRequestAsBinary(final RequestMessage requestMessage, final ByteBufAllocator allocator) throws SerializationException {
-        ByteBuf encodedMessage = null;
-        try {
-            final byte[] header = obtainHeader();
-            final byte[] payload = mapper.writeValueAsBytes(requestMessage);
-
-            encodedMessage = allocator.buffer(header.length + payload.length);
-            encodedMessage.writeBytes(header);
-            encodedMessage.writeBytes(payload);
-
-            return encodedMessage;
-        } catch (Exception ex) {
-            if (encodedMessage != null) ReferenceCountUtil.release(encodedMessage);
-
-            logger.warn("Request [{}] could not be serialized by {}.", requestMessage.toString(), AbstractJsonMessageSerializerV1d0.class.getName());
-            throw new SerializationException(ex);
-        }
-    }
-
-    @Override
-    public RequestMessage deserializeRequest(final ByteBuf msg) throws SerializationException {
-        try {
-            final byte[] payload = new byte[msg.readableBytes()];
-            msg.readBytes(payload);
-            return mapper.readValue(payload, RequestMessage.class);
-        } catch (Exception ex) {
-            logger.warn("Request [{}] could not be deserialized by {}.", msg, AbstractJsonMessageSerializerV1d0.class.getName());
-            throw new SerializationException(ex);
-        }
-    }
-
-    @Override
-    public ResponseMessage deserializeResponse(final ByteBuf msg) throws SerializationException {
-        try {
-            final byte[] payload = new byte[msg.readableBytes()];
-            msg.readBytes(payload);
-            final Map<String, Object> responseData = mapper.readValue(payload, mapTypeReference);
-            final Map<String, Object> status = (Map<String, Object>) responseData.get(SerTokens.TOKEN_STATUS);
-            final Map<String, Object> result = (Map<String, Object>) responseData.get(SerTokens.TOKEN_RESULT);
-            return ResponseMessage.build(UUID.fromString(responseData.get(SerTokens.TOKEN_REQUEST).toString()))
-                    .code(ResponseStatusCode.getFromValue((Integer) status.get(SerTokens.TOKEN_CODE)))
-                    .statusMessage(status.get(SerTokens.TOKEN_MESSAGE).toString())
-                    .statusAttributes((Map<String, Object>) status.get(SerTokens.TOKEN_ATTRIBUTES))
-                    .result(result.get(SerTokens.TOKEN_DATA))
-                    .responseMetaData((Map<String, Object>) result.get(SerTokens.TOKEN_META))
-                    .create();
-        } catch (Exception ex) {
-            logger.warn("Response [{}] could not be deserialized by {}.", msg, AbstractJsonMessageSerializerV1d0.class.getName());
-            throw new SerializationException(ex);
-        }
-    }
-
-    public static class GremlinServerModule extends SimpleModule {
-        public GremlinServerModule() {
-            super("graphson-gremlin-server");
-            addSerializer(JsonBuilder.class, new JsonBuilderJacksonSerializer());
-            addSerializer(ResponseMessage.class, new ResponseMessageSerializer());
-        }
-    }
-
-    public static class JsonBuilderJacksonSerializer extends StdSerializer<JsonBuilder> {
-        public JsonBuilderJacksonSerializer() {
-            super(JsonBuilder.class);
-        }
-
-        @Override
-        public void serialize(final JsonBuilder json, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
-                throws IOException, JsonGenerationException {
-            // the JSON from the builder will already be started/ended as array or object...just need to surround it
-            // with appropriate chars to fit into the serialization pattern.
-            jsonGenerator.writeRaw(":");
-            jsonGenerator.writeRaw(json.toString());
-            jsonGenerator.writeRaw(",");
-        }
-    }
-
-    public static class ResponseMessageSerializer extends StdSerializer<ResponseMessage> {
-        public ResponseMessageSerializer() {
-            super(ResponseMessage.class);
-        }
-
-        @Override
-        public void serialize(final ResponseMessage responseMessage, final JsonGenerator jsonGenerator,
-                              final SerializerProvider serializerProvider) throws IOException, JsonGenerationException {
-            ser(responseMessage, jsonGenerator, serializerProvider, null);
-        }
-
-        @Override
-        public void serializeWithType(final ResponseMessage responseMessage, final JsonGenerator jsonGenerator,
-                                      final SerializerProvider serializerProvider,
-                                      final TypeSerializer typeSerializer) throws IOException, JsonProcessingException {
-            ser(responseMessage, jsonGenerator, serializerProvider, typeSerializer);
-        }
-
-        public void ser(final ResponseMessage responseMessage, final JsonGenerator jsonGenerator,
-                        final SerializerProvider serializerProvider,
-                        final TypeSerializer typeSerializer) throws IOException, JsonProcessingException {
-            jsonGenerator.writeStartObject();
-            if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
-
-            jsonGenerator.writeStringField(SerTokens.TOKEN_REQUEST, responseMessage.getRequestId() != null ? responseMessage.getRequestId().toString() : null);
-            jsonGenerator.writeObjectFieldStart(SerTokens.TOKEN_STATUS);
-
-            if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
-            jsonGenerator.writeStringField(SerTokens.TOKEN_MESSAGE, responseMessage.getStatus().getMessage());
-            jsonGenerator.writeNumberField(SerTokens.TOKEN_CODE, responseMessage.getStatus().getCode().getValue());
-            jsonGenerator.writeObjectField(SerTokens.TOKEN_ATTRIBUTES, responseMessage.getStatus().getAttributes());
-            jsonGenerator.writeEndObject();
-
-            jsonGenerator.writeObjectFieldStart(SerTokens.TOKEN_RESULT);
-            if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
-            if (null == responseMessage.getResult().getData())
-                jsonGenerator.writeNullField(SerTokens.TOKEN_DATA);
-            else
-                GraphSONUtil.writeWithType(SerTokens.TOKEN_DATA, responseMessage.getResult().getData(), jsonGenerator, serializerProvider, typeSerializer);
-            jsonGenerator.writeObjectField(SerTokens.TOKEN_META, responseMessage.getResult().getMeta());
-            jsonGenerator.writeEndObject();
-
-            jsonGenerator.writeEndObject();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3918972c/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerGremlinV1D0.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerGremlinV1D0.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerGremlinV1D0.java
new file mode 100644
index 0000000..b895246
--- /dev/null
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerGremlinV1D0.java
@@ -0,0 +1,66 @@
+/*
+ * 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.driver.ser;
+
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
+
+import java.nio.ByteBuffer;
+
+/**
+ * Serialize results to JSON with version 1.0.x schema.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GraphSONMessageSerializerGremlinV1D0 extends AbstractGraphSONMessageSerializerV1d0 {
+
+    private static final String MIME_TYPE = SerTokens.MIME_GRAPHSON_V1D0;
+
+    private static byte[] header;
+
+    static {
+        final ByteBuffer buffer = ByteBuffer.allocate(MIME_TYPE.length() + 1);
+        buffer.put((byte) MIME_TYPE.length());
+        buffer.put(MIME_TYPE.getBytes());
+        header = buffer.array();
+    }
+
+    public GraphSONMessageSerializerGremlinV1D0() {
+        super();
+    }
+
+    public GraphSONMessageSerializerGremlinV1D0(final GraphSONMapper mapper) {
+        super(mapper);
+    }
+
+    @Override
+    public String[] mimeTypesSupported() {
+        return new String[]{MIME_TYPE};
+    }
+
+    @Override
+    byte[] obtainHeader() {
+        return header;
+    }
+
+    @Override
+    GraphSONMapper.Builder configureBuilder(final GraphSONMapper.Builder builder) {
+        return builder.addCustomModule(new GraphSONMessageSerializerV1D0.GremlinServerModule())
+                .embedTypes(true);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3918972c/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV1D0.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV1D0.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV1D0.java
new file mode 100644
index 0000000..3255419
--- /dev/null
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV1D0.java
@@ -0,0 +1,122 @@
+/*
+ * 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.driver.ser;
+
+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.io.graphson.GraphSONMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.nio.ByteBuffer;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * Serialize results to JSON with version 1.0.x schema.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GraphSONMessageSerializerV1D0 extends AbstractGraphSONMessageSerializerV1d0 implements MessageTextSerializer {
+    private static final Logger logger = LoggerFactory.getLogger(GraphSONMessageSerializerV1D0.class);
+    private static final String MIME_TYPE = SerTokens.MIME_JSON;
+
+    private static byte[] header;
+
+    static {
+        final ByteBuffer buffer = ByteBuffer.allocate(MIME_TYPE.length() + 1);
+        buffer.put((byte) MIME_TYPE.length());
+        buffer.put(MIME_TYPE.getBytes());
+        header = buffer.array();
+    }
+
+    public GraphSONMessageSerializerV1D0() {
+        super();
+    }
+
+    public GraphSONMessageSerializerV1D0(final GraphSONMapper mapper) {
+        super(mapper);
+    }
+
+    @Override
+    public String[] mimeTypesSupported() {
+        return new String[]{MIME_TYPE};
+    }
+
+    @Override
+    GraphSONMapper.Builder configureBuilder(GraphSONMapper.Builder builder) {
+        return builder.addCustomModule(new GremlinServerModule())
+                .embedTypes(false);
+    }
+
+    @Override
+    byte[] obtainHeader() {
+        return header;
+    }
+
+    @Override
+    public ResponseMessage deserializeResponse(final String msg) throws SerializationException {
+        try {
+            final Map<String, Object> responseData = mapper.readValue(msg, mapTypeReference);
+            final Map<String, Object> status = (Map<String, Object>) responseData.get(SerTokens.TOKEN_STATUS);
+            final Map<String, Object> result = (Map<String, Object>) responseData.get(SerTokens.TOKEN_RESULT);
+            return ResponseMessage.build(UUID.fromString(responseData.get(SerTokens.TOKEN_REQUEST).toString()))
+                    .code(ResponseStatusCode.getFromValue((Integer) status.get(SerTokens.TOKEN_CODE)))
+                    .statusMessage(status.get(SerTokens.TOKEN_MESSAGE).toString())
+                    .statusAttributes((Map<String, Object>) status.get(SerTokens.TOKEN_ATTRIBUTES))
+                    .result(result.get(SerTokens.TOKEN_DATA))
+                    .responseMetaData((Map<String, Object>) result.get(SerTokens.TOKEN_META))
+                    .create();
+        } catch (Exception ex) {
+            logger.warn("Response [{}] could not be deserialized by {}.", msg, AbstractGraphSONMessageSerializerV1d0.class.getName());
+            throw new SerializationException(ex);
+        }
+    }
+
+    @Override
+    public String serializeResponseAsString(final ResponseMessage responseMessage) throws SerializationException {
+        try {
+            return mapper.writeValueAsString(responseMessage);
+        } catch (Exception ex) {
+            logger.warn("Response [{}] could not be serialized by {}.", responseMessage.toString(), AbstractGraphSONMessageSerializerV1d0.class.getName());
+            throw new SerializationException(ex);
+        }
+    }
+
+    @Override
+    public RequestMessage deserializeRequest(final String msg) throws SerializationException {
+        try {
+            return mapper.readValue(msg, RequestMessage.class);
+        } catch (Exception ex) {
+            logger.warn("Request [{}] could not be deserialized by {}.", msg, AbstractGraphSONMessageSerializerV1d0.class.getName());
+            throw new SerializationException(ex);
+        }
+    }
+
+    @Override
+    public String serializeRequestAsString(final RequestMessage requestMessage) throws SerializationException {
+        try {
+            return mapper.writeValueAsString(requestMessage);
+        } catch (Exception ex) {
+            logger.warn("Request [{}] could not be serialized by {}.", requestMessage.toString(), AbstractGraphSONMessageSerializerV1d0.class.getName());
+            throw new SerializationException(ex);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3918972c/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerGremlinV1d0.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerGremlinV1d0.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerGremlinV1d0.java
deleted file mode 100644
index e11a70b..0000000
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerGremlinV1d0.java
+++ /dev/null
@@ -1,66 +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.driver.ser;
-
-import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
-
-import java.nio.ByteBuffer;
-
-/**
- * Serialize results to JSON with version 1.0.x schema.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class JsonMessageSerializerGremlinV1d0 extends AbstractJsonMessageSerializerV1d0 {
-
-    private static final String MIME_TYPE = SerTokens.MIME_JSON_V1D0;
-
-    private static byte[] header;
-
-    static {
-        final ByteBuffer buffer = ByteBuffer.allocate(MIME_TYPE.length() + 1);
-        buffer.put((byte) MIME_TYPE.length());
-        buffer.put(MIME_TYPE.getBytes());
-        header = buffer.array();
-    }
-
-    public JsonMessageSerializerGremlinV1d0() {
-        super();
-    }
-
-    public JsonMessageSerializerGremlinV1d0(final GraphSONMapper mapper) {
-        super(mapper);
-    }
-
-    @Override
-    public String[] mimeTypesSupported() {
-        return new String[]{MIME_TYPE};
-    }
-
-    @Override
-    byte[] obtainHeader() {
-        return header;
-    }
-
-    @Override
-    GraphSONMapper.Builder configureBuilder(final GraphSONMapper.Builder builder) {
-        return builder.addCustomModule(new JsonMessageSerializerV1d0.GremlinServerModule())
-                .embedTypes(true);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3918972c/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerV1d0.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerV1d0.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerV1d0.java
deleted file mode 100644
index 84831a0..0000000
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerV1d0.java
+++ /dev/null
@@ -1,123 +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.driver.ser;
-
-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.io.graphson.GraphSONMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.nio.ByteBuffer;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-/**
- * Serialize results to JSON with version 1.0.x schema.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class JsonMessageSerializerV1d0 extends AbstractJsonMessageSerializerV1d0 implements MessageTextSerializer {
-    private static final Logger logger = LoggerFactory.getLogger(JsonMessageSerializerV1d0.class);
-    private static final String MIME_TYPE = SerTokens.MIME_JSON;
-
-    private static byte[] header;
-
-    static {
-        final ByteBuffer buffer = ByteBuffer.allocate(MIME_TYPE.length() + 1);
-        buffer.put((byte) MIME_TYPE.length());
-        buffer.put(MIME_TYPE.getBytes());
-        header = buffer.array();
-    }
-
-    public JsonMessageSerializerV1d0() {
-        super();
-    }
-
-    public JsonMessageSerializerV1d0(final GraphSONMapper mapper) {
-        super(mapper);
-    }
-
-    @Override
-    public String[] mimeTypesSupported() {
-        return new String[]{MIME_TYPE};
-    }
-
-    @Override
-    GraphSONMapper.Builder configureBuilder(GraphSONMapper.Builder builder) {
-        return builder.addCustomModule(new GremlinServerModule())
-                .embedTypes(false);
-    }
-
-    @Override
-    byte[] obtainHeader() {
-        return header;
-    }
-
-    @Override
-    public ResponseMessage deserializeResponse(final String msg) throws SerializationException {
-        try {
-            final Map<String, Object> responseData = mapper.readValue(msg, mapTypeReference);
-            final Map<String, Object> status = (Map<String, Object>) responseData.get(SerTokens.TOKEN_STATUS);
-            final Map<String, Object> result = (Map<String, Object>) responseData.get(SerTokens.TOKEN_RESULT);
-            return ResponseMessage.build(UUID.fromString(responseData.get(SerTokens.TOKEN_REQUEST).toString()))
-                    .code(ResponseStatusCode.getFromValue((Integer) status.get(SerTokens.TOKEN_CODE)))
-                    .statusMessage(status.get(SerTokens.TOKEN_MESSAGE).toString())
-                    .statusAttributes((Map<String, Object>) status.get(SerTokens.TOKEN_ATTRIBUTES))
-                    .result(result.get(SerTokens.TOKEN_DATA))
-                    .responseMetaData((Map<String, Object>) result.get(SerTokens.TOKEN_META))
-                    .create();
-        } catch (Exception ex) {
-            logger.warn("Response [{}] could not be deserialized by {}.", msg, AbstractJsonMessageSerializerV1d0.class.getName());
-            throw new SerializationException(ex);
-        }
-    }
-
-    @Override
-    public String serializeResponseAsString(final ResponseMessage responseMessage) throws SerializationException {
-        try {
-            return mapper.writeValueAsString(responseMessage);
-        } catch (Exception ex) {
-            logger.warn("Response [{}] could not be serialized by {}.", responseMessage.toString(), AbstractJsonMessageSerializerV1d0.class.getName());
-            throw new SerializationException(ex);
-        }
-    }
-
-    @Override
-    public RequestMessage deserializeRequest(final String msg) throws SerializationException {
-        try {
-            return mapper.readValue(msg, RequestMessage.class);
-        } catch (Exception ex) {
-            logger.warn("Request [{}] could not be deserialized by {}.", msg, AbstractJsonMessageSerializerV1d0.class.getName());
-            throw new SerializationException(ex);
-        }
-    }
-
-    @Override
-    public String serializeRequestAsString(final RequestMessage requestMessage) throws SerializationException {
-        try {
-            return mapper.writeValueAsString(requestMessage);
-        } catch (Exception ex) {
-            logger.warn("Request [{}] could not be serialized by {}.", requestMessage.toString(), AbstractJsonMessageSerializerV1d0.class.getName());
-            throw new SerializationException(ex);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3918972c/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerTokens.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerTokens.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerTokens.java
index 1fcb4be..2f5b8be 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerTokens.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerTokens.java
@@ -35,6 +35,6 @@ public class SerTokens {
     public static final String TOKEN_ARGS = "args";
 
     public static final String MIME_JSON = "application/json";
-    public static final String MIME_JSON_V1D0 = "application/vnd.gremlin-v1.0+json";
+    public static final String MIME_GRAPHSON_V1D0 = "application/vnd.gremlin-v1.0+json";
     public static final String MIME_GRYO_V1D0 = "application/vnd.gremlin-v1.0+gryo";
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3918972c/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/Serializers.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/Serializers.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/Serializers.java
index a48be1b..8c5e7ba 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/Serializers.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/Serializers.java
@@ -27,7 +27,7 @@ import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
  */
 public enum Serializers {
     JSON(SerTokens.MIME_JSON),
-    JSON_V1D0(SerTokens.MIME_JSON_V1D0),
+    JSON_V1D0(SerTokens.MIME_GRAPHSON_V1D0),
     GRYO_V1D0(SerTokens.MIME_GRYO_V1D0);
 
     private String value;
@@ -37,14 +37,14 @@ public enum Serializers {
      * {@link org.apache.tinkerpop.gremlin.driver.ser.MessageTextSerializer} so that it can be compatible with text-based
      * websocket messages.
      */
-    public static final MessageSerializer DEFAULT_RESULT_SERIALIZER = new JsonMessageSerializerV1d0();
+    public static final MessageSerializer DEFAULT_RESULT_SERIALIZER = new GraphSONMessageSerializerV1D0();
 
     /**
      * Default serializer for requests received by Gremlin Server. This implementation must be of type
      * {@link org.apache.tinkerpop.gremlin.driver.ser.MessageTextSerializer} so that it can be compatible with text-based
      * websocket messages.
      */
-    public static final MessageSerializer DEFAULT_REQUEST_SERIALIZER = new JsonMessageSerializerV1d0();
+    public static final MessageSerializer DEFAULT_REQUEST_SERIALIZER = new GraphSONMessageSerializerV1D0();
 
     private Serializers(final String mimeType) {
         this.value = mimeType;
@@ -57,9 +57,9 @@ public enum Serializers {
     public MessageSerializer simpleInstance() {
         switch (value) {
             case SerTokens.MIME_JSON:
-                return new JsonMessageSerializerV1d0();
-            case SerTokens.MIME_JSON_V1D0:
-                return new JsonMessageSerializerGremlinV1d0();
+                return new GraphSONMessageSerializerV1D0();
+            case SerTokens.MIME_GRAPHSON_V1D0:
+                return new GraphSONMessageSerializerGremlinV1D0();
             case SerTokens.MIME_GRYO_V1D0:
                 return new GryoMessageSerializerV1d0();
             default:

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3918972c/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerGremlinV1d0Test.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerGremlinV1d0Test.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerGremlinV1d0Test.java
index 484c266..eac6a67 100644
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerGremlinV1d0Test.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerGremlinV1d0Test.java
@@ -22,7 +22,6 @@ import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.structure.Compare;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Property;
@@ -55,7 +54,7 @@ public class JsonMessageSerializerGremlinV1d0Test {
     private ResponseMessage.Builder responseMessageBuilder = ResponseMessage.build(requestId);
     private static ByteBufAllocator allocator = UnpooledByteBufAllocator.DEFAULT;
 
-    public MessageSerializer serializer = new JsonMessageSerializerGremlinV1d0();
+    public MessageSerializer serializer = new GraphSONMessageSerializerGremlinV1D0();
 
     @Test
     public void serializeIterable() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3918972c/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerV1d0Test.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerV1d0Test.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerV1d0Test.java
index 07e3894..453af95 100644
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerV1d0Test.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerV1d0Test.java
@@ -51,7 +51,7 @@ import static org.junit.Assert.assertNotNull;
  */
 public class JsonMessageSerializerV1d0Test {
 
-    public static final JsonMessageSerializerV1d0 SERIALIZER = new JsonMessageSerializerV1d0();
+    public static final GraphSONMessageSerializerV1D0 SERIALIZER = new GraphSONMessageSerializerV1D0();
     private static final RequestMessage msg = RequestMessage.build("op")
             .overrideRequestId(UUID.fromString("2D62161B-9544-4F39-AF44-62EC49F9A595")).create();