summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-03-04 19:41:14 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-04 19:41:14 +0000
commit15a0d9eac08da12e82eaf07b7d50a48f1d87039c (patch)
tree4143f2958adc9f1288e751bed016cf2438b95dbd /ms/blueprintsprocessor/modules
parent8981bb7fdd7b567a85992d295275ec6cf9467daf (diff)
parent50fb805cd04593426f6c8e23a40f51398099e183 (diff)
Merge "Get DSL Property in Resource Resolution"
Diffstat (limited to 'ms/blueprintsprocessor/modules')
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt33
1 files changed, 27 insertions, 6 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
index 47577b39..705caa2e 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
@@ -17,15 +17,16 @@
package org.onap.ccsdk.apps.blueprintsprocessor.rest.service
+import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties
import org.onap.ccsdk.apps.blueprintsprocessor.rest.*
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import org.springframework.stereotype.Service
@Service(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY)
open class BluePrintRestLibPropertyService(private var bluePrintProperties: BluePrintProperties) {
- @Throws(BluePrintProcessorException::class)
fun restClientProperties(prefix: String): RestClientProperties {
val type = bluePrintProperties.propertyBeanType("$prefix.type", String::class.java)
return when (type) {
@@ -47,19 +48,39 @@ open class BluePrintRestLibPropertyService(private var bluePrintProperties: Blue
}
}
- @Throws(BluePrintProcessorException::class)
+ fun restClientProperties(jsonNode: JsonNode): RestClientProperties {
+ val type = jsonNode.get("type").textValue()
+ return when (type) {
+ RestLibConstants.TYPE_BASIC_AUTH -> {
+ JacksonUtils.readValue(jsonNode, BasicAuthRestClientProperties::class.java)!!
+ }
+ RestLibConstants.TYPE_SSL_BASIC_AUTH -> {
+ JacksonUtils.readValue(jsonNode, SSLBasicAuthRestClientProperties::class.java)!!
+ }
+ RestLibConstants.TYPE_DME2_PROXY -> {
+ JacksonUtils.readValue(jsonNode, DME2RestClientProperties::class.java)!!
+ }
+ RestLibConstants.TYPE_POLICY_MANAGER -> {
+ JacksonUtils.readValue(jsonNode, PolicyManagerRestClientProperties::class.java)!!
+ }
+ else -> {
+ throw BluePrintProcessorException("Rest adaptor($type) is not supported")
+ }
+ }
+ }
+
+
fun blueprintWebClientService(selector: String): BlueprintWebClientService {
val prefix = "blueprintsprocessor.restclient.$selector"
val restClientProperties = restClientProperties(prefix)
return blueprintWebClientService(restClientProperties)
}
-
- fun blueprintDynamicWebClientService(sourceType: String, selector: String): BlueprintWebClientService {
- TODO()
+ fun blueprintWebClientService(jsonNode: JsonNode): BlueprintWebClientService {
+ val restClientProperties = restClientProperties(jsonNode)
+ return blueprintWebClientService(restClientProperties)
}
- @Throws(BluePrintProcessorException::class)
fun blueprintWebClientService(restClientProperties: RestClientProperties): BlueprintWebClientService {
when (restClientProperties) {
is BasicAuthRestClientProperties -> {