org.niocchi.urlpools
Class SimpleListURLPool

java.lang.Object
  extended by org.niocchi.urlpools.SimpleListURLPool
All Implemented Interfaces:
URLPool

public class SimpleListURLPool
extends java.lang.Object
implements URLPool

A simple URL Pool that iterates over a list of URLS.


Constructor Summary
SimpleListURLPool(java.lang.Iterable<java.lang.String> list)
           
SimpleListURLPool(java.util.Iterator<java.lang.String> list)
           
 
Method Summary
 Query getNextQuery()
           
 boolean hasNextQuery()
           
 void setProcessed(Query resource_)
          This method is called by the crawler when the query has been processed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleListURLPool

public SimpleListURLPool(java.util.Iterator<java.lang.String> list)

SimpleListURLPool

public SimpleListURLPool(java.lang.Iterable<java.lang.String> list)
Method Detail

hasNextQuery

public boolean hasNextQuery()
Specified by:
hasNextQuery in interface URLPool
Returns:
true if there is at least one query to crawl (i.e. getNextQuery will return a query at some point), false if no more queries to crawl (a call to getNextQuery will throw an URLPoolException).

setProcessed

public void setProcessed(Query resource_)
Description copied from interface: URLPool
This method is called by the crawler when the query has been processed. That gives the oportunity to the url pool to implement specific behaviors (for instance, send back the query to the crawler if it got a timeout.

Specified by:
setProcessed in interface URLPool

getNextQuery

public Query getNextQuery()
                   throws URLPoolException
Specified by:
getNextQuery in interface URLPool
Returns:
null if no query is yet available, otherwise return a Query. Throws URLPoolException is no query will be available (a call to hasNextQuery() must returns false).
Throws:
URLPoolException