Listing crawls

Call the CasCrawler.listCrawls() method to list the existing crawls.

The syntax of the method is:
CasCrawler.listCrawls()

The method returns a List<CrawlId> object, which has zero or more CrawlId objects. Each CrawlId has the name of a crawl.

To list the set of existing crawls:

  1. Make sure that you have created a connection to the CAS Server. (A CasCrawler object named crawler is used in this example.)
  2. Use the CasCrawler.listCrawls() method to return a list of crawl names. For example:
    List<CrawlId> crawlList = crawler.listCrawls();
  3. Call the CrawlId.getId() method to get the actual name (as a string) of each crawl.
You can also use the following to print out the number of crawls:
System.out.println("There are " + crawler.listCrawls().size() + " crawls configured");

The CasCrawler.listCrawls() method does not throw an exception if it fails.