2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * Modifications Copyright (C) 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.apex.service.parameters.carriertechnology;
24 import lombok.AccessLevel;
25 import lombok.NoArgsConstructor;
26 import org.onap.policy.common.parameters.ParameterGroupImpl;
27 import org.onap.policy.common.parameters.ParameterRuntimeException;
28 import org.onap.policy.common.parameters.annotations.ClassName;
29 import org.onap.policy.common.parameters.annotations.NotBlank;
30 import org.onap.policy.common.parameters.annotations.NotNull;
33 * The default carrier technology parameter class that may be specialized by carrier technology plugins that require
34 * plugin specific parameters.
36 * <p>The following parameters are defined: <ol> <li>label: The label of the carrier technology.
37 * <li>eventProducerPluginClass: The name of the plugin class that will be used by Apex to produce and emit output
38 * events for this carrier technology <li>eventConsumerPluginClass: The name of the plugin class that will be used by
39 * Apex to receive and process input events from this carrier technology carrier technology </ol>
41 * @author Liam Fallon (liam.fallon@ericsson.com)
45 @NoArgsConstructor(access = AccessLevel.PROTECTED)
46 public abstract class CarrierTechnologyParameters extends ParameterGroupImpl {
48 // The carrier technology label
49 private String label = null;
51 // Producer and Consumer plugin classes for the event producer and consumer for this carrier
53 private @ClassName String eventProducerPluginClass = null;
54 private @ClassName String eventConsumerPluginClass = null;
57 * Gets the label of the carrier technology.
59 * @return the label of the carrier technology
61 public String getLabel() {
66 * Sets the label of the carrier technology.
68 * @param label the label of the carrier technology
70 public void setLabel(final String label) {
72 this.label = label.replaceAll("\\s+", "");
79 * Gets the event producer plugin class.
81 * @return the event producer plugin class
83 public String getEventProducerPluginClass() {
84 return eventProducerPluginClass;
88 * Sets the event producer plugin class.
90 * @param eventProducerPluginClass the new event producer plugin class
92 public void setEventProducerPluginClass(final String eventProducerPluginClass) {
93 if (eventProducerPluginClass != null) {
94 this.eventProducerPluginClass = eventProducerPluginClass.replaceAll("\\s+", "");
96 this.eventProducerPluginClass = null;
101 * Gets the event consumer plugin class.
103 * @return the event consumer plugin class
105 public String getEventConsumerPluginClass() {
106 return eventConsumerPluginClass;
110 * Sets the event consumer plugin class.
112 * @param eventConsumerPluginClass the new event consumer plugin class
114 public void setEventConsumerPluginClass(final String eventConsumerPluginClass) {
115 if (eventConsumerPluginClass != null) {
116 this.eventConsumerPluginClass = eventConsumerPluginClass.replaceAll("\\s+", "");
118 this.eventConsumerPluginClass = null;
126 public String toString() {
127 return "CarrierTechnologyParameters [label=" + label + ", eventProducerPluginClass=" + eventProducerPluginClass
128 + ", eventConsumerPluginClass=" + eventConsumerPluginClass + "]";
132 public String getName() {
133 return this.getLabel();
137 public void setName(final String name) {
138 throw new ParameterRuntimeException(
139 "the name/label of this carrier technology is always \"" + getLabel() + "\"");