Call the
CasCrawler.getStatus() method to retrieve the status of
a crawl.
The syntax of the method is:
CasCrawler.getStatus(CrawlId crawlId)
The
crawlId parameter is a
CrawlId object that contains the name of the crawl
for which status is to be returned.
The method returns a
Status object, which will have the status of the
crawl as a
CrawlerState simple data type:
To get the status of a crawl:
Make sure that you have created a connection to the CAS Server. (A
CasCrawlerobject namedcrawleris used in this example.)Set the name for the crawl by first instantiating a
CrawlIdobject and then setting its Id in the constructor.For example:
// Create a new crawl Id with the name set to Demo. CrawlId crawlId = new CrawlId("Demo");Declare a
CrawlerStatevariable and initialize it by calling theCasCrawler.getStatus()method with the crawl ID. Note that the status is actually returned by theState.getState()method.For example:
CrawlerState state; state = crawler.getStatus(crawlId).getState();
For example:
System.out.println("Crawl status: " + state);
The
CasCrawler.getStatus() method throws a
CrawlNotFoundException if the specified crawl (the
crawlId parameter) does not exist or is
otherwise not found. To catch an exception, use a
try block with the appropriate
catch clause.

