From 0613ae8f927834f7621011fda3f0cb1b7f8e07ad Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Mon, 18 Feb 2019 15:10:25 -0500 Subject: Add component function scripting service Change-Id: I7c5b49617823dd623566fb4be4d431012420e17c Issue-ID: CCSDK-959 Signed-off-by: Muthuramalingam, Brinda Santh --- .../rest/BluePrintRestLibConfiguration.kt | 2 ++ .../service/BluePrintRestLibPropertyService.kt | 26 +++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'ms/blueprintsprocessor/modules/commons/rest-lib/src/main') diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt index 50d69aee4..f63e39f39 100644 --- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt +++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt @@ -1,5 +1,6 @@ /* * Copyright © 2017-2018 AT&T Intellectual Property. + * Modifications Copyright © 2019 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +29,7 @@ open class BluePrintRestLibConfiguration class RestLibConstants { companion object { + const val SERVICE_BLUEPRINT_REST_LIB_PROPERTY = "blueprint-rest-lib-property-service" const val TYPE_BASIC_AUTH = "basic-auth" const val TYPE_SSL_BASIC_AUTH = "ssl-basic-auth" const val TYPE_DME2_PROXY = "dme2-proxy" 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 21d080d5a..47577b39e 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 @@ -1,5 +1,6 @@ /* * Copyright © 2017-2018 AT&T Intellectual Property. + * Modifications Copyright © 2019 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +22,7 @@ import org.onap.ccsdk.apps.blueprintsprocessor.rest.* import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException import org.springframework.stereotype.Service -@Service +@Service(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY) open class BluePrintRestLibPropertyService(private var bluePrintProperties: BluePrintProperties) { @Throws(BluePrintProcessorException::class) @@ -49,22 +50,31 @@ open class BluePrintRestLibPropertyService(private var bluePrintProperties: Blue @Throws(BluePrintProcessorException::class) fun blueprintWebClientService(selector: String): BlueprintWebClientService { val prefix = "blueprintsprocessor.restclient.$selector" - val beanProperties = restClientProperties(prefix) - when (beanProperties) { + val restClientProperties = restClientProperties(prefix) + return blueprintWebClientService(restClientProperties) + } + + + fun blueprintDynamicWebClientService(sourceType: String, selector: String): BlueprintWebClientService { + TODO() + } + + @Throws(BluePrintProcessorException::class) + fun blueprintWebClientService(restClientProperties: RestClientProperties): BlueprintWebClientService { + when (restClientProperties) { is BasicAuthRestClientProperties -> { - return BasicAuthRestClientService(beanProperties) + return BasicAuthRestClientService(restClientProperties) } is SSLBasicAuthRestClientProperties -> { - return SSLBasicAuthRestClientService(beanProperties) + return SSLBasicAuthRestClientService(restClientProperties) } is DME2RestClientProperties -> { - return DME2ProxyRestClientService(beanProperties) + return DME2ProxyRestClientService(restClientProperties) } else -> { - throw BluePrintProcessorException("couldn't get rest service for selector($selector)") + throw BluePrintProcessorException("couldn't get rest service for") } } - } fun basicAuthRestClientProperties(prefix: String): BasicAuthRestClientProperties { -- cgit 1.2.3-korg