summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-02-12 15:53:39 -0500
committerMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-02-12 20:18:09 -0500
commit2f15f49c88921713b8dd6679220c35adee7ca1c5 (patch)
treea40bfeec75ff8adc3d1b172b8854c6722ef0da5c /ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin
parent92148caefffdee433e1ed9f1edc17858e6de1e49 (diff)
Create restconf component function module
Change-Id: I04c29bfc981b677d81da73441228215ce4868833 Issue-ID: CCSDK-1060 Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin')
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt62
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt33
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt29
3 files changed, 124 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt
new file mode 100644
index 000000000..67202df49
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor
+
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.python.executor.BlueprintJythonService
+import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
+import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
+import org.slf4j.LoggerFactory
+import org.springframework.beans.factory.config.ConfigurableBeanFactory
+import org.springframework.context.ApplicationContext
+import org.springframework.context.annotation.Scope
+import org.springframework.stereotype.Component
+
+@Component("component-restconf-executor")
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+open class ComponentRestconfExecutor(private var applicationContext: ApplicationContext,
+ private val blueprintJythonService: BlueprintJythonService,
+ var bluePrintRestLibPropertyService: BluePrintRestLibPropertyService) :
+ AbstractComponentFunction() {
+
+ private val log = LoggerFactory.getLogger(ComponentRestconfExecutor::class.java)
+
+ lateinit var scriptComponent: RestconfComponentFunction
+
+ override fun process(executionRequest: ExecutionServiceInput) {
+ scriptComponent = blueprintJythonService.jythonComponentInstance(this) as RestconfComponentFunction
+ checkNotNull(scriptComponent) { "failed to get netconf script component" }
+
+ scriptComponent.bluePrintRuntimeService = bluePrintRuntimeService
+ scriptComponent.processId = processId
+ scriptComponent.workflowName = workflowName
+ scriptComponent.stepName = stepName
+ scriptComponent.interfaceName = interfaceName
+ scriptComponent.operationName = operationName
+ scriptComponent.nodeTemplateName = nodeTemplateName
+ scriptComponent.operationInputs = operationInputs
+
+ // Set the Rest Lib Property Service
+ scriptComponent.bluePrintRestLibPropertyService = bluePrintRestLibPropertyService
+
+ scriptComponent.process(executionServiceInput)
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ scriptComponent.recover(runtimeException, executionRequest)
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt
new file mode 100644
index 000000000..7b3615fe3
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt
@@ -0,0 +1,33 @@
+/*
+ * Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor
+
+import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
+import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BlueprintWebClientService
+import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
+
+
+abstract class RestconfComponentFunction : AbstractComponentFunction() {
+
+ lateinit var bluePrintRestLibPropertyService: BluePrintRestLibPropertyService
+
+ fun restClientService(selector: String): BlueprintWebClientService {
+ return bluePrintRestLibPropertyService.blueprintWebClientService(selector)
+ }
+
+
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt
new file mode 100644
index 000000000..300f5be13
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt
@@ -0,0 +1,29 @@
+/*
+ * Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
+import org.springframework.boot.context.properties.EnableConfigurationProperties
+import org.springframework.context.annotation.ComponentScan
+import org.springframework.context.annotation.Configuration
+
+
+@Configuration
+@ComponentScan
+@EnableConfigurationProperties
+@ConditionalOnProperty(name = ["blueprintsprocessor.restconfEnabled"], havingValue = "true")
+open class RestconfExecutorConfiguration \ No newline at end of file