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 * @author Liam Fallon (liam.fallon@est.tech)
30 public class DaoParameters {
31 /** The default PF DAO plugin class. */
32 public static final String DEFAULT_PLUGIN_CLASS = "org.onap.policy.models.dao.impl.DefaultPfDao";
34 private String pluginClass = DEFAULT_PLUGIN_CLASS;
35 private String persistenceUnit;
37 private Properties jdbcProperties = new Properties();
40 * Gets the DAO plugin class, this is the DAO class to use and it must implement the
41 * {@link PfDao} interface.
43 * @return the DAO plugin class
45 public String getPluginClass() {
50 * Sets the DAO plugin class, a class that implements the {@link PfDao} interface.
52 * @param daoPluginClass the DAO plugin class
54 public void setPluginClass(final String daoPluginClass) {
55 pluginClass = daoPluginClass;
59 * Gets the persistence unit for the DAO. The persistence unit defines the JDBC properties the
60 * DAO will use. The persistence unit must defined in the {@code META-INF/persistence.xml}
63 * @return the persistence unit to use for JDBC access
65 public String getPersistenceUnit() {
66 return persistenceUnit;
70 * Sets the persistence unit for the DAO. The persistence unit defines the JDBC properties the
71 * DAO will use. The persistence unit must defined in the {@code META-INF/persistence.xml}
74 * @param daoPersistenceUnit the persistence unit to use for JDBC access
76 public void setPersistenceUnit(final String daoPersistenceUnit) {
77 persistenceUnit = daoPersistenceUnit;
81 * Gets the JDBC properties.
83 * @return the JDBC properties
85 public Properties getJdbcProperties() {
86 return jdbcProperties;
90 * Sets the JDBC properties.
92 * @param jdbcProperties the JDBC properties
94 public void setJdbcProperties(final Properties jdbcProperties) {
95 this.jdbcProperties = jdbcProperties;
99 * Gets a single JDBC property.
101 * @param key the key of the property
102 * @return the JDBC property
104 public String getJdbcProperty(final String key) {
105 return jdbcProperties.getProperty(key);
109 * Sets a single JDBC property.
111 * @param key the key of the property
112 * @param value the value of the JDBC property
114 public void setJdbcProperty(final String key, final String value) {
115 jdbcProperties.setProperty(key, value);
121 * @see java.lang.Object#toString()
124 public String toString() {
125 return "DAOParameters [pluginClass=" + pluginClass + ", persistenceUnit=" + persistenceUnit
126 + ", jdbcProperties=" + jdbcProperties + "]";