diff options
Diffstat (limited to 'ms/blueprintsprocessor/functions/python-executor')
-rw-r--r-- | ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt | 78 |
1 files changed, 40 insertions, 38 deletions
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<PropertiesAssignmentBuilder, ComponentRemotePythonExecutorInputAssignmentBuilder, - ComponentRemotePythonExecutorOutputAssignmentBuilder>(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<PropertiesAssignmentBuilder, ComponentRemotePythonExecutorNodeTemplateBuilder.InputsBuilder, + ComponentRemotePythonExecutorNodeTemplateBuilder.OutputsBuilder>(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<String, JsonNode> { - 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<String, JsonNode> { + 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 |