2 * Copyright © 2017-2018 AT&T Intellectual Property.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.ccsdk.cds.blueprintsprocessor.db
19 import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
20 import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertySevice
21 import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDBLibGenericService
22 import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
23 import org.springframework.boot.context.properties.EnableConfigurationProperties
24 import org.springframework.context.annotation.Bean
25 import org.springframework.context.annotation.ComponentScan
26 import org.springframework.context.annotation.Configuration
30 @EnableConfigurationProperties
31 open class BluePrintDBLibConfiguration(private var bluePrintProperties: BluePrintProperties) {
33 @Bean("primary-database-properties")
34 open fun getPrimaryProperties(): PrimaryDataSourceProperties {
35 return bluePrintProperties.propertyBeanType(DBLibConstants.PREFIX_DB_PRIMARY,
36 PrimaryDataSourceProperties::class.java)
41 * Exposed Dependency Service by this SSH Lib Module
43 fun BluePrintDependencyService.dbLibPropertyService(): BluePrintDBLibPropertySevice =
44 instance(BluePrintDBLibPropertySevice::class)
46 fun BluePrintDependencyService.primaryDBLibGenericService(): BluePrintDBLibGenericService =
47 instance(PrimaryDBLibGenericService::class)
50 class DBLibConstants {
52 const val PREFIX_DB_PRIMARY: String = "blueprintsprocessor.db.primary"
55 const val MARIA_DB: String = "maria-db"
56 const val PRIMARY_DB: String = "primary-db"
57 const val MYSQL_DB: String = "mysql-db"
58 const val ORACLE_DB: String = "oracle-db"
59 const val POSTGRES_DB: String = "postgres-db"
61 //List of database drivers
62 const val DRIVER_MARIA_DB = "org.mariadb.jdbc.Driver"
63 const val DRIVER_MYSQL_DB = "com.mysql.jdbc.Driver"
64 const val DRIVER_ORACLE_DB = "oracle.jdbc.driver.OracleDriver"
65 const val DRIVER_POSTGRES_DB = "org.postgresql.Driver"