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/06/02 07:07:45 UTC
[06/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen
alert engine code on branch-0.5
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/jdbc/JdbcMetadataDaoImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/jdbc/JdbcMetadataDaoImpl.java b/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/jdbc/JdbcMetadataDaoImpl.java
deleted file mode 100644
index 9ec119a..0000000
--- a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/jdbc/JdbcMetadataDaoImpl.java
+++ /dev/null
@@ -1,292 +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.metadata.impl.jdbc;
-
-import java.util.List;
-
-import org.apache.eagle.alert.coordination.model.Kafka2TupleMetadata;
-import org.apache.eagle.alert.coordination.model.ScheduleState;
-import org.apache.eagle.alert.coordination.model.internal.PolicyAssignment;
-import org.apache.eagle.alert.coordination.model.internal.Topology;
-import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
-import org.apache.eagle.alert.engine.coordinator.Publishment;
-import org.apache.eagle.alert.engine.coordinator.PublishmentType;
-import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import org.apache.eagle.alert.engine.coordinator.StreamingCluster;
-import org.apache.eagle.alert.metadata.resource.OpResult;
-import org.apache.eagle.alert.metadata.resource.IMetadataDao;
-import org.apache.eagle.alert.metadata.resource.Models;
-
-/**
- * @since May 26, 2016
- *
- */
-public class JdbcMetadataDaoImpl implements IMetadataDao {
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#listTopologies()
- */
- @Override
- public List<Topology> listTopologies() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#addTopology(org.apache.eagle.alert.coordination.model.internal.Topology)
- */
- @Override
- public OpResult addTopology(Topology t) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#removeTopology(java.lang.String)
- */
- @Override
- public OpResult removeTopology(String topologyName) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#listClusters()
- */
- @Override
- public List<StreamingCluster> listClusters() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#addCluster(org.apache.eagle.alert.engine.coordinator.StreamingCluster)
- */
- @Override
- public OpResult addCluster(StreamingCluster cluster) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#removeCluster(java.lang.String)
- */
- @Override
- public OpResult removeCluster(String clusterId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#listStreams()
- */
- @Override
- public List<StreamDefinition> listStreams() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#createStream(org.apache.eagle.alert.engine.coordinator.StreamDefinition)
- */
- @Override
- public OpResult createStream(StreamDefinition stream) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#removeStream(java.lang.String)
- */
- @Override
- public OpResult removeStream(String streamId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#listDataSources()
- */
- @Override
- public List<Kafka2TupleMetadata> listDataSources() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#addDataSource(org.apache.eagle.alert.coordination.model.Kafka2TupleMetadata)
- */
- @Override
- public OpResult addDataSource(Kafka2TupleMetadata dataSource) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#removeDataSource(java.lang.String)
- */
- @Override
- public OpResult removeDataSource(String datasourceId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#listPolicies()
- */
- @Override
- public List<PolicyDefinition> listPolicies() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#addPolicy(org.apache.eagle.alert.engine.coordinator.PolicyDefinition)
- */
- @Override
- public OpResult addPolicy(PolicyDefinition policy) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#removePolicy(java.lang.String)
- */
- @Override
- public OpResult removePolicy(String policyId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#listPublishment()
- */
- @Override
- public List<Publishment> listPublishment() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#addPublishment(org.apache.eagle.alert.engine.coordinator.Publishment)
- */
- @Override
- public OpResult addPublishment(Publishment publishment) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#removePublishment(java.lang.String)
- */
- @Override
- public OpResult removePublishment(String pubId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#getScheduleState(java.lang.String)
- */
- @Override
- public ScheduleState getScheduleState(String versionId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#getScheduleState()
- */
- @Override
- public ScheduleState getScheduleState() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#addScheduleState(org.apache.eagle.alert.coordination.model.ScheduleState)
- */
- @Override
- public OpResult addScheduleState(ScheduleState state) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#listAssignments()
- */
- @Override
- public List<PolicyAssignment> listAssignments() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#addAssignment(org.apache.eagle.alert.coordination.model.internal.PolicyAssignment)
- */
- @Override
- public OpResult addAssignment(PolicyAssignment assignment) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#clear()
- */
- @Override
- public OpResult clear() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#export()
- */
- @Override
- public Models export() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.eagle.service.alert.resource.IMetadataDao#importModels(org.apache.eagle.service.alert.resource.Models)
- */
- @Override
- public OpResult importModels(Models models) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public List<PublishmentType> listPublishmentType() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public OpResult addPublishmentType(PublishmentType publishmentType) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public OpResult removePublishmentType(String pubType) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/resource/IMetadataDao.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/resource/IMetadataDao.java b/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/resource/IMetadataDao.java
deleted file mode 100644
index 8eef985..0000000
--- a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/resource/IMetadataDao.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.metadata.resource;
-
-import java.util.List;
-
-import org.apache.eagle.alert.coordination.model.Kafka2TupleMetadata;
-import org.apache.eagle.alert.coordination.model.ScheduleState;
-import org.apache.eagle.alert.coordination.model.internal.PolicyAssignment;
-import org.apache.eagle.alert.coordination.model.internal.Topology;
-import org.apache.eagle.alert.engine.coordinator.*;
-
-public interface IMetadataDao {
-
- List<Topology> listTopologies();
-
- OpResult addTopology(Topology t);
-
- OpResult removeTopology(String topologyName);
-
- List<StreamingCluster> listClusters();
-
- OpResult addCluster(StreamingCluster cluster);
-
- OpResult removeCluster(String clusterId);
-
- List<StreamDefinition> listStreams();
-
- OpResult createStream(StreamDefinition stream);
-
- OpResult removeStream(String streamId);
-
- List<Kafka2TupleMetadata> listDataSources();
-
- OpResult addDataSource(Kafka2TupleMetadata dataSource);
-
- OpResult removeDataSource(String datasourceId);
-
- List<PolicyDefinition> listPolicies();
-
- OpResult addPolicy(PolicyDefinition policy);
-
- OpResult removePolicy(String policyId);
-
- List<Publishment> listPublishment();
-
- OpResult addPublishment(Publishment publishment);
-
- OpResult removePublishment(String pubId);
-
- List<PublishmentType> listPublishmentType();
-
- OpResult addPublishmentType(PublishmentType publishmentType);
-
- OpResult removePublishmentType(String pubType);
-
- ScheduleState getScheduleState(String versionId);
-
- ScheduleState getScheduleState();
-
- OpResult addScheduleState(ScheduleState state);
-
- List<PolicyAssignment> listAssignments();
-
- OpResult addAssignment(PolicyAssignment assignment);
-
- // APIs for test friendly
- OpResult clear();
- Models export();
- OpResult importModels(Models models);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/resource/Models.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/resource/Models.java b/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/resource/Models.java
deleted file mode 100644
index 6bb38f1..0000000
--- a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/resource/Models.java
+++ /dev/null
@@ -1,48 +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.metadata.resource;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.apache.eagle.alert.coordination.model.Kafka2TupleMetadata;
-import org.apache.eagle.alert.coordination.model.ScheduleState;
-import org.apache.eagle.alert.coordination.model.internal.PolicyAssignment;
-import org.apache.eagle.alert.coordination.model.internal.Topology;
-import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
-import org.apache.eagle.alert.engine.coordinator.Publishment;
-import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import org.apache.eagle.alert.engine.coordinator.StreamingCluster;
-
-/**
- * This models used for metadata export/import to easy of test.
- *
- * @since May 23, 2016
- *
- */
-public class Models {
- public List<StreamingCluster> clusters = new ArrayList<StreamingCluster>();
- public List<StreamDefinition> schemas = new ArrayList<StreamDefinition>();
- public List<Kafka2TupleMetadata> datasources = new ArrayList<Kafka2TupleMetadata>();
- public List<PolicyDefinition> policies = new ArrayList<PolicyDefinition>();
- public List<Publishment> publishments = new ArrayList<Publishment>();
- public SortedMap<String, ScheduleState> scheduleStates = new TreeMap<String, ScheduleState>();
- public List<PolicyAssignment> assignments = new ArrayList<PolicyAssignment>();
- public List<Topology> topologies = new ArrayList<Topology>();
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/resource/OpResult.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/resource/OpResult.java b/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/resource/OpResult.java
deleted file mode 100644
index 44f507d..0000000
--- a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/resource/OpResult.java
+++ /dev/null
@@ -1,28 +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.metadata.resource;
-
-/**
- * @since Apr 11, 2016
- *
- */
-public class OpResult {
-
- public int code = 200;
- public String message = "";
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/resources/application.conf b/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/resources/application.conf
deleted file mode 100644
index 9c80298..0000000
--- a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/main/resources/application.conf
+++ /dev/null
@@ -1,23 +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.
-
-{
- "datastore": {
- "metadataDao": "org.apache.eagle.service.alert.resource.impl.InMemMetadataDaoImpl",
- "connection": "localhost:27017",
- "properties" : {
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/java/org/apache/eagle/service/alert/resource/impl/InMemoryTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/java/org/apache/eagle/service/alert/resource/impl/InMemoryTest.java b/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/java/org/apache/eagle/service/alert/resource/impl/InMemoryTest.java
deleted file mode 100644
index 54a2ffc..0000000
--- a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/java/org/apache/eagle/service/alert/resource/impl/InMemoryTest.java
+++ /dev/null
@@ -1,43 +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.service.alert.resource.impl;
-
-import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
-import org.apache.eagle.alert.metadata.impl.InMemMetadataDaoImpl;
-import org.apache.eagle.alert.metadata.resource.IMetadataDao;
-import org.junit.Assert;
-import org.junit.Test;
-
-import com.typesafe.config.ConfigFactory;
-
-/**
- * @since May 1, 2016
- *
- */
-public class InMemoryTest {
-
- private IMetadataDao dao = new InMemMetadataDaoImpl(ConfigFactory.load());
-
- @Test
- public void test_AddPolicy() {
- PolicyDefinition pd = new PolicyDefinition();
- pd.setName("pd1");
- dao.addPolicy(pd);
-
- Assert.assertEquals(1, dao.listPolicies().size());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/java/org/apache/eagle/service/alert/resource/impl/MongoImplTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/java/org/apache/eagle/service/alert/resource/impl/MongoImplTest.java b/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/java/org/apache/eagle/service/alert/resource/impl/MongoImplTest.java
deleted file mode 100644
index 16b53d4..0000000
--- a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/java/org/apache/eagle/service/alert/resource/impl/MongoImplTest.java
+++ /dev/null
@@ -1,187 +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.service.alert.resource.impl;
-
-import java.util.Date;
-import java.util.List;
-
-import org.apache.eagle.alert.coordination.model.Kafka2TupleMetadata;
-import org.apache.eagle.alert.coordination.model.ScheduleState;
-import org.apache.eagle.alert.coordination.model.internal.PolicyAssignment;
-import org.apache.eagle.alert.coordination.model.internal.Topology;
-import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
-import org.apache.eagle.alert.engine.coordinator.Publishment;
-import org.apache.eagle.alert.engine.coordinator.PublishmentType;
-import org.apache.eagle.alert.engine.coordinator.StreamingCluster;
-import org.apache.eagle.alert.metadata.impl.MongoMetadataDaoImpl;
-import org.apache.eagle.alert.metadata.resource.IMetadataDao;
-import org.apache.eagle.alert.metadata.resource.OpResult;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.typesafe.config.Config;
-import com.typesafe.config.ConfigFactory;
-
-import de.flapdoodle.embed.mongo.MongodExecutable;
-import de.flapdoodle.embed.mongo.MongodProcess;
-import de.flapdoodle.embed.mongo.MongodStarter;
-import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
-import de.flapdoodle.embed.mongo.config.Net;
-import de.flapdoodle.embed.mongo.distribution.Version;
-import de.flapdoodle.embed.process.runtime.Network;
-
-/**
- * @since May 1, 2016
- *
- */
-public class MongoImplTest {
- private static Logger LOG = LoggerFactory.getLogger(MongoImplTest.class);
- static IMetadataDao dao;
-
- private static MongodExecutable mongodExe;
- private static MongodProcess mongod;
-
- public static void before() {
- try {
- MongodStarter starter = MongodStarter.getDefaultInstance();
- mongodExe = starter.prepare(new MongodConfigBuilder().version(Version.V3_2_1)
- .net(new Net(27017, Network.localhostIsIPv6())).build());
- mongod = mongodExe.start();
- } catch (Exception e) {
- LOG.error("start embed mongod failed, assume some external mongo running. continue run test!", e);
- }
- }
-
- @BeforeClass
- public static void setup() {
- before();
-
- System.setProperty("config.resource", "/application-mongo.conf");
- ConfigFactory.invalidateCaches();
- Config config = ConfigFactory.load().getConfig("datastore");
- dao = new MongoMetadataDaoImpl(config);
-
- }
-
- @AfterClass
- public static void teardown() {
- if (mongod != null) {
- mongod.stop();
- mongodExe.stop();
- }
- }
-
- private String TOPO_NAME = "topoName";
-
- @Test
- public void test_apis() {
- // topology
- {
- OpResult result = dao.addTopology(new Topology(TOPO_NAME, 3, 5));
- System.out.println(result.message);
- Assert.assertEquals(200, result.code);
- List<Topology> topos = dao.listTopologies();
- Assert.assertEquals(1, topos.size());
-
- result = dao.addTopology(new Topology(TOPO_NAME + "-new", 3, 5));
- topos = dao.listTopologies();
- Assert.assertEquals(2, topos.size());
- // add again: replace existing one
- result = dao.addTopology(new Topology(TOPO_NAME, 4, 5));
- topos = dao.listTopologies();
- Assert.assertEquals(2, topos.size());
- Assert.assertEquals(TOPO_NAME, topos.get(0).getName());
- Assert.assertEquals(4, topos.get(0).getNumOfGroupBolt());
- }
- // assignment
- {
- PolicyAssignment assignment = new PolicyAssignment();
- assignment.setPolicyName("policy1");
- OpResult result = dao.addAssignment(assignment);
- Assert.assertEquals(200, result.code);
- List<PolicyAssignment> assigns = dao.listAssignments();
- Assert.assertEquals(1, assigns.size());
- }
- // cluster
- {
- StreamingCluster cluster = new StreamingCluster();
- cluster.setName("dd");
- OpResult result = dao.addCluster(cluster);
- Assert.assertEquals(200, result.code);
- List<StreamingCluster> assigns = dao.listClusters();
- Assert.assertEquals(1, assigns.size());
- }
- // data source
- {
- Kafka2TupleMetadata dataSource = new Kafka2TupleMetadata();
- dataSource.setName("ds");
- OpResult result = dao.addDataSource(dataSource);
- Assert.assertEquals(200, result.code);
- List<Kafka2TupleMetadata> assigns = dao.listDataSources();
- Assert.assertEquals(1, assigns.size());
- }
- // policy
- {
- PolicyDefinition policy = new PolicyDefinition();
- policy.setName("ds");
- OpResult result = dao.addPolicy(policy);
- Assert.assertEquals(200, result.code);
- List<PolicyDefinition> assigns = dao.listPolicies();
- Assert.assertEquals(1, assigns.size());
- }
- // publishment
- {
- Publishment publishment = new Publishment();
- publishment.setName("pub-");
- OpResult result = dao.addPublishment(publishment);
- Assert.assertEquals(200, result.code);
- List<Publishment> assigns = dao.listPublishment();
- Assert.assertEquals(1, assigns.size());
- }
- // publishment
- {
- PublishmentType publishmentType = new PublishmentType();
- publishmentType.setType("KAFKA");
- OpResult result = dao.addPublishmentType(publishmentType);
- Assert.assertEquals(200, result.code);
- List<PublishmentType> assigns = dao.listPublishmentType();
- Assert.assertEquals(1, assigns.size());
- }
- }
-
- private void test_addstate() {
- ScheduleState state = new ScheduleState();
- state.setVersion("state-" + System.currentTimeMillis());
- state.setGenerateTime(String.valueOf(new Date().getTime()));
- OpResult result = dao.addScheduleState(state);
- Assert.assertEquals(200, result.code);
- }
-
- @Test
- public void test_readCurrentState() {
- test_addstate();
- ScheduleState state = dao.getScheduleState();
- Assert.assertNotNull(state);
-
- System.out.println(state.getVersion());
- System.out.println(state.getGenerateTime());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/resources/application-mongo.conf
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/resources/application-mongo.conf b/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/resources/application-mongo.conf
deleted file mode 100644
index 0becbfc..0000000
--- a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/resources/application-mongo.conf
+++ /dev/null
@@ -1,21 +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.
-
-{
- "datastore": {
- "metadataDao": "org.apache.eagle.service.alert.resource.impl.InMemMetadataDaoImpl",
- "connection": "localhost:27017"
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/resources/policy-sample.json
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/resources/policy-sample.json b/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/resources/policy-sample.json
deleted file mode 100644
index 56a53e7..0000000
--- a/eagle-core/eagle-alert/alert/alert-metadata-parent/alert-metadata/src/test/resources/policy-sample.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "name": "policy1",
- "description": "test policy",
- "inputStreams": [
- "in-stream-1",
- "in-stream-2"
- ],
- "outputStreams": [
- "out-stream-1"
- ],
- "definition": {
- "type": "siddhiCEPEngine",
- "value": "select count(*) from in-stream-1"
- },
- "partitionSpec": [
- {
- "streamId": "in-stream-1",
- "type": "GROUPBY",
- "columns": [
- "col-1",
- "col-2"
- ],
- "sortSpec": {
- "column": "col-1",
- "windowPeriod": "60",
- "order": "asc",
- "windowMargin": 30000
- }
- }
- ],
- "parallelismHint": 2
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-metadata-parent/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/alert/alert-metadata-parent/pom.xml b/eagle-core/eagle-alert/alert/alert-metadata-parent/pom.xml
deleted file mode 100644
index e9e3534..0000000
--- a/eagle-core/eagle-alert/alert/alert-metadata-parent/pom.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ~ 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. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.eagle</groupId>
- <artifactId>alert-parent</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- </parent>
- <artifactId>alert-metadata-parent</artifactId>
- <packaging>pom</packaging>
-
- <modules>
- <module>alert-metadata</module>
- <module>alert-metadata-service</module>
- </modules>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/alert/pom.xml b/eagle-core/eagle-alert/alert/pom.xml
deleted file mode 100644
index 9d2c845..0000000
--- a/eagle-core/eagle-alert/alert/pom.xml
+++ /dev/null
@@ -1,387 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ~ 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. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.eagle</groupId>
- <artifactId>alert-parent</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <modules>
- <module>alert-common</module>
- <module>alert-engine</module>
- <module>alert-metadata-parent</module>
- <module>alert-coordinator</module>
- <module>alert-assembly</module>
- <module>alert-devtools</module>
- </modules>
-
- <properties>
- <!-- Runtime -->
- <java.version>1.8</java.version>
-
- <!-- Build -->
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven-compiler.version>2.0.2</maven-compiler.version>
-
- <!-- Test -->
- <junit.version>4.12</junit.version>
-
- <!-- Utilities -->
- <typesafe-config.version>1.2.1</typesafe-config.version>
- <guava.version>19.0</guava.version>
- <commons-lang3.version>3.3.2</commons-lang3.version>
- <commons-collections.version>3.2.1</commons-collections.version>
- <commons-lang.version>2.6</commons-lang.version>
- <archaius.version>0.6.1</archaius.version>
- <metrics.version>3.1.0</metrics.version>
- <mapdb.version>3.0.0-M6</mapdb.version>
-
- <!-- CEP -->
- <siddhi.version>3.0.5</siddhi.version>
-
- <!-- PUBLISH -->
- <velocity.version>1.7</velocity.version>
- <javax.mail.version>1.4</javax.mail.version>
-
- <!-- JSON -->
- <fastxml.version>2.4.5</fastxml.version>
- <jackson.version>1.9.13</jackson.version>
- <fasterxml-jackson.version>2.4.5</fasterxml-jackson.version>
- <codehaus-jackson.version>1.9.13</codehaus-jackson.version>
-
- <!-- Storm and Kafka -->
- <storm.version>0.9.3</storm.version>
- <storm-kafka.version>0.9.3.2.2.0.0-2041</storm-kafka.version>
- <kafka-clients.version>0.8.2.0</kafka-clients.version>
- <kafka.version>0.8.1.2.2.0.0-2041</kafka.version>
- <kafka.artifact.id>kafka_2.10</kafka.artifact.id>
- <zkclient.version>0.3</zkclient.version>
- <slf4j-api.veresion>1.7.20</slf4j-api.veresion>
- <slf4j-log4j12.veresion>1.7.20</slf4j-log4j12.veresion>
- <logback.version>1.1.7</logback.version>
-
- <!-- Web Service/Client -->
- <jersey.version>1.19.1</jersey.version>
- <!--<jersey-client.version>1.19.1</jersey-client.version>-->
- <!--<jersey-server.version>1.19.1</jersey-server.version>-->
- <!--<jersey-multipart.version>1.19.1</jersey-multipart.version>-->
-
- <jetty.version>9.2.3.v20140905</jetty.version>
- <tomcat-embed.version>7.0.55</tomcat-embed.version>
- <swagger.version>1.5.8</swagger.version>
- <curator-framework.version>2.8.0</curator-framework.version>
- <mongodb.version>3.2.2</mongodb.version>
- <mockito.version>1.10.19</mockito.version>
- <joda.version>2.2</joda.version>
- <metrics-elasticsearch-reporter.version>2.2.0</metrics-elasticsearch-reporter.version>
- </properties>
-
- <repositories>
- <repository>
- <id>Maven Central Repository</id>
- <url>http://central.maven.org/maven2/</url>
- </repository>
- <repository>
- <id>HDP Release Repository</id>
- <url>http://repo.hortonworks.com/content/repositories/releases/</url>
- </repository>
- <repository>
- <id>HDP Central Repository</id>
- <url>http://repo.hortonworks.com/content/repositories/central/</url>
- </repository>
- <repository>
- <id>WSO2 Public</id>
- <url>http://maven.wso2.org/nexus/content/groups/wso2-public</url>
- </repository>
- </repositories>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${fastxml.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${fastxml.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- <version>${javax.mail.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- <version>${velocity.version}</version>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>${mockito.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>${curator-framework.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-recipes</artifactId>
- <version>${curator-framework.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>${fasterxml-jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${commons-lang3.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>${commons-collections.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>${commons-lang.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${fasterxml-jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.storm</groupId>
- <artifactId>storm-kafka</artifactId>
- <version>${storm-kafka.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>${slf4j-log4j12.veresion}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.storm</groupId>
- <artifactId>storm-core</artifactId>
- <version>${storm.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>log4j-over-slf4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.kafka</groupId>
- <artifactId>${kafka.artifact.id}</artifactId>
- <version>${kafka.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.sfl4j</groupId>
- <artifactId>slf4j-log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-client</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-jaxrs</artifactId>
- <version>${codehaus-jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-xc</artifactId>
- <version>${codehaus-jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- <version>${codehaus-jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.typesafe</groupId>
- <artifactId>config</artifactId>
- <version>${typesafe-config.version}</version>
- </dependency>
- <dependency>
- <groupId>com.netflix.archaius</groupId>
- <artifactId>archaius-core</artifactId>
- <version>${archaius.version}</version>
- </dependency>
- <dependency>
- <groupId>io.dropwizard.metrics</groupId>
- <artifactId>metrics-core</artifactId>
- <version>${metrics.version}</version>
- </dependency>
- <dependency>
- <groupId>io.dropwizard.metrics</groupId>
- <artifactId>metrics-jvm</artifactId>
- <version>${metrics.version}</version>
- </dependency>
- <dependency>
- <groupId>org.wso2.siddhi</groupId>
- <artifactId>siddhi-core</artifactId>
- <version>${siddhi.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.wso2.siddhi</groupId>
- <artifactId>siddhi-query-api</artifactId>
- <version>${siddhi.version}</version>
- </dependency>
- <dependency>
- <groupId>org.wso2.siddhi</groupId>
- <artifactId>siddhi-query-compiler</artifactId>
- <version>${siddhi.version}</version>
- </dependency>
- <dependency>
- <groupId>org.wso2.siddhi</groupId>
- <artifactId>siddhi-extension-regex</artifactId>
- <version>${siddhi.version}</version>
- </dependency>
- <dependency>
- <groupId>org.wso2.siddhi</groupId>
- <artifactId>siddhi-extension-string</artifactId>
- <version>${siddhi.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.kafka</groupId>
- <artifactId>kafka-clients</artifactId>
- <version>${kafka-clients.version}</version>
- <!--<scope>test</scope> -->
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>com.101tec</groupId>
- <artifactId>zkclient</artifactId>
- <version>${zkclient.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-server</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-servlet</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey.contribs</groupId>
- <artifactId>jersey-multipart</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat-embed.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j-api.veresion}</version>
- </dependency>
- <!--<dependency>-->
- <!--<groupId>ch.qos.logback</groupId>-->
- <!--<artifactId>logback-classic</artifactId>-->
- <!--<version>${logback.version}</version>-->
- <!--</dependency>-->
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jaxrs</artifactId>
- <version>${swagger.version}</version>
- </dependency>
- <dependency>
- <groupId>org.mapdb</groupId>
- <artifactId>mapdb</artifactId>
- <version>${mapdb.version}</version>
- </dependency>
- <dependency>
- <groupId>joda-time</groupId>
- <artifactId>joda-time</artifactId>
- <version>${joda.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.elasticsearch</groupId>
- <artifactId>metrics-elasticsearch-reporter</artifactId>
- <version>${metrics-elasticsearch-reporter.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${maven-compiler.version}</version>
- <configuration>
- <source>${java.version}</source>
- <target>${java.version}</target>
- <encoding>UTF-8</encoding>
- <maxmem>2048m</maxmem>
- <fork>true</fork>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <version>${jetty.version}</version>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/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
deleted file mode 100644
index b1d10fd..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/pom.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.eagle</groupId>
- <artifactId>eagle-alert-parent</artifactId>
- <version>0.4.0-incubating-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>eagle-alert-base</artifactId>
- <packaging>jar</packaging>
- <name>eagle-alert-base</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.eagle</groupId>
- <artifactId>eagle-entity-base</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.eagle</groupId>
- <artifactId>eagle-client-base</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.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/737e5a2d/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
deleted file mode 100644
index 9761031..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/common/AlertEmailSender.java
+++ /dev/null
@@ -1,160 +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;
-
-import java.lang.management.ManagementFactory;
-import java.util.ArrayList;
-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;
-
-import org.apache.eagle.alert.email.AlertEmailComponent;
-import org.apache.eagle.common.DateTimeUtil;
-import org.apache.eagle.common.email.EagleMailClient;
-import com.netflix.config.ConcurrentMapConfiguration;
-import com.typesafe.config.ConfigObject;
-
-@Deprecated
-public class AlertEmailSender implements Runnable {
-
- protected final List<Map<String, String>> alertContexts = new ArrayList<Map<String, String>>();
- protected final String configFileName;
- protected final String subject;
- protected final String sender;
- protected final String recipents;
- protected final String cc;
- protected final String origin;
- protected boolean sentSuccessfully = false;
-
- private final static Logger LOG = LoggerFactory.getLogger(AlertEmailSender.class);
- private final static int MAX_RETRY_COUNT = 3;
-
- private static final String MAIL_HOST = "mail.host";
- private static final String MAIL_PORT = "mail.smtp.port";
- private static final String MAIL_DEBUG = "mail.debug";
-
- private static final String CONF_KEY_MAIL_HOST = "mailHost";
- private static final String CONF_KEY_MAIL_PORT = "mailSmtpPort";
- private static final String CONF_KEY_MAIL_DEBUG = "mailDebug";
-
- private ConfigObject eagleProps;
-
-
- private String threadName;
- /**
- * Derived class may have some additional context properties to add
- * @param context velocity context
- * @param env environment
- */
- protected void additionalContext(VelocityContext context, String env) {
- // By default there's no additional context added
- }
-
- public AlertEmailSender(AlertEmailContext alertEmail){
- this.recipents = alertEmail.getRecipients();
- this.configFileName = alertEmail.getVelocityTplFile();
- this.subject = alertEmail.getSubject();
- this.sender = alertEmail.getSender();
- this.cc = alertEmail.getCc();
- for(AlertEmailComponent bean : alertEmail.getComponents()){
- this.alertContexts.add(bean.getAlertContext().getProperties());
- }
- String tmp = ManagementFactory.getRuntimeMXBean().getName();
- this.origin = tmp.split("@")[1] + "(pid:" + tmp.split("@")[0] + ")";
- threadName = Thread.currentThread().getName();
- LOG.info("Initialized "+threadName+": origin is : " + this.origin+", recipient of the email: " + this.recipents+", velocity TPL file: " + this.configFileName);
- }
-
- public AlertEmailSender(AlertEmailContext alertEmail, ConfigObject eagleProps){
- this(alertEmail);
- this.eagleProps = eagleProps;
- }
-
- @Override
- public void run() {
- int count = 0;
- boolean success = false;
- while(count++ < MAX_RETRY_COUNT && !success){
- LOG.info("Sending email, tried: " + count+", max: "+MAX_RETRY_COUNT);
- try {
- final EagleMailClient client;
- if (eagleProps != null) {
- ConcurrentMapConfiguration con = new ConcurrentMapConfiguration();
- con.addProperty(MAIL_HOST, eagleProps.get(CONF_KEY_MAIL_HOST).unwrapped());
- con.addProperty(MAIL_PORT, eagleProps.get(CONF_KEY_MAIL_PORT).unwrapped());
- if (eagleProps.get(CONF_KEY_MAIL_DEBUG) != null) {
- con.addProperty(MAIL_DEBUG, eagleProps.get(CONF_KEY_MAIL_DEBUG).unwrapped());
- }
- client = new EagleMailClient(con);
- }
- else {
- client = new EagleMailClient();
- }
- String env = "prod";
- if (eagleProps != null && eagleProps.get("env") != null) {
- env = (String) eagleProps.get("env").unwrapped();
- }
- LOG.info("Env is: " + env);
- final VelocityContext context = new VelocityContext();
- generateCommonContext(context);
- LOG.info("After calling generateCommonContext...");
- additionalContext(context, env);
-
- if (recipents == null || recipents.equals("")) {
- LOG.error("Recipients is null, skip sending emails ");
- return;
- }
- String title = subject;
- if (!env.trim().equals("prod")) {
- title = "[" + env + "]" + title;
- }
- success = client.send(sender, recipents, cc, title, configFileName, context, null);
- LOG.info("Success of sending email: " + success);
- if(!success && count < MAX_RETRY_COUNT) {
- LOG.info("Sleep for a while before retrying");
- Thread.sleep(10*1000);
- }
- }
- catch (Exception e){
- LOG.warn("Sending mail exception", e);
- }
- }
-
- if(success){
- sentSuccessfully = true;
- LOG.info(String.format("Successfully send email, thread: %s",threadName));
- }else{
- LOG.warn(String.format("Fail sending email after tries %s times, thread: %s",MAX_RETRY_COUNT,threadName));
- }
- }
-
- private void generateCommonContext(VelocityContext context) {
- 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(){
- return this.sentSuccessfully;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/email/AlertEmailComponent.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/email/AlertEmailComponent.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/email/AlertEmailComponent.java
deleted file mode 100644
index da1078a..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/email/AlertEmailComponent.java
+++ /dev/null
@@ -1,33 +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.email;
-
-import org.apache.eagle.common.metric.AlertContext;
-
-/**
- * Alert email component is one part of an email, which could be an individual alert
- */
-@Deprecated
-public class AlertEmailComponent {
- private AlertContext alertContext;
- public AlertContext getAlertContext() {
- return alertContext;
- }
- public void setAlertContext(AlertContext alertContext) {
- this.alertContext = alertContext;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/email/AlertEmailContext.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/email/AlertEmailContext.java b/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/email/AlertEmailContext.java
deleted file mode 100644
index b2fd929..0000000
--- a/eagle-core/eagle-alert/eagle-alert-base/src/main/java/org/apache/eagle/alert/email/AlertEmailContext.java
+++ /dev/null
@@ -1,70 +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.email;
-
-import java.util.List;
-
-/**
- * alert email bean
- * one email consists of a list of email component
- */
-@Deprecated
-public class AlertEmailContext {
- private List<AlertEmailComponent> components;
- private String sender;
- private String subject;
- private String recipients;
- private String velocityTplFile;
- private String cc;
-
- public List<AlertEmailComponent> getComponents() {
- return components;
- }
- public void setComponents(List<AlertEmailComponent> components) {
- this.components = components;
- }
- public String getVelocityTplFile() {
- return velocityTplFile;
- }
- public void setVelocityTplFile(String velocityTplFile) {
- this.velocityTplFile = velocityTplFile;
- }
- 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 getSubject() {
- return subject;
- }
- public void setSubject(String subject) {
- this.subject = subject;
- }
- public String getCc() {
- return cc;
- }
- public void setCc(String cc) {
- this.cc = cc;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/eagle-alert-notification-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-notification-plugin/pom.xml b/eagle-core/eagle-alert/eagle-alert-notification-plugin/pom.xml
deleted file mode 100644
index 504abb8..0000000
--- a/eagle-core/eagle-alert/eagle-alert-notification-plugin/pom.xml
+++ /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.
- */
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.eagle</groupId>
- <artifactId>eagle-alert-parent</artifactId>
- <version>0.4.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>eagle-alert-notification-plugin</artifactId>
- <name>eagle-alert-notification-plugin</name>
- <description>Apache Eagle Notification Plugin to enable services to use custom or default notification </description>
- <dependencies>
- <dependency>
- <groupId>org.apache.eagle</groupId>
- <artifactId>eagle-policy-base</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>log4j-over-slf4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.kafka</groupId>
- <artifactId>kafka-clients</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-scala_${scala.version}</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-core-asl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.reflections</groupId>
- <artifactId>reflections</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/base/NotificationConstants.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/base/NotificationConstants.java b/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/base/NotificationConstants.java
deleted file mode 100644
index 1e49ac8..0000000
--- a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/base/NotificationConstants.java
+++ /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.
- */
-
-package org.apache.eagle.notification.base;
-
-public class NotificationConstants {
- public static final String NOTIFICATION_TYPE = "notificationType";
- public static final String EMAIL_NOTIFICATION = "email";
- public static final String KAFKA_STORE = "kafka";
- public static final String EAGLE_STORE = "eagleStore";
-
- // email specific constants
- public static final String SUBJECT = "subject";
- public static final String SENDER = "sender";
- public static final String RECIPIENTS = "recipients";
- public static final String TPL_FILE_NAME = "tplFileName";
-
- // kafka specific constants
- public static final String TOPIC = "topic";
- public static final String BROKER_LIST = "kafka_broker";
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/base/NotificationStatus.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/base/NotificationStatus.java b/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/base/NotificationStatus.java
deleted file mode 100644
index d57dbf9..0000000
--- a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/base/NotificationStatus.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.notification.base;
-
-/**
- * Object that holds the status of Notification Posted to Notification Plugin
- */
-public class NotificationStatus {
- public boolean successful;
- public String errorMessage;
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/dao/AlertNotificationDAO.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/dao/AlertNotificationDAO.java b/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/dao/AlertNotificationDAO.java
deleted file mode 100644
index bf2e75e..0000000
--- a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/dao/AlertNotificationDAO.java
+++ /dev/null
@@ -1,36 +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.dao;
-
-
-
-import org.apache.eagle.alert.entity.AlertNotificationEntity;
-
-import java.util.List;
-
-/**
- * Alert Notification Data Access Obj Interface
- */
-public interface AlertNotificationDAO {
- /**
- * find the Alert Notification Types by querying alertNotifications Table
- * @return
- * @throws Exception
- */
- List<AlertNotificationEntity> findAlertNotificationTypes() throws Exception;
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/dao/AlertNotificationDAOImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/dao/AlertNotificationDAOImpl.java b/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/dao/AlertNotificationDAOImpl.java
deleted file mode 100644
index 7251da3..0000000
--- a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/dao/AlertNotificationDAOImpl.java
+++ /dev/null
@@ -1,70 +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.dao;
-
-import org.apache.commons.lang.time.DateUtils;
-import org.apache.eagle.alert.entity.AlertNotificationEntity;
-import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
-import org.apache.eagle.policy.common.Constants;
-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.List;
-
-/**
- * Notification Service API implementation which Provides Read/Write API's of Hbase AlertNotifications Table
- */
-public class AlertNotificationDAOImpl implements AlertNotificationDAO {
-
- private final Logger LOG = LoggerFactory.getLogger(AlertNotificationDAOImpl.class);
- private final EagleServiceConnector connector;
-
- public AlertNotificationDAOImpl(EagleServiceConnector connector){
- this.connector = connector;
- }
-
- /**
- * Find the Alerts by NotificationType
- * @return
- * @throws Exception
- */
- @Override
- public List<AlertNotificationEntity> findAlertNotificationTypes() throws Exception {
- try{
- IEagleServiceClient client = new EagleServiceClientImpl(connector);
- String query = Constants.ALERT_NOTIFICATION_SERVICE_ENDPOINT_NAME+"[@enabled=\"true\"]{*}";
- GenericServiceAPIResponseEntity response = client.search(query).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 alert notification service ", ex);
- throw new IllegalStateException(ex);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailComponent.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailComponent.java b/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailComponent.java
deleted file mode 100644
index 3fe55bf..0000000
--- a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailComponent.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.notification.email;
-
-import org.apache.eagle.common.metric.AlertContext;
-
-/**
- * Alert email component is one part of an email, which could be an individual alert
- */
-public class AlertEmailComponent {
- private AlertContext alertContext;
- public AlertContext getAlertContext() {
- return alertContext;
- }
- public void setAlertContext(AlertContext alertContext) {
- this.alertContext = alertContext;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailContext.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailContext.java b/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailContext.java
deleted file mode 100644
index f1642be..0000000
--- a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailContext.java
+++ /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.
- */
-package org.apache.eagle.notification.email;
-
-import java.util.List;
-
-/**
- * alert email bean
- * one email consists of a list of email component
- */
-public class AlertEmailContext {
- private List<AlertEmailComponent> components;
- private String sender;
- private String subject;
- private String recipients;
- private String velocityTplFile;
- private String cc;
-
- public List<AlertEmailComponent> getComponents() {
- return components;
- }
- public void setComponents(List<AlertEmailComponent> components) {
- this.components = components;
- }
- public String getVelocityTplFile() {
- return velocityTplFile;
- }
- public void setVelocityTplFile(String velocityTplFile) {
- this.velocityTplFile = velocityTplFile;
- }
- 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 getSubject() {
- return subject;
- }
- public void setSubject(String subject) {
- this.subject = subject;
- }
- public String getCc() {
- return cc;
- }
- public void setCc(String cc) {
- this.cc = cc;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailGenerator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailGenerator.java b/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailGenerator.java
deleted file mode 100644
index fd6b794..0000000
--- a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailGenerator.java
+++ /dev/null
@@ -1,138 +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.email;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.*;
-
-import org.apache.eagle.common.metric.AlertContext;
-import org.apache.eagle.policy.common.Constants;
-import org.apache.eagle.alert.entity.AlertAPIEntity;
-import com.typesafe.config.ConfigObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AlertEmailGenerator{
- private String tplFile;
- private String sender;
- private String recipients;
- private String subject;
- private ConfigObject eagleProps;
-
- private ThreadPoolExecutor executorPool;
-
- private final static Logger LOG = LoggerFactory.getLogger(AlertEmailGenerator.class);
-
- private final static long MAX_TIMEOUT_MS =60000;
-
- public boolean sendAlertEmail(AlertAPIEntity entity) {
- return sendAlertEmail(entity, recipients, null);
- }
-
- public boolean sendAlertEmail(AlertAPIEntity entity, String recipients) {
- return sendAlertEmail(entity, recipients, null);
- }
-
- public boolean sendAlertEmail(AlertAPIEntity entity, String recipients, String cc) {
- boolean sentSuccessfully = false;
- AlertEmailContext email = new AlertEmailContext();
-
- AlertEmailComponent component = new AlertEmailComponent();
- AlertContext context = AlertContext.fromJsonString(entity.getAlertContext());
- component.setAlertContext(context);
- List<AlertEmailComponent> components = new ArrayList<AlertEmailComponent>();
- components.add(component);
- email.setComponents(components);
- if (context.getProperty(Constants.SUBJECT) != null) {
- email.setSubject(context.getProperty(Constants.SUBJECT));
- }
- else email.setSubject(subject);
- email.setVelocityTplFile(tplFile);
- email.setRecipients(recipients);
- email.setCc(cc);
- email.setSender(sender);
-
- /** asynchronized email sending */
- @SuppressWarnings("rawtypes")
- AlertEmailSender thread = new AlertEmailSender(email, eagleProps);
-
- if(this.executorPool == null) throw new IllegalStateException("Invoking thread executor pool but it's is not set yet");
-
- LOG.info("Sending email in asynchronous to: "+recipients+", cc: "+cc);
- Future future = this.executorPool.submit(thread);
- try {
- future.get(MAX_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- sentSuccessfully = true;
- LOG.info(String.format("Successfully send email to %s", recipients));
- } catch (InterruptedException | ExecutionException e) {
- sentSuccessfully = false;
- LOG.error(String.format("Failed to send email to %s, due to:%s",recipients,e),e);
- } catch (TimeoutException e) {
- sentSuccessfully = false;
- LOG.error(String.format("Failed to send email to %s due to timeout exception, max timeout: %s ms ",recipients, MAX_TIMEOUT_MS),e);
- }
- return sentSuccessfully;
- }
-
- public String getTplFile() {
- return tplFile;
- }
-
- public void setTplFile(String tplFile) {
- this.tplFile = tplFile;
- }
-
- public String getSender() {
- return sender;
- }
-
- public void setSender(String sender) {
- this.sender = sender;
- }
-
- public String getRecipients() {
- return recipients;
- }
-
- public void setRecipients(String recipients) {
- this.recipients = recipients;
- }
-
- public String getSubject() {
- return subject;
- }
-
- public void setSubject(String subject) {
- this.subject = subject;
- }
-
- public ConfigObject getEagleProps() {
- return eagleProps;
- }
-
- public void setEagleProps(ConfigObject eagleProps) {
- this.eagleProps = eagleProps;
- }
-
- public void setExecutorPool(ThreadPoolExecutor executorPool) {
- this.executorPool = executorPool;
- }
-}
\ No newline at end of file