2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2021-2023 Bell Canada. All rights reserved.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.pap.main.parameters;
24 import lombok.Builder;
26 import org.onap.policy.common.endpoints.listeners.RequestIdDispatcher;
27 import org.onap.policy.models.pdp.concepts.PdpMessage;
28 import org.onap.policy.models.pdp.concepts.PdpStatus;
29 import org.onap.policy.pap.main.comm.Publisher;
30 import org.onap.policy.pap.main.comm.TimerManager;
34 * Parameters needed to create a {@link PdpModifyRequestMapParams}.
38 public class PdpModifyRequestMapParams {
39 private long maxPdpAgeMs;
40 private Publisher<PdpMessage> pdpPublisher;
41 private RequestIdDispatcher<PdpStatus> responseDispatcher;
42 private Object modifyLock;
43 private PdpParameters params;
44 private TimerManager updateTimers;
45 private TimerManager stateChangeTimers;
48 * Validates the parameters.
50 public void validate() {
51 if (maxPdpAgeMs < 1) {
52 throw new IllegalArgumentException("maxPdpAgeMs must be >= 1");
55 if (pdpPublisher == null) {
56 throw new IllegalArgumentException("missing publisher");
59 if (responseDispatcher == null) {
60 throw new IllegalArgumentException("missing responseDispatcher");
63 if (modifyLock == null) {
64 throw new IllegalArgumentException("missing modifyLock");
68 throw new IllegalArgumentException("missing PDP parameters");
71 if (updateTimers == null) {
72 throw new IllegalArgumentException("missing updateTimers");
75 if (stateChangeTimers == null) {
76 throw new IllegalArgumentException("missing stateChangeTimers");