diff --git a/magpie-api/pom.xml b/magpie-api/pom.xml
index 983b59f5..961806cf 100644
--- a/magpie-api/pom.xml
+++ b/magpie-api/pom.xml
@@ -3,7 +3,7 @@
magpie-parent
io.openraven.magpie
- 0.10.1-SNAPSHOT
+ 0.10.2-SNAPSHOT
4.0.0
diff --git a/magpie-aws/pom.xml b/magpie-aws/pom.xml
index c6dcc00f..32a1116e 100644
--- a/magpie-aws/pom.xml
+++ b/magpie-aws/pom.xml
@@ -3,7 +3,7 @@
magpie-parent
io.openraven.magpie
- 0.10.1-SNAPSHOT
+ 0.10.2-SNAPSHOT
4.0.0
diff --git a/magpie-azure/pom.xml b/magpie-azure/pom.xml
index 1409143c..c43a011d 100644
--- a/magpie-azure/pom.xml
+++ b/magpie-azure/pom.xml
@@ -4,7 +4,7 @@
io.openraven.magpie
magpie-parent
- 0.10.1-SNAPSHOT
+ 0.10.2-SNAPSHOT
magpie-azure
diff --git a/magpie-cli/pom.xml b/magpie-cli/pom.xml
index 36abab8d..86fc37a3 100644
--- a/magpie-cli/pom.xml
+++ b/magpie-cli/pom.xml
@@ -3,7 +3,7 @@
magpie-parent
io.openraven.magpie
- 0.10.1-SNAPSHOT
+ 0.10.2-SNAPSHOT
4.0.0
diff --git a/magpie-core/pom.xml b/magpie-core/pom.xml
index dc30ffd1..1a3b0022 100644
--- a/magpie-core/pom.xml
+++ b/magpie-core/pom.xml
@@ -3,7 +3,7 @@
magpie-parent
io.openraven.magpie
- 0.10.1-SNAPSHOT
+ 0.10.2-SNAPSHOT
4.0.0
@@ -54,7 +54,7 @@
io.openraven.magpie
magpie-persist
- 0.10.1-SNAPSHOT
+ 0.10.2-SNAPSHOT
compile
diff --git a/magpie-data/pom.xml b/magpie-data/pom.xml
index b1a34a40..5543770c 100644
--- a/magpie-data/pom.xml
+++ b/magpie-data/pom.xml
@@ -3,7 +3,7 @@
magpie-parent
io.openraven.magpie
- 0.10.1-SNAPSHOT
+ 0.10.2-SNAPSHOT
4.0.0
diff --git a/magpie-gcp/pom.xml b/magpie-gcp/pom.xml
index bc4ec009..35b86d50 100644
--- a/magpie-gcp/pom.xml
+++ b/magpie-gcp/pom.xml
@@ -3,7 +3,7 @@
magpie-parent
io.openraven.magpie
- 0.10.1-SNAPSHOT
+ 0.10.2-SNAPSHOT
4.0.0
diff --git a/magpie-gcp/src/main/java/io/openraven/magpie/plugins/gcp/discovery/GCPUtils.java b/magpie-gcp/src/main/java/io/openraven/magpie/plugins/gcp/discovery/GCPUtils.java
index 85354b82..5aeb5612 100644
--- a/magpie-gcp/src/main/java/io/openraven/magpie/plugins/gcp/discovery/GCPUtils.java
+++ b/magpie-gcp/src/main/java/io/openraven/magpie/plugins/gcp/discovery/GCPUtils.java
@@ -22,6 +22,7 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.appengine.repackaged.com.google.common.base.Pair;
+import com.google.appengine.repackaged.org.joda.time.LocalDate;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
@@ -38,7 +39,9 @@
import java.lang.reflect.Type;
import java.time.Duration;
import java.time.Instant;
+import java.time.LocalDateTime;
import java.time.OffsetDateTime;
+import java.time.format.DateTimeFormatter;
public class GCPUtils {
@@ -49,12 +52,34 @@ public JsonElement serialize(Duration duration, Type type, JsonSerializationCont
return new JsonPrimitive(duration.toString());
}
}
+
+ static class LocalDateTimeSerializer implements JsonSerializer {
+ private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MMM-dd HH:mm:ss");
+
+ @Override
+ public JsonElement serialize(LocalDateTime localDateTime, Type srcType, JsonSerializationContext context) {
+ return new JsonPrimitive(formatter.format(localDateTime));
+ }
+ }
+
+ static class OffsetDateTimeSerializer implements JsonSerializer {
+ private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MMM-dd HH:mm:ss");
+
+ @Override
+ public JsonElement serialize(OffsetDateTime offsetDateTime, Type srcType, JsonSerializationContext context) {
+ return new JsonPrimitive(formatter.format(offsetDateTime));
+ }
+ }
+
private static final Logger logger = LoggerFactory.getLogger(GCPUtils.class);
private static final ObjectMapper mapper = createObjectMapper();
private static final Gson GSON = new GsonBuilder()
.setPrettyPrinting()
.registerTypeAdapter(OffsetDateTime.class, (JsonDeserializer) (json, type, context) -> OffsetDateTime.parse(json.getAsString()))
+ .registerTypeAdapter(LocalDateTime.class, (JsonDeserializer) (json, type, context) -> LocalDateTime.parse(json.getAsString()))
+ .registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer())
+ .registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeSerializer())
.registerTypeAdapter(Duration.class, new DurationSerializer())
.create();
diff --git a/magpie-json/pom.xml b/magpie-json/pom.xml
index a0bcf10b..cccf97b5 100644
--- a/magpie-json/pom.xml
+++ b/magpie-json/pom.xml
@@ -3,7 +3,7 @@
magpie-parent
io.openraven.magpie
- 0.10.1-SNAPSHOT
+ 0.10.2-SNAPSHOT
4.0.0
diff --git a/magpie-persist/pom.xml b/magpie-persist/pom.xml
index b50fa150..7e1ae46e 100644
--- a/magpie-persist/pom.xml
+++ b/magpie-persist/pom.xml
@@ -3,7 +3,7 @@
magpie-parent
io.openraven.magpie
- 0.10.1-SNAPSHOT
+ 0.10.2-SNAPSHOT
4.0.0
diff --git a/magpie-policy-output-csv/pom.xml b/magpie-policy-output-csv/pom.xml
index 06b3c82b..46606af2 100644
--- a/magpie-policy-output-csv/pom.xml
+++ b/magpie-policy-output-csv/pom.xml
@@ -3,7 +3,7 @@
magpie-parent
io.openraven.magpie
- 0.10.1-SNAPSHOT
+ 0.10.2-SNAPSHOT
4.0.0
diff --git a/magpie-policy-output-json/pom.xml b/magpie-policy-output-json/pom.xml
index 737f9995..97aad758 100644
--- a/magpie-policy-output-json/pom.xml
+++ b/magpie-policy-output-json/pom.xml
@@ -3,7 +3,7 @@
magpie-parent
io.openraven.magpie
- 0.10.1-SNAPSHOT
+ 0.10.2-SNAPSHOT
4.0.0
diff --git a/magpie-policy-output-text/pom.xml b/magpie-policy-output-text/pom.xml
index 3d0e523a..7102e8bb 100644
--- a/magpie-policy-output-text/pom.xml
+++ b/magpie-policy-output-text/pom.xml
@@ -3,7 +3,7 @@
magpie-parent
io.openraven.magpie
- 0.10.1-SNAPSHOT
+ 0.10.2-SNAPSHOT
4.0.0
diff --git a/pom.xml b/pom.xml
index ae3185a2..cb067191 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
io.openraven.magpie
magpie-parent
pom
- 0.10.1-SNAPSHOT
+ 0.10.2-SNAPSHOT
Open Raven Magpie
https://github.com/openraven/magpie
Open Raven's Magpie Project