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 token delimited textual event protocols that may be
27 * specialized by event protocol plugins that require plugin specific parameters.
30 * The following parameters are defined:
32 * <li>delimiterToken: the token string that delimits text blocks that contain events.
35 * @author Liam Fallon (liam.fallon@ericsson.com)
37 public abstract class EventProtocolTextTokenDelimitedParameters extends EventProtocolParameters
38 implements ApexParameterValidator {
39 // The delimiter token for text blocks
40 private String delimiterToken = null;
43 * Constructor to create an event protocol parameters instance with the name of a sub class of
46 * @param parameterClassName the class name of a sub class of this class
48 public EventProtocolTextTokenDelimitedParameters(final String parameterClassName) {
49 super(parameterClassName);
53 * Gets the delimiter token that delimits events in the text.
55 * @return the delimiter token
57 public String getDelimiterToken() {
58 return delimiterToken;
63 * Sets the delimiter token that delimits events in the text.
65 * @param delimiterToken the delimiter token
67 public void setDelimiterToken(final String delimiterToken) {
68 this.delimiterToken = delimiterToken;
73 public String toString() {
74 return "EventProtocolTextCharDelimitedParameters {" + super.toString() + "} [delimiterToken=" + delimiterToken
81 * @see org.onap.policy.apex.service.parameters.ApexParameterValidator#validate()
84 public String validate() {
85 final StringBuilder errorMessageBuilder = new StringBuilder();
87 errorMessageBuilder.append(super.validate());
89 if (delimiterToken == null || delimiterToken.length() == 0) {
90 errorMessageBuilder.append(" text delimiter token not specified or is blank\n");
93 return errorMessageBuilder.toString();