package mojo;
import index.context.Application;
import index.context.ApplicationLoader;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.maven.plugin.MojoExecutionException;
import parse.LuceneConfiguration;
/**
* @goal viewIndex
*/
public class IndexViewerMojo extends ApplicationLoader {
Log log = LogFactory.getLog(IndexViewerMojo.class);
public void execute() throws MojoExecutionException {
Application application = this.loadApplication();
LuceneConfiguration configuration = application.<LuceneConfiguration> getInstance(LuceneConfiguration.class);
try {
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec("java -jar lukeall.jar -index " + configuration.getIndexLocation());
process.waitFor();
log.debug("****************Exit Value**************" + process.exitValue());
Thread.sleep(5000);
} catch (Exception e) {
log.error("Error processing index at location:" + configuration.getIndexLocation(), e);
}
log.debug("*********************Viewing Index******************");
}
}