tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [1/5] tinkerpop git commit: Added basics for versioning Gryo.
Date Tue, 20 Dec 2016 20:23:55 GMT
Repository: tinkerpop
Updated Branches:
  refs/heads/master a4a059cb8 -> bb464123a


Added basics for versioning Gryo.

This is not a breaking change. build() remains the operative which gets the default gryo version
and simply calls the new build(version). CTR


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

Branch: refs/heads/master
Commit: 651b0f3b025d13aa0370abff530cb41fd3ef6ef6
Parents: 49668ce
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Tue Dec 20 14:18:09 2016 -0500
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Tue Dec 20 14:18:09 2016 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   1 +
 .../gremlin/structure/io/gryo/GryoMapper.java   | 299 ++++++++++---------
 .../gremlin/structure/io/gryo/GryoVersion.java  |  36 +++
 3 files changed, 194 insertions(+), 142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/651b0f3b/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 02531ba..6fd7255 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Added `GryoVersion` for future flexibility when introducing a new verison of Gryo.
 * Lessened the severity of Gremlin Server logging when it encounters two or more serializers
addressing the same mime type.
 * Bumped to Netty 4.0.42.final.
 * Added `ByteBuffer`, `InetAddress`, `Timestamp` to the list of Gryo supported classes.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/651b0f3b/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 bbd3999..60ed74e 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
