本文整理了Java中io.airlift.command.Option
类的一些代码示例,展示了Option
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option
类的具体详情如下:
包路径:io.airlift.command.Option
类名称:Option
暂无
代码示例来源:origin: facebookarchive/hive-io-experimental
/**
* Options for table
*/
public class TableOptions {
// CHECKSTYLE: stop VisibilityModifier
/** Database name */
@Option(name = "--database", description = "Database to use")
public String database = Defaults.DATABASE;
/** Table name */
@Option(name = { "-t", "--table" }, description = "Table to read from")
public String table;
// CHECKSTYLE: resume VisibilityModifier
}
代码示例来源:origin: io.tesla/airline
OptionType optionType = optionAnnotation.type();
String name;
if (!optionAnnotation.title().isEmpty()) {
name = optionAnnotation.title();
List<String> options = ImmutableList.copyOf(optionAnnotation.name());
String description = optionAnnotation.description();
int arity = optionAnnotation.arity();
Preconditions.checkArgument(arity >= 0 || arity == Integer.MIN_VALUE, "Invalid arity for option %s", name);
if (optionAnnotation.arity() >= 0) {
arity = optionAnnotation.arity();
boolean required = optionAnnotation.required();
boolean hidden = optionAnnotation.hidden();
List<String> allowedValues = ImmutableList.copyOf(optionAnnotation.allowedValues());
if (allowedValues.isEmpty()) {
allowedValues = null;
代码示例来源:origin: com.atlassian.sdk/ap3-api
/**
* @since version
*/
public abstract class AbstractProductStartCommand extends AbstractStartCommand
{
@Option(name = {"-v", "--version"}, title = "Version", description = "The product version to use")
protected String version = "";
@Option(name = {"-ch", "--clean-home"}, title = "Clean Home", description = "TCleans the product home directory")
protected boolean cleanHome = false;
@Option(name = {"-pdv", "--product-data-version"}, title = "Product Data Version", description = "The product data version to use")
protected String dataVersion = "";
@Option(name = {"-pdp", "--product-data-path"}, title = "Product Data Path", description = "A path to a product home zip file to use")
protected String dataPath = "";
}
代码示例来源:origin: facebookarchive/hive-io-experimental
/**
* Options for SOCKS proxy
*/
public class SocksProxyOptions {
// CHECKSTYLE: stop VisibilityModifier
/** Host */
@Option(name = "--socks-proxy-host", hidden = true)
public String host = "localhost";
/** Port */
@Option(name = "--socks-proxy-port", hidden = true)
public int port = -1;
// CHECKSTYLE: resume VisibilityModifier
}
代码示例来源:origin: facebookarchive/hive-io-experimental
/**
* Options for multi-threaded
*/
public class MultiThreadOptions {
// CHECKSTYLE: stop VisibilityModifier
/** Number of threads to use */
@Option(name = "--threads", description = "Number of threads to use")
public int threads = 1;
// CHECKSTYLE: resume VisibilityModifier
public boolean isMultiThreaded() {
return threads > 1;
}
public boolean isSingleThreaded() {
return threads == 1;
}
}
代码示例来源:origin: facebookarchive/hive-io-experimental
/**
* Options for parser
*/
public class ParserOptions {
// CHECKSTYLE: stop VisibilityModifier
/** Parse only, don't print */
@Option(name = { "--parse-only", "--dont-print" },
description = "Don't print, just measure performance")
public boolean parseOnly = false;
/** Name of Java bean parser */
@Option(name = "--bean-parser", description = "Use bean parser")
public boolean beanParser = false;
/** Name of row class */
@Option(name = "--row-class", description = "class which represents a row")
public String rowClassName = IdIdSimRow.class.getName();
// CHECKSTYLE: stop VisibilityModifier
}
代码示例来源:origin: io.airlift.airship/airship-cli
public class GlobalOptions
{
@Option(type = GLOBAL, name = {"-e", "--environment"}, description = "Airship environment")
public String environment;
@Option(type = GLOBAL, name = "--batch", description = "Do not prompt")
public boolean batch;
@Option(type = GLOBAL, name = "--debug", description = "Enable debug messages")
public boolean debug = false;
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
sb.append("GlobalOptions");
sb.append("{environment=").append(environment);
sb.append(", batch=").append(batch);
sb.append(", debug=").append(debug);
sb.append('}');
return sb.toString();
}
}
代码示例来源:origin: prezi/pride
public abstract class AbstractConfiguredCommand extends AbstractCommand {
@Option(name = "--gradle-version",
title = "version",
description = "Use specified Gradle version (can be a version number, a URL of a distribution, or a location of an installation)")
private String explicitGradleVersion;
@Option(name = "--gradle-home",
title = "directory",
description = "Use specified Gradle home")
private String explicitGradleHome;
@Override
final public Integer call() throws Exception {
PropertiesConfiguration globalConfiguration = loadGlobalConfiguration();
RuntimeConfiguration config = DefaultRuntimeConfiguration.create(globalConfiguration);
config.override(GRADLE_VERSION, explicitGradleVersion);
config.override(GRADLE_HOME, explicitGradleHome);
executeWithConfiguration(config);
return 0;
}
abstract protected void executeWithConfiguration(RuntimeConfiguration config) throws Exception;
}
代码示例来源:origin: com.atlassian.sdk/ap3-api
public class GlobalOptions
{
@Option(type = GLOBAL, name = {"-o", "--offline"}, description = "Offline mode")
private boolean offline = false;
@Option(type = GLOBAL, name = {"-u", "--update"}, description = "Force update of the AP3 SDK")
private boolean update = false;
@Option(type = GLOBAL, name = {"-ud", "--update-develop"}, hidden = true)
private boolean updateDevelop = false;
public boolean isOffline()
{
return offline;
}
public boolean doUpdate()
{
return update;
}
public boolean doUpdateDevelop()
{
return updateDevelop;
}
}
代码示例来源:origin: facebookarchive/hive-io-experimental
/**
* Options for output table
*/
public class OutputTableOptions extends TableOptions {
// CHECKSTYLE: stop VisibilityModifier
/** Is the table partitioned */
@Option(name = "--partitioned", description = "Write to a table partitioned by ds")
public boolean partitioned = false;
// CHECKSTYLE: stop VisibilityModifier
/** Constructor */
public OutputTableOptions() {
table = "hiveio_output_test";
}
/** Process options */
public void process() {
if (partitioned) {
table = "hiveio_output_test_partitioned";
}
}
}
代码示例来源:origin: facebookarchive/hive-io-experimental
/**
* Options for Metastore
*/
public class MetastoreOptions {
// CHECKSTYLE: stop VisibilityModifier
/** Hive host */
@Option(name = { "--metastore-host" }, description = "Hive Metastore Host")
public String host = Defaults.METASTORE_HOST;
/** Hive port */
@Option(name = { "--metastore-port" }, description = "Hive Metatstore Port")
public int port = Defaults.METASTORE_PORT;
// CHECKSTYLE: resume VisibilityModifier
/**
* Create Metastore Thrift client
*
* @return thrift metastore client
* @throws TTransportException
*/
public ThriftHiveMetastore.Iface makeClient() throws TTransportException {
return HiveMetastores.create(host, port);
}
}
代码示例来源:origin: facebookarchive/hive-io-experimental
/**
* Options for Hadoop input splits
*/
public class SplitOptions {
// CHECKSTYLE: stop VisibilityModifier
/** number of splits */
@Option(name = "--request-num-splits", description = "Number of splits to request")
public int requestNumSplits = 0;
/** splits per thread */
@Option(name = "--request-splits-per-thread", description = "Number of splits per thread")
public int requestSplitsPerThread = 3;
// CHECKSTYLE: resume VisibilityModifier
/**
* Compute number of splits
*
* @param threads number of threads
*/
public void compute(int threads) {
if (requestNumSplits == 0) {
requestNumSplits = threads * requestSplitsPerThread;
}
}
}
代码示例来源:origin: facebookarchive/hive-io-experimental
@Option(name = { "-f", "--partition-filter" }, description = "Partition filter")
public String partitionFilter = Defaults.PARTITION_FILTER;
@Option(name = "--parser", description = "Force Input parser to use")
public String parser;
代码示例来源:origin: prezi/pride
public abstract class AbstractCommand implements PrideCommand {
protected static final Logger logger = LoggerFactory.getLogger(AbstractCommand.class);
@Option(name = {"-v", "--verbose"},
description = "Verbose mode")
private boolean verbose;
@Option(name = {"-q", "--quiet"},
description = "Quite mode")
private boolean quiet;
@Option(name = {"-p", "--pride-directory"},
title = "directory",
description = "Initializes the pride in the given directory instead of the current directory")
private File explicitPrideDirectory;
@Option(name = {"--help"},
description = "Show help for the command")
private boolean help;
代码示例来源:origin: facebookarchive/hive-io-experimental
@Option(name = "--namespaces-file", description = "File of Hive metastore clusters")
public String path;
@Option(name = "--namespace", description = "Cluster to use")
public String name = "silver";
代码示例来源:origin: prezi/pride
@Command(name = "reinit", description = "Re-initialize the configuration of an existing pride")
public class ReinitCommand extends AbstractConfiguredCommand {
@Option(name = "--with-wrapper",
description = "Add a Gradle wrapper")
private boolean explicitWithWrapper;
@Option(name = "--no-wrapper",
description = "Do not add Gradle wrapper")
private boolean explicitNoWrapper;
@Option(name = {"-D", "--refresh-dependencies"},
description = "Refresh Gradle dependencies after update completed")
private Boolean explicitRefreshDependencies;
@Override
protected void executeWithConfiguration(RuntimeConfiguration config) throws Exception {
Pride pride = Pride.getPride(getPrideDirectory(), config, getVcsManager());
boolean addWrapper = pride.getConfiguration().override(GRADLE_WRAPPER, explicitWithWrapper, explicitNoWrapper);
InitAction.create(pride.getRootDirectory(), config, getVcsManager(), true, true, false).createPride(addWrapper, isVerbose());
boolean refreshDependencies = config.override(COMMAND_REINIT_REFRESH_DEPENDENCIES, explicitRefreshDependencies);
if (refreshDependencies) {
new RefreshDependenciesAction().refreshDependencies(pride);
}
}
}
代码示例来源:origin: io.airlift.airship/airship-cli
@Command(name = "provision", description = "Provision a new agent")
public static class AgentProvisionCommand extends AirshipCommanderCommand
@Option(name = "--agent-config", description = "Agent for the coordinator")
public String agentConfig;
@Option(name = {"--count"}, description = "Number of agent to provision")
public int count = 1;
@Option(name = "--ami", description = "Amazon Machine Image for agent")
public String ami;
@Option(name = "--key-pair", description = "Key pair for agent")
public String keyPair;
@Option(name = "--security-group", description = "Security group for agent")
public String securityGroup;
@Option(name = "--availability-zone", description = "EC2 availability zone for agent")
public String availabilityZone;
@Option(name = "--instance-type", description = "Instance type to provision")
public String instanceType;
@Option(name = "--no-wait", description = "Do not wait for agent to start")
public boolean noWait;
代码示例来源:origin: prezi/pride
@Option(name = {"-f", "--force"},
description = "Force initialization of a pride, even if one already exists")
private boolean explicitForce;
@Option(name = "--with-wrapper",
description = "Add a Gradle wrapper")
private boolean explicitWithWrapper;
@Option(name = "--no-wrapper",
description = "Do not add Gradle wrapper")
private boolean explicitNoWrapper;
@Option(name = "--no-add-existing",
description = "Do not add existing modules in the pride directory to the pride")
private boolean explicitNoAddExisting;
@Option(name = "--ignore-config",
description = "Ignore existing pride's configuration (to be used with --force)")
private boolean explicitIgnoreConfig;
@Option(name = "--import",
title = "file or URL",
description = "Import configuration and modules from configuration file exported by 'pride export' (use '-' to read from standard input)")
@Option(name = "--from-config",
hidden = true)
private String explicitFromConfig;
@Option(name = {"-c", "--use-repo-cache"},
代码示例来源:origin: io.airlift.airship/airship-cli
@Command(name = "provision", description = "Provision a new coordinator")
public static class CoordinatorProvisionCommand extends AirshipCommanderCommand
@Option(name = "--coordinator-config", description = "Configuration for the coordinator")
public String coordinatorConfig;
@Option(name = {"--count"}, description = "Number of coordinators to provision")
public int count = 1;
@Option(name = "--ami", description = "Amazon Machine Image for coordinator")
public String ami;
@Option(name = "--key-pair", description = "Key pair for coordinator")
public String keyPair;
@Option(name = "--security-group", description = "Security group for coordinator")
public String securityGroup;
@Option(name = "--availability-zone", description = "EC2 availability zone for coordinator")
public String availabilityZone;
@Option(name = "--instance-type", description = "Instance type to provision")
public String instanceType;
@Option(name = "--no-wait", description = "Do not wait for coordinator to start")
public boolean noWait;
代码示例来源:origin: facebookarchive/hive-io-experimental
/**
* Input benchmark
*/
@Command(name = "input-benchmark", description = "Benchmark for Input")
public class InputBenchmarkCmd extends BaseCmd {
// CHECKSTYLE: stop VisibilityModifier
/** metastore options */
@Inject public MetastoreOptions metastoreOpts = new MetastoreOptions();
/** table options */
@Inject public InputTableOptions tableOpts = new InputTableOptions();
/** Whether to track metrics */
@Option(name = "--trackMetrics", description = "Track metrics while running")
public boolean trackMetrics = false;
/** Every how many splits to print */
@Option(name = "--splitPrintPeriod", description = "Every how many splits to print")
public int splitPrintPeriod = 3;
/** Every how many records in a split to print */
@Option(name = "--recordPrintPeriod")
public int recordPrintPeriod = 1000000;
// CHECKSTYLE: resume VisibilityModifier
@Override public void execute() throws Exception {
new InputBenchmark().run(this);
}
}
内容来源于网络,如有侵权,请联系作者删除!