Kevin Roast b726c4d6db Merged DEV/TEMPORARY to HEAD
17667: Branch for SpringSurf integration - from HEAD r17665
   17668: Fix to ensure included scripts files are not loaded from a cached classpath loader.
   17670: Part 1 of SpringSurf integration - changes relating to spring-surf-core-1.0.0.CI-SNAPSHOT.jar
   17674: Part 2 of SpringSurf integration - changes relating to spring-surf-core-configservice-1.0.0.CI-SNAPSHOT.jar

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17788 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2009-12-14 13:41:05 +00:00

44 lines
1.5 KiB
Java

package org.alfresco.repo.node.index;
import org.springframework.extensions.surf.util.PropertyCheck;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
* Forces a index recovery using the {@link IndexRecovery recovery component} passed
* in via the job detail.
* <p>
* Nothing is done if the cluster name property <b>alfresco.cluster.name</b> has not been set.
*
* @author Derek Hulley
*/
public class IndexRecoveryJob implements Job
{
public static final String KEY_INDEX_RECOVERY_COMPONENT = "indexRecoveryComponent";
public static final String KEY_CLUSTER_NAME = "clusterName";
/**
* Forces a full index recovery using the {@link IndexRecovery recovery component} passed
* in via the job detail.
*/
public void execute(JobExecutionContext context) throws JobExecutionException
{
JobDataMap map = context.getJobDetail().getJobDataMap();
IndexRecovery indexRecoveryComponent = (IndexRecovery) map.get(KEY_INDEX_RECOVERY_COMPONENT);
if (indexRecoveryComponent == null)
{
throw new JobExecutionException("Missing job data: " + KEY_INDEX_RECOVERY_COMPONENT);
}
String clusterName = (String) map.get(KEY_CLUSTER_NAME);
if (!PropertyCheck.isValidPropertyString(clusterName))
{
// No cluster name
return;
}
// reindex
indexRecoveryComponent.reindex();
}
}