From 7f2452b38b0d69ce51888ec0aefc7ada4281e864 Mon Sep 17 00:00:00 2001 From: Kevin Smokowski Date: Fri, 9 Feb 2018 21:36:38 +0000 Subject: Reset MDC after invoking node collapse get node into a common metho, reset MDC right before getting next node for certain executor Change-Id: I85b1cf0dfd595deee42dc93f4095ecbc6c831998 Issue-ID: CCSDK-187 Signed-off-by: Kevin Smokowski --- .../sli/core/sli/provider/DeleteNodeExecutor.java | 96 +++++------- .../sli/core/sli/provider/ExecuteNodeExecutor.java | 22 +-- .../sli/core/sli/provider/ExistsNodeExecutor.java | 112 ++++++-------- .../core/sli/provider/GetResourceNodeExecutor.java | 163 ++++++++------------- .../core/sli/provider/IsAvailableNodeExecutor.java | 96 ++++-------- .../sli/core/sli/provider/NotifyNodeExecutor.java | 98 +++++-------- .../sli/core/sli/provider/RecordNodeExecutor.java | 125 ++++++---------- .../sli/core/sli/provider/ReleaseNodeExecutor.java | 95 +++++------- .../sli/core/sli/provider/ReserveNodeExecutor.java | 109 ++++++-------- .../sli/core/sli/provider/SaveNodeExecutor.java | 141 +++++++----------- .../core/sli/provider/SvcLogicNodeExecutor.java | 23 ++- .../sli/core/sli/provider/UpdateNodeExecutor.java | 131 +++++++---------- 12 files changed, 450 insertions(+), 761 deletions(-) (limited to 'sli/provider/src') diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/DeleteNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/DeleteNodeExecutor.java index 4eba29d5..a7c3c8e6 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/DeleteNodeExecutor.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/DeleteNodeExecutor.java @@ -30,72 +30,44 @@ import org.slf4j.LoggerFactory; public class DeleteNodeExecutor extends SvcLogicNodeExecutor { - private static final Logger LOG = LoggerFactory - .getLogger(DeleteNodeExecutor.class); - @Override - public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, - SvcLogicContext ctx) throws SvcLogicException { + private static final Logger LOG = LoggerFactory.getLogger(DeleteNodeExecutor.class); - String plugin = SvcLogicExpressionResolver.evaluate( - node.getAttribute("plugin"), node, ctx); - String resourceType = SvcLogicExpressionResolver.evaluate( - node.getAttribute("resource"), node, ctx); - String key = SvcLogicExpressionResolver.evaluateAsKey( - node.getAttribute("key"), node, ctx); + @Override + public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, SvcLogicContext ctx) + throws SvcLogicException { - String outValue = "failure"; + String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); + String resourceType = SvcLogicExpressionResolver.evaluate(node.getAttribute("resource"), node, ctx); + String key = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("key"), node, ctx); - if (LOG.isDebugEnabled()) { - LOG.debug("delete node encountered - looking for resource class " - + plugin); - } + String outValue = "failure"; + if (LOG.isDebugEnabled()) { + LOG.debug("delete node encountered - looking for resource class " + plugin); + } - SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); - if (resourcePlugin != null) { - - try { - - switch (resourcePlugin.delete(resourceType, key, ctx)) { - case SUCCESS: - outValue = "success"; - break; - case NOT_FOUND: - outValue = "not-found"; - break; - case FAILURE: - default: - outValue = "failure"; - } - } catch (SvcLogicException e) { - LOG.error("Caught exception from resource plugin", e); - outValue = "failure"; - } - } else { - LOG.warn("Could not find SvcLogicResource object for plugin " - + plugin); - } - - - SvcLogicNode nextNode = node.getOutcomeValue(outValue); - if (nextNode != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("about to execute " + outValue + " 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 "+outValue+" or Other branch found"); - } - } - return (nextNode); - } + SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); + if (resourcePlugin != null) { + try { + switch (resourcePlugin.delete(resourceType, key, ctx)) { + case SUCCESS: + outValue = "success"; + break; + case NOT_FOUND: + outValue = "not-found"; + break; + case FAILURE: + default: + outValue = "failure"; + } + } catch (SvcLogicException e) { + LOG.error("Caught exception from resource plugin", e); + outValue = "failure"; + } + } else { + LOG.warn("Could not find SvcLogicResource object for plugin " + plugin); + } + return (getNextNode(node, outValue)); + } } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExecuteNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExecuteNodeExecutor.java index eb06f66b..2da0241a 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExecuteNodeExecutor.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExecuteNodeExecutor.java @@ -118,26 +118,7 @@ public class ExecuteNodeExecutor extends SvcLogicNodeExecutor { } } - - SvcLogicNode nextNode = node.getOutcomeValue(outValue); - if (nextNode != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("about to execute " + outValue + " 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 " + outValue + " or Other branch found"); - } - } - return (nextNode); + return (getNextNode(node, outValue)); } protected String evaluate(SvcLogicExpression expr, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { @@ -152,7 +133,6 @@ public class ExecuteNodeExecutor extends SvcLogicNodeExecutor { } else { return "success"; } - } else { return "success"; } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExistsNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExistsNodeExecutor.java index 3a59a2d6..69b1132b 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExistsNodeExecutor.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExistsNodeExecutor.java @@ -30,76 +30,46 @@ import org.slf4j.LoggerFactory; public class ExistsNodeExecutor extends SvcLogicNodeExecutor { - private static final Logger LOG = LoggerFactory - .getLogger(ExistsNodeExecutor.class); - @Override - public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, - SvcLogicContext ctx) throws SvcLogicException { - - String plugin = SvcLogicExpressionResolver.evaluate( - node.getAttribute("plugin"), node, ctx); - String resourceType = SvcLogicExpressionResolver.evaluate( - node.getAttribute("resource"), node, ctx); - String key = SvcLogicExpressionResolver.evaluateAsKey( - node.getAttribute("key"), node, ctx); - String pfx = SvcLogicExpressionResolver.evaluate( - node.getAttribute("pfx"), node, ctx); - - String outValue = "failure"; - - if (LOG.isDebugEnabled()) { - LOG.debug("exists node encountered - looking for resource class " - + plugin); - } - - - - SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); - - if (resourcePlugin != null) { - - try { - - switch (resourcePlugin.exists(resourceType, key, pfx, ctx)) { - case SUCCESS: - outValue = "true"; - break; - case NOT_FOUND: - outValue = "false"; - break; - case FAILURE: - default: - outValue = "false"; - } - } catch (SvcLogicException e) { - LOG.error("Caught exception from resource plugin", e); - outValue = "failure"; - } - } else { - LOG.warn("Could not find SvcLogicResource object for plugin " - + plugin); - } - - SvcLogicNode nextNode = node.getOutcomeValue(outValue); - if (nextNode != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("about to execute " + outValue + " 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 "+outValue+" or Other branch found"); - } - } - return (nextNode); - } + private static final Logger LOG = LoggerFactory.getLogger(ExistsNodeExecutor.class); + + @Override + public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, SvcLogicContext ctx) + throws SvcLogicException { + + String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); + String resourceType = SvcLogicExpressionResolver.evaluate(node.getAttribute("resource"), node, ctx); + String key = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("key"), node, ctx); + String pfx = SvcLogicExpressionResolver.evaluate(node.getAttribute("pfx"), node, ctx); + + String outValue = "failure"; + + if (LOG.isDebugEnabled()) { + LOG.debug("exists node encountered - looking for resource class " + plugin); + } + + SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); + + if (resourcePlugin != null) { + try { + switch (resourcePlugin.exists(resourceType, key, pfx, ctx)) { + case SUCCESS: + outValue = "true"; + break; + case NOT_FOUND: + outValue = "false"; + break; + case FAILURE: + default: + outValue = "false"; + } + } catch (SvcLogicException e) { + LOG.error("Caught exception from resource plugin", e); + outValue = "failure"; + } + } else { + LOG.warn("Could not find SvcLogicResource object for plugin " + plugin); + } + return (getNextNode(node, outValue)); + } } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/GetResourceNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/GetResourceNodeExecutor.java index 82734af6..64cf5bc9 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/GetResourceNodeExecutor.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/GetResourceNodeExecutor.java @@ -31,104 +31,69 @@ import org.slf4j.LoggerFactory; public class GetResourceNodeExecutor extends SvcLogicNodeExecutor { - private static final Logger LOG = LoggerFactory - .getLogger(GetResourceNodeExecutor.class); - - public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, - SvcLogicContext ctx) throws SvcLogicException { - - String plugin = SvcLogicExpressionResolver.evaluate( - node.getAttribute("plugin"), node, ctx); - String resourceType = SvcLogicExpressionResolver.evaluate( - node.getAttribute("resource"), node, ctx); - String key = SvcLogicExpressionResolver.evaluateAsKey( - node.getAttribute("key"), node, ctx); - String pfx = SvcLogicExpressionResolver.evaluate( - node.getAttribute("pfx"), node, ctx); - - String localOnlyStr = SvcLogicExpressionResolver.evaluate( - node.getAttribute("local-only"), node, ctx); - - // Note: for get-resource, only refresh from A&AI if the DG explicitly set - // local-only to false. Otherwise, just read from local database. - boolean localOnly = true; - - if ("false".equalsIgnoreCase(localOnlyStr)) { - localOnly = false; - } - - SvcLogicExpression selectExpr = node.getAttribute("select"); - String select = null; - - if (selectExpr != null) { - select = SvcLogicExpressionResolver.evaluateAsKey(selectExpr, node, - ctx); - } - - SvcLogicExpression orderByExpr = node.getAttribute("order-by"); - String orderBy = null; - - if (orderByExpr != null) { - orderBy = SvcLogicExpressionResolver.evaluateAsKey(orderByExpr, node, - ctx); - } - - String outValue = "failure"; - - if (LOG.isDebugEnabled()) { - LOG.debug(node.getNodeType() - + " node encountered - looking for resource class " - + plugin); - } - - - SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); - - if (resourcePlugin != null) { - - try { - switch (resourcePlugin.query(resourceType, localOnly, select, key, - pfx, orderBy, ctx)) { - case SUCCESS: - outValue = "success"; - break; - case NOT_FOUND: - outValue = "not-found"; - break; - case FAILURE: - default: - outValue = "failure"; - } - } catch (SvcLogicException e) { - LOG.error("Caught exception from resource plugin", e); - outValue = "failure"; - } - } else { - LOG.warn("Could not find SvcLogicResource object for plugin " - + plugin); - } - - - SvcLogicNode nextNode = node.getOutcomeValue(outValue); - if (nextNode != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("about to execute " + outValue + " 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 "+outValue+" or Other branch found"); - } - } - return (nextNode); - } + private static final Logger LOG = LoggerFactory.getLogger(GetResourceNodeExecutor.class); + + public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, SvcLogicContext ctx) + throws SvcLogicException { + + String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); + String resourceType = SvcLogicExpressionResolver.evaluate(node.getAttribute("resource"), node, ctx); + String key = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("key"), node, ctx); + String pfx = SvcLogicExpressionResolver.evaluate(node.getAttribute("pfx"), node, ctx); + + String localOnlyStr = SvcLogicExpressionResolver.evaluate(node.getAttribute("local-only"), node, ctx); + + // Note: for get-resource, only refresh from A&AI if the DG explicitly set + // local-only to false. Otherwise, just read from local database. + boolean localOnly = true; + + if ("false".equalsIgnoreCase(localOnlyStr)) { + localOnly = false; + } + + SvcLogicExpression selectExpr = node.getAttribute("select"); + String select = null; + + if (selectExpr != null) { + select = SvcLogicExpressionResolver.evaluateAsKey(selectExpr, node, ctx); + } + + SvcLogicExpression orderByExpr = node.getAttribute("order-by"); + String orderBy = null; + + if (orderByExpr != null) { + orderBy = SvcLogicExpressionResolver.evaluateAsKey(orderByExpr, node, ctx); + } + + String outValue = "failure"; + + if (LOG.isDebugEnabled()) { + LOG.debug(node.getNodeType() + " node encountered - looking for resource class " + plugin); + } + + SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); + + if (resourcePlugin != null) { + try { + switch (resourcePlugin.query(resourceType, localOnly, select, key, pfx, orderBy, ctx)) { + case SUCCESS: + outValue = "success"; + break; + case NOT_FOUND: + outValue = "not-found"; + break; + case FAILURE: + default: + outValue = "failure"; + } + } catch (SvcLogicException e) { + LOG.error("Caught exception from resource plugin", e); + outValue = "failure"; + } + } else { + LOG.warn("Could not find SvcLogicResource object for plugin " + plugin); + } + return (getNextNode(node, outValue)); + } } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/IsAvailableNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/IsAvailableNodeExecutor.java index 2d8377cd..d2a4bfad 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/IsAvailableNodeExecutor.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/IsAvailableNodeExecutor.java @@ -30,74 +30,42 @@ import org.slf4j.LoggerFactory; public class IsAvailableNodeExecutor extends SvcLogicNodeExecutor { - private static final Logger LOG = LoggerFactory - .getLogger(IsAvailableNodeExecutor.class); - - @Override - public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, - SvcLogicContext ctx) throws SvcLogicException { + private static final Logger LOG = LoggerFactory.getLogger(IsAvailableNodeExecutor.class); - String plugin = SvcLogicExpressionResolver.evaluate( - node.getAttribute("plugin"), node, ctx); - String resourceType = SvcLogicExpressionResolver.evaluate( - node.getAttribute("resource"), node, ctx); - String key = SvcLogicExpressionResolver.evaluateAsKey( - node.getAttribute("key"), node, ctx); - String pfx = SvcLogicExpressionResolver.evaluate( - node.getAttribute("pfx"), node, ctx); + @Override + public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, SvcLogicContext ctx) + throws SvcLogicException { - String outValue = "failure"; + String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); + String resourceType = SvcLogicExpressionResolver.evaluate(node.getAttribute("resource"), node, ctx); + String key = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("key"), node, ctx); + String pfx = SvcLogicExpressionResolver.evaluate(node.getAttribute("pfx"), node, ctx); - if (LOG.isDebugEnabled()) { - LOG.debug("is-available node encountered - looking for resource class " - + plugin); - } + String outValue = "failure"; - SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); + SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); - - if (resourcePlugin != null) { - try { - switch (resourcePlugin.isAvailable(resourceType, key, pfx, ctx)) { - case SUCCESS: - outValue = "true"; - break; - case NOT_FOUND: - outValue = "false"; - break; - case FAILURE: - default: - outValue = "false"; - } - } catch (SvcLogicException e) { - LOG.error("Caught exception from resource plugin", e); - outValue = "failure"; - } - } else { - LOG.warn("Could not find SvcLogicResource object for plugin " - + plugin); - } - - SvcLogicNode nextNode = node.getOutcomeValue(outValue); - if (nextNode != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("about to execute " + outValue + " 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 "+outValue+" or Other branch found"); - } - } - return (nextNode); - } + if (resourcePlugin != null) { + try { + switch (resourcePlugin.isAvailable(resourceType, key, pfx, ctx)) { + case SUCCESS: + outValue = "true"; + break; + case NOT_FOUND: + outValue = "false"; + break; + case FAILURE: + default: + outValue = "false"; + } + } catch (SvcLogicException e) { + LOG.error("Caught exception from resource plugin", e); + outValue = "failure"; + } + } else { + LOG.warn("Could not find SvcLogicResource object for plugin " + plugin); + } + return (getNextNode(node, outValue)); + } } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/NotifyNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/NotifyNodeExecutor.java index ba8d9ba5..cfeab797 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/NotifyNodeExecutor.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/NotifyNodeExecutor.java @@ -30,73 +30,45 @@ import org.slf4j.LoggerFactory; public class NotifyNodeExecutor extends SvcLogicNodeExecutor { - private static final Logger LOG = LoggerFactory - .getLogger(NotifyNodeExecutor.class); - - @Override - public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, - SvcLogicContext ctx) throws SvcLogicException { + private static final Logger LOG = LoggerFactory.getLogger(NotifyNodeExecutor.class); - String plugin = SvcLogicExpressionResolver.evaluate( - node.getAttribute("plugin"), node, ctx); - String resourceType = SvcLogicExpressionResolver.evaluate( - node.getAttribute("resource"), node, ctx); - String action = SvcLogicExpressionResolver.evaluateAsKey( - node.getAttribute("action"), node, ctx); - String key = SvcLogicExpressionResolver.evaluateAsKey( - node.getAttribute("key"), node, ctx); + @Override + public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, SvcLogicContext ctx) + throws SvcLogicException { - String outValue = "failure"; + String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); + String resourceType = SvcLogicExpressionResolver.evaluate(node.getAttribute("resource"), node, ctx); + String action = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("action"), node, ctx); + String key = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("key"), node, ctx); - if (LOG.isDebugEnabled()) { - LOG.debug("release node encountered - looking for resource class " - + plugin); - } + String outValue = "failure"; - SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); - if (resourcePlugin != null) { - - try { - - switch (resourcePlugin.notify(resourceType, action, key, ctx)) { - case SUCCESS: - outValue = "success"; - break; - case NOT_FOUND: - outValue = "not-found"; - break; - case FAILURE: - default: - outValue = "failure"; - } - } catch (SvcLogicException e) { - LOG.error("Caught exception from resource plugin", e); - outValue = "failure"; - } - } else { - LOG.warn("Could not find SvcLogicResource object for plugin " - + plugin); - } + if (LOG.isDebugEnabled()) { + LOG.debug("release node encountered - looking for resource class " + plugin); + } - SvcLogicNode nextNode = node.getOutcomeValue(outValue); - if (nextNode != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("about to execute " + outValue + " 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 "+outValue+" or Other branch found"); - } - } - return (nextNode); - } + SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); + if (resourcePlugin != null) { + try { + switch (resourcePlugin.notify(resourceType, action, key, ctx)) { + case SUCCESS: + outValue = "success"; + break; + case NOT_FOUND: + outValue = "not-found"; + break; + case FAILURE: + default: + outValue = "failure"; + } + } catch (SvcLogicException e) { + LOG.error("Caught exception from resource plugin", e); + outValue = "failure"; + } + } else { + LOG.warn("Could not find SvcLogicResource object for plugin " + plugin); + } + return (getNextNode(node, outValue)); + } } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/RecordNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/RecordNodeExecutor.java index 9ed28d79..42e21535 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/RecordNodeExecutor.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/RecordNodeExecutor.java @@ -25,7 +25,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; - import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.onap.ccsdk.sli.core.sli.SvcLogicExpression; @@ -36,84 +35,48 @@ import org.slf4j.LoggerFactory; public class RecordNodeExecutor extends SvcLogicNodeExecutor { - private static final Logger LOG = LoggerFactory - .getLogger(RecordNodeExecutor.class); - - @Override - public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, - SvcLogicContext ctx) throws SvcLogicException { - - String plugin = SvcLogicExpressionResolver.evaluate( - node.getAttribute("plugin"), node, ctx); - String outValue = "failure"; - - if (LOG.isTraceEnabled()) { - LOG.trace(node.getNodeType() - + " node encountered - looking for recorder class " - + plugin); - } - - Map parmMap = new HashMap(); - - Set> parmSet = node - .getParameterSet(); - boolean hasParms = false; - - for (Iterator> iter = parmSet - .iterator(); iter.hasNext();) { - hasParms = true; - Map.Entry curEnt = iter.next(); - String curName = curEnt.getKey(); - SvcLogicExpression curExpr = curEnt.getValue(); - String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, - node, ctx); - - if (LOG.isTraceEnabled()) { - LOG.trace("executeRecordNode : parameter " + curName + " = " - + curExpr + " => " + curExprValue); - } - parmMap.put(curName, curExprValue); - } - - - SvcLogicRecorder recorder = getSvcLogicRecorder(plugin); - - if (recorder != null) { - - try { - recorder.record(parmMap); - } catch (SvcLogicException e) { - LOG.error("Caught exception from recorder plugin", e); - outValue = "failure"; - } - } else { - LOG.warn("Could not find SvcLogicRecorder object for plugin " - + plugin); - } - - SvcLogicNode nextNode = node.getOutcomeValue(outValue); - if (nextNode != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("about to execute " + outValue + " branch"); - } - return (nextNode); - } - - nextNode = node.getOutcomeValue("Other"); - if (nextNode != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("about to execute Other branch"); - } - } else { - if (LOG.isTraceEnabled()) { - LOG.trace("no failure or Other branch found"); - } - } - return (nextNode); - } - - - - - + private static final Logger LOG = LoggerFactory.getLogger(RecordNodeExecutor.class); + + @Override + public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, SvcLogicContext ctx) + throws SvcLogicException { + + String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); + String outValue = "failure"; + + if (LOG.isTraceEnabled()) { + LOG.trace(node.getNodeType() + " node encountered - looking for recorder class " + plugin); + } + + Map parmMap = new HashMap(); + + Set> parmSet = node.getParameterSet(); + boolean hasParms = false; + + for (Iterator> iter = parmSet.iterator(); iter.hasNext();) { + hasParms = true; + Map.Entry curEnt = iter.next(); + String curName = curEnt.getKey(); + SvcLogicExpression curExpr = curEnt.getValue(); + String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx); + + if (LOG.isTraceEnabled()) { + LOG.trace("executeRecordNode : parameter " + curName + " = " + curExpr + " => " + curExprValue); + } + parmMap.put(curName, curExprValue); + } + + SvcLogicRecorder recorder = getSvcLogicRecorder(plugin); + if (recorder != null) { + try { + recorder.record(parmMap); + } catch (SvcLogicException e) { + LOG.error("Caught exception from recorder plugin", e); + outValue = "failure"; + } + } else { + LOG.warn("Could not find SvcLogicRecorder object for plugin " + plugin); + } + return (getNextNode(node, outValue)); + } } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReleaseNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReleaseNodeExecutor.java index 58013cb8..c1ea9641 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReleaseNodeExecutor.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReleaseNodeExecutor.java @@ -30,71 +30,44 @@ import org.slf4j.LoggerFactory; public class ReleaseNodeExecutor extends SvcLogicNodeExecutor { - private static final Logger LOG = LoggerFactory - .getLogger(ReleaseNodeExecutor.class); - @Override - public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, - SvcLogicContext ctx) throws SvcLogicException { + private static final Logger LOG = LoggerFactory.getLogger(ReleaseNodeExecutor.class); - String plugin = SvcLogicExpressionResolver.evaluate( - node.getAttribute("plugin"), node, ctx); - String resourceType = SvcLogicExpressionResolver.evaluate( - node.getAttribute("resource"), node, ctx); - String key = SvcLogicExpressionResolver.evaluateAsKey( - node.getAttribute("key"), node, ctx); + @Override + public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, SvcLogicContext ctx) + throws SvcLogicException { - String outValue = "failure"; + String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); + String resourceType = SvcLogicExpressionResolver.evaluate(node.getAttribute("resource"), node, ctx); + String key = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("key"), node, ctx); - if (LOG.isDebugEnabled()) { - LOG.debug("release node encountered - looking for resource class " - + plugin); - } + String outValue = "failure"; - SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); - if (resourcePlugin != null) { - - try { - - switch (resourcePlugin.release(resourceType, key, ctx)) { - case SUCCESS: - outValue = "success"; - break; - case NOT_FOUND: - outValue = "not-found"; - break; - case FAILURE: - default: - outValue = "failure"; - } - } catch (SvcLogicException e) { - LOG.error("Caught exception from resource plugin", e); - outValue = "failure"; - } - } else { - LOG.warn("Could not find SvcLogicResource object for plugin " - + plugin); - } + if (LOG.isDebugEnabled()) { + LOG.debug("release node encountered - looking for resource class " + plugin); + } - SvcLogicNode nextNode = node.getOutcomeValue(outValue); - if (nextNode != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("about to execute " + outValue + " 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 "+outValue+" or Other branch found"); - } - } - return (nextNode); - } + SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); + if (resourcePlugin != null) { + try { + switch (resourcePlugin.release(resourceType, key, ctx)) { + case SUCCESS: + outValue = "success"; + break; + case NOT_FOUND: + outValue = "not-found"; + break; + case FAILURE: + default: + outValue = "failure"; + } + } catch (SvcLogicException e) { + LOG.error("Caught exception from resource plugin", e); + outValue = "failure"; + } + } else { + LOG.warn("Could not find SvcLogicResource object for plugin " + plugin); + } + return (getNextNode(node, outValue)); + } } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReserveNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReserveNodeExecutor.java index fc180a71..646650c6 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReserveNodeExecutor.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReserveNodeExecutor.java @@ -31,84 +31,57 @@ import org.slf4j.LoggerFactory; public class ReserveNodeExecutor extends SvcLogicNodeExecutor { - private static final Logger LOG = LoggerFactory - .getLogger(ReserveNodeExecutor.class); - - @Override - public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, - SvcLogicContext ctx) throws SvcLogicException { - - String plugin = SvcLogicExpressionResolver.evaluate( - node.getAttribute("plugin"), node, ctx); - String resourceType = SvcLogicExpressionResolver.evaluate( - node.getAttribute("resource"), node, ctx); - String key = SvcLogicExpressionResolver.evaluateAsKey( - node.getAttribute("key"), node, ctx); - String pfx = SvcLogicExpressionResolver.evaluate(node.getAttribute("pfx"),node,ctx); - - + private static final Logger LOG = LoggerFactory.getLogger(ReserveNodeExecutor.class); + + @Override + public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, SvcLogicContext ctx) + throws SvcLogicException { + + String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); + String resourceType = SvcLogicExpressionResolver.evaluate(node.getAttribute("resource"), node, ctx); + String key = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("key"), node, ctx); + String pfx = SvcLogicExpressionResolver.evaluate(node.getAttribute("pfx"), node, ctx); + + SvcLogicExpression selectExpr = node.getAttribute("select"); String select = null; - if (selectExpr != null) - { - select = SvcLogicExpressionResolver.evaluateAsKey(selectExpr, node, ctx); + if (selectExpr != null) { + select = SvcLogicExpressionResolver.evaluateAsKey(selectExpr, node, ctx); } - String outValue = "failure"; + String outValue = "failure"; - if (LOG.isDebugEnabled()) { - LOG.debug("reserve node encountered - looking for resource class " - + plugin); - } + if (LOG.isDebugEnabled()) { + LOG.debug("reserve node encountered - looking for resource class " + plugin); + } SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); - if (resourcePlugin != null) { - - try { - switch (resourcePlugin.reserve(resourceType, select, key, pfx, ctx)) { - case SUCCESS: - outValue = "success"; - break; - case NOT_FOUND: - outValue = "not-found"; - break; - case FAILURE: - default: - outValue = "failure"; - } - } catch (SvcLogicException e) { - LOG.error("Caught exception from resource plugin", e); - outValue = "failure"; - } - } else { - LOG.warn("Could not find SvcLogicResource object for plugin " - + plugin); - } - - SvcLogicNode nextNode = node.getOutcomeValue(outValue); - if (nextNode != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("about to execute " + outValue + " 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 "+outValue+" or Other branch found"); - } - } - return (nextNode); - } + if (resourcePlugin != null) { + + try { + switch (resourcePlugin.reserve(resourceType, select, key, pfx, ctx)) { + case SUCCESS: + outValue = "success"; + break; + case NOT_FOUND: + outValue = "not-found"; + break; + case FAILURE: + default: + outValue = "failure"; + } + } catch (SvcLogicException e) { + LOG.error("Caught exception from resource plugin", e); + outValue = "failure"; + } + } else { + LOG.warn("Could not find SvcLogicResource object for plugin " + plugin); + } + return (getNextNode(node, outValue)); + } } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SaveNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SaveNodeExecutor.java index 2df85ac8..d2b8b0a5 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SaveNodeExecutor.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SaveNodeExecutor.java @@ -25,7 +25,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; - import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.onap.ccsdk.sli.core.sli.SvcLogicExpression; @@ -36,107 +35,73 @@ import org.slf4j.LoggerFactory; public class SaveNodeExecutor extends SvcLogicNodeExecutor { - private static final Logger LOG = LoggerFactory - .getLogger(SaveNodeExecutor.class); + private static final Logger LOG = LoggerFactory.getLogger(SaveNodeExecutor.class); - @Override - public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, - SvcLogicContext ctx) throws SvcLogicException { + @Override + public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, SvcLogicContext ctx) + throws SvcLogicException { - String plugin = SvcLogicExpressionResolver.evaluate( - node.getAttribute("plugin"), node, ctx); - String resourceType = SvcLogicExpressionResolver.evaluate( - node.getAttribute("resource"), node, ctx); - String key = SvcLogicExpressionResolver.evaluateAsKey( - node.getAttribute("key"), node, ctx); - String forceStr = SvcLogicExpressionResolver.evaluate( - node.getAttribute("force"), node, ctx); - String localOnlyStr = SvcLogicExpressionResolver.evaluate( - node.getAttribute("local-only"), node, ctx); - String pfx = SvcLogicExpressionResolver.evaluate( - node.getAttribute("pfx"), node, ctx); + String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); + String resourceType = SvcLogicExpressionResolver.evaluate(node.getAttribute("resource"), node, ctx); + String key = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("key"), node, ctx); + String forceStr = SvcLogicExpressionResolver.evaluate(node.getAttribute("force"), node, ctx); + String localOnlyStr = SvcLogicExpressionResolver.evaluate(node.getAttribute("local-only"), node, ctx); + String pfx = SvcLogicExpressionResolver.evaluate(node.getAttribute("pfx"), node, ctx); - boolean force = "true".equalsIgnoreCase(forceStr); - boolean localOnly = "true".equalsIgnoreCase(localOnlyStr); + boolean force = "true".equalsIgnoreCase(forceStr); + boolean localOnly = "true".equalsIgnoreCase(localOnlyStr); - Map parmMap = new HashMap(); + Map parmMap = new HashMap(); - Set> parmSet = node - .getParameterSet(); - boolean hasParms = false; + Set> parmSet = node.getParameterSet(); + boolean hasParms = false; - for (Iterator> iter = parmSet - .iterator(); iter.hasNext();) { - hasParms = true; - Map.Entry curEnt = iter.next(); - String curName = curEnt.getKey(); - SvcLogicExpression curExpr = curEnt.getValue(); - if (curExpr != null) { - String curExprValue = SvcLogicExpressionResolver.evaluate( - curExpr, node, ctx); + for (Iterator> iter = parmSet.iterator(); iter.hasNext();) { + hasParms = true; + Map.Entry curEnt = iter.next(); + String curName = curEnt.getKey(); + SvcLogicExpression curExpr = curEnt.getValue(); + if (curExpr != null) { + String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx); - LOG.debug("Parameter " + curName + " = " - + curExpr.asParsedExpr() + " resolves to " - + curExprValue); + LOG.debug("Parameter " + curName + " = " + curExpr.asParsedExpr() + " resolves to " + curExprValue); - parmMap.put(curName, curExprValue); - } - } + parmMap.put(curName, curExprValue); + } + } - String outValue = "failure"; + String outValue = "failure"; - if (LOG.isDebugEnabled()) { - LOG.debug("save node encountered - looking for resource class " - + plugin); - } + if (LOG.isDebugEnabled()) { + LOG.debug("save node encountered - looking for resource class " + plugin); + } SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); - if (resourcePlugin != null) { - - try { - switch (resourcePlugin.save(resourceType, force, localOnly, key, - parmMap, pfx, ctx)) { - case SUCCESS: - outValue = "success"; - break; - case NOT_FOUND: - outValue = "not-found"; - break; - case FAILURE: - default: - outValue = "failure"; - } - } catch (SvcLogicException e) { - LOG.error("Caught exception from resource plugin", e); - outValue = "failure"; - } - } else { - LOG.warn("Could not find SvcLogicResource object for plugin " - + plugin); - } - - SvcLogicNode nextNode = node.getOutcomeValue(outValue); - if (nextNode != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("about to execute " + outValue + " 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 "+outValue+" or Other branch found"); - } - } - return (nextNode); - } + if (resourcePlugin != null) { + + try { + switch (resourcePlugin.save(resourceType, force, localOnly, key, parmMap, pfx, ctx)) { + case SUCCESS: + outValue = "success"; + break; + case NOT_FOUND: + outValue = "not-found"; + break; + case FAILURE: + default: + outValue = "failure"; + } + } catch (SvcLogicException e) { + LOG.error("Caught exception from resource plugin", e); + outValue = "failure"; + } + } else { + LOG.warn("Could not find SvcLogicResource object for plugin " + plugin); + } + return (getNextNode(node, outValue)); + } } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicNodeExecutor.java index 951536b5..0cfcfb91 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicNodeExecutor.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicNodeExecutor.java @@ -21,6 +21,7 @@ package org.onap.ccsdk.sli.core.sli.provider; +import org.onap.ccsdk.sli.core.sli.MetricLogger; import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -28,7 +29,6 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder; import org.onap.ccsdk.sli.core.sli.SvcLogicResource; -import org.onap.ccsdk.sli.core.sli.SvcLogicStore; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; import org.osgi.framework.ServiceReference; @@ -103,5 +103,26 @@ public abstract class SvcLogicNodeExecutor { return plugin; } } + protected SvcLogicNode getNextNode(SvcLogicNode node, String outValue) { + MetricLogger.resetContext(); + SvcLogicNode nextNode = node.getOutcomeValue(outValue); + if (nextNode != null) { + if (LOG.isDebugEnabled()) { + LOG.debug("about to execute " + outValue + " 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 " + outValue + " or Other branch found"); + } + } + return (nextNode); + } } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/UpdateNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/UpdateNodeExecutor.java index 9206b5d8..148745f6 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/UpdateNodeExecutor.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/UpdateNodeExecutor.java @@ -25,7 +25,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; - import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.onap.ccsdk.sli.core.sli.SvcLogicExpression; @@ -36,101 +35,69 @@ import org.slf4j.LoggerFactory; public class UpdateNodeExecutor extends SvcLogicNodeExecutor { - private static final Logger LOG = LoggerFactory - .getLogger(UpdateNodeExecutor.class); + private static final Logger LOG = LoggerFactory.getLogger(UpdateNodeExecutor.class); - @Override - public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, - SvcLogicContext ctx) throws SvcLogicException { + @Override + public SvcLogicNode execute(SvcLogicServiceImpl svc, SvcLogicNode node, SvcLogicContext ctx) + throws SvcLogicException { - String plugin = SvcLogicExpressionResolver.evaluate( - node.getAttribute("plugin"), node, ctx); - String resourceType = SvcLogicExpressionResolver.evaluate( - node.getAttribute("resource"), node, ctx); - String key = SvcLogicExpressionResolver.evaluateAsKey( - node.getAttribute("key"), node, ctx); - String pfx = SvcLogicExpressionResolver.evaluate( - node.getAttribute("pfx"), node, ctx); + String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); + String resourceType = SvcLogicExpressionResolver.evaluate(node.getAttribute("resource"), node, ctx); + String key = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("key"), node, ctx); + String pfx = SvcLogicExpressionResolver.evaluate(node.getAttribute("pfx"), node, ctx); - Map parmMap = new HashMap(); + Map parmMap = new HashMap(); - Set> parmSet = node - .getParameterSet(); - boolean hasParms = false; + Set> parmSet = node.getParameterSet(); + boolean hasParms = false; - for (Iterator> iter = parmSet - .iterator(); iter.hasNext();) { - hasParms = true; - Map.Entry curEnt = iter.next(); - String curName = curEnt.getKey(); - SvcLogicExpression curExpr = curEnt.getValue(); - if (curExpr != null) { - String curExprValue = SvcLogicExpressionResolver.evaluate( - curExpr, node, ctx); + for (Iterator> iter = parmSet.iterator(); iter.hasNext();) { + hasParms = true; + Map.Entry curEnt = iter.next(); + String curName = curEnt.getKey(); + SvcLogicExpression curExpr = curEnt.getValue(); + if (curExpr != null) { + String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx); - LOG.debug("Parameter " + curName + " = " - + curExpr.asParsedExpr() + " resolves to " - + curExprValue); + LOG.debug("Parameter " + curName + " = " + curExpr.asParsedExpr() + " resolves to " + curExprValue); - parmMap.put(curName, curExprValue); - } - } + parmMap.put(curName, curExprValue); + } + } - String outValue = "failure"; + String outValue = "failure"; - if (LOG.isDebugEnabled()) { - LOG.debug("save node encountered - looking for resource class " - + plugin); - } + if (LOG.isDebugEnabled()) { + LOG.debug("save node encountered - looking for resource class " + plugin); + } SvcLogicResource resourcePlugin = getSvcLogicResource(plugin); - if (resourcePlugin != null) { - - try { - switch (resourcePlugin.update(resourceType, key, - parmMap, pfx, ctx)) { - case SUCCESS: - outValue = "success"; - break; - case NOT_FOUND: - outValue = "not-found"; - break; - case FAILURE: - default: - outValue = "failure"; - } - } catch (SvcLogicException e) { - LOG.error("Caught exception from resource plugin", e); - outValue = "failure"; - } - } else { - LOG.warn("Could not find SvcLogicResource object for plugin " - + plugin); - } - - SvcLogicNode nextNode = node.getOutcomeValue(outValue); - if (nextNode != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("about to execute " + outValue + " 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 "+outValue+" or Other branch found"); - } - } - return (nextNode); - } + if (resourcePlugin != null) { + + try { + switch (resourcePlugin.update(resourceType, key, parmMap, pfx, ctx)) { + case SUCCESS: + outValue = "success"; + break; + case NOT_FOUND: + outValue = "not-found"; + break; + case FAILURE: + default: + outValue = "failure"; + } + } catch (SvcLogicException e) { + LOG.error("Caught exception from resource plugin", e); + outValue = "failure"; + } + } else { + LOG.warn("Could not find SvcLogicResource object for plugin " + plugin); + } + return (getNextNode(node, outValue)); + } } -- cgit 1.2.3-korg