2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020-2021 AT&T Intellectual Property. 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.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.controlloop.ophistory;
23 import lombok.AllArgsConstructor;
24 import lombok.Builder;
26 import lombok.NoArgsConstructor;
27 import org.onap.policy.common.parameters.BeanValidator;
28 import org.onap.policy.common.parameters.ValidationResult;
29 import org.onap.policy.common.parameters.annotations.Min;
30 import org.onap.policy.common.parameters.annotations.NotBlank;
31 import org.onap.policy.common.parameters.annotations.NotNull;
34 * Parameters for a Data Manager.
41 public class OperationHistoryDataManagerParams {
42 public static final String DEFAULT_PU = "OperationsHistoryPU";
43 public static final String DEFAULT_DRIVER = "org.mariadb.jdbc.Driver";
44 public static final String DEFAULT_TYPE = "MySQL";
49 private String userName;
52 private String password;
55 private String persistenceUnit = DEFAULT_PU;
58 private String driver = DEFAULT_DRIVER;
61 private String dbType = DEFAULT_TYPE;
64 * Maximum number of records that can be waiting to be inserted into the DB. When the
65 * limit is reached, the oldest records are discarded.
69 private int maxQueueLength = 10000;
72 * Number of records to add the DB in one transaction.
76 private int batchSize = 100;
79 * Validates the parameters.
81 * @param resultName name of the result
83 * @return the validation result
85 public ValidationResult validate(String resultName) {
86 return new BeanValidator().validateTop(resultName, this);