aboutsummaryrefslogtreecommitdiffstats
path: root/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service
diff options
context:
space:
mode:
Diffstat (limited to 'dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service')
-rw-r--r--dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/filter/GenericJsonMessageFilter.java112
-rw-r--r--dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/filter/JsonMessageFilterProcessorContext.java57
-rw-r--r--dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractMessageProcessor.java162
-rw-r--r--dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractProcessorContext.java96
-rw-r--r--dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericMessageChainProcessor.java70
-rw-r--r--dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericProcessorInfo.java57
-rw-r--r--dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/MessageProcessor.java84
-rw-r--r--dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/ProcessingState.java36
-rw-r--r--dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/ProcessorContext.java70
-rw-r--r--dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/ProcessorInfo.java49
10 files changed, 793 insertions, 0 deletions
diff --git a/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/filter/GenericJsonMessageFilter.java b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/filter/GenericJsonMessageFilter.java
new file mode 100644
index 0000000..8583b9c
--- /dev/null
+++ b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/filter/GenericJsonMessageFilter.java
@@ -0,0 +1,112 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.filter;
+
+import com.google.common.collect.ImmutableSet;
+import com.jayway.jsonpath.DocumentContext;
+import com.jayway.jsonpath.JsonPath;
+import com.jayway.jsonpath.PathNotFoundException;
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.dcae.apod.analytics.common.service.processor.AbstractMessageProcessor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Set;
+
+/**
+ * A Generic Json Message Filter which filter the json message based on given json Path and list of expected values
+ * for that json path. The {@link JsonMessageFilterProcessorContext#isMatched} flag will be changed as per table below:
+ * <pre>
+ * Incoming message is blank or invalid Json = null
+ * Incoming message path is matches expected values = true
+ * Incoming message does not match expected values or path does not exist = false
+ * </pre>
+ * <p>
+ * @author Rajiv Singla . Creation Date: 2/10/2017.
+ */
+public class GenericJsonMessageFilter extends AbstractMessageProcessor<JsonMessageFilterProcessorContext> {
+
+ private static final Logger LOG = LoggerFactory.getLogger(GenericJsonMessageFilter.class);
+ private static final long serialVersionUID = 1L;
+
+ private final String filterName;
+ private final String jsonPath;
+ private final Set<String> expectedValues;
+
+ public GenericJsonMessageFilter(final String filterName, final String jsonPath, final Set<String> expectedValues) {
+ this.filterName = filterName;
+ this.jsonPath = jsonPath;
+ this.expectedValues = expectedValues;
+ }
+
+ public GenericJsonMessageFilter(final String filterName, final String jsonPath, final String expectedValue) {
+ this(filterName, jsonPath, ImmutableSet.of(expectedValue));
+ }
+
+ @Override
+ public String getProcessorDescription() {
+ return filterName;
+ }
+
+ @Override
+ public JsonMessageFilterProcessorContext processMessage(final JsonMessageFilterProcessorContext processorContext) {
+
+ final String jsonMessage = processorContext.getMessage().trim();
+
+ if (StringUtils.isNotBlank(jsonMessage) && jsonMessage.startsWith("{") && jsonMessage.endsWith("}")) {
+
+ // locate json path value
+ final DocumentContext documentContext = JsonPath.parse(jsonMessage);
+ String jsonPathValue = null;
+ try {
+ jsonPathValue = documentContext.read(jsonPath, String.class);
+ } catch (PathNotFoundException ex) {
+ LOG.info("Unable to find json Path: {}. Exception: {}, Json Message: {}", jsonPath, ex, jsonMessage);
+ }
+
+ LOG.debug("Value for jsonPath: {}, jsonPathValue: {}, expected Values: {}",
+ jsonPath, jsonPathValue, expectedValues);
+
+ // if json path value is null or we json value is not present in expect values then terminate early
+ if (jsonPathValue == null || !expectedValues.contains(jsonPathValue)) {
+ final String terminatingMessage = String.format("Filter match unsuccessful. " +
+ "JsonPath: %s, Actual JsonPathValue: %s, Excepted Json Path Values: %s",
+ jsonPath, jsonPathValue, expectedValues);
+ processorContext.setMatched(false);
+ setTerminatingProcessingMessage(terminatingMessage, processorContext);
+ } else {
+ final String finishProcessingMessage = String.format("Filter match successful. " +
+ "JsonPath: %s, Actual JsonPathValue: %s, Excepted Json Path Values: %s",
+ jsonPath, jsonPathValue, expectedValues);
+ processorContext.setMatched(true);
+ setFinishedProcessingMessage(finishProcessingMessage, processorContext);
+ }
+ } else {
+ // if incoming message is blank of valid Json then matched flag will be null
+ final String terminatingMessage = "Incoming json message is blank or not json. " +
+ "Json filter cannot be applied";
+ processorContext.setMatched(null);
+ setTerminatingProcessingMessage(terminatingMessage, processorContext);
+ }
+
+ return processorContext;
+ }
+}
diff --git a/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/filter/JsonMessageFilterProcessorContext.java b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/filter/JsonMessageFilterProcessorContext.java
new file mode 100644
index 0000000..d27c363
--- /dev/null
+++ b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/filter/JsonMessageFilterProcessorContext.java
@@ -0,0 +1,57 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.filter;
+
+import org.openecomp.dcae.apod.analytics.common.service.processor.AbstractProcessorContext;
+
+/**
+ * A processor context for Json Message Filter Processor
+ * <p>
+ * @author Rajiv Singla . Creation Date: 2/10/2017.
+ */
+public class JsonMessageFilterProcessorContext extends AbstractProcessorContext {
+
+ private static final long serialVersionUID = 1L;
+
+ private Boolean isMatched;
+
+ public JsonMessageFilterProcessorContext(final String jsonMessageString) {
+ super(jsonMessageString, true);
+ }
+
+ /**
+ * Returns true if Json Message Filter match was successful
+ *
+ * @return true if Json Message Filter match was successful, false if filter was match was unsuccessful
+ */
+ public Boolean getMatched() {
+ return isMatched;
+ }
+
+ /**
+ * Sets the value for Json Message Filter match
+ *
+ * @param matched new value for json message filter match
+ */
+ public void setMatched(final Boolean matched) {
+ isMatched = matched;
+ }
+}
diff --git a/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractMessageProcessor.java b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractMessageProcessor.java
new file mode 100644
index 0000000..fdaa6cb
--- /dev/null
+++ b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractMessageProcessor.java
@@ -0,0 +1,162 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+import com.google.common.base.Optional;
+import org.openecomp.dcae.apod.analytics.common.exception.MessageProcessingException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.Nonnull;
+
+import static java.lang.String.format;
+
+/**
+ * An abstract Message Processor which can be extended by {@link MessageProcessor} implementations
+ * to get default behavior for Message Processors
+ *
+ * @param <P> Processor Context sub classes
+ *
+ * @author Rajiv Singla . Creation Date: 11/8/2016.
+ */
+public abstract class AbstractMessageProcessor<P extends ProcessorContext> implements MessageProcessor<P> {
+
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractMessageProcessor.class);
+
+ /**
+ * By Default there is no processing message
+ */
+ private String processingMessage = null;
+
+ /**
+ * By Default Processing State is set to not required - subclasses must
+ * set processing state to {@link ProcessingState#PROCESSING_FINISHED_SUCCESSFULLY} on successful processing
+ * or {@link ProcessingState#PROCESSING_TERMINATED_EARLY} if processing fails
+ */
+ protected ProcessingState processingState = ProcessingState.PROCESSING_NOT_REQUIRED;
+
+ /**
+ * Sub classes must provide a description of a processor
+ *
+ * @return description of processor
+ *
+ */
+ public abstract String getProcessorDescription();
+
+
+ /**
+ * Sub classes must provide implementation to process Message
+ *
+ * @param processorContext incoming {@link ProcessorContext}
+ * @return outgoing {@link ProcessorContext}
+ */
+ public abstract P processMessage(P processorContext);
+
+ @Override
+ public ProcessorInfo getProcessorInfo() {
+ // by default the class of the Processor is assigned as Processor Name
+ final String processorClassName = getClass().getSimpleName();
+ return new GenericProcessorInfo(processorClassName, getProcessorDescription());
+ }
+
+ @Override
+ public P preProcessor(P processorContext) {
+ LOG.debug("Processing Started for Processor: {}", getProcessorInfo().getProcessorName());
+ // by default check to see if continue processing Flag is not false
+ final boolean okToContinue = processorContext.canProcessingContinue();
+ if (!okToContinue) {
+ final String errorMessage =
+ format("Processor: %s. Processing Context flag okToContinue is false. Unable to proceed...",
+ getProcessorInfo().getProcessorName());
+ throw new MessageProcessingException(errorMessage, LOG, new IllegalStateException(errorMessage));
+ }
+ processingState = ProcessingState.PROCESSING_STARTED;
+ return processorContext;
+ }
+
+ @Override
+ public ProcessingState getProcessingState() {
+ return processingState;
+ }
+
+ @Override
+ public Optional<String> getProcessingMessage() {
+ return Optional.fromNullable(processingMessage);
+ }
+
+ @Override
+ public P postProcessor(P processorContext) {
+ // Default implementation updates the post processing flag if processing did not
+ // completed successfully
+ if (processingState != ProcessingState.PROCESSING_FINISHED_SUCCESSFULLY) {
+ LOG.debug("Processor: {}, Update Process Context State to stop Processing.",
+ getProcessorInfo().getProcessorName());
+ processorContext.setProcessingContinueFlag(false);
+ }
+ // attaches itself to message processor context
+ processorContext.getMessageProcessors().add(this);
+ LOG.debug("Processing Completed for Processor: {}", getProcessorInfo());
+ return processorContext;
+ }
+
+
+ @Override
+ public final P apply(@Nonnull P processorContext) {
+ final P preProcessedProcessorContext = preProcessor(processorContext);
+ final P processedProcessorContext = processMessage(preProcessedProcessorContext);
+ return postProcessor(processedProcessorContext);
+ }
+
+
+ /**
+ * Helper method that updates processing state in case of early termination, logs the processing
+ * termination reason, updates Processor processing state as Terminated and sets it processing message
+ *
+ * @param terminatingMessage error Message
+ * @param processorContext message processor context
+ */
+ protected void setTerminatingProcessingMessage(final String terminatingMessage,
+ final P processorContext) {
+
+ final String message = processorContext.getMessage();
+ this.processingState = ProcessingState.PROCESSING_TERMINATED_EARLY;
+ this.processingMessage = terminatingMessage;
+ LOG.debug("Processor: {}, Early Terminating Message: {}, Incoming Message: {}",
+ getProcessorInfo().getProcessorName(), terminatingMessage, message);
+ }
+
+ /**
+ * Helper method that updates Processing state and logs completion message
+ * passed
+ *
+ * @param processorPassingMessage Processor passing message
+ * @param processorContext message processor context
+ */
+ protected void setFinishedProcessingMessage(final String processorPassingMessage, P processorContext) {
+ final String message = processorContext.getMessage();
+ processingState = ProcessingState.PROCESSING_FINISHED_SUCCESSFULLY;
+ this.processingMessage = processorPassingMessage;
+ LOG.debug("Processor: {}, Successful Completion Message: {}, Incoming Message: {}",
+ getProcessorInfo().getProcessorName(), processorPassingMessage, message);
+ }
+
+
+}
diff --git a/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractProcessorContext.java b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractProcessorContext.java
new file mode 100644
index 0000000..a2501e3
--- /dev/null
+++ b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/AbstractProcessorContext.java
@@ -0,0 +1,96 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+import com.google.common.base.Objects;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * <p>
+ * An abstract implementation for {@link ProcessorContext} which other DCAE Analytics Modules
+ * can extend to add module specific functionality
+ * </p>
+ *
+ * @author Rajiv Singla . Creation Date: 11/7/2016.
+ */
+public abstract class AbstractProcessorContext implements ProcessorContext {
+
+ private final String message;
+ private List<? super MessageProcessor<? extends ProcessorContext>> messageProcessors;
+ private boolean canProcessingContinue;
+
+ public AbstractProcessorContext(final String message,
+ boolean canProcessingContinue) {
+ this.message = message;
+ this.canProcessingContinue = canProcessingContinue;
+ this.messageProcessors = new LinkedList<>();
+ }
+
+ /**
+ * Returns JSON String of incoming CEF Message that needs to be processed
+ *
+ * @return incoming CEF message that needs to be processed
+ */
+ @Override
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Sets if it is ok to continue processing normally
+ *
+ * @return boolean which determines if it is ok to continue processing normally
+ */
+ @Override
+ public boolean canProcessingContinue() {
+ return canProcessingContinue;
+ }
+
+
+ /**
+ * Set if it is ok to continue processing normally
+ *
+ * @param canProcessingContinue sets boolean which determines if it is ok to continue processing normally
+ */
+ @Override
+ public void setProcessingContinueFlag(boolean canProcessingContinue) {
+ this.canProcessingContinue = canProcessingContinue;
+ }
+
+ /**
+ * Provides List of message processors which were used in processing CEF message
+ *
+ * @return List of message processors which were used in processing CEF message
+ */
+ @Override
+ public List<? super MessageProcessor<? extends ProcessorContext>> getMessageProcessors() {
+ return messageProcessors;
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("canProcessingContinue", canProcessingContinue)
+ .toString();
+ }
+}
diff --git a/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericMessageChainProcessor.java b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericMessageChainProcessor.java
new file mode 100644
index 0000000..982641d
--- /dev/null
+++ b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericMessageChainProcessor.java
@@ -0,0 +1,70 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+import org.openecomp.dcae.apod.analytics.common.utils.MessageProcessorUtils.MessageProcessorFunction;
+
+import java.util.List;
+
+import static org.openecomp.dcae.apod.analytics.common.utils.MessageProcessorUtils.computeMessageProcessorChain;
+
+/**
+ * <p>
+ * A Generic Message Processor which passes the {@link ProcessorContext} from first to second
+ * {@link MessageProcessor}
+ * </p>
+ *
+ * @param <P> Processor Context sub classes
+ *
+ * @author Rajiv Singla . Creation Date: 11/8/2016.
+ */
+public class GenericMessageChainProcessor<P extends ProcessorContext> {
+
+ private final List<? extends MessageProcessor<P>> messageProcessors;
+ private final P initialProcessorContext;
+
+ public GenericMessageChainProcessor(List<? extends MessageProcessor<P>> messageProcessors,
+ P initialProcessorContext) {
+ this.messageProcessors = messageProcessors;
+ this.initialProcessorContext = initialProcessorContext;
+ }
+
+ /**
+ * Process a processor chain
+ *
+ * @return Processor Context after processing the processor chain
+ */
+ public P processChain() {
+
+ final MessageProcessorFunction<P> messageProcessorFunction =
+ new MessageProcessorFunction<P>() {
+ @Override
+ public <M extends MessageProcessor<P>> P apply(P context, M processor) {
+ return processor.apply(context);
+ }
+ };
+
+ return computeMessageProcessorChain(messageProcessors, initialProcessorContext,
+ messageProcessorFunction);
+
+ }
+
+}
diff --git a/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericProcessorInfo.java b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericProcessorInfo.java
new file mode 100644
index 0000000..69d817f
--- /dev/null
+++ b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/GenericProcessorInfo.java
@@ -0,0 +1,57 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+import javax.annotation.Nonnull;
+
+/**
+ * A Generic Implementation of {@link ProcessorInfo}
+ *
+ * @author Rajiv Singla . Creation Date: 11/7/2016.
+ */
+public class GenericProcessorInfo implements ProcessorInfo {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String processorName;
+ private final String processorDescription;
+
+ public GenericProcessorInfo(@Nonnull String processorName, @Nonnull String processorDescription) {
+ this.processorName = processorName;
+ this.processorDescription = processorDescription;
+ }
+
+ @Override
+ public String getProcessorName() {
+ return processorName;
+ }
+
+ @Override
+ public String getProcessorDescription() {
+ return processorDescription;
+ }
+
+
+ @Override
+ public String toString() {
+ return processorName;
+ }
+}
diff --git a/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/MessageProcessor.java b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/MessageProcessor.java
new file mode 100644
index 0000000..6af34f3
--- /dev/null
+++ b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/MessageProcessor.java
@@ -0,0 +1,84 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * A message processor can be used to process incoming messages.
+ * It uses implementations of {@link ProcessorContext} as input and output
+ * </p>
+ *
+ * @param <P> Message Processor Context implementations
+ *
+ * @author Rajiv Singla . Creation Date: 11/7/2016.
+ */
+public interface MessageProcessor<P extends ProcessorContext> extends Function<P, P>, Serializable {
+
+ /**
+ * Returns processor information
+ *
+ * @return processor Information
+ */
+ ProcessorInfo getProcessorInfo();
+
+
+ /**
+ * Does pre-processing of {@link ProcessorContext} e.g. validate input conditions and return
+ * pre processed context
+ *
+ * @param processorContext incoming Processor Context
+ * @return Pre processed Processor Context
+ */
+ P preProcessor(P processorContext);
+
+
+ /**
+ * Return processing state of a processor
+ *
+ * @return Processing State
+ */
+ ProcessingState getProcessingState();
+
+
+ /**
+ * May return a message from a processor which indicates the reason for {@link ProcessingState} especially if
+ * there was some failure in processing
+ *
+ * @return processing Message
+ */
+ Optional<String> getProcessingMessage();
+
+
+ /**
+ * Does post-processing of {@link ProcessorContext}
+ *
+ * @param processorContext incoming Processor Context
+ * @return processor Context after post processing is finished
+ */
+ P postProcessor(P processorContext);
+
+
+}
diff --git a/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/ProcessingState.java b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/ProcessingState.java
new file mode 100644
index 0000000..cc6127d
--- /dev/null
+++ b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/ProcessingState.java
@@ -0,0 +1,36 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+/**
+ * <p>
+ * Processing state of a {@link MessageProcessor}
+ * </p>
+ * @author Rajiv Singla . Creation Date: 11/5/2016.
+ */
+public enum ProcessingState {
+
+ PROCESSING_STARTED,
+ PROCESSING_FINISHED_SUCCESSFULLY,
+ PROCESSING_TERMINATED_EARLY,
+ PROCESSING_NOT_REQUIRED;
+
+}
diff --git a/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/ProcessorContext.java b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/ProcessorContext.java
new file mode 100644
index 0000000..2dde5e1
--- /dev/null
+++ b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/ProcessorContext.java
@@ -0,0 +1,70 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * <p>
+ * A Processor Context is used a an input and output to a {@link MessageProcessor}
+ * <br>
+ * DCAE Analytics sub projects should extend this interface and add specific fields
+ * required for input and output
+ * </p>
+ *
+ * @author Rajiv Singla . Creation Date: 11/7/2016.
+ */
+public interface ProcessorContext extends Serializable {
+
+ /**
+ * Returns Processor Context message that will be processed by Chain of Processors
+ *
+ * @return message that need to be processed by processors
+ */
+ String getMessage();
+
+ /**
+ * Processing Context flag which determines if Processing can continue in a processing
+ * chain
+ *
+ * @return true if ok to continue processing normally
+ */
+ boolean canProcessingContinue();
+
+
+ /**
+ * Sets new value for ProcessingContinue flag which will cause early termination of processing in chain if
+ * set to false
+ *
+ * @param canProcessingContinue set new value for canProcessing Continue flag
+ */
+ void setProcessingContinueFlag(boolean canProcessingContinue);
+
+
+ /**
+ * Provides a List of previous processors which have completed processing
+ *
+ * @return list of previous processors
+ */
+ List<? super MessageProcessor<? extends ProcessorContext>> getMessageProcessors();
+
+}
diff --git a/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/ProcessorInfo.java b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/ProcessorInfo.java
new file mode 100644
index 0000000..c7045d8
--- /dev/null
+++ b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/service/processor/ProcessorInfo.java
@@ -0,0 +1,49 @@
+/*
+ * ===============================LICENSE_START======================================
+ * dcae-analytics
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================LICENSE_END===========================================
+ */
+
+package org.openecomp.dcae.apod.analytics.common.service.processor;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * Contains Information about a processor. For e.g. Processor name, processor description etc
+ * </p>
+ *
+ * @author Rajiv Singla . Creation Date: 11/7/2016.
+ */
+public interface ProcessorInfo extends Serializable {
+
+ /**
+ * Returns a name which should uniquely identify a particular {@link MessageProcessor}
+ *
+ * @return processor name
+ */
+ String getProcessorName();
+
+
+ /**
+ * Returns description of a {@link MessageProcessor}
+ *
+ * @return processor description
+ */
+ String getProcessorDescription();
+
+}