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/28 13:08:15 UTC
incubator-tinkerpop git commit: Drop GraphSONVertex which is obsolete
given StarGraph serialization.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master 3adc1dfac -> 40629d93d
Drop GraphSONVertex which is obsolete given StarGraph serialization.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/40629d93
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/40629d93
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/40629d93
Branch: refs/heads/master
Commit: 40629d93d3603f8288a364cdd6a8a89303c8c08c
Parents: 3adc1df
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Apr 28 07:07:47 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Apr 28 07:07:47 2015 -0400
----------------------------------------------------------------------
.../structure/io/graphson/GraphSONModule.java | 1 -
.../structure/io/graphson/GraphSONVertex.java | 94 --------------------
2 files changed, 95 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/40629d93/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
index b35ad77..4ec05fe 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
@@ -57,7 +57,6 @@ public class GraphSONModule extends SimpleModule {
super("graphson");
addSerializer(Edge.class, new EdgeJacksonSerializer());
addSerializer(Vertex.class, new VertexJacksonSerializer());
- addSerializer(GraphSONVertex.class, new GraphSONVertex.VertexJacksonSerializer());
addSerializer(VertexProperty.class, new VertexPropertyJacksonSerializer());
addSerializer(Property.class, new PropertyJacksonSerializer());
addSerializer(TraversalMetrics.class, new TraversalMetricsJacksonSerializer());
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/40629d93/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVertex.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVertex.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVertex.java
deleted file mode 100644
index 2b26ac3..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVertex.java
+++ /dev/null
@@ -1,94 +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.graphson;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
-import com.fasterxml.jackson.databind.ser.std.StdSerializer;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Property;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-class GraphSONVertex {
- private final Direction direction;
- private final Vertex vertexToSerialize;
-
- public GraphSONVertex(final Vertex vertexToSerialize, final Direction direction) {
- this.direction = direction;
- this.vertexToSerialize = vertexToSerialize;
- }
-
- public Direction getDirection() {
- return direction;
- }
-
- public Vertex getVertexToSerialize() {
- return vertexToSerialize;
- }
-
- static class VertexJacksonSerializer extends StdSerializer<GraphSONVertex> {
-
- public VertexJacksonSerializer() {
- super(GraphSONVertex.class);
- }
-
- @Override
- public void serialize(final GraphSONVertex directionalVertex, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
- throws IOException {
- ser(directionalVertex, jsonGenerator);
- }
-
- @Override
- public void serializeWithType(final GraphSONVertex directionalVertex, final JsonGenerator jsonGenerator,
- final SerializerProvider serializerProvider, final TypeSerializer typeSerializer) throws IOException {
- ser(directionalVertex, jsonGenerator);
- }
-
- public static void ser(final GraphSONVertex directionalVertex, final JsonGenerator jsonGenerator) throws IOException {
- final Vertex vertex = directionalVertex.getVertexToSerialize();
- final Map<String, Object> m = new HashMap<>();
- m.put(GraphSONTokens.ID, vertex.id());
- m.put(GraphSONTokens.LABEL, vertex.label());
- m.put(GraphSONTokens.TYPE, GraphSONTokens.VERTEX);
-
- final Object properties = IteratorUtils.groupBy(vertex.properties(), Property::key);
- m.put(GraphSONTokens.PROPERTIES, properties);
-
- if (directionalVertex.getDirection() == Direction.BOTH || directionalVertex.getDirection() == Direction.OUT) {
- m.put(GraphSONTokens.OUT_E, IteratorUtils.list(vertex.edges(Direction.OUT)));
- }
-
- if (directionalVertex.getDirection() == Direction.BOTH || directionalVertex.getDirection() == Direction.IN) {
- m.put(GraphSONTokens.IN_E, IteratorUtils.list(vertex.edges(Direction.IN)));
- }
-
- jsonGenerator.writeObject(m);
- }
- }
-}