Java Code Examples for org.springframework.boot.ApplicationArguments#getOptionValues()

The following examples show how to use org.springframework.boot.ApplicationArguments#getOptionValues() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheProcessor.java    From coolretailer with Apache License 2.0 6 votes vote down vote up
@NewSpan
public void run(ApplicationArguments args) throws Exception {
	if (args.containsOption("clear-cache")) {
		clearCache();
	}

	if (args.containsOption("process-cache")) {
		List<String> cacheOptions = args.getOptionValues("process-cache");
		if (cacheOptions.size() == 1) {
			processCache(cacheOptions.get(0));
		} else {
			processCache(null);
		}
		if (args.containsOption("exit")) {
			Runtime.getRuntime().halt(0);
		}
	}
}
 
Example 2
Source File: LoadGeneratorMain.java    From titus-control-plane with Apache License 2.0 6 votes vote down vote up
@Bean
@Named(API_ACCESS_CHANNEL)
public Channel getApiAccessChannel(@Named(GATEWAY_CHANNEL) Channel gatewayChannel,
                                   ApplicationArguments arguments) {
    List<String> federation = arguments.getOptionValues("federation");

    if (CollectionsExt.isNullOrEmpty(federation)) {
        return gatewayChannel;
    }

    return NettyChannelBuilder
            .forTarget(federation.get(0))
            .usePlaintext(true)
            .maxHeaderListSize(65536)
            .build();
}
 
Example 3
Source File: ComparisonToolArgs.java    From circus-train with Apache License 2.0 5 votes vote down vote up
private void validate(ApplicationArguments args) {
  List<String> optionValues = args.getOptionValues(OUTPUT_FILE);
  if (optionValues == null) {
    throw new IllegalArgumentException("Missing --" + OUTPUT_FILE + " argument");
  } else if (optionValues.isEmpty()) {
    throw new IllegalArgumentException("Missing --" + OUTPUT_FILE + " argument value");
  }
  outputFile = new File(optionValues.get(0));
}
 
Example 4
Source File: LoadGeneratorMain.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Bean
@Named(GATEWAY_CHANNEL)
public Channel getGatewayChannel(ApplicationArguments arguments) {
    List<String> gateway = arguments.getOptionValues("gateway");

    String gatewayAddress = CollectionsExt.isNullOrEmpty(gateway) ? "localhost:8091" : gateway.get(0);

    return NettyChannelBuilder
            .forTarget(gatewayAddress)
            .usePlaintext(true)
            .maxHeaderListSize(65536)
            .build();
}
 
Example 5
Source File: LoadGeneratorMain.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Bean
@Named(SimulatedRemoteInstanceCloudConnector.SIMULATED_CLOUD)
public Channel getSimulatedCloudChannel(ApplicationArguments arguments) {
    List<String> cloud = arguments.getOptionValues("cloud");

    String cloudAddress = CollectionsExt.isNullOrEmpty(cloud) ? "localhost:8093" : cloud.get(0);

    return NettyChannelBuilder
            .forTarget(cloudAddress)
            .usePlaintext(true)
            .maxHeaderListSize(65536)
            .build();
}
 
Example 6
Source File: CleanerRunner.java    From ogham with Apache License 2.0 5 votes vote down vote up
@Override
public void run(ApplicationArguments args) throws Exception {
	boolean override = args.getOptionValues("override")!=null;
	if(!override) {
		return;
	}
	Path parentFolder = Paths.get(args.getNonOptionArgs().get(0));
	log.info("Cleaning {}", parentFolder);
	Files.createDirectories(parentFolder);
	FileUtils.cleanDirectory(parentFolder.toFile());
}
 
Example 7
Source File: ProgramOptions.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
private static String getNamespace(ApplicationArguments args) {
    List<String> namespaces = args.getOptionValues(NAMESPACE);
    if (CollectionUtils.isEmpty(namespaces)) {
        return NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR;
    }
    String namespace = namespaces.get(0);
    if (StringUtils.isEmpty(namespace)) {
        return NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR;
    }
    return namespace;
}
 
Example 8
Source File: ProgramOptions.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
private static String getCompression(ApplicationArguments args) {
    List<String> compressions = args.getOptionValues(COMPRESSION);
    if (CollectionUtils.isEmpty(compressions)) {
        return Compression.Algorithm.NONE.getName();
    }
    String compression = compressions.get(0);
    if (StringUtils.isEmpty(compression)) {
        return Compression.Algorithm.NONE.getName();
    }
    return compression;
}
 
Example 9
Source File: GlobalVariables.java    From AuTe-Framework with Apache License 2.0 4 votes vote down vote up
GlobalVariables(ApplicationArguments args) {
    this.raw = args.getOptionValues(GLOBAL_VARIABLE_ARG_NAME);
}
 
Example 10
Source File: FileSourceVariables.java    From AuTe-Framework with Apache License 2.0 4 votes vote down vote up
FileSourceVariables(ApplicationArguments args) {
    final List<String> values = args.getOptionValues(FILE_SOURCE_VARIABLE_NAME);
    filePath = (values == null || values.size() != 1) ? NO_PATH : values.get(0);
}