Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A934F200B6C for ; Sun, 14 Aug 2016 08:23:24 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A7C49160AB2; Sun, 14 Aug 2016 06:23:24 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 38E6B160AA6 for ; Sun, 14 Aug 2016 08:23:22 +0200 (CEST) Received: (qmail 77820 invoked by uid 500); 14 Aug 2016 06:23:21 -0000 Mailing-List: contact commits-help@eagle.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@eagle.incubator.apache.org Delivered-To: mailing list commits@eagle.incubator.apache.org Received: (qmail 77811 invoked by uid 99); 14 Aug 2016 06:23:21 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Aug 2016 06:23:21 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id D52CEC0C79 for ; Sun, 14 Aug 2016 06:23:20 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.739 X-Spam-Level: X-Spam-Status: No, score=-3.739 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.519] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id bS-3TID_xkJy for ; Sun, 14 Aug 2016 06:23:15 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id BEBD460D4E for ; Sun, 14 Aug 2016 06:23:02 +0000 (UTC) Received: (qmail 74763 invoked by uid 99); 14 Aug 2016 06:23:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Aug 2016 06:23:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8F0E1EEF42; Sun, 14 Aug 2016 06:23:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: yonzhang2012@apache.org To: commits@eagle.incubator.apache.org Date: Sun, 14 Aug 2016 06:23:12 -0000 Message-Id: <1f8c33726b2242dd9010c27de9d96911@git.apache.org> In-Reply-To: <4821ee27a17549b9b5fb2a67d6660b91@git.apache.org> References: <4821ee27a17549b9b5fb2a67d6660b91@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [12/13] incubator-eagle git commit: EAGLE-341 clean inner process alert engine code clean inner process alert engine code archived-at: Sun, 14 Aug 2016 06:23:24 -0000 http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/AlertKafkaPlugin.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/AlertKafkaPlugin.java b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/AlertKafkaPlugin.java deleted file mode 100644 index 683f2f5..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/AlertKafkaPlugin.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -package org.apache.eagle.notification.plugin; - -import com.typesafe.config.Config; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.eagle.alert.entity.AlertAPIEntity; -import org.apache.eagle.alert.entity.AlertDefinitionAPIEntity; -import org.apache.eagle.notification.base.NotificationConstants; -import org.apache.eagle.notification.base.NotificationStatus; -import org.apache.eagle.notification.utils.NotificationPluginUtils; -import org.apache.eagle.policy.common.Constants; -import org.apache.kafka.clients.producer.KafkaProducer; -import org.apache.kafka.clients.producer.ProducerRecord; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; -import java.util.Map; -import java.util.Vector; -import java.util.concurrent.ConcurrentHashMap; - -/** - * send alert to Kafka bus - */ -@SuppressWarnings({ "rawtypes", "unchecked" }) -public class AlertKafkaPlugin implements NotificationPlugin { - private static final Logger LOG = LoggerFactory.getLogger(AlertKafkaPlugin.class); - private List statusList = new Vector<>(); - private Map>> kafaConfigs = new ConcurrentHashMap<>(); - private Config config; - - @Override - public void init(Config config, List initAlertDefs) throws Exception { - this.config = config; - for( AlertDefinitionAPIEntity entity : initAlertDefs ) { - List> configMaps = NotificationPluginUtils.deserializeNotificationConfig(entity.getNotificationDef()); - this.update(entity.getTags().get(Constants.POLICY_ID), configMaps, false); - } - } - - /** - * Update API to update policy delete/create/update in Notification Plug-ins - * @param notificationConfigCollection - * @param isPolicyDelete - * @throws Exception - */ - @Override - public void update(String policyId, List> notificationConfigCollection, boolean isPolicyDelete ) throws Exception { - if( isPolicyDelete ){ - LOG.info(" Policy been deleted.. Removing reference from Notification Plugin "); - this.kafaConfigs.remove(policyId); - return; - } - Vector> kafkaConfigList = new Vector<>(); - for(Map notificationConfigMap : notificationConfigCollection){ - String notificationType = notificationConfigMap.get(NotificationConstants.NOTIFICATION_TYPE); - if(notificationType == null){ - LOG.error("invalid notificationType for this notification, ignoring and continue " + notificationConfigMap); - continue; - }else { - // single policy can have multiple configs , only load Kafka Config's - if (notificationType.equalsIgnoreCase(NotificationConstants.KAFKA_STORE)) { - kafkaConfigList.add(notificationConfigMap); - } - } - } - if(kafkaConfigList.size() != 0) { - kafaConfigs.put(policyId, kafkaConfigList); - } - } - - /** - * Post Notification to KafkaTopic - * @param alertEntity - */ - @Override - public void onAlert(AlertAPIEntity alertEntity) { - String policyId = alertEntity.getTags().get(Constants.POLICY_ID); - for(Map kafkaConfig: this.kafaConfigs.get(policyId)) { - NotificationStatus status = new NotificationStatus(); - try{ - KafkaProducer producer = KafkaProducerSingleton.INSTANCE.getProducer(kafkaConfig); - producer.send(createRecord(alertEntity, kafkaConfig.get(NotificationConstants.TOPIC))); - status.successful = true; - status.errorMessage = ""; - }catch(Exception ex ){ - LOG.error("fail writing alert to Kafka bus", ex); - status.successful = false; - status.errorMessage = ex.getMessage(); - } - this.statusList.add(status); - } - } - - /** - * To Create KafkaProducer Record - * @param entity - * @return - * @throws Exception - */ - private ProducerRecord createRecord(AlertAPIEntity entity, String topic) throws Exception { - ProducerRecord record = new ProducerRecord(topic, NotificationPluginUtils.objectToStr(entity)); - return record; - } - - @Override - public List getStatusList() { - return statusList; - } - - @Override - public int hashCode(){ - return new HashCodeBuilder().append(getClass().getCanonicalName()).toHashCode(); - } - - @Override - public boolean equals(Object o){ - if(o == this) - return true; - if(!(o instanceof AlertKafkaPlugin)) - return false; - return true; - } -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/KafkaProducerSingleton.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/KafkaProducerSingleton.java b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/KafkaProducerSingleton.java deleted file mode 100644 index bc9e3c9..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/KafkaProducerSingleton.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ -package org.apache.eagle.notification.plugin; - -import java.util.Map; -import java.util.Properties; - -import com.typesafe.config.Config; -import org.apache.eagle.notification.base.NotificationConstants; -import org.apache.eagle.notification.utils.NotificationPluginUtils; -import org.apache.kafka.clients.producer.KafkaProducer; - -/** - * The producer is thread safe and sharing a single producer instance across threads will generally be faster than having multiple instances. - */ -public enum KafkaProducerSingleton { - INSTANCE; - - public KafkaProducer getProducer(Map config) throws Exception{ - Properties configMap = new Properties(); - String broker_list = config.get(NotificationConstants.BROKER_LIST); - configMap.put("bootstrap.servers", broker_list); - configMap.put("metadata.broker.list", broker_list); - configMap.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); - configMap.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); - configMap.put("request.required.acks", "1"); - configMap.put("key.deserializer","org.apache.kafka.common.serialization.StringDeserializer"); - configMap.put("value.deserializer","org.apache.kafka.common.serialization.StringDeserializer"); - KafkaProducer producer = new KafkaProducer<>(configMap); - return producer; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPlugin.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPlugin.java b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPlugin.java deleted file mode 100644 index 92ee0b5..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPlugin.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ -package org.apache.eagle.notification.plugin; - -import com.typesafe.config.Config; -import org.apache.eagle.alert.entity.AlertAPIEntity; -import org.apache.eagle.alert.entity.AlertDefinitionAPIEntity; -import org.apache.eagle.notification.base.NotificationStatus; - -import java.util.List; -import java.util.Map; - -/** - * Created on 2/10/16. - * Notification Plug-in interface which provide abstraction layer to notify to different system - */ -public interface NotificationPlugin { - /** - * for initialization - * @throws Exception - */ - void init(Config config, List initAlertDefs) throws Exception; - - /** - * Update Plugin if any change in Policy Definition - * @param policy to be impacted - * @param notificationConfCollection - * @throws Exception - */ - void update(String policy, List> notificationConfCollection , boolean isPolicyDelete) throws Exception; - - /** - * Post a notification for the given alertEntity - * @param alertEntity - * @throws Exception - */ - - void onAlert(AlertAPIEntity alertEntity) throws Exception; - - /** - * Returns Status of Notification Post - * @return - */ - List getStatusList(); -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginLoader.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginLoader.java b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginLoader.java deleted file mode 100644 index 4aa90c5..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginLoader.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ -package org.apache.eagle.notification.plugin; - -import com.typesafe.config.Config; -import org.apache.eagle.alert.entity.AlertNotificationEntity; -import org.apache.eagle.notification.base.NotificationConstants; -import org.apache.eagle.notification.dao.AlertNotificationDAO; -import org.apache.eagle.notification.dao.AlertNotificationDAOImpl; -import org.apache.eagle.service.client.EagleServiceConnector; -import org.reflections.Reflections; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -/** - * Created on 2/10/16. - * don't support dynamic discovery as of 2/10 - */ -public class NotificationPluginLoader { - private static final Logger LOG = LoggerFactory.getLogger(NotificationPluginLoader.class); - private static NotificationPluginLoader instance = new NotificationPluginLoader(); - private static Map notificationMapping = new ConcurrentHashMap<>(); - - private Config config; - private boolean initialized = false; - - public static NotificationPluginLoader getInstance(){ - return instance; - } - - public void init(Config config){ - if(!initialized){ - synchronized (this){ - if(!initialized){ - internalInit(config); - initialized = true; - } - } - } - } - - private void internalInit(Config config){ - this.config = config; - loadPlugins(); - } - - /** - * Scan & Load Plugins - */ - private void loadPlugins(){ - try { - LOG.info("Start loading Plugins from eagle service ..."); - AlertNotificationDAO dao = new AlertNotificationDAOImpl(new EagleServiceConnector(config)); - List activeNotificationPlugins = dao.findAlertNotificationTypes(); - for(AlertNotificationEntity plugin : activeNotificationPlugins){ - notificationMapping.put(plugin.getTags().get(NotificationConstants.NOTIFICATION_TYPE), - (NotificationPlugin) Class.forName(plugin.getClassName()).newInstance()); - } - LOG.info("successfully loaded Plugins from eagle service " + activeNotificationPlugins); - }catch ( Exception ex ){ - LOG.error("Error in loading Notification Plugins: ", ex); - throw new IllegalStateException(ex); - } - } - - public Map getNotificationMapping() { - ensureInitialized(); - return notificationMapping; - } - - private void ensureInitialized(){ - if(!initialized) - throw new IllegalStateException("Plugin loader not initialized"); - } -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginManager.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginManager.java b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginManager.java deleted file mode 100644 index fdf62d1..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginManager.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -package org.apache.eagle.notification.plugin; - -import org.apache.eagle.alert.entity.AlertAPIEntity; -import org.apache.eagle.alert.entity.AlertDefinitionAPIEntity; - -/** - * Created on 2/10/16. - */ -public interface NotificationPluginManager { - /** - * notify alerts to plugins for one specific alert entity - * @param entity - */ - void notifyAlert( AlertAPIEntity entity ); - - /** - * responds to changes of alert notification definition - * @param entity - * @param isDelete - */ - void updateNotificationPlugins(AlertDefinitionAPIEntity entity , boolean isDelete ); -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginManagerImpl.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginManagerImpl.java b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginManagerImpl.java deleted file mode 100644 index 8e9e3b2..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginManagerImpl.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ -package org.apache.eagle.notification.plugin; - -import com.typesafe.config.Config; -import org.apache.commons.collections.CollectionUtils; -import org.apache.eagle.alert.entity.AlertAPIEntity; -import org.apache.eagle.alert.entity.AlertDefinitionAPIEntity; -import org.apache.eagle.notification.base.NotificationConstants; -import org.apache.eagle.notification.utils.NotificationPluginUtils; -import org.apache.eagle.policy.common.Constants; -import org.apache.eagle.policy.dao.PolicyDefinitionDAO; -import org.apache.eagle.policy.dao.PolicyDefinitionEntityDAOImpl; -import org.apache.eagle.service.client.EagleServiceConnector; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -/** - * Created on 2/10/16. - */ -public class NotificationPluginManagerImpl implements NotificationPluginManager { - private static final Logger LOG = LoggerFactory.getLogger(NotificationPluginManagerImpl.class); - // mapping from policy Id to NotificationPlugin instance - private Map> policyNotificationMapping = new ConcurrentHashMap<>(1); //only one write thread - private Config config; - - public NotificationPluginManagerImpl(Config config){ - this.config = config; - internalInit(); - } - - private void internalInit(){ - // iterate all policy ids, keep those notification which belong to plugins - PolicyDefinitionDAO policyDefinitionDao = new PolicyDefinitionEntityDAOImpl(new EagleServiceConnector( config ) , Constants.ALERT_DEFINITION_SERVICE_ENDPOINT_NAME); - String site = config.getString("eagleProps.site"); - String application = config.getString("eagleProps.application"); - try{ - List activeAlertDefs = policyDefinitionDao.findActivePolicies( site , application); - // initialize all loaded plugins - NotificationPluginLoader.getInstance().init(config); - for(NotificationPlugin plugin : NotificationPluginLoader.getInstance().getNotificationMapping().values()){ - plugin.init(config, activeAlertDefs); - } - // build policy and plugin mapping - for( AlertDefinitionAPIEntity entity : activeAlertDefs ){ - Map plugins = pluginsForPolicy(entity); - policyNotificationMapping.put(entity.getTags().get(Constants.POLICY_ID) , plugins.values()); - } - }catch (Exception ex ){ - LOG.error("Error initializing policy/notification mapping ", ex); - throw new IllegalStateException(ex); - } - } - - @Override - public void notifyAlert(AlertAPIEntity entity) { - String policyId = entity.getTags().get(Constants.POLICY_ID); - Collection plugins = policyNotificationMapping.get(policyId); - if(plugins == null || plugins.size() == 0) { - LOG.warn("no alert notification plugins found for policy " + policyId); - return; - } - for(NotificationPlugin plugin : plugins){ - try { - LOG.info("execute notification plugin " + plugin); - plugin.onAlert(entity); - }catch(Exception ex){ - LOG.error("fail invoking plugin's onAlert, continue ", ex); - } - } - } - - @Override - public void updateNotificationPlugins(AlertDefinitionAPIEntity alertDef, boolean isDelete) { - try { - // Update Notification Plugin about the change in AlertDefinition - String policyId = alertDef.getTags().get(Constants.POLICY_ID); - if(isDelete){ - // iterate all plugins and delete this policy - for(NotificationPlugin plugin : policyNotificationMapping.get(policyId)){ - plugin.update(policyId, null, true); - } - policyNotificationMapping.remove(policyId); - LOG.info("Deleted notifications for policy " + policyId); - return; - } - - Map plugins = pluginsForPolicy(alertDef); - // calculate difference between current plugins and previous plugin - Collection previousPlugins = policyNotificationMapping.get(policyId); - if(previousPlugins != null) { - Collection deletedPlugins = CollectionUtils.subtract(previousPlugins, plugins.values()); - LOG.info("Going to delete plugins " + deletedPlugins + ", for policy " + policyId); - for (NotificationPlugin plugin : deletedPlugins) { - plugin.update(policyId, null, true); - } - } - - // iterate current notifications and update it individually - List> notificationConfigCollection = NotificationPluginUtils.deserializeNotificationConfig(alertDef.getNotificationDef()); - for(NotificationPlugin plugin: plugins.values()) { - plugin.update(policyId, notificationConfigCollection, false); - } - - policyNotificationMapping.put(policyId, plugins.values());// update policy - notification types map - LOG.info("Successfully broadcast policy updates to all Notification Plugins ..."); - } catch (Exception e) { - LOG.error("Error broadcasting policy notification changes ", e); - } - } - - private Map pluginsForPolicy(AlertDefinitionAPIEntity policy) throws Exception{ - NotificationPluginLoader loader = NotificationPluginLoader.getInstance(); - loader.init(config); - Map plugins = loader.getNotificationMapping(); - // mapping from notificationType to plugin - Map notifications = new HashMap<>(); - List> notificationConfigCollection = NotificationPluginUtils.deserializeNotificationConfig(policy.getNotificationDef()); - for(Map notificationConf : notificationConfigCollection ){ - String notificationType = notificationConf.get(NotificationConstants.NOTIFICATION_TYPE); - // for backward compatibility, by default notification type is email if notification type is not specified - if(notificationType == null){ - LOG.warn("notificationType is null so use default notification type email for this policy " + policy); - notifications.put(NotificationConstants.EMAIL_NOTIFICATION, plugins.get(NotificationConstants.EMAIL_NOTIFICATION)); - notifications.put(NotificationConstants.EAGLE_STORE, plugins.get(NotificationConstants.EAGLE_STORE)); - }else if(!plugins.containsKey(notificationType)){ - LOG.warn("No NotificationPlugin supports this notificationType " + notificationType); - }else { - notifications.put(notificationType, plugins.get(notificationType)); - } - } - return notifications; - } -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/utils/NotificationPluginUtils.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/utils/NotificationPluginUtils.java b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/utils/NotificationPluginUtils.java deleted file mode 100644 index e490be3..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/utils/NotificationPluginUtils.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -package org.apache.eagle.notification.utils; - -import com.typesafe.config.Config; -import com.typesafe.config.ConfigObject; -import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.type.CollectionType; - -import java.util.List; -import java.util.Map; - -/** - * Common methods for Notification Plugin - */ -public class NotificationPluginUtils { - private final static ObjectMapper OBJECT_MAPPER = TaggedLogAPIEntity.buildObjectMapper(); - /** - * Fetch Notification specific property value - * @param key - * @return - * @throws Exception - */ - public static String getPropValue(Config config, String key ) throws Exception { - if( config.getObject("eagleNotificationProps") == null ) - throw new Exception("Eagle Notification Properties not found in application.conf "); - ConfigObject notificationConf = config.getObject("eagleNotificationProps"); - return notificationConf.get(key).unwrapped().toString(); - } - - /** - * Deserialize Notification Definition and convert all config to Key Value Pairs - * @param notificationDef - * @return - * @throws Exception - */ - public static List> deserializeNotificationConfig( String notificationDef ) throws Exception { - CollectionType mapCollectionType = OBJECT_MAPPER.getTypeFactory().constructCollectionType(List.class, Map.class); - return OBJECT_MAPPER.readValue(notificationDef, mapCollectionType); - } - - /** - * Object to JSON String - * @param obj - * @return - * @throws Exception - */ - public static String objectToStr( Object obj ) throws Exception { - return OBJECT_MAPPER.writeValueAsString(obj); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/resources/ALERT_DEFAULT.vm ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/resources/ALERT_DEFAULT.vm b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/resources/ALERT_DEFAULT.vm deleted file mode 100644 index 3e29439..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/resources/ALERT_DEFAULT.vm +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - - - - - #set ( $elem = $alertList[0] ) - #set ( $alertUrl = $elem["alertDetailUrl"] ) - #set ( $policyUrl = $elem["policyDetailUrl"] ) - - - - - - - - -
- - - - - -
-

Eagle

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

$elem["application"] Alert Detected

-
- - - - #set ( $severity = $elem["severity"] ) - #if (!$severity || ("$severity" == "")) - #set ( $elem["severity"] = "WARNING") - #end - - -
-

Detected Time: $elem["alertTimestamp"]

-
-

- Severity: - #if ($elem["severity"] == "WARNING") - $elem["severity"] - #else - $elem["severity"] - #end -

-
-
-

$elem["alertMessage"]

-
- - - - -
- View Alert Details on Eagle Web -
-
-

Basic Information:

-
- - - - - - - - - - - - - - - - - -
-

Site

-
-

Data Source

-
-

$elem["site"]

-
-

$elem["application"]

-
-

Policy Name

-
-

Severity

-
-

$elem["policyId"]

-
-

$elem["severity"]

-
-
- - - - -
- View Policy Details on Eagle Web -
-
-

Actions Required:

-
-

$elem["application"] alert found, please check.

-
-

Apache Eagle

-
-
- - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/resources/application.conf ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/resources/application.conf b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/resources/application.conf deleted file mode 100644 index d57172b..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/resources/application.conf +++ /dev/null @@ -1,69 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. - -{ - "envContextConfig" : { - "env" : "storm", - "mode" : "cluster", - "topologyName" : "sandbox-hdfsAuditLog-topology", - "stormConfigFile" : "security-auditlog-storm.yaml", - "parallelismConfig" : { - "kafkaMsgConsumer" : 1, - "hdfsAuditLogAlertExecutor*" : 1 - } - }, - "dataSourceConfig": { - "topic" : "sandbox_hdfs_audit_log", - "zkConnection" : "127.0.0.1:2181", - "brokerZkPath" : "/brokers", - "zkConnectionTimeoutMS" : 15000, - "fetchSize" : 1048586, - "deserializerClass" : "org.apache.eagle.security.auditlog.HdfsAuditLogKafkaDeserializer", - "transactionZKServers" : "127.0.0.1", - "transactionZKPort" : 2181, - "transactionZKRoot" : "/consumers", - "consumerGroupId" : "eagle.hdfsaudit.consumer", - "transactionStateUpdateMS" : 2000 - }, - "alertExecutorConfigs" : { - "hdfsAuditLogAlertExecutor" : { - "parallelism" : 1, - "partitioner" : "org.apache.eagle.policy.DefaultPolicyPartitioner", - "needValidation" : "true" - } - }, - "eagleProps" : { - "site" : "sandbox", - "dataSource": "hdfsAuditLog", - "dataJoinPollIntervalSec" : 30, - "mailHost" : "mailhost.com", - "mailSmtpPort":"25", - "mailDebug" : "true", - "eagleService": { - "host": "localhost", - "port": 9099, - "username": "admin", - "password": "secret" - } - }, - "dynamicConfigSource" : { - "enabled" : true, - "initDelayMillis" : 0, - "delayMillis" : 30000 - }, - "eagleNotificationProps" : { - "kafka_broker":"192.168.56.101:6667" - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/resources/notification-plugins-init.sh ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/resources/notification-plugins-init.sh b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/resources/notification-plugins-init.sh deleted file mode 100644 index 0293f9d..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/resources/notification-plugins-init.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with` -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. - -CUR_DIR=$(dirname $0) -source $CUR_DIR/../../../../../../eagle-assembly/src/main/bin/eagle-env.sh - -##################################################################### -# Import notification plugin configuration into Eagle Service # -##################################################################### - -## AlertNotificationService : schema for notifcation plugin configuration -echo "" -echo "Importing notification plugin configurations ... " -curl -u ${EAGLE_SERVICE_USER}:${EAGLE_SERVICE_PASSWD} -X POST -H 'Content-Type:application/json' \ - "http://${EAGLE_SERVICE_HOST}:${EAGLE_SERVICE_PORT}/eagle-service/rest/entities?serviceName=AlertNotificationService" \ - -d ' - [ - { - "prefix": "alertNotifications", - "tags": { - "notificationType": "email" - }, - "className": "org.apache.eagle.notification.plugin.AlertEmailPlugin", - "description": "send alert to email", - "enabled":true - }, - { - "prefix": "alertNotifications", - "tags": { - "notificationType": "kafka" - }, - "className": "org.apache.eagle.notification.plugin.AlertKafkaPlugin", - "description": "send alert to kafka bus", - "enabled":true - }, - { - "prefix": "alertNotifications", - "tags": { - "notificationType": "eagleStore" - }, - "className": "org.apache.eagle.notification.plugin.AlertEagleStorePlugin", - "description": "send alert to eagle store", - "enabled":true - } - ] - ' - -## Finished -echo "" -echo "Finished initialization for alert notification plugins" - -exit 0 http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestAlertEagleStorePlugin.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestAlertEagleStorePlugin.java b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestAlertEagleStorePlugin.java deleted file mode 100644 index e1c2ead..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestAlertEagleStorePlugin.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ -package org.apache.eagle.notifications.testcases; - -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; -import org.apache.eagle.alert.entity.AlertAPIEntity; -import org.apache.eagle.alert.entity.AlertDefinitionAPIEntity; -import org.apache.eagle.common.metric.AlertContext; -import org.apache.eagle.notification.plugin.AlertEagleStorePlugin; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -import java.util.Arrays; - -/** - * Created on 2/11/16. - */ -public class TestAlertEagleStorePlugin { - @Ignore // only work when eagle service is up - @Test - public void testEagleStorePlugin() throws Exception{ - AlertEagleStorePlugin plugin = new AlertEagleStorePlugin(); - Config config = ConfigFactory.load(); - AlertDefinitionAPIEntity def = new AlertDefinitionAPIEntity(); - def.setNotificationDef(""); - plugin.init(config, Arrays.asList(def)); - - AlertAPIEntity alert = new AlertAPIEntity(); - alert.setDescription(""); - alert.setAlertContext(new AlertContext().toJsonString()); - plugin.onAlert(alert); - Assert.assertTrue(plugin.getStatusList().get(0).successful); - } -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestAlertEmailPlugin.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestAlertEmailPlugin.java b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestAlertEmailPlugin.java deleted file mode 100644 index 7a52369..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestAlertEmailPlugin.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ -package org.apache.eagle.notifications.testcases; - -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; -import org.apache.eagle.alert.entity.AlertAPIEntity; -import org.apache.eagle.alert.entity.AlertDefinitionAPIEntity; -import org.apache.eagle.common.metric.AlertContext; -import org.apache.eagle.notification.plugin.AlertEmailPlugin; -import org.apache.eagle.policy.common.Constants; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -import java.util.Arrays; -import java.util.HashMap; - -/** - * Created on 2/11/16. - */ -public class TestAlertEmailPlugin { - @Ignore // only works when there is correct email setup and eagle service - @Test - public void testAlertEmailPlugin() throws Exception{ - AlertEmailPlugin plugin = new AlertEmailPlugin(); - Config config = ConfigFactory.load(); - AlertDefinitionAPIEntity def = new AlertDefinitionAPIEntity(); - def.setTags(new HashMap()); - def.getTags().put(Constants.POLICY_ID, "testPolicyId"); - def.setNotificationDef("[{\"notificationType\":\"email\",\"sender\":\"eagle@apache.org\",\"recipients\":\"eagle@apache.org\",\"subject\":\"last check point time lag found.\",\"tplFileName\":\"\"}]"); - plugin.init(config, Arrays.asList(def)); - - AlertAPIEntity alert = new AlertAPIEntity(); - alert.setTags(new HashMap()); - alert.getTags().put(Constants.POLICY_ID, "testPolicyId"); - alert.setDescription(""); - alert.setDecodedAlertContext(new AlertContext()); - plugin.onAlert(alert); - Assert.assertTrue(plugin.getStatusList().get(0).successful); - } -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestAlertKafkaPlugin.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestAlertKafkaPlugin.java b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestAlertKafkaPlugin.java deleted file mode 100644 index 414211a..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestAlertKafkaPlugin.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -package org.apache.eagle.notifications.testcases; - -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; -import org.apache.eagle.alert.entity.AlertAPIEntity; -import org.apache.eagle.alert.entity.AlertDefinitionAPIEntity; -import org.apache.eagle.common.metric.AlertContext; -import org.apache.eagle.notification.plugin.AlertKafkaPlugin; -import org.apache.eagle.policy.common.Constants; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -import java.util.Arrays; -import java.util.HashMap; - -@SuppressWarnings({ "unchecked", "rawtypes" }) -public class TestAlertKafkaPlugin { - @Ignore // only work when kafka is ready for use - @Test - public void testAlertToKafkaBus() throws Exception - { - AlertKafkaPlugin plugin = new AlertKafkaPlugin(); - Config config = ConfigFactory.load(); - AlertDefinitionAPIEntity def = new AlertDefinitionAPIEntity(); - def.setTags(new HashMap()); - def.getTags().put(Constants.POLICY_ID, "testPolicyId"); - def.setNotificationDef("[{\"notificationType\":\"kafka\",\"kafka_broker\":\"sandbox.hortonworks.com:6667\",\"topic\":\"sandbox_hdfs_audit_log\"}]"); - plugin.init(config, Arrays.asList(def)); - - AlertAPIEntity alert = new AlertAPIEntity(); - alert.setTags(new HashMap()); - alert.getTags().put(Constants.POLICY_ID, "testPolicyId"); - alert.setDescription(""); - alert.setAlertContext(new AlertContext().toJsonString()); - plugin.onAlert(alert); - Thread.sleep(1000); // wait for message sent out - Assert.assertTrue(plugin.getStatusList().get(0).successful); - } -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestGetAllNotifications.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestGetAllNotifications.java b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestGetAllNotifications.java deleted file mode 100644 index 2749648..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestGetAllNotifications.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - - -package org.apache.eagle.notifications.testcases; - -import com.typesafe.config.Config; -import org.apache.eagle.alert.entity.AlertNotificationEntity; -import org.apache.eagle.common.config.EagleConfigFactory; -import org.apache.eagle.notification.dao.AlertNotificationDAO; -import org.apache.eagle.notification.dao.AlertNotificationDAOImpl; -import org.apache.eagle.service.client.EagleServiceConnector; -import org.junit.Ignore; -import org.junit.Test; - -import java.util.List; - -public class TestGetAllNotifications { - @Ignore - @Test - public void getAllNotification() throws Exception { - Config config = EagleConfigFactory.load().getConfig(); - AlertNotificationDAO dao = new AlertNotificationDAOImpl( new EagleServiceConnector(config)); - List list = dao.findAlertNotificationTypes(); - System.out.println(" Fetch all Notifications : "+list); - } -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestNotificationPluginLoader.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestNotificationPluginLoader.java b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestNotificationPluginLoader.java deleted file mode 100644 index e128770..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestNotificationPluginLoader.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ -package org.apache.eagle.notifications.testcases; - -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; -import org.apache.eagle.notification.base.NotificationConstants; -import org.apache.eagle.notification.plugin.NotificationPluginLoader; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -/** - * Created on 2/10/16. - */ -public class TestNotificationPluginLoader { - @Ignore //only work when connected to eagle service - @Test - public void testLoader(){ - Config config = ConfigFactory.load(); - NotificationPluginLoader loader = NotificationPluginLoader.getInstance(); - loader.init(config); - Assert.assertTrue(loader.getNotificationMapping().keySet().contains(NotificationConstants.EAGLE_STORE)); - Assert.assertTrue(loader.getNotificationMapping().keySet().contains(NotificationConstants.KAFKA_STORE)); - Assert.assertTrue(loader.getNotificationMapping().keySet().contains(NotificationConstants.EMAIL_NOTIFICATION)); - } -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestNotificationPluginManager.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestNotificationPluginManager.java b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestNotificationPluginManager.java deleted file mode 100644 index 2b6f25d..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestNotificationPluginManager.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - * - */ - -package org.apache.eagle.notifications.testcases; - - -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; -import org.apache.eagle.alert.entity.AlertAPIEntity; -import org.apache.eagle.alert.entity.AlertDefinitionAPIEntity; -import org.apache.eagle.common.metric.AlertContext; -import org.apache.eagle.notification.plugin.NotificationPluginManager; -import org.apache.eagle.notification.plugin.NotificationPluginManagerImpl; -import org.apache.eagle.policy.common.Constants; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -import java.util.HashMap; - -public class TestNotificationPluginManager { - @Ignore - @Test - public void testUpdateNotificationPlugins() { - boolean isDelete = false; - AlertDefinitionAPIEntity alertDef = new AlertDefinitionAPIEntity(); - alertDef.setTags(new HashMap()); - alertDef.getTags().put(Constants.POLICY_ID, "testPlugin"); - alertDef.setNotificationDef("[]"); - Config config = ConfigFactory.load(); - NotificationPluginManager manager = new NotificationPluginManagerImpl(config); - manager.updateNotificationPlugins(alertDef, isDelete); - Assert.assertTrue(true); - } - @Ignore - @Test - public void testUpdateNotificationPlugins2() { - boolean isDelete = false; - AlertDefinitionAPIEntity alertDef = new AlertDefinitionAPIEntity(); - alertDef.setTags(new HashMap()); - alertDef.getTags().put(Constants.POLICY_ID, "testEmptyPlugins"); - alertDef.setNotificationDef("[{\"notificationType\":\"eagleStore\"},{\"notificationType\":\"kafka\",\"kafka_broker\":\"sandbox.hortonworks.com:6667\",\"topic\":\"testTopic\"}]"); - Config config = ConfigFactory.load(); - NotificationPluginManager manager = new NotificationPluginManagerImpl(config); - manager.updateNotificationPlugins(alertDef, isDelete); - Assert.assertTrue(true); - } - - @Ignore - @Test - public void testUpdateNotificationPluginsWithDelete() { - boolean isDelete = true; - AlertDefinitionAPIEntity alertDef = new AlertDefinitionAPIEntity(); - alertDef.setTags(new HashMap()); - alertDef.getTags().put(Constants.POLICY_ID, "testEmptyPlugins"); - alertDef.setNotificationDef("[]"); - Config config = ConfigFactory.load(); - NotificationPluginManager manager = new NotificationPluginManagerImpl(config); - manager.updateNotificationPlugins(alertDef, isDelete); - Assert.assertTrue(true); - } - - @Ignore - @Test - public void testMultipleNotificationInstance() { - AlertAPIEntity alert = new AlertAPIEntity(); - alert.setTags(new HashMap()); - alert.getTags().put(Constants.POLICY_ID, "testPlugin"); - alert.setDescription(""); - alert.setAlertContext(new AlertContext().toJsonString()); - - Config config = ConfigFactory.load(); - NotificationPluginManager manager = new NotificationPluginManagerImpl(config); - manager.notifyAlert(alert); - Assert.assertTrue(true); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestNotificationPluginUtils.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestNotificationPluginUtils.java b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestNotificationPluginUtils.java deleted file mode 100644 index 022526c..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/java/org/apache/eagle/notifications/testcases/TestNotificationPluginUtils.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - * - */ - -package org.apache.eagle.notifications.testcases; - -import org.apache.eagle.notification.utils.NotificationPluginUtils; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -import java.util.List; -import java.util.Map; - - -public class TestNotificationPluginUtils { - @Ignore - @Test - public void testDeserializeNotificationConfig() throws Exception { - String notificationDef = "[]"; - List> list = NotificationPluginUtils.deserializeNotificationConfig(notificationDef); - Assert.assertTrue(list.isEmpty()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/resources/application.conf ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/resources/application.conf b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/resources/application.conf deleted file mode 100644 index 2c5e770..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/resources/application.conf +++ /dev/null @@ -1,69 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. - -{ - "envContextConfig" : { - "env" : "storm", - "mode" : "cluster", - "topologyName" : "sandbox-hdfsAuditLog-topology", - "stormConfigFile" : "security-auditlog-storm.yaml", - "parallelismConfig" : { - "kafkaMsgConsumer" : 1, - "hdfsAuditLogAlertExecutor*" : 1 - } - }, - "dataSourceConfig": { - "topic" : "sandbox_hdfs_audit_log", - "zkConnection" : "127.0.0.1:2181", - "brokerZkPath" : "/brokers", - "zkConnectionTimeoutMS" : 15000, - "fetchSize" : 1048586, - "deserializerClass" : "org.apache.eagle.security.auditlog.HdfsAuditLogKafkaDeserializer", - "transactionZKServers" : "127.0.0.1", - "transactionZKPort" : 2181, - "transactionZKRoot" : "/consumers", - "consumerGroupId" : "eagle.hdfsaudit.consumer", - "transactionStateUpdateMS" : 2000 - }, - "alertExecutorConfigs" : { - "hdfsAuditLogAlertExecutor" : { - "parallelism" : 1, - "partitioner" : "org.apache.eagle.policy.DefaultPolicyPartitioner", - "needValidation" : "true" - } - }, - "eagleProps" : { - "site" : "sandbox", - "application": "hdfsAuditLog", - "dataJoinPollIntervalSec" : 30, - "mailHost" : "mailhost.com", - "mailSmtpPort":"25", - "mailDebug" : "true", - "eagleService": { - "host": "localhost", - "port": 9099, - "username": "admin", - "password": "secret" - } - }, - "dynamicConfigSource" : { - "enabled" : true, - "initDelayMillis" : 0, - "delayMillis" : 30000 - }, - "eagleNotificationProps" : { - "kafka_broker":"192.168.56.101:6667" - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/resources/log4j.properties b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/resources/log4j.properties deleted file mode 100644 index 3499c46..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/test/resources/log4j.properties +++ /dev/null @@ -1,35 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. - -log4j.rootLogger=INFO, stdout - - eagle.log.dir=./logs - eagle.log.file=eagle.log - -# standard output -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n - -# Daily Rolling File Appender - log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender - log4j.appender.DRFA.File=${eagle.log.dir}/${eagle.log.file} - log4j.appender.DRFA.DatePattern=.yyyy-MM-dd -## 30-day backup -# log4j.appender.DRFA.MaxBackupIndex=30 - log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout - -# Pattern format: Date LogLevel LoggerName LogMessage -log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-process/pom.xml ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-process/pom.xml b/eagle-core/eagle-alert-parent/eagle-alert-process/pom.xml deleted file mode 100644 index 1d35d95..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-process/pom.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - 4.0.0 - - org.apache.eagle - eagle-alert-parent - 0.5.0-incubating-SNAPSHOT - ../pom.xml - - jar - eagle-alert-process - eagle-alert-process - - - - org.apache.eagle - eagle-embed-server - ${project.version} - test - - - org.apache.eagle - eagle-embed-server - ${project.version} - tests - test - - - org.apache.eagle - eagle-embed-hbase - ${project.version} - tests - - - asm - asm - - - test - - - org.apache.eagle - eagle-embed-hbase - ${project.version} - - - asm - asm - - - test - - - org.apache.eagle - eagle-alert-base - ${project.version} - - - org.apache.eagle - eagle-metric - ${project.version} - - - org.wso2.siddhi - siddhi-core - - - org.slf4j - slf4j-simple - - - org.apache.log4j.wso2 - log4j - - - jdk.tools - jdk.tools - - - - - org.wso2.siddhi - siddhi-extension-string - - - log4j - log4j - - - org.slf4j - log4j-over-slf4j - - - org.apache.eagle - eagle-stream-process-base - ${project.version} - - - org.apache.eagle - eagle-alert-notification-plugin - ${project.version} - - - - - - - maven-jar-plugin - - - test-jar - test-compile - - test-jar - - - - - - - http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/DeduplicatorConfig.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/DeduplicatorConfig.java b/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/DeduplicatorConfig.java deleted file mode 100644 index 1e65408..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/DeduplicatorConfig.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ -package org.apache.eagle.alert.config; - -import java.io.Serializable; -import java.util.List; - -public class DeduplicatorConfig implements Serializable{ - private static final long serialVersionUID = 1L; - - private int alertDedupIntervalMin; - private List fields; - - public int getAlertDedupIntervalMin() { - return alertDedupIntervalMin; - } - - public void setAlertDedupIntervalMin(int alertDedupIntervalMin) { - this.alertDedupIntervalMin = alertDedupIntervalMin; - } - public List getFields() { - return fields; - } - - public void setFields(List fields) { - this.fields = fields; - } -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/EmailNotificationConfig.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/EmailNotificationConfig.java b/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/EmailNotificationConfig.java deleted file mode 100644 index f543d63..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/EmailNotificationConfig.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ -package org.apache.eagle.alert.config; - -@Deprecated -public class EmailNotificationConfig extends NotificationConfig{ - private static final long serialVersionUID = 1L; - private String sender; - private String recipients; - private String tplFileName; - private String subject; - public String getSubject() { - return subject; - } - public void setSubject(String subject) { - this.subject = subject; - } - public String getRecipients() { - return recipients; - } - public void setRecipients(String recipients) { - this.recipients = recipients; - } - public String getSender() { - return sender; - } - public void setSender(String sender) { - this.sender = sender; - } - public String getTplFileName() { - return tplFileName; - } - public void setTplFileName(String tplFileName) { - this.tplFileName = tplFileName; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/NotificationConfig.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/NotificationConfig.java b/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/NotificationConfig.java deleted file mode 100644 index 60c87dc..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/NotificationConfig.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ -package org.apache.eagle.alert.config; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonTypeInfo; - -@Deprecated -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "flavor", visible=true) -public class NotificationConfig implements Serializable{ - private static final long serialVersionUID = 1L; - private String id; - private String flavor; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getFlavor() { - return flavor; - } - - public void setFlavor(String flavor) { - this.flavor = flavor; - } -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0f11a591/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/Remediation.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/Remediation.java b/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/Remediation.java deleted file mode 100644 index ec52508..0000000 --- a/eagle-core/eagle-alert-parent/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/Remediation.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ -package org.apache.eagle.alert.config; - -import java.io.Serializable; - -public class Remediation implements Serializable{ - private static final long serialVersionUID = 1L; - private String id; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } -}