KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > node > index > IndexRecoveryJob


1 package org.alfresco.repo.node.index;
2
3 import org.quartz.Job;
4 import org.quartz.JobExecutionContext;
5 import org.quartz.JobExecutionException;
6
7 /**
8  * Forces a index recovery using the {@link IndexRecovery recovery component} passed
9  * in via the job detail.
10  *
11  * @author Derek Hulley
12  */

13 public class IndexRecoveryJob implements Job
14 {
15     /** KEY_INDEX_RECOVERY_COMPONENT = 'indexRecoveryComponent' */
16     public static final String JavaDoc KEY_INDEX_RECOVERY_COMPONENT = "indexRecoveryComponent";
17     
18     /**
19      * Forces a full index recovery using the {@link IndexRecovery recovery component} passed
20      * in via the job detail.
21      */

22     public void execute(JobExecutionContext context) throws JobExecutionException
23     {
24         IndexRecovery indexRecoveryComponent = (IndexRecovery) context.getJobDetail()
25                 .getJobDataMap().get(KEY_INDEX_RECOVERY_COMPONENT);
26         if (indexRecoveryComponent == null)
27         {
28             throw new JobExecutionException("Missing job data: " + KEY_INDEX_RECOVERY_COMPONENT);
29         }
30         // reindex
31
indexRecoveryComponent.reindex();
32     }
33 }
34
Popular Tags