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.eventprotocol;
24 import org.onap.policy.common.parameters.GroupValidationResult;
25 import org.onap.policy.common.parameters.ValidationStatus;
28 * An event protocol parameter class for character delimited textual event protocols that may be specialized by event
29 * protocol plugins that require plugin specific parameters.
31 * <p>The following parameters are defined:
33 * <li>startChar: starting character delimiter for text blocks containing an event.
34 * <li>endChar: ending character delimiter for text blocks containing an event.
37 * @author Liam Fallon (liam.fallon@ericsson.com)
39 public abstract class EventProtocolTextCharDelimitedParameters extends EventProtocolParameters {
40 // The starting and ending character delimiter
41 private char startChar = '\0';
42 private char endChar = '\0';
45 * Constructor to create an event protocol parameters instance with the name of a sub class of this class.
47 protected EventProtocolTextCharDelimitedParameters() {
52 * Gets the start character that delimits the start of text blocks.
54 * @return the start char
56 public char getStartChar() {
61 * Sets the start character that delimits the start of text blocks.
63 * @param startChar the start character
65 public void setStartChar(final char startChar) {
66 this.startChar = startChar;
70 * Gets the end character that delimits the end of text blocks.
72 * @return the end character
74 public char getEndChar() {
79 * Sets the end character that delimits the end of text blocks.
81 * @param endChar the end character
83 public void setEndChar(final char endChar) {
84 this.endChar = endChar;
91 public String toString() {
92 return "EventProtocolTextCharDelimitedParameters {" + super.toString() + "} [startChar=" + startChar
93 + ", endChar=" + endChar + "]";
100 public GroupValidationResult validate() {
101 final GroupValidationResult result = super.validate();
103 if (startChar == '\0') {
104 result.setResult("startChar", ValidationStatus.INVALID,
105 "text character delimited start character has not been specified");
108 if (endChar == '\0') {
109 result.setResult("endChar", ValidationStatus.INVALID,
110 "text character delimited end character has not been specified\n");