Package mojo

Source Code of mojo.IndexViewerMojo

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******************");

    }

}
TOP

Related Classes of mojo.IndexViewerMojo

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.