Skip to content

Instantly share code, notes, and snippets.

@donovanmuller
Created October 25, 2016 07:12
Show Gist options
  • Save donovanmuller/6c03dfaeccd21cc6e95663ddda0eb6af to your computer and use it in GitHub Desktop.
Save donovanmuller/6c03dfaeccd21cc6e95663ddda0eb6af to your computer and use it in GitHub Desktop.
...
/**
* Builds the execution command for an application.
*
* @param request the request for the application to execute
* @return the build command as a string array
*/
private String[] buildExecutionCommand(AppDeploymentRequest request) {
ArrayList<String> commands = new ArrayList<String>();
commands.add(properties.getJavaCmd());
Map<String, String> deploymentProperties = request.getDeploymentProperties();
// Adds Java System Properties (ie -Dmy.prop=val) before main class or -jar
if (deploymentProperties.containsKey("JAVA_OPTS")) {
String[] javaOpts = StringUtils.tokenizeToStringArray(deploymentProperties.get("JAVA_OPTS"), ",");
commands.addAll(Arrays.asList(javaOpts));
}
// Below allows passing JAVA_OPTS via Data Flow
Map<String, String> appProperties = request.getDefinition().getProperties();
if (appProperties.containsKey("JAVA_OPTS")) {
String[] javaOpts = StringUtils.tokenizeToStringArray(appProperties.get("JAVA_OPTS"), ",");
commands.addAll(Arrays.asList(javaOpts));
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment