diff options
author | Dan Timoney <dtimoney@att.com> | 2018-10-05 19:06:33 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-10-05 19:06:33 +0000 |
commit | 701f863f4cc97c5e7073d17e32086ee6f32f7eab (patch) | |
tree | a8e79ad2d0a60aac47755df21813a4f78d4e37a1 /sli/provider/src/main/java/org/onap | |
parent | 86e489058f5a8f75f0b8fbcbd0a3eca2dbcb4470 (diff) | |
parent | c153dbc5e9583b79d67a20522b2a4664644df62c (diff) |
Merge "callnode handling updates"
Diffstat (limited to 'sli/provider/src/main/java/org/onap')
2 files changed, 18 insertions, 26 deletions
diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/CallNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/CallNodeExecutor.java index 6036c38a..c8e6548f 100644..100755 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/CallNodeExecutor.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/CallNodeExecutor.java @@ -118,16 +118,18 @@ public class CallNodeExecutor extends SvcLogicNodeExecutor { ctx.setAttribute("parentGraph", parentGraph); SvcLogicStore store = svc.getStore(); - - if (store != null) { + String errorMessage = "Parent " + parentGraph + " failed to call child [" + module + "," + rpc + "," + version + "," + mode + "] because the graph could not be found"; + boolean graphWasCalled = false; + if (store != null) { SvcLogicGraph calledGraph = store.fetch(module, rpc, version, mode); if (calledGraph != null) { LOG.debug("Parent " + parentGraph + " is calling child " + calledGraph.toString()); ctx.setAttribute("currentGraph", calledGraph.toString()); svc.execute(calledGraph, ctx); outValue = ctx.getStatus(); + graphWasCalled = true; } else { - LOG.debug("Parent " + parentGraph + " failed to call child [" + module + "," + rpc + "," + version + "," + mode + "] because the graph could not be found"); + LOG.debug(errorMessage); } } else { LOG.debug("Could not get SvcLogicStore reference"); @@ -152,7 +154,18 @@ public class CallNodeExecutor extends SvcLogicNodeExecutor { LOG.debug("no " + outValue + " or Other branch found"); } } - ctx.setAttribute("currentGraph", parentGraph); + + if (graphWasCalled == false) { + if (node.getOutcomeValue("catch") != null) { + nextNode = node.getOutcomeValue("catch"); + LOG.debug("graph could not be called, but catch node was found and will be executed"); + } else { + LOG.debug("graph could not be called and no catch node was found, throwing exception"); + throw new SvcLogicException(errorMessage); + } + } + + ctx.setAttribute("currentGraph", parentGraph); ctx.setAttribute("parentGraph", null); return (nextNode); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java index 0a286958..dd7139a7 100755 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java @@ -185,28 +185,7 @@ public class SvcLogicServiceImpl implements SvcLogicService { executor.getClass().getName()); return (executor.execute(this, node, ctx)); } else { - if (LOG.isDebugEnabled()) { - LOG.debug("{} node not implemented", node.getNodeType()); - } - SvcLogicNode nextNode = node.getOutcomeValue("failure"); - if (nextNode != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("about to execute failure branch"); - } - return (nextNode); - } - - nextNode = node.getOutcomeValue("Other"); - if (nextNode != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("about to execute Other branch"); - } - } else { - if (LOG.isDebugEnabled()) { - LOG.debug("no failure or Other branch found"); - } - } - return (nextNode); + throw new SvcLogicException("Attempted to execute a node of type " + node.getNodeType() + ", but no executor was registered for this type"); } } |