2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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.pap.main.parameters;
24 import org.onap.policy.common.endpoints.listeners.RequestIdDispatcher;
25 import org.onap.policy.models.pdp.concepts.PdpMessage;
26 import org.onap.policy.models.pdp.concepts.PdpStatus;
27 import org.onap.policy.pap.main.comm.Publisher;
28 import org.onap.policy.pap.main.comm.TimerManager;
32 * Parameters needed to create a Request.
35 public class RequestParams {
36 private Publisher<PdpMessage> pdpPublisher;
37 private RequestIdDispatcher<PdpStatus> responseDispatcher;
38 private Object modifyLock;
39 private TimerManager timers;
40 private int maxRetryCount;
43 public RequestParams setPdpPublisher(Publisher<PdpMessage> publisher) {
44 this.pdpPublisher = publisher;
48 public RequestParams setResponseDispatcher(RequestIdDispatcher<PdpStatus> responseDispatcher) {
49 this.responseDispatcher = responseDispatcher;
53 public RequestParams setModifyLock(Object modifyLock) {
54 this.modifyLock = modifyLock;
58 public RequestParams setTimers(TimerManager timers) {
63 public RequestParams setMaxRetryCount(int maxRetryCount) {
64 this.maxRetryCount = maxRetryCount;
69 * Validates the parameters.
71 public void validate() {
72 if (pdpPublisher == null) {
73 throw new IllegalArgumentException("missing publisher");
76 if (responseDispatcher == null) {
77 throw new IllegalArgumentException("missing responseDispatcher");
80 if (modifyLock == null) {
81 throw new IllegalArgumentException("missing modifyLock");
85 throw new IllegalArgumentException("missing timers");