websphinx
Class LinkEvent

java.lang.Object
  |
  +--websphinx.LinkEvent

public class LinkEvent
extends java.lang.Object

Link event. A LinkEvent is issued when the crawler starts or stops retrieving a link, and when it makes a decision about a link.


Field Summary
static int ALREADY_VISITED
          Link has already been visited during the crawl, so it was skipped.
static int DOWNLOADED
          Link has been retrieved
static int ERROR
          An error occurred in retrieving the page.
static java.lang.String[] eventName
          Map from id code (RETRIEVING) to name ("retrieving")
static int NONE
          No event occured on this link yet.
static int QUEUED
          Link was accepted by walk() and is waiting to be downloaded
static int RETRIEVING
          Link is being retrieved
static int SKIPPED
          Link was rejected by shouldVisit()
static int TOO_DEEP
          Link was accepted by walk() but exceeds the maximum depth from the start set.
static int VISITED
          Link has been thoroughly processed by crawler
 
Constructor Summary
LinkEvent(Crawler crawler, int id, Link link)
          Make a LinkEvent.
LinkEvent(Crawler crawler, int id, Link link, java.lang.Throwable exception)
          Make a LinkEvent for an error.
 
Method Summary
 Crawler getCrawler()
          Get crawler that generated the event
 java.lang.Throwable getException()
          Get exception related to this event.
 int getID()
          Get event id
 Link getLink()
          Get link to which this event occurred.
 java.lang.String getName()
          Get event name (string equivalent to its ID)
 java.lang.String toString()
          Convert this event to a String describing it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
No event occured on this link yet. Never delivered in a LinkEvent, but may be returned by link.getStatus().


SKIPPED

public static final int SKIPPED
Link was rejected by shouldVisit()


ALREADY_VISITED

public static final int ALREADY_VISITED
Link has already been visited during the crawl, so it was skipped.


TOO_DEEP

public static final int TOO_DEEP
Link was accepted by walk() but exceeds the maximum depth from the start set.


QUEUED

public static final int QUEUED
Link was accepted by walk() and is waiting to be downloaded


RETRIEVING

public static final int RETRIEVING
Link is being retrieved


ERROR

public static final int ERROR
An error occurred in retrieving the page. The error can be obtained from getException().


DOWNLOADED

public static final int DOWNLOADED
Link has been retrieved


VISITED

public static final int VISITED
Link has been thoroughly processed by crawler


eventName

public static final java.lang.String[] eventName
Map from id code (RETRIEVING) to name ("retrieving")

Constructor Detail

LinkEvent

public LinkEvent(Crawler crawler,
                 int id,
                 Link link)
Make a LinkEvent.

Parameters:
crawler - Crawler that generated this event
id - event code, like LinkEvent.RETRIEVING
link - Link on which this event occurred

LinkEvent

public LinkEvent(Crawler crawler,
                 int id,
                 Link link,
                 java.lang.Throwable exception)
Make a LinkEvent for an error.

Parameters:
crawler - Crawler that generated this event
id - Event code, usually ERROR
link - Link on which this event occurred
exception - Throwable
Method Detail

getCrawler

public Crawler getCrawler()
Get crawler that generated the event

Returns:
crawler

getID

public int getID()
Get event id

Returns:
id

getName

public java.lang.String getName()
Get event name (string equivalent to its ID)

Returns:
id

getLink

public Link getLink()
Get link to which this event occurred.

Returns:
link

getException

public java.lang.Throwable getException()
Get exception related to this event. Valid when ID == ERROR.

Returns:
exception object

toString

public java.lang.String toString()
Convert this event to a String describing it.

Overrides:
toString in class java.lang.Object