Package org.codehaus.mojo.cassandra
Class AbstractCassandraMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.codehaus.mojo.cassandra.AbstractCassandraMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AbstractCqlExecMojo,AbstractSchemaCassandraMojo,CleanupCassandraMojo,CompactCassandraMojo,FlushCassandraMojo,RepairCassandraMojo,TruncateCassandraMojo
public abstract class AbstractCassandraMojo extends org.apache.maven.plugin.AbstractMojoBase class for all the Cassandra Maven Plugin goals.- Author:
- stephenc
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanaddMainClasspathAdds the main classpath to cassandra (for example you could use this when you have a custom comparator on your main classpath.protected booleanaddTestClasspathAdds the test classpath to cassandra (for example you could use this when you have a custom comparator on your test classpath.protected FilecassandraDirThe directory to hold cassandra's database.protected intjmxPortPort to listen to for the JMX interface.protected StringkeyspaceThe keyspace against which individual operations will be executedprotected StringlistenAddressAddress to bind to and tell other Cassandra nodes to connect to.protected StringlogLevelLog level of cassandra process.protected intmaxMemoryNumber of megabytes to limit the cassandra JVM to.protected intnativeTransportPortPort on which the CQL native transport listens for clients.protected org.apache.maven.project.MavenProjectprojectThe enclosing project.protected StringrpcAddressAddress to use for the RPC interface.protected org.apache.maven.execution.MavenSessionsessionThe current build session instance.protected booleanskipSkip the execution.protected booleanstartNativeTransportEnable or disable the native transport server.protected StringstopKeyKey to be provided when stopping cassandraprotected intstopPortPort to listen to for receiving the stop command overprotected intstoragePortPort to listen to for the Storage interface.protected Map<String,String>systemPropertyVariablesList of System properties to pass to the JUnit tests.
-
Constructor Summary
Constructors Constructor Description AbstractCassandraMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcreateCassandraHome()Creates the cassandra home directory.protected voidcreateCassandraHome(File cassandraDir, String listenAddress, String rpcAddress, BigInteger initialToken, String[] seeds)Creates the cassandra home directory.protected voidcreateCassandraJar(File jarFile, String mainClass)Create a jar with just a manifest containing a Main-Class entry for SurefireBooter and a Class-Path entry for all classpath elements.protected voidcreateCassandraJar(File jarFile, String mainClass, File cassandraDir)Create a jar with just a manifest containing a Main-Class entry for SurefireBooter and a Class-Path entry for all classpath elements.protected Map<String,String>createEnvironmentVars()Creates the environment required when launching Cassandra or the CLI tools.protected org.apache.maven.toolchain.ToolchaingetToolchain()Gets the Java toolchain.protected org.apache.commons.exec.CommandLinenewJavaCommandLine()Create aCommandLineto launch Java.protected org.apache.commons.exec.CommandLinenewNodetoolCommandLine(String... args)Creates the command line to launch thenodetoolutility.protected org.apache.commons.exec.CommandLinenewServiceCommandLine()Creates the command line to launch the cassandra server.protected org.apache.commons.exec.CommandLinenewServiceCommandLine(File cassandraDir, String listenAddress, String rpcAddress, BigInteger initialToken, String[] seeds, boolean jmxRemoteEnabled, int jmxPort)Creates the command line to launch the cassandra server.protected booleanuseJdk11Options()-
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
-
-
-
Field Detail
-
cassandraDir
@Parameter(defaultValue="${project.build.directory}/cassandra") protected File cassandraDirThe directory to hold cassandra's database.
-
project
@Parameter(readonly=true) protected org.apache.maven.project.MavenProject project
The enclosing project.
-
addTestClasspath
@Parameter(defaultValue="false") protected boolean addTestClasspath
Adds the test classpath to cassandra (for example you could use this when you have a custom comparator on your test classpath.
-
addMainClasspath
@Parameter(defaultValue="false") protected boolean addMainClasspath
Adds the main classpath to cassandra (for example you could use this when you have a custom comparator on your main classpath.
-
skip
@Parameter(property="cassandra.skip", defaultValue="false") protected boolean skipSkip the execution.
-
session
@Parameter(defaultValue="${session}", required=true, readonly=true) protected org.apache.maven.execution.MavenSession sessionThe current build session instance. This is used for toolchain manager API calls.
-
rpcAddress
@Parameter(defaultValue="127.0.0.1", required=true) protected String rpcAddressAddress to use for the RPC interface. Do not change this unless you really know what you are doing.
-
jmxPort
@Parameter(property="cassandra.jmxPort", defaultValue="7199") protected int jmxPortPort to listen to for the JMX interface.
-
nativeTransportPort
@Parameter(property="cassandra.nativeTransportPort", defaultValue="9042") protected int nativeTransportPortPort on which the CQL native transport listens for clients.- Since:
- 2.0.0-1
-
startNativeTransport
@Parameter(property="cassandra.startNativeTransport", defaultValue="true") protected boolean startNativeTransportEnable or disable the native transport server. Currently, only the Thrift server is started by default because the native transport is considered beta.- Since:
- 2.0.0-1
-
listenAddress
@Parameter(defaultValue="127.0.0.1") protected String listenAddress
Address to bind to and tell other Cassandra nodes to connect to. You must change this if you want multiple nodes to be able to communicate!
Leaving it blank leaves it up to InetAddress.getLocalHost(). This will always do the Right Thing if the node is properly configured (hostname, name resolution, etc), and the Right Thing is to use the address associated with the hostname (it might not be).
Setting this to 0.0.0.0 is always wrong. Do not change this unless you really know what you are doing.
-
storagePort
@Parameter(property="cassandra.storagePort", defaultValue="7000") protected int storagePortPort to listen to for the Storage interface.
-
stopPort
@Parameter(property="cassandra.stopPort", defaultValue="8081") protected int stopPortPort to listen to for receiving the stop command over
-
stopKey
@Parameter(property="cassandra.stopKey", defaultValue="cassandra-maven-plugin") protected String stopKeyKey to be provided when stopping cassandra
-
maxMemory
@Parameter(property="cassandra.maxMemory", defaultValue="512") protected int maxMemoryNumber of megabytes to limit the cassandra JVM to.
-
keyspace
@Parameter(property="cassandra.keyspace") protected String keyspace
The keyspace against which individual operations will be executed
-
systemPropertyVariables
@Parameter protected Map<String,String> systemPropertyVariables
List of System properties to pass to the JUnit tests.- Since:
- 1.2.1-2
-
logLevel
@Parameter(defaultValue="ERROR") protected String logLevel
Log level of cassandra process. Logging is performed via log4j2.- Since:
- 3.5
-
-
Method Detail
-
createCassandraJar
protected void createCassandraJar(File jarFile, String mainClass) throws IOException
Create a jar with just a manifest containing a Main-Class entry for SurefireBooter and a Class-Path entry for all classpath elements. Copied from surefire (ForkConfiguration#createJar())- Parameters:
jarFile- The jar file to create/updatemainClass- The main class to run.- Throws:
IOException- if something went wrong.
-
useJdk11Options
protected boolean useJdk11Options()
-
createCassandraJar
protected void createCassandraJar(File jarFile, String mainClass, File cassandraDir) throws IOException
Create a jar with just a manifest containing a Main-Class entry for SurefireBooter and a Class-Path entry for all classpath elements. Copied from surefire (ForkConfiguration#createJar())- Parameters:
jarFile- The jar file to create/updatemainClass- The main class to run.- Throws:
IOException- if something went wrong.
-
createCassandraHome
protected void createCassandraHome() throws IOExceptionCreates the cassandra home directory.- Throws:
IOException- if something goes wrong.
-
createCassandraHome
protected void createCassandraHome(File cassandraDir, String listenAddress, String rpcAddress, BigInteger initialToken, String[] seeds) throws IOException
Creates the cassandra home directory.- Parameters:
cassandraDir- the cassandra home directory.- Throws:
IOException- if something goes wrong.
-
getToolchain
protected org.apache.maven.toolchain.Toolchain getToolchain()
Gets the Java toolchain.- Returns:
- the Java toolchain.
-
newJavaCommandLine
protected org.apache.commons.exec.CommandLine newJavaCommandLine()
Create aCommandLineto launch Java.- Returns:
- a
CommandLineto launch Java.
-
createEnvironmentVars
protected Map<String,String> createEnvironmentVars()
Creates the environment required when launching Cassandra or the CLI tools.- Returns:
- the environment required when launching Cassandra or the CLI tools.
-
newServiceCommandLine
protected org.apache.commons.exec.CommandLine newServiceCommandLine() throws IOExceptionCreates the command line to launch the cassandra server.- Returns:
- the command line to launch the cassandra server.
- Throws:
IOException- if there are issues creating the cassandra home directory.
-
newServiceCommandLine
protected org.apache.commons.exec.CommandLine newServiceCommandLine(File cassandraDir, String listenAddress, String rpcAddress, BigInteger initialToken, String[] seeds, boolean jmxRemoteEnabled, int jmxPort) throws IOException
Creates the command line to launch the cassandra server.- Returns:
- the command line to launch the cassandra server.
- Throws:
IOException- if there are issues creating the cassandra home directory.
-
newNodetoolCommandLine
protected org.apache.commons.exec.CommandLine newNodetoolCommandLine(String... args) throws IOException
Creates the command line to launch thenodetoolutility.- Parameters:
args- the command line arguments to pass to thenodetoolutility.- Returns:
- the
CommandLineto launchnodetoolwith the supplied arguments. - Throws:
IOException- if there are issues creating the cassandra home directory.
-
-