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
8 package org.opendaylight.aaa.datastore.h2;
10 import com.google.common.base.MoreObjects;
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;
18 * Responsible for providing configuration properties for the IDMLight/H2 data store implementation.
20 * @author peter.mellquist@hp.com - Initial contribution
21 * @author Michael Vorburger.ch - Made it configurable, as Immutable with a Builder
24 @Value.Style(strictBuilder = true, builder = "new",
25 typeImmutable = "*Impl", visibility = ImplementationVisibility.PRIVATE)
26 public abstract class IdmLightConfig {
28 * The filename for the H2 database file.
30 * @return data base name
33 public String getDbName() {
38 * The database directory for the h2 database file. Either absolute or
39 * relative to KARAF_HOME.
41 * @return data base dir
44 public String getDbDirectory() {
49 * The database JDBC driver, default is H2; a pure-java implementation.
51 * @return data base driver
54 public String getDbDriver() {
55 return "org.h2.Driver";
59 * The database username. This is not the same as AAA credentials!
61 * @return data base user
63 public abstract String getDbUser();
66 * The database password. This is not the same as AAA credentials!
68 * @return data base password
70 public abstract String getDbPwd();
73 * Timeout for database connections in seconds.
75 * @return data base valid time out
78 public int getDbValidTimeOut() {
83 * The JDBC default connection string.
85 * @return data base connection prefix
88 public String getDbConnectionStringPrefix() {
93 * The JDBC database connection string.
95 * @return data base connection
98 public String getDbConnectionString() {
99 return getDbConnectionStringPrefix() + getDbDirectory() + File.separatorChar + getDbName();
103 public final String toString() {
104 return MoreObjects.toStringHelper(this)
105 .add("path", getDbConnectionString())
106 .add("driver", getDbDriver())
107 .add("validity timeout", getDbValidTimeOut())