Author: sblackmon
Date: Wed Feb 26 20:20:20 2014
New Revision: 1572231
URL: http://svn.apache.org/r1572231
Log:
altering StreamsResultSet to be easier to use
Modified:
incubator/streams/branches/STREAMS-26/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterTimelineProvider.java
incubator/streams/branches/STREAMS-26/streams-core/src/main/java/org/apache/streams/core/StreamsResultSet.java
incubator/streams/branches/STREAMS-26/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/activity.json
incubator/streams/branches/STREAMS-26/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/object.json
Modified:
incubator/streams/branches/STREAMS-26/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterTimelineProvider.java
URL:
http://svn.apache.org/viewvc/incubator/streams/branches/STREAMS-26/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterTimelineProvider.java?rev=1572231&r1=1572230&r2=1572231&view=diff
==============================================================================
---
incubator/streams/branches/STREAMS-26/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterTimelineProvider.java
(original)
+++
incubator/streams/branches/STREAMS-26/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterTimelineProvider.java
Wed Feb 26 20:20:20 2014
@@ -25,10 +25,7 @@ import twitter4j.json.DataObjectFactory;
import java.io.Serializable;
import java.math.BigInteger;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Queue;
-import java.util.Random;
+import java.util.*;
import java.util.concurrent.*;
/**
@@ -183,7 +180,7 @@ public class TwitterTimelineProvider imp
Preconditions.checkArgument(ids.hasNext());
- LOGGER.info("{} readCurrent", STREAMS_ID);
+ LOGGER.info("readCurrent");
while( ids.hasNext() ) {
Long currentId = ids.next();
@@ -191,11 +188,14 @@ public class TwitterTimelineProvider imp
captureTimeline(currentId);
}
- LOGGER.info("{} Finished. Cleaning up...", STREAMS_ID);
+ LOGGER.info("Finished. Cleaning up...");
+
+ LOGGER.info("Providing {} docs", providerQueue.size());
+
+ StreamsResultSet result = new StreamsResultSet(providerQueue);
+
+ LOGGER.info("Exiting");
- StreamsResultSet result = (StreamsResultSet)
ImmutableList.copyOf(Iterators.consumingIterator(providerQueue.iterator()));
- LOGGER.info("{} providing {} docs", STREAMS_ID, providerQueue.size());
- LOGGER.info("{} Exiting", STREAMS_ID);
return result;
}
Modified:
incubator/streams/branches/STREAMS-26/streams-core/src/main/java/org/apache/streams/core/StreamsResultSet.java
URL:
http://svn.apache.org/viewvc/incubator/streams/branches/STREAMS-26/streams-core/src/main/java/org/apache/streams/core/StreamsResultSet.java?rev=1572231&r1=1572230&r2=1572231&view=diff
==============================================================================
---
incubator/streams/branches/STREAMS-26/streams-core/src/main/java/org/apache/streams/core/StreamsResultSet.java
(original)
+++
incubator/streams/branches/STREAMS-26/streams-core/src/main/java/org/apache/streams/core/StreamsResultSet.java
Wed Feb 26 20:20:20 2014
@@ -19,29 +19,19 @@
package org.apache.streams.core;
import java.math.BigInteger;
+import java.util.Iterator;
+import java.util.Queue;
-public interface StreamsResultSet extends Iterable<StreamsDatum> {
- /**
- * Get the time that the result set started collecting
- * @return long representing time since epoch
- */
- long getStartTime();
+public class StreamsResultSet implements Iterable<StreamsDatum> {
- /**
- * Get the time that the result set stopped collecting
- * @return long representing time since epoch
- */
- long getEndTime();
+ Queue<StreamsDatum> queue;
- /**
- * Get the source Unique identifier
- * @return String id
- */
- String getSourceId();
+ public StreamsResultSet(Queue<StreamsDatum> queue) {
+ this.queue = queue;
+ }
- /**
- * Get the maximum id of the items in the result set
- * @return the max sequence ID
- */
- BigInteger getMaxSequence();
+ @Override
+ public Iterator<StreamsDatum> iterator() {
+ return queue.iterator();
+ }
}
Modified:
incubator/streams/branches/STREAMS-26/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/activity.json
URL:
http://svn.apache.org/viewvc/incubator/streams/branches/STREAMS-26/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/activity.json?rev=1572231&r1=1572230&r2=1572231&view=diff
==============================================================================
---
incubator/streams/branches/STREAMS-26/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/activity.json
(original)
+++
incubator/streams/branches/STREAMS-26/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/activity.json
Wed Feb 26 20:20:20 2014
@@ -2,6 +2,7 @@
"type" : "object",
"title" : "activity",
"javaType": "org.apache.streams.pojo.json.Activity",
+ "javaInterfaces": ["java.io.Serializable"],
"description" : "An activity construct recounts what an actor did to an
object in the past. If there is no actor it simply describes the change.",
"additionalProperties": true,
"properties": {
Modified:
incubator/streams/branches/STREAMS-26/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/object.json
URL:
http://svn.apache.org/viewvc/incubator/streams/branches/STREAMS-26/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/object.json?rev=1572231&r1=1572230&r2=1572231&view=diff
==============================================================================
---
incubator/streams/branches/STREAMS-26/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/object.json
(original)
+++
incubator/streams/branches/STREAMS-26/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/object.json
Wed Feb 26 20:20:20 2014
@@ -2,6 +2,7 @@
"type" : "object",
"title" : "object",
"javaType": "org.apache.streams.pojo.json.ActivityObject",
+ "javaInterfaces": ["java.io.Serializable"],
"description" : "Basic object on the web. The only required property is the
id",
"properties" : {
"id" : {