aboutsummaryrefslogtreecommitdiffstats
path: root/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java
diff options
context:
space:
mode:
authorSmokowski, Kevin (ks6305) <kevin.smokowski@att.com>2018-10-04 20:12:40 +0000
committerSmokowski, Kevin (ks6305) <kevin.smokowski@att.com>2018-10-04 20:12:40 +0000
commit86e489058f5a8f75f0b8fbcbd0a3eca2dbcb4470 (patch)
tree0810ee935852d90b3ad7f26da1910e3c61fd0726 /sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java
parenta68b1d51bdb4b5fb8575b7029b86d2d1abbfdace (diff)
implement exit node
exit node functions similar to a return statement in most programming languages Change-Id: I2991590fb700b03a9f3d72ae0bc7b5dd9bb25f74 Issue-ID: CCSDK-611 Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Diffstat (limited to 'sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java')
-rwxr-xr-xsli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java45
1 files changed, 35 insertions, 10 deletions
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 000c2872..0a286958 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
@@ -26,6 +26,7 @@ import java.util.Map;
import java.util.Properties;
import org.onap.ccsdk.sli.core.dblib.DbLibService;
import org.onap.ccsdk.sli.core.sli.ConfigurationException;
+import org.onap.ccsdk.sli.core.sli.ExitNodeException;
import org.onap.ccsdk.sli.core.sli.MetricLogger;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicDblibStore;
@@ -70,7 +71,7 @@ public class SvcLogicServiceImpl implements SvcLogicService {
put("update", new UpdateNodeExecutor());
put("break", new BreakNodeExecutor());
put("while", new WhileNodeExecutor());
-
+ put("exit", new ExitNodeExecutor());
}
};
@@ -151,14 +152,17 @@ public class SvcLogicServiceImpl implements SvcLogicService {
SvcLogicNode curNode = graph.getRootNode();
LOG.info("About to execute graph {}", graph.toString());
-
- while (curNode != null) {
- MDC.put("nodeId", curNode.getNodeId() + " (" + curNode.getNodeType() + ")");
- LOG.info("About to execute node # {} ({})", curNode.getNodeId(), curNode.getNodeType());
-
- SvcLogicNode nextNode = executeNode(curNode, ctx);
- curNode = nextNode;
- }
+ try {
+ while (curNode != null) {
+ MDC.put("nodeId", curNode.getNodeId() + " (" + curNode.getNodeType() + ")");
+ LOG.info("About to execute node # {} ({})", curNode.getNodeId(), curNode.getNodeType());
+
+ SvcLogicNode nextNode = executeNode(curNode, ctx);
+ curNode = nextNode;
+ }
+ } catch (ExitNodeException e) {
+ LOG.debug("SvcLogicServiceImpl caught ExitNodeException");
+ }
MDC.remove("nodeId");
MDC.remove("currentGraph");
@@ -181,7 +185,28 @@ public class SvcLogicServiceImpl implements SvcLogicService {
executor.getClass().getName());
return (executor.execute(this, node, ctx));
} else {
- throw new SvcLogicException("Attempted to execute a node of type " + node.getNodeType() + ", but no executor was registered for this type");
+ 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);
}
}