2 * ===============================LICENSE_START======================================
\r
4 * ================================================================================
\r
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============================LICENSE_END===========================================
\r
21 package org.openecomp.dcae.apod.analytics.common.service.processor;
\r
23 import com.google.common.base.Function;
\r
24 import com.google.common.base.Optional;
\r
26 import java.io.Serializable;
\r
30 * A message processor can be used to process incoming messages.
\r
31 * It uses implementations of {@link ProcessorContext} as input and output
\r
34 * @param <P> Message Processor Context implementations
\r
36 * @author Rajiv Singla . Creation Date: 11/7/2016.
\r
38 public interface MessageProcessor<P extends ProcessorContext> extends Function<P, P>, Serializable {
\r
41 * Returns processor information
\r
43 * @return processor Information
\r
45 ProcessorInfo getProcessorInfo();
\r
49 * Does pre-processing of {@link ProcessorContext} e.g. validate input conditions and return
\r
50 * pre processed context
\r
52 * @param processorContext incoming Processor Context
\r
53 * @return Pre processed Processor Context
\r
55 P preProcessor(P processorContext);
\r
59 * Return processing state of a processor
\r
61 * @return Processing State
\r
63 ProcessingState getProcessingState();
\r
67 * May return a message from a processor which indicates the reason for {@link ProcessingState} especially if
\r
68 * there was some failure in processing
\r
70 * @return processing Message
\r
72 Optional<String> getProcessingMessage();
\r
76 * Does post-processing of {@link ProcessorContext}
\r
78 * @param processorContext incoming Processor Context
\r
79 * @return processor Context after post processing is finished
\r
81 P postProcessor(P processorContext);
\r