2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2016 - 2017 ONAP
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.ccsdk.sli.core.dblib.config;
23 import java.util.Properties;
25 public abstract class BaseDBConfiguration {
26 public static final String DATABASE_TYPE = "org.onap.ccsdk.sli.dbtype";
27 public static final String DATABASE_URL = "org.onap.ccsdk.sli.jdbc.url";
28 public static final String DATABASE_NAME = "org.onap.ccsdk.sli.jdbc.database";
29 public static final String CONNECTION_NAME = "org.onap.ccsdk.sli.jdbc.connection.name";
30 public static final String DATABASE_USER = "org.onap.ccsdk.sli.jdbc.user";
31 public static final String DATABASE_PSSWD = "org.onap.ccsdk.sli.jdbc.password";
32 public static final String CONNECTION_TIMEOUT="org.onap.ccsdk.sli.jdbc.connection.timeout";
33 public static final String REQUEST_TIMEOUT = "org.onap.ccsdk.sli.jdbc.request.timeout";
34 public static final String MIN_LIMIT = "org.onap.ccsdk.sli.jdbc.limit.min";
35 public static final String MAX_LIMIT = "org.onap.ccsdk.sli.jdbc.limit.max";
36 public static final String INIT_LIMIT = "org.onap.ccsdk.sli.jdbc.limit.init";
37 public static final String DATABASE_HOSTS = "org.onap.ccsdk.sli.jdbc.hosts";
40 protected final Properties props;
42 public BaseDBConfiguration(Properties properties) {
43 this.props = properties;
46 public int getConnTimeout() {
48 String value = props.getProperty(CONNECTION_TIMEOUT);
49 return Integer.parseInt(value);
50 } catch(Exception exc) {
55 public int getRequestTimeout() {
57 String value = props.getProperty(REQUEST_TIMEOUT);
60 return Integer.parseInt(value);
61 } catch(Exception exc) {
66 public String getDbConnectionName() {
67 return props.getProperty(CONNECTION_NAME);
70 public String getDatabaseName() {
71 return props.getProperty(DATABASE_NAME);
74 public String getDbUserId() {
75 return props.getProperty(DATABASE_USER);
78 public String getDbPasswd() {
79 return props.getProperty(DATABASE_PSSWD);
82 public int getDbMinLimit() {
83 String value = props.getProperty(MIN_LIMIT);
84 return Integer.parseInt(value);
87 public int getDbMaxLimit() {
88 String value = props.getProperty(MAX_LIMIT);
89 return Integer.parseInt(value);
92 public int getDbInitialLimit() {
93 String value = props.getProperty(INIT_LIMIT);
94 return Integer.parseInt(value);
97 public String getDbUrl() {
98 return props.getProperty(DATABASE_URL);
101 public String getServerGroup() {