minor updates to clean up code
[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 /**
31  * @version $Revision: 1.15 $
32  * Change Log
33  * Author         Date     Comments
34  * ============== ======== ====================================================
35  * Rich Tabedzki
36  */\r
37 public class DbConfigPool {
38         private static final Logger LOGGER = LoggerFactory.getLogger(DbConfigPool.class);
39         private final String type;
40         private static final int timeOut=0;
41         private ArrayList<BaseDBConfiguration> configurations = new ArrayList<>();
42
43         public DbConfigPool(Properties properties) {
44                 LOGGER.debug("Initializing DbConfigType");
45                 type = properties.getProperty(BaseDBConfiguration.DATABASE_TYPE, "JDBC").toUpperCase();
46         }
47
48         public int getTimeout() {
49                 return timeOut;
50         }
51
52         public String getType() {
53                 return type;
54         }
55
56         public JDBCConfiguration[] getJDBCbSourceArray() {
57                 return configurations.toArray(new JDBCConfiguration[configurations.size()]);
58         }
59
60         public void addConfiguration(BaseDBConfiguration config) {
61                 configurations.add(config);
62         }
63 }