refactor sli-provider 81/74081/7
authorSmokowski, Kevin (ks6305) <ks6305@us.att.com>
Fri, 30 Nov 2018 18:00:42 +0000 (18:00 +0000)
committerSmokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Mon, 3 Dec 2018 17:03:26 +0000 (17:03 +0000)
split sli-provider into sli-provider and sli-provider-base

Change-Id: I7b7edb767c04c9a6caf72a9172f49518655e33b7
Issue-ID: CCSDK-778
Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
58 files changed:
sli/pom.xml
sli/provider-base/pom.xml [new file with mode: 0644]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicNodeExecutor.java with 73% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/BlockNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/BlockNodeExecutor.java with 91% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/BreakNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/BreakNodeExecutor.java with 86% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/CallNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/CallNodeExecutor.java with 95% similarity, mode: 0644]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ConfigureNodeExecutor.java with 97% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/DeleteNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/DeleteNodeExecutor.java with 92% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExecuteNodeExecutor.java with 96% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExistsNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExistsNodeExecutor.java with 92% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExitNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExitNodeExecutor.java with 86% similarity, mode: 0644]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ForNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ForNodeExecutor.java with 95% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/GetResourceNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/GetResourceNodeExecutor.java with 94% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/IsAvailableNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/IsAvailableNodeExecutor.java with 92% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/NotifyNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/NotifyNodeExecutor.java with 92% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/RecordNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/RecordNodeExecutor.java with 93% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReleaseNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReleaseNodeExecutor.java with 92% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReserveNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReserveNodeExecutor.java with 93% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReturnNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReturnNodeExecutor.java with 92% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SaveNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SaveNodeExecutor.java with 95% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SetNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutor.java with 97% similarity, mode: 0644]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicExpressionResolver.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicExpressionResolver.java with 99% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicPropertiesProvider.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicPropertiesProvider.java with 95% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicResolver.java [new file with mode: 0644]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceBase.java [new file with mode: 0644]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java [new file with mode: 0644]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SwitchNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SwitchNodeExecutor.java with 90% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/UpdateNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/UpdateNodeExecutor.java with 94% similarity]
sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/WhileNodeExecutor.java [moved from sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/WhileNodeExecutor.java with 92% similarity]
sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/BadPlugin.java [moved from sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/BadPlugin.java with 97% similarity]
sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyAdaptor.java [moved from sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/DummyAdaptor.java with 96% similarity]
sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyRecorder.java [moved from sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/DummyRecorder.java with 85% similarity]
sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyResource.java [moved from sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/DummyResource.java with 98% similarity]
sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutorTest.java [moved from sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/ExecuteNodeExecutorTest.java with 80% similarity]
sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/LunchSelectorPlugin.java [moved from sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/LunchSelectorPlugin.java with 97% similarity]
sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/PluginTest.java [moved from sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PluginTest.java with 96% similarity]
sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/SetNodeExecutorTest.java [moved from sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutorTest.java with 98% similarity, mode: 0644]
sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicExpressionResolverTest.java [moved from sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicExpressionResolverTest.java with 96% similarity]
sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/VoidDummyPlugin.java [moved from sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/VoidDummyPlugin.java with 96% similarity]
sli/provider-base/src/test/resources/clearMultipleArrayValues.xml [moved from sli/provider/src/test/resources/clearMultipleArrayValues.xml with 100% similarity]
sli/provider-base/src/test/resources/clearNestedSubArrayValues.xml [moved from sli/provider/src/test/resources/clearNestedSubArrayValues.xml with 100% similarity]
sli/provider-base/src/test/resources/clearSingleArrayValues.xml [moved from sli/provider/src/test/resources/clearSingleArrayValues.xml with 100% similarity]
sli/provider-base/src/test/resources/clearSingleSubArrayValues.xml [moved from sli/provider/src/test/resources/clearSingleSubArrayValues.xml with 100% similarity]
sli/provider-base/src/test/resources/clearSubArrayValues.xml [moved from sli/provider/src/test/resources/clearSubArrayValues.xml with 100% similarity]
sli/provider-base/src/test/resources/clearValues.xml [moved from sli/provider/src/test/resources/clearValues.xml with 100% similarity]
sli/provider-base/src/test/resources/copyValues.xml [moved from sli/provider/src/test/resources/copyValues.xml with 100% similarity]
sli/provider-base/src/test/resources/expression.tests [moved from sli/provider/src/test/resources/expression.tests with 100% similarity, mode: 0644]
sli/provider-base/src/test/resources/simplelogger.properties [new file with mode: 0644]
sli/provider/pom.xml
sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactory.java
sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicClassResolver.java
sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicPropertiesProviderImpl.java
sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicService.java
sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java
sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/ITCaseSvcLogicGraphExecutor.java
sliPluginUtils/provider/testFileName [deleted file]
sliapi/provider/pom.xml
sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java

index 7b1fd9d..7060541 100755 (executable)
@@ -21,6 +21,7 @@
     </organization>
 
     <modules>
+        <module>provider-base</module>
         <module>model</module>
         <module>common</module>
         <module>provider</module>
