2 * ===============================LICENSE_START======================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============================LICENSE_END===========================================
21 package org.openecomp.dcae.apod.analytics.common.service.processor;
23 import com.google.common.base.Objects;
25 import java.util.LinkedList;
26 import java.util.List;
30 * An abstract implementation for {@link ProcessorContext} which other DCAE Analytics Modules
31 * can extend to add module specific functionality
34 * @author Rajiv Singla . Creation Date: 11/7/2016.
36 public abstract class AbstractProcessorContext implements ProcessorContext {
38 private final String message;
39 private List<? super MessageProcessor<? extends ProcessorContext>> messageProcessors;
40 private boolean canProcessingContinue;
42 public AbstractProcessorContext(final String message,
43 boolean canProcessingContinue) {
44 this.message = message;
45 this.canProcessingContinue = canProcessingContinue;
46 this.messageProcessors = new LinkedList<>();
50 * Returns JSON String of incoming CEF Message that needs to be processed
52 * @return incoming CEF message that needs to be processed
55 public String getMessage() {
60 * Sets if it is ok to continue processing normally
62 * @return boolean which determines if it is ok to continue processing normally
65 public boolean canProcessingContinue() {
66 return canProcessingContinue;
71 * Set if it is ok to continue processing normally
73 * @param canProcessingContinue sets boolean which determines if it is ok to continue processing normally
76 public void setProcessingContinueFlag(boolean canProcessingContinue) {
77 this.canProcessingContinue = canProcessingContinue;
81 * Provides List of message processors which were used in processing CEF message
83 * @return List of message processors which were used in processing CEF message
86 public List<? super MessageProcessor<? extends ProcessorContext>> getMessageProcessors() {
87 return messageProcessors;
91 public String toString() {
92 return Objects.toStringHelper(this)
93 .add("canProcessingContinue", canProcessingContinue)