Skip to content

Commit 1d605af

Browse files
committed
Add additional logging
1 parent 0e0042f commit 1d605af

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

org.opentosca.bus/org.opentosca.bus.management.invocation.plugin.script/src/main/java/org/opentosca/bus/management/invocation/plugin/script/ManagementBusInvocationPluginScript.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,17 @@ private TNodeTemplate getNodeTemplate(Message message, Csar csar, TRelationshipT
290290
* @param operation The script service operation to check
291291
*/
292292
private void addOutputParametersToResultMap(final Map<String, String> resultMap, final Object result, final TOperation operation) throws UnsupportedEncodingException {
293+
LOG.debug("Checking if operation has output parameters to update: {}", operation.getName());
293294
final boolean hasOutputParams = operation.getOutputParameters() != null;
294295
if (!hasOutputParams) {
296+
LOG.debug("No output parameters defined!");
295297
return;
296298
}
299+
LOG.debug("Adding output parameters to the response message.");
297300
if (!(result instanceof HashMap<?, ?>)) {
298301
LOG.warn("Result of type {} not supported. The bus should return a HashMap as result class when it is used as input.", result.getClass());
299302
return;
300303
}
301-
LOG.debug("Adding output parameters to the response message.");
302304
final Map<?, ?> resultHashMap = (HashMap<?, ?>) result;
303305

304306
// get ScriptResult part of the response which contains the parameters
@@ -317,11 +319,15 @@ private void addOutputParametersToResultMap(final Map<String, String> resultMap,
317319
// split result in line breaks as every parameter is returned in a separate "echo" command
318320
final String[] resultParameters = scriptResultString.split("[\\r\\n]+");
319321

322+
LOG.debug("Searching for {} output parameters...", operation.getOutputParameters().size());
320323
// add each parameter that is defined in the operation and passed back
321324
for (final TParameter outputParameter : operation.getOutputParameters()) {
325+
LOG.debug("Searching for output parameter: {}", outputParameter.getName());
322326
// we expect the outputparameters at the end of the result in multiple lines
327+
LOG.debug("Found {} lines in script result...", resultParameters.length);
323328
for (int i = resultParameters.length - 1; i >= 0; i--) {
324329
if (resultParameters[i].startsWith(outputParameter.getName())) {
330+
LOG.debug("Found parameter with given name: {}", outputParameter.getName());
325331
final String value = resultParameters[i].substring(resultParameters[i].indexOf("=") + 1);
326332

327333
LOG.debug("Adding parameter {} with value: {}", outputParameter, value);

0 commit comments

Comments
 (0)