Skip to content

Commit

Permalink
Merge pull request #2910 from nadment/2000Z
Browse files Browse the repository at this point in the history
 Cleanup XML of action Wait for SQL #2000
  • Loading branch information
hansva authored May 17, 2023
2 parents 50ca58f + af135c5 commit 0967272
Show file tree
Hide file tree
Showing 6 changed files with 382 additions and 408 deletions.
42 changes: 22 additions & 20 deletions engine/src/main/java/org/apache/hop/run/HopRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public class HopRun implements Runnable, IHasHopMetadataProvider {
@Option(
names = {"-p", "--parameters"},
description = "A list of PARAMETER=VALUE pairs")
private String parameters = null;
private String[] parameters = null;

@Option(
names = {"-ps", "--parameters-separator"},
Expand Down Expand Up @@ -483,25 +483,27 @@ private void parseParametersAndVariables(
if (parameters != null) {
parametersSeparator = parametersSeparator == null ? "," : parametersSeparator;

for (String parameter : parameters.split(parametersSeparator)) {
String[] split = parameter.split("=", 2);
String key = split.length > 0 ? split[0] : null;
String value = split.length > 1 ? split[1] : null;
if (value != null && value.startsWith("\"") && value.endsWith("\"")) {
value = value.substring(1, value.length() - 1);
}
for (String parameter : parameters) {
for(String singleParameter : parameter.split(parametersSeparator)){
String[] split = singleParameter.split("=", 2);
String key = split.length > 0 ? split[0] : null;
String value = split.length > 1 ? split[1] : null;
if (value != null && value.startsWith("\"") && value.endsWith("\"")) {
value = value.substring(1, value.length() - 1);
}

if (key != null) {
// We can work with this.
//
if (Const.indexOfString(key, availableParameters) < 0) {
// A variable
//
configuration.getVariablesMap().put(key, value);
} else {
// A parameter
if (key != null) {
// We can work with this.
//
configuration.getParametersMap().put(key, value);
if (Const.indexOfString(key, availableParameters) < 0) {
// A variable
//
configuration.getVariablesMap().put(key, value);
} else {
// A parameter
//
configuration.getParametersMap().put(key, value);
}
}
}
}
Expand Down Expand Up @@ -674,14 +676,14 @@ public void setHelpRequested(boolean helpRequested) {
*
* @return value of parameters
*/
public String getParameters() {
public String[] getParameters() {
return parameters;
}

/**
* @param parameters The parameters to set
*/
public void setParameters(String parameters) {
public void setParameters(String[] parameters) {
this.parameters = parameters;
}

Expand Down
Loading

0 comments on commit 0967272

Please sign in to comment.