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

com.arangodb.shaded.vertx.core.spi.launcher.Command Maven / Gradle / Ivy

There is a newer version: 7.8.0
Show newest version
/*
 * Copyright (c) 2011-2019 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 com.arangodb.shaded.vertx.core.spi.launcher;

import com.arangodb.shaded.vertx.core.cli.CLIException;
import com.arangodb.shaded.vertx.core.cli.annotations.Argument;
import com.arangodb.shaded.vertx.core.cli.annotations.Description;
import com.arangodb.shaded.vertx.core.cli.annotations.Option;
import com.arangodb.shaded.vertx.core.cli.annotations.Summary;

/**
 * A plug-in to the Vert.x command or {@link com.arangodb.shaded.vertx.core.Launcher} class. Each command instance is created
 * by a {@link CommandFactory}.
 * 

* {@link Command} implementation can retrieve argument and option using the {@link Argument} and {@link * Option} annotations. Documentation / help is provided using the {@link Summary} (single sentence) and * {@link Description} annotations. *

* Commands follow a strict lifecycle. The {@link #setUp(ExecutionContext)} method is called with an * execution context. It lets you validate the inputs and prepare the environment is needed. The * {@link #run()} method is called immediately after {@link #setUp(ExecutionContext)}, and executes the * command. Finally, once the command has completed, the {@link #tearDown()} method is called. In this method * you have the opportunity to cleanup. *

* * @author Clement Escoffier */ public interface Command { /** * Set up the command execution environment. * The command line model has been retrieved and is frozen. Values has been set / injected. You can use * this callback to validate the inputs. * * @param context the context * @throws CLIException if the validation failed */ void setUp(ExecutionContext context) throws CLIException; /** * Executes the command. * * @throws CLIException If anything went wrong. */ void run() throws CLIException; /** * The command has been executed. Use this method to cleanup the environment. * * @throws CLIException if anything went wrong */ void tearDown() throws CLIException; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy