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.PolicyModelsProviderFactoryWrapper;
28 import org.onap.policy.pap.main.comm.Publisher;
29 import org.onap.policy.pap.main.comm.TimerManager;
30 import org.onap.policy.pap.main.notification.PolicyNotifier;
34 * Parameters needed to create a {@link PdpModifyRequestMapParams}.
37 public class PdpModifyRequestMapParams {
38 private Publisher<PdpMessage> pdpPublisher;
39 private RequestIdDispatcher<PdpStatus> responseDispatcher;
40 private Object modifyLock;
41 private PdpParameters params;
42 private TimerManager updateTimers;
43 private TimerManager stateChangeTimers;
44 private PolicyModelsProviderFactoryWrapper daoFactory;
45 private PolicyNotifier policyNotifier;
47 public PdpModifyRequestMapParams setParams(PdpParameters params) {
52 public PdpModifyRequestMapParams setUpdateTimers(TimerManager updateTimers) {
53 this.updateTimers = updateTimers;
57 public PdpModifyRequestMapParams setStateChangeTimers(TimerManager stateChangeTimers) {
58 this.stateChangeTimers = stateChangeTimers;
62 public PdpModifyRequestMapParams setDaoFactory(PolicyModelsProviderFactoryWrapper daoFactory) {
63 this.daoFactory = daoFactory;
67 public PdpModifyRequestMapParams setPolicyNotifier(PolicyNotifier policyNotifier) {
68 this.policyNotifier = policyNotifier;
72 public PdpModifyRequestMapParams setPdpPublisher(Publisher<PdpMessage> pdpPublisher) {
73 this.pdpPublisher = pdpPublisher;
77 public PdpModifyRequestMapParams setResponseDispatcher(RequestIdDispatcher<PdpStatus> responseDispatcher) {
78 this.responseDispatcher = responseDispatcher;
82 public PdpModifyRequestMapParams setModifyLock(Object modifyLock) {
83 this.modifyLock = modifyLock;
88 * Validates the parameters.
90 public void validate() {
91 if (pdpPublisher == null) {
92 throw new IllegalArgumentException("missing publisher");
95 if (responseDispatcher == null) {
96 throw new IllegalArgumentException("missing responseDispatcher");
99 if (modifyLock == null) {
100 throw new IllegalArgumentException("missing modifyLock");
103 if (params == null) {
104 throw new IllegalArgumentException("missing PDP parameters");
107 if (updateTimers == null) {
108 throw new IllegalArgumentException("missing updateTimers");
111 if (stateChangeTimers == null) {
112 throw new IllegalArgumentException("missing stateChangeTimers");
115 if (daoFactory == null) {
116 throw new IllegalArgumentException("missing DAO factory");
119 if (policyNotifier == null) {
120 throw new IllegalArgumentException("missing policy notifier");