2 * Copyright (c) 2014, 2017 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.datastore.h2;
12 import org.immutables.value.Value;
13 import org.immutables.value.Value.Default;
14 import org.immutables.value.Value.Immutable;
15 import org.immutables.value.Value.Style.ImplementationVisibility;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 * Responsible for providing configuration properties for the IDMLight/H2 data
21 * store implementation.
23 * @author peter.mellquist@hp.com - Initial contribution
24 * @author Michael Vorburger.ch - Made it configurable, as Immutable with
28 @Value.Style(strictBuilder = true, builder = "new",
29 typeImmutable = "*Impl", visibility = ImplementationVisibility.PRIVATE)
30 public abstract class IdmLightConfig {
32 private static final Logger LOG = LoggerFactory.getLogger(IdmLightConfig.class);
35 * The filename for the H2 database file.
37 * @return data base name
40 public String getDbName() {
45 * The database directory for the h2 database file. Either absolute or
46 * relative to KARAF_HOME.
48 * @return data base dir
51 public String getDbDirectory() {
56 * The database JDBC driver, default is H2; a pure-java implementation.
58 * @return data base driver
61 public String getDbDriver() {
62 return "org.h2.Driver";
66 * The database username. This is not the same as AAA credentials!
68 * @return data base user
70 public abstract String getDbUser();
73 * The database password. This is not the same as AAA credentials!
75 * @return data base password
77 public abstract String getDbPwd();
80 * Timeout for database connections in seconds.
82 * @return data base valid time out
85 public int getDbValidTimeOut() {
90 * The JDBC default connection string.
92 * @return data base connection prefix
95 public String getDbConnectionStringPrefix() {
100 * The JDBC database connection string.
102 * @return data base connection
105 public String getDbConnectionString() {
106 return getDbConnectionStringPrefix() + getDbDirectory() + File.separatorChar + getDbName();
110 LOG.info("DB Path : {}", getDbConnectionString());
111 LOG.info("DB Driver : {}", getDbDriver());
112 LOG.info("DB Valid Time Out : {}", getDbValidTimeOut());