diff options
author | Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com> | 2019-03-13 10:56:28 -0400 |
---|---|---|
committer | Brinda Santh Muthuramalingam <brindasanth@in.ibm.com> | 2019-03-13 21:16:15 +0000 |
commit | abdc4a1f59294b8435a4af3738b415fe348967ab (patch) | |
tree | d8e990b6cb4039ad7b5af9a9cac313fb0a7a1e4f /ms/blueprintsprocessor/modules/services/execution-service/src | |
parent | 2a4848031776982dbefbde5b27442fd20c01d344 (diff) |
Add node template workflow service.
Change-Id: I3a9167fe58b697f8fb9c7f5fd09768950afe1ff4
Issue-ID: CCSDK-1154
Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/services/execution-service/src')
-rw-r--r-- | ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt index a67e006a6..f2b6e3ff5 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt @@ -26,11 +26,10 @@ import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status import org.onap.ccsdk.apps.controllerblueprints.common.api.EventType
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode
+import org.onap.ccsdk.apps.controllerblueprints.core.asObjectNode
import org.onap.ccsdk.apps.controllerblueprints.core.getAsString
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
/**
@@ -51,8 +50,11 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic lateinit var operationName: String
lateinit var nodeTemplateName: String
var operationInputs: MutableMap<String, JsonNode> = hashMapOf()
+
+ //FIXME("Move to Script abstract class")
/**
- * Store Dynamic Dependency Instances
+ * Store Dynamic Script Dependency Instances, Objects present inside won't be persisted or state maintained.
+ * Later it will be moved to ScriptComponentFunction class, sub class for abstract class
*/
var functionDependencyInstances: MutableMap<String, Any> = hashMapOf()
@@ -91,7 +93,8 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic operationName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_OPERATION)
check(operationName.isNotEmpty()) { "couldn't get Operation name for step($stepName)" }
- val operationResolvedProperties = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
+ val operationResolvedProperties = bluePrintRuntimeService
+ .resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
this.operationInputs.putAll(operationResolvedProperties)
@@ -103,15 +106,16 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic executionServiceOutput.commonHeader = executionServiceInput.commonHeader
executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers
-
// Resolve the Output Expression
val stepOutputs = bluePrintRuntimeService
.resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
- bluePrintRuntimeService.put("$stepName-step-outputs", stepOutputs.asJsonNode())
+ // FIXME("Not the right place to populate the response payload")
+ executionServiceOutput.payload = stepOutputs.asObjectNode()
- executionServiceOutput.payload = JacksonUtils.objectNodeFromObject(stepOutputs)
+ bluePrintRuntimeService.put("$stepName-step-outputs", executionServiceOutput.payload)
+ // FIXME("Not the right place to populate the status")
// Populate Status
val status = Status()
status.eventType = EventType.EVENT_COMPONENT_EXECUTED.name
@@ -122,8 +126,12 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic }
override fun apply(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
- prepareRequest(executionServiceInput)
- process(executionServiceInput)
+ try {
+ prepareRequest(executionServiceInput)
+ process(executionServiceInput)
+ } catch (runtimeException: RuntimeException) {
+ recover(runtimeException, executionServiceInput)
+ }
return prepareResponse()
}
@@ -136,6 +144,7 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName, key, value)
}
+ //FIXME("Move to Script abstract class")
/**
* This will be called from the scripts to serve instance from runtime to scripts.
*/
|