2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation.
4 * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.models.sim.dmaap.parameters;
24 import java.util.Properties;
26 import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
27 import org.onap.policy.common.gson.GsonMessageBodyHandler;
28 import org.onap.policy.common.parameters.ParameterGroupImpl;
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;
32 import org.onap.policy.models.sim.dmaap.rest.CambriaMessageBodyHandler;
33 import org.onap.policy.models.sim.dmaap.rest.DmaapSimRestControllerV1;
34 import org.onap.policy.models.sim.dmaap.rest.TextMessageBodyHandler;
37 * Class to hold all parameters needed for rest server.
42 public class RestServerParameters extends ParameterGroupImpl {
48 public RestServerParameters() {
49 super(RestServerParameters.class.getSimpleName());
53 * Creates a set of properties, suitable for building a REST server, from the
56 * @return a set of properties representing the given parameters
58 public Properties getServerProperties() {
59 final var props = new Properties();
60 props.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES, getName());
63 PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + getName();
65 props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX, getHost());
66 props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX,
67 Integer.toString(getPort()));
68 props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX,
69 DmaapSimRestControllerV1.class.getName());
70 props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "false");
71 props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SWAGGER_SUFFIX, "false");
73 props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER,
74 String.join(",", CambriaMessageBodyHandler.class.getName(),
75 GsonMessageBodyHandler.class.getName(),
76 TextMessageBodyHandler.class.getName()));