// Path: vertx-deploy-agent/src/main/java/nl/jpoint/vertx/deploy/agent/request/DeployApplicationRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class DeployApplicationRequest extends ModuleRequest {
// 
//     private boolean running = false;
//     private String javaOpts = "";
//     private String instances = "1";
//     private String configLocation = "";
//     private boolean installed = false;
//     private boolean testScope = false;
//     private String mainService;
// 
//     @JsonCreator
//     public DeployApplicationRequest(@JsonProperty("group_id") final String groupId, @JsonProperty("artifact_id") final String artifactId,
//                                     @JsonProperty("version") final String version, @JsonProperty("classifier") final String classifier, @JsonProperty("type") final String type) {
//         super(groupId, artifactId, version, classifier, type);
//     }
// 
//     private DeployApplicationRequest(final String groupId, final String artifactId,
//                                      final String version, final String classifier, final String type, boolean testScope) {
//         this(groupId, artifactId, version, classifier, type);
//         this.testScope = testScope;
//     }
// 
//     @Override
//     public boolean deleteBase() {
//         return false;
//     }
// 
//     @Override
//     public boolean checkConfig() {
//         return false;
//     }
// 
//     @Override
//     public String getLogName() {
//         return LogConstants.DEPLOY_ARTIFACT_REQUEST;
//     }
// 
//     public boolean isRunning() {
//         return running;
//     }
// 
//     public void setRunning(boolean running) {
//         this.running = running;
//     }
// 
//     public void withJavaOpts(String javaOpts) {
//         this.javaOpts = javaOpts != null ? javaOpts : "";
//     }
// 
//     public void withConfigLocation(String configLocation) {
//         this.configLocation = configLocation != null ? configLocation : "";
//     }
// 
//     public void withInstances(String instances) {
//         this.instances = instances;
//     }
// 
//     public void withTestScope(boolean testScope) {
//         this.testScope = testScope;
//     }
// 
//     public DeployApplicationRequest withMainService(String mainService) {
//         this.mainService = mainService;
//         return this;
//     }
// 
//     public boolean isTestScope() {
//         return this.testScope;
//     }
// 
//     public String getJavaOpts() {
//         return javaOpts;
//     }
// 
//     public String getInstances() {
//         return instances;
//     }
// 
//     public String getConfigLocation() {
//         return this.configLocation;
//     }
// 
//     public String getMainService() {
//         return mainService;
//     }
// 
//     public boolean isInstalled() {
//         return installed;
//     }
// 
//     public void setInstalled(boolean installed) {
//         this.installed = installed;
//     }
// 
//     public static DeployApplicationRequest build(String groupId, String artifactId, String version, String classifier, boolean testScope) {
//         return new DeployApplicationRequest(groupId, artifactId, version, classifier, "jar", testScope);
//     }
// }
// 
// Path: vertx-deploy-agent/src/main/java/nl/jpoint/vertx/deploy/agent/util/ExitCodes.java
// public enum ExitCodes {
//     ZERO("Normal startup"),
//     ONE("Vertx Initialization Issue"),
//     TWO("Process Issue"),
//     THREE("System Configuration Issue"),
//     FOUR(""),
//     FIVE("Vertx Deployment Issue");
// 
//     private final String explanation;
// 
//     ExitCodes(String explanation) {
// 
//         this.explanation = explanation;
//     }
// 
//     @Override
//     public String toString() {
//         return explanation;
//     }
// 
// }


import nl.jpoint.vertx.deploy.agent.request.DeployApplicationRequest;
import nl.jpoint.vertx.deploy.agent.util.ExitCodes;
import rx.Observable;
import static rx.Observable.just;
package nl.jpoint.vertx.deploy.agent.command;



@FunctionalInterface
public interface Command<T> {
    Observable<T> executeAsync(T request);