@@ -207,7 +207,11 @@ public final class GryoMapper implements Mapper<Kryo> {
     }
 
     public static Builder build() {
-        return new Builder();
+        return build(GryoVersion.V1_0);
+    }
+
+    public static Builder build(final GryoVersion version) {
+        return new BuilderV1d0();
     }
 
     private void validate() {
@@ -225,27 +229,169 @@ public final class GryoMapper implements Mapper<Kryo> {
             throw new IllegalStateException("There are duplicate kryo identifiers in use:
" + duplicates);
     }
 
+    public final static class BuilderV1d0 extends Builder {
+        @Override
+        public List<TypeRegistration<?>> initTypeRegistrations() {
+            return new ArrayList<TypeRegistration<?>>() {{
+                add(GryoTypeReg.of(byte[].class, 25));
+                add(GryoTypeReg.of(char[].class, 26));
+                add(GryoTypeReg.of(short[].class, 27));
+                add(GryoTypeReg.of(int[].class, 28));
+                add(GryoTypeReg.of(long[].class, 29));
+                add(GryoTypeReg.of(float[].class, 30));
+                add(GryoTypeReg.of(double[].class, 31));
+                add(GryoTypeReg.of(String[].class, 32));
+                add(GryoTypeReg.of(Object[].class, 33));
+                add(GryoTypeReg.of(ArrayList.class, 10));
+                add(GryoTypeReg.of(ARRAYS_AS_LIST, 134, new UtilSerializers.ArraysAsListSerializer()));
+                add(GryoTypeReg.of(BigInteger.class, 34));
+                add(GryoTypeReg.of(BigDecimal.class, 35));
+                add(GryoTypeReg.of(Calendar.class, 39));
+                add(GryoTypeReg.of(Class.class, 41, new UtilSerializers.ClassSerializer()));
+                add(GryoTypeReg.of(Collection.class, 37));
+                add(GryoTypeReg.of(Collections.EMPTY_LIST.getClass(), 51));
+                add(GryoTypeReg.of(Collections.EMPTY_MAP.getClass(), 52));
+                add(GryoTypeReg.of(Collections.EMPTY_SET.getClass(), 53));
+                add(GryoTypeReg.of(Collections.singleton(null).getClass(), 54));
+                add(GryoTypeReg.of(Collections.singletonList(null).getClass(), 24));
+                add(GryoTypeReg.of(Collections.singletonMap(null, null).getClass(), 23));
+                add(GryoTypeReg.of(Contains.class, 49));
+                add(GryoTypeReg.of(Currency.class, 40));
+                add(GryoTypeReg.of(Date.class, 38));
+                add(GryoTypeReg.of(Direction.class, 12));
+                add(GryoTypeReg.of(DetachedEdge.class, 21));
+                add(GryoTypeReg.of(DetachedVertexProperty.class, 20));
+                add(GryoTypeReg.of(DetachedProperty.class, 18));
+                add(GryoTypeReg.of(DetachedVertex.class, 19));
+                add(GryoTypeReg.of(DetachedPath.class, 60));
+                // skip 14
+                add(GryoTypeReg.of(EnumSet.class, 46));
+                add(GryoTypeReg.of(HashMap.class, 11));
+                add(GryoTypeReg.of(HashMap.Entry.class, 16));
+                add(GryoTypeReg.of(HASH_MAP_NODE, 92));
+                add(GryoTypeReg.of(KryoSerializable.class, 36));
+                add(GryoTypeReg.of(LinkedHashMap.class, 47));
+                add(GryoTypeReg.of(LinkedHashSet.class, 71));
+                add(GryoTypeReg.of(LinkedList.class, 116));
+                add(GryoTypeReg.of(LINKED_HASH_MAP_ENTRY_CLASS, 15));
+                add(GryoTypeReg.of(Locale.class, 22));
+                add(GryoTypeReg.of(StringBuffer.class, 43));
+                add(GryoTypeReg.of(StringBuilder.class, 44));
+                add(GryoTypeReg.of(T.class, 48));
+                add(GryoTypeReg.of(TimeZone.class, 42));
+                add(GryoTypeReg.of(TreeMap.class, 45));
+                add(GryoTypeReg.of(TreeSet.class, 50));
+                add(GryoTypeReg.of(UUID.class, 17, new UtilSerializers.UUIDSerializer()));
+                add(GryoTypeReg.of(URI.class, 72, new UtilSerializers.URISerializer()));
+                add(GryoTypeReg.of(VertexTerminator.class, 13));
+                add(GryoTypeReg.of(AbstractMap.SimpleEntry.class, 120));
+                add(GryoTypeReg.of(AbstractMap.SimpleImmutableEntry.class, 121));
+                add(GryoTypeReg.of(java.sql.Timestamp.class, 138));
+                add(GryoTypeReg.of(InetAddress.class, 139, new UtilSerializers.InetAddressSerializer()));
+                add(GryoTypeReg.of(ByteBuffer.class, 140, new UtilSerializers.ByteBufferSerializer()));
 // ***LAST ID***
+
+                add(GryoTypeReg.of(ReferenceEdge.class, 81));
+                add(GryoTypeReg.of(ReferenceVertexProperty.class, 82));
+                add(GryoTypeReg.of(ReferenceProperty.class, 83));
+                add(GryoTypeReg.of(ReferenceVertex.class, 84));
+                add(GryoTypeReg.of(ReferencePath.class, 85));
+
+                add(GryoTypeReg.of(StarGraph.class, 86, new StarGraphSerializer(Direction.BOTH,
new GraphFilter())));
+
+                add(GryoTypeReg.of(Edge.class, 65, new GryoSerializers.EdgeSerializer()));
+                add(GryoTypeReg.of(Vertex.class, 66, new GryoSerializers.VertexSerializer()));
+                add(GryoTypeReg.of(Property.class, 67, new GryoSerializers.PropertySerializer()));
+                add(GryoTypeReg.of(VertexProperty.class, 68, new GryoSerializers.VertexPropertySerializer()));
+                add(GryoTypeReg.of(Path.class, 59, new GryoSerializers.PathSerializer()));
+                // skip 55
+                add(GryoTypeReg.of(B_O_Traverser.class, 75));
+                add(GryoTypeReg.of(O_Traverser.class, 76));
+                add(GryoTypeReg.of(B_LP_O_P_S_SE_SL_Traverser.class, 77));
+                add(GryoTypeReg.of(B_O_S_SE_SL_Traverser.class, 78));
+                add(GryoTypeReg.of(B_LP_O_S_SE_SL_Traverser.class, 87));
+                add(GryoTypeReg.of(O_OB_S_SE_SL_Traverser.class, 89));
+                add(GryoTypeReg.of(LP_O_OB_S_SE_SL_Traverser.class, 90));
+                add(GryoTypeReg.of(LP_O_OB_P_S_SE_SL_Traverser.class, 91));
+                add(GryoTypeReg.of(DefaultRemoteTraverser.class, 123, new GryoSerializers.DefaultRemoteTraverserSerializer()));
+
+                add(GryoTypeReg.of(Bytecode.class, 122, new GryoSerializers.BytecodeSerializer()));
+                add(GryoTypeReg.of(P.class, 124, new GryoSerializers.PSerializer()));
+                add(GryoTypeReg.of(Lambda.class, 125, new GryoSerializers.LambdaSerializer()));
+                add(GryoTypeReg.of(Bytecode.Binding.class, 126, new GryoSerializers.BindingSerializer()));
+                add(GryoTypeReg.of(Order.class, 127));
+                add(GryoTypeReg.of(Scope.class, 128));
+                add(GryoTypeReg.of(AndP.class, 129, new GryoSerializers.AndPSerializer()));
+                add(GryoTypeReg.of(OrP.class, 130, new GryoSerializers.OrPSerializer()));
+                add(GryoTypeReg.of(VertexProperty.Cardinality.class, 131));
+                add(GryoTypeReg.of(Column.class, 132));
+                add(GryoTypeReg.of(Pop.class, 133));
+                add(GryoTypeReg.of(SackFunctions.Barrier.class, 135));
+                add(GryoTypeReg.of(TraversalOptionParent.Pick.class, 137));
+                add(GryoTypeReg.of(HashSetSupplier.class, 136, new UtilSerializers.HashSetSupplierSerializer()));
+
+                add(GryoTypeReg.of(TraverserSet.class, 58));
+                add(GryoTypeReg.of(Tree.class, 61));
+                add(GryoTypeReg.of(HashSet.class, 62));
+                add(GryoTypeReg.of(BulkSet.class, 64));
+                add(GryoTypeReg.of(MutableMetrics.class, 69));
+                add(GryoTypeReg.of(ImmutableMetrics.class, 115));
+                add(GryoTypeReg.of(DefaultTraversalMetrics.class, 70));
+                add(GryoTypeReg.of(MapMemory.class, 73));
+                add(GryoTypeReg.of(MapReduce.NullObject.class, 74));
+                add(GryoTypeReg.of(AtomicLong.class, 79));
+                add(GryoTypeReg.of(Pair.class, 88, new UtilSerializers.PairSerializer()));
+                add(GryoTypeReg.of(TraversalExplanation.class, 106, new JavaSerializer()));
+
+                add(GryoTypeReg.of(Duration.class, 93, new JavaTimeSerializers.DurationSerializer()));
+                add(GryoTypeReg.of(Instant.class, 94, new JavaTimeSerializers.InstantSerializer()));
+                add(GryoTypeReg.of(LocalDate.class, 95, new JavaTimeSerializers.LocalDateSerializer()));
+                add(GryoTypeReg.of(LocalDateTime.class, 96, new JavaTimeSerializers.LocalDateTimeSerializer()));
+                add(GryoTypeReg.of(LocalTime.class, 97, new JavaTimeSerializers.LocalTimeSerializer()));
+                add(GryoTypeReg.of(MonthDay.class, 98, new JavaTimeSerializers.MonthDaySerializer()));
+                add(GryoTypeReg.of(OffsetDateTime.class, 99, new JavaTimeSerializers.OffsetDateTimeSerializer()));
+                add(GryoTypeReg.of(OffsetTime.class, 100, new JavaTimeSerializers.OffsetTimeSerializer()));
+                add(GryoTypeReg.of(Period.class, 101, new JavaTimeSerializers.PeriodSerializer()));
+                add(GryoTypeReg.of(Year.class, 102, new JavaTimeSerializers.YearSerializer()));
+                add(GryoTypeReg.of(YearMonth.class, 103, new JavaTimeSerializers.YearMonthSerializer()));
+                add(GryoTypeReg.of(ZonedDateTime.class, 104, new JavaTimeSerializers.ZonedDateTimeSerializer()));
+                add(GryoTypeReg.of(ZoneOffset.class, 105, new JavaTimeSerializers.ZoneOffsetSerializer()));
+
+                add(GryoTypeReg.of(Operator.class, 107));
+                add(GryoTypeReg.of(FoldStep.FoldBiOperator.class, 108));
+                add(GryoTypeReg.of(GroupCountStep.GroupCountBiOperator.class, 109));
+                add(GryoTypeReg.of(GroupStep.GroupBiOperator.class, 117, new JavaSerializer()));
// because they contain traversals
+                add(GryoTypeReg.of(MeanGlobalStep.MeanGlobalBiOperator.class, 110));
+                add(GryoTypeReg.of(MeanGlobalStep.MeanNumber.class, 111));
+                add(GryoTypeReg.of(TreeStep.TreeBiOperator.class, 112));
+                add(GryoTypeReg.of(GroupStepV3d0.GroupBiOperatorV3d0.class, 113));
+                add(GryoTypeReg.of(RangeGlobalStep.RangeBiOperator.class, 114));
+                add(GryoTypeReg.of(OrderGlobalStep.OrderBiOperator.class, 118, new JavaSerializer()));
// because they contain traversals
+                add(GryoTypeReg.of(ProfileStep.ProfileBiOperator.class, 119));
+            }};
+        }
+    }
+
     /**
      * A builder to construct a {@link GryoMapper} instance.
      */
-    public final static class Builder implements Mapper.Builder<Builder> {
+    public abstract 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.
          */
-        private static final LinkedHashMap m = new LinkedHashMap() {{
+        protected static final LinkedHashMap m = new LinkedHashMap() {{
             put("junk", "dummy");
         }};
 
-        private static final Class ARRAYS_AS_LIST = Arrays.asList("dummy").getClass();
+        protected static final Class ARRAYS_AS_LIST = Arrays.asList("dummy").getClass();
 
-        private static final Class LINKED_HASH_MAP_ENTRY_CLASS = m.entrySet().iterator().next().getClass();
+        protected static final Class LINKED_HASH_MAP_ENTRY_CLASS = m.entrySet().iterator().next().getClass();
 
         /**
          * The {@code HashMap$Node} class comes into serialization play when a {@code Map.entrySet()}
is
          * serialized.
          */
-        private static final Class HASH_MAP_NODE;
+        protected static final Class HASH_MAP_NODE;
 
         static {
             // have to instantiate this via reflection because it is a private inner class
of HashMap
@@ -261,142 +407,7 @@ public final class GryoMapper implements Mapper<Kryo> {
          * Note that the following are pre-registered boolean, Boolean, byte, Byte, char,
Character, double, Double,
          * int, Integer, float, Float, long, Long, short, Short, String, void.
          */
-        private final List<TypeRegistration<?>> typeRegistrations = new ArrayList<TypeRegistration<?>>()
{{
-            add(GryoTypeReg.of(byte[].class, 25));
-            add(GryoTypeReg.of(char[].class, 26));
-            add(GryoTypeReg.of(short[].class, 27));
-            add(GryoTypeReg.of(int[].class, 28));
-            add(GryoTypeReg.of(long[].class, 29));
-            add(GryoTypeReg.of(float[].class, 30));
-            add(GryoTypeReg.of(double[].class, 31));
-            add(GryoTypeReg.of(String[].class, 32));
-            add(GryoTypeReg.of(Object[].class, 33));
-            add(GryoTypeReg.of(ArrayList.class, 10));
-            add(GryoTypeReg.of(ARRAYS_AS_LIST, 134, new UtilSerializers.ArraysAsListSerializer()));
-            add(GryoTypeReg.of(BigInteger.class, 34));
-            add(GryoTypeReg.of(BigDecimal.class, 35));
-            add(GryoTypeReg.of(Calendar.class, 39));
-            add(GryoTypeReg.of(Class.class, 41, new UtilSerializers.ClassSerializer()));
-            add(GryoTypeReg.of(Collection.class, 37));
-            add(GryoTypeReg.of(Collections.EMPTY_LIST.getClass(), 51));
-            add(GryoTypeReg.of(Collections.EMPTY_MAP.getClass(), 52));
-            add(GryoTypeReg.of(Collections.EMPTY_SET.getClass(), 53));
-            add(GryoTypeReg.of(Collections.singleton(null).getClass(), 54));
-            add(GryoTypeReg.of(Collections.singletonList(null).getClass(), 24));
-            add(GryoTypeReg.of(Collections.singletonMap(null, null).getClass(), 23));
-            add(GryoTypeReg.of(Contains.class, 49));
-            add(GryoTypeReg.of(Currency.class, 40));
-            add(GryoTypeReg.of(Date.class, 38));
-            add(GryoTypeReg.of(Direction.class, 12));
-            add(GryoTypeReg.of(DetachedEdge.class, 21));
-            add(GryoTypeReg.of(DetachedVertexProperty.class, 20));
-            add(GryoTypeReg.of(DetachedProperty.class, 18));
-            add(GryoTypeReg.of(DetachedVertex.class, 19));
-            add(GryoTypeReg.of(DetachedPath.class, 60));
-            // skip 14
-            add(GryoTypeReg.of(EnumSet.class, 46));
-            add(GryoTypeReg.of(HashMap.class, 11));
-            add(GryoTypeReg.of(HashMap.Entry.class, 16));
-            add(GryoTypeReg.of(HASH_MAP_NODE, 92));
-            add(GryoTypeReg.of(KryoSerializable.class, 36));
-            add(GryoTypeReg.of(LinkedHashMap.class, 47));
-            add(GryoTypeReg.of(LinkedHashSet.class, 71));
-            add(GryoTypeReg.of(LinkedList.class, 116));
-            add(GryoTypeReg.of(LINKED_HASH_MAP_ENTRY_CLASS, 15));
-            add(GryoTypeReg.of(Locale.class, 22));
-            add(GryoTypeReg.of(StringBuffer.class, 43));
-            add(GryoTypeReg.of(StringBuilder.class, 44));
-            add(GryoTypeReg.of(T.class, 48));
-            add(GryoTypeReg.of(TimeZone.class, 42));
-            add(GryoTypeReg.of(TreeMap.class, 45));
-            add(GryoTypeReg.of(TreeSet.class, 50));
-            add(GryoTypeReg.of(UUID.class, 17, new UtilSerializers.UUIDSerializer()));
-            add(GryoTypeReg.of(URI.class, 72, new UtilSerializers.URISerializer()));
-            add(GryoTypeReg.of(VertexTerminator.class, 13));
-            add(GryoTypeReg.of(AbstractMap.SimpleEntry.class, 120));
-            add(GryoTypeReg.of(AbstractMap.SimpleImmutableEntry.class, 121));
-            add(GryoTypeReg.of(java.sql.Timestamp.class, 138));
-            add(GryoTypeReg.of(InetAddress.class, 139, new UtilSerializers.InetAddressSerializer()));
-            add(GryoTypeReg.of(ByteBuffer.class, 140, new UtilSerializers.ByteBufferSerializer()));
 // ***LAST ID***
-
-            add(GryoTypeReg.of(ReferenceEdge.class, 81));
-            add(GryoTypeReg.of(ReferenceVertexProperty.class, 82));
-            add(GryoTypeReg.of(ReferenceProperty.class, 83));
-            add(GryoTypeReg.of(ReferenceVertex.class, 84));
-            add(GryoTypeReg.of(ReferencePath.class, 85));
-
-            add(GryoTypeReg.of(StarGraph.class, 86, new StarGraphSerializer(Direction.BOTH,
new GraphFilter())));
-
-            add(GryoTypeReg.of(Edge.class, 65, new GryoSerializers.EdgeSerializer()));
-            add(GryoTypeReg.of(Vertex.class, 66, new GryoSerializers.VertexSerializer()));
-            add(GryoTypeReg.of(Property.class, 67, new GryoSerializers.PropertySerializer()));
-            add(GryoTypeReg.of(VertexProperty.class, 68, new GryoSerializers.VertexPropertySerializer()));
-            add(GryoTypeReg.of(Path.class, 59, new GryoSerializers.PathSerializer()));
-            // skip 55
-            add(GryoTypeReg.of(B_O_Traverser.class, 75));
-            add(GryoTypeReg.of(O_Traverser.class, 76));
-            add(GryoTypeReg.of(B_LP_O_P_S_SE_SL_Traverser.class, 77));
-            add(GryoTypeReg.of(B_O_S_SE_SL_Traverser.class, 78));
-            add(GryoTypeReg.of(B_LP_O_S_SE_SL_Traverser.class, 87));
-            add(GryoTypeReg.of(O_OB_S_SE_SL_Traverser.class, 89));
-            add(GryoTypeReg.of(LP_O_OB_S_SE_SL_Traverser.class, 90));
-            add(GryoTypeReg.of(LP_O_OB_P_S_SE_SL_Traverser.class, 91));
-            add(GryoTypeReg.of(DefaultRemoteTraverser.class, 123, new GryoSerializers.DefaultRemoteTraverserSerializer()));
-
-            add(GryoTypeReg.of(Bytecode.class, 122, new GryoSerializers.BytecodeSerializer()));
-            add(GryoTypeReg.of(P.class, 124, new GryoSerializers.PSerializer()));
-            add(GryoTypeReg.of(Lambda.class, 125, new GryoSerializers.LambdaSerializer()));
-            add(GryoTypeReg.of(Bytecode.Binding.class, 126, new GryoSerializers.BindingSerializer()));
-            add(GryoTypeReg.of(Order.class, 127));
-            add(GryoTypeReg.of(Scope.class, 128));
-            add(GryoTypeReg.of(AndP.class, 129, new GryoSerializers.AndPSerializer()));
-            add(GryoTypeReg.of(OrP.class, 130, new GryoSerializers.OrPSerializer()));
-            add(GryoTypeReg.of(VertexProperty.Cardinality.class, 131));
-            add(GryoTypeReg.of(Column.class, 132));
-            add(GryoTypeReg.of(Pop.class, 133));
-            add(GryoTypeReg.of(SackFunctions.Barrier.class, 135));
-            add(GryoTypeReg.of(TraversalOptionParent.Pick.class, 137));
-            add(GryoTypeReg.of(HashSetSupplier.class, 136, new UtilSerializers.HashSetSupplierSerializer()));
-
-            add(GryoTypeReg.of(TraverserSet.class, 58));
-            add(GryoTypeReg.of(Tree.class, 61));
-            add(GryoTypeReg.of(HashSet.class, 62));
-            add(GryoTypeReg.of(BulkSet.class, 64));
-            add(GryoTypeReg.of(MutableMetrics.class, 69));
-            add(GryoTypeReg.of(ImmutableMetrics.class, 115));
-            add(GryoTypeReg.of(DefaultTraversalMetrics.class, 70));
-            add(GryoTypeReg.of(MapMemory.class, 73));
-            add(GryoTypeReg.of(MapReduce.NullObject.class, 74));
-            add(GryoTypeReg.of(AtomicLong.class, 79));
-            add(GryoTypeReg.of(Pair.class, 88, new UtilSerializers.PairSerializer()));
-            add(GryoTypeReg.of(TraversalExplanation.class, 106, new JavaSerializer()));
-
-            add(GryoTypeReg.of(Duration.class, 93, new JavaTimeSerializers.DurationSerializer()));
-            add(GryoTypeReg.of(Instant.class, 94, new JavaTimeSerializers.InstantSerializer()));
-            add(GryoTypeReg.of(LocalDate.class, 95, new JavaTimeSerializers.LocalDateSerializer()));
-            add(GryoTypeReg.of(LocalDateTime.class, 96, new JavaTimeSerializers.LocalDateTimeSerializer()));
-            add(GryoTypeReg.of(LocalTime.class, 97, new JavaTimeSerializers.LocalTimeSerializer()));
-            add(GryoTypeReg.of(MonthDay.class, 98, new JavaTimeSerializers.MonthDaySerializer()));
-            add(GryoTypeReg.of(OffsetDateTime.class, 99, new JavaTimeSerializers.OffsetDateTimeSerializer()));
-            add(GryoTypeReg.of(OffsetTime.class, 100, new JavaTimeSerializers.OffsetTimeSerializer()));
-            add(GryoTypeReg.of(Period.class, 101, new JavaTimeSerializers.PeriodSerializer()));
-            add(GryoTypeReg.of(Year.class, 102, new JavaTimeSerializers.YearSerializer()));
-            add(GryoTypeReg.of(YearMonth.class, 103, new JavaTimeSerializers.YearMonthSerializer()));
-            add(GryoTypeReg.of(ZonedDateTime.class, 104, new JavaTimeSerializers.ZonedDateTimeSerializer()));
-            add(GryoTypeReg.of(ZoneOffset.class, 105, new JavaTimeSerializers.ZoneOffsetSerializer()));
-
-            add(GryoTypeReg.of(Operator.class, 107));
-            add(GryoTypeReg.of(FoldStep.FoldBiOperator.class, 108));
-            add(GryoTypeReg.of(GroupCountStep.GroupCountBiOperator.class, 109));
-            add(GryoTypeReg.of(GroupStep.GroupBiOperator.class, 117, new JavaSerializer()));
// because they contain traversals
-            add(GryoTypeReg.of(MeanGlobalStep.MeanGlobalBiOperator.class, 110));
-            add(GryoTypeReg.of(MeanGlobalStep.MeanNumber.class, 111));
-            add(GryoTypeReg.of(TreeStep.TreeBiOperator.class, 112));
-            add(GryoTypeReg.of(GroupStepV3d0.GroupBiOperatorV3d0.class, 113));
-            add(GryoTypeReg.of(RangeGlobalStep.RangeBiOperator.class, 114));
-            add(GryoTypeReg.of(OrderGlobalStep.OrderBiOperator.class, 118, new JavaSerializer()));
// because they contain traversals
-            add(GryoTypeReg.of(ProfileStep.ProfileBiOperator.class, 119));
-        }};
+        private final List<TypeRegistration<?>> typeRegistrations;
 
         private final List<IoRegistry> registries = new ArrayList<>();
 
@@ -410,6 +421,8 @@ public final class GryoMapper implements Mapper<Kryo> {
         private Supplier<ClassResolver> classResolver = GryoClassResolver::new;
 
         private Builder() {
+            this.typeRegistrations = initTypeRegistrations();
+
             // Validate the default registrations
             // For justification of these default registration rules, see TinkerPopKryoRegistrator
             for (TypeRegistration<?> tr : typeRegistrations) {
@@ -426,6 +439,8 @@ public final class GryoMapper implements Mapper<Kryo> {
             }
         }
 
+        public abstract List<TypeRegistration<?>> initTypeRegistrations();
+
         /**
          * {@inheritDoc}
          */

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/651b0f3b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
new file mode 100644
index 0000000..5a52290
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
@@ -0,0 +1,36 @@
+/*
+ * 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;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public enum GryoVersion {
+    V1_0("1.0");
+
+    private final String versionNumber;
+
+    GryoVersion(final String versionNumber) {
+        this.versionNumber = versionNumber;
+    }
+
+    public String getVersion() {
+        return versionNumber;
+    }
+}


Mime
View raw message