KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > websphinx > CrawlEvent


1 /*
2  * WebSphinx web-crawling toolkit
3  *
4  * Copyright (c) 1998-2002 Carnegie Mellon University. All rights
5  * reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in
16  * the documentation and/or other materials provided with the
17  * distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
20  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
23  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  *
31  */

32
33 package websphinx;
34
35 /**
36  * Crawling event. CrawlEvents are broadcast when the
37  * crawler starts, stops, or clears its state.
38  */

39 public class CrawlEvent
40 {
41     private Crawler crawler;
42     private int id;
43
44     /**
45      * Crawler started.
46      */

47     public static final int STARTED = 0;
48     
49     /**
50      * Crawler ran out of links to crawl
51      */

52     public static final int STOPPED = 1;
53
54     /**
55      * Crawler's state was cleared.
56      */

57     public static final int CLEARED = 2;
58
59     /**
60      * Crawler timeout expired.
61      */

62     public static final int TIMED_OUT = 3;
63
64     /**
65      * Crawler was paused.
66      */

67     public static final int PAUSED = 4;
68
69     /**
70      * Make a CrawlEvent.
71      * @param crawler Crawler that generated this event
72      * @param id event id (one of STARTED, STOPPED, etc.)
73      */

74     public CrawlEvent (Crawler crawler, int id) {
75         this.crawler = crawler;
76         this.id = id;
77     }
78
79     /**
80      * Get crawler that generated the event
81      * @return crawler
82      */

83     public Crawler getCrawler () {
84         return crawler;
85     }
86
87     /**
88      * Get event id.
89      * @return one of STARTED, STOPPED, CLEARED, TIMED_OUT,
90      * or PAUSED.
91      */

92     public int getID () { return id; }
93
94 }
95
Popular Tags