Github user meiercaleb commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/240#discussion_r145809455
--- Diff:
extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/query/CommonNodeMetadataImpl.java
---
@@ -0,0 +1,109 @@
+/*
+ * 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.rya.indexing.pcj.fluo.app.query;
+
+import java.lang.reflect.Type;
+
+import org.apache.log4j.Logger;
+import org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder;
+
+import com.google.common.base.Optional;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonPrimitive;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+
+/**
+ * Implementation of {@link CommonNodeMetadata} for storing metadata
nodeIds and
+ * {@link VariableOrder}s. This class is used primarily for storing
Aggregation State
+ * Metadata.
+ */
+public class CommonNodeMetadataImpl extends CommonNodeMetadata {
+
+ public CommonNodeMetadataImpl(String nodeId, VariableOrder varOrder) {
+ super(nodeId, varOrder);
+ }
+
+ public CommonNodeMetadataImpl(CommonNodeMetadataImpl metadata) {
+ super(metadata.getNodeId(), metadata.getVariableOrder());
+ }
+
+ /**
+ * Reads/Writes instances of {@link CommonNodeMetadataImpl} to/from
Json Strings.
+ */
+ public static class CommonNodeMetadataSerDe {
+
+ private static Logger log =
Logger.getLogger(CommonNodeMetadataSerDe.class);
+ private static Gson gson = new
GsonBuilder().registerTypeAdapter(CommonNodeMetadataImpl.class, new
CommonNodeTypeAdapter())
+ .create();
+
+ public static String serialize(CommonNodeMetadataImpl metadata) {
+ try {
+ return gson.toJson(metadata);
+ } catch (Exception e) {
+ log.info("Unable to serialize BatchInformation: " +
metadata);
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static Optional<CommonNodeMetadataImpl> deserialize(String
json) {
--- End diff --
Done
---