org.apache.droids
Class HelloCrawler

Package class diagram package HelloCrawler
java.lang.Object
  extended by org.apache.droids.AbstractDroid
      extended by org.apache.droids.HelloCrawler
All Implemented Interfaces:
Runnable, Droid

public class HelloCrawler
extends AbstractDroid

Default implementation of a crawler. The crawler needs a starting url and extract then the next links with the help of the defaultWorker. Extend this method for your own Droid.


Constructor Summary
HelloCrawler()
           
 
Method Summary
 DelayTimer getDelayTimer()
          Get the DelayTimer implementation that we want to use.
 String getUrl()
          Return the initial url
 Worker getWorker()
          Get the default worker for the class.
 void initQueue()
          Initialize the queue.
 void run()
          Do the work (whatever it is defined in the Droid and their workers)
 void setDelayTimer(DelayTimer delayTimer)
           
 void setUrl(String url)
          Set the initial url
 long startWorkers()
          Will start a new worker.
 
Methods inherited from class org.apache.droids.AbstractDroid
finishedWorker, getCore, getFreeSlots, getMaxThreads, getPool, getQueue, getRunningThreads, getRunningWorker, getTaskDate, setCore, setFreeSlots, setMaxThreads, setPool, setQueue, setRunningThreads, setRunningWorker, setTaskDate, shutdownAndAwaitTermination
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HelloCrawler

public HelloCrawler()
Method Detail

run

public void run()
Do the work (whatever it is defined in the Droid and their workers)

See Also:
Runnable.run()

startWorkers

public long startWorkers()
Description copied from class: AbstractDroid
Will start a new worker.

Specified by:
startWorkers in class AbstractDroid
Returns:
the id of the worker we just started.

initQueue

public void initQueue()
               throws DroidsException
Description copied from interface: Droid
Initialize the queue. Can have different implementation but the main groups normally are
  1. add only one url, from which we then start crawling
  2. add an array of start urls and then crawl them
  3. add an array of urls as fixed subset (no further crawling done)

    Throws:
    DroidsException

getUrl

public String getUrl()
Return the initial url

Returns:
the initial url

setUrl

public void setUrl(String url)
Set the initial url

Parameters:
url - the initial url

getDelayTimer

public DelayTimer getDelayTimer()
Get the DelayTimer implementation that we want to use.

Returns:
the delayTimer we use in the droid

setDelayTimer

public void setDelayTimer(DelayTimer delayTimer)
                   throws DroidsException
Throws:
DroidsException

getWorker

public Worker getWorker()
                 throws DroidsException
Description copied from class: AbstractDroid
Get the default worker for the class.

Specified by:
getWorker in class AbstractDroid
Returns:
Worker that should do the job.
Throws:
DroidsException


Copyright © 2008 The Apache Software Foundation