From 2a4848031776982dbefbde5b27442fd20c01d344 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Mon, 11 Mar 2019 16:34:55 -0400 Subject: Improve RA capability processor. Change-Id: I44a8157c9e2a27b49aa8af00a857ebc7b3e845c3 Issue-ID: CCSDK-1137 Signed-off-by: Muthuramalingam, Brinda Santh --- .../execution/ComponentFunctionScriptingService.kt | 22 ++++++++++------------ .../execution/scripts/BlueprintJythonService.kt | 5 +++-- 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'ms/blueprintsprocessor/modules/services') diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt index ecdd454e5..9bae4eb31 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt @@ -20,6 +20,7 @@ import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.scripts.Bluepr import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintScriptsService +import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext import org.slf4j.LoggerFactory import org.springframework.context.ApplicationContext @@ -34,19 +35,24 @@ class ComponentFunctionScriptingService(private val applicationContext: Applicat fun scriptInstance(componentFunction: AbstractComponentFunction, scriptType: String, scriptClassReference: String, - instanceDependencies: MutableList): T { + instanceDependencies: List): T { + log.info("creating component function of script type($scriptType), reference name($scriptClassReference) and " + "instanceDependencies($instanceDependencies)") val scriptComponent: T = scriptInstance(componentFunction.bluePrintRuntimeService.bluePrintContext(), scriptType, scriptClassReference) - populateScriptDependencies(scriptComponent, instanceDependencies) + // Populate Instance Properties + instanceDependencies.forEach { instanceDependency -> + componentFunction.functionDependencyInstances[instanceDependency] = applicationContext + .getBean(instanceDependency) + } return scriptComponent } - fun scriptInstance(bluePrintContext: BluePrintContext, scriptType: String, - scriptClassReference: String): T { + fun > scriptInstance(bluePrintContext: BluePrintContext, scriptType: String, + scriptClassReference: String): T { var scriptComponent: T? = null when (scriptType) { @@ -66,12 +72,4 @@ class ComponentFunctionScriptingService(private val applicationContext: Applicat return scriptComponent } - - private fun populateScriptDependencies(componentFunction: AbstractComponentFunction, - instanceDependencies: MutableList) { - instanceDependencies.forEach { instanceDependency -> - componentFunction.functionDependencyInstances[instanceDependency] = applicationContext - .getBean(instanceDependency) - } - } } \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt index 9c0390166..3937f27c3 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt @@ -22,6 +22,7 @@ import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractCompon import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmptyOrThrow import org.onap.ccsdk.apps.controllerblueprints.core.data.OperationAssignment +import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils import org.slf4j.Logger @@ -55,7 +56,7 @@ class BlueprintJythonService(val pythonExecutorProperty: PythonExecutorProperty, } fun jythonComponentInstance(bluePrintContext: BluePrintContext, scriptClassReference: String): - AbstractComponentFunction { + BlueprintFunctionNode<*, *> { val blueprintBasePath: String = bluePrintContext.rootPath val pythonFileName = bluePrintContext.rootPath @@ -74,7 +75,7 @@ class BlueprintJythonService(val pythonExecutorProperty: PythonExecutorProperty, val jythonInstances: MutableMap = hashMapOf() jythonInstances["log"] = LoggerFactory.getLogger(pythonClassName) - return jythonInstance(bluePrintContext, pythonClassName, + return jythonInstance>(bluePrintContext, pythonClassName, content, jythonInstances) } -- cgit 1.2.3-korg