View Javadoc

    1   /* Copyright (C) 2003 Internet Archive.
    2    *
    3    * This file is part of the Heritrix web crawler (crawler.archive.org).
    4    *
    5    * Heritrix is free software; you can redistribute it and/or modify
    6    * it under the terms of the GNU Lesser Public License as published by
    7    * the Free Software Foundation; either version 2.1 of the License, or
    8    * any later version.
    9    *
    10   * Heritrix is distributed in the hope that it will be useful,
    11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13   * GNU Lesser Public License for more details.
    14   *
    15   * You should have received a copy of the GNU Lesser Public License
    16   * along with Heritrix; if not, write to the Free Software
    17   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    18   */
    19  package org.archive.crawler.event;
    20
    21  import java.io.File;
    22
    23  import org.archive.crawler.framework.CrawlController;
    24
    25
    26  /***
    27   * Listen for CrawlStatus events.
    28   *
    29   * Classes that implement this interface can register themselves with
    30   * a CrawlController to receive notifications about the events that
    31   * affect a crawl job's current status.
    32   *
    33   * @author Kristinn Sigurdsson
    34   *
    35   * @see org.archive.crawler.framework.CrawlController#addCrawlStatusListener(CrawlStatusListener)
    36   */
    37
    38  public interface CrawlStatusListener {
    39      /***
    40       * Called on crawl start.
    41       * @param message Start message.
    42       */
    43      public void crawlStarted(String message);
    44
    45      /***
    46       * Called when a CrawlController is ending a crawl (for any reason)
    47       *
    48       * @param sExitMessage Type of exit. Should be one of the STATUS constants
    49       * in defined in CrawlJob.
    50       *
    51       * @see org.archive.crawler.admin.CrawlJob
    52       */
    53      public void crawlEnding(String sExitMessage);
    54
    55      /***
    56       * Called when a CrawlController has ended a crawl and is about to exit.
    57       *
    58       * @param sExitMessage Type of exit. Should be one of the STATUS constants
    59       * in defined in CrawlJob.
    60       *
    61       * @see org.archive.crawler.admin.CrawlJob
    62       */
    63      public void crawlEnded(String sExitMessage);
    64
    65      /***
    66       * Called when a CrawlController is going to be paused.
    67       *
    68       * @param statusMessage Should be
    69       * {@link org.archive.crawler.admin.CrawlJob#STATUS_WAITING_FOR_PAUSE
    70       * STATUS_WAITING_FOR_PAUSE}. Passed for convenience
    71       */
    72      public void crawlPausing(String statusMessage);
    73
    74      /***
    75       * Called when a CrawlController is actually paused (all threads are idle).
    76       *
    77       * @param statusMessage Should be
    78       * {@link org.archive.crawler.admin.CrawlJob#STATUS_PAUSED}. Passed for
    79       * convenience
    80       */
    81      public void crawlPaused(String statusMessage);
    82
    83      /***
    84       * Called when a CrawlController is resuming a crawl that had been paused.
    85       *
    86       * @param statusMessage Should be
    87       * {@link org.archive.crawler.admin.CrawlJob#STATUS_RUNNING}. Passed for
    88       * convenience
    89       */
    90      public void crawlResuming(String statusMessage);
    91
    92      /***
    93       * Called by {@link CrawlController} when checkpointing.
    94       * @param checkpointDir Checkpoint dir.  Write checkpoint state here.
    95       * @throws Exception A fatal exception.  Any exceptions
    96       * that are let out of this checkpoint are assumed fatal
    97       * and terminate further checkpoint processing.
    98       */
    99      public void crawlCheckpoint(File checkpointDir) throws Exception;
    100 }