You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@streams.apache.org by robdouglas <gi...@git.apache.org> on 2014/10/28 23:44:01 UTC
[GitHub] incubator-streams pull request: Streams-203 | GooglePlus Activity ...
GitHub user robdouglas opened a pull request:
https://github.com/apache/incubator-streams/pull/115
Streams-203 | GooglePlus Activity Serialization
Created mechanisms to convert a GooglePlus Activity object to a Streams Activity object. Updated serializers and TypeConverters accordingly. Added in appropriate unit tests. Updated documentation.
Depends on changes found in: Streams-202 (this PR will shrink significantly after that is merged in)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/robdouglas/incubator-streams STREAMS-203
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-streams/pull/115.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #115
----
commit eba9aefd77273c8290324ac33370aa250da34c10
Author: Robert Douglas <rd...@w2ogroup.com>
Date: 2014-10-28T17:02:51Z
STREAMS-202 | Built a GooglePlusTypeConverter, the corresponding deserializer and all necessary tests
commit 42d0ab33f20cada4bbf71eb590a4858a1f1cad2e
Author: Robert Douglas <rd...@w2ogroup.com>
Date: 2014-10-28T17:03:57Z
STREAMS-202 | Additional modifications
commit c921f6741804f745e6d4926166bf1cf792603bbd
Author: Robert Douglas <rd...@w2ogroup.com>
Date: 2014-10-28T22:42:39Z
STREAMS-203 | Created mechanisms to convert a GooglePlus Activity object to a Streams Activity object. Updated serializers and TypeConverters accordingly. Added in appropriate unit tests. Updated documentation.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-streams pull request: Streams-203 | GooglePlus Activity ...
Posted by rbnks <gi...@git.apache.org>.
Github user rbnks commented on the pull request:
https://github.com/apache/incubator-streams/pull/115#issuecomment-61503476
:+1:
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-streams pull request: Streams-203 | GooglePlus Activity ...
Posted by rbnks <gi...@git.apache.org>.
Github user rbnks commented on a diff in the pull request:
https://github.com/apache/incubator-streams/pull/115#discussion_r19670218
--- Diff: streams-contrib/streams-provider-google/google-gplus/src/main/java/com/google/gplus/serializer/util/GPlusActivityDeserializer.java ---
@@ -0,0 +1,129 @@
+/*
+ * 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 com.google.gplus.serializer.util;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.api.client.util.DateTime;
+import com.google.api.client.util.Lists;
+import com.google.api.services.plus.model.Activity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Custom deserializer for GooglePlus' Person model
+ */
+public class GPlusActivityDeserializer extends JsonDeserializer<Activity> {
+ private final static Logger LOGGER = LoggerFactory.getLogger(GPlusActivityDeserializer.class);
+
+ /**
+ * Because the GooglePlus Activity object {@link com.google.api.services.plus.model.Activity} contains complex objects
+ * within its hierarchy, we have to use a custom deserializer
+ *
+ * @param jsonParser
+ * @param deserializationContext
+ * @return The deserialized {@link com.google.api.services.plus.model.Activity} object
+ * @throws IOException
+ * @throws JsonProcessingException
+ */
+ @Override
+ public Activity deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
--- End diff --
Can you break this method apart into multiple methods / helper functions? a 100 line method is a little too big.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-streams pull request: Streams-203 | GooglePlus Activity ...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/incubator-streams/pull/115
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-streams pull request: Streams-203 | GooglePlus Activity ...
Posted by robdouglas <gi...@git.apache.org>.
Github user robdouglas commented on a diff in the pull request:
https://github.com/apache/incubator-streams/pull/115#discussion_r19740711
--- Diff: streams-contrib/streams-provider-google/google-gplus/src/main/java/com/google/gplus/serializer/util/GPlusActivityDeserializer.java ---
@@ -0,0 +1,129 @@
+/*
+ * 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 com.google.gplus.serializer.util;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.api.client.util.DateTime;
+import com.google.api.client.util.Lists;
+import com.google.api.services.plus.model.Activity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Custom deserializer for GooglePlus' Person model
+ */
+public class GPlusActivityDeserializer extends JsonDeserializer<Activity> {
+ private final static Logger LOGGER = LoggerFactory.getLogger(GPlusActivityDeserializer.class);
+
+ /**
+ * Because the GooglePlus Activity object {@link com.google.api.services.plus.model.Activity} contains complex objects
+ * within its hierarchy, we have to use a custom deserializer
+ *
+ * @param jsonParser
+ * @param deserializationContext
+ * @return The deserialized {@link com.google.api.services.plus.model.Activity} object
+ * @throws IOException
+ * @throws JsonProcessingException
+ */
+ @Override
+ public Activity deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
--- End diff --
Will do
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-streams pull request: Streams-203 | GooglePlus Activity ...
Posted by robdouglas <gi...@git.apache.org>.
Github user robdouglas commented on the pull request:
https://github.com/apache/incubator-streams/pull/115#issuecomment-61498004
Responded to code review feedback, broke down monolithic deserialization method into smaller chunks
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---