diff options
author | Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com> | 2019-02-25 16:03:16 -0500 |
---|---|---|
committer | Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com> | 2019-03-01 15:54:08 -0500 |
commit | 21ff59b375513c95ce0fdbd1736c9cce3a8ef0de (patch) | |
tree | 3d78042bc5f8ae608e98a7ee893a6d2dcd2f0648 /ms/blueprintsprocessor/modules/commons/rest-lib/src | |
parent | 5ad9dd16620cd734a6cc35bf937d33f159c25e41 (diff) |
Get DSL Property in Resource Resolution
Change-Id: I768c2515bc4b0eaa829213ac4d045628ca960adb
Issue-ID: CCSDK-1106
Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons/rest-lib/src')
-rw-r--r-- | ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt | 33 |
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 47577b39e..705caa2e2 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 -> { |