Merge "fixed sonar issue in DBConfigFactory"
[ccsdk/sli/core.git] / dblib / provider / src / main / java / org / onap / ccsdk / sli / core / dblib / config / DbConfigPool.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * onap
4  * ================================================================================
5  * Copyright (C) 2016 - 2017 ONAP
6  * ================================================================================
7  * Modifications Copyright (C) 2018 IBM.
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.ccsdk.sli.core.dblib.config;
24
25 import java.util.ArrayList;
26 import java.util.Properties;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29
30 public class DbConfigPool {
31         private static Logger LOGGER = LoggerFactory.getLogger(DbConfigPool.class);
32
33         private final String type;
34
35         private ArrayList<BaseDBConfiguration> configurations = new ArrayList<>();
36
37         public DbConfigPool(Properties properties) {
38                 LOGGER.debug("Initializing DbConfigType");
39                 type = properties.getProperty(BaseDBConfiguration.DATABASE_TYPE, "JDBC").toUpperCase();
40         }
41
42         public int getTimeout() {
43                 return 0;
44         }
45
46         public String getType() {
47                 return type;
48         }
49
50         public JDBCConfiguration[] getJDBCbSourceArray() {
51                 return configurations.toArray(new JDBCConfiguration[configurations.size()]);
52         }
53
54         public void addConfiguration(BaseDBConfiguration config) {
55                 configurations.add(config);
56         }
57 }