You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by sb...@apache.org on 2014/05/05 20:54:35 UTC
[48/52] [abbrv] git commit: Documentation per STREAMS-44
Documentation per STREAMS-44
Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/9f0a71a1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/9f0a71a1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/9f0a71a1
Branch: refs/heads/sblackmon
Commit: 9f0a71a1fb77f044d501658f4a450e0b8505b60d
Parents: c49e600
Author: sblackmon <sb...@w2odigital.com>
Authored: Thu Apr 17 11:55:22 2014 -0500
Committer: sblackmon <sb...@w2odigital.com>
Committed: Thu Apr 17 11:55:22 2014 -0500
----------------------------------------------------------------------
.../SysomosJsonActivitySerializer.mup | 316 +++++++++++++++++
.../SysomosJsonActivitySerializer.png | Bin 0 -> 121779 bytes
.../SysomosXmlJsonConverter.png | Bin 0 -> 151206 bytes
.../SysomosXmlJsonSerializer.mup | 335 +++++++++++++++++++
.../processor/SysomosXmlJsonConverter.java | 45 +++
.../SysomosXmlActivitySerializer.java | 60 ++++
.../src/main/xmlschema/com/sysomos/sysomos.xsd | 2 +-
7 files changed, 757 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/9f0a71a1/streams-contrib/streams-provider-sysomos/SysomosJsonActivitySerializer.mup
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-sysomos/SysomosJsonActivitySerializer.mup b/streams-contrib/streams-provider-sysomos/SysomosJsonActivitySerializer.mup
new file mode 100644
index 0000000..c32f2e5
--- /dev/null
+++ b/streams-contrib/streams-provider-sysomos/SysomosJsonActivitySerializer.mup
@@ -0,0 +1,316 @@
+{
+ "title": "SysomosJsonActivitySerializer",
+ "id": 1,
+ "formatVersion": 2,
+ "ideas": {
+ "1": {
+ "title": "activity",
+ "id": 53,
+ "ideas": {
+ "1": {
+ "title": "id",
+ "id": 54
+ },
+ "2": {
+ "title": "published",
+ "id": 55
+ },
+ "3": {
+ "title": "provider\nsysomos:$.mediaType",
+ "id": 58
+ },
+ "4": {
+ "title": "extensions",
+ "id": 59,
+ "ideas": {
+ "1": {
+ "title": "sysomos",
+ "id": 60
+ }
+ }
+ },
+ "5": {
+ "title": "url",
+ "id": 65
+ },
+ "0.5": {
+ "title": "content",
+ "id": 56
+ },
+ "0.25": {
+ "title": "title",
+ "id": 57
+ },
+ "0.125": {
+ "title": "actor",
+ "id": 61,
+ "ideas": {
+ "1": {
+ "title": "id",
+ "id": 62,
+ "ideas": {}
+ }
+ }
+ }
+ }
+ },
+ "-10": {
+ "title": "sysomos",
+ "id": 2,
+ "ideas": {
+ "2": {
+ "title": "twitterFollowers",
+ "id": 26,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "3": {
+ "title": "twitterFollowing",
+ "id": 27,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "4": {
+ "title": "docid",
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ },
+ "id": 28
+ },
+ "5": {
+ "title": "mediaType",
+ "id": 29,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "6": {
+ "title": "time",
+ "id": 30,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "7": {
+ "title": "title",
+ "id": 31,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "8": {
+ "title": "content",
+ "id": 32,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "9": {
+ "title": "link",
+ "id": 33,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "10": {
+ "title": "gender",
+ "id": 34,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "11": {
+ "title": "location",
+ "ideas": {
+ "1": {
+ "title": "country",
+ "id": 36
+ },
+ "2": {
+ "title": "locationString",
+ "id": 37
+ }
+ },
+ "id": 35,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "12": {
+ "title": "influenceLevel",
+ "id": 38,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "13": {
+ "title": "sentiment",
+ "id": 39,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "14": {
+ "title": "tweetid",
+ "id": 40,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "15": {
+ "title": "tweetJsonLink",
+ "id": 41,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "3.5": {
+ "title": "tweetHbLink",
+ "id": 25,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "3.75": {
+ "title": "tags",
+ "id": 42,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ },
+ "ideas": {
+ "1": {
+ "title": "FBID",
+ "id": 68
+ }
+ }
+ }
+ }
+ }
+ },
+ "links": [
+ {
+ "ideaIdFrom": 4,
+ "ideaIdTo": 42,
+ "attr": {
+ "style": {
+ "color": "#FF0000",
+ "lineStyle": "dashed"
+ }
+ }
+ },
+ {
+ "ideaIdFrom": 28,
+ "ideaIdTo": 54,
+ "attr": {
+ "style": {
+ "color": "#FF0000",
+ "lineStyle": "dashed"
+ }
+ }
+ },
+ {
+ "ideaIdFrom": 30,
+ "ideaIdTo": 55,
+ "attr": {
+ "style": {
+ "color": "#FF0000",
+ "lineStyle": "dashed"
+ }
+ }
+ },
+ {
+ "ideaIdFrom": 32,
+ "ideaIdTo": 56,
+ "attr": {
+ "style": {
+ "color": "#FF0000",
+ "lineStyle": "dashed"
+ }
+ }
+ },
+ {
+ "ideaIdFrom": 31,
+ "ideaIdTo": 57,
+ "attr": {
+ "style": {
+ "color": "#FF0000",
+ "lineStyle": "dashed"
+ }
+ }
+ },
+ {
+ "ideaIdFrom": 2,
+ "ideaIdTo": 60,
+ "attr": {
+ "style": {
+ "color": "#FF0000",
+ "lineStyle": "dashed"
+ }
+ }
+ },
+ {
+ "ideaIdFrom": 33,
+ "ideaIdTo": 65,
+ "attr": {
+ "style": {
+ "color": "#FF0000",
+ "lineStyle": "dashed"
+ }
+ }
+ },
+ {
+ "ideaIdFrom": 29,
+ "ideaIdTo": 58,
+ "attr": {
+ "style": {
+ "color": "#FF0000",
+ "lineStyle": "dashed"
+ }
+ }
+ },
+ {
+ "ideaIdFrom": 68,
+ "ideaIdTo": 62,
+ "attr": {
+ "style": {
+ "color": "#FF0000",
+ "lineStyle": "dashed"
+ }
+ }
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/9f0a71a1/streams-contrib/streams-provider-sysomos/SysomosJsonActivitySerializer.png
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-sysomos/SysomosJsonActivitySerializer.png b/streams-contrib/streams-provider-sysomos/SysomosJsonActivitySerializer.png
new file mode 100644
index 0000000..4e6b870
Binary files /dev/null and b/streams-contrib/streams-provider-sysomos/SysomosJsonActivitySerializer.png differ
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/9f0a71a1/streams-contrib/streams-provider-sysomos/SysomosXmlJsonConverter.png
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-sysomos/SysomosXmlJsonConverter.png b/streams-contrib/streams-provider-sysomos/SysomosXmlJsonConverter.png
new file mode 100644
index 0000000..cabbf41
Binary files /dev/null and b/streams-contrib/streams-provider-sysomos/SysomosXmlJsonConverter.png differ
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/9f0a71a1/streams-contrib/streams-provider-sysomos/SysomosXmlJsonSerializer.mup
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-sysomos/SysomosXmlJsonSerializer.mup b/streams-contrib/streams-provider-sysomos/SysomosXmlJsonSerializer.mup
new file mode 100644
index 0000000..77f81d1
--- /dev/null
+++ b/streams-contrib/streams-provider-sysomos/SysomosXmlJsonSerializer.mup
@@ -0,0 +1,335 @@
+{
+ "title": "SysomosXmlJsonSerializer",
+ "id": 1,
+ "formatVersion": 2,
+ "ideas": {
+ "1": {
+ "title": "sysomos",
+ "id": 2,
+ "ideas": {
+ "1": {
+ "title": "tweetHbLink",
+ "id": 25,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "2": {
+ "title": "twitterFollowers",
+ "id": 26,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "3": {
+ "title": "twitterFollowing",
+ "id": 27,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "4": {
+ "title": "docid",
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ },
+ "id": 28
+ },
+ "5": {
+ "title": "mediaType",
+ "id": 29,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "6": {
+ "title": "time",
+ "id": 30,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "7": {
+ "title": "title",
+ "id": 31,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "8": {
+ "title": "content",
+ "id": 32,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "9": {
+ "title": "link",
+ "id": 33,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "10": {
+ "title": "gender",
+ "id": 34,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "11": {
+ "title": "location",
+ "ideas": {
+ "1": {
+ "title": "country",
+ "id": 36
+ },
+ "2": {
+ "title": "locationString",
+ "id": 37
+ }
+ },
+ "id": 35,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "12": {
+ "title": "influenceLevel",
+ "id": 38,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "13": {
+ "title": "sentiment",
+ "id": 39,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "14": {
+ "title": "tweetid",
+ "id": 40,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "15": {
+ "title": "tweetJsonLink",
+ "id": 41,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "25": {
+ "title": "tags",
+ "id": 42,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ },
+ "ideas": {
+ "1": {
+ "title": "\"$displayName\": \"$value\"\nonly where systemType != SYSTEM",
+ "id": 51,
+ "attr": {
+ "style": {
+ "background": "#00ffff"
+ }
+ }
+ }
+ }
+ },
+ "26": {
+ "title": "systemTags",
+ "id": 49,
+ "ideas": {
+ "1": {
+ "title": "\"$displayName\": \"$value\"only where systemType == SYSTEM",
+ "attr": {
+ "style": {
+ "background": "#00ffff"
+ }
+ },
+ "id": 52
+ }
+ }
+ }
+ }
+ },
+ "-1": {
+ "title": "beatResponse",
+ "id": 3,
+ "ideas": {
+ "3": {
+ "title": "beat",
+ "id": 7,
+ "ideas": {
+ "2": {
+ "title": "docid",
+ "id": 5,
+ "attr": {
+ "style": {
+ "background": "#E0E0E0"
+ }
+ }
+ },
+ "3": {
+ "title": "mediaType",
+ "id": 8
+ },
+ "4": {
+ "title": "time",
+ "id": 9
+ },
+ "5": {
+ "title": "title",
+ "id": 10
+ },
+ "6": {
+ "title": "content",
+ "id": 11
+ },
+ "7": {
+ "title": "link",
+ "id": 12
+ },
+ "8": {
+ "title": "gender",
+ "id": 13
+ },
+ "9": {
+ "title": "location",
+ "id": 14,
+ "ideas": {
+ "1": {
+ "title": "country",
+ "id": 15
+ },
+ "2": {
+ "title": "locationString",
+ "id": 16
+ }
+ }
+ },
+ "10": {
+ "title": "influenceLevel",
+ "id": 17
+ },
+ "11": {
+ "title": "sentiment",
+ "id": 18
+ },
+ "12": {
+ "title": "tweetid",
+ "id": 19
+ },
+ "13": {
+ "title": "tweetJsonLink",
+ "id": 20
+ },
+ "14": {
+ "title": "tweetHbLink",
+ "id": 21
+ },
+ "15": {
+ "title": "twitterFollowers",
+ "id": 22
+ },
+ "16": {
+ "title": "twitterFollowing",
+ "id": 24
+ },
+ "26": {
+ "title": "tag",
+ "id": 4,
+ "attr": {
+ "style": {
+ "background": "transparent"
+ }
+ },
+ "ideas": {
+ "1": {
+ "title": "value",
+ "id": 46
+ },
+ "2": {
+ "title": "systemType",
+ "id": 48
+ },
+ "0.5": {
+ "title": "displayName",
+ "id": 47
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "links": [
+ {
+ "ideaIdFrom": 3,
+ "ideaIdTo": 2,
+ "attr": {
+ "style": {
+ "color": "#FF0000",
+ "lineStyle": "dashed"
+ }
+ }
+ },
+ {
+ "ideaIdFrom": 4,
+ "ideaIdTo": 42,
+ "attr": {
+ "style": {
+ "color": "#FF0000",
+ "lineStyle": "dashed"
+ }
+ }
+ },
+ {
+ "ideaIdFrom": 4,
+ "ideaIdTo": 49,
+ "attr": {
+ "style": {
+ "color": "#FF0000",
+ "lineStyle": "dashed"
+ }
+ }
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/9f0a71a1/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/processor/SysomosXmlJsonConverter.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/processor/SysomosXmlJsonConverter.java b/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/processor/SysomosXmlJsonConverter.java
new file mode 100644
index 0000000..efa489c
--- /dev/null
+++ b/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/processor/SysomosXmlJsonConverter.java
@@ -0,0 +1,45 @@
+package org.apache.streams.sysomos.processor;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.base.Joiner;
+import com.google.common.collect.Lists;
+import org.apache.commons.lang.NotImplementedException;
+import org.apache.streams.core.StreamsDatum;
+import org.apache.streams.core.StreamsProcessor;
+import org.apache.streams.data.ActivitySerializer;
+import org.apache.streams.exceptions.ActivitySerializerException;
+import org.apache.streams.pojo.json.Activity;
+import org.apache.streams.pojo.json.Provider;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by sblackmon on 3/26/14.
+ */
+public class SysomosXmlJsonConverter implements StreamsProcessor
+{
+
+ public SysomosXmlJsonConverter() {
+
+ }
+
+ @Override
+ public List<StreamsDatum> process(StreamsDatum entry) {
+
+ // this class converts individual XML fragments from heartbeat API
+ // into beans that match the sysomos jsonschema, one per post
+
+ return Lists.newArrayList();
+ }
+
+ @Override
+ public void prepare(Object configurationObject) {
+
+ }
+
+ @Override
+ public void cleanUp() {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/9f0a71a1/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/serializer/SysomosXmlActivitySerializer.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/serializer/SysomosXmlActivitySerializer.java b/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/serializer/SysomosXmlActivitySerializer.java
new file mode 100644
index 0000000..be40bdb
--- /dev/null
+++ b/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/serializer/SysomosXmlActivitySerializer.java
@@ -0,0 +1,60 @@
+package org.apache.streams.sysomos.serializer;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.base.Joiner;
+import com.google.common.collect.Lists;
+import org.apache.commons.lang.NotImplementedException;
+import org.apache.streams.data.ActivitySerializer;
+import org.apache.streams.exceptions.ActivitySerializerException;
+import org.apache.streams.pojo.json.Activity;
+import org.apache.streams.pojo.json.Provider;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by sblackmon on 3/26/14.
+ */
+public class SysomosXmlActivitySerializer implements ActivitySerializer<String>
+{
+
+ public SysomosXmlActivitySerializer() {
+
+ }
+
+ @Override
+ public String serializationFormat() {
+ return null;
+ }
+
+ @Override
+ public String serialize(Activity deserialized) throws ActivitySerializerException {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public Activity deserialize(String serialized) throws ActivitySerializerException {
+
+ return null;
+ }
+
+ @Override
+ public List<Activity> deserializeAll(List<String> serializedList) {
+ throw new NotImplementedException();
+ }
+
+ public static Provider getProvider() {
+ Provider provider = new Provider();
+ provider.setId(formatId("id:sysomos"));
+ return provider;
+ }
+
+ public static void addSysomosExtension(Activity activity, ObjectNode event) {
+ Map<String, Object> extensions = org.apache.streams.data.util.ActivityUtil.ensureExtensions(activity);
+ extensions.put("sysomos", event);
+ }
+
+ public static String formatId(String... idparts) {
+ return Joiner.on(":").join(Lists.asList("id:sysomos", idparts));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/9f0a71a1/streams-contrib/streams-provider-sysomos/src/main/xmlschema/com/sysomos/sysomos.xsd
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-sysomos/src/main/xmlschema/com/sysomos/sysomos.xsd b/streams-contrib/streams-provider-sysomos/src/main/xmlschema/com/sysomos/sysomos.xsd
index b41ecfe..6558189 100644
--- a/streams-contrib/streams-provider-sysomos/src/main/xmlschema/com/sysomos/sysomos.xsd
+++ b/streams-contrib/streams-provider-sysomos/src/main/xmlschema/com/sysomos/sysomos.xsd
@@ -50,7 +50,7 @@
<xs:element type="xs:anyURI" name="tweetJsonLink" minOccurs="0"/>
<xs:element type="xs:anyURI" name="tweetHbLink" minOccurs="0"/>
<xs:element type="xs:string" name="twitterFollowers" minOccurs="0"/>
- <xs:element type="xs:string" name="twitterFollowing" minOccurs="0"/>
+ <xs:element type="xs:string" name=" " minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>