Call the
CasCrawler.deleteCrawl()
method to delete an existing
crawl.
The syntax of the method is:
CasCrawler.deleteCrawl(CrawlId crawlId)
The
crawlId
parameter is a
CrawlId
object that contains the name of the crawl
to be deleted.
Note
You cannot delete a crawl that is running.
To delete a crawl:
Make sure that you have created a connection to the CAS Server. (A
CasCrawler
object namedcrawler
is used in this example.)Set the name for the crawl to be deleted by first instantiating a
CrawlId
object and then setting Id in the constructor.For example:
// Create a new crawl Id with the name set to Demo. CrawlId crawlId = new CrawlId("Demo");
Call the
CasCrawler.deleteCrawl()
method with theCrawlId
object. To catch exceptions, use atry
block with the appropriatecatch
clauses, as in this example:try { crawler.deleteCrawl(crawlId); } catch (CrawlNotFoundException e) { System.out.println(e.getLocalizedMessage()); }
If the
CasCrawler.deleteCrawl()
method fails, it throws an
exception:
As shown in step 3, use a
try
block to catch these exceptions.