Call the
CasCrawler.updateCrawl()
method to change the
configuration settings for an existing crawl.
The syntax of the method is:
CasCrawler.updateCrawl(CrawlConfig crawlConfig)
The
crawlConfig
parameter is a
CrawlConfig
object that has the configuration
settings of the crawl.
If you update a crawl configuration and specify an empty
ModuleProperty
for a password property, the crawl
configuration reuses the password stored on CAS Server.
Note
You cannot change the configuration if the crawl is running.
To update the configuration settings of an existing 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 modified by first instantiating a
CrawlId
object 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");
Call the
CasCrawler.getCrawlConfig()
method to retrieve the current configuration.For example:
CrawlConfig crawlConfig = crawler.getCrawlConfig(crawlId, false);
Update the file system crawl by using the
CasCrawler.updateCrawl()
method with the previously createdcrawlConfig
.For example:
crawler.updateCrawl(crawlConfig);
If the
CasCrawler.updateCrawl()
method fails, it throws an
exception:
To catch these exceptions, use a
try
block when you issue the method.