Add docker file for all simulators
[policy/models.git] / models-sim / policy-models-simulators / src / main / java / org / onap / policy / models / simulators / SimulatorParameters.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP
4  * ================================================================================
5  * Copyright (C) 2020 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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20
21 package org.onap.policy.models.simulators;
22
23 import java.util.LinkedList;
24 import java.util.List;
25 import lombok.Getter;
26 import org.onap.policy.common.endpoints.parameters.TopicParameters;
27 import org.onap.policy.common.parameters.BeanValidationResult;
28 import org.onap.policy.common.parameters.BeanValidator;
29 import org.onap.policy.common.parameters.annotations.NotNull;
30 import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterGroup;
31
32 /**
33  * Simulator parameters.
34  */
35 @Getter
36 @NotNull
37 public class SimulatorParameters {
38
39     /**
40      * Note: this is only used to capture the provider's parameters; the rest server
41      * parameters that it contains are ignored. Instead, the parameters for the rest
42      * server are contained within the {@link #restServers} entry having the same name as
43      * the provider parameters.
44      */
45     private DmaapSimParameterGroup dmaapProvider;
46
47     /**
48      * Parameters for the REST server simulators that are to be started.
49      */
50     private List<ClassRestServerParameters> restServers = new LinkedList<>();
51
52     /**
53      * Topic sinks that are used by {@link #topicServers}.
54      */
55     private List<TopicParameters> topicSinks = new LinkedList<>();
56
57     /**
58      * Topic sources that are used by {@link #topicServers}.
59      */
60     private List<TopicParameters> topicSources = new LinkedList<>();
61
62     /**
63      * Parameters for the TOPIC server simulators that are to be started.
64      */
65     private List<TopicServerParameters> topicServers = new LinkedList<>();
66
67
68     /**
69      * Validates the parameters.
70      *
71      * @param containerName name of the parameter container
72      * @return the validation result
73      */
74     public BeanValidationResult validate(String containerName) {
75         BeanValidationResult result = new BeanValidator().validateTop(containerName, this);
76
77         result.validateList("restServers", restServers, params -> params.validate("restServers"));
78         result.validateList("topicServers", topicServers, params -> params.validate("topicServers"));
79
80         return result;
81     }
82 }