2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation.
4 * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
5 * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * SPDX-License-Identifier: Apache-2.0
20 * ============LICENSE_END=========================================================
23 package org.onap.policy.models.provider;
26 import org.onap.policy.common.parameters.BeanValidationResult;
27 import org.onap.policy.common.parameters.BeanValidator;
28 import org.onap.policy.common.parameters.ParameterGroup;
29 import org.onap.policy.common.parameters.annotations.NotBlank;
30 import org.onap.policy.common.parameters.annotations.NotNull;
31 import org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl;
35 * Class to hold all the plugin handler parameters.
37 * <p>The following parameters are defined:
39 * <li>name: A name for the parameters.
40 * <li>implementation: The implementation of the PolicyModelsProvider to use for writing and reading concepts,
41 * defaults to {@link DatabasePolicyModelsProviderImpl} and may not be null
42 * <li>databaseUrl: The JDBC URL for the database, mandatory.
43 * <li>databaseUser: The user id to use for connecting to the database, optional, defaults to null.
44 * <li>databasePassword: The password to use for connecting to the database, optional,
46 * <li>persistenceUnit: The persistence unit refined in META-INF/persistence.xml to use for connecting
47 * to the database, mandatory.
50 * @author Liam Fallon (liam.fallon@est.tech)
55 public class PolicyModelsProviderParameters implements ParameterGroup {
56 private static final String DEFAULT_IMPLEMENTATION = DatabasePolicyModelsProviderImpl.class.getName();
60 private String implementation = DEFAULT_IMPLEMENTATION;
61 private String databaseType;
63 private String databaseDriver;
65 private String databaseUrl;
66 private String databaseUser;
67 private String databasePassword;
69 private String persistenceUnit;
72 * Validate the model provider parameters.
77 public BeanValidationResult validate() {
78 return new BeanValidator().validateTop(getClass().getSimpleName(), this);