From a283fe3ca39221e950a9cd97b6f9abcb40050ae0 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Thu, 6 Dec 2018 10:30:59 -0500 Subject: Add Generic Rest Configuration Change-Id: I3865eac84765ac2cbc5dd0db7a1ed0065bcaa7c5 Issue-ID: CCSDK-699 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../modules/commons/core/pom.xml | 9 ++----- .../core/BluePrintCoreConfiguration.kt | 21 ++++++++++++++-- .../core/BluePrintProperties.kt | 29 ++++++++++++++++++++++ 3 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintProperties.kt (limited to 'ms/blueprintsprocessor/modules/commons/core') diff --git a/ms/blueprintsprocessor/modules/commons/core/pom.xml b/ms/blueprintsprocessor/modules/commons/core/pom.xml index 626a27a37..5e0c966d2 100644 --- a/ms/blueprintsprocessor/modules/commons/core/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/core/pom.xml @@ -29,15 +29,10 @@ jar Blueprints Processor Core Blueprints Processor Core - - org.onap.ccsdk.apps.blueprintsprocessor - db-lib - - - org.onap.ccsdk.apps.blueprintsprocessor - rest-lib + org.springframework.boot + spring-boot-starter-webflux diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt index 3b5722d5f..07e494a1a 100644 --- a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt +++ b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt @@ -16,17 +16,34 @@ package org.onap.ccsdk.apps.blueprintsprocessor.core +import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Value +import org.springframework.boot.context.properties.bind.Binder +import org.springframework.boot.context.properties.source.ConfigurationPropertySources +import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.core.env.Environment @Configuration open class BluePrintCoreConfiguration { - @Value("\${blueprintsprocessor.blueprint-deploy-path}") + @Value("\${blueprintsprocessor.blueprintDeployPath}") lateinit var deployPath: String - @Value("\${blueprintsprocessor.blueprint-archive-path}") + @Value("\${blueprintsprocessor.blueprintArchivePath}") lateinit var archivePath: String +} + +@Configuration +open class BlueprintPropertyConfiguration { + @Autowired + lateinit var environment: Environment + + @Bean + open fun bluePrintPropertyBinder(): Binder { + val configurationPropertySource = ConfigurationPropertySources.get(environment) + return Binder(configurationPropertySource) + } } \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintProperties.kt b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintProperties.kt new file mode 100644 index 000000000..10b8ceb5e --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintProperties.kt @@ -0,0 +1,29 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * 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.core + +import org.springframework.boot.context.properties.bind.Bindable +import org.springframework.boot.context.properties.bind.Binder +import org.springframework.stereotype.Service + +@Service +open class BluePrintProperties(var bluePrintPropertyBinder: Binder) { + + fun propertyBeanType(prefix: String, type: Class): T { + return bluePrintPropertyBinder.bind(prefix, Bindable.of(type)).get() + } +} \ No newline at end of file -- cgit 1.2.3-korg