You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by ha...@apache.org on 2016/01/12 08:48:01 UTC
[8/8] incubator-eagle git commit: EAGLE-79 Provide aggregation and
persistence DSL support
EAGLE-79 Provide aggregation and persistence DSL support
https://issues.apache.org/jira/browse/EAGLE-79
1. Support aggregation api
2. Support persist Api
3. Refactor AlertExecutor to be policy wide.
Author: @RalphSu <su...@gmail.com>
Reviewer: @haoch <ha...@apache.org>
Closes #52
Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/da8f419c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/da8f419c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/da8f419c
Branch: refs/heads/master
Commit: da8f419c67b5ef42dcc480a19ca7ebce5a9a16b9
Parents: dd26aa4
Author: Hao Chen <ha...@apache.org>
Authored: Tue Jan 12 15:45:28 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Tue Jan 12 15:45:28 2016 +0800
----------------------------------------------------------------------
.gitignore | 4 +
README.md | 2 +-
eagle-assembly/src/assembly/eagle-bin.xml | 8 +
.../src/main/bin/eagle-create-table.rb | 2 +
.../sandbox-hbaseSecurityLog-application.conf | 2 +-
.../conf/sandbox-hdfsAuditLog-application.conf | 2 +-
.../conf/sandbox-hiveQueryLog-application.conf | 2 +-
.../main/conf/sandbox-userprofile-topology.conf | 2 +-
eagle-core/eagle-alert/eagle-alert-base/pom.xml | 5 +
.../eagle/alert/common/AlertConstants.java | 64 ---
.../eagle/alert/common/AlertEmailSender.java | 9 +-
.../eagle/alert/dao/AlertDataSourceDAO.java | 25 --
.../eagle/alert/dao/AlertDataSourceDAOImpl.java | 63 ---
.../eagle/alert/dao/AlertDefinitionDAO.java | 39 --
.../eagle/alert/dao/AlertDefinitionDAOImpl.java | 83 ----
.../eagle/alert/dao/AlertExecutorDAO.java | 26 --
.../eagle/alert/dao/AlertExecutorDAOImpl.java | 86 ----
.../apache/eagle/alert/dao/AlertStreamDAO.java | 25 --
.../eagle/alert/dao/AlertStreamDAOImpl.java | 62 ---
.../eagle/alert/dao/AlertStreamSchemaDAO.java | 25 --
.../alert/dao/AlertStreamSchemaDAOImpl.java | 83 ----
.../eagle/alert/entity/AlertAPIEntity.java | 84 ----
.../alert/entity/AlertContextSerDeser.java | 98 -----
.../alert/entity/AlertDataSourceEntity.java | 67 ---
.../alert/entity/AlertDefinitionAPIEntity.java | 181 --------
.../alert/entity/AlertEntityRepository.java | 32 --
.../eagle/alert/entity/AlertExecutorEntity.java | 45 --
.../eagle/alert/entity/AlertStreamEntity.java | 51 ---
.../alert/entity/AlertStreamSchemaEntity.java | 111 -----
.../alert/config/AbstractPolicyDefinition.java | 42 --
.../dedup/AlertDeduplicationExecutorBase.java | 41 +-
.../dedup/AlertEmailDeduplicationExecutor.java | 4 +-
.../dedup/AlertEntityDeduplicationExecutor.java | 7 +-
.../eagle/alert/executor/AlertExecutor.java | 41 ++
.../executor/AlertExecutorCreationUtils.java | 109 +++++
.../alert/notification/AlertEmailGenerator.java | 6 +-
.../notification/AlertNotificationExecutor.java | 39 +-
.../eagle/alert/notification/UrlBuilder.java | 64 ---
.../alert/policy/DefaultPolicyPartitioner.java | 32 --
.../eagle/alert/policy/DynamicPolicyLoader.java | 270 ------------
.../eagle/alert/policy/PartitionUtils.java | 30 --
.../policy/PolicyDistStatsDAOLogReporter.java | 47 ---
.../policy/PolicyDistributionReportMethods.java | 27 --
.../alert/policy/PolicyDistributionStats.java | 74 ----
.../policy/PolicyDistributionStatsDAO.java | 26 --
.../policy/PolicyDistroStatsLogReporter.java | 50 ---
.../eagle/alert/policy/PolicyEvaluator.java | 47 ---
.../policy/PolicyEvaluatorServiceProvider.java | 47 ---
.../alert/policy/PolicyLifecycleMethods.java | 27 --
.../eagle/alert/policy/PolicyManager.java | 61 ---
.../eagle/alert/policy/PolicyPartitioner.java | 26 --
.../eagle/alert/siddhi/AttributeType.java | 30 --
.../eagle/alert/siddhi/EagleAlertContext.java | 32 --
.../siddhi/SiddhiAlertAPIEntityRender.java | 109 +++++
.../siddhi/SiddhiAlertAPIEntityRendner.java | 100 -----
.../eagle/alert/siddhi/SiddhiAlertHandler.java | 26 --
.../alert/siddhi/SiddhiPolicyDefinition.java | 42 --
.../alert/siddhi/SiddhiPolicyEvaluator.java | 269 ------------
...iddhiPolicyEvaluatorServiceProviderImpl.java | 45 --
.../alert/siddhi/SiddhiQueryCallbackImpl.java | 85 ----
.../alert/siddhi/SiddhiStreamMetadataUtils.java | 119 ------
.../alert/siddhi/StreamMetadataManager.java | 128 ------
.../extension/ContainsIgnoreCaseExtension.java | 87 ----
.../extension/EqualsIgnoreCaseExtension.java | 91 ----
.../RegexpIgnoreCaseFunctionExtension.java | 89 ----
.../apache/eagle/executor/AlertExecutor.java | 395 ------------------
.../executor/AlertExecutorCreationUtils.java | 134 ------
....alert.policy.PolicyEvaluatorServiceProvider | 16 -
....eagle.policy.PolicyEvaluatorServiceProvider | 16 +
.../src/main/resources/str.siddhiext | 35 --
.../eagle/alert/cep/TestSiddhiEvaluator.java | 37 +-
.../alert/dao/TestAlertDefinitionDAOImpl.java | 8 +-
.../dao/TestSiddhiStreamMetadataUtils.java | 7 +-
.../alert/dao/TestStreamDefinitionDAOImpl.java | 4 +-
.../alert/executor/TestPolicyExecutor.java | 85 ++++
.../alert/policy/TestDynamicPolicyLoader.java | 25 +-
.../alert/policy/TestPolicyDistribution.java | 1 +
.../policy/TestPolicyDistributionUpdater.java | 19 +-
.../alert/policy/TestPolicyPartitioner.java | 1 +
.../alert/siddhi/TestExternalBatchWindow.java | 307 ++++++++++++++
.../eagle/alert/siddhi/TestSiddhiEngine.java | 2 +-
.../eagle/alert/siddhi/TestSiddhiStream.java | 3 +-
.../src/test/resources/str.siddhiext | 6 +-
.../src/test/resources/unittest.conf | 2 +-
.../SiddhiAlertPolicyValidateProvider.java | 6 +-
.../eagle-stream-process-api/pom.xml | 6 +
.../impl/aggregate/AggregateExecutor.java | 46 ++
.../aggregate/AggregateExecutorFactory.java | 121 ++++++
.../impl/aggregate/AggregateResultRender.java | 45 ++
.../impl/aggregate/SimpleAggregateExecutor.java | 182 ++++++++
.../entity/AggregateDefinitionAPIEntity.java | 121 ++++++
.../impl/aggregate/entity/AggregateEntity.java | 43 ++
.../entity/AggregateEntityRepository.java | 28 ++
.../dataproc/impl/persist/IPersistService.java | 28 ++
.../dataproc/impl/persist/PersistExecutor.java | 84 ++++
.../druid/AggregateEntitySerializer.java | 66 +++
.../impl/persist/druid/KafkaPersistService.java | 122 ++++++
.../JavaStormExecutorForAlertWrapper.java | 8 +-
.../eagle/datastream/ExecutionEnvironment.scala | 134 ++++++
.../datastream/ExecutionEnvironments.scala | 134 ------
.../datastream/core/ExecutionEnvironment.scala | 2 +
.../core/StreamAggregateExpansion.scala | 82 ++++
.../datastream/core/StreamAlertExpansion.scala | 77 ++--
.../eagle/datastream/core/StreamProducer.scala | 31 +-
.../eagle/datastream/core/StreamProtocol.scala | 16 +-
.../datastream/storm/StormBoltFactory.scala | 6 +
.../storm/StormExecutorForAlertWrapper.scala | 7 +-
.../utils/AlertExecutorConsumerUtils.scala | 6 +-
.../eagle/datastream/TestStreamAggregate.java | 152 +++++++
.../src/test/resources/application.conf | 19 +-
.../org/apache/eagle/ml/MLAnomalyCallback.java | 4 +-
.../org/apache/eagle/ml/MLPolicyEvaluator.java | 25 +-
.../eagle/ml/impl/MLAnomalyCallbackImpl.java | 39 +-
.../MLPolicyEvaluatorServiceProviderImpl.java | 10 +-
.../eagle/ml/model/MLPolicyDefinition.java | 2 +-
....alert.policy.PolicyEvaluatorServiceProvider | 16 -
....eagle.policy.PolicyEvaluatorServiceProvider | 16 +
....alert.policy.PolicyEvaluatorServiceProvider | 16 -
....eagle.policy.PolicyEvaluatorServiceProvider | 16 +
.../src/test/resources/application.conf | 2 +-
.../eagle-policy/eagle-policy-base/pom.xml | 62 +++
.../entity/AbstractPolicyDefinitionEntity.java | 27 ++
.../eagle/alert/entity/AlertAPIEntity.java | 93 +++++
.../alert/entity/AlertContextSerDeser.java | 98 +++++
.../alert/entity/AlertDataSourceEntity.java | 67 +++
.../alert/entity/AlertDefinitionAPIEntity.java | 179 ++++++++
.../alert/entity/AlertEntityRepository.java | 32 ++
.../eagle/alert/entity/AlertExecutorEntity.java | 45 ++
.../eagle/alert/entity/AlertStreamEntity.java | 51 +++
.../alert/entity/AlertStreamSchemaEntity.java | 111 +++++
.../eagle/policy/DefaultPolicyPartitioner.java | 32 ++
.../eagle/policy/DynamicPolicyLoader.java | 268 ++++++++++++
.../org/apache/eagle/policy/PartitionUtils.java | 31 ++
.../policy/PolicyDistStatsDAOLogReporter.java | 47 +++
.../policy/PolicyDistributionReportMethods.java | 27 ++
.../eagle/policy/PolicyDistributionStats.java | 74 ++++
.../policy/PolicyDistributionStatsDAO.java | 26 ++
.../policy/PolicyDistroStatsLogReporter.java | 50 +++
.../eagle/policy/PolicyEvaluationContext.java | 34 ++
.../apache/eagle/policy/PolicyEvaluator.java | 51 +++
.../policy/PolicyEvaluatorServiceProvider.java | 49 +++
.../eagle/policy/PolicyLifecycleMethods.java | 27 ++
.../org/apache/eagle/policy/PolicyManager.java | 61 +++
.../apache/eagle/policy/PolicyPartitioner.java | 26 ++
.../org/apache/eagle/policy/ResultRender.java | 32 ++
.../apache/eagle/policy/common/Constants.java | 70 ++++
.../apache/eagle/policy/common/UrlBuilder.java | 63 +++
.../policy/config/AbstractPolicyDefinition.java | 42 ++
.../eagle/policy/dao/AlertDataSourceDAO.java | 25 ++
.../policy/dao/AlertDataSourceDAOImpl.java | 61 +++
.../policy/dao/AlertDefinitionDAOImpl.java | 85 ++++
.../eagle/policy/dao/AlertExecutorDAO.java | 26 ++
.../eagle/policy/dao/AlertExecutorDAOImpl.java | 88 ++++
.../apache/eagle/policy/dao/AlertStreamDAO.java | 25 ++
.../eagle/policy/dao/AlertStreamDAOImpl.java | 60 +++
.../eagle/policy/dao/AlertStreamSchemaDAO.java | 25 ++
.../policy/dao/AlertStreamSchemaDAOImpl.java | 84 ++++
.../eagle/policy/dao/PolicyDefinitionDAO.java | 42 ++
.../dao/PolicyDefinitionEntityDAOImpl.java | 96 +++++
.../eagle/policy/executor/IPolicyExecutor.java | 29 ++
.../policy/executor/PolicyProcessExecutor.java | 418 +++++++++++++++++++
.../eagle/policy/siddhi/AttributeType.java | 30 ++
.../policy/siddhi/SiddhiEvaluationHandler.java | 27 ++
.../policy/siddhi/SiddhiPolicyDefinition.java | 56 +++
.../policy/siddhi/SiddhiPolicyEvaluator.java | 270 ++++++++++++
...iddhiPolicyEvaluatorServiceProviderImpl.java | 46 ++
.../policy/siddhi/SiddhiQueryCallbackImpl.java | 98 +++++
.../siddhi/SiddhiStreamMetadataUtils.java | 119 ++++++
.../policy/siddhi/StreamMetadataManager.java | 128 ++++++
.../extension/ContainsIgnoreCaseExtension.java | 87 ++++
.../extension/EqualsIgnoreCaseExtension.java | 91 ++++
.../ExternalTimeBatchWindowProcessor.java | 184 ++++++++
.../RegexpIgnoreCaseFunctionExtension.java | 89 ++++
....eagle.policy.PolicyEvaluatorServiceProvider | 16 +
.../src/main/resources/eagle.siddhiext | 1 +
.../src/main/resources/str.siddhiext | 35 ++
.../apache/eagle/policy/dao/TestSchemaDao.java | 37 ++
eagle-core/eagle-policy/pom.xml | 37 ++
.../entity/repo/EntityRepositoryScanner.java | 2 +-
.../TestHBaseWriteEntitiesPerformance.java | 2 +
eagle-core/pom.xml | 1 +
eagle-samples/eagle-persist-sample/pom.xml | 70 ++++
.../assembly/eagle-persist-sample-assembly.xml | 63 +++
.../eagle/persist/test/MetricSerializer.java | 31 ++
.../eagle/persist/test/PersistTopoTestMain.java | 115 +++++
.../persist/test/PersistTopoTestMain2.java | 58 +++
.../src/main/resources/application.conf | 86 ++++
.../src/main/resources/log4j.properties | 40 ++
.../main/resources/persist-test-topo-init.sh | 194 +++++++++
.../src/main/resources/persit-test-storm.yaml | 18 +
eagle-samples/pom.xml | 19 +
.../src/main/resources/application.conf | 2 +-
.../HdfsUserCommandPatternByFileImpl.java | 1 -
.../auditlog/HdfsUserCommandReassembler.java | 4 +-
.../src/main/resources/application.conf | 2 +-
.../src/main/resources/application.conf | 2 +-
.../UserProfileMLAlgorithmEvaluator.java | 7 +-
....alert.policy.PolicyEvaluatorServiceProvider | 16 -
....eagle.policy.PolicyEvaluatorServiceProvider | 16 +
.../src/main/resources/application-batch.conf | 2 +-
.../src/main/resources/application-stream.conf | 2 +-
....alert.policy.PolicyEvaluatorServiceProvider | 16 -
....eagle.policy.PolicyEvaluatorServiceProvider | 16 +
....alert.policy.PolicyEvaluatorServiceProvider | 17 -
....eagle.policy.PolicyEvaluatorServiceProvider | 17 +
.../src/main/resources/application.conf | 4 +-
pom.xml | 1 +
207 files changed, 7231 insertions(+), 4261 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index fd68dd6..c51d955 100644
--- a/.gitignore
+++ b/.gitignore
@@ -71,3 +71,7 @@ logs/
*.log*
# Mac files
.DS_Store
+
+*.cache-tests
+
+*.orig
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index e92104e..c41a3bd 100755
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ Apache Eagle is an open source monitoring solution to instantly identify access
For more details, please visit [https://eagle.incubator.apache.org](https://eagle.incubator.apache.org)
## Documentation
-You can find the latest Eagle documentation on [https://eagle.incubator.apache.org](https://eagle.incubator.apache.org/docs). This [README](README) file only contains basic setup instructions.
+You can find the latest Eagle documentation on [https://eagle.incubator.apache.org](https://eagle.incubator.apache.org/docs). This [README](README.md) file only contains basic setup instructions.
## Getting Started
The fastest way to get started with Eagle is to run with [docker](https://github.com/docker/docker) by one of following options:
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-assembly/src/assembly/eagle-bin.xml
----------------------------------------------------------------------
diff --git a/eagle-assembly/src/assembly/eagle-bin.xml b/eagle-assembly/src/assembly/eagle-bin.xml
index af8612c..d03af36 100644
--- a/eagle-assembly/src/assembly/eagle-bin.xml
+++ b/eagle-assembly/src/assembly/eagle-bin.xml
@@ -210,6 +210,14 @@
</excludes>
</fileSet>
+ <!--<fileSet>-->
+ <!--<directory>${project.basedir}/../eagle-samples/eagle-persist-sample/target/</directory>-->
+ <!--<outputDirectory>lib/topology</outputDirectory>-->
+ <!--<includes>-->
+ <!--<include>eagle-persist-sample-*-assembly.jar</include>-->
+ <!--</includes>-->
+ <!--</fileSet>-->
+
<fileSet>
<directory>${project.basedir}/../eagle-external/eagle-ambari</directory>
<outputDirectory>lib/ambari</outputDirectory>
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-assembly/src/main/bin/eagle-create-table.rb
----------------------------------------------------------------------
diff --git a/eagle-assembly/src/main/bin/eagle-create-table.rb b/eagle-assembly/src/main/bin/eagle-create-table.rb
index 2b6454b..185deb9 100644
--- a/eagle-assembly/src/main/bin/eagle-create-table.rb
+++ b/eagle-assembly/src/main/bin/eagle-create-table.rb
@@ -21,6 +21,7 @@ import org.apache.hadoop.hbase.client.HBaseAdmin
def createEagleTable(admin, tableName)
if !admin.tableExists(tableName)
+ # create tableName, {NAME => 'f', VERSIONS => '1', BLOOMFILTER => 'ROW', COMPRESSION => 'GZ'}
create tableName, {NAME => 'f', VERSIONS => '1', BLOOMFILTER => 'ROW', COMPRESSION => 'SNAPPY'}
puts "Create Table #{tableName} successfully"
elsif admin.isTableDisabled(tableName)
@@ -52,5 +53,6 @@ createEagleTable(admin, 'mlmodel')
createEagleTable(admin, 'userprofile')
createEagleTable(admin, 'hfdsusercommandpattern')
createEagleTable(admin, 'serviceAudit')
+createEagleTable(admin, 'aggregatedef')
exit
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-assembly/src/main/conf/sandbox-hbaseSecurityLog-application.conf
----------------------------------------------------------------------
diff --git a/eagle-assembly/src/main/conf/sandbox-hbaseSecurityLog-application.conf b/eagle-assembly/src/main/conf/sandbox-hbaseSecurityLog-application.conf
index 7fe2866..9909d75 100644
--- a/eagle-assembly/src/main/conf/sandbox-hbaseSecurityLog-application.conf
+++ b/eagle-assembly/src/main/conf/sandbox-hbaseSecurityLog-application.conf
@@ -40,7 +40,7 @@
"alertExecutorConfigs" : {
"hbaseSecurityLogAlertExecutor" : {
"parallelism" : 1,
- "partitioner" : "org.apache.eagle.alert.policy.DefaultPolicyPartitioner"
+ "partitioner" : "org.apache.eagle.policy.DefaultPolicyPartitioner"
"needValidation" : "true"
}
},
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-assembly/src/main/conf/sandbox-hdfsAuditLog-application.conf
----------------------------------------------------------------------
diff --git a/eagle-assembly/src/main/conf/sandbox-hdfsAuditLog-application.conf b/eagle-assembly/src/main/conf/sandbox-hdfsAuditLog-application.conf
index cffec42..2814890 100644
--- a/eagle-assembly/src/main/conf/sandbox-hdfsAuditLog-application.conf
+++ b/eagle-assembly/src/main/conf/sandbox-hdfsAuditLog-application.conf
@@ -40,7 +40,7 @@
"alertExecutorConfigs" : {
"hdfsAuditLogAlertExecutor" : {
"parallelism" : 1,
- "partitioner" : "org.apache.eagle.alert.policy.DefaultPolicyPartitioner",
+ "partitioner" : "org.apache.eagle.policy.DefaultPolicyPartitioner",
"needValidation" : "true"
}
},
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-assembly/src/main/conf/sandbox-hiveQueryLog-application.conf
----------------------------------------------------------------------
diff --git a/eagle-assembly/src/main/conf/sandbox-hiveQueryLog-application.conf b/eagle-assembly/src/main/conf/sandbox-hiveQueryLog-application.conf
index 08aed6f..f5ee0be 100644
--- a/eagle-assembly/src/main/conf/sandbox-hiveQueryLog-application.conf
+++ b/eagle-assembly/src/main/conf/sandbox-hiveQueryLog-application.conf
@@ -50,7 +50,7 @@
"alertExecutorConfigs" : {
"hiveAccessAlertByRunningJob" : {
"parallelism" : 1,
- "partitioner" : "org.apache.eagle.alert.policy.DefaultPolicyPartitioner",
+ "partitioner" : "org.apache.eagle.policy.DefaultPolicyPartitioner",
"needValidation" : "true"
}
},
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-assembly/src/main/conf/sandbox-userprofile-topology.conf
----------------------------------------------------------------------
diff --git a/eagle-assembly/src/main/conf/sandbox-userprofile-topology.conf b/eagle-assembly/src/main/conf/sandbox-userprofile-topology.conf
index 8b432de..e955f23 100644
--- a/eagle-assembly/src/main/conf/sandbox-userprofile-topology.conf
+++ b/eagle-assembly/src/main/conf/sandbox-userprofile-topology.conf
@@ -37,7 +37,7 @@
"alertExecutorConfigs" : {
"userProfileAnomalyDetectionExecutor" : {
"parallelism" : 1,
- "partitioner" : "org.apache.eagle.alert.policy.DefaultPolicyPartitioner",
+ "partitioner" : "org.apache.eagle.policy.DefaultPolicyPartitioner",
"needValidation":true
}
},
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/pom.xml b/eagle-core/eagle-alert/eagle-alert-base/pom.xml
index e9868a5..ce05d83 100644
--- a/eagle-core/eagle-alert/eagle-alert-base/pom.xml
+++ b/eagle-core/eagle-alert/eagle-alert-base/pom.xml
@@ -42,6 +42,11 @@
<artifactId>eagle-client-base</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>eagle</groupId>
+ <artifactId>eagle-policy-base</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/common/AlertConstants.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/common/AlertConstants.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/common/AlertConstants.java
deleted file mode 100644
index 44728ea..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/common/AlertConstants.java
+++ /dev/null
@@ -1,64 +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.common;
-
-public class AlertConstants {
- public final static String ALERT_SERVICE_ENDPOINT_NAME = "AlertService";
- public final static String ALERT_DEFINITION_SERVICE_ENDPOINT_NAME = "AlertDefinitionService";
- public final static String ALERT_STREAM_SCHEMA_SERVICE_ENDPOINT_NAME = "AlertStreamSchemaService";
- public final static String ALERT_DATA_SOURCE_SERVICE_ENDPOINT_NAME = "AlertDataSourceService";
- public final static String ALERT_EXECUTOR_SERVICE_ENDPOINT_NAME = "AlertExecutorService";
- public final static String ALERT_STREAM_SERVICE_ENDPOINT_NAME = "AlertStreamService";
- public static final String ALERT_EMAIL_ORIGIN_PROPERTY = "alertEmailOrigin";
- public static final String ALERT_TIMESTAMP_PROPERTY = "alertTimestamp";
-
- public static final String ALERT_EMAIL_TIME_PROPERTY = "timestamp";
- public static final String ALERT_EMAIL_COUNT_PROPERTY = "count";
- public static final String ALERT_EMAIL_ALERTLIST_PROPERTY = "alertList";
-
- public static final String URL = "url";
- public static final String ALERT_SOURCE = "alertSource";
- public static final String ALERT_MESSAGE = "alertMessage";
- public static final String SUBJECT = "subject";
- public static final String ALERT_EXECUTOR_ID = "alertExecutorId";
- public static final String POLICY_NAME = "policyName";
- public static final String POLICY_ID = "policyId";
- public static final String SOURCE_STREAMS = "sourceStreams";
- public static final String ALERT_EVENT = "alertEvent";
- public static final String POLICY_DETAIL_URL = "policyDetailUrl";
- public static final String ALERT_DETAIL_URL = "alertDetailUrl";
-
- public static final String POLICY_DEFINITION = "policyDefinition";
- public static final String POLICY_TYPE = "policyType";
- public static final String STREAM_NAME = "streamName";
- public static final String ATTR_NAME = "attrName";
-
- public static final String ALERT_EXECUTOR_CONFIGS = "alertExecutorConfigs";
- public static final String PARALLELISM = "parallelism";
- public static final String PARTITIONER = "partitioner";
- public static final String SOURCE = "source";
- public static final String PARTITIONSEQ = "partitionSeq";
-
- public enum policyType {
- siddhiCEPEngine,
- MachineLearning;
-
- policyType() {
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/common/AlertEmailSender.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/common/AlertEmailSender.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/common/AlertEmailSender.java
index c812f0e..faea5be 100644
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/common/AlertEmailSender.java
+++ b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/common/AlertEmailSender.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import org.apache.eagle.alert.email.AlertEmailContext;
+import org.apache.eagle.policy.common.Constants;
import org.apache.velocity.VelocityContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -146,10 +147,10 @@ public class AlertEmailSender implements Runnable {
}
private void generateCommonContext(VelocityContext context) {
- context.put(AlertConstants.ALERT_EMAIL_TIME_PROPERTY, DateTimeUtil.millisecondsToHumanDateWithSeconds( System.currentTimeMillis() ));
- context.put(AlertConstants.ALERT_EMAIL_COUNT_PROPERTY, alertContexts.size());
- context.put(AlertConstants.ALERT_EMAIL_ALERTLIST_PROPERTY, alertContexts);
- context.put(AlertConstants.ALERT_EMAIL_ORIGIN_PROPERTY, origin);
+ context.put(Constants.ALERT_EMAIL_TIME_PROPERTY, DateTimeUtil.millisecondsToHumanDateWithSeconds( System.currentTimeMillis() ));
+ context.put(Constants.ALERT_EMAIL_COUNT_PROPERTY, alertContexts.size());
+ context.put(Constants.ALERT_EMAIL_ALERTLIST_PROPERTY, alertContexts);
+ context.put(Constants.ALERT_EMAIL_ORIGIN_PROPERTY, origin);
}
public boolean sentSuccessfully(){
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDataSourceDAO.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDataSourceDAO.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDataSourceDAO.java
deleted file mode 100644
index 4196d7f..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDataSourceDAO.java
+++ /dev/null
@@ -1,25 +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.dao;
-
-import org.apache.eagle.alert.entity.AlertDataSourceEntity;
-
-import java.util.List;
-
-public interface AlertDataSourceDAO {
- List<AlertDataSourceEntity> findAlertDataSourceBySite(String site) throws Exception;
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDataSourceDAOImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDataSourceDAOImpl.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDataSourceDAOImpl.java
deleted file mode 100644
index cd125f3..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDataSourceDAOImpl.java
+++ /dev/null
@@ -1,63 +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.dao;
-
-import com.typesafe.config.Config;
-import org.apache.eagle.alert.common.AlertConstants;
-import org.apache.eagle.alert.entity.AlertDataSourceEntity;
-import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
-import org.apache.eagle.common.config.EagleConfigConstants;
-import org.apache.eagle.service.client.EagleServiceConnector;
-import org.apache.eagle.service.client.IEagleServiceClient;
-import org.apache.eagle.service.client.impl.EagleServiceClientImpl;
-import org.apache.commons.lang.time.DateUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-public class AlertDataSourceDAOImpl implements AlertDataSourceDAO{
- private final Logger LOG = LoggerFactory.getLogger(AlertDataSourceDAOImpl.class);
- private final EagleServiceConnector connector;
-
- public AlertDataSourceDAOImpl(EagleServiceConnector connector){
- this.connector = connector;
- }
-
- @Override
- public List<AlertDataSourceEntity> findAlertDataSourceBySite(String site) throws Exception{
- try {
- IEagleServiceClient client = new EagleServiceClientImpl(connector);
- String query = AlertConstants.ALERT_STREAM_SERVICE_ENDPOINT_NAME + "[@site=\"" + site + "\"]{*}";
- GenericServiceAPIResponseEntity<AlertDataSourceEntity> response = client.search()
- .startTime(0)
- .endTime(10 * DateUtils.MILLIS_PER_DAY)
- .pageSize(Integer.MAX_VALUE)
- .query(query)
- .send();
- client.close();
- if (response.getException() != null) {
- throw new Exception("Got an exception when query eagle service: " + response.getException());
- }
- return response.getObj();
- }
- catch (Exception ex) {
- LOG.error("Got an exception when query stream metadata service ", ex);
- throw new IllegalStateException(ex);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDefinitionDAO.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDefinitionDAO.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDefinitionDAO.java
deleted file mode 100644
index 44f081a..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDefinitionDAO.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.alert.dao;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.eagle.alert.entity.AlertDefinitionAPIEntity;
-
-public interface AlertDefinitionDAO extends Serializable{
- /**
- * find list of active alert definitions for one specific site and dataSource
- * @return
- */
- List<AlertDefinitionAPIEntity> findActiveAlertDefs(String site, String dataSource) throws Exception;
-
- /**
- * find map from alertExecutorId to map from policy Id to alert definition for one specific site and dataSource
- * Map from alertExecutorId to map from policyId to policy definition
- (site,dataSource) => Map[alertExecutorId,Map[policyId,alertDefinition]]
- * @return
- */
- Map<String, Map<String, AlertDefinitionAPIEntity>> findActiveAlertDefsGroupbyAlertExecutorId(String site, String dataSource) throws Exception;
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDefinitionDAOImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDefinitionDAOImpl.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDefinitionDAOImpl.java
deleted file mode 100644
index b6f865c..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertDefinitionDAOImpl.java
+++ /dev/null
@@ -1,83 +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.dao;
-
-import org.apache.eagle.alert.common.AlertConstants;
-import org.apache.eagle.alert.entity.AlertDefinitionAPIEntity;
-import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
-import org.apache.eagle.service.client.EagleServiceConnector;
-import org.apache.eagle.service.client.IEagleServiceClient;
-import org.apache.eagle.service.client.impl.EagleServiceClientImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Utility methods to load alert definitions for a program
- */
-public class AlertDefinitionDAOImpl implements AlertDefinitionDAO {
- private final Logger LOG = LoggerFactory.getLogger(AlertDefinitionDAOImpl.class);
- private final EagleServiceConnector connector;
-
- public AlertDefinitionDAOImpl(EagleServiceConnector connector){
- this.connector = connector;
- }
-
- @Override
- public List<AlertDefinitionAPIEntity> findActiveAlertDefs(String site, String dataSource) throws Exception {
- try {
- IEagleServiceClient client = new EagleServiceClientImpl(connector);
- String query = AlertConstants.ALERT_DEFINITION_SERVICE_ENDPOINT_NAME + "[@site=\"" + site + "\" AND @dataSource=\"" + dataSource + "\"]{*}";
- GenericServiceAPIResponseEntity<AlertDefinitionAPIEntity> response = client.search()
- .pageSize(Integer.MAX_VALUE)
- .query(query)
- .send();
- client.close();
- if (response.getException() != null) {
- throw new Exception("Got an exception when query eagle service: " + response.getException());
- }
- List<AlertDefinitionAPIEntity> list = response.getObj();
- List<AlertDefinitionAPIEntity> enabledList = new ArrayList<AlertDefinitionAPIEntity>();
- for (AlertDefinitionAPIEntity entity : list) {
- if (entity.isEnabled()) enabledList.add(entity);
- }
- return enabledList;
- }
- catch (Exception ex) {
- LOG.error("Got an exception when query alert Def service", ex);
- throw new IllegalStateException(ex);
- }
- }
-
- @Override
- public Map<String, Map<String, AlertDefinitionAPIEntity>> findActiveAlertDefsGroupbyAlertExecutorId(String site, String dataSource) throws Exception {
- List<AlertDefinitionAPIEntity> list = findActiveAlertDefs(site, dataSource);
- Map<String, Map<String, AlertDefinitionAPIEntity>> map = new HashMap<String, Map<String, AlertDefinitionAPIEntity>>();
- for (AlertDefinitionAPIEntity entity : list) {
- String executorID = entity.getTags().get(AlertConstants.ALERT_EXECUTOR_ID);
- if (map.get(executorID) == null) {
- map.put(executorID, new HashMap<String, AlertDefinitionAPIEntity>());
- }
- map.get(executorID).put(entity.getTags().get("policyId"), entity);
- }
- return map;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertExecutorDAO.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertExecutorDAO.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertExecutorDAO.java
deleted file mode 100644
index 7fc1469..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertExecutorDAO.java
+++ /dev/null
@@ -1,26 +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.dao;
-
-import org.apache.eagle.alert.entity.AlertExecutorEntity;
-
-import java.util.List;
-
-public interface AlertExecutorDAO {
- List<AlertExecutorEntity> findAlertExecutorByDataSource(String dataSource) throws Exception;
- List<AlertExecutorEntity> findAlertExecutor(String dataSource, String alertExecutorId) throws Exception;
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertExecutorDAOImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertExecutorDAOImpl.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertExecutorDAOImpl.java
deleted file mode 100644
index 590a9db..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertExecutorDAOImpl.java
+++ /dev/null
@@ -1,86 +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.dao;
-
-import org.apache.eagle.alert.common.AlertConstants;
-import org.apache.eagle.alert.entity.AlertExecutorEntity;
-import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
-import org.apache.eagle.service.client.EagleServiceConnector;
-import org.apache.eagle.service.client.IEagleServiceClient;
-import org.apache.eagle.service.client.impl.EagleServiceClientImpl;
-import org.apache.commons.lang.time.DateUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-public class AlertExecutorDAOImpl implements AlertExecutorDAO{
- private final Logger LOG = LoggerFactory.getLogger(AlertExecutorDAOImpl.class);
- private final EagleServiceConnector connector;
-
- public AlertExecutorDAOImpl(EagleServiceConnector connector){
- this.connector = connector;
- }
-
- @Override
- public List<AlertExecutorEntity> findAlertExecutorByDataSource(String dataSource) throws Exception{
- try {
- IEagleServiceClient client = new EagleServiceClientImpl(connector);
- String query = AlertConstants.ALERT_EXECUTOR_SERVICE_ENDPOINT_NAME + "[@dataSource=\"" + dataSource + "\"]{*}";
- GenericServiceAPIResponseEntity<AlertExecutorEntity> response = client.search()
- .startTime(0)
- .endTime(10 * DateUtils.MILLIS_PER_DAY)
- .pageSize(Integer.MAX_VALUE)
- .query(query)
- .send();
- client.close();
- if (response.getException() != null) {
- throw new Exception("Got an exception when query eagle service: " + response.getException());
- }
- return response.getObj();
- }
- catch (Exception ex) {
- LOG.error("Got an exception when query stream metadata service ", ex);
- throw new IllegalStateException(ex);
- }
- }
-
- @Override
- public List<AlertExecutorEntity> findAlertExecutor(String dataSource, String alertExecutorId) throws Exception{
- try {
- IEagleServiceClient client = new EagleServiceClientImpl(connector);
- String query = AlertConstants.ALERT_EXECUTOR_SERVICE_ENDPOINT_NAME + "[@dataSource=\"" + dataSource + "\""
- + " AND @alertExecutorId=\"" + alertExecutorId + "\""
- + "]{*}";
- GenericServiceAPIResponseEntity<AlertExecutorEntity> response = client.search()
- .startTime(0)
- .endTime(10 * DateUtils.MILLIS_PER_DAY)
- .pageSize(Integer.MAX_VALUE)
- .query(query)
- .send();
- client.close();
- if (response.getException() != null) {
- throw new Exception("Got an exception when query eagle service: " + response.getException());
- }
- return response.getObj();
- }
- catch (Exception ex) {
- LOG.error("Got an exception when query stream metadata service ", ex);
- throw new IllegalStateException(ex);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamDAO.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamDAO.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamDAO.java
deleted file mode 100644
index 17bdef0..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamDAO.java
+++ /dev/null
@@ -1,25 +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.dao;
-
-import org.apache.eagle.alert.entity.AlertStreamEntity;
-
-import java.util.List;
-
-public interface AlertStreamDAO {
- List<AlertStreamEntity> findAlertStreamByDataSource(String dataSource) throws Exception;
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamDAOImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamDAOImpl.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamDAOImpl.java
deleted file mode 100644
index 95ac2a9..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamDAOImpl.java
+++ /dev/null
@@ -1,62 +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.dao;
-
-import com.typesafe.config.Config;
-import org.apache.eagle.alert.common.AlertConstants;
-import org.apache.eagle.alert.entity.AlertStreamEntity;
-import org.apache.eagle.common.config.EagleConfigConstants;
-import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
-import org.apache.eagle.service.client.EagleServiceConnector;
-import org.apache.eagle.service.client.IEagleServiceClient;
-import org.apache.eagle.service.client.impl.EagleServiceClientImpl;
-import org.apache.commons.lang.time.DateUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-public class AlertStreamDAOImpl implements AlertStreamDAO{
- private final Logger LOG = LoggerFactory.getLogger(AlertStreamDAOImpl.class);
- private final EagleServiceConnector connector;
-
- public AlertStreamDAOImpl(EagleServiceConnector connector){
- this.connector = connector;
- }
-
- public List<AlertStreamEntity> findAlertStreamByDataSource(String dataSource) throws Exception{
- try {
- IEagleServiceClient client = new EagleServiceClientImpl(connector);
- String query = AlertConstants.ALERT_STREAM_SERVICE_ENDPOINT_NAME + "[@dataSource=\"" + dataSource + "\"]{*}";
- GenericServiceAPIResponseEntity<AlertStreamEntity> response = client.search()
- .startTime(0)
- .endTime(10 * DateUtils.MILLIS_PER_DAY)
- .pageSize(Integer.MAX_VALUE)
- .query(query)
- .send();
- client.close();
- if (response.getException() != null) {
- throw new Exception("Got an exception when query eagle service: " + response.getException());
- }
- return response.getObj();
- }
- catch (Exception ex) {
- LOG.error("Got an exception when query stream metadata service ", ex);
- throw new IllegalStateException(ex);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamSchemaDAO.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamSchemaDAO.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamSchemaDAO.java
deleted file mode 100644
index 0e69d89..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamSchemaDAO.java
+++ /dev/null
@@ -1,25 +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.dao;
-
-import java.util.List;
-
-import org.apache.eagle.alert.entity.AlertStreamSchemaEntity;
-
-public interface AlertStreamSchemaDAO {
- List<AlertStreamSchemaEntity> findAlertStreamSchemaByDataSource(String dataSource) throws Exception;
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamSchemaDAOImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamSchemaDAOImpl.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamSchemaDAOImpl.java
deleted file mode 100644
index 4c252b7..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/dao/AlertStreamSchemaDAOImpl.java
+++ /dev/null
@@ -1,83 +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.dao;
-
-import com.typesafe.config.Config;
-import org.apache.eagle.alert.common.AlertConstants;
-import org.apache.eagle.alert.entity.AlertStreamSchemaEntity;
-import org.apache.eagle.common.config.EagleConfigConstants;
-import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
-import org.apache.eagle.service.client.IEagleServiceClient;
-import org.apache.eagle.service.client.impl.EagleServiceClientImpl;
-import org.apache.commons.lang.time.DateUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-public class AlertStreamSchemaDAOImpl implements AlertStreamSchemaDAO {
- private final Logger LOG = LoggerFactory.getLogger(AlertStreamSchemaDAOImpl.class);
-
- private final String eagleServiceHost;
- private final Integer eagleServicePort;
- private String username;
- private String password;
-
- public AlertStreamSchemaDAOImpl(String eagleServiceHost, Integer eagleServicePort) {
- this(eagleServiceHost, eagleServicePort, null, null);
- }
-
- public AlertStreamSchemaDAOImpl(String eagleServiceHost, Integer eagleServicePort, String username, String password) {
- this.eagleServiceHost = eagleServiceHost;
- this.eagleServicePort = eagleServicePort;
- this.username = username;
- this.password = password;
- }
-
- public AlertStreamSchemaDAOImpl(Config config) {
- this.eagleServiceHost = config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.HOST);
- this.eagleServicePort = config.getInt(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PORT);
- if (config.hasPath(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.USERNAME) &&
- config.hasPath(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PASSWORD)) {
- this.username = config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.USERNAME);
- this.password = config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PASSWORD);
- }
- }
-
- @Override
- public List<AlertStreamSchemaEntity> findAlertStreamSchemaByDataSource(String dataSource) throws Exception {
- try {
- IEagleServiceClient client = new EagleServiceClientImpl(eagleServiceHost, eagleServicePort, username, password);
- String query = AlertConstants.ALERT_STREAM_SCHEMA_SERVICE_ENDPOINT_NAME + "[@dataSource=\"" + dataSource + "\"]{*}";
- GenericServiceAPIResponseEntity<AlertStreamSchemaEntity> response = client.search()
- .startTime(0)
- .endTime(10 * DateUtils.MILLIS_PER_DAY)
- .pageSize(Integer.MAX_VALUE)
- .query(query)
- .send();
- client.close();
- if (response.getException() != null) {
- throw new Exception("Got an exception when query eagle service: " + response.getException());
- }
- return response.getObj();
- }
- catch (Exception ex) {
- LOG.error("Got an exception when query stream metadata service ", ex);
- throw new IllegalStateException(ex);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertAPIEntity.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertAPIEntity.java
deleted file mode 100644
index 7b51f8d..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertAPIEntity.java
+++ /dev/null
@@ -1,84 +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.entity;
-
-import org.apache.eagle.alert.common.AlertConstants;
-import org.apache.eagle.common.metric.AlertContext;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.meta.Column;
-import org.apache.eagle.log.entity.meta.ColumnFamily;
-import org.apache.eagle.log.entity.meta.Prefix;
-import org.apache.eagle.log.entity.meta.Service;
-import org.apache.eagle.log.entity.meta.Table;
-import org.apache.eagle.log.entity.meta.TimeSeries;
-
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
-@Table("alertdetail")
-@ColumnFamily("f")
-@Prefix("hadoop")
-@Service(AlertConstants.ALERT_SERVICE_ENDPOINT_NAME)
-@TimeSeries(true)
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class AlertAPIEntity extends TaggedLogAPIEntity{
- @Column("description")
- private String description;
- @Column("remediationID")
- private String remediationID;
- @Column("remediationCallback")
- private String remediationCallback;
- @Column("alertContext")
- private AlertContext alertContext;
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- _pcs.firePropertyChange("description", null, null);
- }
-
- public String getRemediationID() {
- return remediationID;
- }
-
- public void setRemediationID(String remediationID) {
- this.remediationID = remediationID;
- _pcs.firePropertyChange("remediationID", null, null);
- }
-
- public String getRemediationCallback() {
- return remediationCallback;
- }
-
- public void setRemediationCallback(String remediationCallback) {
- this.remediationCallback = remediationCallback;
- _pcs.firePropertyChange("remediationCallback", null, null);
- }
-
- public AlertContext getAlertContext() {
- return alertContext;
- }
-
- public void setAlertContext(AlertContext alertContext) {
- this.alertContext = alertContext;
- _pcs.firePropertyChange("alertContext", null, null);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertContextSerDeser.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertContextSerDeser.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertContextSerDeser.java
deleted file mode 100644
index f001725..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertContextSerDeser.java
+++ /dev/null
@@ -1,98 +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.entity;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.eagle.common.metric.AlertContext;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import org.apache.eagle.log.entity.meta.EntitySerDeser;
-
-public class AlertContextSerDeser implements EntitySerDeser<AlertContext> {
-
- @Override
- public AlertContext deserialize(byte[] bytes) {
- AlertContext context = new AlertContext();
- Map<String, String> properties = new HashMap<String, String>();
- final int length = bytes.length;
- if (length < 4) { return context; }
- int size = Bytes.toInt(bytes, 0, 4);
-
- int offset = 4;
- for (int i = 0; i < size; i++) {
- int keySize = Bytes.toInt(bytes, offset, 4);
- offset += 4;
- int valueSize = Bytes.toInt(bytes, offset, 4);
- offset += 4;
- String key = Bytes.toString(bytes, offset, keySize);
- offset += keySize;
- String value =Bytes.toString(bytes, offset, valueSize);
- offset += valueSize;
- properties.put(key, value);
- }
- context.addAll(properties);
- return context;
- }
-
- @Override
- public byte[] serialize(AlertContext context) {
-
- final Map<String, String> pair = context.getProperties();
- int totalSize = 4;
- for (Entry<String, String> entry : pair.entrySet()) {
- String key = entry.getKey();
- String value = entry.getValue();
- int keySize = 0;
- if(key!=null) keySize = key.getBytes().length;
- int valueSize = 0;
- if(value!=null) valueSize = value.getBytes().length;
- totalSize += keySize + valueSize + 8;
- }
- byte[] buffer = new byte[totalSize];
-
- Bytes.putInt(buffer, 0, pair.size());
- int offset = 4;
- for (Entry<String, String> entry : pair.entrySet()) {
- String key = entry.getKey();
- String value = entry.getValue();
-
- int keySize = key !=null ? key.getBytes().length : 0;
- int valueSize = value != null ? value.getBytes().length:0;
-
- Bytes.putInt(buffer, offset, keySize);
- offset += 4;
- Bytes.putInt(buffer, offset, valueSize);
- offset += 4;
-
-
- Bytes.putBytes(buffer, offset, key != null ? key.getBytes() : new byte[0], 0, keySize);
- offset += keySize;
- Bytes.putBytes(buffer, offset, value != null ? value.getBytes() : new byte[0], 0, valueSize);
- offset += valueSize;
- }
- return buffer;
- }
-
-
- @Override
- public Class<AlertContext> type(){
- return AlertContext.class;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertDataSourceEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertDataSourceEntity.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertDataSourceEntity.java
deleted file mode 100644
index ec7d432..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertDataSourceEntity.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.alert.entity;
-
-import org.apache.eagle.alert.common.AlertConstants;
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.meta.*;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
-@Table("alertDataSource")
-@ColumnFamily("f")
-@Prefix("alertDataSource")
-@Service(AlertConstants.ALERT_DATA_SOURCE_SERVICE_ENDPOINT_NAME)
-@JsonIgnoreProperties(ignoreUnknown = true)
-@TimeSeries(false)
-@Tags({"site", "dataSource"})
-public class AlertDataSourceEntity extends TaggedLogAPIEntity{
- @Column("a")
- private boolean enabled;
- @Column("b")
- private String config;
- @Column("c")
- private String desc;
-
- public String getConfig() {
- return config;
- }
-
- public void setConfig(String config) {
- this.config = config;
- valueChanged("config");
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- valueChanged("enabled");
- }
-
- public String getDesc() {
- return desc;
- }
-
- public void setDesc(String desc) {
- this.desc = desc;
- valueChanged("desc");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertDefinitionAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertDefinitionAPIEntity.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertDefinitionAPIEntity.java
deleted file mode 100644
index 61a5ae2..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertDefinitionAPIEntity.java
+++ /dev/null
@@ -1,181 +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.entity;
-
-import org.apache.eagle.alert.common.AlertConstants;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.meta.Column;
-import org.apache.eagle.log.entity.meta.ColumnFamily;
-import org.apache.eagle.log.entity.meta.Index;
-import org.apache.eagle.log.entity.meta.Indexes;
-import org.apache.eagle.log.entity.meta.Prefix;
-import org.apache.eagle.log.entity.meta.Service;
-import org.apache.eagle.log.entity.meta.Table;
-import org.apache.eagle.log.entity.meta.Tags;
-import org.apache.eagle.log.entity.meta.TimeSeries;
-
-/**
- * site: site name
- * dataSource: data source name
- *
- * alertExecutorId: Group Policy by alertExecutorId, the policy definition with the sample ["site", "dataSource", "alertExecutorId"] should run on the sample alert executor
- *
- * policyId: policy name, should be unique
- * policyType: policy engine implementation type
- */
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
-@Table("alertdef")
-@ColumnFamily("f")
-@Prefix("alertdef")
-@Service(AlertConstants.ALERT_DEFINITION_SERVICE_ENDPOINT_NAME)
-@JsonIgnoreProperties(ignoreUnknown = true)
-@TimeSeries(false)
-@Tags({"site", "dataSource", "alertExecutorId", "policyId", "policyType"})
-@Indexes({
- @Index(name="Index_1_alertExecutorId", columns = { "alertExecutorID" }, unique = true),
-})
-public class AlertDefinitionAPIEntity extends TaggedLogAPIEntity{
- @Column("a")
- private String desc;
- @Column("b")
- private String policyDef;
- @Column("c")
- private String dedupeDef;
- @Column("d")
- private String notificationDef;
- @Column("e")
- private String remediationDef;
- @Column("f")
- private boolean enabled;
- @Column("g")
- private String owner;
- @Column("h")
- private long lastModifiedDate;
- @Column("i")
- private long severity;
- @Column("j")
- private long createdTime;
-
- public String getDesc() {
- return desc;
- }
- public void setDesc(String desc) {
- this.desc = desc;
- valueChanged("desc");
- }
- public String getPolicyDef() {
- return policyDef;
- }
- public void setPolicyDef(String policyDef) {
- this.policyDef = policyDef;
- valueChanged("policyDef");
- }
- public String getDedupeDef() {
- return dedupeDef;
- }
- public void setDedupeDef(String dedupeDef) {
- this.dedupeDef = dedupeDef;
- valueChanged("dedupeDef");
- }
- public String getNotificationDef() {
- return notificationDef;
- }
- public void setNotificationDef(String notificationDef) {
- this.notificationDef = notificationDef;
- valueChanged("notificationDef");
- }
- public String getRemediationDef() {
- return remediationDef;
- }
- public void setRemediationDef(String remediationDef) {
- this.remediationDef = remediationDef;
- valueChanged("remediationDef");
- }
- public boolean isEnabled() {
- return enabled;
- }
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- valueChanged("enabled");
- }
- public String getOwner() {
- return owner;
- }
- public void setOwner(String owner) {
- this.owner = owner;
- valueChanged("owner");
- }
- public long getLastModifiedDate() {
- return lastModifiedDate;
- }
- public void setLastModifiedDate(long lastModifiedDate) {
- this.lastModifiedDate = lastModifiedDate;
- valueChanged("lastModifiedDate");
- }
- public long getSeverity() {
- return severity;
- }
- public void setSeverity(long severity) {
- this.severity = severity;
- valueChanged("severity");
- }
- public long getCreatedTime() {
- return createdTime;
- }
- public void setCreatedTime(long createdTime) {
- this.createdTime = createdTime;
- valueChanged("createdTime");
- }
- public boolean equals(Object o){
- if(o == this)
- return true;
- if(!(o instanceof AlertDefinitionAPIEntity))
- return false;
- AlertDefinitionAPIEntity that = (AlertDefinitionAPIEntity)o;
- if(that.enabled == this.enabled &&
- compare(that.policyDef, this.policyDef) &&
- compare(that.dedupeDef, this.dedupeDef) &&
- compare(that.notificationDef, this.notificationDef) &&
- compare(that.remediationDef, this.remediationDef))
- return true;
- return false;
- }
-
- private boolean compare(String a, String b){
- if(a == b)
- return true;
- if(a == null || b == null)
- return false;
- if(a.equals(b))
- return true;
- return false;
- }
-
- public int hashCode(){
- HashCodeBuilder builder = new HashCodeBuilder();
- builder.append(enabled);
- builder.append(policyDef);
- builder.append(dedupeDef);
- builder.append(notificationDef);
- builder.append(remediationDef);
- return builder.toHashCode();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertEntityRepository.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertEntityRepository.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertEntityRepository.java
deleted file mode 100644
index ad518e9..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertEntityRepository.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.entity;
-
-import org.apache.eagle.common.metric.AlertContext;
-import org.apache.eagle.log.entity.repo.EntityRepository;
-
-public class AlertEntityRepository extends EntityRepository {
- public AlertEntityRepository() {
- serDeserMap.put(AlertContext.class, new AlertContextSerDeser());
- entitySet.add(AlertAPIEntity.class);
- entitySet.add(AlertDefinitionAPIEntity.class);
- entitySet.add(AlertStreamSchemaEntity.class);
- entitySet.add(AlertStreamEntity.class);
- entitySet.add(AlertDataSourceEntity.class);
- entitySet.add(AlertExecutorEntity.class);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertExecutorEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertExecutorEntity.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertExecutorEntity.java
deleted file mode 100644
index 60d51c7..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertExecutorEntity.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.entity;
-
-import org.apache.eagle.alert.common.AlertConstants;
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.meta.*;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
-@Table("alertExecutor")
-@ColumnFamily("f")
-@Prefix("alertExecutor")
-@Service(AlertConstants.ALERT_EXECUTOR_SERVICE_ENDPOINT_NAME)
-@JsonIgnoreProperties(ignoreUnknown = true)
-@TimeSeries(false)
-@Tags({"dataSource", "alertExecutorId", "streamName"})
-public class AlertExecutorEntity extends TaggedLogAPIEntity{
- @Column("a")
- private String desc;
-
- public String getDesc() {
- return desc;
- }
-
- public void setDesc(String desc) {
- this.desc = desc;
- valueChanged("desc");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertStreamEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertStreamEntity.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertStreamEntity.java
deleted file mode 100644
index f0f2c7b..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertStreamEntity.java
+++ /dev/null
@@ -1,51 +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.entity;
-
-import org.apache.eagle.alert.common.AlertConstants;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.meta.Column;
-import org.apache.eagle.log.entity.meta.ColumnFamily;
-import org.apache.eagle.log.entity.meta.Prefix;
-import org.apache.eagle.log.entity.meta.Service;
-import org.apache.eagle.log.entity.meta.Table;
-import org.apache.eagle.log.entity.meta.Tags;
-import org.apache.eagle.log.entity.meta.TimeSeries;
-
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
-@Table("alertStream")
-@ColumnFamily("f")
-@Prefix("alertStream")
-@Service(AlertConstants.ALERT_STREAM_SERVICE_ENDPOINT_NAME)
-@JsonIgnoreProperties(ignoreUnknown = true)
-@TimeSeries(false)
-@Tags({"dataSource", "streamName"})
-public class AlertStreamEntity extends TaggedLogAPIEntity{
- @Column("a")
- private String desc;
-
- public String getDesc() {
- return desc;
- }
- public void setDesc(String desc) {
- this.desc = desc;
- valueChanged("desc");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertStreamSchemaEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertStreamSchemaEntity.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertStreamSchemaEntity.java
deleted file mode 100644
index 76b6097..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/entity/AlertStreamSchemaEntity.java
+++ /dev/null
@@ -1,111 +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.entity;
-
-import org.apache.eagle.alert.common.AlertConstants;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.meta.Column;
-import org.apache.eagle.log.entity.meta.ColumnFamily;
-import org.apache.eagle.log.entity.meta.Prefix;
-import org.apache.eagle.log.entity.meta.Service;
-import org.apache.eagle.log.entity.meta.Table;
-import org.apache.eagle.log.entity.meta.Tags;
-import org.apache.eagle.log.entity.meta.TimeSeries;
-
-/**
- * ddl to create streammetadata table
- *
- * create 'alertStreamSchema', {NAME => 'f', BLOOMFILTER => 'ROW', VERSIONS => '1', COMPRESSION => 'SNAPPY'}
- */
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
-@Table("alertStreamSchema")
-@ColumnFamily("f")
-@Prefix("alertStreamSchema")
-@Service(AlertConstants.ALERT_STREAM_SCHEMA_SERVICE_ENDPOINT_NAME)
-@JsonIgnoreProperties(ignoreUnknown = true)
-@TimeSeries(false)
-@Tags({"dataSource", "streamName", "attrName"})
-public class AlertStreamSchemaEntity extends TaggedLogAPIEntity{
- @Column("a")
- private String attrType;
- @Column("b")
- private String category;
- @Column("c")
- private String attrValueResolver;
- /* all tags form the key for alert de-duplication */
- @Column("d")
- private Boolean usedAsTag;
- @Column("e")
- private String attrDescription;
- @Column("f")
- private String attrDisplayName;
- @Column("g")
- private String defaultValue;
-
- public String getAttrType() {
- return attrType;
- }
- public void setAttrType(String attrType) {
- this.attrType = attrType;
- valueChanged("attrType");
- }
- public String getCategory() {
- return category;
- }
- public void setCategory(String category) {
- this.category = category;
- valueChanged("category");
- }
- public String getAttrValueResolver() {
- return attrValueResolver;
- }
- public void setAttrValueResolver(String attrValueResolver) {
- this.attrValueResolver = attrValueResolver;
- valueChanged("attrValueResolver");
- }
- public Boolean getUsedAsTag() {
- return usedAsTag;
- }
- public void setUsedAsTag(Boolean usedAsTag) {
- this.usedAsTag = usedAsTag;
- valueChanged("usedAsTag");
- }
- public String getAttrDescription() {
- return attrDescription;
- }
- public void setAttrDescription(String attrDescription) {
- this.attrDescription = attrDescription;
- valueChanged("attrDescription");
- }
- public String getAttrDisplayName() {
- return attrDisplayName;
- }
- public void setAttrDisplayName(String attrDisplayName) {
- this.attrDisplayName = attrDisplayName;
- valueChanged("attrDisplayName");
- }
- public String getDefaultValue() {
- return defaultValue;
- }
- public void setDefaultValue(String defaultValue) {
- this.defaultValue = defaultValue;
- valueChanged("defaultValue");
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/da8f419c/eagle-core/eagle-alert/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/AbstractPolicyDefinition.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/AbstractPolicyDefinition.java b/eagle-core/eagle-alert/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/AbstractPolicyDefinition.java
deleted file mode 100644
index 9a9a9e2..0000000
--- a/eagle-core/eagle-alert/eagle-alert-process/src/main/java/org/apache/eagle/alert/config/AbstractPolicyDefinition.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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-
-/**
- * base fields for all policy definition
- */
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible=true)
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class AbstractPolicyDefinition {
- private String type;
- /**
- * @return type in string
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type set type value
- */
- public void setType(String type) {
- this.type = type;
- }
-}
\ No newline at end of file