    default Observable<Integer> handleExitCode(DeployApplicationRequest request, Integer exitCode) {
        if (exitCode != 0) {
// Path: vertx-deploy-agent/src/main/java/nl/jpoint/vertx/deploy/agent/request/DeployApplicationRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class DeployApplicationRequest extends ModuleRequest {
// 
//     private boolean running = false;
//     private String javaOpts = "";
//     private String instances = "1";
//     private String configLocation = "";
//     private boolean installed = false;
//     private boolean testScope = false;
//     private String mainService;
// 
//     @JsonCreator
//     public DeployApplicationRequest(@JsonProperty("group_id") final String groupId, @JsonProperty("artifact_id") final String artifactId,
//                                     @JsonProperty("version") final String version, @JsonProperty("classifier") final String classifier, @JsonProperty("type") final String type) {
//         super(groupId, artifactId, version, classifier, type);
//     }
// 
//     private DeployApplicationRequest(final String groupId, final String artifactId,
//                                      final String version, final String classifier, final String type, boolean testScope) {
//         this(groupId, artifactId, version, classifier, type);
//         this.testScope = testScope;
//     }
// 
//     @Override
//     public boolean deleteBase() {
//         return false;
//     }
// 
//     @Override
//     public boolean checkConfig() {
//         return false;
//     }
// 
//     @Override
//     public String getLogName() {
//         return LogConstants.DEPLOY_ARTIFACT_REQUEST;
//     }
// 
//     public boolean isRunning() {
//         return running;
//     }
// 
//     public void setRunning(boolean running) {
//         this.running = running;
//     }
// 
//     public void withJavaOpts(String javaOpts) {
//         this.javaOpts = javaOpts != null ? javaOpts : "";
//     }
// 
//     public void withConfigLocation(String configLocation) {
//         this.configLocation = configLocation != null ? configLocation : "";
//     }
// 
//     public void withInstances(String instances) {
//         this.instances = instances;
//     }
// 
//     public void withTestScope(boolean testScope) {
//         this.testScope = testScope;
//     }
// 
//     public DeployApplicationRequest withMainService(String mainService) {
//         this.mainService = mainService;
//         return this;
//     }
// 
//     public boolean isTestScope() {
//         return this.testScope;
//     }
// 
//     public String getJavaOpts() {
//         return javaOpts;
//     }
// 
//     public String getInstances() {
//         return instances;
//     }
// 
//     public String getConfigLocation() {
//         return this.configLocation;
//     }
// 
//     public String getMainService() {
//         return mainService;
//     }
// 
//     public boolean isInstalled() {
//         return installed;
//     }
// 
//     public void setInstalled(boolean installed) {
//         this.installed = installed;
//     }
// 
//     public static DeployApplicationRequest build(String groupId, String artifactId, String version, String classifier, boolean testScope) {
//         return new DeployApplicationRequest(groupId, artifactId, version, classifier, "jar", testScope);
//     }
// }
// 
// Path: vertx-deploy-agent/src/main/java/nl/jpoint/vertx/deploy/agent/util/ExitCodes.java
// public enum ExitCodes {
//     ZERO("Normal startup"),
//     ONE("Vertx Initialization Issue"),
//     TWO("Process Issue"),
//     THREE("System Configuration Issue"),
//     FOUR(""),
//     FIVE("Vertx Deployment Issue");
// 
//     private final String explanation;
// 
//     ExitCodes(String explanation) {
// 
//         this.explanation = explanation;
//     }
// 
//     @Override
//     public String toString() {
//         return explanation;
//     }
// 
// }


// Path: vertx-deploy-agent/src/main/java/nl/jpoint/vertx/deploy/agent/command/Command.java
import nl.jpoint.vertx.deploy.agent.request.DeployApplicationRequest;
import nl.jpoint.vertx.deploy.agent.util.ExitCodes;
import rx.Observable;
import static rx.Observable.just;

package nl.jpoint.vertx.deploy.agent.command;



@FunctionalInterface
public interface Command<T> {
    Observable<T> executeAsync(T request);

    default Observable<Integer> handleExitCode(DeployApplicationRequest request, Integer exitCode) {
        if (exitCode != 0) {
            throw new IllegalStateException("Error while initializing container " + request.getModuleId() + " with error " + ExitCodes.values()[exitCode]);