Migrate "ms/controllerblueprints" from ccsdk/apps
[ccsdk/cds.git] / ms / blueprintsprocessor / modules / commons / db-lib / src / main / kotlin / org / onap / ccsdk / apps / blueprintsprocessor / db / BluePrintDBLibConfiguration.kt
1 /*
2  * Copyright © 2017-2018 AT&T Intellectual Property.
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onap.ccsdk.apps.blueprintsprocessor.db
18
19 import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties
20 import org.springframework.boot.context.properties.EnableConfigurationProperties
21 import org.springframework.context.annotation.Bean
22 import org.springframework.context.annotation.ComponentScan
23 import org.springframework.context.annotation.Configuration
24
25 @Configuration
26 @ComponentScan
27 @EnableConfigurationProperties
28 open class BluePrintDBLibConfiguration(private var bluePrintProperties: BluePrintProperties) {
29
30     @Bean("primary-database-properties")
31     open fun getPrimaryProperties(): PrimaryDataSourceProperties {
32         return bluePrintProperties.propertyBeanType(DBLibConstants.PREFIX_DB_PRIMARY,
33                 PrimaryDataSourceProperties::class.java)
34     }
35 }
36
37 class DBLibConstants {
38     companion object {
39         const val PREFIX_DB_PRIMARY: String = "blueprintsprocessor.db.primary"
40
41         //list of database
42         const val MARIA_DB: String = "maria-db"
43         const val PRIMARY_DB: String = "primary-db"
44         const val MYSQL_DB: String = "mysql-db"
45         const val ORACLE_DB: String = "oracle-db"
46         const val POSTGRES_DB: String = "postgres-db"
47
48         //List of database drivers
49         const val DRIVER_MARIA_DB = "org.mariadb.jdbc.Driver"
50         const val DRIVER_MYSQL_DB = "com.mysql.jdbc.Driver"
51         const val DRIVER_ORACLE_DB = "oracle.jdbc.driver.OracleDriver"
52         const val DRIVER_POSTGRES_DB = "org.postgresql.Driver"
53
54
55     }
56 }