2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.apex.plugins.event.carrier.restrequestor;
23 import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters;
26 * Apex parameters for REST as an event carrier technology with Apex issuing a REST request and receiving a REST
29 * <p>The parameters for this plugin are:
31 * <li>url: The URL that the Apex Rest Requestor will connect to over REST for REST request sending. This parameter is
33 * <li>httpMethod: The HTTP method to use when making requests over REST, legal values are GET (default), POST, PUT, and
35 * <li>restRequestTimeout: The time in milliseconds to wait for a REST request to complete.
38 * @author Liam Fallon (liam.fallon@ericsson.com)
40 public class RestRequestorCarrierTechnologyParameters extends CarrierTechnologyParameters {
41 /** The supported HTTP methods. */
42 public enum HttpMethod {
43 GET, PUT, POST, DELETE
46 /** The label of this carrier technology. */
47 public static final String RESTREQUESTOR_CARRIER_TECHNOLOGY_LABEL = "RESTREQUESTOR";
49 /** The producer plugin class for the REST carrier technology. */
50 public static final String RESTREQUSTOR_EVENT_PRODUCER_PLUGIN_CLASS =
51 ApexRestRequestorProducer.class.getCanonicalName();
53 /** The consumer plugin class for the REST carrier technology. */
54 public static final String RESTREQUSTOR_EVENT_CONSUMER_PLUGIN_CLASS =
55 ApexRestRequestorConsumer.class.getCanonicalName();
57 /** The default HTTP method for request events. */
58 public static final HttpMethod DEFAULT_REQUESTOR_HTTP_METHOD = HttpMethod.GET;
60 /** The default timeout for REST requests. */
61 public static final long DEFAULT_REST_REQUEST_TIMEOUT = 500;
63 private String url = null;
64 private HttpMethod httpMethod = null;
67 * Constructor to create a REST carrier technology parameters instance and register the instance with the parameter
70 public RestRequestorCarrierTechnologyParameters() {
73 // Set the carrier technology properties for the web socket carrier technology
74 this.setLabel(RESTREQUESTOR_CARRIER_TECHNOLOGY_LABEL);
75 this.setEventProducerPluginClass(RESTREQUSTOR_EVENT_PRODUCER_PLUGIN_CLASS);
76 this.setEventConsumerPluginClass(RESTREQUSTOR_EVENT_CONSUMER_PLUGIN_CLASS);
80 * Gets the URL for the REST request.
84 public String getUrl() {
89 * Sets the URL for the REST request.
91 * @param incomingUrl the URL
93 public void setUrl(final String incomingUrl) {
94 this.url = incomingUrl;
98 * Gets the HTTP method to use for the REST request.
100 * @return the HTTP method
102 public HttpMethod getHttpMethod() {
107 * Sets the HTTP method to use for the REST request.
109 * @param httpMethod the HTTP method
111 public void setHttpMethod(final HttpMethod httpMethod) {
112 this.httpMethod = httpMethod;
118 * @see java.lang.Object#toString()
122 public String toString() {
123 return "RESTRequestorCarrierTechnologyParameters [url=" + url + ", httpMethod=" + httpMethod + "]";