protected FastForwardConfig ffwdConfig(final Namespace options) { if (!options.getBoolean(ffwdEnabled.getDest())) { return null; } return new FastForwardConfig( Optional.ofNullable(options.getString(ffwdAddress.getDest())), options.getInt(ffwdInterval.getDest()), options.getString(ffwdMetricKey.getDest())); } }
@Override public void run(Namespace namespace, Liquibase liquibase) throws Exception { final String tag = namespace.getString("tag"); final Integer count = namespace.getInt("count"); final Date date = namespace.get("date"); final boolean dryRun = namespace.getBoolean("dry-run") == null ? false : namespace.getBoolean("dry-run"); final String context = getContext(namespace); if (Stream.of(tag, count, date).filter(Objects::nonNull).count() != 1) { throw new IllegalArgumentException("Must specify either a count, a tag, or a date."); } if (count != null) { if (dryRun) { liquibase.rollback(count, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)); } else { liquibase.rollback(count, context); } } else if (tag != null) { if (dryRun) { liquibase.rollback(tag, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)); } else { liquibase.rollback(tag, context); } } else { if (dryRun) { liquibase.rollback(date, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)); } else { liquibase.rollback(date, context); } } }
@Override protected void run(Bootstrap<HelloWorldConfiguration> bootstrap, Namespace namespace, HelloWorldConfiguration configuration) throws Exception { final Template template = configuration.buildTemplate(); if (namespace.getBoolean("include-default")) { LOGGER.info("DEFAULT => {}", template.render(Optional.empty())); } for (String name : namespace.<String>getList("names")) { for (int i = 0; i < 1000; i++) { LOGGER.info("{} => {}", name, template.render(Optional.of(name))); Thread.sleep(1000); } } } }
public ItemSimilarityProcessor(final Namespace ns) { this.windowSecs = ns.getInt("window_secs"); this.windowProcessed = ns.getInt("window_processed"); this.outputTopic = ns.getString("output_topic"); this.kafkaServers = ns.getString("kafka"); System.out.println(ns); this.streamJaccard = new StreamingJaccardSimilarity(windowSecs, ns.getInt("hashes"), ns.getInt("min_activity")); //createOutputSimilaritiesTimer(ns); }
public LoggingConfig getLoggingConfig() { return new LoggingConfig(options.getInt(verboseArg.getDest()), options.getBoolean(syslogArg.getDest()), (File) options.get(logconfigArg.getDest()), options.getBoolean(noLogSetupArg.getDest())); }
public static void main(String... args) throws Exception { ArgumentParser parser = ArgumentParsers.newFor("SynthesizeFile").build() .defaultHelp(true) .description("Synthesize a text file or ssml file."); MutuallyExclusiveGroup group = parser.addMutuallyExclusiveGroup().required(true); group.addArgument("--text").help("The text file from which to synthesize speech."); group.addArgument("--ssml").help("The ssml file from which to synthesize speech."); try { Namespace namespace = parser.parseArgs(args); if (namespace.get("text") != null) { synthesizeTextFile(namespace.getString("text")); } else { synthesizeSsmlFile(namespace.getString("ssml")); } } catch (ArgumentParserException e) { parser.handleError(e); } } }
@Override int run(final Namespace options, final HeliosClient client, final PrintStream out, final boolean json, final BufferedReader stdin) throws ExecutionException, InterruptedException { final String name = options.getString(nameArg.getDest()); final boolean full = options.getBoolean(fullArg.getDest()); return run0(client, out, json, name, full); }
final List<File> configFiles = namespace.getList("config"); final String memberId = namespace.getString("member"); final Address address = namespace.get("address"); final String host = namespace.getString("host"); final String rack = namespace.getString("rack"); final String zone = namespace.getString("zone"); final List<NodeConfig> bootstrap = namespace.getList("bootstrap"); final boolean multicastEnabled = namespace.getBoolean("multicast"); final String multicastGroup = namespace.get("multicast_group"); final Integer multicastPort = namespace.get("multicast_port"); System.setProperty("atomix.data", namespace.getString("data_dir"));
final boolean json, final BufferedReader stdin) throws ExecutionException, InterruptedException { final String jobIdString = options.getString(jobArg.getDest()); final String hostPattern = options.getString(hostArg.getDest()); final boolean full = options.getBoolean(fullArg.getDest()); String domainsSwitchString = ""; final List<String> domains = options.get("domains"); if (domains.size() > 0) { domainsSwitchString = "-d " + Joiner.on(",").join(domains);
@Override @SuppressWarnings("UseOfSystemOutOrSystemErr") public void run(Namespace namespace, Liquibase liquibase) throws Exception { final String context = getContext(namespace); final Integer count = namespace.getInt("count"); final boolean dryRun = namespace.getBoolean("dry-run") == null ? false : namespace.getBoolean("dry-run"); if (count != null) { if (dryRun) { liquibase.update(count, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)); } else { liquibase.update(count, context); } } else { if (dryRun) { liquibase.update(context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)); } else { liquibase.update(context); } } }
props.put(ProduceServiceConfig.ZOOKEEPER_CONNECT_CONFIG, res.getString("zkConnect")); props.put(ProduceServiceConfig.BOOTSTRAP_SERVERS_CONFIG, res.getString("brokerList")); if (res.getString("producerClassName") != null) props.put(ProduceServiceConfig.PRODUCER_CLASS_CONFIG, res.getString("producerClassName")); if (res.getString("topic") != null) props.put(ProduceServiceConfig.TOPIC_CONFIG, res.getString("topic")); if (res.getString("producerId") != null) props.put(ProduceServiceConfig.PRODUCER_ID_CONFIG, res.getString("producerId")); if (res.getString("recordDelayMs") != null) props.put(ProduceServiceConfig.PRODUCE_RECORD_DELAY_MS_CONFIG, res.getString("recordDelayMs")); if (res.getString("recordSize") != null) props.put(ProduceServiceConfig.PRODUCE_RECORD_SIZE_BYTE_CONFIG, res.getString("recordSize")); if (res.getString("producerConfig") != null) props.put(ProduceServiceConfig.PRODUCER_PROPS_CONFIG, Utils.loadProps(res.getString("producerConfig"))); if (res.getString("consumerConfig") != null) props.put(ConsumeServiceConfig.CONSUMER_PROPS_CONFIG, Utils.loadProps(res.getString("consumerConfig"))); if (res.getString("consumerClassName") != null) props.put(ConsumeServiceConfig.CONSUMER_CLASS_CONFIG, res.getString("consumerClassName")); if (res.getString("latencyPercentileMaxMs") != null) props.put(ConsumeServiceConfig.LATENCY_PERCENTILE_MAX_MS_CONFIG, res.getString("latencyPercentileMaxMs")); if (res.getString("latencyPercentileGranularityMs") != null) props.put(ConsumeServiceConfig.LATENCY_PERCENTILE_GRANULARITY_MS_CONFIG, res.getString("latencyPercentileGranularityMs")); if (res.getBoolean("autoTopicCreationEnabled") != null) props.put(TopicManagementServiceConfig.TOPIC_CREATION_ENABLED_CONFIG, res.getBoolean("autoTopicCreationEnabled")); if (res.getInt("replicationFactor") != null) props.put(TopicManagementServiceConfig.TOPIC_REPLICATION_FACTOR_CONFIG, res.getInt("replicationFactor")); if (res.getInt("rebalanceMs") != null)
@Override public void run(Namespace namespace, Liquibase liquibase) throws Exception { final AbstractLiquibaseCommand<T> subcommand = requireNonNull(subcommands.get(namespace.getString(COMMAND_NAME_ATTR)), "Unable find the command"); subcommand.run(namespace, liquibase); } }
@Override protected int runWithJob(final Namespace options, final HeliosClient client, final PrintStream out, final boolean json, final Job job, final BufferedReader stdin) throws ExecutionException, InterruptedException, IOException { final JobId jobId = job.getId(); final List<String> hosts = options.getList(hostsArg.getDest()); final Deployment deployment = new Deployment.Builder() .setGoal(Goal.START) .setJobId(jobId) .build(); if (!json) { out.printf("Starting %s on %s%n", jobId, hosts); } return Utils.setGoalOnHosts(client, out, json, hosts, deployment, options.getString(tokenArg.getDest())); } }
if (isTrue(namespace.getBoolean("columns"))) { compareTypes.add(Column.class); if (isTrue(namespace.getBoolean("data"))) { compareTypes.add(Data.class); if (isTrue(namespace.getBoolean("foreign-keys"))) { compareTypes.add(ForeignKey.class); if (isTrue(namespace.getBoolean("indexes"))) { compareTypes.add(Index.class); if (isTrue(namespace.getBoolean("primary-keys"))) { compareTypes.add(PrimaryKey.class); if (isTrue(namespace.getBoolean("sequences"))) { compareTypes.add(Sequence.class); if (isTrue(namespace.getBoolean("tables"))) { compareTypes.add(Table.class); if (isTrue(namespace.getBoolean("unique-constraints"))) { compareTypes.add(UniqueConstraint.class); if (isTrue(namespace.getBoolean("views"))) { compareTypes.add(View.class); final String filename = namespace.getString("output"); if (filename != null) {
File getOutputFile() { return options.get("output_file"); } }
@Override public int handleCommand(final Namespace ns, final Manager m) { if (!m.isRegistered()) { System.err.println("User is not registered."); return 1; } if (ns.get("number") == null) { for (Map.Entry<String, List<JsonIdentityKeyStore.Identity>> keys : m.getIdentities().entrySet()) { for (JsonIdentityKeyStore.Identity id : keys.getValue()) { printIdentityFingerprint(m, keys.getKey(), id); } } } else { String number = ns.getString("number"); for (JsonIdentityKeyStore.Identity id : m.getIdentities(number)) { printIdentityFingerprint(m, number, id); } } return 0; } }
public boolean getZooKeeperEnableAcls() { return options.getBoolean(zooKeeperEnableAcls.getDest()); }
private String getContext(Namespace namespace) { final List<Object> contexts = namespace.getList("contexts"); if (contexts == null) { return ""; } return contexts.stream() .map(Object::toString) .collect(Collectors.joining(",")); } }
/** * * @param ns Namespace which contains parsed commandline arguments * @return true if the sort was successful, false if an error occurred */ @Override public boolean process( Namespace ns ) { File file = ns.get( "input" ); Object jsonObject = JoltCliUtilities.readJsonInput( file, SUPPRESS_OUTPUT ); if ( jsonObject == null ) { return false; } Sortr sortr = new Sortr(); Object output = sortr.transform( jsonObject ); Boolean uglyPrint = ns.getBoolean( "u" ); return JoltCliUtilities.printJsonObject( output, uglyPrint, SUPPRESS_OUTPUT ); }