2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2020 Nordix Foundation.
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.grpc;
25 import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters;
26 import org.onap.policy.common.parameters.annotations.Max;
27 import org.onap.policy.common.parameters.annotations.Min;
28 import org.onap.policy.common.parameters.annotations.NotNull;
32 * Apex parameters for gRPC as an event carrier technology.
34 * <p>The parameters for this plugin are:
36 * <li>host: The host on which CDS is running. This parameter is mandatory
37 * <li>port: The port on the CDS host to connect to for CDS. This parameter is mandatory.
38 * <li>username: The username for basic authentication to connect to CDS. This parameter is mandatory.
39 * <li>password: The password for basic authentication to connect to CDS. This parameter is mandatory.
40 * <li>timeout: The timeout in seconds for CDS requests. This parameter is mandatory.
43 * @author Ajith Sreekumar(ajith.sreekumar@est.tech)
48 public class GrpcCarrierTechnologyParameters extends CarrierTechnologyParameters {
50 private static final int MIN_USER_PORT = 1024;
51 private static final int MAX_USER_PORT = 65535;
53 /** The label of this carrier technology. */
54 public static final String GRPC_CARRIER_TECHNOLOGY_LABEL = "GRPC";
56 /** The producer plugin class for the grpc carrier technology. */
57 public static final String GRPC_EVENT_PRODUCER_PLUGIN_CLASS = ApexGrpcProducer.class.getName();
59 /** The consumer plugin class for the gRPC carrier technology. */
60 public static final String GRPC_EVENT_CONSUMER_PLUGIN_CLASS = ApexGrpcConsumer.class.getName();
65 @Min(value = MIN_USER_PORT)
66 @Max(value = MAX_USER_PORT)
73 private String username;
76 private String password;
80 * Constructor to create a gRPC carrier technology parameters instance and register the instance with the
83 public GrpcCarrierTechnologyParameters() {
85 // Set the carrier technology properties for the gRPC carrier technology
86 this.setLabel(GRPC_CARRIER_TECHNOLOGY_LABEL);
87 this.setEventProducerPluginClass(GRPC_EVENT_PRODUCER_PLUGIN_CLASS);
88 this.setEventConsumerPluginClass(GRPC_EVENT_CONSUMER_PLUGIN_CLASS);