com.walmart.openapi
Class DataFeedManager

java.lang.Object
  extended by com.walmart.openapi.DataFeedManager

public class DataFeedManager
extends java.lang.Object

Feed manager lets you iterate over the items in data feeds. We choose the Iterator pattern because the category feeds/full feeds for some of the categories are really huge(>1GB) and cannot be loaded in memory for analysis. Note : It does not cache the result locally i.e on successive runs it makes a network call to download the feeds again from the open api end points.


Nested Class Summary
static class DataFeedManager.FeedIterator
          Reads a JsonParser to extract a list of items and then closes the socket.
static class DataFeedManager.FeedsType
           
 
Constructor Summary
DataFeedManager(java.lang.String apiKey)
           
 
Method Summary
 DataFeedManager.FeedIterator getFeedIterator(DataFeedManager.FeedsType feedsType)
          Return the iterator for the entire feed.
 DataFeedManager.FeedIterator getFeedIterator(DataFeedManager.FeedsType feedsType, java.lang.String categoryId)
          Open a connection to the server, unzip the stream and then create a JsonParser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataFeedManager

public DataFeedManager(java.lang.String apiKey)
Method Detail

getFeedIterator

public DataFeedManager.FeedIterator getFeedIterator(DataFeedManager.FeedsType feedsType)
                                             throws java.lang.Exception
Return the iterator for the entire feed. Note : Walmart catalog has millions of items.

Parameters:
feedsType -
Returns:
Throws:
java.lang.Exception

getFeedIterator

public DataFeedManager.FeedIterator getFeedIterator(DataFeedManager.FeedsType feedsType,
                                                    java.lang.String categoryId)
                                             throws java.lang.Exception
Open a connection to the server, unzip the stream and then create a JsonParser.

Parameters:
feedsType - Type of feed eg. specialbuys, rollbacks, etc
categoryId - category id for which the iterator is requested.
Returns:
Returns iterator which supports hasNext() and next() methods to parse the feed.
Throws:
java.lang.Exception