From 132312ce49fa4efbe7008f3055aa86a8853bedd3 Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Fri, 2 Aug 2019 10:02:34 -0400 Subject: Add resource source template DSL. Change-Id: If68ce2e944700cb19380d34ff3b466a9c8633472 Issue-ID: CCSDK-1577 Signed-off-by: Brinda Santh --- .../executor/ComponentRemotePythonExecutorDSL.kt | 78 +++++++++++----------- 1 file changed, 40 insertions(+), 38 deletions(-) (limited to 'ms/blueprintsprocessor/functions/python-executor') diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt index 6a60c98cd..c2055f9a5 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt @@ -89,16 +89,11 @@ fun BluePrintTypes.dataTypeDtSystemPackages(): DataType { /** Component Builder */ fun BluePrintTypes.nodeTemplateComponentRemotePythonExecutor(id: String, description: String, - block: ComponentRemotePythonExecutorNodeTemplateOperationImplBuilder.() -> Unit) + block: ComponentRemotePythonExecutorNodeTemplateBuilder.() -> Unit) : NodeTemplate { - return ComponentRemotePythonExecutorNodeTemplateOperationImplBuilder(id, description).apply(block).build() + return ComponentRemotePythonExecutorNodeTemplateBuilder(id, description).apply(block).build() } -class ComponentRemotePythonExecutorNodeTemplateOperationImplBuilder(id: String, description: String) : - AbstractNodeTemplateOperationImplBuilder(id, "component-remote-python-executor", - "ComponentRemotePythonExecutor", description) - class DtSystemPackageDataTypeBuilder : PropertiesAssignmentBuilder() { fun type(type: String) = type(type.asJsonPrimitive()) @@ -116,48 +111,55 @@ class DtSystemPackageDataTypeBuilder : PropertiesAssignmentBuilder() { } } -class ComponentRemotePythonExecutorInputAssignmentBuilder : PropertiesAssignmentBuilder() { +class ComponentRemotePythonExecutorNodeTemplateBuilder(id: String, description: String) : + AbstractNodeTemplateOperationImplBuilder(id, "component-remote-python-executor", + "ComponentRemotePythonExecutor", description) { - private var packageList: ArrayNode? = null + class InputsBuilder : PropertiesAssignmentBuilder() { - fun endpointSelector(endpointSelector: String) = endpointSelector(endpointSelector.asJsonPrimitive()) + private var packageList: ArrayNode? = null - fun endpointSelector(endpointSelector: JsonNode) { - property(ComponentRemotePythonExecutor.INPUT_ENDPOINT_SELECTOR, endpointSelector) - } + fun endpointSelector(endpointSelector: String) = endpointSelector(endpointSelector.asJsonPrimitive()) - fun dynamicProperties(dynamicProperties: String) = dynamicProperties(dynamicProperties.asJsonType()) + fun endpointSelector(endpointSelector: JsonNode) { + property(ComponentRemotePythonExecutor.INPUT_ENDPOINT_SELECTOR, endpointSelector) + } - fun dynamicProperties(dynamicProperties: JsonNode) { - property(ComponentRemotePythonExecutor.INPUT_DYNAMIC_PROPERTIES, dynamicProperties) - } + fun dynamicProperties(dynamicProperties: String) = dynamicProperties(dynamicProperties.asJsonType()) - fun argumentProperties(argumentProperties: String) = argumentProperties(argumentProperties.asJsonType()) + fun dynamicProperties(dynamicProperties: JsonNode) { + property(ComponentRemotePythonExecutor.INPUT_DYNAMIC_PROPERTIES, dynamicProperties) + } - fun argumentProperties(argumentProperties: JsonNode) { - property(ComponentRemotePythonExecutor.INPUT_ARGUMENT_PROPERTIES, argumentProperties) - } + fun argumentProperties(argumentProperties: String) = argumentProperties(argumentProperties.asJsonType()) - fun command(command: String) = command(command.asJsonPrimitive()) + fun argumentProperties(argumentProperties: JsonNode) { + property(ComponentRemotePythonExecutor.INPUT_ARGUMENT_PROPERTIES, argumentProperties) + } - fun command(command: JsonNode) { - property(ComponentRemotePythonExecutor.INPUT_COMMAND, command) - } + fun command(command: String) = command(command.asJsonPrimitive()) - fun packages(block: DtSystemPackageDataTypeBuilder.() -> Unit) { - if (packageList == null) - packageList = JacksonUtils.objectMapper.createArrayNode() - val dtSysyemPackagePropertyAssignments = DtSystemPackageDataTypeBuilder().apply(block).build() - packageList!!.add(dtSysyemPackagePropertyAssignments.asJsonType()) - } + fun command(command: JsonNode) { + property(ComponentRemotePythonExecutor.INPUT_COMMAND, command) + } - override fun build(): MutableMap { - val propertyAssignments = super.build() - if (packageList != null) { - propertyAssignments[ComponentRemotePythonExecutor.INPUT_PACKAGES] = packageList!! + fun packages(block: DtSystemPackageDataTypeBuilder.() -> Unit) { + if (packageList == null) + packageList = JacksonUtils.objectMapper.createArrayNode() + val dtSysyemPackagePropertyAssignments = DtSystemPackageDataTypeBuilder().apply(block).build() + packageList!!.add(dtSysyemPackagePropertyAssignments.asJsonType()) + } + + override fun build(): MutableMap { + val propertyAssignments = super.build() + if (packageList != null) { + propertyAssignments[ComponentRemotePythonExecutor.INPUT_PACKAGES] = packageList!! + } + return propertyAssignments } - return propertyAssignments } -} -class ComponentRemotePythonExecutorOutputAssignmentBuilder : PropertiesAssignmentBuilder() \ No newline at end of file + class OutputsBuilder : PropertiesAssignmentBuilder() + +} \ No newline at end of file -- cgit 1.2.3-korg