Added a default Kickstart dependency, changed all references to ‘launchpad’ to ‘kickstart’ and cleaned up some unused code.
diff --git a/Readme.md b/Readme.md
index 31e1ef5..d051825 100644
--- a/Readme.md
+++ b/Readme.md
@@ -30,20 +30,28 @@
</execution>
</executions>
<configuration>
- <launchpadJar>${project.build.directory}/${project.artifactId}-${project.version}.jar</launchpadJar>
<parallelExecution>false</parallelExecution>
<servers>
<server>
<port>${http.port}</port>
<controlPort>${sling.control.port}</controlPort>
<debug>true</debug>
- <stdOutFile>launchpad.out</stdOutFile>
+ <stdOutFile>kickstart.out</stdOutFile>
</server>
</servers>
</configuration>
</plugin>
```
+## Customize Kickstart Dependency
+
+The Plugin comes with the latest released version of the Kickstart dependency.
+That said it provides the ability to use a different Kickstart version. These
+are the two options:
+
+* **kickstartJar**: path to the Kickstart JAR file
+* **kickstartDependency**: Maven Dependency of the Kickstart artifact
+
## Notes
For now this Plugin only supports the starting and stopping of a Sling
diff --git a/beforeReleaseDo.md b/beforeReleaseDo.md
new file mode 100644
index 0000000..8cc2e07
--- /dev/null
+++ b/beforeReleaseDo.md
@@ -0,0 +1,10 @@
+# Before a Release Do
+
+The **StartMojo** class has a default Kickstart Dependency hard coded into it.
+
+It is **important** that the version number is adjusted to the **release version**
+number before the release is performed. To make the release work (it will build the
+project) the **Sling Kickstart** module must be released first so that the it can
+load that version.
+
+Andreas Schaefer, 6/11/2020
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/maven/kickstart/BuildConstants.java b/src/main/java/org/apache/sling/maven/kickstart/BuildConstants.java
index 8ea845b..cbe89b1 100644
--- a/src/main/java/org/apache/sling/maven/kickstart/BuildConstants.java
+++ b/src/main/java/org/apache/sling/maven/kickstart/BuildConstants.java
@@ -21,40 +21,14 @@
public abstract class BuildConstants {
- // CONTEXTS
- public static final String CONTEXT_GLOBAL = "slingstart:global";
- public static final String CONTEXT_STANDALONE = "slingstart" + ":standalone";
- public static final String CONTEXT_WEBAPP = "slingstart" + ":webapp";
-
- // Model artifact name
- public static final String MODEL_ARTIFACT_NAME = "slingstart.txt";
-
// Types
-
public static final String TYPE_JAR = "jar";
- public static final String TYPE_WAR = "war";
-
- public static final String TYPE_POM = "pom";
-
- public static final String TYPE_TXT = "txt";
-
- public static final String PACKAGING_PARTIAL_SYSTEM = "slingfeature";
-
public static final String PACKAGING_SLINGQUICKSTART = "slingkickstart";
// Classifiers
-
- public static final String CLASSIFIER_PARTIAL_SYSTEM = "slingfeature";
-
- public static final String CLASSIFIER_BASE = "base";
-
public static final String CLASSIFIER_APP = "app";
- public static final String CLASSIFIER_WEBAPP = "webapp";
-
-// public static final String CLASSIFIER_MAR = ModelArchiveWriter.DEFAULT_EXTENSION;
-
// Manifest attributes
public static final String ATTR_BUILT_BY = "Built-By";
@@ -77,10 +51,6 @@
public static final String ATTR_SPECIFICATION_VERSION = "Specification-Version";
- public static final String ATTR_MAIN_CLASS = "Main-Class";
-
- public static final String ATTR_VALUE_MAIN_CLASS = "org.apache.sling.launchpad.app.Main";
-
public static final List<String> ATTRS_EXCLUDES = new ArrayList<String>();
static {
ATTRS_EXCLUDES.add(ATTR_BUILT_BY);
diff --git a/src/main/java/org/apache/sling/maven/kickstart/launcher/Main.java b/src/main/java/org/apache/sling/maven/kickstart/launcher/Main.java
index 59d80ed..08973da 100644
--- a/src/main/java/org/apache/sling/maven/kickstart/launcher/Main.java
+++ b/src/main/java/org/apache/sling/maven/kickstart/launcher/Main.java
@@ -49,7 +49,7 @@
/**
* Create a new launcher
- * First argument is the launchpad jar
+ * First argument is the kickstart jar
* Second argument is the listener port
* Third argument is verbose
*/
diff --git a/src/main/java/org/apache/sling/maven/kickstart/run/AbstractStartStopMojo.java b/src/main/java/org/apache/sling/maven/kickstart/run/AbstractStartStopMojo.java
index e79277a..1b353e1 100644
--- a/src/main/java/org/apache/sling/maven/kickstart/run/AbstractStartStopMojo.java
+++ b/src/main/java/org/apache/sling/maven/kickstart/run/AbstractStartStopMojo.java
@@ -30,10 +30,10 @@
public abstract class AbstractStartStopMojo extends AbstractMojo {
/**
- * Set this to "true" to skip starting the launchpad
+ * Set this to "true" to skip starting the kickstart
*/
@Parameter(property = "maven.test.skip", defaultValue = "false")
- protected boolean skipLaunchpad;
+ protected boolean skipKickStart;
/**
* Parameter containing the list of server configurations
@@ -44,7 +44,7 @@
/**
* The system properties file will contain all started instances with their ports etc.
*/
- @Parameter(defaultValue = "${project.build.directory}/launchpad-runner.properties")
+ @Parameter(defaultValue = "${project.build.directory}/kickstart-runner.properties")
protected File systemPropertiesFile;
/**
@@ -60,7 +60,7 @@
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
- if (this.skipLaunchpad) {
+ if (this.skipKickStart) {
this.getLog().info("Executing of this mojo is disabled by configuration.");
return;
}
diff --git a/src/main/java/org/apache/sling/maven/kickstart/run/LaunchpadEnvironment.java b/src/main/java/org/apache/sling/maven/kickstart/run/KickstartEnvironment.java
similarity index 81%
rename from src/main/java/org/apache/sling/maven/kickstart/run/LaunchpadEnvironment.java
rename to src/main/java/org/apache/sling/maven/kickstart/run/KickstartEnvironment.java
index e1a5127..a927b67 100644
--- a/src/main/java/org/apache/sling/maven/kickstart/run/LaunchpadEnvironment.java
+++ b/src/main/java/org/apache/sling/maven/kickstart/run/KickstartEnvironment.java
@@ -24,25 +24,25 @@
import java.io.InputStream;
/**
- * Common settings for all launchpad instances.
+ * Common settings for all kickstart instances.
*/
-public class LaunchpadEnvironment {
+public class KickstartEnvironment {
- /** The work directory created by starting launchpad. */
+ /** The work directory created by starting kickstart. */
public static final String WORK_DIR_NAME = "sling";
- private final File launchpadJar;
+ private final File kickstartJar;
private final boolean cleanWorkingDirectory;
private final boolean shutdownOnExit;
private final int readyTimeOutSec;
private final String debug;
- public LaunchpadEnvironment(final File launchpadJar,
+ public KickstartEnvironment(final File kickstartJar,
final boolean cleanWorkingDirectory,
final boolean shutdownOnExit,
final int readyTimeOutSec,
final String debug) {
- this.launchpadJar = launchpadJar;
+ this.kickstartJar = kickstartJar;
this.cleanWorkingDirectory = cleanWorkingDirectory;
this.shutdownOnExit = shutdownOnExit;
this.readyTimeOutSec = readyTimeOutSec;
@@ -58,7 +58,7 @@
}
/**
- * Check if the launchpad folder exists.
+ * Check if the kickstart folder exists.
*/
private void ensureFolderExists(final File folder) {
if (!folder.exists()) {
@@ -70,15 +70,15 @@
}
}
- private File installLaunchpad(final File folder) throws IOException {
- if (this.launchpadJar.getParentFile().getAbsolutePath().equals(folder.getAbsolutePath())) {
- return this.launchpadJar;
+ private File installKickstart(final File folder) throws IOException {
+ if (this.kickstartJar.getParentFile().getAbsolutePath().equals(folder.getAbsolutePath())) {
+ return this.kickstartJar;
}
try {
- FileUtils.copyFileToDirectory(this.launchpadJar, folder);
- return new File(folder, this.launchpadJar.getName());
+ FileUtils.copyFileToDirectory(this.kickstartJar, folder);
+ return new File(folder, this.kickstartJar.getName());
} catch (final IOException ioe) {
- throw new IOException("Unable to copy " + this.launchpadJar + " to " + folder, ioe);
+ throw new IOException("Unable to copy " + this.kickstartJar + " to " + folder, ioe);
}
}
@@ -90,19 +90,19 @@
/**
* Prepare a new instance.
* @param folder The target folder for the instance
- * @return The launchpad jar
+ * @return The kickstart jar
* @throws IOException if an error occurs.
*/
public File prepare(final File folder) throws IOException {
this.ensureFolderExists(folder);
- // copy launchpadJar
- final File launchpad = this.installLaunchpad(folder);
+ // copy kickstartJar
+ final File kickstart = this.installKickstart(folder);
// install launcher
this.installLauncher(folder);
- return launchpad;
+ return kickstart;
}
private void copyResource(final String resource,
@@ -118,7 +118,7 @@
}
baseDir.mkdirs();
final File file = new File(baseDir, resource.substring(lastSlash + 1));
- final InputStream is = LaunchpadEnvironment.class.getClassLoader().getResourceAsStream(resource);
+ final InputStream is = KickstartEnvironment.class.getClassLoader().getResourceAsStream(resource);
if ( is == null ) {
throw new IOException("Resource not found: " + resource);
}
diff --git a/src/main/java/org/apache/sling/maven/kickstart/run/LauncherCallable.java b/src/main/java/org/apache/sling/maven/kickstart/run/LauncherCallable.java
index 3374b2d..d347b70 100644
--- a/src/main/java/org/apache/sling/maven/kickstart/run/LauncherCallable.java
+++ b/src/main/java/org/apache/sling/maven/kickstart/run/LauncherCallable.java
@@ -40,17 +40,17 @@
import java.util.concurrent.TimeUnit;
/**
- * A callable for launchpad an instance
+ * A callable for kickstart an instance
*/
public class LauncherCallable implements Callable<ProcessDescription> {
- private final LaunchpadEnvironment environment;
+ private final KickstartEnvironment environment;
private final ServerConfiguration configuration;
private final Log logger;
public LauncherCallable(final Log logger,
final ServerConfiguration configuration,
- final LaunchpadEnvironment environment) {
+ final KickstartEnvironment environment) {
this.logger = logger;
this.configuration = configuration;
this.environment = environment;
@@ -62,27 +62,27 @@
@Override
public ProcessDescription call() throws Exception {
logger.info("call() started");
- // fail if launchpad with this id is already started
+ // fail if kickstart with this id is already started
if (!ProcessDescriptionProvider.getInstance().isRunConfigurationAvailable(configuration.getId())) {
- throw new Exception("Launchpad with id " + configuration.getId() + " is not available");
+ throw new Exception("Kickstart with id " + configuration.getId() + " is not available");
}
- // get the launchpad jar
- final File launchpad = this.environment.prepare(this.configuration.getFolder());
+ // get the kickstart jar
+ final File kickstart = this.environment.prepare(this.configuration.getFolder());
- // Lock the launchpad id
- final String launchpadKey = ProcessDescriptionProvider.getInstance().getId(configuration.getId());
+ // Lock the kickstart id
+ final String kickstartKey = ProcessDescriptionProvider.getInstance().getId(configuration.getId());
- // start launchpad
- ProcessDescription cfg = this.start(launchpad);
+ // start kickstart
+ ProcessDescription cfg = this.start(kickstart);
- // Add thread hook to shutdown launchpad
+ // Add thread hook to shutdown kickstart
if (environment.isShutdownOnExit()) {
cfg.installShutdownHook();
}
// Add configuration to the config provider
- ProcessDescriptionProvider.getInstance().addRunConfiguration(cfg, launchpadKey);
+ ProcessDescriptionProvider.getInstance().addRunConfiguration(cfg, kickstartKey);
logger.info("Before Check if started");
boolean started = false;
@@ -106,10 +106,10 @@
logger.info("Check Done, started: " + started + ", finihsed: " + finished);
if ( finished ) {
- throw new Exception("Launchpad did exit unexpectedly.");
+ throw new Exception("Kickstart did exit unexpectedly.");
}
if ( !started ) {
- throw new Exception("Launchpad did not start successfully in " + this.environment.getReadyTimeOutSec() + " seconds.");
+ throw new Exception("Kickstart did not start successfully in " + this.environment.getReadyTimeOutSec() + " seconds.");
}
// now check for the availability of the HTTP port
boolean httpAvailable = isLocalhostPortAvailable(Integer.valueOf(this.configuration.getPort()));
@@ -119,15 +119,15 @@
httpAvailable = isLocalhostPortAvailable(Integer.valueOf(this.configuration.getPort()));
}
if ( !httpAvailable ) {
- throw new Exception("Launchpad did not start http service on port " + this.configuration.getPort() + " successfully in " + this.environment.getReadyTimeOutSec() + " seconds.");
+ throw new Exception("Kickstart did not start http service on port " + this.configuration.getPort() + " successfully in " + this.environment.getReadyTimeOutSec() + " seconds.");
}
- this.logger.info("Started Launchpad '" + configuration.getId() +
+ this.logger.info("Started Kickstart '" + configuration.getId() +
"' at port " + configuration.getPort()+ " [run modes: " + configuration.getRunmode()+ "]");
} finally {
// // stop control port
// cfg.getControlClient().shutdownServer();
- // call launchpad stop routine if not properly started
+ // call kickstart stop routine if not properly started
if (!started) {
stop(this.logger, cfg);
ProcessDescriptionProvider.getInstance().removeRunConfiguration(cfg.getId());
@@ -201,7 +201,7 @@
args.add(String.valueOf(cfg.getControlClient().getPort()));
args.add("true");
- // from here on launchpad properties
+ // from here on kickstart properties
add(args, this.configuration.getOpts());
if(this.configuration.getAdditionalFeatureFile() != null) {
@@ -235,8 +235,8 @@
builder.command(args.toArray(new String[args.size()]));
builder.directory(this.configuration.getFolder());
builder.redirectErrorStream(true);
- logger.info("Starting Launchpad " + this.configuration.getId() + "...");
- logger.info("Starting Launchpad, arguments: " + args);
+ logger.info("Starting Kickstart " + this.configuration.getId() + "...");
+ logger.info("Starting Kickstart, arguments: " + args);
String stdOutFile = this.configuration.getStdOutFile();
if (StringUtils.isNotBlank(stdOutFile)) {
File absoluteStdOutFile = new File(builder.directory(), stdOutFile);
@@ -248,8 +248,8 @@
builder.redirectOutput(Redirect.INHERIT);
}
- logger.debug("Launchpad cmd: " + builder.command());
- logger.debug("Launchpad dir: " + builder.directory());
+ logger.debug("Kickstart cmd: " + builder.command());
+ logger.debug("Kickstart dir: " + builder.directory());
try {
logger.info("Before Builder start()");
@@ -260,7 +260,7 @@
cfg.getProcess().destroy();
cfg.setProcess(null);
}
- throw new Exception("Could not start the Launchpad", e);
+ throw new Exception("Could not start the Kickstart", e);
}
return cfg;
@@ -270,7 +270,7 @@
boolean isNew = false;
if (cfg.getProcess() != null || isNew ) {
- LOG.info("Stopping Launchpad '" + cfg.getId() + "'");
+ LOG.info("Stopping Kickstart '" + cfg.getId() + "'");
boolean destroy = true;
final int twoMinutes = 2 * 60 * 1000;
final File controlPortFile = getControlPortFile(cfg.getDirectory());
@@ -372,7 +372,7 @@
cfg.setProcess(null);
}
} else {
- LOG.warn("Launchpad already stopped");
+ LOG.warn("Kickstart already stopped");
}
}
diff --git a/src/main/java/org/apache/sling/maven/kickstart/run/ProcessDescription.java b/src/main/java/org/apache/sling/maven/kickstart/run/ProcessDescription.java
index d903ebd..c762893 100644
--- a/src/main/java/org/apache/sling/maven/kickstart/run/ProcessDescription.java
+++ b/src/main/java/org/apache/sling/maven/kickstart/run/ProcessDescription.java
@@ -22,7 +22,7 @@
import java.io.File;
/**
- * A running launchpad process.
+ * A running kickstart process.
*/
public class ProcessDescription {
@@ -69,7 +69,7 @@
@Override
public void run() {
if ( cfg.getProcess() != null ) {
- System.out.println("Terminating launchpad " + cfg.getId());
+ System.out.println("Terminating kickstart " + cfg.getId());
cfg.getProcess().destroy();
cfg.setProcess(null);
}
diff --git a/src/main/java/org/apache/sling/maven/kickstart/run/ProcessDescriptionProvider.java b/src/main/java/org/apache/sling/maven/kickstart/run/ProcessDescriptionProvider.java
index 7bb3374..e6878cd 100644
--- a/src/main/java/org/apache/sling/maven/kickstart/run/ProcessDescriptionProvider.java
+++ b/src/main/java/org/apache/sling/maven/kickstart/run/ProcessDescriptionProvider.java
@@ -39,14 +39,14 @@
}
/**
- * Prepare an ID for a launchpad that will be started, before saving the config.
- * @param launchpadId the id of the launchpad to lock
+ * Prepare an ID for a kickstart that will be started, before saving the config.
+ * @param kickstartId the id of the kickstart to lock
* @return id key used to add to configs
*/
- public synchronized String getId(final String launchpadId) throws Exception {
- final String id = (launchpadId == null ? DEFAULT_KEY : launchpadId);
+ public synchronized String getId(final String kickstartId) throws Exception {
+ final String id = (kickstartId == null ? DEFAULT_KEY : kickstartId);
if (configs.containsKey(id) || lockedIds.containsKey(id)) {
- throw new Exception("Launchpad Id " + id + " is already in use");
+ throw new Exception("Kickstart Id " + id + " is already in use");
}
String ts = String.valueOf(System.currentTimeMillis());
@@ -56,12 +56,12 @@
/**
*
- * @param launchpadId
+ * @param kickstartId
* @param unlockKey
* @return
*/
- public synchronized boolean cancelId(final String launchpadId, final String unlockKey) {
- final String id = (launchpadId == null ? DEFAULT_KEY : launchpadId);
+ public synchronized boolean cancelId(final String kickstartId, final String unlockKey) {
+ final String id = (kickstartId == null ? DEFAULT_KEY : kickstartId);
if (lockedIds.containsKey(id) && lockedIds.get(id).equals(unlockKey)) {
lockedIds.remove(id);
return true;
@@ -72,21 +72,21 @@
/**
*
- * @param launchpadId
+ * @param kickstartId
* @return
*/
- public synchronized ProcessDescription getRunConfiguration(final String launchpadId) {
- final String id = (launchpadId == null ? DEFAULT_KEY : launchpadId);
+ public synchronized ProcessDescription getRunConfiguration(final String kickstartId) {
+ final String id = (kickstartId == null ? DEFAULT_KEY : kickstartId);
return configs.get(id);
}
/**
*
- * @param launchpadId
+ * @param kickstartId
* @return
*/
- public synchronized boolean isRunConfigurationAvailable(final String launchpadId) {
- return getRunConfiguration(launchpadId) == null && !lockedIds.containsKey(launchpadId);
+ public synchronized boolean isRunConfigurationAvailable(final String kickstartId) {
+ return getRunConfiguration(kickstartId) == null && !lockedIds.containsKey(kickstartId);
}
public synchronized void addRunConfiguration(ProcessDescription cfg, final String unlockKey) throws Exception {
@@ -98,8 +98,8 @@
configs.put(cfg.getId(), cfg);
}
- public synchronized void removeRunConfiguration(final String launchpadId) {
- final String id = (launchpadId == null ? DEFAULT_KEY : launchpadId);
+ public synchronized void removeRunConfiguration(final String kickstartId) {
+ final String id = (kickstartId == null ? DEFAULT_KEY : kickstartId);
configs.remove(id);
}
diff --git a/src/main/java/org/apache/sling/maven/kickstart/run/StartMojo.java b/src/main/java/org/apache/sling/maven/kickstart/run/StartMojo.java
index d09e8fd..b0c4f77 100644
--- a/src/main/java/org/apache/sling/maven/kickstart/run/StartMojo.java
+++ b/src/main/java/org/apache/sling/maven/kickstart/run/StartMojo.java
@@ -52,7 +52,7 @@
import java.util.concurrent.Future;
/**
- * Start one or multiple launchpad instance(s).
+ * Start one or multiple Kickstart instance(s).
*/
@Mojo(
name = "start",
@@ -61,52 +61,60 @@
)
public class StartMojo extends AbstractStartStopMojo {
+ private static Dependency defaultKickstart = new Dependency();
+
+ static {
+ defaultKickstart.setGroupId("org.apache.sling");
+ defaultKickstart.setArtifactId("org.apache.sling.kickstart");
+ defaultKickstart.setVersion("0.0.3-SNAPSHOT");
+ }
+
/**
* Overwrites debug parameter of all server configurations (if set).
* Attaches a debugger to the forked JVM. If set to {@code "true"}, the process will allow a debugger to connect on port 8000.
* If set to some other string, that string will be appended to the server's {@code vmOpts}, allowing you to configure arbitrary debugging options.
*/
- @Parameter(property = "launchpad.debug")
+ @Parameter(property = "kickstart.debug")
protected String debug;
/**
- * Ready timeout in seconds. If the launchpad has not been started in this
+ * Ready timeout in seconds. If the kickstart has not been started in this
* time, it's assumed that the startup failed.
*/
- @Parameter(property = "launchpad.ready.timeout", defaultValue = "600")
- private int launchpadReadyTimeOutSec;
+ @Parameter(property = "kickstart.ready.timeout", defaultValue = "600")
+ private int kickstartReadyTimeOutSec;
/**
- * The launchpad jar. This option has precedence over "launchpadDependency".
+ * The kickstart jar. This option has precedence over "kickstartDependency".
*/
- @Parameter(property = "launchpad.jar")
- private File launchpadJar;
+ @Parameter(property = "kickstart.jar")
+ private File kickstartJar;
/**
- * The launchpad jar as a dependency. This is only used if "launchpadJar" is not
+ * The kickstart jar as a dependency. This is only used if "kickstartJar" is not
* specified.
*/
@Parameter
- private Dependency launchpadDependency;
+ private Dependency kickstartDependency = defaultKickstart;
/**
* Clean the working directory before start.
*/
- @Parameter(property = "launchpad.clean.workdir", defaultValue = "false")
+ @Parameter(property = "kickstart.clean.workdir", defaultValue = "false")
private boolean cleanWorkingDirectory;
/**
- * Keep the launchpad running.
+ * Keep the kickstart running.
* @deprecated Use {@link AbstractStartStopMojo# blockUntilKeyIsPressed} instead.
*/
@Deprecated
- @Parameter(property = "launchpad.keep.running", defaultValue = "false")
- private boolean keepLaunchpadRunning;
+ @Parameter(property = "kickstart.keep.running", defaultValue = "false")
+ private boolean keepKickstartRunning;
/**
- * Set the execution of launchpad instances to be run in parallel (threads)
+ * Set the execution of kickstart instances to be run in parallel (threads)
*/
- @Parameter(property = "launchpad.parallelExecution", defaultValue = "true")
+ @Parameter(property = "kickstart.parallelExecution", defaultValue = "true")
private boolean parallelExecution;
/**
@@ -166,30 +174,30 @@
}
// get configurations
- final Collection<ServerConfiguration> configurations = getLaunchpadConfigurations();
+ final Collection<ServerConfiguration> configurations = getKickstartConfigurations();
// create the common environment
- getLog().info("Keep Launchpad Running: " + this.keepLaunchpadRunning);
- final LaunchpadEnvironment env = new LaunchpadEnvironment(this.findLaunchpadJar(),
+ getLog().info("Keep kickstart Running: " + this.keepKickstartRunning);
+ final KickstartEnvironment env = new KickstartEnvironment(this.findKickstartJar(),
this.cleanWorkingDirectory,
- !this.keepLaunchpadRunning,
- this.launchpadReadyTimeOutSec,
+ !this.keepKickstartRunning,
+ this.kickstartReadyTimeOutSec,
this.debug);
// create callables
final Collection<LauncherCallable> tasks = new LinkedList<LauncherCallable>();
- for (final ServerConfiguration launchpadConfiguration : configurations) {
- validateConfiguration(launchpadConfiguration);
+ for (final ServerConfiguration kickstartConfiguration : configurations) {
+ validateConfiguration(kickstartConfiguration);
- tasks.add(createTask(launchpadConfiguration, env));
+ tasks.add(createTask(kickstartConfiguration, env));
}
- // create the launchpad runner properties
- this.createLaunchpadRunnerProperties(configurations);
+ // create the kickstart runner properties
+ this.createKickstartRunnerProperties(configurations);
if (parallelExecution) {
- // ExecutorService for starting launchpad instances in parallel
+ // ExecutorService for starting kickstart instances in parallel
final ExecutorService executor = Executors.newCachedThreadPool();
try {
final List<Future<ProcessDescription>> resultsCollector = executor.invokeAll(tasks);
@@ -216,8 +224,8 @@
}
}
}
- if (this.keepLaunchpadRunning) {
- getLog().info("Press CTRL-C to stop launchpad instance(s)...");
+ if (this.keepKickstartRunning) {
+ getLog().info("Press CTRL-C to stop kickstart instance(s)...");
while ( true && this.isRunning(tasks)) {
try {
Thread.sleep(5000);
@@ -230,7 +238,7 @@
}
/**
- * Are all launchpads still running?
+ * Are all kickstarts still running?
*/
private boolean isRunning(final Collection<LauncherCallable> tasks) {
for(final LauncherCallable task : tasks) {
@@ -241,7 +249,7 @@
return true;
}
- private void createLaunchpadRunnerProperties(final Collection<ServerConfiguration> configurations)
+ private void createKickstartRunnerProperties(final Collection<ServerConfiguration> configurations)
throws MojoExecutionException {
// create properties
OutputStream writer = null;
@@ -250,25 +258,25 @@
writer = new FileOutputStream(this.systemPropertiesFile);
// disable sling startup check
- props.put("launchpad.skip.startupcheck", "true");
+ props.put("kickstart.skip.startupcheck", "true");
// write out all instances
int index = 0;
- for (final ServerConfiguration launchpadConfiguration : configurations) {
+ for (final ServerConfiguration kickstartConfiguration : configurations) {
index++;
- props.put("launchpad.instance.id." + String.valueOf(index), launchpadConfiguration.getId());
- String runMode = launchpadConfiguration.getRunmode();
+ props.put("kickstart.instance.id." + String.valueOf(index), kickstartConfiguration.getId());
+ String runMode = kickstartConfiguration.getRunmode();
if ( runMode == null ) {
runMode = "";
}
- props.put("launchpad.instance.runmode." + String.valueOf(index), runMode);
- props.put("launchpad.instance.server." + String.valueOf(index), launchpadConfiguration.getServer());
- props.put("launchpad.instance.port." + String.valueOf(index), launchpadConfiguration.getPort());
- props.put("launchpad.instance.contextPath." + String.valueOf(index), launchpadConfiguration.getContextPath());
- final String url = createServerUrl(launchpadConfiguration);
- props.put("launchpad.instance.url." + String.valueOf(index), url);
+ props.put("kickstart.instance.runmode." + String.valueOf(index), runMode);
+ props.put("kickstart.instance.server." + String.valueOf(index), kickstartConfiguration.getServer());
+ props.put("kickstart.instance.port." + String.valueOf(index), kickstartConfiguration.getPort());
+ props.put("kickstart.instance.contextPath." + String.valueOf(index), kickstartConfiguration.getContextPath());
+ final String url = createServerUrl(kickstartConfiguration);
+ props.put("kickstart.instance.url." + String.valueOf(index), url);
}
- props.put("launchpad.instances", String.valueOf(index));
+ props.put("kickstart.instances", String.valueOf(index));
props.store(writer, null);
} catch (final IOException e) {
@@ -301,93 +309,93 @@
}
/**
- * @param launchpadConfiguration
+ * @param kickstartConfiguration
*/
- private LauncherCallable createTask(final ServerConfiguration launchpadConfiguration,
- final LaunchpadEnvironment env)
+ private LauncherCallable createTask(final ServerConfiguration kickstartConfiguration,
+ final KickstartEnvironment env)
throws MojoExecutionException, MojoFailureException {
- final String id = launchpadConfiguration.getId();
+ final String id = kickstartConfiguration.getId();
getLog().debug(new StringBuilder("Starting ").append(id).
- append(" with runmode ").append(launchpadConfiguration.getRunmode()).
- append(" on port ").append(launchpadConfiguration.getPort()).
- append(" in folder ").append(launchpadConfiguration.getFolder().getAbsolutePath()).toString());
+ append(" with runmode ").append(kickstartConfiguration.getRunmode()).
+ append(" on port ").append(kickstartConfiguration.getPort()).
+ append(" in folder ").append(kickstartConfiguration.getFolder().getAbsolutePath()).toString());
// create task
- return new LauncherCallable(this.getLog(), launchpadConfiguration, env);
+ return new LauncherCallable(this.getLog(), kickstartConfiguration, env);
}
/**
* Validate a configuration
- * @param launchpadConfiguration The launchpad configuration
+ * @param kickstartConfiguration The kickstart configuration
* @throws MojoExecutionException
*/
- private void validateConfiguration(final ServerConfiguration launchpadConfiguration)
+ private void validateConfiguration(final ServerConfiguration kickstartConfiguration)
throws MojoExecutionException {
- if ( launchpadConfiguration.getPort() == null ) {
- launchpadConfiguration.setPort(String.valueOf(PortHelper.getNextAvailablePort()));
+ if ( kickstartConfiguration.getPort() == null ) {
+ kickstartConfiguration.setPort(String.valueOf(PortHelper.getNextAvailablePort()));
}
- if ( launchpadConfiguration.getControlPort() == null ) {
- launchpadConfiguration.setControlPort(String.valueOf(PortHelper.getNextAvailablePort()));
+ if ( kickstartConfiguration.getControlPort() == null ) {
+ kickstartConfiguration.setControlPort(String.valueOf(PortHelper.getNextAvailablePort()));
}
- // set the id of the launchpad
- if ( launchpadConfiguration.getId() == null || launchpadConfiguration.getId().trim().length() == 0 ) {
- String runMode = launchpadConfiguration.getRunmode();
+ // set the id of the kickstart
+ if ( kickstartConfiguration.getId() == null || kickstartConfiguration.getId().trim().length() == 0 ) {
+ String runMode = kickstartConfiguration.getRunmode();
if ( runMode == null ) {
runMode = "_";
}
- final String id = new StringBuilder(runMode.replace(',', '_')).append('-').append(launchpadConfiguration.getPort()).toString();
- launchpadConfiguration.setId(id);
+ final String id = new StringBuilder(runMode.replace(',', '_')).append('-').append(kickstartConfiguration.getPort()).toString();
+ kickstartConfiguration.setId(id);
}
// populate folder if not set
- if (launchpadConfiguration.getFolder() == null) {
- final File folder = new File(new StringBuilder(this.project.getBuild().getDirectory()).append('/').append(launchpadConfiguration.getId()).toString());
- launchpadConfiguration.setFolder(folder);
+ if (kickstartConfiguration.getFolder() == null) {
+ final File folder = new File(new StringBuilder(this.project.getBuild().getDirectory()).append('/').append(kickstartConfiguration.getId()).toString());
+ kickstartConfiguration.setFolder(folder);
}
// context path should not be null
- if ( launchpadConfiguration.getContextPath() == null ) {
- launchpadConfiguration.setContextPath("");
+ if ( kickstartConfiguration.getContextPath() == null ) {
+ kickstartConfiguration.setContextPath("");
}
- if ( launchpadConfiguration.getInstances() < 0 ) {
- launchpadConfiguration.setInstances(1);
+ if ( kickstartConfiguration.getInstances() < 0 ) {
+ kickstartConfiguration.setInstances(1);
}
}
/**
- * Finds the launchpad.jar artifact of the project being built.
+ * Finds the kickstart.jar artifact of the project being built.
*
- * @return the launchpad.jar artifact
- * @throws MojoFailureException if a launchpad.jar artifact was not found
+ * @return the kickstart.jar artifact
+ * @throws MojoFailureException if a kickstart.jar artifact was not found
*/
- private File findLaunchpadJar() throws MojoFailureException, MojoExecutionException {
+ private File findKickstartJar() throws MojoFailureException, MojoExecutionException {
- // If a launchpad JAR is specified, use it
- if (launchpadJar != null) {
- getLog().info("Using launchpad jar from '" + launchpadJar + "' given as configuration parameter!");
- return launchpadJar;
+ // If a kickstart JAR is specified, use it
+ if (kickstartJar != null) {
+ getLog().info("Using kickstart jar from '" + kickstartJar + "' given as configuration parameter!");
+ return kickstartJar;
}
- // If a launchpad dependency is configured, resolve it
- if (launchpadDependency != null) {
- getLog().info("Using launchpad dependency '" + launchpadDependency + "' given as configuration parameter!");
- return getArtifact(launchpadDependency).getFile();
+ // If a kickstart dependency is configured, resolve it
+ if (kickstartDependency != null) {
+ getLog().info("Using kickstart dependency '" + kickstartDependency + "' given as configuration parameter!");
+ return getArtifact(kickstartDependency).getFile();
}
// If the current project is a slingstart project, use its JAR artifact
if (this.project.getPackaging().equals(BuildConstants.PACKAGING_SLINGQUICKSTART)) {
File jarFile = project.getArtifact().getFile();
if (jarFile != null && jarFile.exists()) {
- getLog().info("Using launchpad jar being generated as this project's primary artifact: '" + jarFile + "'!");
+ getLog().info("Using kickstart jar being generated as this project's primary artifact: '" + jarFile + "'!");
return jarFile;
}
else {
jarFile = new File(project.getBuild().getDirectory(), project.getBuild().getFinalName() + ".jar");
if (jarFile.exists()) {
- getLog().info("Using launchpad jar being generated as this project's primary artifact: '" + jarFile + "'!");
+ getLog().info("Using kickstart jar being generated as this project's primary artifact: '" + jarFile + "'!");
return jarFile;
}
}
@@ -397,7 +405,7 @@
for (Artifact attachedArtifact : project.getAttachedArtifacts()) {
// find the attached artifact with classifier "standalone"
if (BuildConstants.TYPE_JAR.equals(attachedArtifact.getType()) && BuildConstants.CLASSIFIER_APP.equals(attachedArtifact.getClassifier())) {
- getLog().info("Using launchpad jar being attached as additional project artifact: '" + attachedArtifact.getFile() + "'!");
+ getLog().info("Using kickstart jar being attached as additional project artifact: '" + attachedArtifact.getFile() + "'!");
return attachedArtifact.getFile();
}
}
@@ -406,7 +414,7 @@
//AS TODO: Is Package Mojo still needed / supported ?
// File localJarFile = PackageMojo.getNonPrimaryBuildFile(project, ".jar");
// if (localJarFile.exists()) {
-// getLog().info("Using local launchpad jar being created in predefined directory: '" + localJarFile + "'!");
+// getLog().info("Using local kickstart jar being created in predefined directory: '" + localJarFile + "'!");
// return localJarFile;
// }
@@ -420,21 +428,21 @@
d.setVersion(dep.getVersion());
d.setScope(Artifact.SCOPE_RUNTIME);
d.setType(BuildConstants.TYPE_JAR);
- getLog().info("Using launchpad jar from first dependency of type 'slingstart': '"+ d +"'!");
+ getLog().info("Using kickstart jar from first dependency of type 'slingstart': '"+ d +"'!");
return getArtifact(d).getFile();
}
}
- // Launchpad has not been found, throw an exception
- throw new MojoFailureException("Could not find the launchpad jar. " +
- "Either specify the 'launchpadJar' configuration or use this inside a slingstart project.");
+ // kickstart has not been found, throw an exception
+ throw new MojoFailureException("Could not find the kickstart jar. " +
+ "Either specify the 'kickstartJar' configuration or use this inside a slingstart project.");
}
/**
* Get all configurations
* @return Collection of configurations.
*/
- private Collection<ServerConfiguration> getLaunchpadConfigurations() {
+ private Collection<ServerConfiguration> getKickstartConfigurations() {
final List<ServerConfiguration> configs = new ArrayList<ServerConfiguration>();
if ( this.servers != null && !this.servers.isEmpty() ) {
for(final ServerConfiguration config : this.servers) {
diff --git a/src/main/java/org/apache/sling/maven/kickstart/run/StopMojo.java b/src/main/java/org/apache/sling/maven/kickstart/run/StopMojo.java
index 013360a..31ea0df 100644
--- a/src/main/java/org/apache/sling/maven/kickstart/run/StopMojo.java
+++ b/src/main/java/org/apache/sling/maven/kickstart/run/StopMojo.java
@@ -30,7 +30,7 @@
import java.util.Properties;
/**
- * Stop one or multiple running launchpad instance(s).
+ * Stop one or multiple running kickstart instance(s).
*
*/
@Mojo(
@@ -44,25 +44,25 @@
protected void doExecute() throws MojoExecutionException, MojoFailureException {
// read configurations
- final Properties launchpadConfigProps = new Properties();
+ final Properties kickstartConfigProps = new Properties();
Reader reader = null;
try {
reader = new FileReader(this.systemPropertiesFile);
- launchpadConfigProps.load(reader);
+ kickstartConfigProps.load(reader);
} catch ( final IOException ioe) {
- throw new MojoExecutionException("Unable to read launchpad runner configuration properties.", ioe);
+ throw new MojoExecutionException("Unable to read kickstart runner configuration properties.", ioe);
} finally {
IOUtils.closeQuietly(reader);
}
- final int instances = Integer.valueOf(launchpadConfigProps.getProperty("launchpad.instances"));
+ final int instances = Integer.valueOf(kickstartConfigProps.getProperty("kickstart.instances"));
final List<ProcessDescription> configurations = new ArrayList<ProcessDescription>();
for(int i=1;i<=instances;i++) {
- final String id = launchpadConfigProps.getProperty("launchpad.instance.id." + String.valueOf(i));
+ final String id = kickstartConfigProps.getProperty("kickstart.instance.id." + String.valueOf(i));
final ProcessDescription config = ProcessDescriptionProvider.getInstance().getRunConfiguration(id);
if ( config == null ) {
- getLog().warn("No launchpad configuration found for instance " + id);
+ getLog().warn("No kickstart configuration found for instance " + id);
} else {
configurations.add(config);
}
@@ -70,7 +70,7 @@
blockIfNecessary();
if (configurations.size() > 0) {
- getLog().info(new StringBuilder("Stopping ").append(configurations.size()).append(" Launchpad instances").toString());
+ getLog().info(new StringBuilder("Stopping ").append(configurations.size()).append(" Kickstart instances").toString());
for (final ProcessDescription cfg : configurations) {
@@ -78,7 +78,7 @@
LauncherCallable.stop(this.getLog(), cfg);
ProcessDescriptionProvider.getInstance().removeRunConfiguration(cfg.getId());
} catch (Exception e) {
- throw new MojoExecutionException("Could not stop launchpad " + cfg.getId(), e);
+ throw new MojoExecutionException("Could not stop kickstart " + cfg.getId(), e);
}
}
} else {