/*
* Copyright (c) 2011-2017 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/
package io.vertx.core.spi.launcher;
import io.vertx.core.cli.CLI;
import io.vertx.core.cli.CommandLine;
import io.vertx.core.impl.launcher.VertxCommandLauncher;
import java.io.PrintStream;
import java.util.HashMap;
The execution context contains various information on the execution.
/**
* The execution context contains various information on the execution.
*/
public class ExecutionContext extends HashMap<String, Object> {
private final VertxCommandLauncher launcher;
private final Command command;
private final CommandLine commandLine;
Creates a new instance of ExecutionContext
. Params: - command – the command instance that is executed
- launcher – the launcher class
- commandLine – the command line
/**
* Creates a new instance of {@link ExecutionContext}.
*
* @param command the command instance that is executed
* @param launcher the launcher class
* @param commandLine the command line
*/
public ExecutionContext(Command command, VertxCommandLauncher launcher, CommandLine commandLine) {
this.command = command;
this.commandLine = commandLine;
this.launcher = launcher;
}
Returns: the command line object.
/**
* @return the command line object.
*/
public Command command() {
return command;
}
Returns: the launcher.
/**
* @return the launcher.
*/
public VertxCommandLauncher launcher() {
return launcher;
}
Returns: the CLI
.
/**
* @return the {@link CLI}.
*/
public CLI cli() {
return commandLine.cli();
}
Returns: the CommandLine
.
/**
* @return the {@link CommandLine}.
*/
public CommandLine commandLine() {
return commandLine;
}
Executes another command.
Params: - command – the command name
- args – the arguments
/**
* Executes another command.
*
* @param command the command name
* @param args the arguments
*/
public void execute(String command, String... args) {
launcher.execute(command, args);
}
Returns: the Main-Class
object.
/**
* @return the {@code Main-Class} object.
*/
public Object main() {
return get("Main");
}
Returns: the PrintStream
on which command can write.
/**
* @return the {@link PrintStream} on which command can write.
*/
public PrintStream getPrintStream() {
return launcher.getPrintStream();
}
}