diff options
Diffstat (limited to 'ms/blueprintsprocessor/modules/services/execution-service/src')
2 files changed, 13 insertions, 14 deletions
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 <T : AbstractComponentFunction> scriptInstance(componentFunction: AbstractComponentFunction, scriptType: String, scriptClassReference: String, - instanceDependencies: MutableList<String>): T { + instanceDependencies: List<String>): 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 <T : AbstractComponentFunction> scriptInstance(bluePrintContext: BluePrintContext, scriptType: String, - scriptClassReference: String): T { + fun <T : BlueprintFunctionNode<*, *>> 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<String>) { - 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<String, Any> = hashMapOf() jythonInstances["log"] = LoggerFactory.getLogger(pythonClassName) - return jythonInstance<AbstractComponentFunction>(bluePrintContext, pythonClassName, + return jythonInstance<BlueprintFunctionNode<*, *>>(bluePrintContext, pythonClassName, content, jythonInstances) } |