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/01/09 18:27:58 UTC
svn commit: r1556893 [15/25] - in /incubator/streams/branches/sblackmon: ./
streams-config-graph/ streams-config-graph/src/
streams-config-graph/src/main/ streams-config-graph/src/main/java/
streams-config-graph/src/main/java/org/ streams-config-graph/...
Added: incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-reddit/src/test/resources/redditTest.xml
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-reddit/src/test/resources/redditTest.xml?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-reddit/src/test/resources/redditTest.xml (added)
+++ incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-reddit/src/test/resources/redditTest.xml Thu Jan 9 17:27:50 2014
@@ -0,0 +1 @@
+<entry xmlns="http://www.w3.org/2005/Atom" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:service="http://activitystrea.ms/service-provider" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:gnip="http://www.gnip.com/schemas/2010"> <id>1088dt</id> <published>2012-09-21T03:28:15Z</published> <updated>2012-09-21T03:28:15Z</updated> <title>Precious_Zest posted an article Reddit</title> <category term="ArticlePosted" label="Article Posted"/> <link rel="alternate" type="text/html" href="http://www.reddit.com/r/atheism/comments/1088dt/a_classy_new_way_to_respond_to_stupid_fundie/"/> <source> <link rel="self" type="application/json" href="http://com.facebook.api.reddit.com/search.json?q=%22zest%22%20%20%22%22%20%20--%22%22&limit=100&after=t3_1brddb"/> <title>Reddit - Keyword - Search (Recent) - "zest" "" --""</title> <updated>2013-08-28T17-54-04Z</updated> <gnip:rule xmlns:gnip="http://www.gnip.com/schemas/2010">"zest" "" --"" </gnip
:rule> </source> <service:provider> <name>Reddit</name> <uri>www.reddit.com</uri> </service:provider> <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb> <activity:object> <activity:object-type>http://activitystrea.ms/schema/1.0/article</activity:object-type> <id>1088dt</id> <title>A classy new way to respond to stupid fundie claims (X-post from r/funny) </title> <link rel="alternate" type="text/html" href="http://www.reddit.com/r/atheism/comments/1088dt/a_classy_new_way_to_respond_to_stupid_fundie/"/> <link rel="enclosure" type="text/html" href="http://i.imgur.com/ZphAO.png"/> <link rel="preview" type="image/jpeg" href="http://a.thumbs.redditmedia.com/iL3sa_rwh2j-WA7H.jpg"/> <gnip:statistics upVotes="220" downVotes="69"/> </activity:object> <author> <name>Precious_Zest</name> <uri>http://www.reddit.com/user/Precious_Zest</uri> </author> <activity:actor> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:obje
ct-type> <link rel="alternate" type="text/html" length="0" href="http://www.reddit.com/user/Precious_Zest"/> <id>http://www.reddit.com/user/Precious_Zest</id> </activity:actor> <gnip:matching_rules> <gnip:matching_rule rel="source" tag="Zest">"zest" "" --""</gnip:matching_rule> </gnip:matching_rules> </entry>
\ No newline at end of file
Added: incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/pom.xml
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/pom.xml?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/pom.xml (added)
+++ incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/pom.xml Thu Jan 9 17:27:50 2014
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>streams-provider-gnip</artifactId>
+ <groupId>org.apache.streams</groupId>
+ <version>0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>gnip-edc-youtube</artifactId>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jsonschema2pojo</groupId>
+ <artifactId>jsonschema2pojo-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.streams</groupId>
+ <artifactId>streams-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.streams</groupId>
+ <artifactId>streams-pojo</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.streams</groupId>
+ <artifactId>gnip-powertrack</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml</groupId>
+ <artifactId>aalto-xml</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <!--<sourceDirectory>src/main/java</sourceDirectory>-->
+ <testSourceDirectory>src/test/java</testSourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <id>add-source-jaxb2</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/generated-sources/jaxb2</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ <configuration>
+ <schemaDirectory>src/main/xmlschema/com/flickr/</schemaDirectory>
+ <generateDirectory>target/generated-sources/jaxb2</generateDirectory>
+ <verbose>true</verbose>
+ <debug>true</debug>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ <forceRegenerate>true</forceRegenerate>
+ <removeOldOutput>false</removeOldOutput>
+ <generatePackage>com.flickr.api</generatePackage>
+ <plugins>
+ <plugin>
+ <groupId>org.jvnet.jaxb2_commons</groupId>
+ <artifactId>jaxb2-basics</artifactId>
+ <version>0.6.5</version>
+ </plugin>
+ </plugins>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+</project>
\ No newline at end of file
Added: incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/src/test/java/com/gnip/test/YouTubeEDCSerDeTest.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/src/test/java/com/gnip/test/YouTubeEDCSerDeTest.java?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/src/test/java/com/gnip/test/YouTubeEDCSerDeTest.java (added)
+++ incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/src/test/java/com/gnip/test/YouTubeEDCSerDeTest.java Thu Jan 9 17:27:50 2014
@@ -0,0 +1,68 @@
+package test.java.com.gnip.test;
+
+//import org.codehaus.jackson.map.ObjectMapper;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+//import com.fasterxml.jackson.xml.XmlMapper;
+//import com.gnip.xmlpojo.generated.FacebookEDC;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: rebanks
+ * Date: 8/21/13
+ * Time: 11:53 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class YouTubeEDCSerDeTest {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(YouTubeEDCSerDeTest.class);
+
+ private ObjectMapper mapper = new ObjectMapper();
+// XmlMapper mapper = new XmlMapper();
+
+ @Test
+ public void Tests() throws Exception
+ {
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
+ mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, Boolean.TRUE);
+ mapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, Boolean.TRUE);
+
+ InputStream is = YouTubeEDCSerDeTest.class.getResourceAsStream("/YoutubeEDC.xml");
+ if(is == null) System.out.println("null");
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ XmlMapper xmlMapper = new XmlMapper();
+ xmlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
+ xmlMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, Boolean.TRUE);
+ xmlMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, Boolean.TRUE);
+
+ ObjectMapper jsonMapper = new ObjectMapper();
+
+ try {
+ while (br.ready()) {
+ String line = br.readLine();
+ //LOGGER.debug(line);
+
+ Object activityObject = xmlMapper.readValue(line, Object.class);
+
+ String jsonObject = jsonMapper.writeValueAsString(activityObject);
+
+ //LOGGER.debug(jsonObject);
+ }
+ } catch( Exception e ) {
+ e.printStackTrace();
+ Assert.fail();
+ }
+ }
+}
Added: incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/src/test/java/com/gnip/test/YoutubeEDCAsActivityTest.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/src/test/java/com/gnip/test/YoutubeEDCAsActivityTest.java?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/src/test/java/com/gnip/test/YoutubeEDCAsActivityTest.java (added)
+++ incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/src/test/java/com/gnip/test/YoutubeEDCAsActivityTest.java Thu Jan 9 17:27:50 2014
@@ -0,0 +1,96 @@
+/*
+ * 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
+ *
+ * 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 test.java.com.gnip.test;
+
+//import org.codehaus.jackson.map.ObjectMapper;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+import org.apache.streams.gnip.powertrack.GnipActivityFixer;
+import org.apache.streams.pojo.json.Activity;
+import org.json.JSONObject;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+//import com.fasterxml.jackson.xml.XmlMapper;
+//import com.gnip.xmlpojo.generated.FacebookEDC;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: rebanks
+ * Date: 8/21/13
+ * Time: 11:53 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class YoutubeEDCAsActivityTest {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(YoutubeEDCAsActivityTest.class);
+
+ private ObjectMapper mapper = new ObjectMapper();
+// XmlMapper mapper = new XmlMapper();
+
+ @Test @Ignore
+ public void Tests() throws Exception
+ {
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
+ mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, Boolean.TRUE);
+ mapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, Boolean.TRUE);
+
+ InputStream is = YoutubeEDCAsActivityTest.class.getResourceAsStream("/YoutubeEDC.xml");
+ if(is == null) System.out.println("null");
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ XmlMapper xmlMapper = new XmlMapper();
+ xmlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
+ xmlMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, Boolean.TRUE);
+ xmlMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, Boolean.TRUE);
+
+ ObjectMapper jsonMapper = new ObjectMapper();
+
+ try {
+ while (br.ready()) {
+ String line = br.readLine();
+ //LOGGER.debug(line);
+
+ Object activityObject = xmlMapper.readValue(line, Object.class);
+
+ String jsonString = jsonMapper.writeValueAsString(activityObject);
+
+ JSONObject jsonObject = new JSONObject(jsonString);
+
+ JSONObject fixedObject = GnipActivityFixer.fix(jsonObject);
+
+ Activity activity = jsonMapper.readValue(fixedObject.toString(), Activity.class);
+
+ //LOGGER.debug(des);
+ }
+ } catch( Exception e ) {
+ e.printStackTrace();
+ Assert.fail();
+ }
+ }
+}
Added: incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/src/test/resources/YoutubeEDC.xml
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/src/test/resources/YoutubeEDC.xml?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/src/test/resources/YoutubeEDC.xml (added)
+++ incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-edc-youtube/src/test/resources/YoutubeEDC.xml Thu Jan 9 17:27:50 2014
@@ -0,0 +1,8 @@
+<entry xmlns:gnip="http://www.gnip.com/schemas/2010" xmlns="http://www.w3.org/2005/Atom"> <id>http://gdata.youtube.com/feeds/api/videos/9wWOaUX8e7U</id> <published>2013-08-21T14:11:40.000Z</published> <updated>2013-08-21T14:15:11.000Z</updated> <title>girls fail compilation posted a video to YouTube</title> <category term="VideoPosted" label="Video Posted"/> <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=9wWOaUX8e7U&feature=youtube_gdata"/> <source> <link rel="self" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos?q=%28%28maybelline%20%7C%20maybellines%20%7C%20mybelline%20%7C%20mybellines%20%7C%20mayballine%20%7C%20mayballines%29%20%28makeover%20%7C%20makeovers%20%7C%20%22make%20over%22%20%7C%20%22make%20overs%22%20%7C%20nail%20%7C%20nails%20%7C%20manicure%20%7C%20manicures%20%7C%20pedicure%20%7C%20pedicures%20%7C%20mani%20%7C%20pedi%20%7C%20foundation%20%7C%20mascara%20%7C%20mascaras%20%7C%20concealer%20%7C%20c&a
mp;orderby=published"/> <title>YouTube - Keyword - Uploads - ((maybelline | maybellines | mybelline | mybellines | mayballine | mayballines) (makeover | makeovers | "make over" | "make overs" | nail | nails | manicure | manicures | pedicure | pedicures | mani | pedi | foundation | mascara | mascaras | concealer | c</title> <updated>2013-08-21T09-04-45Z</updated> <gnip:rule xmlns:gnip="http://www.gnip.com/schemas/2010">((maybelline | maybellines | mybelline | mybellines | mayballine | mayballines) (makeover | makeovers | "make over" | "make overs" | nail | nails | manicure | manicures | pedicure | pedicures | mani | pedi | foundation | mascara | mascaras | concealer | c</gnip:rule> </source> <service:provider xmlns:service="http://activitystrea.ms/service-provider"> <name>YouTube</name> <uri>http://www.youtube.com/</uri> <icon/> </service:provider> <activity:verb xmlns:activity="http://activitystrea.ms/spec/1.0/">http://activitystrea.ms/schema/1.0/post</activity
:verb> <activity:object xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/video</activity:object-type> <id>object:http://gdata.youtube.com/feeds/api/videos/9wWOaUX8e7U</id> <title type="text">Maybelline Makeup Tutorial 2013 BIBHU MOHAPATRA Fall HD</title> <content type="text">Fail Compilation 2013 HD FAILS / WINS COMPILATION 2013 funny videos to share, failure compilation funny videos to see, funny video to watch funny vid video, ...</content> <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=9wWOaUX8e7U&feature=youtube_gdata"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" rel="enclosure" type="application/x-shockwave-flash" href="http://www.youtube.com/v/9wWOaUX8e7U?version=3&f=videos&app=youtube_gdata" atommedia1:duration="113"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" rel="preview" href="http://i.ytimg.com/vi/9wWOaUX8e7U/0
.jpg" atommedia1:height="360" atommedia1:width="480" atommedia1:duration="00:00:56.500"/> <category scheme="http://gdata.youtube.com/schemas/2007/categories.cat" term="Comedy"/> </activity:object> <author> <name>girls fail compilation</name> <uri>http://www.youtube.com/user/girls fail compilation</uri> </author> <activity:author xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link rel="alternate" type="text/html" length="0" href="http://www.youtube.com/user/girls fail compilation"/> <id>http://gdata.youtube.com/feeds/api/users/us7R7STuzmlwhqKH481qWg</id> </activity:author> <activity:actor xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link rel="alternate" type="text/html" length="0" href="http://www.youtube.com/user/girls fail compilation"/> <id>http://gdata.youtube.co
m/feeds/api/users/us7R7STuzmlwhqKH481qWg</id> </activity:actor> <gnip:matching_rules> <gnip:matching_rule rel="source" tag="Maybelline_CA">((maybelline | maybellines | mybelline | mybellines | mayballine | mayballines) (makeover | makeovers | "make over" | "make overs" | nail | nails | manicure | manicures | pedicure | pedicures | mani | pedi | foundation | mascara | mascaras | concealer | c</gnip:matching_rule> </gnip:matching_rules></entry>
+<entry xmlns:gnip="http://www.gnip.com/schemas/2010" xmlns="http://www.w3.org/2005/Atom"> <id>http://gdata.youtube.com/feeds/api/videos/IMtFtwzGyo4</id> <published>2013-08-21T11:55:58.000Z</published> <updated>2013-08-21T11:55:58.000Z</updated> <title>Hannah Marie posted a video to YouTube</title> <category term="VideoPosted" label="Video Posted"/> <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=IMtFtwzGyo4&feature=youtube_gdata"/> <source> <link rel="self" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos?q=%28%28maybelline%20%7C%20maybellines%20%7C%20mybelline%20%7C%20mybellines%20%7C%20mayballine%20%7C%20mayballines%29%20%28makeover%20%7C%20makeovers%20%7C%20%22make%20over%22%20%7C%20%22make%20overs%22%20%7C%20nail%20%7C%20nails%20%7C%20manicure%20%7C%20manicures%20%7C%20pedicure%20%7C%20pedicures%20%7C%20mani%20%7C%20pedi%20%7C%20foundation%20%7C%20mascara%20%7C%20mascaras%20%7C%20concealer%20%7C%20c&orderby
=published"/> <title>YouTube - Keyword - Uploads - ((maybelline | maybellines | mybelline | mybellines | mayballine | mayballines) (makeover | makeovers | "make over" | "make overs" | nail | nails | manicure | manicures | pedicure | pedicures | mani | pedi | foundation | mascara | mascaras | concealer | c</title> <updated>2013-08-21T09-04-45Z</updated> <gnip:rule xmlns:gnip="http://www.gnip.com/schemas/2010">((maybelline | maybellines | mybelline | mybellines | mayballine | mayballines) (makeover | makeovers | "make over" | "make overs" | nail | nails | manicure | manicures | pedicure | pedicures | mani | pedi | foundation | mascara | mascaras | concealer | c</gnip:rule> </source> <service:provider xmlns:service="http://activitystrea.ms/service-provider"> <name>YouTube</name> <uri>http://www.youtube.com/</uri> <icon/> </service:provider> <activity:verb xmlns:activity="http://activitystrea.ms/spec/1.0/">http://activitystrea.ms/schema/1.0/post</activity:verb> <a
ctivity:object xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/video</activity:object-type> <id>object:http://gdata.youtube.com/feeds/api/videos/IMtFtwzGyo4</id> <title type="text">Summer Must Haves - Make Up | Hann.</title> <content type="text">'iya beauties. today I'm bringing you part two of my summer must haves! This is strictly make up related!! Don't forget to subscribe for more videos and all ...</content> <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=IMtFtwzGyo4&feature=youtube_gdata"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" rel="enclosure" type="application/x-shockwave-flash" href="http://www.youtube.com/v/IMtFtwzGyo4?version=3&f=videos&app=youtube_gdata" atommedia1:duration="886"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" rel="preview" href="http://i.ytimg.com/vi/IMtFtwzGyo4/0.jpg" atommedia1:height="360"
atommedia1:width="480" atommedia1:duration="00:07:23"/> <category scheme="http://gdata.youtube.com/schemas/2007/categories.cat" term="Howto"/> </activity:object> <author> <name>Hannah Marie</name> <uri>http://www.youtube.com/user/Hannah Marie</uri> </author> <activity:author xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link rel="alternate" type="text/html" length="0" href="http://www.youtube.com/user/Hannah Marie"/> <id>http://gdata.youtube.com/feeds/api/users/lilstarh220</id> </activity:author> <activity:actor xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link rel="alternate" type="text/html" length="0" href="http://www.youtube.com/user/Hannah Marie"/> <id>http://gdata.youtube.com/feeds/api/users/lilstarh220</id> </activity:actor> <gnip:matching_rules> <gnip:
matching_rule rel="source" tag="Maybelline_CA">((maybelline | maybellines | mybelline | mybellines | mayballine | mayballines) (makeover | makeovers | "make over" | "make overs" | nail | nails | manicure | manicures | pedicure | pedicures | mani | pedi | foundation | mascara | mascaras | concealer | c</gnip:matching_rule> </gnip:matching_rules></entry>
+<entry xmlns:gnip="http://www.gnip.com/schemas/2010" xmlns="http://www.w3.org/2005/Atom"> <id>http://gdata.youtube.com/feeds/api/videos/t-Mnb5eZxn8</id> <published>2013-08-21T16:01:26.000Z</published> <updated>2013-08-21T16:01:26.000Z</updated> <title>ontsofa posted a video to YouTube</title> <category term="VideoPosted" label="Video Posted"/> <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=t-Mnb5eZxn8&feature=youtube_gdata"/> <source> <link rel="self" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos?q=%28Wilkinson%29%20%28rasatura%20%7C%20rasarsi%20%7C%20barba%20%7C%20%22rasoio%20power%22%20%7C%20rasoi%20%7C%20%22rasoio%20manuale%22%20%7C%20%22rasoio%20elettrico%22%20%7C%20rasoio%20%7C%20manico%20%7C%20impugnatura%20%7C%20lama%20%7C%20lame%20%7C%20lamette%20%7C%20testina%20%7C%20%22crema%20idratante%22%20%7C%20%22balsamo%20dopo%20barba%22%20%7C%20%22gel%20da%20barba%22%20%7C%20%22schiuma%20da%20barba%22%20%7C%20s&
amp;orderby=published"/> <title>YouTube - Keyword - Uploads - (Wilkinson) (rasatura | rasarsi | barba | "rasoio power" | rasoi | "rasoio manuale" | "rasoio elettrico" | rasoio | manico | impugnatura | lama | lame | lamette | testina | "crema idratante" | "balsamo dopo barba" | "gel da barba" | "schiuma da barba" | s</title> <updated>2013-08-21T09-06-48Z</updated> <gnip:rule xmlns:gnip="http://www.gnip.com/schemas/2010">(Wilkinson) (rasatura | rasarsi | barba | "rasoio power" | rasoi | "rasoio manuale" | "rasoio elettrico" | rasoio | manico | impugnatura | lama | lame | lamette | testina | "crema idratante" | "balsamo dopo barba" | "gel da barba" | "schiuma da barba" | s</gnip:rule> </source> <service:provider xmlns:service="http://activitystrea.ms/service-provider"> <name>YouTube</name> <uri>http://www.youtube.com/</uri> <icon/> </service:provider> <activity:verb xmlns:activity="http://activitystrea.ms/spec/1.0/">http://activitystrea.ms/schema/1.0/post</activit
y:verb> <activity:object xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/video</activity:object-type> <id>object:http://gdata.youtube.com/feeds/api/videos/t-Mnb5eZxn8</id> <title type="text">Lloyd Wilkinson - Tricks Of The Trade (Paulo Nutini Cover) - Ont' Sofa Prime Studios Sessions</title> <content type="text">The genius that is Lloyd Wilkinson popped in for a sit ont' sofa recently and played this cracking cover of 'Tricks of the Trade' by Paulo Nutini - hope you ...</content> <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=t-Mnb5eZxn8&feature=youtube_gdata"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" rel="enclosure" type="application/x-shockwave-flash" href="http://www.youtube.com/v/t-Mnb5eZxn8?version=3&f=videos&app=youtube_gdata" atommedia1:duration="133"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" rel="preview" hr
ef="http://i.ytimg.com/vi/t-Mnb5eZxn8/0.jpg" atommedia1:height="360" atommedia1:width="480" atommedia1:duration="00:01:06.500"/> <category scheme="http://gdata.youtube.com/schemas/2007/categories.cat" term="Music"/> <gnip:statistics xmlns:gnip="http://www.gnip.com/schemas/2010" favoriteCount="0" viewCount="19"/> </activity:object> <author> <name>ontsofa</name> <uri>http://www.youtube.com/user/ontsofa</uri> </author> <activity:author xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link rel="alternate" type="text/html" length="0" href="http://www.youtube.com/user/ontsofa"/> <id>http://gdata.youtube.com/feeds/api/users/ontsofa</id> </activity:author> <activity:actor xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link rel="alternate" type="text/html" length="0" href="http:
//www.youtube.com/user/ontsofa"/> <id>http://gdata.youtube.com/feeds/api/users/ontsofa</id> </activity:actor> <gnip:matching_rules> <gnip:matching_rule rel="source" tag="Wilkinson_IT">(Wilkinson) (rasatura | rasarsi | barba | "rasoio power" | rasoi | "rasoio manuale" | "rasoio elettrico" | rasoio | manico | impugnatura | lama | lame | lamette | testina | "crema idratante" | "balsamo dopo barba" | "gel da barba" | "schiuma da barba" | s</gnip:matching_rule> </gnip:matching_rules></entry>
+<entry xmlns:gnip="http://www.gnip.com/schemas/2010" xmlns="http://www.w3.org/2005/Atom"> <id>http://gdata.youtube.com/feeds/api/videos/jNluNACoEk0</id> <published>2013-08-21T13:35:44.000Z</published> <updated>2013-08-21T13:38:14.000Z</updated> <title>Girl Funny Videosx posted a video to YouTube</title> <category term="VideoPosted" label="Video Posted"/> <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=jNluNACoEk0&feature=youtube_gdata"/> <source> <link rel="self" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos?q=fructis&orderby=published"/> <title>YouTube - Keyword - Uploads - fructis</title> <updated>2013-08-21T09-07-02Z</updated> <gnip:rule xmlns:gnip="http://www.gnip.com/schemas/2010">fructis</gnip:rule> </source> <service:provider xmlns:service="http://activitystrea.ms/service-provider"> <name>YouTube</name> <uri>http://www.youtube.com/</uri> <icon/> </service:provider> <activity:verb
xmlns:activity="http://activitystrea.ms/spec/1.0/">http://activitystrea.ms/schema/1.0/post</activity:verb> <activity:object xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/video</activity:object-type> <id>object:http://gdata.youtube.com/feeds/api/videos/jNluNACoEk0</id> <title type="text">garnier fructis commercial india Pelo con Volumen Peinado Cardado</title> <content type="text">ail Compilation June 2013 Week 1 Fail Compilation April 2013 Fail Compilation 2013 Win Compilation May 2013 Win Compilation June 2013 Win Compilation July 20...</content> <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=jNluNACoEk0&feature=youtube_gdata"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" rel="enclosure" type="application/x-shockwave-flash" href="http://www.youtube.com/v/jNluNACoEk0?version=3&f=videos&app=youtube_gdata" atommedia1:duration="185"/> <link x
mlns:atommedia1="http://purl.org/syndication/atommedia" rel="preview" href="http://i.ytimg.com/vi/jNluNACoEk0/0.jpg" atommedia1:height="360" atommedia1:width="480" atommedia1:duration="00:01:32.500"/> <category scheme="http://gdata.youtube.com/schemas/2007/categories.cat" term="Entertainment"/> </activity:object> <author> <name>Girl Funny Videosx</name> <uri>http://www.youtube.com/user/Girl Funny Videosx</uri> </author> <activity:author xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link rel="alternate" type="text/html" length="0" href="http://www.youtube.com/user/Girl Funny Videosx"/> <id>http://gdata.youtube.com/feeds/api/users/dqBhZLxFPLwKbv9q9Y7BXQ</id> </activity:author> <activity:actor xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link rel="alternate" type="text/h
tml" length="0" href="http://www.youtube.com/user/Girl Funny Videosx"/> <id>http://gdata.youtube.com/feeds/api/users/dqBhZLxFPLwKbv9q9Y7BXQ</id> </activity:actor> <gnip:matching_rules> <gnip:matching_rule rel="source" tag="Fructis_MX">fructis</gnip:matching_rule> </gnip:matching_rules></entry>
+<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gnip="http://www.gnip.com/schemas/2010"> <id>http://gdata.youtube.com/feeds/api/videos/Hqwi278mioE</id> <published>2013-09-06T17:11:01.000Z</published> <updated>2013-09-06T17:11:01.000Z</updated> <title>magazin dünyası posted a video to YouTube</title> <category label="Video Posted" term="VideoPosted"/> <link href="http://www.youtube.com/watch?v=Hqwi278mioE&feature=youtube_gdata" rel="alternate" type="text/html"/> <source> <link href="http://gdata.youtube.com/feeds/api/videos?q=%28Olay%20%7C%20Olays%20%7C%20%22Olay%27s%22%20%7C%20%23Olay%20%7C%20%23Olays%20%7C%20%22Professional%20Pro-X%22%20%7C%20%22Smooth%20Finish%20Facial%20Hair%20Removal%20Duo%22%20%7C%20%22Professional%20ProX%22%20%7C%20%22Smooth%20Finish%20Facial%20Hair%20Removal%20Duos%22%20%7C%20%22fresh%20effects%22%20%7C%20fresheffects%20%7C%20%22fresh%20effect%22%20%7C%20fresheffect%20%7C%20%22total%20effects%22%20%7C&orderby=published" rel="self" typ
e="application/atom+xml"/> <title>YouTube - Keyword - Uploads - (Olay | Olays | "Olay's" | #Olay | #Olays | "Professional Pro-X" | "Smooth Finish Facial Hair Removal Duo" | "Professional ProX" | "Smooth Finish Facial Hair Removal Duos" | "fresh effects" | fresheffects | "fresh effect" | fresheffect | "total effects" |</title> <updated>2013-09-06T13-13-32Z</updated> <gnip:rule>(Olay | Olays | "Olay's" | #Olay | #Olays | "Professional Pro-X" | "Smooth Finish Facial Hair Removal Duo" | "Professional ProX" | "Smooth Finish Facial Hair Removal Duos" | "fresh effects" | fresheffects | "fresh effect" | fresheffect | "total effects" |</gnip:rule> </source> <service:provider xmlns:service="http://activitystrea.ms/service-provider"> <name>YouTube</name> <uri>http://www.youtube.com/</uri> <icon/> </service:provider> <activity:verb xmlns:activity="http://activitystrea.ms/spec/1.0/">http://activitystrea.ms/schema/1.0/post</activity:verb> <activity:object xmlns:activity="ht
tp://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/video</activity:object-type> <id>object:http://gdata.youtube.com/feeds/api/videos/Hqwi278mioE</id> <title type="text">Ebru Åancı Olay Yaratan Elbisesi Canay tv</title> <content type="text">empty</content> <link href="http://www.youtube.com/watch?v=Hqwi278mioE&feature=youtube_gdata" rel="alternate" type="text/html"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" atommedia1:duration="172" href="http://www.youtube.com/v/Hqwi278mioE?version=3&f=videos&app=youtube_gdata" rel="enclosure" type="application/x-shockwave-flash"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" atommedia1:duration="00:01:26" atommedia1:height="360" atommedia1:width="480" href="http://i.ytimg.com/vi/Hqwi278mioE/0.jpg" rel="preview"/> <category scheme="http://gdata.youtube.com/schemas/2007/categories.cat" term="Entertainment"/> </activity:object> <
author> <name>magazin dünyası</name> <uri>http://www.youtube.com/user/magazin dünyası</uri> </author> <activity:author xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link href="http://www.youtube.com/user/magazin dünyası" length="0" rel="alternate" type="text/html"/> <id>http://gdata.youtube.com/feeds/api/users/o0xt0oPAqrzC9CVg-DLDcA</id> </activity:author> <activity:actor xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link href="http://www.youtube.com/user/magazin dünyası" length="0" rel="alternate" type="text/html"/> <id>http://gdata.youtube.com/feeds/api/users/o0xt0oPAqrzC9CVg-DLDcA</id> </activity:actor> <gnip:matching_rules> <gnip:matching_rule rel="source" tag="Olay_CA">(Olay | Olays | "Olay's" | #Olay | #Olays | "Professional Pro-X" | "S
mooth Finish Facial Hair Removal Duo" | "Professional ProX" | "Smooth Finish Facial Hair Removal Duos" | "fresh effects" | fresheffects | "fresh effect" | fresheffect | "total effects" |</gnip:matching_rule> </gnip:matching_rules></entry>
+<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gnip="http://www.gnip.com/schemas/2010"> <id>http://gdata.youtube.com/feeds/api/videos/Hqwi278mioE</id> <published>2013-09-06T17:11:01.000Z</published> <updated>2013-09-06T17:11:01.000Z</updated> <title>magazin dünyası posted a video to YouTube</title> <category label="Video Posted" term="VideoPosted"/> <link href="http://www.youtube.com/watch?v=Hqwi278mioE&feature=youtube_gdata" rel="alternate" type="text/html"/> <source> <link href="http://gdata.youtube.com/feeds/api/videos?q=%28Olay%20%7C%20Olays%20%7C%20%22Olay%27s%22%20%7C%20%23Olay%20%7C%20%23Olays%20%7C%20%22Professional%20Pro-X%22%20%7C%20%22Smooth%20Finish%20Facial%20Hair%20Removal%20Duo%22%20%7C%20%22Professional%20ProX%22%20%7C%20%22Smooth%20Finish%20Facial%20Hair%20Removal%20Duos%22%20%7C%20%22fresh%20effects%22%20%7C%20fresheffects%20%7C%20%22fresh%20effect%22%20%7C%20fresheffect%20%7C%20%22total%20effects%22%20%7C&orderby=published" rel="self" typ
e="application/atom+xml"/> <title>YouTube - Keyword - Uploads - (Olay | Olays | "Olay's" | #Olay | #Olays | "Professional Pro-X" | "Smooth Finish Facial Hair Removal Duo" | "Professional ProX" | "Smooth Finish Facial Hair Removal Duos" | "fresh effects" | fresheffects | "fresh effect" | fresheffect | "total effects" |</title> <updated>2013-09-06T13-13-32Z</updated> <gnip:rule>(Olay | Olays | "Olay's" | #Olay | #Olays | "Professional Pro-X" | "Smooth Finish Facial Hair Removal Duo" | "Professional ProX" | "Smooth Finish Facial Hair Removal Duos" | "fresh effects" | fresheffects | "fresh effect" | fresheffect | "total effects" |</gnip:rule> </source> <service:provider xmlns:service="http://activitystrea.ms/service-provider"> <name>YouTube</name> <uri>http://www.youtube.com/</uri> <icon/> </service:provider> <activity:verb xmlns:activity="http://activitystrea.ms/spec/1.0/">http://activitystrea.ms/schema/1.0/post</activity:verb> <activity:object xmlns:activity="ht
tp://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/video</activity:object-type> <id>object:http://gdata.youtube.com/feeds/api/videos/Hqwi278mioE</id> <title type="text">Ebru Åancı Olay Yaratan Elbisesi Canay tv</title> <content type="text">empty</content> <link href="http://www.youtube.com/watch?v=Hqwi278mioE&feature=youtube_gdata" rel="alternate" type="text/html"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" atommedia1:duration="172" href="http://www.youtube.com/v/Hqwi278mioE?version=3&f=videos&app=youtube_gdata" rel="enclosure" type="application/x-shockwave-flash"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" atommedia1:duration="00:01:26" atommedia1:height="360" atommedia1:width="480" href="http://i.ytimg.com/vi/Hqwi278mioE/0.jpg" rel="preview"/> <category scheme="http://gdata.youtube.com/schemas/2007/categories.cat" term="Entertainment"/> </activity:object> <
author> <name>magazin dünyası</name> <uri>http://www.youtube.com/user/magazin dünyası</uri> </author> <activity:author xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link href="http://www.youtube.com/user/magazin dünyası" length="0" rel="alternate" type="text/html"/> <id>http://gdata.youtube.com/feeds/api/users/o0xt0oPAqrzC9CVg-DLDcA</id> </activity:author> <activity:actor xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link href="http://www.youtube.com/user/magazin dünyası" length="0" rel="alternate" type="text/html"/> <id>http://gdata.youtube.com/feeds/api/users/o0xt0oPAqrzC9CVg-DLDcA</id> </activity:actor> <gnip:matching_rules> <gnip:matching_rule rel="source" tag="Olay_CA">(Olay | Olays | "Olay's" | #Olay | #Olays | "Professional Pro-X" | "S
mooth Finish Facial Hair Removal Duo" | "Professional ProX" | "Smooth Finish Facial Hair Removal Duos" | "fresh effects" | fresheffects | "fresh effect" | fresheffect | "total effects" |</gnip:matching_rule> </gnip:matching_rules></entry>
+<entry xmlns:gnip="http://www.gnip.com/schemas/2010" xmlns="http://www.w3.org/2005/Atom"> <id>http://gdata.youtube.com/feeds/api/videos/Hqwi278mioE</id> <published>2013-09-06T17:11:01.000Z</published> <updated>2013-09-06T17:11:01.000Z</updated> <title>magazin dünyası posted a video to YouTube</title> <category term="VideoPosted" label="Video Posted"/> <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=Hqwi278mioE&feature=youtube_gdata"/> <source> <link rel="self" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos?q=%28Olay%20%7C%20Olays%20%7C%20%22Olay%27s%22%20%7C%20%23Olay%20%7C%20%23Olays%20%7C%20%22Professional%20Pro-X%22%20%7C%20%22Smooth%20Finish%20Facial%20Hair%20Removal%20Duo%22%20%7C%20%22Professional%20ProX%22%20%7C%20%22Smooth%20Finish%20Facial%20Hair%20Removal%20Duos%22%20%7C%20%22fresh%20effects%22%20%7C%20fresheffects%20%7C%20%22fresh%20effect%22%20%7C%20fresheffect%20%7C%20%22total%20effects%22
%20%7C&orderby=published"/> <title>YouTube - Keyword - Uploads - (Olay | Olays | "Olay's" | #Olay | #Olays | "Professional Pro-X" | "Smooth Finish Facial Hair Removal Duo" | "Professional ProX" | "Smooth Finish Facial Hair Removal Duos" | "fresh effects" | fresheffects | "fresh effect" | fresheffect | "total effects" |</title> <updated>2013-09-06T13-13-32Z</updated> <gnip:rule xmlns:gnip="http://www.gnip.com/schemas/2010">(Olay | Olays | "Olay's" | #Olay | #Olays | "Professional Pro-X" | "Smooth Finish Facial Hair Removal Duo" | "Professional ProX" | "Smooth Finish Facial Hair Removal Duos" | "fresh effects" | fresheffects | "fresh effect" | fresheffect | "total effects" |</gnip:rule> </source> <service:provider xmlns:service="http://activitystrea.ms/service-provider"> <name>YouTube</name> <uri>http://www.youtube.com/</uri> <icon/> </service:provider> <activity:verb xmlns:activity="http://activitystrea.ms/spec/1.0/">http://activitystrea.ms/schema/1.0/post</
activity:verb> <activity:object xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/video</activity:object-type> <id>object:http://gdata.youtube.com/feeds/api/videos/Hqwi278mioE</id> <title type="text">Ebru Şancı Olay Yaratan Elbisesi Canay tv</title> <content type="text"></content> <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=Hqwi278mioE&feature=youtube_gdata"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" rel="enclosure" type="application/x-shockwave-flash" href="http://www.youtube.com/v/Hqwi278mioE?version=3&f=videos&app=youtube_gdata" atommedia1:duration="172"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" rel="preview" href="http://i.ytimg.com/vi/Hqwi278mioE/0.jpg" atommedia1:height="360" atommedia1:width="480" atommedia1:duration="00:01:26"/> <category scheme="http://gdata.youtube.com/schemas/2007/categorie
s.cat" term="Entertainment"/> </activity:object> <author> <name>magazin dünyası</name> <uri>http://www.youtube.com/user/magazin dünyası</uri> </author> <activity:author xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link rel="alternate" type="text/html" length="0" href="http://www.youtube.com/user/magazin dünyası"/> <id>http://gdata.youtube.com/feeds/api/users/o0xt0oPAqrzC9CVg-DLDcA</id> </activity:author> <activity:actor xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link rel="alternate" type="text/html" length="0" href="http://www.youtube.com/user/magazin dünyası"/> <id>http://gdata.youtube.com/feeds/api/users/o0xt0oPAqrzC9CVg-DLDcA</id> </activity:actor> <gnip:matching_rules> <gnip:matching_rule rel="source" tag="Olay_C
A">(Olay | Olays | "Olay's" | #Olay | #Olays | "Professional Pro-X" | "Smooth Finish Facial Hair Removal Duo" | "Professional ProX" | "Smooth Finish Facial Hair Removal Duos" | "fresh effects" | fresheffects | "fresh effect" | fresheffect | "total effects" |</gnip:matching_rule> </gnip:matching_rules></entry>
+<entry xmlns:gnip="http://www.gnip.com/schemas/2010" xmlns="http://www.w3.org/2005/Atom"> <id>http://gdata.youtube.com/feeds/api/videos/s6Xsa8B4vL4</id> <published>2013-09-06T16:01:11.000Z</published> <updated>2013-09-06T16:01:11.000Z</updated> <title>YDS Video Ders Sayısal posted a video to YouTube</title> <category term="VideoPosted" label="Video Posted"/> <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=s6Xsa8B4vL4&feature=youtube_gdata"/> <source> <link rel="self" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos?q=%28Olay%20%7C%20Olays%20%7C%20%22Olay%27s%22%20%7C%20%23Olay%20%7C%20%23Olays%20%7C%20%22Professional%20Pro-X%22%20%7C%20%22Smooth%20Finish%20Facial%20Hair%20Removal%20Duo%22%20%7C%20%22Professional%20ProX%22%20%7C%20%22Smooth%20Finish%20Facial%20Hair%20Removal%20Duos%22%20%7C%20%22fresh%20effects%22%20%7C%20fresheffects%20%7C%20%22fresh%20effect%22%20%7C%20fresheffect%20%7C%20%22total%20effects%
22%20%7C&orderby=published"/> <title>YouTube - Keyword - Uploads - (Olay | Olays | "Olay's" | #Olay | #Olays | "Professional Pro-X" | "Smooth Finish Facial Hair Removal Duo" | "Professional ProX" | "Smooth Finish Facial Hair Removal Duos" | "fresh effects" | fresheffects | "fresh effect" | fresheffect | "total effects" |</title> <updated>2013-09-06T12-23-07Z</updated> <gnip:rule xmlns:gnip="http://www.gnip.com/schemas/2010">(Olay | Olays | "Olay's" | #Olay | #Olays | "Professional Pro-X" | "Smooth Finish Facial Hair Removal Duo" | "Professional ProX" | "Smooth Finish Facial Hair Removal Duos" | "fresh effects" | fresheffects | "fresh effect" | fresheffect | "total effects" |</gnip:rule> </source> <service:provider xmlns:service="http://activitystrea.ms/service-provider"> <name>YouTube</name> <uri>http://www.youtube.com/</uri> <icon/> </service:provider> <activity:verb xmlns:activity="http://activitystrea.ms/spec/1.0/">http://activitystrea.ms/schema/1.0/post
</activity:verb> <activity:object xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/video</activity:object-type> <id>object:http://gdata.youtube.com/feeds/api/videos/s6Xsa8B4vL4</id> <title type="text">Fotoelektrik Olay 2</title> <content type="text"></content> <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=s6Xsa8B4vL4&feature=youtube_gdata"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" rel="enclosure" type="application/x-shockwave-flash" href="http://www.youtube.com/v/s6Xsa8B4vL4?version=3&f=videos&app=youtube_gdata" atommedia1:duration="857"/> <link xmlns:atommedia1="http://purl.org/syndication/atommedia" rel="preview" href="http://i.ytimg.com/vi/s6Xsa8B4vL4/0.jpg" atommedia1:height="360" atommedia1:width="480" atommedia1:duration="00:07:08.500"/> <category scheme="http://gdata.youtube.com/schemas/2007/categories.cat" term="People"/> </
activity:object> <author> <name>YDS Video Ders Sayısal</name> <uri>http://www.youtube.com/user/YDS Video Ders Sayısal</uri> </author> <activity:author xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link rel="alternate" type="text/html" length="0" href="http://www.youtube.com/user/YDS Video Ders Sayısal"/> <id>http://gdata.youtube.com/feeds/api/users/7jgS9i6n8p5Qs6vUwPLuEg</id> </activity:author> <activity:actor xmlns:activity="http://activitystrea.ms/spec/1.0/"> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <link rel="alternate" type="text/html" length="0" href="http://www.youtube.com/user/YDS Video Ders Sayısal"/> <id>http://gdata.youtube.com/feeds/api/users/7jgS9i6n8p5Qs6vUwPLuEg</id> </activity:actor> <gnip:matching_rules> <gnip:matching_rule rel="source" tag="Olay_CA">(Olay | Olays | "Olay'
s" | #Olay | #Olays | "Professional Pro-X" | "Smooth Finish Facial Hair Removal Duo" | "Professional ProX" | "Smooth Finish Facial Hair Removal Duos" | "fresh effects" | fresheffects | "fresh effect" | fresheffect | "total effects" |</gnip:matching_rule> </gnip:matching_rules></entry>
\ No newline at end of file
Added: incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/pom.xml
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/pom.xml?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/pom.xml (added)
+++ incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/pom.xml Thu Jan 9 17:27:50 2014
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.streams</groupId>
+ <artifactId>streams-provider-gnip</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>gnip-powertrack</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jsonschema2pojo</groupId>
+ <artifactId>jsonschema2pojo-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.streams</groupId>
+ <artifactId>streams-pojo</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>20090211</version>
+ <scope>compile</scope>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+ <build>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <testSourceDirectory>src/test/java</testSourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>target</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/generated-sources/jsonschema2pojo/**/*.java</source>
+ </sources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>add-source-jaxb2</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/generated-sources/jaxb2</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.jsonschema2pojo</groupId>
+ <artifactId>jsonschema2pojo-maven-plugin</artifactId>
+ <configuration>
+ <addCompileSourceRoot>true</addCompileSourceRoot>
+ <generateBuilders>true</generateBuilders>
+ <sourcePaths>
+ <sourcePath>src/main/jsonschema/com/gnip</sourcePath>
+ </sourcePaths>
+ <outputDirectory>target/generated-sources/jsonschema2pojo</outputDirectory>
+ <targetPackage>com.gnip</targetPackage>
+ <useLongIntegers>true</useLongIntegers>
+ <useJodaDates>false</useJodaDates>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ <configuration>
+ <schemaDirectory>src/main/xmlschema/com/gnip/</schemaDirectory>
+ <generateDirectory>target/generated-sources/jaxb2</generateDirectory>
+ <verbose>true</verbose>
+ <debug>true</debug>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ <forceRegenerate>true</forceRegenerate>
+ <removeOldOutput>false</removeOldOutput>
+ <generatePackage>com.gnip.api</generatePackage>
+ <plugins>
+ <plugin>
+ <groupId>org.jvnet.jaxb2_commons</groupId>
+ <artifactId>jaxb2-basics</artifactId>
+ <version>0.6.5</version>
+ </plugin>
+ </plugins>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Added: incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/src/main/java/org/apache/streams/gnip/powertrack/ActivityXMLActivitySerializer.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/src/main/java/org/apache/streams/gnip/powertrack/ActivityXMLActivitySerializer.java?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/src/main/java/org/apache/streams/gnip/powertrack/ActivityXMLActivitySerializer.java (added)
+++ incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/src/main/java/org/apache/streams/gnip/powertrack/ActivityXMLActivitySerializer.java Thu Jan 9 17:27:50 2014
@@ -0,0 +1,223 @@
+package org.apache.streams.gnip.powertrack;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+import org.apache.commons.lang.NotImplementedException;
+import org.apache.commons.lang.StringUtils;
+import org.apache.streams.data.ActivitySerializer;
+import org.apache.streams.pojo.json.Activity;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: rebanks
+ * Date: 9/5/13
+ * Time: 3:07 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class ActivityXMLActivitySerializer implements ActivitySerializer {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ActivityXMLActivitySerializer.class);
+
+ private ObjectMapper mapper;
+ private XmlMapper xmlMapper;
+
+ public ActivityXMLActivitySerializer() {
+ mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
+ mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, Boolean.TRUE);
+ mapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, Boolean.TRUE);
+ xmlMapper = new XmlMapper();
+ xmlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
+ xmlMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, Boolean.TRUE);
+ xmlMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, Boolean.TRUE);
+ }
+
+
+ @Override
+ public String serializationFormat() {
+ return "gnip_activity_xml"; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public String serialize(Activity deserialized) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Activity deserialize(String serializedXML) {
+ Activity activity = null;
+ try {
+ activity = xmlMapper.readValue(new StringReader(setContentIfEmpty(serializedXML)), Activity.class);
+ activity = mapper.readValue(new StringReader(fixActivityXML(activity, serializedXML)), Activity.class);
+ } catch (Exception e) {
+ LOGGER.error("Exception correcting Gnip Activity Xml to Activity format.", e);
+ LOGGER.error("Xml that caused error : {}", serializedXML);
+ }
+ return activity; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public List<Activity> deserializeAll(String serializedList) {
+ //TODO Support
+ throw new NotImplementedException("Not currently supported by this deserializer");
+ }
+
+ private String fixActivityXML(Activity activity, String xml) throws Exception{
+ JSONObject jsonObject = new JSONObject(mapper.writeValueAsString(activity));
+ JSONObject newObject = (JSONObject) fixActivityXML(jsonObject);
+ StringReader str = new StringReader(newObject.toString());
+ newObject = formatFixedJSON(newObject);
+ newObject = fixDateFormats(newObject, xml);
+ newObject = createTopLevelConentField(newObject);
+ return newObject.toString();
+
+ }
+
+ private Object fixActivityXML(Object obj) throws Exception {
+ if(obj instanceof JSONObject) {
+ JSONObject json = new JSONObject();
+ JSONObject old = (JSONObject) obj;
+ Iterator keys = old.keys();
+ while(keys.hasNext()) {
+ String key = (String) keys.next();
+ if(StringUtils.isBlank(key)) {
+ return fixActivityXML(old.get(key));
+ }
+ else if(!key.equals("type")){
+ Object o = fixActivityXML(old.get(key));
+ if(o != null)
+ json.put(key, o);
+ }
+
+ }
+ if(json.keys().hasNext())
+ return json;
+ else
+ return null;
+ }
+ else {
+ return obj;
+ }
+
+ }
+
+ private JSONObject formatFixedJSON(JSONObject json) throws Exception{
+ JSONObject topLink = json.optJSONObject("link");
+ if(topLink != null) {
+ json.put("link", topLink.getString("href"));
+ }
+ JSONObject actor = json.optJSONObject("actor");
+ if(actor != null) {
+ JSONObject link = actor.optJSONObject("link");
+ if(link != null) {
+ actor.put("link", link.get("href"));
+ }
+ }
+ JSONObject object = json.optJSONObject("object");
+ if(object != null) {
+ JSONObject link = object.optJSONObject("link");
+ if(link != null) {
+ object.put("link", link.get("href"));
+ }
+ }
+ String generator = json.optString("generator");
+ if(generator != null) {
+ JSONObject gen = new JSONObject();
+ gen.put("displayName", generator);
+ json.put("generator", gen);
+ }
+ return json;
+ }
+
+ private JSONObject fixDateFormats(JSONObject json, String xml) throws Exception{
+ DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ InputSource is = new InputSource(new StringReader(xml));
+ Document doc = docBuilder.parse(is);
+ //why?
+ doc.getDocumentElement().normalize();
+ if(json.optLong("published", -1L) != -1L) {
+ json.put("published", getValueFromXML("published", doc));
+ }
+ if(json.optLong("updated", -1L) != -1L) {
+ json.put("updated", getValueFromXML("updated", doc));
+ }
+ if(json.optLong("created", -1L) != -1L) {
+ json.put("created", getValueFromXML("created", doc));
+ }
+ return json;
+ }
+
+ private JSONObject createTopLevelConentField(JSONObject json) throws JSONException {
+ if(!json.isNull("content")) {
+ return json;
+ }
+ JSONObject object = json.optJSONObject("object");
+ if(object != null) {
+ String content = object.optString("content");
+ if(content == null) {
+ content = object.optString("summary");
+ }
+ if(content != null) {
+ json.put("content", content);
+ }
+ }
+ return json;
+ }
+
+ private String getValueFromXML(String tag, Document doc) throws Exception{
+ Element base = (Element) doc.getElementsByTagName("entry").item(0);
+ return base.getElementsByTagName(tag).item(0).getTextContent();
+ }
+
+ private String setContentIfEmpty(String xml) throws Exception {
+ DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ InputSource is = new InputSource(new StringReader(xml));
+ Document doc = docBuilder.parse(is);
+ doc.getDocumentElement().normalize();
+ Element base = (Element) doc.getElementsByTagName("entry").item(0);
+ NodeList nodeList = base.getChildNodes();
+// for(int i=0; i < nodeList.getLength(); ++i) {
+// System.out.println(nodeList.item(i).getNodeName());
+// }
+ Element obj = (Element)base.getElementsByTagName("activity:object").item(0);
+ Element content = (Element)obj.getElementsByTagName("content").item(0);
+// System.out.println("Number of child nodes : "+content.getChildNodes().getLength());
+// System.out.println("Text content before : "+content.getTextContent());
+ if(content.getTextContent() == null || content.getTextContent().equals("")) {
+ content.setTextContent(" ");
+ }
+// System.out.println("Number of child nodes after : "+content.getChildNodes().getLength());
+// System.out.println("Text content after : "+content.getTextContent());
+ TransformerFactory tf = TransformerFactory.newInstance();
+ Transformer transformer = tf.newTransformer();
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ StringWriter writer = new StringWriter();
+ transformer.transform(new DOMSource(doc), new StreamResult(writer));
+ String output = writer.getBuffer().toString().replaceAll("\n|\r", "");
+// System.out.println(output);
+// System.out.println(output);
+// System.out.println(content);
+ return output;
+ }
+}
Added: incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/src/main/java/org/apache/streams/gnip/powertrack/GnipActivityFixer.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/src/main/java/org/apache/streams/gnip/powertrack/GnipActivityFixer.java?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/src/main/java/org/apache/streams/gnip/powertrack/GnipActivityFixer.java (added)
+++ incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/src/main/java/org/apache/streams/gnip/powertrack/GnipActivityFixer.java Thu Jan 9 17:27:50 2014
@@ -0,0 +1,151 @@
+/*
+ * 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
+ *
+ * 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.streams.gnip.powertrack;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+import org.apache.commons.lang.StringUtils;
+import org.apache.streams.pojo.json.Activity;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: mdelaet
+ * Date: 8/23/13
+ * Time: 9:40 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class GnipActivityFixer {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(GnipActivityFixer.class);
+
+ private ObjectMapper mapper;
+ private XmlMapper xmlMapper;
+
+ public GnipActivityFixer(){
+ mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
+ mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, Boolean.TRUE);
+ mapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, Boolean.TRUE);
+ xmlMapper = new XmlMapper();
+ xmlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
+ xmlMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, Boolean.TRUE);
+ xmlMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, Boolean.TRUE);
+ };
+
+ public static void findNullContents(JSONObject json, ArrayList<String> drilldownKeys, HashMap<ArrayList<String>, JSONObject> nullContents) throws Exception {
+
+ Iterator itr = json.keys();
+ while (itr.hasNext()){
+ String element = (String) itr.next();
+
+ if (StringUtils.isBlank(element)){
+ nullContents.put(drilldownKeys, json);
+
+ }
+ else{
+ try {
+ drilldownKeys.add(element);
+ if(json.get(element) instanceof JSONObject)
+ findNullContents((JSONObject) json.get(element), drilldownKeys, nullContents);
+ }catch(Exception e){
+ LOGGER.info("Failed to convert in findNullKeys, " + e);
+ LOGGER.error("Element : {}", element);
+ LOGGER.error(json.toString());
+ break;
+ }
+ }
+ drilldownKeys = new ArrayList<String>();
+ }
+ }
+
+ public static void editJson(JSONObject json, ArrayList<String> keyPath, Object nullFragment) throws JSONException {
+ Integer numKeys = keyPath.size();
+ JSONObject newJson = new JSONObject();
+ if (numKeys > 1){
+ for (int i = numKeys-1; i > 0; i-=1){
+ String key = keyPath.get(i);
+ if (i == numKeys -1){
+ newJson = newJson.put(key, nullFragment);
+ }
+ else {
+ newJson = newJson.put(key, newJson);
+ }
+ }
+ json.put(keyPath.get(0), newJson);
+ }
+ else{
+ json.put(keyPath.get(0), nullFragment);
+ }
+ }
+
+ public static Activity fix(Activity activity) throws Exception {
+ ObjectMapper mapper = new ObjectMapper();
+
+ String des = mapper.writeValueAsString(activity);
+ JSONObject json = new JSONObject(des);
+
+ HashMap<ArrayList<String>, JSONObject> nullContents = new HashMap<ArrayList<String>, JSONObject>();
+ ArrayList<String> drilldownKeys = new ArrayList<String>();
+
+ findNullContents(json, drilldownKeys, nullContents);
+
+ for ( Map.Entry<ArrayList<String>,JSONObject> entry : nullContents.entrySet() ) {
+ JSONObject frag = entry.getValue();
+ editJson(json, entry.getKey(), frag.get(""));
+ }
+
+ StringReader str = new StringReader(json.toString());
+ Activity testAct = null;
+ try {
+ testAct = mapper.readValue(str, Activity.class);
+ } catch (Exception e) {
+ LOGGER.error("Exception creating activity.", e);
+ LOGGER.error("JSON : {}"+json.toString());
+ }
+
+ return testAct;
+ };
+
+ public static JSONObject fix(JSONObject json) throws Exception {
+
+ HashMap<ArrayList<String>, JSONObject> nullContents = new HashMap<ArrayList<String>, JSONObject>();
+ ArrayList<String> drilldownKeys = new ArrayList<String>();
+
+ findNullContents(json, drilldownKeys, nullContents);
+
+ for ( Map.Entry<ArrayList<String>,JSONObject> entry : nullContents.entrySet() ) {
+ JSONObject frag = entry.getValue();
+ editJson(json, entry.getKey(), frag.get(""));
+ }
+
+ return json;
+ };
+
+}
\ No newline at end of file
Added: incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/src/main/java/org/apache/streams/gnip/powertrack/PowerTrackActivitySerializer.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/src/main/java/org/apache/streams/gnip/powertrack/PowerTrackActivitySerializer.java?rev=1556893&view=auto
==============================================================================
--- incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/src/main/java/org/apache/streams/gnip/powertrack/PowerTrackActivitySerializer.java (added)
+++ incubator/streams/branches/sblackmon/streams-contrib/streams-provider-gnip/gnip-powertrack/src/main/java/org/apache/streams/gnip/powertrack/PowerTrackActivitySerializer.java Thu Jan 9 17:27:50 2014
@@ -0,0 +1,103 @@
+package org.apache.streams.gnip.powertrack;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.commons.lang.NotImplementedException;
+import org.apache.streams.data.ActivitySerializer;
+import org.apache.streams.pojo.json.Activity;
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.StringReader;
+import java.util.List;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: rebanks
+ * Date: 9/5/13
+ * Time: 2:29 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class PowerTrackActivitySerializer implements ActivitySerializer {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(PowerTrackActivitySerializer.class);
+
+ private ObjectMapper mapper;
+
+ public PowerTrackActivitySerializer() {
+ mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
+ mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, Boolean.TRUE);
+ mapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, Boolean.TRUE);
+ }
+
+
+
+ @Override
+ public String serializationFormat() {
+ return "gnip_powertrack"; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public String serialize(Activity deserialized) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Activity deserialize(String serialized) {
+ Activity activity = null;
+ try {
+ JSONObject jsonObject = new JSONObject(serialized);
+ String content = jsonObject.optString("content", null);
+ if(content == null) {
+ content = jsonObject.optString("body", null);
+ if(content == null) {
+ content = jsonObject.optString("summary", null);
+ if(content == null) {
+ JSONObject object = jsonObject.optJSONObject("object");
+ if(object != null) {
+ content = object.optString("content", null);
+ if(content == null) {
+ content = object.optString("body", null);
+ if(content == null) {
+ content = object.optString("summary", null);
+ }
+ }
+ }
+ }
+ }
+
+ }
+ if(content != null) {
+ jsonObject.put("content", content);
+ }
+ String dateTime = jsonObject.optString("postedTime");
+ if(dateTime != null) {
+ jsonObject.put("published", dateTime);
+ }
+ JSONObject actor = jsonObject.optJSONObject("actor");
+ if(actor != null) {
+ String url = actor.optString("image");
+ if(url != null) {
+ JSONObject media = new JSONObject();
+ media.put("url", url);
+ actor.put("image", media);
+ }
+ }
+ serialized = jsonObject.toString();
+ StringReader reader = new StringReader(serialized);
+ activity = this.mapper.readValue(reader, Activity.class);
+ } catch (Exception e) {
+ LOGGER.error("Exception deserializing powertrack string to Activity Object.", e);
+ LOGGER.error("Exception on json : {}", serialized);
+ }
+ return activity;
+ }
+
+ @Override
+ public List<Activity> deserializeAll(String serializedList) {
+ //TODO Support
+ throw new NotImplementedException("Not currently supported by this deserializer");
+ }
+}