From f439f401aa06ea497a84c73f3c158dfc6c62bc61 Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Wed, 10 Jul 2019 18:27:23 -0400 Subject: Refractor blueprint-script to avoid cyclic dependency. There is a possibility of cyclic dependencies between blueprint-script module and code module. To avoid cyclic dependency blueprint-script implementation should be moved to Core module. This implementation has zero impact on code functionality and code testing. Change-Id: Ic18ea848cb2e1e2e7a5f1c144714de26d1495cee Issue-ID: CCSDK-1469 Signed-off-by: Brinda Santh --- .../services/execution/ComponentFunctionScriptingService.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'ms/blueprintsprocessor/modules/services/execution-service/src/main') diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt index b2991be5e..49a2c62b1 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt @@ -21,6 +21,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintScriptsService import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintFunctionNode +import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext import org.slf4j.LoggerFactory import org.springframework.context.ApplicationContext @@ -28,15 +29,14 @@ import org.springframework.stereotype.Service @Service class ComponentFunctionScriptingService(private val applicationContext: ApplicationContext, - private val bluePrintScriptsService: BluePrintScriptsService, private val blueprintJythonService: BlueprintJythonService) { private val log = LoggerFactory.getLogger(ComponentFunctionScriptingService::class.java) suspend fun scriptInstance(componentFunction: AbstractComponentFunction, - scriptType: String, - scriptClassReference: String, - instanceDependencies: List): T { + scriptType: String, + scriptClassReference: String, + instanceDependencies: List): T { log.info("creating component function of script type($scriptType), reference name($scriptClassReference) and " + "instanceDependencies($instanceDependencies)") @@ -66,14 +66,16 @@ class ComponentFunctionScriptingService(private val applicationContext: Applicat suspend fun > scriptInstance(bluePrintContext: BluePrintContext, scriptType: String, - scriptClassReference: String): T { + scriptClassReference: String): T { var scriptComponent: T? = null when (scriptType) { BluePrintConstants.SCRIPT_INTERNAL -> { + val bluePrintScriptsService: BluePrintScriptsService = BluePrintScriptsServiceImpl() scriptComponent = bluePrintScriptsService.scriptInstance(scriptClassReference) } BluePrintConstants.SCRIPT_KOTLIN -> { + val bluePrintScriptsService: BluePrintScriptsService = BluePrintScriptsServiceImpl() scriptComponent = bluePrintScriptsService.scriptInstance(bluePrintContext, scriptClassReference, false) } BluePrintConstants.SCRIPT_JYTHON -> { -- cgit 1.2.3-korg