diff options
author | Brinda Santh <brindasanth@in.ibm.com> | 2019-08-02 10:02:34 -0400 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2019-08-09 20:03:31 +0000 |
commit | 132312ce49fa4efbe7008f3055aa86a8853bedd3 (patch) | |
tree | e6a17f60642ca0dda38216baee8b838ed678c900 /ms/blueprintsprocessor/functions/python-executor | |
parent | 2d879240396861aa253dd65b2476f35a2ffc0493 (diff) |
Add resource source template DSL.
Change-Id: If68ce2e944700cb19380d34ff3b466a9c8633472
Issue-ID: CCSDK-1577
Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
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 |