All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codehaus.mojo.cassandra.AbstractCqlLoadMojo Maven / Gradle / Ivy

Go to download

The Mojo Projects plugin for Apache Maven to allow launching a local Apache Cassandra instance from a Maven build

There is a newer version: 2.1.7-z4
Show newest version
package org.codehaus.mojo.cassandra;

import java.io.File;

import org.apache.maven.plugin.MojoExecutionException;

/**
 * Abstract parent class for mojos that load and execute CQL statements from a file.
 *
 * @author sparhomenko
 */
public abstract class AbstractCqlLoadMojo extends AbstractCqlExecMojo
{
    /**
     * The CQL file to load.
     *
     * @parameter default-value="${basedir}/src/cassandra/cql/load.cql"
     */
    private File script;

    /**
     * Whether to ignore errors when loading the script.
     *
     * @parameter expression="${cassandra.load.failure.ignore}"
     */
    private boolean loadFailureIgnore;

    protected void execCqlFile() throws MojoExecutionException
    {
        if (script != null)
        {
            getLog().info("Running " + script + "...");
            try
            {
                executeCql(readFile(script));
                getLog().info("Finished " + script + ".");
            } catch (MojoExecutionException e)
            {
                if (loadFailureIgnore)
                {
                    getLog().error("Script execution failed with " + e.getMessage() + ". Ignoring.");
                } else
                {
                    throw e;
                }
            }
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy