Package org.webharvest.ioc
Class ScrapingInterceptor.ScrapingAwareHelper
- java.lang.Object
-
- org.webharvest.ioc.ScrapingInterceptor.ScrapingAwareHelper
-
- Enclosing class:
- ScrapingInterceptor
public static class ScrapingInterceptor.ScrapingAwareHelper extends Object
Guice aware helper class that maintains collection of registeredScrapingAware
listeners. It simplifies notification of all registered listeners about updates the instances ofScrapingAware
are interested in. That is when new scraping scope is created or tore down. It has almost exactly the same methods (onBeforeScraping(Harvester)
andonAfterScraping(Harvester)
as those introduced byScrapingAware
. However by contrast it does not implement this interface as there is a threat it would be automatically self-registered by Guice. The instance of this object is meant to be a singleton (especially for Guice).- Since:
- 2.1.0-SNAPSHOT
- Version:
- %I%, %G%
- Author:
- Robert Bala
- See Also:
ScrapingAware
-
-
Constructor Summary
Constructors Constructor Description ScrapingAwareHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(ScrapingAware listener)
RegisterScrapingAware
listener.void
onAfterScraping(Harvester harvester)
Notify all registered listeners about scraping scope that is about the end.void
onBeforeScraping(Harvester harvester)
Notify all registered listeners about new scraping scope.
-
-
-
Method Detail
-
addListener
public void addListener(ScrapingAware listener)
RegisterScrapingAware
listener.- Parameters:
listener
- reference to listener object.
-
onBeforeScraping
public void onBeforeScraping(Harvester harvester)
Notify all registered listeners about new scraping scope.- Parameters:
harvester
- reference to theHarvester
the event applies to.
-
-