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.tca.processor;
23 import org.openecomp.dcae.apod.analytics.common.service.processor.AbstractProcessorContext;
24 import org.openecomp.dcae.apod.analytics.model.domain.cef.EventListener;
25 import org.openecomp.dcae.apod.analytics.model.domain.policy.tca.MetricsPerEventName;
26 import org.openecomp.dcae.apod.analytics.model.domain.policy.tca.TCAPolicy;
29 * TCA CEF Policy Processor Context
31 * @author Rajiv Singla . Creation Date: 11/7/2016.
33 public class TCACEFProcessorContext extends AbstractProcessorContext {
35 private static final long serialVersionUID = 1L;
37 private final TCAPolicy tcaPolicy;
38 private EventListener eventListener;
39 private MetricsPerEventName metricsPerEventName;
41 public TCACEFProcessorContext(final String message, boolean canProcessingContinue, final TCAPolicy tcaPolicy) {
42 super(message, canProcessingContinue);
43 this.tcaPolicy = tcaPolicy;
44 // present only if cef incoming message can be parsed successfully to Event Listener Object
45 this.eventListener = null;
46 // present only if there are any threshold violations are detected
47 this.metricsPerEventName = null;
50 // Auxiliary Constructor which default canProcessingContinue Flag to true
51 public TCACEFProcessorContext(final String message, final TCAPolicy tcaPolicy) {
52 this(message, true, tcaPolicy);
56 * Returns {@link TCAPolicy} Object
60 public TCAPolicy getTCAPolicy() {
65 * Returns Common Event Format {@link EventListener} if present else null
67 * @return CEF Event Listener
69 public EventListener getCEFEventListener() {
75 * Sets new {@link EventListener}
77 * @param eventListener set new value for CEF event listener
79 public void setCEFEventListener(final EventListener eventListener) {
80 this.eventListener = eventListener;
85 * Returns TCA Policy {@link MetricsPerEventName} which was has violated Threshold for the CEF Message if
88 * @return Violated Threshold
90 public MetricsPerEventName getMetricsPerEventName() {
91 return metricsPerEventName;
95 * Assign new TCA Policy {@link MetricsPerEventName} which was has violated Threshold for the CEF Message
97 * @param metricsPerEventName new value for Metrics Per Functional Role with violated threshold
99 public void setMetricsPerEventName(MetricsPerEventName metricsPerEventName) {
100 this.metricsPerEventName = metricsPerEventName;