Class ScrapingInterceptor.ScrapingAwareHelper

  • Enclosing class:
    ScrapingInterceptor

    public static class ScrapingInterceptor.ScrapingAwareHelper
    extends Object
    Guice aware helper class that maintains collection of registered ScrapingAware listeners. It simplifies notification of all registered listeners about updates the instances of ScrapingAware are interested in. That is when new scraping scope is created or tore down. It has almost exactly the same methods ( onBeforeScraping(Harvester) and onAfterScraping(Harvester) as those introduced by ScrapingAware. 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 Detail

      • ScrapingAwareHelper

        public ScrapingAwareHelper()
    • Method Detail

      • addListener

        public void addListener​(ScrapingAware listener)
        Register ScrapingAware 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 the Harvester the event applies to.
      • onAfterScraping

        public void onAfterScraping​(Harvester harvester)
        Notify all registered listeners about scraping scope that is about the end.
        Parameters:
        harvester - reference to the Harvester the event applies to.