| | 1 | = Data Crawler = |
| | 2 | |
| | 3 | == Java Interface == |
| | 4 | |
| | 5 | /** |
| | 6 | * A DataCrawler accesses the physical source represented by a DataSource |
| | 7 | * and delivers a stream of DataObjects representing the individual items |
| | 8 | * in that source. |
| | 9 | */ |
| | 10 | public interface DataCrawler { |
| | 11 | |
| | 12 | /** |
| | 13 | * Constants used to indicate why a scan was stopped. |
| | 14 | */ |
| | 15 | public static enum ExitCode { |
| | 16 | COMPLETED, // the scan procedure terminated normally |
| | 17 | BY_REQUEST, // the DataCrawler was requested to abort the scan procedure |
| | 18 | FATAL_EXCEPTION // an error occurred that made further scanning impossible |
| | 19 | }; |
| | 20 | |
| | 21 | /** |
| | 22 | * Returns the DataSource crawler by this DataCrawler. |
| | 23 | */ |
| | 24 | public DataSource getDataSource(); |
| | 25 | |
| | 26 | /** |
| | 27 | * Starts a scan for DataObjects over the configured domain defined |
| | 28 | * in the DataSource. If this is not the first run of this DataCrawler, |
| | 29 | * it will only report the differences with the previous run, unless the |
| | 30 | * previous scan results have been cleared. |
| | 31 | **/ |
| | 32 | public void scan(); |
| | 33 | |
| | 34 | /** |
| | 35 | * Stops a running scan operation as fast as possible. This method |
| | 36 | * may return before the operation has actually been stopped. |
| | 37 | **/ |
| | 38 | public void stopScanning(); |
| | 39 | |
| | 40 | /** |
| | 41 | * Clears all stored scan results. Any listeners registered with |
| | 42 | * this data source will be notified of the removal of the data |
| | 43 | * objects. The next call to scan() will again report all |
| | 44 | * data objects in the configured domain. |
| | 45 | **/ |
| | 46 | public void clearScanResults(); |
| | 47 | |
| | 48 | /** |
| | 49 | * Gets the ScanReport of the last performed scan, or the current |
| | 50 | * scan when a scan is in progress. Returns null when |
| | 51 | * no scan was performed in this session and there is no scan report |
| | 52 | * available from the previous session. |
| | 53 | * |
| | 54 | * @return The ScanReport of the last session, or null when |
| | 55 | * this is not available. |
| | 56 | **/ |
| | 57 | public ScanReport getLastScanReport(); |
| | 58 | |
| | 59 | /** |
| | 60 | * Adds a DataSourceListener to which this data source should |
| | 61 | * report any scanned or cleared data objects. |
| | 62 | * |
| | 63 | * @param listener The DataCrawlerListener to add. |
| | 64 | **/ |
| | 65 | public void addListener(DataCrawlerListener listener); |
| | 66 | |
| | 67 | /** |
| | 68 | * Removes a DataSourceListener from this data source. |
| | 69 | * |
| | 70 | * @param listener The DataCrawlerListener to remove. |
| | 71 | **/ |
| | 72 | public void removeListener(DataCrawlerListener listener); |
| | 73 | } |