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 org.onap.policy.common.parameters.ParameterGroupImpl;
25 import org.onap.policy.common.parameters.ParameterRuntimeException;
26 import org.onap.policy.common.parameters.annotations.ClassName;
27 import org.onap.policy.common.parameters.annotations.NotBlank;
28 import org.onap.policy.common.parameters.annotations.NotNull;
31 * The default carrier technology parameter class that may be specialized by carrier technology plugins that require
32 * plugin specific parameters.
34 * <p>The following parameters are defined: <ol> <li>label: The label of the carrier technology.
35 * <li>eventProducerPluginClass: The name of the plugin class that will be used by Apex to produce and emit output
36 * events for this carrier technology <li>eventConsumerPluginClass: The name of the plugin class that will be used by
37 * Apex to receive and process input events from this carrier technology carrier technology </ol>
39 * @author Liam Fallon (liam.fallon@ericsson.com)
43 public abstract class CarrierTechnologyParameters extends ParameterGroupImpl {
45 // The carrier technology label
46 private String label = null;
48 // Producer and Consumer plugin classes for the event producer and consumer for this carrier
50 private @ClassName String eventProducerPluginClass = null;
51 private @ClassName String eventConsumerPluginClass = null;
54 * Constructor to create a carrier technology parameters instance with the name of a sub class of this class and
55 * register the instance with the parameter service.
57 protected CarrierTechnologyParameters() {
62 * Gets the label of the carrier technology.
64 * @return the label of the carrier technology
66 public String getLabel() {
71 * Sets the label of the carrier technology.
73 * @param label the label of the carrier technology
75 public void setLabel(final String label) {
77 this.label = label.replaceAll("\\s+", "");
84 * Gets the event producer plugin class.
86 * @return the event producer plugin class
88 public String getEventProducerPluginClass() {
89 return eventProducerPluginClass;
93 * Sets the event producer plugin class.
95 * @param eventProducerPluginClass the new event producer plugin class
97 public void setEventProducerPluginClass(final String eventProducerPluginClass) {
98 if (eventProducerPluginClass != null) {
99 this.eventProducerPluginClass = eventProducerPluginClass.replaceAll("\\s+", "");
101 this.eventProducerPluginClass = null;
106 * Gets the event consumer plugin class.
108 * @return the event consumer plugin class
110 public String getEventConsumerPluginClass() {
111 return eventConsumerPluginClass;
115 * Sets the event consumer plugin class.
117 * @param eventConsumerPluginClass the new event consumer plugin class
119 public void setEventConsumerPluginClass(final String eventConsumerPluginClass) {
120 if (eventConsumerPluginClass != null) {
121 this.eventConsumerPluginClass = eventConsumerPluginClass.replaceAll("\\s+", "");
123 this.eventConsumerPluginClass = null;
131 public String toString() {
132 return "CarrierTechnologyParameters [label=" + label + ", eventProducerPluginClass=" + eventProducerPluginClass
133 + ", eventConsumerPluginClass=" + eventConsumerPluginClass + "]";
137 public String getName() {
138 return this.getLabel();
142 public void setName(final String name) {
143 throw new ParameterRuntimeException(
144 "the name/label of this carrier technology is always \"" + getLabel() + "\"");