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.service.parameters.eventprotocol;
23 import org.onap.policy.apex.service.parameters.ApexParameterValidator;
26 * An event protocol parameter class for character delimited textual event protocols that may be
27 * specialized by event protocol plugins that require plugin specific parameters.
29 * <p>The following parameters are defined:
31 * <li>startChar: starting character delimiter for text blocks containing an event.
32 * <li>endChar: ending character delimiter for text blocks containing an event.
35 * @author Liam Fallon (liam.fallon@ericsson.com)
37 public abstract class EventProtocolTextCharDelimitedParameters extends EventProtocolParameters
38 implements ApexParameterValidator {
39 // The starting and ending character delimiter
40 private char startChar = '\0';
41 private char endChar = '\0';
44 * Constructor to create an event protocol parameters instance with the name of a sub class of
47 * @param parameterClassName the class name of a sub class of this class
49 public EventProtocolTextCharDelimitedParameters(final String parameterClassName) {
50 super(parameterClassName);
54 * Gets the start character that delimits the start of text blocks.
56 * @return the start char
58 public char getStartChar() {
63 * Sets the start character that delimits the start of text blocks.
65 * @param startChar the start character
67 public void setStartChar(final char startChar) {
68 this.startChar = startChar;
72 * Gets the end character that delimits the end of text blocks.
74 * @return the end character
76 public char getEndChar() {
81 * Sets the end character that delimits the end of text blocks.
83 * @param endChar the end character
85 public void setEndChar(final char endChar) {
86 this.endChar = endChar;
92 * @see org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParameters#toString()
95 public String toString() {
96 return "EventProtocolTextCharDelimitedParameters {" + super.toString() + "} [startChar=" + startChar
97 + ", endChar=" + endChar + "]";
103 * @see org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParameters#validate()
106 public String validate() {
107 final StringBuilder errorMessageBuilder = new StringBuilder();
109 errorMessageBuilder.append(super.validate());
111 if (startChar == '\0') {
112 errorMessageBuilder.append(" text character delimited start character has not been specified\n");
115 if (endChar == '\0') {
116 errorMessageBuilder.append(" text character delimited end character has not been specified\n");
119 return errorMessageBuilder.toString();