summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-03-11 16:34:55 -0400
committerMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-03-13 15:09:10 -0400
commit2a4848031776982dbefbde5b27442fd20c01d344 (patch)
tree7cfd9ed6617427c96892cfbd9f2fd3127bd7cee5 /ms/blueprintsprocessor/modules
parent5dfc1bc16546a146b911ff1f19dd549da27926e0 (diff)
Improve RA capability processor.
Change-Id: I44a8157c9e2a27b49aa8af00a857ebc7b3e845c3 Issue-ID: CCSDK-1137 Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules')
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt22
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt5
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)
}