6cb1d9c337d57d0bae954aeac98efdab95d6f705
[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 log = LoggerFactory.getLogger(DbConfigPool.class);
32         private final String type;
33         private static final int timeOut=0;
34         private ArrayList<BaseDBConfiguration> configurations = new ArrayList<>();
35
36         public DbConfigPool(Properties properties) {
37                 log.debug("Initializing DbConfigType");
38                 type = properties.getProperty(BaseDBConfiguration.DATABASE_TYPE, "JDBC").toUpperCase();
39         }
40
41         public int getTimeout() {
42                 return timeOut;
43         }
44
45         public String getType() {
46                 return type;
47         }
48
49         public JDBCConfiguration[] getJDBCbSourceArray() {
50                 return configurations.toArray(new JDBCConfiguration[configurations.size()]);
51         }
52
53         public void addConfiguration(BaseDBConfiguration config) {
54                 configurations.add(config);
55         }
56 }