2 * Copyright (c) 2014, 2015 Hewlett-Packard Development Company, L.P. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.aaa.h2.config;
11 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory;
15 * Responsible for providing configuration properties for the IDMLight/H2
16 * data store implementation.
18 * @author peter.mellquist@hp.com
21 public class IdmLightConfig {
23 private static final Logger LOG = LoggerFactory.getLogger(IdmLightConfig.class);
26 * The default timeout for db connections in seconds.
28 private static final int DEFAULT_DB_TIMEOUT = 3;
31 * The default password for the database
33 private static final String DEFAULT_PASSWORD = "bar";
36 * The default username for the database
38 private static final String DEFAULT_USERNAME = "foo";
41 * The default driver for the databse is H2; a pure-java implementation
44 private static final String DEFAULT_JDBC_DRIVER = "org.h2.Driver";
47 * The default connection string includes the intention to use h2 as
48 * the JDBC driver, and the path for the file is located relative to
51 private static final String DEFAULT_CONNECTION_STRING = "jdbc:h2:./";
54 * The default filename for the database file.
56 private static final String DEFAULT_IDMLIGHT_DB_FILENAME = "idmlight.db";
59 * The database filename
61 private String dbName;
64 * the database connection string
66 private String dbPath;
69 * The database driver (i.e., H2)
71 private String dbDriver;
74 * The database password. This is not the same as AAA credentials!
76 private String dbUser;
79 * The database username. This is not the same as AAA credentials!
84 * Timeout for database connections in seconds
86 private int dbValidTimeOut;
89 * Creates an valid database configuration using default values.
91 public IdmLightConfig() {
92 // TODO make this configurable
93 dbName = DEFAULT_IDMLIGHT_DB_FILENAME;
94 dbPath = DEFAULT_CONNECTION_STRING + dbName;
95 dbDriver = DEFAULT_JDBC_DRIVER;
96 dbUser = DEFAULT_USERNAME;
97 dbPwd = DEFAULT_PASSWORD;
98 dbValidTimeOut = DEFAULT_DB_TIMEOUT;
102 * Outputs some debugging information surrounding idmlight config
105 LOG.info("DB Path : {}", dbPath);
106 LOG.info("DB Driver : {}", dbDriver);
107 LOG.info("DB Valid Time Out : {}", dbValidTimeOut);
110 public String getDbName() {
114 public String getDbPath() {
118 public String getDbDriver() {
119 return this.dbDriver;
122 public String getDbUser() {
126 public String getDbPwd() {
130 public int getDbValidTimeOut() {
131 return this.dbValidTimeOut;