/** * Parses a String comprised of 0 or more comma-delimited key=value pairs where each key * has the format: {@code app.[appname].[key]} or {@code deployer.[appname].[key]}. Values * may themselves contain commas, since the split points will be based upon the key * pattern. * <p> * Logic of parsing key/value pairs from a string is based on few rules and assumptions 1. * keys will not have commas or equals. 2. First raw split is done by commas which will * need to be fixed later if value is a comma-delimited list. * * @param s the string to parse * @return the Map of parsed key value pairs */ public static Map<String, String> parse(String s) { Map<String, String> deploymentProperties = new LinkedHashMap<>(); List<String> pairs = parseParamList(s, ","); // add what we got, addKeyValuePairAsProperty // handles rest as trimming, etc for (String pair : pairs) { addKeyValuePairAsProperty(pair, deploymentProperties); } return deploymentProperties; }
/** * Request the launching of an existing task definition. The name must be included in the * path. * * @param taskName the name of the existing task to be executed (required) * @param properties the runtime properties for the task, as a comma-delimited list of * key=value pairs * @param arguments the runtime commandline arguments * @return the taskExecutionId for the executed task */ @RequestMapping(value = "", method = RequestMethod.POST, params = "name") @ResponseStatus(HttpStatus.CREATED) public long launch(@RequestParam("name") String taskName, @RequestParam(required = false) String properties, @RequestParam(required = false) String arguments) { Map<String, String> propertiesToUse = DeploymentPropertiesUtils.parse(properties); List<String> argumentsToUse = DeploymentPropertiesUtils.parseParamList(arguments, " "); return this.taskExecutionService.executeTask(taskName, propertiesToUse, argumentsToUse); }
/** * Parses a String comprised of 0 or more comma-delimited key=value pairs where each key * has the format: {@code app.[appname].[key]} or {@code deployer.[appname].[key]}. Values * may themselves contain commas, since the split points will be based upon the key * pattern. * <p> * Logic of parsing key/value pairs from a string is based on few rules and assumptions 1. * keys will not have commas or equals. 2. First raw split is done by commas which will * need to be fixed later if value is a comma-delimited list. * * @param s the string to parse * @return the Map of parsed key value pairs */ public static Map<String, String> parse(String s) { Map<String, String> deploymentProperties = new LinkedHashMap<>(); List<String> pairs = parseParamList(s, ","); // add what we got, addKeyValuePairAsProperty // handles rest as trimming, etc for (String pair : pairs) { addKeyValuePairAsProperty(pair, deploymentProperties); } return deploymentProperties; }
/** * Request the launching of an existing task definition. The name must be included in * the path. * * @param taskName the name of the existing task to be executed (required) * @param properties the runtime properties for the task, as a comma-delimited list of * key=value pairs * @param arguments the runtime commandline arguments * @return the taskExecutionId for the executed task */ @RequestMapping(value = "", method = RequestMethod.POST, params = "name") @ResponseStatus(HttpStatus.CREATED) public long launch(@RequestParam("name") String taskName, @RequestParam(required = false) String properties, @RequestParam(required = false) String arguments) { Map<String, String> propertiesToUse = DeploymentPropertiesUtils.parse(properties); DeploymentPropertiesUtils.validateDeploymentProperties(propertiesToUse); List<String> argumentsToUse = DeploymentPropertiesUtils.parseParamList(arguments, " "); return this.taskService.executeTask(taskName, propertiesToUse, argumentsToUse); }