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

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

package org.codehaus.mojo.cassandra;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;

/**
 * Display help information on cassandra-maven-plugin.
Call
  mvn cassandra:help -Ddetail=true -Dgoal=<goal-name>
to display parameter details. * * @version generated on Wed Oct 12 23:21:18 IST 2011 * @author org.apache.maven.tools.plugin.generator.PluginHelpGenerator (version 2.7) * @goal help * @requiresProject false * @threadSafe */ public class HelpMojo extends AbstractMojo { /** * If true, display all settable properties for each goal. * * @parameter expression="${detail}" default-value="false" */ private boolean detail; /** * The name of the goal for which to show help. If unspecified, all goals will be displayed. * * @parameter expression="${goal}" */ private java.lang.String goal; /** * The maximum length of a display line, should be positive. * * @parameter expression="${lineLength}" default-value="80" */ private int lineLength; /** * The number of spaces per indentation level, should be positive. * * @parameter expression="${indentSize}" default-value="2" */ private int indentSize; /** {@inheritDoc} */ public void execute() throws MojoExecutionException { if ( lineLength <= 0 ) { getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." ); lineLength = 80; } if ( indentSize <= 0 ) { getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." ); indentSize = 2; } StringBuffer sb = new StringBuffer(); append( sb, "org.codehaus.mojo:cassandra-maven-plugin:1.0.0-1", 0 ); append( sb, "", 0 ); append( sb, "Mojo\'s Cassandra Maven Plugin", 0 ); append( sb, "The Mojo Projects plugin for Apache Maven to allow launching a local Apache Cassandra instance from a Maven build", 1 ); append( sb, "", 0 ); if ( goal == null || goal.length() <= 0 ) { append( sb, "This plugin has 13 goals:", 0 ); append( sb, "", 0 ); } if ( goal == null || goal.length() <= 0 || "cleanup".equals( goal ) ) { append( sb, "cassandra:cleanup", 0 ); append( sb, "Runs nodetool cleanup on a Cassandra instance.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "addMainClasspath (Default: false)", 2 ); append( sb, "Adds the main classpath to cassandra (for example you could use this when you have a custom comparator on your main classpath.", 3 ); append( sb, "", 0 ); append( sb, "addTestClasspath (Default: false)", 2 ); append( sb, "Adds the test classpath to cassandra (for example you could use this when you have a custom comparator on your test classpath.", 3 ); append( sb, "", 0 ); append( sb, "cassandraDir (Default: ${project.build.directory}/cassandra)", 2 ); append( sb, "The directory to hold cassandra\'s database.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "classesDirectory", 2 ); append( sb, "The directory containing generated classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.outputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "jmxPort (Default: 7199)", 2 ); append( sb, "Port to listen to for the JMX interface.", 3 ); append( sb, "Expression: ${cassandra.jmxPort}", 3 ); append( sb, "", 0 ); append( sb, "keyspace", 2 ); append( sb, "The keyspace against which individual operations will be executed", 3 ); append( sb, "Expression: ${cassandra.keyspace}", 3 ); append( sb, "", 0 ); append( sb, "listenAddress (Default: 127.0.0.1)", 2 ); append( sb, "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.", 3 ); append( sb, "", 0 ); append( sb, "maxMemory (Default: 512)", 2 ); append( sb, "Number of megabytes to limit the cassandra JVM to.", 3 ); append( sb, "Expression: ${cassandra.maxMemory}", 3 ); append( sb, "", 0 ); append( sb, "rpcAddress (Default: 127.0.0.1)", 2 ); append( sb, "Address to use for the RPC interface. Do not change this unless you really know what you are doing.", 3 ); append( sb, "", 0 ); append( sb, "rpcPort (Default: 9160)", 2 ); append( sb, "Port to listen to for the RPC interface.", 3 ); append( sb, "Expression: ${cassandra.rpcPort}", 3 ); append( sb, "", 0 ); append( sb, "skip (Default: false)", 2 ); append( sb, "Skip the execution.", 3 ); append( sb, "Expression: ${cassandra.skip}", 3 ); append( sb, "", 0 ); append( sb, "stopKey (Default: cassandra-maven-plugin)", 2 ); append( sb, "Key to be provided when stopping cassandra", 3 ); append( sb, "Expression: ${cassandra.stopKey}", 3 ); append( sb, "", 0 ); append( sb, "stopPort (Default: 8081)", 2 ); append( sb, "Port to listen to for receiving the stop command over", 3 ); append( sb, "Expression: ${cassandra.stopPort}", 3 ); append( sb, "", 0 ); append( sb, "storagePort (Default: 7000)", 2 ); append( sb, "Port to listen to for the Storage interface.", 3 ); append( sb, "Expression: ${cassandra.storagePort}", 3 ); append( sb, "", 0 ); append( sb, "testClassesDirectory", 2 ); append( sb, "The directory containing generated test classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.testOutputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "yaml", 2 ); append( sb, "In yaml format any overrides or additional configuration that you want to apply to the server.", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "compact".equals( goal ) ) { append( sb, "cassandra:compact", 0 ); append( sb, "Runs nodetool compact on a Cassandra instance.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "addMainClasspath (Default: false)", 2 ); append( sb, "Adds the main classpath to cassandra (for example you could use this when you have a custom comparator on your main classpath.", 3 ); append( sb, "", 0 ); append( sb, "addTestClasspath (Default: false)", 2 ); append( sb, "Adds the test classpath to cassandra (for example you could use this when you have a custom comparator on your test classpath.", 3 ); append( sb, "", 0 ); append( sb, "cassandraDir (Default: ${project.build.directory}/cassandra)", 2 ); append( sb, "The directory to hold cassandra\'s database.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "classesDirectory", 2 ); append( sb, "The directory containing generated classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.outputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "jmxPort (Default: 7199)", 2 ); append( sb, "Port to listen to for the JMX interface.", 3 ); append( sb, "Expression: ${cassandra.jmxPort}", 3 ); append( sb, "", 0 ); append( sb, "keyspace", 2 ); append( sb, "The keyspace against which individual operations will be executed", 3 ); append( sb, "Expression: ${cassandra.keyspace}", 3 ); append( sb, "", 0 ); append( sb, "listenAddress (Default: 127.0.0.1)", 2 ); append( sb, "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.", 3 ); append( sb, "", 0 ); append( sb, "maxMemory (Default: 512)", 2 ); append( sb, "Number of megabytes to limit the cassandra JVM to.", 3 ); append( sb, "Expression: ${cassandra.maxMemory}", 3 ); append( sb, "", 0 ); append( sb, "rpcAddress (Default: 127.0.0.1)", 2 ); append( sb, "Address to use for the RPC interface. Do not change this unless you really know what you are doing.", 3 ); append( sb, "", 0 ); append( sb, "rpcPort (Default: 9160)", 2 ); append( sb, "Port to listen to for the RPC interface.", 3 ); append( sb, "Expression: ${cassandra.rpcPort}", 3 ); append( sb, "", 0 ); append( sb, "skip (Default: false)", 2 ); append( sb, "Skip the execution.", 3 ); append( sb, "Expression: ${cassandra.skip}", 3 ); append( sb, "", 0 ); append( sb, "stopKey (Default: cassandra-maven-plugin)", 2 ); append( sb, "Key to be provided when stopping cassandra", 3 ); append( sb, "Expression: ${cassandra.stopKey}", 3 ); append( sb, "", 0 ); append( sb, "stopPort (Default: 8081)", 2 ); append( sb, "Port to listen to for receiving the stop command over", 3 ); append( sb, "Expression: ${cassandra.stopPort}", 3 ); append( sb, "", 0 ); append( sb, "storagePort (Default: 7000)", 2 ); append( sb, "Port to listen to for the Storage interface.", 3 ); append( sb, "Expression: ${cassandra.storagePort}", 3 ); append( sb, "", 0 ); append( sb, "testClassesDirectory", 2 ); append( sb, "The directory containing generated test classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.testOutputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "yaml", 2 ); append( sb, "In yaml format any overrides or additional configuration that you want to apply to the server.", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "cql-exec".equals( goal ) ) { append( sb, "cassandra:cql-exec", 0 ); append( sb, "Executes cql statements from maven.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "addMainClasspath (Default: false)", 2 ); append( sb, "Adds the main classpath to cassandra (for example you could use this when you have a custom comparator on your main classpath.", 3 ); append( sb, "", 0 ); append( sb, "addTestClasspath (Default: false)", 2 ); append( sb, "Adds the test classpath to cassandra (for example you could use this when you have a custom comparator on your test classpath.", 3 ); append( sb, "", 0 ); append( sb, "cassandraDir (Default: ${project.build.directory}/cassandra)", 2 ); append( sb, "The directory to hold cassandra\'s database.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "classesDirectory", 2 ); append( sb, "The directory containing generated classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.outputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "comparator", 2 ); append( sb, "Expected type of the column name", 3 ); append( sb, "Expression: ${cql.comparator}", 3 ); append( sb, "", 0 ); append( sb, "cqlScript (Default: ${basedir}/src/cassandra/cql/exec.cql)", 2 ); append( sb, "The CQL script which will be executed", 3 ); append( sb, "Expression: ${cassandra.cql.script}", 3 ); append( sb, "", 0 ); append( sb, "cqlStatement", 2 ); append( sb, "The CQL statement to execute singularly", 3 ); append( sb, "Expression: ${cql.statement}", 3 ); append( sb, "", 0 ); append( sb, "defaultValidator", 2 ); append( sb, "Expected type of the column value", 3 ); append( sb, "Expression: ${cql.defaultValidator}", 3 ); append( sb, "", 0 ); append( sb, "jmxPort (Default: 7199)", 2 ); append( sb, "Port to listen to for the JMX interface.", 3 ); append( sb, "Expression: ${cassandra.jmxPort}", 3 ); append( sb, "", 0 ); append( sb, "keyspace", 2 ); append( sb, "The keyspace against which individual operations will be executed", 3 ); append( sb, "Expression: ${cassandra.keyspace}", 3 ); append( sb, "", 0 ); append( sb, "keyValidator", 2 ); append( sb, "Expected type of the key", 3 ); append( sb, "Expression: ${cql.keyValidator}", 3 ); append( sb, "", 0 ); append( sb, "listenAddress (Default: 127.0.0.1)", 2 ); append( sb, "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.", 3 ); append( sb, "", 0 ); append( sb, "maxMemory (Default: 512)", 2 ); append( sb, "Number of megabytes to limit the cassandra JVM to.", 3 ); append( sb, "Expression: ${cassandra.maxMemory}", 3 ); append( sb, "", 0 ); append( sb, "rpcAddress (Default: 127.0.0.1)", 2 ); append( sb, "Address to use for the RPC interface. Do not change this unless you really know what you are doing.", 3 ); append( sb, "", 0 ); append( sb, "rpcPort (Default: 9160)", 2 ); append( sb, "Port to listen to for the RPC interface.", 3 ); append( sb, "Expression: ${cassandra.rpcPort}", 3 ); append( sb, "", 0 ); append( sb, "skip (Default: false)", 2 ); append( sb, "Skip the execution.", 3 ); append( sb, "Expression: ${cassandra.skip}", 3 ); append( sb, "", 0 ); append( sb, "stopKey (Default: cassandra-maven-plugin)", 2 ); append( sb, "Key to be provided when stopping cassandra", 3 ); append( sb, "Expression: ${cassandra.stopKey}", 3 ); append( sb, "", 0 ); append( sb, "stopPort (Default: 8081)", 2 ); append( sb, "Port to listen to for receiving the stop command over", 3 ); append( sb, "Expression: ${cassandra.stopPort}", 3 ); append( sb, "", 0 ); append( sb, "storagePort (Default: 7000)", 2 ); append( sb, "Port to listen to for the Storage interface.", 3 ); append( sb, "Expression: ${cassandra.storagePort}", 3 ); append( sb, "", 0 ); append( sb, "testClassesDirectory", 2 ); append( sb, "The directory containing generated test classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.testOutputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "yaml", 2 ); append( sb, "In yaml format any overrides or additional configuration that you want to apply to the server.", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "delete".equals( goal ) ) { append( sb, "cassandra:delete", 0 ); append( sb, "Deletes the Cassandra home directory that we create for running Cassandra.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "cassandraDir (Default: ${project.build.directory}/cassandra)", 2 ); append( sb, "The directory to hold cassandra\'s database.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "skip (Default: false)", 2 ); append( sb, "Skip the execution.", 3 ); append( sb, "Expression: ${cassandra.skip}", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "flush".equals( goal ) ) { append( sb, "cassandra:flush", 0 ); append( sb, "Runs nodetool flush on a Cassandra instance.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "addMainClasspath (Default: false)", 2 ); append( sb, "Adds the main classpath to cassandra (for example you could use this when you have a custom comparator on your main classpath.", 3 ); append( sb, "", 0 ); append( sb, "addTestClasspath (Default: false)", 2 ); append( sb, "Adds the test classpath to cassandra (for example you could use this when you have a custom comparator on your test classpath.", 3 ); append( sb, "", 0 ); append( sb, "cassandraDir (Default: ${project.build.directory}/cassandra)", 2 ); append( sb, "The directory to hold cassandra\'s database.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "classesDirectory", 2 ); append( sb, "The directory containing generated classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.outputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "jmxPort (Default: 7199)", 2 ); append( sb, "Port to listen to for the JMX interface.", 3 ); append( sb, "Expression: ${cassandra.jmxPort}", 3 ); append( sb, "", 0 ); append( sb, "keyspace", 2 ); append( sb, "The keyspace against which individual operations will be executed", 3 ); append( sb, "Expression: ${cassandra.keyspace}", 3 ); append( sb, "", 0 ); append( sb, "listenAddress (Default: 127.0.0.1)", 2 ); append( sb, "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.", 3 ); append( sb, "", 0 ); append( sb, "maxMemory (Default: 512)", 2 ); append( sb, "Number of megabytes to limit the cassandra JVM to.", 3 ); append( sb, "Expression: ${cassandra.maxMemory}", 3 ); append( sb, "", 0 ); append( sb, "rpcAddress (Default: 127.0.0.1)", 2 ); append( sb, "Address to use for the RPC interface. Do not change this unless you really know what you are doing.", 3 ); append( sb, "", 0 ); append( sb, "rpcPort (Default: 9160)", 2 ); append( sb, "Port to listen to for the RPC interface.", 3 ); append( sb, "Expression: ${cassandra.rpcPort}", 3 ); append( sb, "", 0 ); append( sb, "skip (Default: false)", 2 ); append( sb, "Skip the execution.", 3 ); append( sb, "Expression: ${cassandra.skip}", 3 ); append( sb, "", 0 ); append( sb, "stopKey (Default: cassandra-maven-plugin)", 2 ); append( sb, "Key to be provided when stopping cassandra", 3 ); append( sb, "Expression: ${cassandra.stopKey}", 3 ); append( sb, "", 0 ); append( sb, "stopPort (Default: 8081)", 2 ); append( sb, "Port to listen to for receiving the stop command over", 3 ); append( sb, "Expression: ${cassandra.stopPort}", 3 ); append( sb, "", 0 ); append( sb, "storagePort (Default: 7000)", 2 ); append( sb, "Port to listen to for the Storage interface.", 3 ); append( sb, "Expression: ${cassandra.storagePort}", 3 ); append( sb, "", 0 ); append( sb, "testClassesDirectory", 2 ); append( sb, "The directory containing generated test classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.testOutputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "yaml", 2 ); append( sb, "In yaml format any overrides or additional configuration that you want to apply to the server.", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "help".equals( goal ) ) { append( sb, "cassandra:help", 0 ); append( sb, "Display help information on cassandra-maven-plugin.\nCall\n\u00a0\u00a0mvn\u00a0cassandra:help\u00a0-Ddetail=true\u00a0-Dgoal=\nto display parameter details.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "detail (Default: false)", 2 ); append( sb, "If true, display all settable properties for each goal.", 3 ); append( sb, "Expression: ${detail}", 3 ); append( sb, "", 0 ); append( sb, "goal", 2 ); append( sb, "The name of the goal for which to show help. If unspecified, all goals will be displayed.", 3 ); append( sb, "Expression: ${goal}", 3 ); append( sb, "", 0 ); append( sb, "indentSize (Default: 2)", 2 ); append( sb, "The number of spaces per indentation level, should be positive.", 3 ); append( sb, "Expression: ${indentSize}", 3 ); append( sb, "", 0 ); append( sb, "lineLength (Default: 80)", 2 ); append( sb, "The maximum length of a display line, should be positive.", 3 ); append( sb, "Expression: ${lineLength}", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "load".equals( goal ) ) { append( sb, "cassandra:load", 0 ); append( sb, "Loads a cassandra-cli bscript into a Cassandra instance.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "addMainClasspath (Default: false)", 2 ); append( sb, "Adds the main classpath to cassandra (for example you could use this when you have a custom comparator on your main classpath.", 3 ); append( sb, "", 0 ); append( sb, "addTestClasspath (Default: false)", 2 ); append( sb, "Adds the test classpath to cassandra (for example you could use this when you have a custom comparator on your test classpath.", 3 ); append( sb, "", 0 ); append( sb, "cassandraDir (Default: ${project.build.directory}/cassandra)", 2 ); append( sb, "The directory to hold cassandra\'s database.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "classesDirectory", 2 ); append( sb, "The directory containing generated classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.outputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "jmxPort (Default: 7199)", 2 ); append( sb, "Port to listen to for the JMX interface.", 3 ); append( sb, "Expression: ${cassandra.jmxPort}", 3 ); append( sb, "", 0 ); append( sb, "keyspace", 2 ); append( sb, "The keyspace against which individual operations will be executed", 3 ); append( sb, "Expression: ${cassandra.keyspace}", 3 ); append( sb, "", 0 ); append( sb, "listenAddress (Default: 127.0.0.1)", 2 ); append( sb, "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.", 3 ); append( sb, "", 0 ); append( sb, "loadFailureIgnore", 2 ); append( sb, "Whether to ignore errors when loading the script.", 3 ); append( sb, "Expression: ${cassandra.load.failure.ignore}", 3 ); append( sb, "", 0 ); append( sb, "maxMemory (Default: 512)", 2 ); append( sb, "Number of megabytes to limit the cassandra JVM to.", 3 ); append( sb, "Expression: ${cassandra.maxMemory}", 3 ); append( sb, "", 0 ); append( sb, "rpcAddress (Default: 127.0.0.1)", 2 ); append( sb, "Address to use for the RPC interface. Do not change this unless you really know what you are doing.", 3 ); append( sb, "", 0 ); append( sb, "rpcPort (Default: 9160)", 2 ); append( sb, "Port to listen to for the RPC interface.", 3 ); append( sb, "Expression: ${cassandra.rpcPort}", 3 ); append( sb, "", 0 ); append( sb, "script (Default: ${basedir}/src/cassandra/cli/load.script)", 2 ); append( sb, "The script to load.", 3 ); append( sb, "", 0 ); append( sb, "skip (Default: false)", 2 ); append( sb, "Skip the execution.", 3 ); append( sb, "Expression: ${cassandra.skip}", 3 ); append( sb, "", 0 ); append( sb, "stopKey (Default: cassandra-maven-plugin)", 2 ); append( sb, "Key to be provided when stopping cassandra", 3 ); append( sb, "Expression: ${cassandra.stopKey}", 3 ); append( sb, "", 0 ); append( sb, "stopPort (Default: 8081)", 2 ); append( sb, "Port to listen to for receiving the stop command over", 3 ); append( sb, "Expression: ${cassandra.stopPort}", 3 ); append( sb, "", 0 ); append( sb, "storagePort (Default: 7000)", 2 ); append( sb, "Port to listen to for the Storage interface.", 3 ); append( sb, "Expression: ${cassandra.storagePort}", 3 ); append( sb, "", 0 ); append( sb, "testClassesDirectory", 2 ); append( sb, "The directory containing generated test classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.testOutputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "yaml", 2 ); append( sb, "In yaml format any overrides or additional configuration that you want to apply to the server.", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "repair".equals( goal ) ) { append( sb, "cassandra:repair", 0 ); append( sb, "Runs nodetool repair on a Cassandra instance.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "addMainClasspath (Default: false)", 2 ); append( sb, "Adds the main classpath to cassandra (for example you could use this when you have a custom comparator on your main classpath.", 3 ); append( sb, "", 0 ); append( sb, "addTestClasspath (Default: false)", 2 ); append( sb, "Adds the test classpath to cassandra (for example you could use this when you have a custom comparator on your test classpath.", 3 ); append( sb, "", 0 ); append( sb, "cassandraDir (Default: ${project.build.directory}/cassandra)", 2 ); append( sb, "The directory to hold cassandra\'s database.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "classesDirectory", 2 ); append( sb, "The directory containing generated classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.outputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "jmxPort (Default: 7199)", 2 ); append( sb, "Port to listen to for the JMX interface.", 3 ); append( sb, "Expression: ${cassandra.jmxPort}", 3 ); append( sb, "", 0 ); append( sb, "keyspace", 2 ); append( sb, "The keyspace against which individual operations will be executed", 3 ); append( sb, "Expression: ${cassandra.keyspace}", 3 ); append( sb, "", 0 ); append( sb, "listenAddress (Default: 127.0.0.1)", 2 ); append( sb, "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.", 3 ); append( sb, "", 0 ); append( sb, "maxMemory (Default: 512)", 2 ); append( sb, "Number of megabytes to limit the cassandra JVM to.", 3 ); append( sb, "Expression: ${cassandra.maxMemory}", 3 ); append( sb, "", 0 ); append( sb, "rpcAddress (Default: 127.0.0.1)", 2 ); append( sb, "Address to use for the RPC interface. Do not change this unless you really know what you are doing.", 3 ); append( sb, "", 0 ); append( sb, "rpcPort (Default: 9160)", 2 ); append( sb, "Port to listen to for the RPC interface.", 3 ); append( sb, "Expression: ${cassandra.rpcPort}", 3 ); append( sb, "", 0 ); append( sb, "skip (Default: false)", 2 ); append( sb, "Skip the execution.", 3 ); append( sb, "Expression: ${cassandra.skip}", 3 ); append( sb, "", 0 ); append( sb, "stopKey (Default: cassandra-maven-plugin)", 2 ); append( sb, "Key to be provided when stopping cassandra", 3 ); append( sb, "Expression: ${cassandra.stopKey}", 3 ); append( sb, "", 0 ); append( sb, "stopPort (Default: 8081)", 2 ); append( sb, "Port to listen to for receiving the stop command over", 3 ); append( sb, "Expression: ${cassandra.stopPort}", 3 ); append( sb, "", 0 ); append( sb, "storagePort (Default: 7000)", 2 ); append( sb, "Port to listen to for the Storage interface.", 3 ); append( sb, "Expression: ${cassandra.storagePort}", 3 ); append( sb, "", 0 ); append( sb, "testClassesDirectory", 2 ); append( sb, "The directory containing generated test classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.testOutputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "yaml", 2 ); append( sb, "In yaml format any overrides or additional configuration that you want to apply to the server.", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "run".equals( goal ) ) { append( sb, "cassandra:run", 0 ); append( sb, "Runs Cassandra in the foreground.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "addMainClasspath (Default: false)", 2 ); append( sb, "Adds the main classpath to cassandra (for example you could use this when you have a custom comparator on your main classpath.", 3 ); append( sb, "", 0 ); append( sb, "addTestClasspath (Default: false)", 2 ); append( sb, "Adds the test classpath to cassandra (for example you could use this when you have a custom comparator on your test classpath.", 3 ); append( sb, "", 0 ); append( sb, "cassandraDir (Default: ${project.build.directory}/cassandra)", 2 ); append( sb, "The directory to hold cassandra\'s database.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "classesDirectory", 2 ); append( sb, "The directory containing generated classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.outputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "jmxPort (Default: 7199)", 2 ); append( sb, "Port to listen to for the JMX interface.", 3 ); append( sb, "Expression: ${cassandra.jmxPort}", 3 ); append( sb, "", 0 ); append( sb, "keyspace", 2 ); append( sb, "The keyspace against which individual operations will be executed", 3 ); append( sb, "Expression: ${cassandra.keyspace}", 3 ); append( sb, "", 0 ); append( sb, "listenAddress (Default: 127.0.0.1)", 2 ); append( sb, "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.", 3 ); append( sb, "", 0 ); append( sb, "loadAfterFirstStart (Default: true)", 2 ); append( sb, "When true, if this is a clean start then the load script will be applied automatically.", 3 ); append( sb, "Expression: ${cassandra.load.after.first.start}", 3 ); append( sb, "", 0 ); append( sb, "loadFailureIgnore", 2 ); append( sb, "Whether to ignore errors when loading the script.", 3 ); append( sb, "Expression: ${cassandra.load.failure.ignore}", 3 ); append( sb, "", 0 ); append( sb, "maxMemory (Default: 512)", 2 ); append( sb, "Number of megabytes to limit the cassandra JVM to.", 3 ); append( sb, "Expression: ${cassandra.maxMemory}", 3 ); append( sb, "", 0 ); append( sb, "rpcAddress (Default: 127.0.0.1)", 2 ); append( sb, "Address to use for the RPC interface. Do not change this unless you really know what you are doing.", 3 ); append( sb, "", 0 ); append( sb, "rpcPort (Default: 9160)", 2 ); append( sb, "Port to listen to for the RPC interface.", 3 ); append( sb, "Expression: ${cassandra.rpcPort}", 3 ); append( sb, "", 0 ); append( sb, "script (Default: ${basedir}/src/cassandra/cli/load.script)", 2 ); append( sb, "The script to load.", 3 ); append( sb, "", 0 ); append( sb, "skip (Default: false)", 2 ); append( sb, "Skip the execution.", 3 ); append( sb, "Expression: ${cassandra.skip}", 3 ); append( sb, "", 0 ); append( sb, "stopKey (Default: cassandra-maven-plugin)", 2 ); append( sb, "Key to be provided when stopping cassandra", 3 ); append( sb, "Expression: ${cassandra.stopKey}", 3 ); append( sb, "", 0 ); append( sb, "stopPort (Default: 8081)", 2 ); append( sb, "Port to listen to for receiving the stop command over", 3 ); append( sb, "Expression: ${cassandra.stopPort}", 3 ); append( sb, "", 0 ); append( sb, "storagePort (Default: 7000)", 2 ); append( sb, "Port to listen to for the Storage interface.", 3 ); append( sb, "Expression: ${cassandra.storagePort}", 3 ); append( sb, "", 0 ); append( sb, "testClassesDirectory", 2 ); append( sb, "The directory containing generated test classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.testOutputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "yaml", 2 ); append( sb, "In yaml format any overrides or additional configuration that you want to apply to the server.", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "start".equals( goal ) ) { append( sb, "cassandra:start", 0 ); append( sb, "Starts a Cassandra instance in the background.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "addMainClasspath (Default: false)", 2 ); append( sb, "Adds the main classpath to cassandra (for example you could use this when you have a custom comparator on your main classpath.", 3 ); append( sb, "", 0 ); append( sb, "addTestClasspath (Default: false)", 2 ); append( sb, "Adds the test classpath to cassandra (for example you could use this when you have a custom comparator on your test classpath.", 3 ); append( sb, "", 0 ); append( sb, "cassandraDir (Default: ${project.build.directory}/cassandra)", 2 ); append( sb, "The directory to hold cassandra\'s database.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "classesDirectory", 2 ); append( sb, "The directory containing generated classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.outputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "jmxPort (Default: 7199)", 2 ); append( sb, "Port to listen to for the JMX interface.", 3 ); append( sb, "Expression: ${cassandra.jmxPort}", 3 ); append( sb, "", 0 ); append( sb, "keyspace", 2 ); append( sb, "The keyspace against which individual operations will be executed", 3 ); append( sb, "Expression: ${cassandra.keyspace}", 3 ); append( sb, "", 0 ); append( sb, "listenAddress (Default: 127.0.0.1)", 2 ); append( sb, "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.", 3 ); append( sb, "", 0 ); append( sb, "loadAfterFirstStart (Default: true)", 2 ); append( sb, "When true, if this is a clean start then the load script will be applied automatically.", 3 ); append( sb, "Expression: ${cassandra.load.after.first.start}", 3 ); append( sb, "", 0 ); append( sb, "loadFailureIgnore", 2 ); append( sb, "Whether to ignore errors when loading the script.", 3 ); append( sb, "Expression: ${cassandra.load.failure.ignore}", 3 ); append( sb, "", 0 ); append( sb, "maxMemory (Default: 512)", 2 ); append( sb, "Number of megabytes to limit the cassandra JVM to.", 3 ); append( sb, "Expression: ${cassandra.maxMemory}", 3 ); append( sb, "", 0 ); append( sb, "rpcAddress (Default: 127.0.0.1)", 2 ); append( sb, "Address to use for the RPC interface. Do not change this unless you really know what you are doing.", 3 ); append( sb, "", 0 ); append( sb, "rpcPort (Default: 9160)", 2 ); append( sb, "Port to listen to for the RPC interface.", 3 ); append( sb, "Expression: ${cassandra.rpcPort}", 3 ); append( sb, "", 0 ); append( sb, "script (Default: ${basedir}/src/cassandra/cli/load.script)", 2 ); append( sb, "The script to load.", 3 ); append( sb, "", 0 ); append( sb, "skip (Default: false)", 2 ); append( sb, "Skip the execution.", 3 ); append( sb, "Expression: ${cassandra.skip}", 3 ); append( sb, "", 0 ); append( sb, "startWaitSeconds (Default: 180)", 2 ); append( sb, "How long to wait for Cassandra to be started before finishing the goal. A value of 0 will wait indefinately. A value of -1 will not wait at all.", 3 ); append( sb, "", 0 ); append( sb, "stopKey (Default: cassandra-maven-plugin)", 2 ); append( sb, "Key to be provided when stopping cassandra", 3 ); append( sb, "Expression: ${cassandra.stopKey}", 3 ); append( sb, "", 0 ); append( sb, "stopPort (Default: 8081)", 2 ); append( sb, "Port to listen to for receiving the stop command over", 3 ); append( sb, "Expression: ${cassandra.stopPort}", 3 ); append( sb, "", 0 ); append( sb, "storagePort (Default: 7000)", 2 ); append( sb, "Port to listen to for the Storage interface.", 3 ); append( sb, "Expression: ${cassandra.storagePort}", 3 ); append( sb, "", 0 ); append( sb, "testClassesDirectory", 2 ); append( sb, "The directory containing generated test classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.testOutputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "yaml", 2 ); append( sb, "In yaml format any overrides or additional configuration that you want to apply to the server.", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "start-cluster".equals( goal ) ) { append( sb, "cassandra:start-cluster", 0 ); append( sb, "Starts a Cassandra instance in the background.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "addMainClasspath (Default: false)", 2 ); append( sb, "Adds the main classpath to cassandra (for example you could use this when you have a custom comparator on your main classpath.", 3 ); append( sb, "", 0 ); append( sb, "addTestClasspath (Default: false)", 2 ); append( sb, "Adds the test classpath to cassandra (for example you could use this when you have a custom comparator on your test classpath.", 3 ); append( sb, "", 0 ); append( sb, "cassandraDir (Default: ${project.build.directory}/cassandra)", 2 ); append( sb, "The directory to hold cassandra\'s database.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "classesDirectory", 2 ); append( sb, "The directory containing generated classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.outputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "clusterSize (Default: 4)", 2 ); append( sb, "The number of nodes in the cluster.", 3 ); append( sb, "Expression: ${cassandra.cluster.size}", 3 ); append( sb, "", 0 ); append( sb, "jmxPort (Default: 7199)", 2 ); append( sb, "Port to listen to for the JMX interface.", 3 ); append( sb, "Expression: ${cassandra.jmxPort}", 3 ); append( sb, "", 0 ); append( sb, "keyspace", 2 ); append( sb, "The keyspace against which individual operations will be executed", 3 ); append( sb, "Expression: ${cassandra.keyspace}", 3 ); append( sb, "", 0 ); append( sb, "listenAddress (Default: 127.0.0.1)", 2 ); append( sb, "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.", 3 ); append( sb, "", 0 ); append( sb, "loadAfterFirstStart (Default: true)", 2 ); append( sb, "When true, if this is a clean start then the load script will be applied automatically.", 3 ); append( sb, "Expression: ${cassandra.load.after.first.start}", 3 ); append( sb, "", 0 ); append( sb, "loadFailureIgnore", 2 ); append( sb, "Whether to ignore errors when loading the script.", 3 ); append( sb, "Expression: ${cassandra.load.failure.ignore}", 3 ); append( sb, "", 0 ); append( sb, "maxMemory (Default: 512)", 2 ); append( sb, "Number of megabytes to limit the cassandra JVM to.", 3 ); append( sb, "Expression: ${cassandra.maxMemory}", 3 ); append( sb, "", 0 ); append( sb, "rpcAddress (Default: 127.0.0.1)", 2 ); append( sb, "Address to use for the RPC interface. Do not change this unless you really know what you are doing.", 3 ); append( sb, "", 0 ); append( sb, "rpcPort (Default: 9160)", 2 ); append( sb, "Port to listen to for the RPC interface.", 3 ); append( sb, "Expression: ${cassandra.rpcPort}", 3 ); append( sb, "", 0 ); append( sb, "script (Default: ${basedir}/src/cassandra/cli/load.script)", 2 ); append( sb, "The script to load.", 3 ); append( sb, "", 0 ); append( sb, "skip (Default: false)", 2 ); append( sb, "Skip the execution.", 3 ); append( sb, "Expression: ${cassandra.skip}", 3 ); append( sb, "", 0 ); append( sb, "startWaitSeconds (Default: 180)", 2 ); append( sb, "How long to wait for Cassandra to be started before finishing the goal. A value of 0 will wait indefinately. A value of -1 will not wait at all.", 3 ); append( sb, "", 0 ); append( sb, "stopKey (Default: cassandra-maven-plugin)", 2 ); append( sb, "Key to be provided when stopping cassandra", 3 ); append( sb, "Expression: ${cassandra.stopKey}", 3 ); append( sb, "", 0 ); append( sb, "stopPort (Default: 8081)", 2 ); append( sb, "Port to listen to for receiving the stop command over", 3 ); append( sb, "Expression: ${cassandra.stopPort}", 3 ); append( sb, "", 0 ); append( sb, "storagePort (Default: 7000)", 2 ); append( sb, "Port to listen to for the Storage interface.", 3 ); append( sb, "Expression: ${cassandra.storagePort}", 3 ); append( sb, "", 0 ); append( sb, "testClassesDirectory", 2 ); append( sb, "The directory containing generated test classes.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.testOutputDirectory}", 3 ); append( sb, "", 0 ); append( sb, "yaml", 2 ); append( sb, "In yaml format any overrides or additional configuration that you want to apply to the server.", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "stop".equals( goal ) ) { append( sb, "cassandra:stop", 0 ); append( sb, "Stops a background Cassandra instance.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "listenAddress (Default: 127.0.0.1)", 2 ); append( sb, "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.", 3 ); append( sb, "", 0 ); append( sb, "rpcAddress (Default: 127.0.0.1)", 2 ); append( sb, "Address to use for the RPC interface. Do not change this unless you really know what you are doing.", 3 ); append( sb, "", 0 ); append( sb, "rpcPort (Default: 9160)", 2 ); append( sb, "Port to listen to for the RPC interface.", 3 ); append( sb, "Expression: ${cassandra.rpcPort}", 3 ); append( sb, "", 0 ); append( sb, "skip (Default: false)", 2 ); append( sb, "Skip the execution.", 3 ); append( sb, "Expression: ${cassandra.skip}", 3 ); append( sb, "", 0 ); append( sb, "stopKey (Default: cassandra-maven-plugin)", 2 ); append( sb, "Key to provide when stopping cassandra", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${cassandra.stopKey}", 3 ); append( sb, "", 0 ); append( sb, "stopPort (Default: 8081)", 2 ); append( sb, "Port to send stop command over", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${cassandra.stopPort}", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "stop-cluster".equals( goal ) ) { append( sb, "cassandra:stop-cluster", 0 ); append( sb, "Stops a background Cassandra instance.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "clusterSize (Default: 4)", 2 ); append( sb, "The number of nodes in the cluster.", 3 ); append( sb, "Expression: ${cassandra.cluster.size}", 3 ); append( sb, "", 0 ); append( sb, "rpcAddress (Default: 127.0.0.1)", 2 ); append( sb, "Address to use for the RPC interface. Do not change this unless you really know what you are doing.", 3 ); append( sb, "", 0 ); append( sb, "rpcPort (Default: 9160)", 2 ); append( sb, "Port to listen to for the RPC interface.", 3 ); append( sb, "Expression: ${cassandra.rpcPort}", 3 ); append( sb, "", 0 ); append( sb, "skip (Default: false)", 2 ); append( sb, "Skip the execution.", 3 ); append( sb, "Expression: ${cassandra.skip}", 3 ); append( sb, "", 0 ); append( sb, "stopKey (Default: cassandra-maven-plugin)", 2 ); append( sb, "Key to provide when stopping cassandra", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${cassandra.stopKey}", 3 ); append( sb, "", 0 ); append( sb, "stopPort (Default: 8081)", 2 ); append( sb, "Port to send stop command over", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${cassandra.stopPort}", 3 ); append( sb, "", 0 ); } } if ( getLog().isInfoEnabled() ) { getLog().info( sb.toString() ); } } /** *

Repeat a String n times to form a new string.

* * @param str String to repeat * @param repeat number of times to repeat str * @return String with repeated String * @throws NegativeArraySizeException if repeat < 0 * @throws NullPointerException if str is null */ private static String repeat( String str, int repeat ) { StringBuffer buffer = new StringBuffer( repeat * str.length() ); for ( int i = 0; i < repeat; i++ ) { buffer.append( str ); } return buffer.toString(); } /** * Append a description to the buffer by respecting the indentSize and lineLength parameters. * Note: The last character is always a new line. * * @param sb The buffer to append the description, not null. * @param description The description, not null. * @param indent The base indentation level of each line, must not be negative. */ private void append( StringBuffer sb, String description, int indent ) { for ( Iterator it = toLines( description, indent, indentSize, lineLength ).iterator(); it.hasNext(); ) { sb.append( it.next().toString() ).append( '\n' ); } } /** * Splits the specified text into lines of convenient display length. * * @param text The text to split into lines, must not be null. * @param indent The base indentation level of each line, must not be negative. * @param indentSize The size of each indentation, must not be negative. * @param lineLength The length of the line, must not be negative. * @return The sequence of display lines, never null. * @throws NegativeArraySizeException if indent < 0 */ private static List toLines( String text, int indent, int indentSize, int lineLength ) { List lines = new ArrayList(); String ind = repeat( "\t", indent ); String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" ); for ( int i = 0; i < plainLines.length; i++ ) { toLines( lines, ind + plainLines[i], indentSize, lineLength ); } return lines; } /** * Adds the specified line to the output sequence, performing line wrapping if necessary. * * @param lines The sequence of display lines, must not be null. * @param line The line to add, must not be null. * @param indentSize The size of each indentation, must not be negative. * @param lineLength The length of the line, must not be negative. */ private static void toLines( List lines, String line, int indentSize, int lineLength ) { int lineIndent = getIndentLevel( line ); StringBuffer buf = new StringBuffer( 256 ); String[] tokens = line.split( " +" ); for ( int i = 0; i < tokens.length; i++ ) { String token = tokens[i]; if ( i > 0 ) { if ( buf.length() + token.length() >= lineLength ) { lines.add( buf.toString() ); buf.setLength( 0 ); buf.append( repeat( " ", lineIndent * indentSize ) ); } else { buf.append( ' ' ); } } for ( int j = 0; j < token.length(); j++ ) { char c = token.charAt( j ); if ( c == '\t' ) { buf.append( repeat( " ", indentSize - buf.length() % indentSize ) ); } else if ( c == '\u00A0' ) { buf.append( ' ' ); } else { buf.append( c ); } } } lines.add( buf.toString() ); } /** * Gets the indentation level of the specified line. * * @param line The line whose indentation level should be retrieved, must not be null. * @return The indentation level of the line. */ private static int getIndentLevel( String line ) { int level = 0; for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ ) { level++; } for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ ) { if ( line.charAt( i ) == '\t' ) { level++; break; } } return level; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy