2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.models.dao;
23 import java.util.Properties;
26 * This class is a POJO that holds properties for PF DAOs.
28 public class DaoParameters {
29 /** The default PF DAO plugin class. */
30 public static final String DEFAULT_PLUGIN_CLASS = "org.onap.policy.models.dao.impl.DefaultPfDao";
32 private String pluginClass = DEFAULT_PLUGIN_CLASS;
33 private String persistenceUnit;
35 private Properties jdbcProperties = new Properties();
38 * Gets the DAO plugin class, this is the DAO class to use and it must implement the
39 * {@link PfDao} interface.
41 * @return the DAO plugin class
43 public String getPluginClass() {
48 * Sets the DAO plugin class, a class that implements the {@link PfDao} interface.
50 * @param daoPluginClass the DAO plugin class
52 public void setPluginClass(final String daoPluginClass) {
53 pluginClass = daoPluginClass;
57 * Gets the persistence unit for the DAO. The persistence unit defines the JDBC properties the
58 * DAO will use. The persistence unit must defined in the {@code META-INF/persistence.xml}
61 * @return the persistence unit to use for JDBC access
63 public String getPersistenceUnit() {
64 return persistenceUnit;
68 * Sets the persistence unit for the DAO. The persistence unit defines the JDBC properties the
69 * DAO will use. The persistence unit must defined in the {@code META-INF/persistence.xml}
72 * @param daoPersistenceUnit the persistence unit to use for JDBC access
74 public void setPersistenceUnit(final String daoPersistenceUnit) {
75 persistenceUnit = daoPersistenceUnit;
79 * Gets the JDBC properties.
81 * @return the JDBC properties
83 public Properties getJdbcProperties() {
84 return jdbcProperties;
88 * Sets the JDBC properties.
90 * @param jdbcProperties the JDBC properties
92 public void setJdbcProperties(final Properties jdbcProperties) {
93 this.jdbcProperties = jdbcProperties;
97 * Gets a single JDBC property.
99 * @param key the key of the property
100 * @return the JDBC property
102 public String getJdbcProperty(final String key) {
103 return jdbcProperties.getProperty(key);
107 * Sets a single JDBC property.
109 * @param key the key of the property
110 * @param value the value of the JDBC property
112 public void setJdbcProperty(final String key, final String value) {
113 jdbcProperties.setProperty(key, value);
119 * @see java.lang.Object#toString()
122 public String toString() {
123 return "DAOParameters [pluginClass=" + pluginClass + ", persistenceUnit=" + persistenceUnit
124 + ", jdbcProperties=" + jdbcProperties + "]";