com.spinn3r.api
Class CommentClient

java.lang.Object
  extended by com.spinn3r.api.BaseClient
      extended by com.spinn3r.api.CommentClient
All Implemented Interfaces:
Client

public class CommentClient
extends BaseClient
implements Client

This class is NOT threadsafe. Implementations need to ensure thread safety by using synchronized or java.util.concurrent constructs.


Field Summary
static int CONSERVATIVE_LIMIT
           
static int MAX_LIMIT
           
static int OPTIMAL_LIMIT
           
 
Fields inherited from class com.spinn3r.api.BaseClient
ACCEPT_ENCODING_HEADER, COMMENT_HANDLER, config, DEFAULT_CONNECT_TIMEOUT, DEFAULT_HOST, DEFAULT_HTTP_KEEPALIVE, DEFAULT_MAX_REDIRECTS, DEFAULT_READ_TIMEOUT, disable_parse, FEED_HANDLER, GZIP_ENCODING, isCompressed, LINK_HANDLER, NETWORKADDRESS_CACHE_TTL, NS_API, NS_ATOM, NS_COMMENT, NS_DC, NS_FEED, NS_LINK, NS_POST, NS_SOURCE, NS_TARGET, NS_WEBLOG, PERMALINK_HANDLER, RESTART_BUFFER, results, RETRY_MAX, USER_AGENT, USER_AGENT_HEADER
 
Constructor Summary
CommentClient()
           
 
Method Summary
 void fetch()
           
protected  int getConservativeLimit()
          Conservative limit for items which should work in all situations (but might be slower)
protected  int getMaxLimit()
          Return the maximum number of request per call.
protected  int getOptimalLimit()
          Return the optimal limit for fetches.
 java.util.List<BaseItem> getResults()
           
 java.lang.String getRouter()
          Return the router for this client.
protected  BaseResult parseItem(ContentApi.Entry current)
           
protected  BaseItem parseItem(org.w3c.dom.Element current)
          Parse an individual item which might be specific to this client.
 
Methods inherited from class com.spinn3r.api.BaseClient
addParam, addParam, addParam, doProtobufFetch, doXmlFetch, empty, fetch, generateFirstRequestURL, getCallDuration, getConfig, getElementByTagName, getElementByTagName, getElementCDATAByTagName, getElementCDATAByTagName, getHost, getInputStream, getLastRequestURL, getLimit, getNextRequestURL, getopt, getParseDuration, getRestartPoint, getSleepDuration, hasMoreResults, padd, parseChildNodesAsList, parseFloat, parseInt, parseItem, parseItem, parseLong, parseTags, protobufParse, setCallDuration, setConfig, setHost, setLastRequestURL, setNextRequestURL, setParam, setParseDuration, setSleepDuration, toISO8601, xmlParse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.spinn3r.api.Client
getCallDuration, getConfig, getHost, getInputStream, getLastRequestURL, getNextRequestURL, getParseDuration, getRestartPoint, getSleepDuration, setConfig, setHost, setParseDuration, setSleepDuration
 

Field Detail

MAX_LIMIT

public static int MAX_LIMIT

OPTIMAL_LIMIT

public static int OPTIMAL_LIMIT

CONSERVATIVE_LIMIT

public static int CONSERVATIVE_LIMIT
Constructor Detail

CommentClient

public CommentClient()
Method Detail

fetch

public void fetch()
           throws java.io.IOException,
                  ParseException,
                  java.lang.InterruptedException
Specified by:
fetch in interface Client
Throws:
java.io.IOException
ParseException
java.lang.InterruptedException

getResults

public java.util.List<BaseItem> getResults()
Specified by:
getResults in interface Client

parseItem

protected BaseResult parseItem(ContentApi.Entry current)
                        throws java.lang.Exception
Specified by:
parseItem in class BaseClient
Throws:
java.lang.Exception

parseItem

protected BaseItem parseItem(org.w3c.dom.Element current)
                      throws java.lang.Exception
Description copied from class: BaseClient
Parse an individual item which might be specific to this client.

Overrides:
parseItem in class BaseClient
Throws:
java.lang.Exception

getMaxLimit

protected int getMaxLimit()
Description copied from class: BaseClient
Return the maximum number of request per call. If the API has more content this might cause an error on our end if the limit is more than 10 or so.

Overrides:
getMaxLimit in class BaseClient

getOptimalLimit

protected int getOptimalLimit()
Description copied from class: BaseClient
Return the optimal limit for fetches. This is used to boost performance in some situations. We have to resort to the conservative limit if the HTTP server can't handle the result set size.

Overrides:
getOptimalLimit in class BaseClient

getConservativeLimit

protected int getConservativeLimit()
Description copied from class: BaseClient
Conservative limit for items which should work in all situations (but might be slower)

Overrides:
getConservativeLimit in class BaseClient

getRouter

public java.lang.String getRouter()
Description copied from class: BaseClient
Return the router for this client. Right now this is either: http://api.spinn3r.com/rss/feed.getDelta? or http://api.spinn3r.com/rss/permalink.getDelta?

Specified by:
getRouter in interface Client
Specified by:
getRouter in class BaseClient


Copyright © Tailrank Inc. All Rights Reserved.