diff options
author | 2019-03-27 13:22:51 -0400 | |
---|---|---|
committer | 2019-04-01 10:43:53 -0400 | |
commit | 40072d3dcc1d0193bba1ea9432c13ac24857be55 (patch) | |
tree | 2fe78015e772c4cbab4fd52184530b9e52c8c3af /ms/blueprintsprocessor/functions/netconf-executor/src/main | |
parent | 38300292cbce3bb0500593f3cc44fe129cf5c877 (diff) |
Improve function interfaces
Change-Id: I24f45d39ac05491a4217101e00bcbf8d122e4e1a
Issue-ID: CCSDK-1137
Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/functions/netconf-executor/src/main')
-rw-r--r-- | ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt index 2980de98a..663daf54e 100644 --- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt +++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt @@ -24,7 +24,6 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.Reso import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService import org.onap.ccsdk.cds.controllerblueprints.core.getAsString -import org.slf4j.LoggerFactory import org.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope import org.springframework.stereotype.Component @@ -34,18 +33,15 @@ import org.springframework.stereotype.Component open class ComponentNetconfExecutor(private var componentFunctionScriptingService: ComponentFunctionScriptingService) : AbstractComponentFunction() { - private val log = LoggerFactory.getLogger(ComponentNetconfExecutor::class.java) - companion object { const val SCRIPT_TYPE = "script-type" const val SCRIPT_CLASS_REFERENCE = "script-class-reference" const val INSTANCE_DEPENDENCIES = "instance-dependencies" } - lateinit var scriptComponent: NetconfComponentFunction - override fun process(executionRequest: ExecutionServiceInput) { + override suspend fun processNB(executionRequest: ExecutionServiceInput) { val scriptType = operationInputs.getAsString(SCRIPT_TYPE) val scriptClassReference = operationInputs.getAsString(SCRIPT_CLASS_REFERENCE) @@ -64,12 +60,13 @@ open class ComponentNetconfExecutor(private var componentFunctionScriptingServic checkNotNull(scriptComponent) { "failed to get netconf script component" } - scriptComponent.process(executionServiceInput) - } - - override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - scriptComponent.recover(runtimeException, executionRequest) + // Handles both script processing and error handling + scriptComponent.executeScript(executionServiceInput) } + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { + bluePrintRuntimeService.getBluePrintError() + .addError("Failed in ComponentNetconfExecutor : ${runtimeException.message}") + } }
\ No newline at end of file |