diff --git a/sli/provider-base/pom.xml b/sli/provider-base/pom.xml
new file mode 100644 (file)
index 0000000..63cba83
--- /dev/null
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+
+       <parent>
+               <groupId>org.onap.ccsdk.parent</groupId>
+               <artifactId>binding-parent</artifactId>
+               <version>1.2.0-SNAPSHOT</version>
+               <relativePath />
+       </parent>
+
+       <groupId>org.onap.ccsdk.sli.core</groupId>
+       <artifactId>sli-provider-base</artifactId>
+       <version>0.4.0-SNAPSHOT</version>
+
+       <dependencyManagement>
+               <dependencies>
+                       <dependency>
+                               <groupId>org.onap.ccsdk.sli.core</groupId>
+                               <artifactId>dblib-provider</artifactId>
+                               <version>${project.version}</version>
+                       </dependency>
+               </dependencies>
+       </dependencyManagement>
+       
+       <dependencies>
+               <dependency>
+                       <groupId>org.onap.ccsdk.sli.core</groupId>
+                       <artifactId>sli-common</artifactId>
+                       <version>${project.version}</version>
+                       <scope>compile</scope>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.slf4j</groupId>
+                       <artifactId>slf4j-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>commons-lang</groupId>
+                       <artifactId>commons-lang</artifactId>
+                       <scope>compile</scope>
+               </dependency>
+
+               <!-- Testing Dependencies -->
+               <dependency>
+                       <groupId>junit</groupId>
+                       <artifactId>junit</artifactId>
+                       <scope>test</scope>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.mockito</groupId>
+                       <artifactId>mockito-core</artifactId>
+                       <scope>test</scope>
+               </dependency>
+
+       </dependencies>
+
+</project>
@@ -19,9 +19,8 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
-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;
@@ -32,11 +31,11 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public abstract class SvcLogicNodeExecutor {
+public abstract class AbstractSvcLogicNodeExecutor {
+       protected SvcLogicResolver resolver;
+       public abstract SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException;
 
-       public abstract SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException;
-
-    private static final Logger LOG = LoggerFactory.getLogger(SvcLogicNodeExecutor.class);
+       private static final Logger LOG = LoggerFactory.getLogger(AbstractSvcLogicNodeExecutor.class);
 
     protected String evaluateNodeTest(SvcLogicNode node, SvcLogicContext ctx)
                        throws SvcLogicException {
@@ -49,28 +48,27 @@ public abstract class SvcLogicNodeExecutor {
 
        }
 
+    public void setResolver(SvcLogicResolver resolver) {
+               this.resolver = resolver;
+       }
 
-
-    protected SvcLogicAdaptor getAdaptor(String adaptorName) {
-        return SvcLogicAdaptorFactory.getInstance(adaptorName);
+       protected SvcLogicAdaptor getAdaptor(String adaptorName) {
+       return resolver.getSvcLogicAdaptor(adaptorName);
     }
 
-    protected SvcLogicResource getSvcLogicResource(String plugin) {
-
-        return((SvcLogicResource) SvcLogicClassResolver.resolve(plugin));
+    protected SvcLogicResource getSvcLogicResource(String resourceName) {
+        return resolver.getSvcLogicResource(resourceName);
     }
 
-    protected SvcLogicRecorder getSvcLogicRecorder(String plugin) {
-        return((SvcLogicRecorder) SvcLogicClassResolver.resolve(plugin));
+    protected SvcLogicRecorder getSvcLogicRecorder(String recorderName) {
+        return resolver.getSvcLogicRecorder(recorderName);
     }
 
     protected SvcLogicJavaPlugin getSvcLogicJavaPlugin(String pluginName){
-        return((SvcLogicJavaPlugin) SvcLogicClassResolver.resolve(pluginName));
-
+        return resolver.getSvcLogicJavaPlugin(pluginName);
     }
 
     protected SvcLogicNode getNextNode(SvcLogicNode node, String outValue) {
-        MetricLogger.resetContext();
         SvcLogicNode nextNode = node.getOutcomeValue(outValue);
         if (nextNode != null) {
             if (LOG.isDebugEnabled()) {
@@ -91,4 +89,5 @@ public abstract class SvcLogicNodeExecutor {
         }
         return (nextNode);
     }
+    
 }
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
@@ -28,13 +28,13 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class BlockNodeExecutor extends SvcLogicNodeExecutor {
+public class BlockNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
        private static final Logger LOG = LoggerFactory
                        .getLogger(BlockNodeExecutor.class);
        
        @Override
-       public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx)
+       public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
                        throws SvcLogicException {
 
                SvcLogicExpression atomicExpr = node.getAttribute("atomic");
@@ -72,4 +72,5 @@ public class BlockNodeExecutor extends SvcLogicNodeExecutor {
        }
 
 
+
 }
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import org.onap.ccsdk.sli.core.sli.BreakNodeException;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
@@ -28,12 +28,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class BreakNodeExecutor extends SvcLogicNodeExecutor {
+public class BreakNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(BreakNodeExecutor.class);
 
     @Override
-    public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException {
+    public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException {
         String message = "BreakNodeExecutor encountered break with nodeId " + node.getNodeId();
         LOG.debug(message);
         throw new BreakNodeException(message);
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
@@ -30,13 +30,13 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicStore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class CallNodeExecutor extends SvcLogicNodeExecutor {
+public class CallNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
        private static final Logger LOG = LoggerFactory
                        .getLogger(CallNodeExecutor.class);
 
        @Override
-       public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx)
+       public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
                        throws SvcLogicException {
 
                String outValue = "not-found";
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import java.util.HashMap;
 import java.util.Iterator;
@@ -34,11 +34,11 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ConfigureNodeExecutor extends SvcLogicNodeExecutor {
+public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
        private static final Logger LOG = LoggerFactory
                        .getLogger(ConfigureNodeExecutor.class);
 
-       public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node,
+       public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node,
                        SvcLogicContext ctx) throws SvcLogicException {
 
                String adaptorName = SvcLogicExpressionResolver.evaluate(
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
@@ -28,13 +28,13 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class DeleteNodeExecutor extends SvcLogicNodeExecutor {
+public class DeleteNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(DeleteNodeExecutor.class);
     private static final String FAILURE="failure";
 
     @Override
-    public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx)
+    public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
             throws SvcLogicException {
 
         String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx);
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -36,12 +36,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ExecuteNodeExecutor extends SvcLogicNodeExecutor {
+public class ExecuteNodeExecutor extends AbstractSvcLogicNodeExecutor {
        private static final Logger LOG = LoggerFactory
                        .getLogger(ExecuteNodeExecutor.class);
 
        private static final String pluginErrorMessage = "Could not execute plugin. SvcLogic status will be set to failure.";
-       public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node,
+       public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node,
                        SvcLogicContext ctx) throws SvcLogicException {
 
                String pluginName = SvcLogicExpressionResolver.evaluate(
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
@@ -28,12 +28,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ExistsNodeExecutor extends SvcLogicNodeExecutor {
+public class ExistsNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(ExistsNodeExecutor.class);
 
     @Override
-    public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx)
+    public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
             throws SvcLogicException {
 
         String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx);
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import org.onap.ccsdk.sli.core.sli.ExitNodeException;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
@@ -28,12 +28,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ExitNodeExecutor extends SvcLogicNodeExecutor {
+public class ExitNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(ExitNodeExecutor.class);
 
     @Override
-    public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException {
+    public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException {
         String message = "ExitNodeExecutor encountered exit with nodeId " + node.getNodeId();
         LOG.debug(message);
         throw new ExitNodeException(message);
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import org.onap.ccsdk.sli.core.sli.BreakNodeException;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
@@ -29,13 +29,13 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ForNodeExecutor extends SvcLogicNodeExecutor {
+public class ForNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
        private static final Logger LOG = LoggerFactory
                        .getLogger(ForNodeExecutor.class);
 
        @Override
-       public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node,
+       public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node,
                        SvcLogicContext ctx) throws SvcLogicException {
 
                SvcLogicExpression atomicExpr = node.getAttribute("atomic");
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
@@ -29,11 +29,11 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class GetResourceNodeExecutor extends SvcLogicNodeExecutor {
+public class GetResourceNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(GetResourceNodeExecutor.class);
 
-    public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx)
+    public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
             throws SvcLogicException {
 
         String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx);
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
@@ -28,12 +28,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class IsAvailableNodeExecutor extends SvcLogicNodeExecutor {
+public class IsAvailableNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(IsAvailableNodeExecutor.class);
 
     @Override
-    public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx)
+    public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
             throws SvcLogicException {
 
         String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx);
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
@@ -28,12 +28,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class NotifyNodeExecutor extends SvcLogicNodeExecutor {
+public class NotifyNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(NotifyNodeExecutor.class);
 
     @Override
-    public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx)
+    public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
             throws SvcLogicException {
 
         String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx);
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import java.util.HashMap;
 import java.util.Iterator;
@@ -33,12 +33,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class RecordNodeExecutor extends SvcLogicNodeExecutor {
+public class RecordNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(RecordNodeExecutor.class);
 
     @Override
-    public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx)
+    public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
             throws SvcLogicException {
 
         String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx);
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
@@ -28,12 +28,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ReleaseNodeExecutor extends SvcLogicNodeExecutor {
+public class ReleaseNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(ReleaseNodeExecutor.class);
 
     @Override
-    public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx)
+    public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
             throws SvcLogicException {
 
         String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx);
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
@@ -29,12 +29,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ReserveNodeExecutor extends SvcLogicNodeExecutor {
+public class ReserveNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(ReserveNodeExecutor.class);
 
     @Override
-    public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx)
+    public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
             throws SvcLogicException {
 
         String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx);
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import java.util.Iterator;
 import java.util.Map;
@@ -32,13 +32,13 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ReturnNodeExecutor extends SvcLogicNodeExecutor {
+public class ReturnNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
        private static final Logger LOG = LoggerFactory
                        .getLogger(ReturnNodeExecutor.class);
        
        @Override
-       public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node,
+       public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node,
                        SvcLogicContext ctx) throws SvcLogicException {
 
                String status = SvcLogicExpressionResolver.evaluate(
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import java.util.HashMap;
 import java.util.Iterator;
@@ -33,12 +33,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class SaveNodeExecutor extends SvcLogicNodeExecutor {
+public class SaveNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(SaveNodeExecutor.class);
 
     @Override
-    public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx)
+    public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
             throws SvcLogicException {
 
         String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx);
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import java.util.HashMap;
 import java.util.Iterator;
@@ -34,13 +34,13 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class SetNodeExecutor extends SvcLogicNodeExecutor {
+public class SetNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(SetNodeExecutor.class);
     protected final String arrayPattern = "\\[\\d*\\]";
 
     @Override
-    public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx)
+    public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
             throws SvcLogicException {
         execute(node,ctx);
         return null;
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicResolver.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicResolver.java
new file mode 100644 (file)
index 0000000..08b6759
--- /dev/null
@@ -0,0 +1,17 @@
+package org.onap.ccsdk.sli.core.sli.provider.base;
+
+import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor;
+import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
+import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder;
+import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
+
+public interface SvcLogicResolver {
+    
+    abstract SvcLogicResource getSvcLogicResource(String resourceName);
+
+    abstract SvcLogicRecorder getSvcLogicRecorder(String recorderName);
+
+    abstract SvcLogicJavaPlugin getSvcLogicJavaPlugin(String pluginName);
+    
+    abstract SvcLogicAdaptor getSvcLogicAdaptor(String adaptorName);
+}
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceBase.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceBase.java
new file mode 100644 (file)
index 0000000..8c436fe
--- /dev/null
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ *                                             reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.sli.provider.base;
+
+import java.util.Properties;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
+import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
+import org.onap.ccsdk.sli.core.sli.SvcLogicStore;
+
+public interface SvcLogicServiceBase {
+
+
+    /**
+     * Check for existence of a directed graph
+     * @param module - module name
+     * @param rpc - rpc name
+     * @param version - version.  If null, looks for active version
+     * @param mode - mode (sync/async)
+     * @return true if directed graph found, false otherwise
+     * @throws SvcLogicException
+     */
+    boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException;
+
+    /**
+     *  Execute a directed graph
+     *
+     * @param module - module name
+     * @param rpc - rpc name
+     * @param version - version.  If null, use active version
+     * @param mode - mode (sync/async)
+     * @param parms - parameters, used to set SvcLogicContext attributes
+     * @return final values of attributes from SvcLogicContext, as Properties
+     * @throws SvcLogicException
+     *
+     *
+     */
+    Properties execute(String module, String rpc, String version, String mode, Properties parms) throws SvcLogicException;
+
+    SvcLogicStore getStore() throws SvcLogicException;
+
+    SvcLogicContext execute(SvcLogicGraph calledGraph, SvcLogicContext ctx) throws SvcLogicException;
+
+    SvcLogicNode executeNode(SvcLogicNode nextNode, SvcLogicContext ctx) throws SvcLogicException;
+
+}
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java
new file mode 100644 (file)
index 0000000..92fdb9a
--- /dev/null
@@ -0,0 +1,189 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ *                                             reserved.
+ * ================================================================================
+ *  Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.sli.provider.base;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+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.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
+import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
+import org.onap.ccsdk.sli.core.sli.SvcLogicStore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+
+public class SvcLogicServiceImplBase implements SvcLogicServiceBase {
+       protected SvcLogicResolver resolver;
+    protected static final Map<String, AbstractSvcLogicNodeExecutor> BUILTIN_NODES = new HashMap<String, AbstractSvcLogicNodeExecutor>() {
+        {
+            put("block", new BlockNodeExecutor());
+            put("call", new CallNodeExecutor());
+            put("configure", new ConfigureNodeExecutor());
+            put("delete", new DeleteNodeExecutor());
+            put("execute", new ExecuteNodeExecutor());
+            put("exists", new ExistsNodeExecutor());
+            put("for", new ForNodeExecutor());
+            put("get-resource", new GetResourceNodeExecutor());
+            put("is-available", new IsAvailableNodeExecutor());
+            put("notify", new NotifyNodeExecutor());
+            put("record", new RecordNodeExecutor());
+            put("release", new ReleaseNodeExecutor());
+            put("reserve", new ReserveNodeExecutor());
+            put("return", new ReturnNodeExecutor());
+            put("save", new SaveNodeExecutor());
+            put("set", new SetNodeExecutor());
+            put("switch", new SwitchNodeExecutor());
+            put("update", new UpdateNodeExecutor());
+            put("break", new BreakNodeExecutor());
+            put("while", new WhileNodeExecutor());
+            put("exit", new ExitNodeExecutor());
+        }
+    };
+
+    private static final Logger LOG = LoggerFactory.getLogger(SvcLogicServiceImplBase.class);
+    protected HashMap<String, AbstractSvcLogicNodeExecutor> nodeExecutors = null;
+    protected Properties properties;
+    protected SvcLogicStore store;
+    protected static final String CURRENT_GRAPH="currentGraph";
+
+    public SvcLogicServiceImplBase(SvcLogicStore store) {
+       this.store = store;
+    }
+
+    protected void registerExecutors() {
+
+        LOG.info("Entered register executors");
+        for (String nodeType : BUILTIN_NODES.keySet()) {
+            LOG.info("SLI - registering node executor for node type " + nodeType);
+            registerExecutor(nodeType, BUILTIN_NODES.get(nodeType));
+        }
+        LOG.info("Done registerExecutors");
+    }
+
+    public void registerExecutor(String nodeName, AbstractSvcLogicNodeExecutor executor) {
+        if (nodeExecutors == null) {
+            nodeExecutors = new HashMap<>();
+        }
+        LOG.info("SLI - registering executor for node type {}", nodeName);
+        executor.setResolver(resolver);
+        nodeExecutors.put(nodeName, executor);
+    }
+
+    public void unregisterExecutor(String nodeName) {
+        LOG.info("SLI - unregistering executor for node type {}", nodeName);
+        nodeExecutors.remove(nodeName);
+    }
+
+    public SvcLogicContext execute(SvcLogicGraph graph, SvcLogicContext ctx) throws SvcLogicException {
+        if (nodeExecutors == null) {
+            registerExecutors();
+        }
+
+        // Set service name in MDC to reference current working directed graph
+        MDC.put(MetricLogger.SERVICE_NAME, graph.getModule() + ":" + graph.getRpc() + "/v" + graph.getVersion());
+
+        MDC.put(CURRENT_GRAPH, graph.toString());
+
+        SvcLogicNode curNode = graph.getRootNode();
+        LOG.info("About to execute graph {}", graph.toString());
+               try {
+                       while (curNode != null) {
+                               resetContext();
+                               SvcLogicNode nextNode = executeNode(curNode, ctx);
+                               curNode = nextNode;
+                       }
+               } catch (ExitNodeException e) {
+            LOG.debug("SvcLogicServiceImpl caught ExitNodeException");
+               }
+        MDC.remove("nodeId");
+        MDC.remove(CURRENT_GRAPH);
+
+        return (ctx);
+    }
+
+    protected void resetContext() {
+       
+    }
+    
+       public SvcLogicNode executeNode(SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException {
+        if (node == null) {
+            return (null);
+        }
+
+               LOG.info("About to execute node # {} ({})", node.getNodeId(), node.getNodeType());
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Executing node " + node.getNodeId() + " of " + node.getGraph().getRpc());
+        }
+
+        AbstractSvcLogicNodeExecutor executor = nodeExecutors.get(node.getNodeType());
+
+        if (executor != null) {
+            LOG.debug("Executing node executor for node type {} - {}", node.getNodeType(),
+                    executor.getClass().getName());
+
+               MDC.put("nodeId", node.getNodeId() + " (" + node.getNodeType() + ")");
+            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");
+        }
+    }
+
+    @Override
+    public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException {
+        return (store.hasGraph(module, rpc, version, mode));
+    }
+
+    @Override
+       public Properties execute(String module, String rpc, String version, String mode, Properties props)
+                       throws SvcLogicException {
+               LOG.info("Fetching service logic from data store");
+               SvcLogicGraph graph = store.fetch(module, rpc, version, mode);
+
+               if (graph == null) {
+                       Properties retProps = new Properties();
+                       retProps.setProperty("error-code", "401");
+                       retProps.setProperty("error-message",
+                                       "No service logic found for [" + module + "," + rpc + "," + version + "," + mode + "]");
+                       return (retProps);
+               }
+
+               SvcLogicContext ctx = new SvcLogicContext(props);
+               ctx.setAttribute(CURRENT_GRAPH, graph.toString());
+               ctx.setAttribute("X-ECOMP-RequestID", MDC.get("X-ECOMP-RequestID"));
+               execute(graph, ctx);
+               return (ctx.toProperties());
+       }
+
+       @Override
+       public SvcLogicStore getStore() throws SvcLogicException {
+               return this.store;
+       }
+
+}
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
@@ -27,14 +27,14 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class SwitchNodeExecutor extends SvcLogicNodeExecutor {
+public class SwitchNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
        private static final Logger LOG = LoggerFactory
                        .getLogger(SwitchNodeExecutor.class);
        
        @Override
 
-       public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node,
+       public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node,
                        SvcLogicContext ctx) throws SvcLogicException {
 
 
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import java.util.HashMap;
 import java.util.Iterator;
@@ -33,12 +33,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class UpdateNodeExecutor extends SvcLogicNodeExecutor {
+public class UpdateNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(UpdateNodeExecutor.class);
 
     @Override
-    public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx)
+    public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
             throws SvcLogicException {
 
         String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx);
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import org.onap.ccsdk.sli.core.sli.BreakNodeException;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
@@ -29,12 +29,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class WhileNodeExecutor extends SvcLogicNodeExecutor {
+public class WhileNodeExecutor extends AbstractSvcLogicNodeExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(WhileNodeExecutor.class);
 
     @Override
-    public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException {
+    public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException {
 
         String testResult = evaluateNodeTest(node, ctx);
         SvcLogicExpression silentFailureExpr = node.getAttribute("do");
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import java.util.Map.Entry;
+import java.util.Properties;
 
 import org.onap.ccsdk.sli.core.sli.DuplicateValueException;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
@@ -30,8 +31,9 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
 import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
 import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
-import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.SvcLogicServiceImpl;
+import org.onap.ccsdk.sli.core.sli.provider.base.ExecuteNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicPropertiesProvider;
+import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceImplBase;
 
 import junit.framework.TestCase;
 
@@ -53,8 +55,15 @@ public class ExecuteNodeExecutorTest extends TestCase {
         MockExecuteNodeExecutor execute = new MockExecuteNodeExecutor();
         SvcLogicNode node = new SvcLogicNode(0, "", "", new SvcLogicGraph());
         node.setAttribute("method", "selectLunch");
-        SvcLogicPropertiesProvider resourceProvider = new SvcLogicPropertiesProviderImpl();
-        execute.execute(new SvcLogicServiceImpl(resourceProvider), new SvcLogicNode(0, "", "", new SvcLogicGraph()), new SvcLogicContext());
+        SvcLogicPropertiesProvider resourceProvider = new SvcLogicPropertiesProvider() {
+
+                       public Properties getProperties() {
+                               return new Properties();
+                       };
+        };
+        
+        
+        execute.execute(new SvcLogicServiceImplBase(null), new SvcLogicNode(0, "", "", new SvcLogicGraph()), new SvcLogicContext());
     }
 
 }
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import java.lang.reflect.Method;
 import java.util.HashMap;
@@ -29,8 +29,8 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
 import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
-import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.SvcLogicExpressionResolver;
+import org.onap.ccsdk.sli.core.sli.provider.base.ExecuteNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicExpressionResolver;
 
 import junit.framework.TestCase;
 
@@ -1,4 +1,4 @@
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
@@ -8,6 +8,7 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
 import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
 import org.onap.ccsdk.sli.core.sli.SvcLogicParser;
+import org.onap.ccsdk.sli.core.sli.provider.base.SetNodeExecutor;
 
 public class SetNodeExecutorTest {
     @Test
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.ccsdk.sli.core.sli.provider;
+package org.onap.ccsdk.sli.core.sli.provider.base;
 
 import java.io.BufferedReader;
 import java.io.InputStream;
@@ -31,7 +31,7 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
 import org.onap.ccsdk.sli.core.sli.SvcLogicExpressionFactory;
 import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
 import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
-import org.onap.ccsdk.sli.core.sli.provider.SvcLogicExpressionResolver;
+import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicExpressionResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/sli/provider-base/src/test/resources/simplelogger.properties b/sli/provider-base/src/test/resources/simplelogger.properties
new file mode 100644 (file)
index 0000000..07ab67f
--- /dev/null
@@ -0,0 +1,22 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : CCSDK
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights
+#                                              reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+org.slf4j.simpleLogger.defaultLogLevel=info
index 3bf931a..0a09028 100755 (executable)
                        <version>${project.version}</version>
                        <scope>compile</scope>
                </dependency>
-
+               <dependency>
+                       <groupId>org.onap.ccsdk.sli.core</groupId>
+                       <artifactId>sli-provider-base</artifactId>
+                       <version>${project.version}</version>
+                       <scope>compile</scope>
+               </dependency>
                <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
index ecfe6b6..540c04e 100644 (file)
@@ -24,9 +24,6 @@ package org.onap.ccsdk.sli.core.sli.provider;
 import java.util.HashMap;
 
 import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -56,7 +53,7 @@ public class SvcLogicAdaptorFactory {
             return adaptorMap.get(name);
         } else {
 
-            SvcLogicAdaptor adaptor = (SvcLogicAdaptor) SvcLogicClassResolver.resolve(name);
+            SvcLogicAdaptor adaptor = (SvcLogicAdaptor) SvcLogicClassResolver.getInstance().resolve(name);
 
             if (adaptor != null) {
                 registerAdaptor(adaptor);
index d2b733f..f10976a 100644 (file)
@@ -1,5 +1,10 @@
 package org.onap.ccsdk.sli.core.sli.provider;
 
+import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor;
+import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
+import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder;
+import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
+import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicResolver;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.FrameworkUtil;
@@ -7,35 +12,63 @@ import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class SvcLogicClassResolver {
-    private static final Logger LOG = LoggerFactory.getLogger(SvcLogicClassResolver.class);
+public class SvcLogicClassResolver implements SvcLogicResolver {
+       private static final Logger LOG = LoggerFactory.getLogger(SvcLogicClassResolver.class);
+       private static SvcLogicClassResolver instance = new SvcLogicClassResolver();
 
-    public static Object resolve(String className) {
+       private SvcLogicClassResolver() {
+       }
 
-        Bundle bundle = FrameworkUtil.getBundle(SvcLogicClassResolver.class);
+       public static SvcLogicClassResolver getInstance() {
+               return instance;
+       }
 
-        if (bundle == null) {
-            // Running outside OSGi container (e.g. jUnit).  Use Reflection
-            // to resolve class
-            try {
-                return(Class.forName(className).newInstance());
-            } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
+       public Object resolve(String className) {
 
-                LOG.error("Could not resolve class "+className, e);
-                return null;
-            }
+               Bundle bundle = FrameworkUtil.getBundle(SvcLogicClassResolver.class);
 
-        } else {
-            BundleContext bctx = bundle.getBundleContext();
-            ServiceReference sref = bctx.getServiceReference(className);
-            if (sref != null) {
-                return bctx.getService(sref);
-            } else {
+               if (bundle == null) {
+                       // Running outside OSGi container (e.g. jUnit). Use Reflection
+                       // to resolve class
+                       try {
+                               return (Class.forName(className).newInstance());
+                       } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
 
-                LOG.warn("Could not find service reference object for class " + className);
-                return null;
-            }
-        }
-    }
+                               LOG.error("Could not resolve class " + className, e);
+                               return null;
+                       }
+
+               } else {
+                       BundleContext bctx = bundle.getBundleContext();
+                       ServiceReference sref = bctx.getServiceReference(className);
+                       if (sref != null) {
+                               return bctx.getService(sref);
+                       } else {
+
+                               LOG.warn("Could not find service reference object for class " + className);
+                               return null;
+                       }
+               }
+       }
+
+       @Override
+       public SvcLogicResource getSvcLogicResource(String resourceName) {
+               return (SvcLogicResource) resolve(resourceName);
+       }
+
+       @Override
+       public SvcLogicRecorder getSvcLogicRecorder(String recorderName) {
+               return (SvcLogicRecorder) resolve(recorderName);
+       }
+
+       @Override
+       public SvcLogicJavaPlugin getSvcLogicJavaPlugin(String pluginName) {
+               return (SvcLogicJavaPlugin) resolve(pluginName);
+       }
+
+       @Override
+       public SvcLogicAdaptor getSvcLogicAdaptor(String adaptorName) {
+               return SvcLogicAdaptorFactory.getInstance(adaptorName);
+       }
 
 }
index a9992a0..c4680cc 100644 (file)
@@ -31,6 +31,7 @@ import java.util.Vector;
 
 import org.onap.ccsdk.sli.core.dblib.DblibConfigurationException;
 import org.onap.ccsdk.sli.core.sli.ConfigurationException;
+import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicPropertiesProvider;
 import org.onap.ccsdk.sli.core.utils.JREFileResolver;
 import org.onap.ccsdk.sli.core.utils.KarafRootFileResolver;
 import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver;
index 3f24adf..a23594e 100644 (file)
 package org.onap.ccsdk.sli.core.sli.provider;
 
 import java.util.Properties;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
-import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
-import org.onap.ccsdk.sli.core.sli.SvcLogicStore;
+import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceBase;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 
-public interface SvcLogicService {
+public interface SvcLogicService extends SvcLogicServiceBase {
 
     String NAME = "org.onap.ccsdk.sli.core.sli.provider.SvcLogicService";
 
-    // public SvcLogicContext execute(SvcLogicGraph graph, SvcLogicContext ctx) throws SvcLogicException;
-    /**
-     * Check for existence of a directed graph
-     * @param module - module name
-     * @param rpc - rpc name
-     * @param version - version.  If null, looks for active version
-     * @param mode - mode (sync/async)
-     * @return true if directed graph found, false otherwise
-     * @throws SvcLogicException
-     */
-    boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException;
-
-    /**
-     *  Execute a directed graph
-     *
-     * @param module - module name
-     * @param rpc - rpc name
-     * @param version - version.  If null, use active version
-     * @param mode - mode (sync/async)
-     * @param parms - parameters, used to set SvcLogicContext attributes
-     * @return final values of attributes from SvcLogicContext, as Properties
-     * @throws SvcLogicException
-     *
-     *
-     *  @deprecated use execute(String module, String rpc, String version, String mode, DOMDataBroker dataBroker) instead
-     */
     @Deprecated
     Properties execute(String module, String rpc, String version, String mode, Properties parms) throws SvcLogicException;
 
@@ -76,10 +48,5 @@ public interface SvcLogicService {
      */
     Properties execute(String module, String rpc, String version, String mode, Properties parms, DOMDataBroker domDataBroker) throws SvcLogicException;
 
-    SvcLogicStore getStore() throws SvcLogicException;
-
-    SvcLogicContext execute(SvcLogicGraph calledGraph, SvcLogicContext ctx) throws SvcLogicException;
-
-    SvcLogicNode executeNode(SvcLogicNode nextNode, SvcLogicContext ctx) throws SvcLogicException;
 
 }
index c794256..23d703c 100755 (executable)
 
 package org.onap.ccsdk.sli.core.sli.provider;
 
-import java.util.HashMap;
-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;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
 import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
-import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
 import org.onap.ccsdk.sli.core.sli.SvcLogicStore;
 import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory;
+import org.onap.ccsdk.sli.core.sli.provider.base.AbstractSvcLogicNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicPropertiesProvider;
+import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceImplBase;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -44,71 +44,32 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.MDC;
 
-public class SvcLogicServiceImpl implements SvcLogicService {
-
-    private static final Map<String, SvcLogicNodeExecutor> BUILTIN_NODES = new HashMap<String, SvcLogicNodeExecutor>() {
-        {
-            put("block", new BlockNodeExecutor());
-            put("call", new CallNodeExecutor());
-            put("configure", new ConfigureNodeExecutor());
-            put("delete", new DeleteNodeExecutor());
-            put("execute", new ExecuteNodeExecutor());
-            put("exists", new ExistsNodeExecutor());
-            put("for", new ForNodeExecutor());
-            put("get-resource", new GetResourceNodeExecutor());
-            put("is-available", new IsAvailableNodeExecutor());
-            put("notify", new NotifyNodeExecutor());
-            put("record", new RecordNodeExecutor());
-            put("release", new ReleaseNodeExecutor());
-            put("reserve", new ReserveNodeExecutor());
-            put("return", new ReturnNodeExecutor());
-            put("save", new SaveNodeExecutor());
-            put("set", new SetNodeExecutor());
-            put("switch", new SwitchNodeExecutor());
-            put("update", new UpdateNodeExecutor());
-            put("break", new BreakNodeExecutor());
-            put("while", new WhileNodeExecutor());
-            put("exit", new ExitNodeExecutor());
-        }
-    };
+public class SvcLogicServiceImpl extends SvcLogicServiceImplBase implements SvcLogicService  {
 
     private static final Logger LOG = LoggerFactory.getLogger(SvcLogicServiceImpl.class);
-    protected HashMap<String, SvcLogicNodeExecutor> nodeExecutors = null;
     protected BundleContext bctx = null;
-    protected Properties properties;
-    protected SvcLogicStore store;
-    private static final String CURRENT_GRAPH="currentGraph";
 
     public SvcLogicServiceImpl(SvcLogicPropertiesProvider resourceProvider) throws SvcLogicException {
+        super(null);
+        this.resolver = SvcLogicClassResolver.getInstance();
         properties = resourceProvider.getProperties();
-        getStore();
+        this.store = getStore();
     }
 
     public SvcLogicServiceImpl(SvcLogicPropertiesProvider resourceProvider, DbLibService dbSvc)
             throws SvcLogicException {
+        super(null);
+        this.resolver = SvcLogicClassResolver.getInstance();
         properties = resourceProvider.getProperties();
-        store = new SvcLogicDblibStore(dbSvc);
-    }
-
-
-    protected void registerExecutors() {
-
-        LOG.info("Entered register executors");
-        for (String nodeType : BUILTIN_NODES.keySet()) {
-            LOG.info("SLI - registering node executor for node type " + nodeType);
-            registerExecutor(nodeType, BUILTIN_NODES.get(nodeType));
-        }
-        LOG.info("Done registerExecutors");
+        this.store = new SvcLogicDblibStore(dbSvc);
     }
 
     public void registerExecutor(ServiceReference sr) {
         String nodeName = (String) sr.getProperty("nodeType");
         if (nodeName != null) {
-
-            SvcLogicNodeExecutor executor;
-
+            AbstractSvcLogicNodeExecutor executor;
             try {
-                executor = (SvcLogicNodeExecutor) bctx.getService(sr);
+                executor = (AbstractSvcLogicNodeExecutor) bctx.getService(sr);
             } catch (Exception e) {
                 LOG.error("Cannot get service executor for {}", nodeName, e);
                 return;
@@ -117,14 +78,6 @@ public class SvcLogicServiceImpl implements SvcLogicService {
         }
     }
 
-    public void registerExecutor(String nodeName, SvcLogicNodeExecutor executor) {
-        if (nodeExecutors == null) {
-            nodeExecutors = new HashMap<>();
-        }
-        LOG.info("SLI - registering executor for node type {}", nodeName);
-        nodeExecutors.put(nodeName, executor);
-    }
-
     public void unregisterExecutor(ServiceReference sr) {
         String nodeName = (String) sr.getProperty("nodeType");
 
@@ -133,67 +86,6 @@ public class SvcLogicServiceImpl implements SvcLogicService {
         }
     }
 
-    public void unregisterExecutor(String nodeName) {
-        LOG.info("SLI - unregistering executor for node type {}", nodeName);
-        nodeExecutors.remove(nodeName);
-    }
-
-    public SvcLogicContext execute(SvcLogicGraph graph, SvcLogicContext ctx) throws SvcLogicException {
-        if (nodeExecutors == null) {
-            registerExecutors();
-        }
-
-        // Set service name in MDC to reference current working directed graph
-        MDC.put(MetricLogger.SERVICE_NAME, graph.getModule() + ":" + graph.getRpc() + "/v" + graph.getVersion());
-
-        MDC.put(CURRENT_GRAPH, graph.toString());
-
-        SvcLogicNode curNode = graph.getRootNode();
-        LOG.info("About to execute graph {}", graph.toString());
-               try {
-                       while (curNode != null) {
-
-                               SvcLogicNode nextNode = executeNode(curNode, ctx);
-                               curNode = nextNode;
-                       }
-               } catch (ExitNodeException e) {
-            LOG.debug("SvcLogicServiceImpl caught ExitNodeException");
-               }
-        MDC.remove("nodeId");
-        MDC.remove(CURRENT_GRAPH);
-
-        return (ctx);
-    }
-
-    public SvcLogicNode executeNode(SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException {
-        if (node == null) {
-            return (null);
-        }
-
-               LOG.info("About to execute node # {} ({})", node.getNodeId(), node.getNodeType());
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Executing node " + node.getNodeId() + " of " + node.getGraph().getRpc());
-        }
-
-        SvcLogicNodeExecutor executor = nodeExecutors.get(node.getNodeType());
-
-        if (executor != null) {
-            LOG.debug("Executing node executor for node type {} - {}", node.getNodeType(),
-                    executor.getClass().getName());
-
-               MDC.put("nodeId", node.getNodeId() + " (" + node.getNodeType() + ")");
-            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");
-        }
-    }
-
-    @Override
-    public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException {
-        return (store.hasGraph(module, rpc, version, mode));
-    }
-
     @Override
     public Properties execute(String module, String rpc, String version, String mode, Properties props)
             throws SvcLogicException {
@@ -218,12 +110,16 @@ public class SvcLogicServiceImpl implements SvcLogicService {
         ctx.setAttribute(CURRENT_GRAPH, graph.toString());
         ctx.setAttribute("X-ECOMP-RequestID", MDC.get("X-ECOMP-RequestID"));
         ctx.setDomDataBroker(domDataBroker);
-
         execute(graph, ctx);
-
         return (ctx.toProperties());
     }
+    
+    @Override
+    protected void resetContext() {
+               MetricLogger.resetContext();
+       }
 
+    @Override
     public SvcLogicStore getStore() throws SvcLogicException {
         // Create and initialize SvcLogicStore object - used to access
         // saved service logic.
@@ -246,4 +142,5 @@ public class SvcLogicServiceImpl implements SvcLogicService {
 
         return store;
     }
+
 }
index 445df36..6d466bc 100644 (file)
@@ -24,7 +24,6 @@ package org.onap.ccsdk.sli.core.sli.provider;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
-
 import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -34,27 +33,46 @@ import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.Map;
 import java.util.Properties;
+
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
 import org.onap.ccsdk.sli.core.sli.SvcLogicParser;
 import org.onap.ccsdk.sli.core.sli.SvcLogicStore;
 import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceRegistration;
+import org.onap.ccsdk.sli.core.sli.provider.base.BlockNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.BreakNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.CallNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ConfigureNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.DeleteNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ExecuteNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ExistsNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ForNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.GetResourceNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.IsAvailableNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.NotifyNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.RecordNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ReleaseNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ReserveNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ReturnNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.SaveNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.SetNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.AbstractSvcLogicNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicPropertiesProvider;
+import org.onap.ccsdk.sli.core.sli.provider.base.SwitchNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.UpdateNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.WhileNodeExecutor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class ITCaseSvcLogicGraphExecutor {
 
     private static final Logger LOG = LoggerFactory.getLogger(SvcLogicGraph.class);
-    private static final Map<String, SvcLogicNodeExecutor> BUILTIN_NODES = new HashMap<String, SvcLogicNodeExecutor>() {
+    private static final Map<String, AbstractSvcLogicNodeExecutor> BUILTIN_NODES = new HashMap<String, AbstractSvcLogicNodeExecutor>() {
         {
             put("block", new BlockNodeExecutor());
             put("break", new BreakNodeExecutor());
diff --git a/sliPluginUtils/provider/testFileName b/sliPluginUtils/provider/testFileName
deleted file mode 100644 (file)
index 674e20c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#######################################
index e6ffaa9..efcf321 100755 (executable)
             <artifactId>sli-provider</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.onap.ccsdk.sli.core</groupId>
+            <artifactId>sli-provider-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal-core-api</artifactId>
index 287f2f2..96d6193 100644 (file)
@@ -25,28 +25,28 @@ import org.junit.Test;
 import org.onap.ccsdk.sli.core.sli.SvcLogicParser;
 import org.onap.ccsdk.sli.core.sli.SvcLogicStore;
 import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory;
-import org.onap.ccsdk.sli.core.sli.provider.BlockNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.CallNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.ConfigureNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.DeleteNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.ExistsNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.ForNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.GetResourceNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.IsAvailableNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.NotifyNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.RecordNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.ReleaseNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.ReserveNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.ReturnNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.SaveNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.SetNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.SvcLogicNodeExecutor;
 import org.onap.ccsdk.sli.core.sli.provider.SvcLogicPropertiesProviderImpl;
 import org.onap.ccsdk.sli.core.sli.provider.SvcLogicServiceImpl;
-import org.onap.ccsdk.sli.core.sli.provider.SwitchNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.UpdateNodeExecutor;
-import org.onap.ccsdk.sli.core.sli.provider.WhileNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.AbstractSvcLogicNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.BlockNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.CallNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ConfigureNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.DeleteNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ExecuteNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ExistsNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ForNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.GetResourceNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.IsAvailableNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.NotifyNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.RecordNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ReleaseNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ReserveNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ReturnNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.SaveNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.SetNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.SwitchNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.UpdateNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.WhileNodeExecutor;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
@@ -67,7 +67,7 @@ public class TestSliapiProvider {
 
     private static final String HEALTHCHECK_DG = "sli_healthcheck.xml";
 
-    private static final Map<String, SvcLogicNodeExecutor> BUILTIN_NODES = new HashMap<String, SvcLogicNodeExecutor>() {
+    private static final Map<String, AbstractSvcLogicNodeExecutor> BUILTIN_NODES = new HashMap<String, AbstractSvcLogicNodeExecutor>() {
         {
             put("block", new BlockNodeExecutor());
             put("call", new CallNodeExecutor());