Package com.norconex.crawler.core.fetch
Class AbstractFetcher<C extends BaseFetcherConfig>
java.lang.Object
com.norconex.crawler.core.fetch.AbstractFetcher<C>
- Type Parameters:
C- configuration type
- All Implemented Interfaces:
Configurable<C>,EventListener<Event>,Fetcher,EventListener,Consumer<Event>
- Direct Known Subclasses:
AbstractNioFetcher,BoxFetcher,EgnyteFetcher,GoogleDriveFetcher,HttpClientFetcher,M365GraphFetcher,PlaywrightFetcher,WebDriverFetcher
public abstract class AbstractFetcher<C extends BaseFetcherConfig>
extends Object
implements Fetcher, EventListener<Event>, Configurable<C>
Base class implementing the accept(FetchRequest) method
using reference filters to determine if this fetcher will accept to fetch
a document, in addition to whatever logic implementing classes may provide
by optionally overriding acceptRequest(FetchRequest)
(which otherwise always return true).
It also offers methods to overwrite in order to react to crawler
startup and shutdown events.
-
Field Summary
Fields inherited from interface com.norconex.commons.lang.config.Configurable
PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidfinal booleanaccept(@NonNull FetchRequest fetchRequest) protected booleanacceptRequest(@NonNull FetchRequest fetchRequest) Optional method for subclasses to override when in need for additional acceptance logic beyond reference filters (which this abstract class provides).protected booleanbooleanprotected voidfetcherShutdown(CrawlerSession crawler) Invoked once per fetcher when the crawler ends.protected voidfetcherStartup(CrawlerSession crawler) Invoked once per fetcher instance, when the crawler starts.inthashCode()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.norconex.commons.lang.config.Configurable
getConfiguration
-
Constructor Details
-
AbstractFetcher
public AbstractFetcher()
-
-
Method Details
-
accept
-
acceptRequest
Optional method for subclasses to override when in need for additional acceptance logic beyond reference filters (which this abstract class provides). This method is only invoked if there are no reference filters configured on this class, or all of them accepts the request document. Default implementation does nothing (always returntrue).- Parameters:
fetchRequest- the fetch request to evaluate (nevernull)- Returns:
trueif accepted
-
accept
- Specified by:
acceptin interfaceConsumer<C extends BaseFetcherConfig>
-
fetcherStartup
Invoked once per fetcher instance, when the crawler starts. Default implementation does nothing.- Parameters:
crawler- crawler
-
fetcherShutdown
Invoked once per fetcher when the crawler ends. Default implementation does nothing.- Parameters:
crawler- crawler
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-