summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/commons
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2019-06-21 18:21:42 -0400
committerBrinda Santh <brindasanth@in.ibm.com>2019-06-25 18:39:24 -0400
commitd9e690caf3c1c0b6bb5d55dd21fc75508f267f5d (patch)
tree283de5502a6cef17e30d2bc7116bbc16c1305adf /ms/blueprintsprocessor/modules/commons
parenta6fae85764a8dfbeba6000a060b8be0f21fb0466 (diff)
Refractor blueprint script dependency
Change-Id: I2e6b4dd278c1a4a3069a44f648129599365909d4 Issue-ID: CCSDK-1428 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons')
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt12
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt18
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt20
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt19
4 files changed, 68 insertions, 1 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
index 19e482aab..efefe0290 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
@@ -16,7 +16,9 @@
package org.onap.ccsdk.cds.blueprintsprocessor.db
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertySevice
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
@@ -34,8 +36,18 @@ open class BluePrintDBLibConfiguration(private var bluePrintProperties: BluePrin
}
}
+/**
+ * Exposed Dependency Service by this SSH Lib Module
+ */
+//TODO("right now not wired with name ")
+fun BluePrintDependencyService.dbLibPropertyService(): BluePrintDBLibPropertySevice =
+ instance(DBLibConstants.SERVICE_BLUEPRINT_DB_LIB_PROPERTY)
+
+
class DBLibConstants {
companion object {
+ //TODO("right now not wired with name ")
+ const val SERVICE_BLUEPRINT_DB_LIB_PROPERTY = "blueprint-db-lib-property-service"
const val PREFIX_DB_PRIMARY: String = "blueprintsprocessor.db.primary"
//list of database
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
index 5f1ae7d37..1cb66b8ab 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
@@ -17,16 +17,19 @@
package org.onap.ccsdk.cds.blueprintsprocessor.core
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.properties.bind.Bindable
import org.springframework.boot.context.properties.bind.Binder
import org.springframework.boot.context.properties.source.ConfigurationPropertySources
+import org.springframework.context.ApplicationContext
+import org.springframework.context.ApplicationContextAware
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.core.env.Environment
import org.springframework.stereotype.Service
-
@Configuration
open class BluePrintCoreConfiguration(private val bluePrintProperties: BlueprintProcessorProperties) {
@@ -59,4 +62,17 @@ open class BlueprintProcessorProperties(private var bluePrintPropertyBinder: Bin
fun <T> propertyBeanType(prefix: String, type: Class<T>): T {
return bluePrintPropertyBinder.bind(prefix, Bindable.of(type)).get()
}
+}
+
+@Configuration
+// Add Conditional property , If we try to manage on Application level
+open class BlueprintDependencyConfiguration : ApplicationContextAware {
+
+ private val log = LoggerFactory.getLogger(BlueprintDependencyConfiguration::class.java)!!
+
+ override fun setApplicationContext(applicationContext: ApplicationContext) {
+ BluePrintDependencyService.inject(applicationContext)
+ log.info("Dependency Management module created...")
+ }
+
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
index fa4ff231d..25d1de881 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
@@ -18,6 +18,10 @@
package org.onap.ccsdk.cds.blueprintsprocessor.rest
+import com.fasterxml.jackson.databind.JsonNode
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
@@ -27,6 +31,22 @@ import org.springframework.context.annotation.Configuration
@EnableConfigurationProperties
open class BluePrintRestLibConfiguration
+/**
+ * Exposed Dependency Service by this Rest Lib Module
+ */
+fun BluePrintDependencyService.restLibPropertyService(): BluePrintRestLibPropertyService =
+ instance(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY)
+
+
+fun BluePrintDependencyService.restClientService(selector: String): BlueprintWebClientService {
+ return restLibPropertyService().blueprintWebClientService(selector)
+}
+
+
+fun BluePrintDependencyService.restClientService(jsonNode: JsonNode): BlueprintWebClientService {
+ return restLibPropertyService().blueprintWebClientService(jsonNode)
+}
+
class RestLibConstants {
companion object {
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt
index 48e451f03..3c625a6d3 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt
@@ -16,6 +16,10 @@
package org.onap.ccsdk.cds.blueprintsprocessor.ssh
+import com.fasterxml.jackson.databind.JsonNode
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.service.BluePrintSshLibPropertyService
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.service.BlueprintSshClientService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
@@ -25,6 +29,21 @@ import org.springframework.context.annotation.Configuration
@EnableConfigurationProperties
open class BluePrintSshLibConfiguration
+/**
+ * Exposed Dependency Service by this SSH Lib Module
+ */
+fun BluePrintDependencyService.sshLibPropertyService(): BluePrintSshLibPropertyService =
+ instance(SshLibConstants.SERVICE_BLUEPRINT_SSH_LIB_PROPERTY)
+
+
+fun BluePrintDependencyService.sshClientService(selector: String): BlueprintSshClientService =
+ sshLibPropertyService().blueprintSshClientService(selector)
+
+
+fun BluePrintDependencyService.sshClientService(jsonNode: JsonNode): BlueprintSshClientService =
+ sshLibPropertyService().blueprintSshClientService(jsonNode)
+
+
class SshLibConstants {
companion object {
const val SERVICE_BLUEPRINT_SSH_LIB_PROPERTY = "blueprint-ssh-lib-property-service"