incubator-eagle git commit: [EAGLE-403] Initialize eagle jpm app

2016-08-03 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/develop f2f07211d -> 037b97ad6


[EAGLE-403] Initialize eagle jpm app

Author: Hao Chen <h...@apache.org>

Closes #294 from haoch/createEagleJPMApp.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/037b97ad
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/037b97ad
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/037b97ad

Branch: refs/heads/develop
Commit: 037b97ad627148c81d53aa8444e599f0103020e5
Parents: f2f0721
Author: Hao Chen <h...@apache.org>
Authored: Wed Aug 3 20:02:49 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Wed Aug 3 20:02:49 2016 +0800

--
 .../app/service/ApplicationProviderLoader.java  |   6 +-
 .../impl/ApplicationProviderSPILoader.java  |   1 -
 eagle-jpm/eagle-jpm-app/pom.xml |  30 +
 .../apache/eagle/app/jpm/JPMApplication.java|  56 ++
 .../eagle/app/jpm/JPMApplicationProvider.java   |  33 ++
 .../resources/META-INF/apps/jpm/metadata.xml| 109 +++
 ...org.apache.eagle.app.spi.ApplicationProvider |  16 +++
 .../src/main/webapp/app/apps/jpm/index.html |   6 +
 .../eagle-jpm-app/src/main/webapp/package.json  |   0
 .../eagle/app/jpm/JPMApplicationTest.java   |  71 
 eagle-jpm/pom.xml   |   1 +
 eagle-server/pom.xml|   8 +-
 12 files changed, 334 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/037b97ad/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderLoader.java
--
diff --git 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderLoader.java
 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderLoader.java
index 85f0709..0c895a3 100644
--- 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderLoader.java
+++ 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderLoader.java
@@ -56,7 +56,11 @@ public abstract class ApplicationProviderLoader {
 }
 
 public ApplicationProvider getApplicationProviderByType(String type) {
-return providers.get(type);
+if(providers.containsKey(type)) {
+return providers.get(type);
+}else{
+throw new IllegalArgumentException("Unknown Application Type: 
"+type);
+}
 }
 
 public void reset(){

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/037b97ad/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java
--
diff --git 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java
 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java
index 3304286..762f024 100644
--- 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java
+++ 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java
@@ -44,7 +44,6 @@ public class ApplicationProviderSPILoader extends 
ApplicationProviderLoader{
 }
 
 LOG.info("Using {}: 
{}",APPLICATIONS_DIR_PROPS_KEY,this.appProviderExtDir);
-
 }
 
 @Override

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/037b97ad/eagle-jpm/eagle-jpm-app/pom.xml
--
diff --git a/eagle-jpm/eagle-jpm-app/pom.xml b/eagle-jpm/eagle-jpm-app/pom.xml
new file mode 100644
index 000..095596f
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-app/pom.xml
@@ -0,0 +1,30 @@
+
+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;>
+
+eagle-jpm-parent
+org.apache.eagle
+0.5.0-incubating-SNAPSHOT
+
+4.0.0
+eagle-jpm-app
+
+
+org.apache.eagle
+eagle-app-base
+${project.version}
+
+
+
+
+
+src/main/webapp/app
+assets/
+
+
+src/main/resources
+
+
+
+
\ No newline at end of file

http://git-wip-us.ap

incubator-eagle git commit: [EAGLE-399] Implement consistent RESTResponse Wrapper for operation (CREAT/MODIFY/DELETE) request

2016-07-27 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/develop 043a103fd -> c017fe4cd


[EAGLE-399] Implement consistent RESTResponse Wrapper for operation 
(CREAT/MODIFY/DELETE) request

https://issues.apache.org/jira/browse/EAGLE-399

Author: Hao Chen <h...@apache.org>

Closes #281 from haoch/EAGLE-399.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/c017fe4c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/c017fe4c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/c017fe4c

Branch: refs/heads/develop
Commit: c017fe4cdfcba0c95b9a32f665e8314a8bf99271
Parents: 043a103
Author: Hao Chen <h...@apache.org>
Authored: Wed Jul 27 18:45:54 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Wed Jul 27 18:45:54 2016 +0800

--
 .../eagle/app/resource/ApplicationResource.java |  39 +--
 .../apache/eagle/app/test/AppSimulatorImpl.java |   2 +-
 .../eagle/app/TestApplicationTestSuite.java |   2 +-
 .../eagle/metadata/resource/RestResponse.java   | 107 +--
 .../eagle/metadata/resource/SiteResource.java   |  10 +-
 .../app/example/ExampleApplicationTest.java |   2 +-
 6 files changed, 68 insertions(+), 94 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/c017fe4c/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/resource/ApplicationResource.java
--
diff --git 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/resource/ApplicationResource.java
 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/resource/ApplicationResource.java
index b0e9988..7878587 100644
--- 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/resource/ApplicationResource.java
+++ 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/resource/ApplicationResource.java
@@ -23,6 +23,7 @@ import org.apache.eagle.app.service.ApplicationOperations;
 import org.apache.eagle.app.service.ApplicationProviderService;
 import org.apache.eagle.metadata.model.ApplicationDesc;
 import org.apache.eagle.metadata.model.ApplicationEntity;
+import org.apache.eagle.metadata.resource.RESTResponse;
 import org.apache.eagle.metadata.service.ApplicationEntityService;
 
 import javax.ws.rs.*;
@@ -62,9 +63,12 @@ public class ApplicationResource {
 @PUT
 @Path("/providers/reload")
 @Produces(MediaType.APPLICATION_JSON)
-public Collection reloadApplicationDescs(){
-providerService.reload();
-return providerService.getApplicationDescs();
+public RESTResponse<Collection> reloadApplicationDescs(){
+return RESTResponse.<Collection>async((builder)-> {
+providerService.reload();
+builder.message("Successfully reload application providers");
+builder.data(providerService.getApplicationDescs());
+}).get();
 }
 
 @GET
@@ -97,8 +101,12 @@ public class ApplicationResource {
 @Path("/install")
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
-public ApplicationEntity 
installApplication(ApplicationOperations.InstallOperation operation){
-return applicationManagementService.install(operation);
+public RESTResponse 
installApplication(ApplicationOperations.InstallOperation operation){
+return RESTResponse.async((builder)-> {
+ApplicationEntity entity = 
applicationManagementService.install(operation);
+builder.message("Successfully installed application 
"+operation.getAppType()+" onto site "+operation.getSiteId());
+builder.data(entity);
+}).get();
 }
 
 /**
@@ -115,8 +123,11 @@ public class ApplicationResource {
 @Path("/uninstall")
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
-public ApplicationEntity 
uninstallApplication(ApplicationOperations.UninstallOperation operation){
-return applicationManagementService.uninstall(operation);
+public RESTResponse 
uninstallApplication(ApplicationOperations.UninstallOperation operation){
+return RESTResponse.async((builder)-> {
+ApplicationEntity entity = 
applicationManagementService.uninstall(operation);
+builder.success(true).message("Successfully uninstalled 
application "+entity.getUuid());
+}).get();
 }
 
 /**
@@ -132,8 +143,11 @@ public class ApplicationResource {
 @Path("/start")
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
-public ApplicationEntity 
star

incubator-eagle git commit: [EAGLE-397] Implement KafkaStreamSink with type safe StreamSinkDesc

2016-07-27 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/develop f1a93b1bb -> 043a103fd


[EAGLE-397] Implement KafkaStreamSink with type safe StreamSinkDesc

https://issues.apache.org/jira/browse/EAGLE-397

Author: Hao Chen <h...@apache.org>

Closes #278 from haoch/EAGLE-397.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/043a103f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/043a103f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/043a103f

Branch: refs/heads/develop
Commit: 043a103fd6137fd9367e5ad520fb19fffb954469
Parents: f1a93b1
Author: Hao Chen <h...@apache.org>
Authored: Wed Jul 27 16:29:32 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Wed Jul 27 16:29:32 2016 +0800

--
 .../apache/eagle/app/ApplicationContext.java| 11 ++---
 .../eagle/app/sink/AbstractStreamSink.java  |  5 ++-
 .../eagle/app/sink/DefaultStreamSinkDesc.java   | 42 ++
 .../apache/eagle/app/sink/KafkaStreamSink.java  | 29 ++--
 .../eagle/app/sink/KafkaStreamSinkDesc.java | 46 
 .../eagle/app/sink/LoggingStreamSink.java   | 20 +++--
 .../org/apache/eagle/app/sink/StreamSink.java   | 11 ++---
 .../app/spi/AbstractApplicationProvider.java|  6 +--
 .../apache/eagle/metadata/model/StreamDesc.java | 31 +
 .../eagle/metadata/model/StreamSinkDesc.java| 25 +++
 .../app/example/ExampleApplicationTest.java |  1 -
 11 files changed, 140 insertions(+), 87 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/043a103f/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/ApplicationContext.java
--
diff --git 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/ApplicationContext.java
 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/ApplicationContext.java
index dc2a456..cf8646c 100644
--- 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/ApplicationContext.java
+++ 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/ApplicationContext.java
@@ -18,7 +18,6 @@ package org.apache.eagle.app;
 
 import com.typesafe.config.Config;
 import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import org.apache.eagle.app.sink.AbstractStreamSink;
 import org.apache.eagle.app.sink.StreamSink;
 import org.apache.eagle.app.sink.mapper.*;
 import org.apache.eagle.app.spi.ApplicationProvider;
@@ -77,12 +76,10 @@ public class ApplicationContext implements Serializable, 
ApplicationLifecycleLis
 if(null != outputStreams){
 outputStreams.forEach((stream) -> {
 try {
-StreamSink streamSink = (StreamSink) 
sinkClass.newInstance();
-streamSink.init(stream,this);
 StreamDesc streamDesc = new StreamDesc();
-streamDesc.setStreamSchema(stream);
-streamDesc.setSinkContext(streamSink.getSinkContext());
-streamDesc.setSinkType(sinkClass);
+StreamSink streamSink = (StreamSink) 
sinkClass.newInstance();
+streamDesc.setSink(streamSink.init(stream,this));
+streamDesc.setSchema(stream);
 streamDesc.setStreamId(stream.getStreamId());
 streamDescMap.put(streamDesc.getStreamId(),streamDesc);
 streamDefinitionMap.put(streamDesc.getStreamId(),stream);
@@ -113,7 +110,7 @@ public class ApplicationContext implements Serializable, 
ApplicationLifecycleLis
 checkStreamExists(streamId);
 Class sinkClass = appEntity.getDescriptor().getSinkClass();
 try {
-AbstractStreamSink abstractStreamSink = (AbstractStreamSink) 
sinkClass.newInstance();
+StreamSink abstractStreamSink = (StreamSink) 
sinkClass.newInstance();
 abstractStreamSink.setEventMapper(mapper);
 abstractStreamSink.init(streamDefinitionMap.get(streamId),this);
 return abstractStreamSink;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/043a103f/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/AbstractStreamSink.java
--
diff --git 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/AbstractStreamSink.java
 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/AbstractStreamSink.java
index 322ff8b..8280b5b 100644
--- 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/AbstractStreamSink.java
+++

[2/3] incubator-eagle git commit: [EAGLE-386] Refactor Application Framework Interfaces and StreamEventMapper

2016-07-22 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e73e35da/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/AbstractStreamSink.java
--
diff --git 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/AbstractStreamSink.java
 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/AbstractStreamSink.java
new file mode 100644
index 000..322ff8b
--- /dev/null
+++ 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/AbstractStreamSink.java
@@ -0,0 +1,74 @@
+/**
+ * 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.app.sink;
+
+import backtype.storm.task.TopologyContext;
+import backtype.storm.topology.BasicOutputCollector;
+import backtype.storm.topology.OutputFieldsDeclarer;
+import backtype.storm.tuple.Fields;
+import backtype.storm.tuple.Tuple;
+import org.apache.eagle.alert.engine.model.StreamEvent;
+import org.apache.eagle.app.sink.mapper.StreamEventMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.Map;
+
+public abstract class AbstractStreamSink extends StreamSink {
+private final static Logger LOG = 
LoggerFactory.getLogger(AbstractStreamSink.class);
+private final static String KEY_FIELD = "KEY";
+private final static String VALUE_FIELD = "VALUE";
+private StreamEventMapper streamEventMapper;
+
+public AbstractStreamSink setEventMapper(StreamEventMapper 
streamEventMapper){
+this.streamEventMapper = streamEventMapper;
+return this;
+}
+
+@Override
+public void prepare(Map stormConf, TopologyContext context) {
+super.prepare(stormConf, context);
+}
+
+@Override
+public void execute(Tuple input, BasicOutputCollector collector) {
+try {
+List streamEvents = streamEventMapper.map(input);
+if(streamEvents!=null) {
+streamEvents.forEach((streamEvent -> {
+try {
+onEvent(streamEvent);
+} catch (Exception e) {
+LOG.error("Failed to execute event {}", streamEvent);
+collector.reportError(e);
+}
+}));
+}
+} catch (Exception e) {
+LOG.error("Failed to execute event {}",input);
+collector.reportError(e);
+}
+}
+
+protected abstract void onEvent(StreamEvent streamEvent);
+
+@Override
+public void declareOutputFields(OutputFieldsDeclarer declarer) {
+declarer.declare(new Fields(KEY_FIELD,VALUE_FIELD));
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e73e35da/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/KafkaStreamSink.java
--
diff --git 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/KafkaStreamSink.java
 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/KafkaStreamSink.java
index eee2a70..1490368 100644
--- 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/KafkaStreamSink.java
+++ 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/KafkaStreamSink.java
@@ -26,32 +26,27 @@ import org.slf4j.LoggerFactory;
 import java.util.HashMap;
 import java.util.Map;
 
-public class KafkaStreamSink extends StreamSink {
+public class KafkaStreamSink extends AbstractStreamSink {
 private final static Logger LOGGER = 
LoggerFactory.getLogger(KafkaStreamSink.class);
-private final String topicId;
+private String topicId;
 
-public KafkaStreamSink(StreamDefinition streamDefinition, 
ApplicationContext applicationContext) {
-super(streamDefinition, applicationContext);
-this.topicId = String.format("EAGLE_%s_%s_%s",
-applicationContext.getAppEntity().getSite().getSiteId(),
-applicationContext.getAppEntity().getDescriptor().getType(),
+@Override
+public 

[3/3] incubator-eagle git commit: [EAGLE-386] Refactor Application Framework Interfaces and StreamEventMapper

2016-07-22 Thread hao
[EAGLE-386] Refactor Application Framework Interfaces and StreamEventMapper

[Description]
h1. Application Framework Interfaces

Application Context (Runtime): org.apache.eagle.app.ApplicationContext
Application Metadata Entity (Persistence): 
org.apache.eagle.metadata.model.ApplicationEntity
Application Processing Logic (Execution): org.apache.eagle.app.Application
Application Lifecycle Listener (Installation): 
org.apache.eagle.app.ApplicationLifecycleListener

h1. StreamEventMapper (Flatten/Direct)
* FlattenEventMapper
* DirectEventMapper

h1. Metadata.xml Path Best Practice
/META-INF/apps/example/metadata.xml

[Changes]
Decouple Tuple to Event mapping with StreamEventMapper

Rename EventMapper and Application#buildApp

Integrate with ApplicationContext with ApplicationLifecycleListener to make 
sure callback onAppInstall/onAppUninstall

Clarify application framework interfaces and docs

Clarify ApplicationContext as single entrance of app 
metadata/processing/lifecycle

Clear application service code

Better metadata.xml practice: /META-INF/apps/example/metadata.xml

Fix ApplicationOperations json bug and MetadataStore related compile error


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/e73e35da
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/e73e35da
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/e73e35da

Branch: refs/heads/develop
Commit: e73e35da0fa778564fb23582478541fe390f2a0a
Parents: e21b073
Author: Chen, Hao <hch...@ebay.com>
Authored: Fri Jul 22 17:27:28 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Sat Jul 23 00:50:40 2016 +0800

--
 .../apache/eagle/app/AbstractApplication.java   |   4 +-
 .../java/org/apache/eagle/app/Application.java  |   2 +-
 .../apache/eagle/app/ApplicationContext.java| 217 +++
 .../eagle/app/ApplicationGuiceModule.java   |   4 +-
 .../eagle/app/ApplicationLifecycleListener.java |  39 
 .../java/org/apache/eagle/app/package-info.java |  29 +++
 .../eagle/app/resource/ApplicationResource.java |  14 +-
 .../apache/eagle/app/service/AppOperations.java | 161 --
 .../service/ApplicationManagementService.java   |   8 +-
 .../ApplicationManagementServiceImpl.java   |  96 
 .../app/service/ApplicationOperations.java  | 189 
 .../app/service/ApplicationProviderLoader.java  |   4 +-
 .../service/ApplicationProviderServiceImpl.java |  87 
 .../impl/ApplicationManagementServiceImpl.java  |  98 +
 .../impl/ApplicationProviderConfigLoader.java   | 128 +++
 .../impl/ApplicationProviderSPILoader.java  |  89 
 .../impl/ApplicationProviderServiceImpl.java|  89 
 .../loader/ApplicationProviderConfigLoader.java | 128 ---
 .../loader/ApplicationProviderSPILoader.java|  89 
 .../eagle/app/sink/AbstractStreamSink.java  |  74 +++
 .../apache/eagle/app/sink/KafkaStreamSink.java  |  39 ++--
 .../eagle/app/sink/LoggingStreamSink.java   |  18 +-
 .../org/apache/eagle/app/sink/StreamSink.java   | 125 ---
 .../app/sink/mapper/DirectEventMapper.java  |  19 ++
 .../mapper/FieldIndexDirectEventMapper.java |  40 
 .../sink/mapper/FieldNameDirectEventMapper.java |  40 
 .../app/sink/mapper/FlattenEventMapper.java |  78 +++
 .../app/sink/mapper/StreamEventMapper.java  |  33 +++
 .../app/sink/mapper/TimestampSelector.java  |  25 +++
 .../app/spi/AbstractApplicationProvider.java|   6 +-
 .../org/apache/eagle/app/test/AppSimulator.java |  51 -
 .../apache/eagle/app/test/AppSimulatorImpl.java |   8 +-
 .../eagle/app/test/AppTestGuiceModule.java  |   4 +-
 .../eagle/app/test/ApplicationSimulator.java|  70 ++
 .../src/main/resources/applications.xml |  42 
 .../app/ApplicationProviderServiceTest.java |   3 +-
 .../apache/eagle/app/TestApplicationImpl.java   |  38 ++--
 .../eagle/app/TestApplicationTestSuite.java |  14 +-
 .../test/resources/TestApplicationMetadata.xml  |   8 +
 .../src/test/resources/application.conf |   4 +-
 .../eagle-metadata/eagle-metadata-base/pom.xml  |   4 +
 .../eagle/metadata/model/ApplicationEntity.java |   2 +-
 .../eagle/metadata/model/StreamSinkDesc.java|  40 
 .../persistence/MemoryMetadataStore.java|  33 ---
 .../metadata/persistence/MetadataStore.java |   4 +-
 .../service/memory/MemoryMetadataStore.java |  32 +++
 eagle-examples/eagle-app-example/pom.xml|   6 -
 .../eagle/app/example/ExampleApplication.java   |  36 ++-
 .../app/example/ExampleApplicationProvider.java |   5 +-
 .../example/ExampleApplicationProvider2.java|   2 +-
 .../eagle/app/example/RandomEventSpout.java |  59 -
 .../resources/ExampleApplicationMetadata.xml|   8 +
 .../META-INF/apps/example/

[1/3] incubator-eagle git commit: [EAGLE-386] Refactor Application Framework Interfaces and StreamEventMapper

2016-07-22 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/develop e21b073f6 -> e73e35da0


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e73e35da/eagle-server/src/main/resources/providers-disabled.xml
--
diff --git a/eagle-server/src/main/resources/providers-disabled.xml 
b/eagle-server/src/main/resources/providers-disabled.xml
new file mode 100644
index 000..b434715
--- /dev/null
+++ b/eagle-server/src/main/resources/providers-disabled.xml
@@ -0,0 +1,27 @@
+
+
+
+
+target/apache-eagle-example-app.jar
+
org.apache.eagle.app.example.ExampleApplicationProvider
+
+
+target/apache-eagle-example-app.jar
+
org.apache.eagle.app.example.ExampleApplicationProvider2
+
+
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e73e35da/eagle-server/src/main/resources/providers.xml
--
diff --git a/eagle-server/src/main/resources/providers.xml 
b/eagle-server/src/main/resources/providers.xml
deleted file mode 100644
index b434715..000
--- a/eagle-server/src/main/resources/providers.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-target/apache-eagle-example-app.jar
-
org.apache.eagle.app.example.ExampleApplicationProvider
-
-
-target/apache-eagle-example-app.jar
-
org.apache.eagle.app.example.ExampleApplicationProvider2
-
-
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e73e35da/eagle-server/src/main/webapp/WEB-INF/web.xml
--
diff --git a/eagle-server/src/main/webapp/WEB-INF/web.xml 
b/eagle-server/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 000..9b8c5ac
--- /dev/null
+++ b/eagle-server/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,88 @@
+
+
+http://java.sun.com/xml/ns/javaee;
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
+   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd;
+   version="3.0">
+
+index.html
+
+
+
+
+Jersey Web Application
+
com.sun.jersey.spi.container.servlet.ServletContainer
+
+com.sun.jersey.config.property.packages
+
io.swagger.jaxrs.json,io.swagger.jaxrs.listing,org.apache.eagle,org.codehaus.jackson.jaxrs
+
+
+
com.sun.jersey.spi.container.ContainerRequestFilters
+
com.sun.jersey.api.container.filter.GZIPContentEncodingFilter;com.sun.jersey.api.container.filter.PostReplaceFilter
+
+
+
com.sun.jersey.spi.container.ContainerResponseFilters
+
com.sun.jersey.api.container.filter.GZIPContentEncodingFilter
+
+1
+
+
+   
+   swaggerConfig
+   
io.swagger.jaxrs.config.DefaultJaxrsConfig
+   
+   api.version
+   1.0.0
+   
+   
+   swagger.api.basepath
+   /rest
+   
+   2
+   
+
+Jersey Web Application
+/rest/*
+
+
+CorsFilter
+
+
org.apache.eagle.alert.resource.SimpleCORSFiler
+
+cors.allowed.origins
+*
+
+
+cors.allowed.headers
+Authorization,Origin, No-Cache, X-Requested-With, 
If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, 
X-E4M-With, Accept
+
+
+cors.allowed.methods
+GET,POST,HEAD,OPTIONS,PUT,DELETE
+
+
+cors.support.credentials
+true
+
+
+
+CorsFilter
+/*
+
+
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e73e35da/pom.xml
--
diff --git a/pom.xml b/pom.xml
index d7d0ccb..ccae27f 100755
--- a/pom.xml
+++ b/pom.xml
@@ -809,6 +809,17 @@
 
 
 
+io.dropwizard
+dropwizard-servlets
+${dropwizard.version}
+
+
+org.slf4j
+slf4j-log4j12
+
+
+
+
 io.swagger
 swagger-jersey-jaxrs
 ${swagger.version}



[10/11] incubator-eagle git commit: [EAGLE-382][EAGLE-385] Monitoring Application Framework Core

2016-07-21 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderLoader.java
--
diff --git 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderLoader.java
 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderLoader.java
new file mode 100644
index 000..8b98404
--- /dev/null
+++ 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderLoader.java
@@ -0,0 +1,74 @@
+/**
+ * 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.app.service;
+
+import com.typesafe.config.Config;
+import org.apache.eagle.app.service.loader.ApplicationProviderConfigLoader;
+import org.apache.eagle.app.service.loader.ApplicationProviderSPILoader;
+import org.apache.eagle.app.spi.ApplicationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public abstract class ApplicationProviderLoader {
+private final Config config;
+private final Map providers;
+private final static Logger LOG = 
LoggerFactory.getLogger(ApplicationProviderLoader.class);
+
+public ApplicationProviderLoader(Config config) {
+this.config = config;
+this.providers = new HashMap<>();
+}
+
+public abstract void load();
+
+protected Config getConfig() {
+return config;
+}
+
+protected void registerProvider(ApplicationProvider provider){
+if(providers.containsKey(provider.getApplicationDesc().getType())){
+throw new RuntimeException("Duplicated APPLICATION_TYPE: 
"+provider.getApplicationDesc().getType()+", was already registered by 
provider: "+providers.get(provider.getApplicationDesc().getType()));
+}
+providers.put(provider.getApplicationDesc().getType(),provider);
+LOG.info("Initialized application provider: {}",provider);
+}
+
+public Collection getProviders(){
+return providers.values();
+}
+
+public ApplicationProvider getApplicationProviderByType(String type) {
+return providers.get(type);
+}
+
+public void reset(){
+providers.clear();
+}
+
+public static String getDefaultAppProviderLoader(){
+if(ApplicationProviderConfigLoader
+
.appProviderConfExists(ApplicationProviderConfigLoader.DEFAULT_APPLICATIONS_CONFIG_FILE)){
+return ApplicationProviderConfigLoader.class.getCanonicalName();
+} else {
+return ApplicationProviderSPILoader.class.getCanonicalName();
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderService.java
--
diff --git 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderService.java
 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderService.java
new file mode 100644
index 000..52dfb5c
--- /dev/null
+++ 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderService.java
@@ -0,0 +1,31 @@
+
+/**
+ * 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.
+ * 

[06/11] incubator-eagle git commit: [EAGLE-382][EAGLE-385] Monitoring Application Framework Core

2016-07-21 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/TestScheduler.scala
--
diff --git 
a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/TestScheduler.scala
 
b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/TestScheduler.scala
deleted file mode 100644
index 3db2d67..000
--- 
a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/TestScheduler.scala
+++ /dev/null
@@ -1,61 +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.stream.application.scheduler
-
-import akka.actor.{ActorSystem, Props}
-import akka.testkit.{TestActorRef, TestKit}
-import com.typesafe.config.ConfigFactory
-import org.scalatest.{Ignore, BeforeAndAfterAll, MustMatchers, WordSpecLike}
-
-@Ignore
-class TestSchedulerSpec extends TestKit(ActorSystem("stream-app-scheduler"))
-with WordSpecLike with MustMatchers with BeforeAndAfterAll {
-
-  "A Scheduler actor" must {
-"Forward a message it receives" in {
-  val coordinator = TestActorRef[StreamAppCoordinator]
-  coordinator ! CommandLoaderEvent
-  expectNoMsg()
-}
-  }
-
-  "A Integrated test" must {
-"run end-to-end" in {
-  val coordinator = system.actorOf(Props[StreamAppCoordinator])
-  coordinator ! CommandLoaderEvent
-  expectNoMsg()
-}
-  }
-
-  override def afterAll(): Unit = {
-super.afterAll()
-system.shutdown()
-  }
-}
-
-@Ignore
-object TestStreamAppScheduler extends App {
-  val conf: String = """
-  akka.loglevel = "DEBUG"
-  akka.actor.debug {
-receive = on
-lifecycle = on
-  }
- """
-  new ApplicationScheduler().start(ConfigFactory.parseString(conf))
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/pom.xml
--
diff --git a/eagle-core/eagle-application-management/pom.xml 
b/eagle-core/eagle-application-management/pom.xml
deleted file mode 100644
index 5bb8e72..000
--- a/eagle-core/eagle-application-management/pom.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-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;>
-
-eagle-core
-org.apache.eagle
-0.5.0-incubating-SNAPSHOT
-
-4.0.0
-
-eagle-application-management
-pom
-Eagle Application Management
-
-
-eagle-stream-application-manager
-eagle-application-service
-
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/pom.xml
--
diff --git a/eagle-core/eagle-common/pom.xml b/eagle-core/eagle-common/pom.xml
new file mode 100644
index 000..a8b8124
--- /dev/null
+++ b/eagle-core/eagle-common/pom.xml
@@ -0,0 +1,82 @@
+
+
+
+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;>
+   4.0.0
+
+   
+   org.apache.eagle
+   eagle-query-parent
+   0.5.0-incubating-SNAPSHOT
+../pom.xml
+   
+
+   eagle-common
+   jar
+   eagle-common
+
+   
+   
+   commons-configuration
+   commons-configuration
+   
+   
+   org.apache.hbase
+   hbase-client
+   
+
+   
+   

[02/11] incubator-eagle git commit: [EAGLE-382][EAGLE-385] Monitoring Application Framework Core

2016-07-21 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/main/resources/header.vm
--
diff --git a/eagle-core/eagle-query/eagle-common/src/main/resources/header.vm 
b/eagle-core/eagle-query/eagle-common/src/main/resources/header.vm
deleted file mode 100755
index 6731aee..000
--- a/eagle-core/eagle-query/eagle-common/src/main/resources/header.vm
+++ /dev/null
@@ -1,303 +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.
- *
- * @version 0.3.0
- *#
-http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;>
-http://www.w3.org/1999/xhtml;>
-
-  
-  
-  
-  
-/* Based on The MailChimp Reset INLINE: Yes. */
-/* Client-specific Styles */
-.outlook a {
-  color: #091D42;
-  padding: 0;
-  text-decoration: none;
-}
-
-/* Force Outlook to provide a "view in browser" menu link. */
-body {
-  width: 100% !important;
-  -webkit-text-size-adjust: 100%;
-  -ms-text-size-adjust: 100%;
-  margin: 0;
-  padding: 0;
-}
-
-/* Prevent Webkit and Windows Mobile platforms from changing default font 
sizes.*/
-.ExternalClass {
-  width: 100%;
-}
-
-/* Force Hotmail to display emails at full width */
-.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass 
font, .ExternalClass td, .ExternalClass div {
-  line-height: 100%;
-}
-
-/* Forces Hotmail to display normal line spacing.  More on that: 
http://www.emailonacid.com/forum/viewthread/43/ */
-#backgroundTable {
-  margin: 0;
-  padding: 0;
-  width: 100% !important;
-  line-height: 100% !important;
-border: 1pt solid #BFB8AF;
-background-color: #fff;
-}
-
-/* End reset */
-
-/* Some sensible defaults for images
-Bring inline: Yes. */
-img {
-  outline: none;
-  text-decoration: none;
-  -ms-interpolation-mode: bicubic;
-}
-
-a img {
-  border: none;
-}
-
-.image_fix {
-  display: block;
-}
-
-/* Yahoo paragraph fix
-Bring inline: Yes. */
-p {
-  margin: 1em 0;
-}
-
-/* Hotmail header color reset
-Bring inline: Yes. */
-h1, h2, h3, h4, h5, h6 {
-  color: black !important;
-}
-
-h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
-  color: blue !important;
-}
-
-h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 
a:active {
-  color: red !important; /* Preferably not the same color as the normal 
header link color.  There is limited support for psuedo classes in email 
clients, this was added just for good measure. */
-}
-
-h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 
a:visited {
-  color: purple !important; /* Preferably not the same color as the normal 
header link color. There is limited support for psuedo classes in email 
clients, this was added just for good measure. */
-}
-
-table{
-width: 100%;
-}
-
-/* Outlook 07, 10 Padding issue fix
-Bring inline: No.*/
-table td {
-  border-collapse: collapse;
-}
-
-/* Remove spacing around Outlook 07, 10 tables
-Bring inline: Yes */
-table {
-  border-collapse: collapse;
-  mso-table-lspace: 0pt;
-  mso-table-rspace: 0pt;
-}
-
-/* Styling your links has become much simpler with the new Yahoo.  In 
fact, it falls in line with the main credo of styling in email and make sure to 
bring your styles inline.  Your link colors will be uniform across clients when 
brought inline.
-Bring inline: Yes. */
-a {
-  color: orange;
-}
-
-/***
-
-MOBILE TARGETING
-
-***/
-@media only screen and (max-device-width: 480px) {
-  /* Part one of controlling phone number linking for mobile. */
-  a[href^="tel"], a[href^="sms"] {
-text-decoration: none;
-color: blue; /* or 

[04/11] incubator-eagle git commit: [EAGLE-382][EAGLE-385] Monitoring Application Framework Core

2016-07-21 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationEntity.java
--
diff --git 
a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationEntity.java
 
b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationEntity.java
new file mode 100644
index 000..09377ab
--- /dev/null
+++ 
b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationEntity.java
@@ -0,0 +1,153 @@
+/**
+ * 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.metadata.model;
+
+import org.apache.eagle.metadata.persistence.PersistenceEntity;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Site app management entity
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ApplicationEntity extends PersistenceEntity {
+private String appId;
+private SiteEntity site;
+
+/**
+ * TODO: Think about keeping ApplicationDesc as a reference or deep clone 
into current instance
+ */
+private ApplicationDesc descriptor;
+
+private Map configuration = new HashMap<>();
+private Map context = new HashMap<>();
+private Collection streams;
+private Mode mode = Mode.CLUSTER;
+private Status status = Status.INITIAILIZED;
+
+public SiteEntity getSite() {
+return site;
+}
+
+public void setSite(SiteEntity site) {
+this.site = site;
+}
+
+public ApplicationDesc getDescriptor() {
+return descriptor;
+}
+
+public void setDescriptor(ApplicationDesc descriptor) {
+this.descriptor = descriptor;
+}
+
+public Map getConfiguration() {
+return configuration;
+}
+
+public void setConfiguration(Map configuration) {
+this.configuration = configuration;
+}
+
+public String getAppId() {
+return appId;
+}
+
+public void setAppId(String appId) {
+this.appId = appId;
+}
+
+@Override
+public void ensureDefault() {
+super.ensureDefault();
+if(this.appId == null){
+this.appId = 
String.format("EAGLE_APP_%s_%s",this.getSite().getSiteId(),this.getDescriptor().getType());
+}
+if(this.status == null){
+this.status = Status.INITIAILIZED;
+}
+}
+
+public Map getContext() {
+return context;
+}
+
+public void setContext(Map context) {
+this.context = context;
+}
+
+public Mode getMode() {
+return mode;
+}
+
+public void setMode(Mode mode) {
+this.mode = mode;
+}
+
+public Status getStatus() {
+return status;
+}
+
+public void setStatus(Status status) {
+this.status = status;
+}
+
+public Collection getStreams() {
+return streams;
+}
+
+public void setStreams(Collection streams) {
+this.streams = streams;
+}
+
+public static enum Status{
+INITIAILIZED("INITIAILIZED"),
+STARTING("STARTING"),
+RUNNING("RUNNING"),
+STOPPPING("STOPPPING"),
+STOPPED("STOPPED");
+
+private final String status;
+Status(String status){
+this.status = status;
+}
+
+@Override
+public String toString() {
+return status;
+}
+}
+
+public static enum Mode{
+LOCAL("LOCAL"),
+CLUSTER("CLUSTER");
+private final String name;
+
+Mode(String name){
+this.name = name;
+}
+
+@Override
+public String toString() {
+return this.name;
+}
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationRawEntity.java

[03/11] incubator-eagle git commit: [EAGLE-382][EAGLE-385] Monitoring Application Framework Core

2016-07-21 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/ByteUtil.java
--
diff --git 
a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/ByteUtil.java
 
b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/ByteUtil.java
deleted file mode 100644
index c1d4976..000
--- 
a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/ByteUtil.java
+++ /dev/null
@@ -1,178 +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.common;
-
-public class ByteUtil {
-   
-   public static double bytesToDouble(byte[] bytes, int offset){
-   return Double.longBitsToDouble(bytesToLong(bytes, offset));
-   }
-   
-   public static double bytesToDouble(byte[] bytes){
-   return Double.longBitsToDouble(bytesToLong(bytes));
-   }
-   
-   public static void doubleToBytes(double v, byte[] bytes){
-   doubleToBytes(v, bytes, 0);
-   }
-   
-   public static void doubleToBytes(double v, byte[] bytes, int offset){
-   longToBytes(Double.doubleToLongBits(v), bytes, offset);
-   }
-   
-   public static byte[] doubleToBytes(double v){
-   return longToBytes(Double.doubleToLongBits(v));
-   }
-   
-   public static long bytesToLong(byte[] bytes){
-   return bytesToLong(bytes, 0);
-   }
-   
-   public static long bytesToLong(byte[] bytes, int offset){
-   long value = 0;
-   for(int i=0; i<8; i++){
-   value <<= 8;
-   value |= (bytes[i+offset] & 0xFF);
-   }
-   return value;
-   }
-   
-   public static void longToBytes(long v, byte[] bytes){
-   longToBytes(v, bytes, 0);
-   }
-   
-   public static void longToBytes(long v, byte[] bytes, int offset){
-   long tmp = v;
-   for(int i=0; i<8; i++){
-   bytes[offset + 7 - i] = (byte)(tmp & 0xFF);
-   tmp >>= 8;
-   }
-   }
-   
-   public static byte[] longToBytes(long v){
-   long tmp = v;
-   byte[] b = new byte[8];
-   for(int i=0; i<8; i++){
-   b[7-i] = (byte)(tmp & 0xFF);
-   tmp >>= 8;
-   }
-   return b;
-   }
-   
-   public static int bytesToInt(byte[] bytes){
-   return bytesToInt(bytes, 0);
-   }
-   
-   public static int bytesToInt(byte[] bytes, int offset){
-   int value = 0;
-   for(int i=0; i<4; i++){
-   value <<= 8;
-   value |= (bytes[i+offset] & 0xFF);
-   }
-   return value;
-   }
-   
-   public static void intToBytes(int v, byte[] bytes){
-   intToBytes(v, bytes, 0);
-   }
-   
-   public static void intToBytes(int v, byte[] bytes, int offset){
-   int tmp = v;
-   for(int i=0; i<4; i++){
-   bytes[offset + 3 - i] = (byte)(tmp & 0xFF);
-   tmp >>= 8;
-   }
-   }
-
-   public static byte[] intToBytes(int v){
-   int tmp = v;
-   byte[] b = new byte[4];
-   for(int i=0; i<4; i++){
-   b[3-i] = (byte)(tmp & 0xFF);
-   tmp >>= 8;
-   }
-   return b;
-   }
-
-   //
-   
-   public static short bytesToShort(byte[] bytes){
-   return bytesToShort(bytes, 0);
-   }
-   
-   public static short bytesToShort(byte[] bytes, int offset){
-   short value = 0;
-   for(int i=0; i < 2; i++){
-   value <<= 8;
-   value |= (bytes[i+offset] & 0xFF);
-   }
-   return value;
-   }
-   
-   public static void shortToBytes(short v, byte[] bytes){
-  

[05/11] incubator-eagle git commit: [EAGLE-382][EAGLE-385] Monitoring Application Framework Core

2016-07-21 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/LdapService.java
--
diff --git 
a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/LdapService.java
 
b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/LdapService.java
new file mode 100644
index 000..31f1d01
--- /dev/null
+++ 
b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/LdapService.java
@@ -0,0 +1,259 @@
+/*
+ * 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.common.service;
+
+
+import org.apache.eagle.common.config.EagleConfig;
+import org.apache.eagle.common.config.EagleConfigFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.*;
+import java.util.*;
+
+/**
+ * @since : 7/11/14,2014
+ */
+public class LdapService {
+private final static Logger LOG = 
LoggerFactory.getLogger(LdapService.class);
+
+private final List ldapSrvs;
+private String ldapCerts;
+private final String securityPrincipal;
+private final String securityCredentials;
+
+public final static String SECURITY_PRINCIPAL_CONFIG_NAME = 
"eagle.ldap.security-principal";
+public final static String SECURITY_CREDENTIALS_CONFIG_NAME = 
"eagle.ldap.security-credentials";
+public final static String LDAP_SERVER_CONFIG_NAME = "eagle.ldap.server";
+public final static String LDAP_CERTS_CONFIG_NAME = "eagle.ldap.certs";
+public final static String DEFAULT_LDAP_CERTS_FILE_NAME = "jssecacerts";
+
+private LdapService(){
+EagleConfig manager = EagleConfigFactory.load();
+securityPrincipal = 
manager.getConfig().getString(SECURITY_PRINCIPAL_CONFIG_NAME);
+securityCredentials = 
manager.getConfig().getString(SECURITY_CREDENTIALS_CONFIG_NAME);
+String ldapServer = 
manager.getConfig().getString(LDAP_SERVER_CONFIG_NAME);
+if(LOG.isDebugEnabled())
+LOG.debug(SECURITY_PRINCIPAL_CONFIG_NAME+":"+securityPrincipal);
+if(securityCredentials!=null){
+if(LOG.isDebugEnabled())
+LOG.debug(SECURITY_CREDENTIALS_CONFIG_NAME+": (hidden for 
security, length: "+securityCredentials.length()+")");
+}else{
+LOG.warn(SECURITY_CREDENTIALS_CONFIG_NAME+":"+null);
+}
+if(LOG.isDebugEnabled())
+LOG.debug(LDAP_SERVER_CONFIG_NAME+":"+ldapServer);
+
+ldapSrvs = Arrays.asList(ldapServer.split(","));
+ldapCerts = manager.getConfig().getString(LDAP_CERTS_CONFIG_NAME);
+if(ldapCerts == null) {
+ldapCerts = 
LdapService.class.getClassLoader().getResource(DEFAULT_LDAP_CERTS_FILE_NAME).getPath();
+}else if(!ldapCerts.startsWith("/") && 
!ldapCerts.matches("[a-zA-Z]+:.*")) {
+ldapCerts = 
LdapService.class.getClassLoader().getResource(ldapCerts).getPath();
+}
+if(LOG.isDebugEnabled()) {
+LOG.debug(SECURITY_PRINCIPAL_CONFIG_NAME +": "+securityPrincipal);
+if(securityCredentials == null){
+LOG.debug(SECURITY_CREDENTIALS_CONFIG_NAME +": null");
+}else{
+LOG.debug(SECURITY_CREDENTIALS_CONFIG_NAME +": (hidden, 
length: "+securityCredentials .length()+")");
+}
+
+LOG.debug(LDAP_SERVER_CONFIG_NAME +": "+ldapSrvs);
+LOG.debug(LDAP_CERTS_CONFIG_NAME +": "+ldapCerts);
+}
+}
+
+private static LdapService instance;
+
+public static LdapService getInstance(){
+if(instance == null){
+instance = new LdapService();
+}
+return instance;
+}
+
+protected DirContext getDirContext(int id) {
+if (ldapCerts != null) {
+System.setProperty("javax.net.ssl.keyStore", ldapCerts);
+System.setProperty("javax.net.ssl.trustStore", ldapCerts);
+}
+
+String host = ldapSrvs.get(id);
+
+Hashtable env = new Hashtable();
+// 

[07/11] incubator-eagle git commit: [EAGLE-382][EAGLE-385] Monitoring Application Framework Core

2016-07-21 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyOperationEntity.java
--
diff --git 
a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyOperationEntity.java
 
b/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyOperationEntity.java
deleted file mode 100644
index 6d8f1a0..000
--- 
a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyOperationEntity.java
+++ /dev/null
@@ -1,105 +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.application.entity;
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.meta.*;
-import org.apache.eagle.policy.common.Constants;
-
-import org.apache.eagle.service.application.AppManagerConstants;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
-@Table("eagle_metadata")
-@ColumnFamily("f")
-@Prefix("topologyOperation")
-@Service(Constants.TOPOLOGY_OPERATION_SERVICE_ENDPOINT_NAME)
-@JsonIgnoreProperties(ignoreUnknown = true)
-@TimeSeries(true)
-@Tags({"site", "application", "topology", "operationID", "operation"})
-public class TopologyOperationEntity extends TaggedLogAPIEntity {
-@Column("a")
-private String status;
-@Column("b")
-private String message;
-@Column("c")
-private long lastModifiedDate;
-
-public String getStatus() {
-return status;
-}
-
-public void setStatus(String status) {
-this.status = status;
-valueChanged("status");
-}
-
-public String getMessage() {
-return message;
-}
-
-public void setMessage(String message) {
-this.message = message;
-valueChanged("message");
-}
-
-public long getLastModifiedDate() {
-return lastModifiedDate;
-}
-
-public void setLastModifiedDate(long lastModifiedDate) {
-this.lastModifiedDate = lastModifiedDate;
-valueChanged("lastModifiedDate");
-}
-
-public final static class OPERATION {
-public final static String START = "START";
-public final static String STOP = "STOP";
-public final static String STATUS = "STATUS";
-}
-
-public final static class OPERATION_STATUS {
-public final static String PENDING = "PENDING";
-public final static String INITIALIZED = "INITIALIZED";
-public final static String SUCCESS = "SUCCESS";
-public final static String FAILED = "FAILED";
-}
-
-public String getSite() {
-return this.getTags().get(AppManagerConstants.SITE_TAG);
-}
-
-public String getApplication() {
-return this.getTags().get(AppManagerConstants.APPLICATION_TAG);
-}
-
-public String getTopology() {
-return this.getTags().get(AppManagerConstants.TOPOLOGY_TAG);
-}
-
-public String getOperation() {
-return this.getTags().get(AppManagerConstants.OPERATION_TAG);
-}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/pom.xml
--
diff --git 
a/eagle-core/eagle-application-management/eagle-stream-application-manager/pom.xml
 
b/eagle-core/eagle-application-management/eagle-stream-application-manager/pom.xml
deleted file mode 100644
index fd3a5f1..000
--- 
a/eagle-core/eagle-application-management/eagle-stream-application-manager/pom.xml
+++ /dev/null
@@ -1,142 +0,0 @@
-
-
-
-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 

incubator-eagle git commit: [EAGLE-355] fix advanced sql parse logic

2016-07-07 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/branch-0.3.1 6caa6f02b -> 5a7689eae


[EAGLE-355] fix advanced sql parse logic

Adjust the logic of expression parse

Author: jiljiang <jilji...@ebay.com>

Closes #251 from zombieJ/branch-0.4.

(cherry picked from commit 6a3f152b3a5e44803f19592da6ce7f284232b37a)
Signed-off-by: Hao Chen <h...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/5a7689ea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/5a7689ea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/5a7689ea

Branch: refs/heads/branch-0.3.1
Commit: 5a7689eaeb475e8feacf2c7919865a6e6bbd4704
Parents: 6caa6f0
Author: jiljiang <jilji...@ebay.com>
Authored: Thu Jul 7 15:21:10 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Thu Jul 7 15:22:04 2016 +0800

--
 .../main/webapp/app/public/feature/common/controller.js  | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5a7689ea/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
--
diff --git 
a/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js 
b/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
index 50f377c..ee1597c 100644
--- a/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
+++ b/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
@@ -489,15 +489,16 @@
// >> Parse expression
$scope.policy.__.conditions = 
{};
var _condition = 
_policyUnit.expression.match(/from\s+(\w+)(\[(.*)])?(#window[^\)]*\))?\s+(select
 (\w+, )?(\w+)\((\w+)\) as [\w\d_]+ (group by (\w+) )?having ([\w\d_]+) 
([<>=]+) ([^\s]+))?/);
-   var _cond_stream = 
_condition[1];
-   var _cond_query = _condition[3] 
|| "";
-   var _cond_window = 
_condition[4];
-   var _cond_group = _condition[5];
-   var _cond_groupUnit = 
_condition.slice(7,14);
 
if(!_condition) {

$scope.policy.__.advanced = true;
} else {
+   var _cond_stream = 
_condition[1];
+   var _cond_query = 
_condition[3] || "";
+   var _cond_window = 
_condition[4];
+   var _cond_group = 
_condition[5];
+   var _cond_groupUnit = 
_condition.slice(7,14);
+
// > StreamName
var _streamName = 
_cond_stream;
var _cond = _cond_query;



incubator-eagle git commit: [EAGLE-355] fix advanced sql parse logic

2016-07-07 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/branch-0.4 f76a97248 -> 6a3f152b3


[EAGLE-355] fix advanced sql parse logic

Adjust the logic of expression parse

Author: jiljiang <jilji...@ebay.com>

Closes #251 from zombieJ/branch-0.4.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/6a3f152b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/6a3f152b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/6a3f152b

Branch: refs/heads/branch-0.4
Commit: 6a3f152b3a5e44803f19592da6ce7f284232b37a
Parents: f76a972
Author: jiljiang <jilji...@ebay.com>
Authored: Thu Jul 7 15:21:10 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Thu Jul 7 15:21:10 2016 +0800

--
 .../main/webapp/app/public/feature/common/controller.js  | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6a3f152b/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
--
diff --git 
a/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js 
b/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
index 72af7eb..b23d53b 100644
--- a/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
+++ b/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
@@ -644,15 +644,16 @@
// >> Parse expression
$scope.policy.__.conditions = 
{};
var _condition = 
_policyUnit.expression.match(/from\s+(\w+)(\[(.*)])?(#window[^\)]*\))?\s+(select
 (\w+, )?(\w+)\((\w+)\) as [\w\d_]+ (group by (\w+) )?having ([\w\d_]+) 
([<>=]+) ([^\s]+))?/);
-   var _cond_stream = 
_condition[1];
-   var _cond_query = _condition[3] 
|| "";
-   var _cond_window = 
_condition[4];
-   var _cond_group = _condition[5];
-   var _cond_groupUnit = 
_condition.slice(7,14);
 
if(!_condition) {

$scope.policy.__.advanced = true;
} else {
+   var _cond_stream = 
_condition[1];
+   var _cond_query = 
_condition[3] || "";
+   var _cond_window = 
_condition[4];
+   var _cond_group = 
_condition[5];
+   var _cond_groupUnit = 
_condition.slice(7,14);
+
// > StreamName
var _streamName = 
_cond_stream;
var _cond = _cond_query;



[5/6] incubator-eagle git commit: Rebase code base

2016-07-06 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/72a1501c/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/UnitTopologyMain.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/UnitTopologyMain.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/UnitTopologyMain.java
index 2bca329..57529b6 100644
--- 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/UnitTopologyMain.java
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/UnitTopologyMain.java
@@ -19,6 +19,10 @@
 
 package org.apache.eagle.alert.engine;
 
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.Options;
 import org.apache.eagle.alert.config.ZKConfig;
 import org.apache.eagle.alert.config.ZKConfigBuilder;
 import 
org.apache.eagle.alert.engine.coordinator.impl.ZKMetadataChangeNotifyService;
@@ -40,19 +44,43 @@ import com.typesafe.config.ConfigFactory;
  */
 public class UnitTopologyMain {
 
-public static void main(String[] args) {
+public static void main(String[] args) throws Exception {
+// command line parse
+Options options = new Options();
+options.addOption("c", true,
+"config URL (valid file name) - defaults application.conf 
according to typesafe config default behavior.");
+CommandLineParser parser = new DefaultParser();
+CommandLine cmd = parser.parse(options, args);
+
+if (cmd.hasOption("c")) {
+String fileName = cmd.getOptionValue("c", "application.conf");
+System.setProperty("config.resource", fileName.startsWith("/") ? 
fileName : "/" + fileName);
+ConfigFactory.invalidateCaches();
+}
 Config config = ConfigFactory.load();
-ZKConfig zkConfig = ZKConfigBuilder.getZKConfig(config);
-String topologyId = config.getString("topology.name");
-ZKMetadataChangeNotifyService changeNotifyService = new 
ZKMetadataChangeNotifyService(zkConfig, topologyId);
 
+// load config and start
+String topologyId = config.getString("topology.name");
+ZKMetadataChangeNotifyService changeNotifyService = 
createZKNotifyService(config, topologyId);
 new UnitTopologyRunner(changeNotifyService).run(topologyId, config);
 }
+
+public static void runTopology(Config config, backtype.storm.Config 
stormConfig) {
+// load config and start
+String topologyId = config.getString("topology.name");
+ZKMetadataChangeNotifyService changeNotifyService = 
createZKNotifyService(config, topologyId);
+new UnitTopologyRunner(changeNotifyService, 
stormConfig).run(topologyId, config);
+}
 
-public static StormTopology createTopology(Config config) {
+private static ZKMetadataChangeNotifyService createZKNotifyService(Config 
config, String topologyId) {
 ZKConfig zkConfig = ZKConfigBuilder.getZKConfig(config);
-String topologyId = config.getString("topology.name");
 ZKMetadataChangeNotifyService changeNotifyService = new 
ZKMetadataChangeNotifyService(zkConfig, topologyId);
+return changeNotifyService;
+}
+
+public static StormTopology createTopology(Config config) {
+String topologyId = config.getString("topology.name");
+ZKMetadataChangeNotifyService changeNotifyService = 
createZKNotifyService(config, topologyId);
 
 return new 
UnitTopologyRunner(changeNotifyService).buildTopology(topologyId, config);
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/72a1501c/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/PolicyStreamHandlers.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/PolicyStreamHandlers.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/PolicyStreamHandlers.java
index 2aa70e8..e8f736c 100644
--- 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/PolicyStreamHandlers.java
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/PolicyStreamHandlers.java
@@ -20,13 +20,17 @@ import java.util.Map;
 
 import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
 import org.apache.eagle.alert.engine.evaluator.impl.SiddhiPolicyHandler;
+import 

[3/6] incubator-eagle git commit: Rebase code base

2016-07-06 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/72a1501c/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/siddhi/SiddhiPolicyTest.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/siddhi/SiddhiPolicyTest.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/siddhi/SiddhiPolicyTest.java
new file mode 100644
index 000..f4e82bc
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/siddhi/SiddhiPolicyTest.java
@@ -0,0 +1,247 @@
+/*
+ * 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.engine.siddhi;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.wso2.siddhi.core.ExecutionPlanRuntime;
+import org.wso2.siddhi.core.SiddhiManager;
+import org.wso2.siddhi.core.event.Event;
+import org.wso2.siddhi.core.stream.input.InputHandler;
+import org.wso2.siddhi.core.stream.output.StreamCallback;
+
+/**
+ * @since Jun 21, 2016
+ *
+ */
+public class SiddhiPolicyTest {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(SiddhiPolicyTest.class);
+
+private String streams = " define stream syslog_stream("
++ "dims_facility string, "
++ "dims_severity string, "
++ "dims_hostname string, "
++ "dims_msgid string, "
++ "timestamp string, "
++ "conn string, "
++ "op string, "
++ "msgId string, "
++ "command string, "
++ "name string, "
++ "namespace string, "
++ "epochMillis long); ";
+private SiddhiManager sm;
+
+@Before
+public void setup() {
+sm = new SiddhiManager();
+}
+
+@After
+public void shutdown() {
+sm.shutdown();
+}
+
+@Test
+public void testPolicy_grpby() {
+String ql = " from syslog_stream#window.time(1min) select name, 
namespace, timestamp, dims_hostname, count(*) as abortCount group by 
dims_hostname insert into syslog_severity_check_output; ";
+StreamCallback sc = new StreamCallback() {
+@Override
+public void receive(Event[] arg0) {
+
+};
+};
+
+String executionPlan = streams + ql;
+ExecutionPlanRuntime runtime = 
sm.createExecutionPlanRuntime(executionPlan);
+runtime.addCallback("syslog_severity_check_output", sc);
+runtime.start();
+}
+
+@Ignore
+@Test
+public void testPolicy_agg() throws Exception {
+String sql = " from syslog_stream#window.time(1min) select "
++ "name, "
++ "namespace, "
++ "timestamp, "
++ "dims_hostname, "
++ "count(*) as abortCount "
++ "group by dims_hostname "
++ "having abortCount > 3 insert into 
syslog_severity_check_output; ";
+
+final AtomicBoolean checked = new AtomicBoolean(false);
+StreamCallback sc = new StreamCallback() {
+@Override
+public void receive(Event[] arg0) {
+checked.set(true);
+LOG.info("event array size: " + arg0.length);
+Set hosts = new HashSet();
+for (Event e : arg0) {
+hosts.add((String) e.getData()[3]);
+}
+
+LOG.info(" grouped hosts : " + hosts);
+Assert.assertTrue(hosts.contains("HOSTNAME-" + 0));
+Assert.assertTrue(hosts.contains("HOSTNAME-" + 1));
+Assert.assertTrue(hosts.contains("HOSTNAME-" + 2));
+Assert.assertFalse(hosts.contains("HOSTNAME-" + 3));
+};
+};
+
+String executionPlan = streams + sql;
+

[2/6] incubator-eagle git commit: Rebase code base

2016-07-06 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/72a1501c/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/JdbcDatabaseHandler.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/JdbcDatabaseHandler.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/JdbcDatabaseHandler.java
new file mode 100644
index 000..a5448a4
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/JdbcDatabaseHandler.java
@@ -0,0 +1,277 @@
+/*
+ * 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;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.typesafe.config.Config;
+import org.apache.eagle.alert.metadata.MetadataUtils;
+import org.apache.eagle.alert.metadata.resource.OpResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.sql.*;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+public class JdbcDatabaseHandler {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(JdbcDatabaseHandler.class);
+
+private final String INSERT_STATEMENT = "INSERT INTO %s VALUES (?, ?)";
+private final String DELETE_STATEMENT = "DELETE FROM %s WHERE id=?";
+private final String UPDATE_STATEMENT = "UPDATE %s set value=? WHERE id=?";
+private final String QUERY_ALL_STATEMENT = "SELECT value FROM %s";
+private final String QUERY_CONDITION_STATEMENT = "SELECT value FROM %s 
WHERE id=?";
+private final String QUERY_ORDERBY_STATEMENT = "SELECT value FROM %s ORDER 
BY id %s";
+
+private Map tblNameMap = new HashMap<>();
+
+private static final ObjectMapper mapper = new ObjectMapper();
+private Connection connection = null;
+
+static {
+mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, 
false);
+}
+
+public JdbcDatabaseHandler(Config config) {
+// "jdbc:mysql://dbhost/database?" + "user=sqluser=sqluserpw"
+this.tblNameMap = JdbcSchemaManager.tblNameMap;
+try {
+Class.forName("com.mysql.jdbc.Driver");
+JdbcSchemaManager.getInstance().init(config);
+connection = MetadataUtils.getJdbcConnection(config);
+} catch (ClassNotFoundException e) {
+e.printStackTrace();
+}
+}
+
+private String getTableName(String clzName) {
+String tbl = tblNameMap.get(clzName);
+if (tbl != null) {
+return tbl;
+} else {
+return clzName;
+}
+}
+
+public  OpResult addOrReplace(String clzName, T t) {
+String tb = getTableName(clzName);
+OpResult result = new OpResult();
+PreparedStatement statement = null;
+Savepoint savepoint = null;
+String key = null;
+String value = null;
+try {
+statement = 
connection.prepareStatement(String.format(INSERT_STATEMENT, tb));
+key = MetadataUtils.getKey(t);
+value = mapper.writeValueAsString(t);
+
+statement.setString(1, key);
+Clob clob = connection.createClob();
+clob.setString(1, value);
+statement.setClob(2, clob);
+
+connection.setAutoCommit(false);
+savepoint = connection.setSavepoint("insertEntity");
+int status = statement.executeUpdate();
+LOG.info("update {} entities", status);
+connection.commit();
+} catch (SQLException e) {
+//e.printStackTrace();
+if(e.getMessage().toLowerCase().contains("duplicate")){
+try {
+

[4/6] incubator-eagle git commit: Rebase code base

2016-07-06 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/72a1501c/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/FloatSerializer.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/FloatSerializer.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/FloatSerializer.java
index 18089a9..e6b510a 100644
--- 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/FloatSerializer.java
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/FloatSerializer.java
@@ -1,11 +1,11 @@
 package org.apache.eagle.alert.engine.serialization.impl;
 
-import org.apache.eagle.alert.engine.serialization.Serializer;
-
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.eagle.alert.engine.serialization.Serializer;
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/72a1501c/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/IntegerSerializer.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/IntegerSerializer.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/IntegerSerializer.java
index d2473a9..f784456 100644
--- 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/IntegerSerializer.java
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/IntegerSerializer.java
@@ -1,11 +1,11 @@
 package org.apache.eagle.alert.engine.serialization.impl;
 
-import org.apache.eagle.alert.engine.serialization.Serializer;
-
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.eagle.alert.engine.serialization.Serializer;
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/72a1501c/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/JavaObjectSerializer.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/JavaObjectSerializer.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/JavaObjectSerializer.java
index 76d2294..39baf2b 100644
--- 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/JavaObjectSerializer.java
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/JavaObjectSerializer.java
@@ -16,14 +16,14 @@
  */
 package org.apache.eagle.alert.engine.serialization.impl;
 
-import org.apache.commons.lang3.SerializationUtils;
-import org.apache.eagle.alert.engine.serialization.Serializer;
-
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.Serializable;
 
+import org.apache.commons.lang3.SerializationUtils;
+import org.apache.eagle.alert.engine.serialization.Serializer;
+
 public class JavaObjectSerializer implements Serializer {
 @Override
 public void serialize(Object value, DataOutput dataOutput) throws 
IOException {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/72a1501c/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/LongSerializer.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/LongSerializer.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/LongSerializer.java
index 8d85c76..116b275 100644
--- 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/LongSerializer.java
+++ 

incubator-eagle git commit: [EAGLE-329] Dependency incompatibility bug among jersey, asm and extcos under Java 8

2016-06-07 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/develop 985080112 -> 9d16f213c


[EAGLE-329] Dependency incompatibility bug among jersey, asm and extcos under 
Java 8

https://issues.apache.org/jira/browse/EAGLE-329

Author: Hao Chen <h...@apache.org>

Closes #226 from haoch/EAGLE-329.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/9d16f213
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/9d16f213
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/9d16f213

Branch: refs/heads/develop
Commit: 9d16f213c991a816b4cf89732a51243b871b0c5a
Parents: 9850801
Author: Hao Chen <h...@apache.org>
Authored: Tue Jun 7 14:09:49 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Tue Jun 7 14:09:49 2016 +0800

--
 .github/PULL_REQUEST_TEMPLATE.md|  23 +-
 .../metadata/resource/MetadataResource.java | 225 ---
 .../metadata/resource/MetadataResource.java |   2 +-
 .../eagle-alert-parent/eagle-alert/pom.xml  | 101 +
 .../eagle-query/eagle-entity-base/pom.xml   |  10 +
 .../entity/repo/EntityRepositoryScanner.java|   4 +-
 eagle-security/eagle-metric-collection/pom.xml  |   3 +-
 eagle-webservice/pom.xml|  67 +-
 pom.xml |  31 ++-
 9 files changed, 132 insertions(+), 334 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9d16f213/.github/PULL_REQUEST_TEMPLATE.md
--
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index b17f620..c205680 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,8 +1,27 @@
+
+
 Be sure to do all of the following to help us incorporate your contribution
 quickly and easily:
 
  - [ ] Make sure the PR title is formatted like:
-   `[BEAM-] Description of pull request`
+   `[EAGLE-] Description of pull request`
  - [ ] Make sure tests pass via `mvn clean verify`. (Even better, enable
Travis-CI on your fork and ensure the whole test matrix passes).
  - [ ] Replace `` in the title with the actual Jira issue
@@ -10,4 +29,4 @@ quickly and easily:
  - [ ] If this contribution is large, please file an Apache
[Individual Contributor License 
Agreement](https://www.apache.org/licenses/icla.txt).
 

+---
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9d16f213/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/alert/metadata/resource/MetadataResource.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/alert/metadata/resource/MetadataResource.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/alert/metadata/resource/MetadataResource.java
deleted file mode 100644
index 94ec767..000
--- 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/alert/metadata/resource/MetadataResource.java
+++ /dev/null
@@ -1,225 +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 javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-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.

incubator-eagle git commit: [EAGLE-219] front end documentation

2016-06-02 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/master df576452f -> 982a6b743


[EAGLE-219] front end documentation

Author: jiljiang <jilji...@ebay.com>

Closes #171 from zombieJ/doc.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/982a6b74
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/982a6b74
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/982a6b74

Branch: refs/heads/master
Commit: 982a6b7430d349199091add264c9bef1bdc8ae35
Parents: df57645
Author: jiljiang <jilji...@ebay.com>
Authored: Thu Jun 2 18:45:52 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Thu Jun 2 18:45:52 2016 +0800

--
 .../development/eagle_frontend_development.md   | 103 +++
 1 file changed, 103 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/982a6b74/eagle-docs/development/eagle_frontend_development.md
--
diff --git a/eagle-docs/development/eagle_frontend_development.md 
b/eagle-docs/development/eagle_frontend_development.md
new file mode 100644
index 000..883e7c3
--- /dev/null
+++ b/eagle-docs/development/eagle_frontend_development.md
@@ -0,0 +1,103 @@
+
+
+Eagle Frontend Development Guide
+-
+Eagle provide easy way for customize UI development.
+If you want to build customize page, you can follow [Customize 
Pages](#customize-pages)
+
+### Frontend Design
+Eagle frontend (using [AngularJS](https://angularjs.org/)) provide multi site 
support. Each site can use several applications which is composed of features.
+
+ Feature
+Feature is basic UI element. It provide the pages and interactive logic but 
have no state by itself.
+When frontend call the feature page, feature can get current `site`, 
`application` and also about the configuration from them.
+With the configuration to process the logic. Current Eagle pages (excluded 
`configuration` and `login` page), all are built on features.
+
+Feature should not share any code between each others. If you need code 
sharing, put them into one feature.
+
+ Application
+Application is logic component which is composed of features. It provide the 
configuration for feature usage.
+Application can be share between sites.
+For example `hiveQueryLog`, `hdfsAuditLog` and `hbaseSecurityLog` are the 
default applications provided by Eagle.
+
+Application has the additional attribute called `groupName`.
+You can group the same duty application into one group and Eagle frontend will 
help to maintain them in navigation.
+
+ Site
+Site can include multi applications.
+Each application provide special configuration content so that you can defined 
the application logic which will read by feature.
+
+### Customize Pages
+Customize pages is all included in 
`eagle-webservice/src/main/webapp/app/public/feature` folder.
+You can see the original pages provided by Eagle frontend are also designed as 
`feature`.
+After maven building, all the features will compress in the tar file.
+But you can also just copy feature into 
`lib/tomcat/webapps/eagle-service/ui/feature/` and restart tomcat. It will also 
works.
+
+ Build a Customize Feature Page
+After reading follow steps, we recommend you can view the features already in 
Eagle.
+Which can help your understanding more fast.
+
+# Step 1
+Create a folder under `eagle-webservice/src/main/webapp/app/public/feature`. 
create follow files in it:
+* controller.js
+* page (folder)
+
+# Step 2
+In `controller.js` code the feature entry function.
+``` javascript
+(function() {
+'use strict';
+
+var featureControllers = angular.module("featureControllers");
+var feature = featureControllers.register("yourFeatureName");
+});
+```
+`featureControllers` provide the `register` function to register the feature 
in frontend.
+When call the `feature`, Eagle will transform the request to the feature.
+
+# Step 3
+Same as native angularJS, using `controller` to create a page controller.
+``` javascript
+feature.controller('yourCustomizePageName', function($scope, PageConfig, Site, 
Application, ...) {
+// do something
+});
+```
+
+After register the `controller`, Eagle will auto create the route mapping for 
the page. Like `#/yourFeatureName/yourCustomizePageName`.
+Now create the `yourCustomizePageName.html` in `page` folder and Eagle will 
automatic link the controller with it.
+
+This document do not provide the angularJS guide.
+If you are not familiar with angularJS, please click 
[HERE](https://angularjs.org/) for study.
+
+# Step 4
+After build pages, register them in navigation sidebar:
+``` javascript
+feature.navItem("

incubator-eagle git commit: [EAGLE-324] Add MetadataResource and exclude *.out in rat checking

2016-06-02 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/develop 8dc70df42 -> 1d51f826c


[EAGLE-324] Add MetadataResource and exclude *.out in rat checking


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/1d51f826
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/1d51f826
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/1d51f826

Branch: refs/heads/develop
Commit: 1d51f826c735096aa3c4cc1eb16362359c1d3b29
Parents: 8dc70df
Author: Hao Chen <h...@apache.org>
Authored: Thu Jun 2 18:23:12 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Thu Jun 2 18:23:12 2016 +0800

--
 .../src/assembly/alert-assembly.xml |  27 +--
 .../eagle/alert/config/ConfigBusBase.java   |  26 ++-
 .../eagle/alert/config/ConfigBusConsumer.java   |   9 +-
 .../eagle/alert/config/ConfigBusProducer.java   |   9 +-
 .../alert/config/ConfigChangeCallback.java  |  32 +--
 .../apache/eagle/alert/config/ConfigValue.java  |  33 +--
 .../org/apache/eagle/alert/config/ZKConfig.java |  33 +--
 .../eagle/alert/config/ZKConfigBuilder.java |  33 +--
 .../eagle/alert/utils/AlertConstants.java   |  12 +-
 .../apache/eagle/alert/utils/ConfigUtils.java   |  16 --
 .../eagle/alert/utils/StreamIdConversion.java   |  16 --
 .../trigger/PolicyChangeListener.java   |   2 +-
 .../src/main/resources/application.conf |   1 +
 .../alert-devtools/bin/start-integration1.sh|   2 +-
 .../alert-devtools/bin/start-integration2.sh|   3 +-
 .../alert-devtools/bin/start-sampleclient2.sh   |   1 +
 .../alert/tools/KafkaLatestOffsetFetcher.java   |   4 +-
 .../kafka-offset-test.application.conf  |   1 -
 .../apache/eagle/alert/engine/Collector.java|  12 +-
 .../eagle/alert/engine/StreamContextImpl.java   |   2 -
 .../impl/StreamEventSerializer.java |   1 -
 .../impl/StreamPartitionDigestSerializer.java   |   1 -
 .../impl/StreamPartitionSerializer.java |   1 -
 .../metadata/resource/MetadataResource.java | 228 +++
 .../src/main/resources/application.conf |   2 +-
 .../metadata/impl/InMemMetadataDaoImpl.java |   3 +-
 .../metadata/impl/MongoMetadataDaoImpl.java |   2 +
 .../src/main/resources/application.conf |   5 +-
 .../alert/resource/impl/MongoImplTest.java  |   2 +-
 .../src/test/resources/application-mongo.conf   |   4 +-
 30 files changed, 361 insertions(+), 162 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d51f826/eagle-core/eagle-alert-parent/eagle-alert/alert-assembly/src/assembly/alert-assembly.xml
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-assembly/src/assembly/alert-assembly.xml
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-assembly/src/assembly/alert-assembly.xml
index b61e6b2..9f25ec0 100644
--- 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-assembly/src/assembly/alert-assembly.xml
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-assembly/src/assembly/alert-assembly.xml
@@ -1,20 +1,15 @@
 
-
+
 http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
   
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
 http://maven.apache.org/xsd/assembly-1.1.0.xsd;>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d51f826/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/config/ConfigBusBase.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/config/ConfigBusBase.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/config/ConfigBusBase.java
index e9c4a7c..5cedba6 100644
--- 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/config/ConfigBusBase.java
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/config/ConfigBusBase.java
@@ -1,18 +1,20 @@
 /*
- * 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
+ *  * Licensed to the Apache Softw

[1/2] incubator-eagle git commit: [EAGLE-324][maven-release-plugin] Initialize v0.5.0-incubating-SNAPSHOT

2016-06-02 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/develop [created] 8dc70df42


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8dc70df4/eagle-webservice/pom.xml
--
diff --git a/eagle-webservice/pom.xml b/eagle-webservice/pom.xml
index 9d379e7..80c42bc 100644
--- a/eagle-webservice/pom.xml
+++ b/eagle-webservice/pom.xml
@@ -11,13 +11,12 @@
License for the specific language governing permissions and ~ 
limitations 
under the License. -->
 
-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/maven-v4_0_0.xsd;>
+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/maven-v4_0_0.xsd;>
4.0.0

org.apache.eagle
eagle-parent
-   0.4.0-incubating-SNAPSHOT
+   0.5.0-incubating-SNAPSHOT
../pom.xml

eagle-webservice

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8dc70df4/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 977a3ee..1660e56 100755
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
 org.apache.eagle
 eagle-parent
-0.4.0-incubating-SNAPSHOT
+0.5.0-incubating-SNAPSHOT
 pom
 Apache Eagle Parent
 https://eagle.incubator.apache.org



[2/2] incubator-eagle git commit: [EAGLE-324][maven-release-plugin] Initialize v0.5.0-incubating-SNAPSHOT

2016-06-02 Thread hao
[EAGLE-324][maven-release-plugin] Initialize v0.5.0-incubating-SNAPSHOT


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/8dc70df4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/8dc70df4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/8dc70df4

Branch: refs/heads/develop
Commit: 8dc70df42f917c58f2fca131ec45c418be68c055
Parents: 737e5a2
Author: Hao Chen <h...@apache.org>
Authored: Thu Jun 2 15:34:00 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Thu Jun 2 15:34:00 2016 +0800

--
 eagle-assembly/pom.xml  |  6 ++---
 .../eagle-alert-parent/eagle-alert-base/pom.xml |  5 ++--
 .../eagle-alert-notification-plugin/pom.xml |  2 +-
 .../eagle-alert-process/pom.xml |  6 ++---
 .../eagle-alert-service/pom.xml |  5 ++--
 .../eagle-alert/alert-assembly/pom.xml  |  6 ++---
 .../eagle-alert/alert-common/pom.xml|  2 +-
 .../eagle-alert/alert-coordinator/pom.xml   |  2 +-
 .../eagle-alert/alert-devtools/pom.xml  |  2 +-
 .../eagle-alert/alert-engine/pom.xml|  2 +-
 .../alert-metadata-service/pom.xml  | 24 ++--
 .../alert-metadata/pom.xml  |  5 ++--
 .../eagle-alert/alert-metadata-parent/pom.xml   |  5 ++--
 .../eagle-alert-parent/eagle-alert/pom.xml  |  2 +-
 eagle-core/eagle-alert-parent/pom.xml   |  2 +-
 .../eagle-application-service/pom.xml   |  6 ++---
 .../eagle-stream-application-manager/pom.xml|  6 ++---
 eagle-core/eagle-application-management/pom.xml |  6 ++---
 .../eagle-data-process/eagle-job-common/pom.xml |  5 ++--
 .../eagle-storm-jobrunning-spout/pom.xml|  5 ++--
 .../eagle-stream-pipeline/pom.xml   |  6 ++---
 .../eagle-stream-process-api/pom.xml|  5 ++--
 .../eagle-stream-process-base/pom.xml   |  6 ++---
 eagle-core/eagle-data-process/pom.xml   |  2 +-
 .../eagle-embed/eagle-embed-hbase/pom.xml   |  6 ++---
 .../eagle-embed/eagle-embed-server/pom.xml  |  5 ++--
 eagle-core/eagle-embed/pom.xml  |  6 ++---
 .../eagle-machinelearning-base/pom.xml  |  5 ++--
 eagle-core/eagle-machinelearning/pom.xml|  6 ++---
 eagle-core/eagle-metric/pom.xml |  5 ++--
 .../eagle-policy/eagle-policy-base/pom.xml  |  5 ++--
 eagle-core/eagle-policy/pom.xml |  6 ++---
 eagle-core/eagle-query/eagle-antlr/pom.xml  |  2 +-
 eagle-core/eagle-query/eagle-audit-base/pom.xml |  5 ++--
 .../eagle-query/eagle-client-base/pom.xml   |  5 ++--
 eagle-core/eagle-query/eagle-common/pom.xml |  5 ++--
 .../eagle-query/eagle-entity-base/pom.xml   |  5 ++--
 eagle-core/eagle-query/eagle-query-base/pom.xml |  6 ++---
 .../eagle-query/eagle-service-base/pom.xml  |  5 ++--
 .../eagle-query/eagle-storage-base/pom.xml  |  6 ++---
 .../eagle-query/eagle-storage-hbase/pom.xml |  6 ++---
 .../eagle-query/eagle-storage-jdbc/pom.xml  |  6 ++---
 eagle-core/eagle-query/pom.xml  |  2 +-
 eagle-core/pom.xml  |  2 +-
 eagle-examples/eagle-topology-example/pom.xml   |  6 ++---
 eagle-examples/pom.xml  |  6 ++---
 eagle-external/eagle-kafka/pom.xml  |  6 ++---
 eagle-external/eagle-log4jkafka/pom.xml |  6 ++---
 eagle-external/pom.xml  |  6 ++---
 eagle-gc/pom.xml|  2 +-
 eagle-hadoop-metric/pom.xml |  6 ++---
 eagle-security/eagle-metric-collection/pom.xml  |  5 ++--
 eagle-security/eagle-security-common/pom.xml|  5 ++--
 .../eagle-security-hbase-securitylog/pom.xml|  6 ++---
 eagle-security/eagle-security-hbase-web/pom.xml |  6 ++---
 .../eagle-security-hdfs-auditlog/pom.xml|  5 ++--
 .../eagle-security-hdfs-securitylog/pom.xml |  6 ++---
 eagle-security/eagle-security-hdfs-web/pom.xml  |  5 ++--
 eagle-security/eagle-security-hive-web/pom.xml  |  5 ++--
 eagle-security/eagle-security-hive/pom.xml  |  5 ++--
 .../eagle-security-maprfs-auditlog/pom.xml  |  5 ++--
 .../eagle-security-maprfs-web/pom.xml   |  5 ++--
 .../eagle-security-oozie-auditlog/pom.xml   |  6 ++---
 eagle-security/eagle-security-oozie-web/pom.xml |  6 ++---
 .../eagle-security-userprofile/common/pom.xml   |  5 ++--
 .../detection/pom.xml   |  5 ++--
 .../eagle-security-userprofile/pom.xml  |  6 ++---
 .../eagle-security-userprofile/training/pom.xml |  6 ++---
 eagle-security/pom.xml  |  5 ++--
 eagle-topology-assembly/pom.xml |  6 ++---
 eagle-webservice/pom.xml|  5 ++--
 pom.xml |  2 +-
 72 files changed, 14

[01/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/branch-0.5 656dd2305 -> 737e5a2d5


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/eagle-alert-service/src/main/java/org/apache/eagle/service/alert/resolver/impl/EntityAttributeResolver.java
--
diff --git 
a/eagle-core/eagle-alert/eagle-alert-service/src/main/java/org/apache/eagle/service/alert/resolver/impl/EntityAttributeResolver.java
 
b/eagle-core/eagle-alert/eagle-alert-service/src/main/java/org/apache/eagle/service/alert/resolver/impl/EntityAttributeResolver.java
deleted file mode 100644
index 9758863..000
--- 
a/eagle-core/eagle-alert/eagle-alert-service/src/main/java/org/apache/eagle/service/alert/resolver/impl/EntityAttributeResolver.java
+++ /dev/null
@@ -1,142 +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.resolver.impl;
-
-import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.meta.EntityDefinition;
-import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
-import org.apache.eagle.service.alert.resolver.AttributeResolvable;
-import org.apache.eagle.service.alert.resolver.AttributeResolveException;
-import 
org.apache.eagle.service.alert.resolver.BadAttributeResolveRequestException;
-import org.apache.eagle.service.alert.resolver.GenericAttributeResolveRequest;
-import org.apache.eagle.service.generic.GenericEntityServiceResource;
-import org.apache.eagle.common.DateTimeUtil;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @since 6/16/15
- */
-public class EntityAttributeResolver implements 
AttributeResolvable
 {
-
-private final static GenericEntityServiceResource entityServiceResource = 
new GenericEntityServiceResource();
-
-@Override
-public List resolve(EntityAttributeResolveRequest request) throws 
AttributeResolveException {
-if(request.getFieldName()==null){
-throw new AttributeResolveException("fieldName is required");
-}
-String attributeName = request.getFieldName();
-EntityDefinition entityDefinition;
-try {
-if(request.getServiceName()!=null){
-entityDefinition = 
EntityDefinitionManager.getEntityByServiceName(request.getServiceName());
-}else if (request.getEntityClassName()!=null){
-Class entityClass = (Class) Class.forName(request.getEntityClassName());
-entityDefinition = 
EntityDefinitionManager.getEntityDefinitionByEntityClass(entityClass);
-}else {
-throw new AttributeResolveException("At least serviceName or 
entityClassName is required, but neither found");
-}
-} catch (InstantiationException | IllegalAccessException | 
ClassNotFoundException e) {
-throw new AttributeResolveException(e);
-}
-List filterCondition = new ArrayList<>();
-if(request.getTags()!=null){
-for(Map.Entry tag:request.getTags().entrySet()) {
-filterCondition.add("@" + tag.getKey() + " = \"" + 
tag.getValue() + "\"");
-}
-}
-if(request.getQuery() != null) {
-filterCondition.add("@" + attributeName + "~= \".*" + 
request.getQuery()+".*\"");
-}
-String query = entityDefinition.getService() + "[" + 
StringUtils.join(filterCondition, " AND ") + "]<@" + attributeName + ">{count}";
-return aggregateQuery(query, 
DateTimeUtil.millisecondsToHumanDateWithSeconds(0), 
DateTimeUtil.millisecondsToHumanDateWithSeconds(System.currentTimeMillis()),request.getMetricName());
-}
-
-@Override
-public Class getRequestClass() {
-return EntityAttributeResolveRequest.class;
-}
-
-@Override
-public void 

[11/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/storm/kafka/KafkaSpoutMetric.java
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/storm/kafka/KafkaSpoutMetric.java
 
b/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/storm/kafka/KafkaSpoutMetric.java
deleted file mode 100644
index dd58172..000
--- 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/storm/kafka/KafkaSpoutMetric.java
+++ /dev/null
@@ -1,94 +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 storm.kafka;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import backtype.storm.metric.api.IMetric;
-
-/**
- * Since 5/18/16.
- * The original storm.kafka.KafkaSpout has some issues like the following
- * 1) can only support one single topic
- * 2) can only be initialized at open(), can't dynamically support another 
topic
- */
-public class KafkaSpoutMetric implements IMetric {
-@SuppressWarnings("unused")
-private final static Logger LOG = 
LoggerFactory.getLogger(KafkaSpoutMetric.class);
-private Map metricContextMap = new 
ConcurrentHashMap<>();
-private Map offsetMetricMap = new 
ConcurrentHashMap<>();
-
-public static class KafkaSpoutMetricContext {
-SpoutConfig _spoutConfig;
-DynamicPartitionConnections _connections;
-PartitionCoordinator _coordinator;
-}
-
-public void addTopic(String topic, KafkaSpoutMetricContext context) {
-// construct KafkaOffsetMetric
-KafkaUtils.KafkaOffsetMetric kafkaOffsetMetric = new 
KafkaUtils.KafkaOffsetMetric(context._spoutConfig.topic, context._connections);
-metricContextMap.put(topic, context);
-offsetMetricMap.put(topic, kafkaOffsetMetric);
-}
-
-public void removeTopic(String topic) {
-metricContextMap.remove(topic);
-offsetMetricMap.remove(topic);
-}
-
-@SuppressWarnings({ "unchecked", "rawtypes" })
-@Override
-public Object getValueAndReset() {
-HashMap spoutMetric = new HashMap();
-for (Map.Entry entry : 
metricContextMap.entrySet()) {
-// construct offset metric
-List pms = 
entry.getValue()._coordinator.getMyManagedPartitions();
-Set latestPartitions = new HashSet();
-for (PartitionManager pm : pms) {
-latestPartitions.add(pm.getPartition());
-}
-
-KafkaUtils.KafkaOffsetMetric offsetMetric = 
offsetMetricMap.get(entry.getKey());
-offsetMetric.refreshPartitions(latestPartitions);
-for (PartitionManager pm : pms) {
-offsetMetric.setLatestEmittedOffset(pm.getPartition(), 
pm.lastCompletedOffset());
-}
-Object o = offsetMetric.getValueAndReset();
-if(o != null) {
-((HashMap) o).forEach(
-(k, v) -> spoutMetric.put(k + "_" + entry.getKey(), v)
-);
-}
-
-// construct partition metric
-for (PartitionManager pm : pms) {
-pm.getMetricsDataMap().forEach(
-(k, v) -> spoutMetric.put(k + "_" + entry.getKey(), v)
-);
-}
-}
-return spoutMetric;
-}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/storm/kafka/KafkaSpoutWrapper.java
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/storm/kafka/KafkaSpoutWrapper.java
 
b/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/storm/kafka/KafkaSpoutWrapper.java
deleted 

[13/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/serialization/Serializers.java
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/serialization/Serializers.java
 
b/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/serialization/Serializers.java
deleted file mode 100644
index a94604c..000
--- 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/serialization/Serializers.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.alert.engine.serialization;
-
-import org.apache.eagle.alert.engine.coordinator.StreamColumn;
-import org.apache.eagle.alert.engine.serialization.impl.*;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class Serializers {
-private final static Map 
COLUMN_TYPE_SER_MAPPING = new HashMap<>();
-
-public static  void register(StreamColumn.Type type,Serializer 
serializer){
-if(COLUMN_TYPE_SER_MAPPING.containsKey(type)){
-throw new IllegalArgumentException("Duplicated column type: 
"+type);
-}
-COLUMN_TYPE_SER_MAPPING.put(type,serializer);
-}
-
-public static  Serializer getColumnSerializer(StreamColumn.Type 
type){
-if(COLUMN_TYPE_SER_MAPPING.containsKey(type)){
-return (Serializer) COLUMN_TYPE_SER_MAPPING.get(type);
-}else{
-throw new IllegalArgumentException("Serializer of type: "+type+" 
not found");
-}
-}
-
-public static PartitionedEventSerializer 
newPartitionedEventSerializer(SerializationMetadataProvider metadataProvider){
-return new PartitionedEventSerializerImpl(metadataProvider);
-}
-
-static {
-register(StreamColumn.Type.STRING,new StringSerializer());
-register(StreamColumn.Type.INT,new IntegerSerializer());
-register(StreamColumn.Type.LONG,new LongSerializer());
-register(StreamColumn.Type.FLOAT,new FloatSerializer());
-register(StreamColumn.Type.DOUBLE,new DoubleSerializer());
-register(StreamColumn.Type.BOOL,new BooleanSerializer());
-register(StreamColumn.Type.OBJECT,new JavaObjectSerializer());
-}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/serialization/impl/BooleanSerializer.java
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/serialization/impl/BooleanSerializer.java
 
b/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/serialization/impl/BooleanSerializer.java
deleted file mode 100644
index 1e90569..000
--- 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/serialization/impl/BooleanSerializer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.apache.eagle.alert.engine.serialization.impl;
-
-import org.apache.eagle.alert.engine.serialization.Serializer;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-/**
- * 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,
- * 

[05/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
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/AlertEmailGeneratorBuilder.java
--
diff --git 
a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailGeneratorBuilder.java
 
b/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailGeneratorBuilder.java
deleted file mode 100644
index 2e63dab..000
--- 
a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailGeneratorBuilder.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.notification.email;
-
-import java.util.concurrent.ThreadPoolExecutor;
-
-import com.typesafe.config.ConfigObject;
-
-public class AlertEmailGeneratorBuilder {
-private AlertEmailGenerator generator;
-private AlertEmailGeneratorBuilder(){
-generator = new AlertEmailGenerator();
-}
-public static AlertEmailGeneratorBuilder newBuilder(){
-return new AlertEmailGeneratorBuilder();
-}
-public AlertEmailGeneratorBuilder withSubject(String subject){
-generator.setSubject(subject);
-return this;
-}
-public AlertEmailGeneratorBuilder withSender(String sender){
-generator.setSender(sender);
-return this;
-}
-public AlertEmailGeneratorBuilder withRecipients(String recipients){
-generator.setRecipients(recipients);
-return this;
-}
-public AlertEmailGeneratorBuilder withTplFile(String tplFile){
-generator.setTplFile(tplFile);
-return this;
-}
-public AlertEmailGeneratorBuilder withEagleProps(ConfigObject eagleProps) {
-generator.setEagleProps(eagleProps);
-return this;
-}
-public AlertEmailGeneratorBuilder withExecutorPool(ThreadPoolExecutor 
threadPoolExecutor) {
-generator.setExecutorPool(threadPoolExecutor);
-return this;
-}
-
-public AlertEmailGenerator build(){
-return this.generator;
-}
-}
\ 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/AlertEmailSender.java
--
diff --git 
a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailSender.java
 
b/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailSender.java
deleted file mode 100644
index c2c4949..000
--- 
a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailSender.java
+++ /dev/null
@@ -1,191 +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.lang.management.ManagementFactory;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.eagle.policy.common.Constants;
-import org.apache.velocity.VelocityContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import 

[12/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/sorter/impl/PartitionedEventTimeOrderingComparator.java
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/sorter/impl/PartitionedEventTimeOrderingComparator.java
 
b/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/sorter/impl/PartitionedEventTimeOrderingComparator.java
deleted file mode 100644
index a9f9f39..000
--- 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/sorter/impl/PartitionedEventTimeOrderingComparator.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.alert.engine.sorter.impl;
-
-import java.util.Comparator;
-import java.util.Objects;
-
-import org.apache.eagle.alert.engine.model.PartitionedEvent;
-
-/**
- * TODO: Stable sorting algorithm for better performance to avoid event 
resorting with same timestamp?
- */
-public class PartitionedEventTimeOrderingComparator implements 
Comparator {
-public static final PartitionedEventTimeOrderingComparator INSTANCE = new 
PartitionedEventTimeOrderingComparator();
-
-@Override
-public int compare(PartitionedEvent o1, PartitionedEvent o2) {
-if(Objects.equals(o1,o2)){
-return 0;
-}else {
-if(o1 == null && o2 == null){
-return 0;
-}else if(o1 != null && o2 == null){
-return 1;
-}else if(o1 == null){
-return -1;
-}
-// Unstable Sorting Algorithm
-if(o1.getTimestamp() <= o2.getTimestamp()){
-return -1;
-} else {
-return 1;
-}
-}
-}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/sorter/impl/StreamSortWindowHandlerImpl.java
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/sorter/impl/StreamSortWindowHandlerImpl.java
 
b/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/sorter/impl/StreamSortWindowHandlerImpl.java
deleted file mode 100644
index 7be69e1..000
--- 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/main/java/org/apache/eagle/alert/engine/sorter/impl/StreamSortWindowHandlerImpl.java
+++ /dev/null
@@ -1,113 +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.engine.sorter.impl;
-
-import java.io.IOException;
-
-import org.apache.eagle.alert.engine.PartitionedEventCollector;
-import org.apache.eagle.alert.engine.coordinator.StreamSortSpec;
-import org.apache.eagle.alert.engine.model.PartitionedEvent;
-import org.apache.eagle.alert.engine.router.StreamSortHandler;
-import org.apache.eagle.alert.engine.sorter.StreamTimeClock;
-import org.apache.eagle.alert.engine.sorter.StreamWindow;
-import 

[17/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-devtools/conf/zookeeper-server.properties
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-devtools/conf/zookeeper-server.properties 
b/eagle-core/eagle-alert/alert/alert-devtools/conf/zookeeper-server.properties
deleted file mode 100644
index dd71ffc..000
--- 
a/eagle-core/eagle-alert/alert/alert-devtools/conf/zookeeper-server.properties
+++ /dev/null
@@ -1,20 +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.
-# the directory where the snapshot is stored.
-dataDir=/tmp/dev-zookeeper-data
-# the port at which the clients will connect
-clientPort=2181
-# disable the per-ip limit on the number of connections since this is a 
non-production config
-maxClientCnxns=0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-devtools/pom.xml
--
diff --git a/eagle-core/eagle-alert/alert/alert-devtools/pom.xml 
b/eagle-core/eagle-alert/alert/alert-devtools/pom.xml
deleted file mode 100644
index f6f1f2b..000
--- a/eagle-core/eagle-alert/alert/alert-devtools/pom.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-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;>
-4.0.0
-
-
-org.apache.eagle
-alert-parent
-0.0.1-SNAPSHOT
-
-
-alert-devtools
-
-
-2.15.0
-
-
-
-
-org.apache.eagle
-alert-common
-${project.version}
-
-
-org.apache.storm
-storm-kafka
-
-
-org.apache.storm
-storm-core
-
-
-org.apache.kafka
-${kafka.artifact.id}
-
-
-com.fasterxml.jackson.core
-jackson-core
-
-
-com.fasterxml.jackson.core
-jackson-databind
-
-
-junit
-junit
-test
-
-
-
-
-src/main/java
-
-
-
-maven-compiler-plugin
-${maven-compiler.version}
-
-
-
-
-maven-dependency-plugin
-
-
-install
-
-copy-dependencies
-
-
-
${project.build.directory}/lib
-
-
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-devtools/src/main/java/org/apache/eagle/alert/tools/KafkaConsumerOffset.java
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-devtools/src/main/java/org/apache/eagle/alert/tools/KafkaConsumerOffset.java
 
b/eagle-core/eagle-alert/alert/alert-devtools/src/main/java/org/apache/eagle/alert/tools/KafkaConsumerOffset.java
deleted file mode 100644
index 8f98d71..000
--- 
a/eagle-core/eagle-alert/alert/alert-devtools/src/main/java/org/apache/eagle/alert/tools/KafkaConsumerOffset.java
+++ /dev/null
@@ -1,27 +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 

[23/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/config/ConfigBusBase.java
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/config/ConfigBusBase.java
 
b/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/config/ConfigBusBase.java
deleted file mode 100644
index e9c4a7c..000
--- 
a/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/config/ConfigBusBase.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.alert.config;
-
-import java.io.Closeable;
-
-import org.apache.curator.framework.CuratorFramework;
-import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.retry.RetryNTimes;
-
-
-/**
- * Abstraction of asynchronized configuration management
- * This is used for config change notification between processes, without this 
one process has to pull changes triggered by another process
- *
- * Config bus is similar to message bus, config change producer can publish 
config change(message) to config bus,
- *  while config change consumer can subscribe config change and do business 
logic in callback
- * 1. use zookeeper as media to notify config consumer of config changes
- * 2. each type of config is represented by topic
- * 3. each config change can contain actual value or contain reference Id 
which consumer uses to retrieve actual value. This mechanism will reduce 
zookeeper overhed
- *
- */
-public class ConfigBusBase implements Closeable{
-protected String zkRoot;
-protected CuratorFramework curator;
-
-public ConfigBusBase(ZKConfig config) {
-this.zkRoot = config.zkRoot;
-curator = CuratorFrameworkFactory.newClient(
-config.zkQuorum,
-config.zkSessionTimeoutMs,
-config.connectionTimeoutMs,
-new RetryNTimes(config.zkRetryTimes, config.zkRetryInterval)
-);
-curator.start();
-}
-
-@Override
-public void close(){
-curator.close();
-}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/config/ConfigBusConsumer.java
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/config/ConfigBusConsumer.java
 
b/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/config/ConfigBusConsumer.java
deleted file mode 100644
index 9abfff5..000
--- 
a/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/config/ConfigBusConsumer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.alert.config;
-
-import org.apache.curator.framework.recipes.cache.NodeCache;
-import org.slf4j.Logger;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * 1. When consumer is started, it always get notified of config
- * 2. When config is changed, consumer always get notified of config change
- *
- * Reliability issue:
- * TODO How to ensure config change message is always delivered to consumer
- */
-public class 

[19/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/provider/InMemScheduleConext.java
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/provider/InMemScheduleConext.java
 
b/eagle-core/eagle-alert/alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/provider/InMemScheduleConext.java
deleted file mode 100644
index 84a4061..000
--- 
a/eagle-core/eagle-alert/alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/provider/InMemScheduleConext.java
+++ /dev/null
@@ -1,148 +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.coordinator.provider;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.eagle.alert.coordination.model.Kafka2TupleMetadata;
-import org.apache.eagle.alert.coordination.model.internal.MonitoredStream;
-import org.apache.eagle.alert.coordination.model.internal.PolicyAssignment;
-import org.apache.eagle.alert.coordination.model.internal.StreamGroup;
-import org.apache.eagle.alert.coordination.model.internal.Topology;
-import org.apache.eagle.alert.coordinator.IScheduleContext;
-import org.apache.eagle.alert.coordinator.model.TopologyUsage;
-import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
-import org.apache.eagle.alert.engine.coordinator.Publishment;
-import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-
-/**
- * @since Mar 28, 2016
- *
- */
-public class InMemScheduleConext implements IScheduleContext {
-
-private Map topologies = new HashMap();
-private Map usages = new HashMap();
-private Map policies = new HashMap();
-private Map datasources = new HashMap();
-private Map policyAssignments = new 
HashMap();
-private Map schemas = new HashMap();
-private Map monitoredStreams = new 
HashMap();
-private Map publishments = new HashMap();
-
-public InMemScheduleConext() {
-}
-
-public InMemScheduleConext(IScheduleContext context) {
-this.topologies = new HashMap(context.getTopologies());
-this.usages = new HashMap(context.getTopologyUsages());
-this.policies = new HashMap(context.getPolicies());
-this.datasources = new HashMap(context.getDataSourceMetadata());
-this.policyAssignments = new HashMap(context.getPolicyAssignments());
-this.schemas = new HashMap(context.getStreamSchemas());
-this.monitoredStreams = new HashMap(context.getMonitoredStreams());
-this.publishments = new HashMap(context.getPublishments());
-}
-
-public InMemScheduleConext(Map topologies2, Map assignments,
-Map kafkaSources, Map policies2,
-Map publishments2, Map streamDefinitions,
-Map monitoredStreamMap, Map usages2) {
-this.topologies = topologies2;
-this.policyAssignments = assignments;
-this.datasources = kafkaSources;
-this.policies = policies2;
-this.publishments = publishments2;
-this.schemas = streamDefinitions;
-this.monitoredStreams = monitoredStreamMap;
-this.usages = usages2;
-}
-
-public Map getTopologies() {
-return topologies;
-}
-
-

[42/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert-process/src/test/java/org/apache/eagle/alert/state/TestAggregation.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert-process/src/test/java/org/apache/eagle/alert/state/TestAggregation.java
 
b/eagle-core/eagle-alert-parent/eagle-alert-process/src/test/java/org/apache/eagle/alert/state/TestAggregation.java
new file mode 100644
index 000..adcd728
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert-process/src/test/java/org/apache/eagle/alert/state/TestAggregation.java
@@ -0,0 +1,98 @@
+/*
+ *
+ *  * 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.state;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.junit.Test;
+import org.wso2.siddhi.core.ExecutionPlanRuntime;
+import org.wso2.siddhi.core.SiddhiManager;
+import org.wso2.siddhi.core.event.Event;
+import org.wso2.siddhi.core.query.output.callback.QueryCallback;
+import org.wso2.siddhi.core.stream.input.InputHandler;
+
+import junit.framework.Assert;
+import org.wso2.siddhi.core.util.EventPrinter;
+
+public class TestAggregation {
+@Test
+public void test01DownSampling() throws Exception {
+String stream = "define stream jmxMetric(cpu double, memory int, 
bytesIn int, bytesOut long, timestamp long);";
+String query = "@info(name = 'downSample') "
++ "from jmxMetric#window.timeBatch(1 sec) "
++ "select "
++ " min(cpu) as minCpu, max(cpu) as maxCpu, avg(cpu) as 
avgCpu, "
++ " min(memory) as minMem, max(memory) as maxMem, avg(memory) 
as avgMem, "
++ " min(bytesIn) as minBytesIn, max(bytesIn) as maxBytesIn, 
avg(bytesIn) as avgBytesIn, sum(bytesIn) as totalBytesIn, "
++ " min(bytesOut) as minBytesOut, max(bytesOut) as 
maxBytesOut, avg(bytesOut) as avgBytesOut, sum(bytesOut) as totalBytesOut, "
++ " timestamp as timeWindowEnds "
++ " INSERT  INTO tmp;";
+
+SiddhiManager sm = new SiddhiManager();
+ExecutionPlanRuntime plan = sm.createExecutionPlanRuntime(stream + 
query);
+
+final AtomicInteger counter = new AtomicInteger();
+plan.addCallback("downSample", new QueryCallback() {
+@Override
+public void receive(long timeStamp, Event[] inEvents, Event[] 
removeEvents) {
+EventPrinter.print(timeStamp, inEvents, removeEvents);
+int count = counter.incrementAndGet();
+if (count == 1) {
+Assert.assertEquals(6000L, inEvents[0].getData(9));
+} else if(count == 2) {
+Assert.assertEquals(6000L, inEvents[0].getData(9));
+}
+}
+});
+InputHandler input = plan.getInputHandler("jmxMetric");
+
+plan.start();
+sendEvent(input);
+Thread.sleep(100);
+sendEvent(input);
+Thread.sleep(1000);
+sendEvent(input);
+Thread.sleep(1000);
+sendEvent(input);
+Thread.sleep(200);
+plan.shutdown();
+}
+
+// send 3 events
+private void sendEvent(InputHandler input) throws Exception {
+int len = 3;
+Event[] events = new Event[len];
+for (int i = 0; i < len; i++) {
+long externalTs = System.currentTimeMillis();
+// cpu int, memory int, bytesIn long, bytesOut long, timestamp long
+events[i] = new Event(externalTs + i, new Object[] {
+15.0,
+15,
+1000,
+2000L,
+externalTs + i
+});
+}
+
+for (Event e : events) {
+input.send(e);
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert-process/src/test/java/org/apache/eagle/alert/state/TestSiddhiExpiredEvents.java
--
diff --git 

[21/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/metric/sink/ElasticSearchSink.java
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/metric/sink/ElasticSearchSink.java
 
b/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/metric/sink/ElasticSearchSink.java
deleted file mode 100644
index 7e30b82..000
--- 
a/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/metric/sink/ElasticSearchSink.java
+++ /dev/null
@@ -1,74 +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.metric.sink;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.elasticsearch.metrics.ElasticsearchReporter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.codahale.metrics.MetricRegistry;
-import com.typesafe.config.Config;
-
-public class ElasticSearchSink implements MetricSink {
-private ElasticsearchReporter reporter = null;
-private final static Logger LOG = 
LoggerFactory.getLogger(ElasticSearchSink.class);
-
-@Override
-public void prepare(Config config, MetricRegistry registry) {
-LOG.debug("Preparing elasticsearch-sink");
-try {
-ElasticsearchReporter.Builder builder = 
ElasticsearchReporter.forRegistry(registry);
-if(config.hasPath("hosts")){
-List hosts = config.getStringList("hosts");
-builder.hosts(hosts.toArray(new String[hosts.size()]));
-}
-if(config.hasPath("index")){
-builder.index(config.getString("index"));
-}
-builder.indexDateFormat("-MM-dd");
-
builder.timestampFieldname(config.hasPath("timestampField")?config.getString("timestampField"):"@timestamp");
-
-if(config.hasPath("tags")) {
-
builder.additionalFields(config.getConfig("tags").root().unwrapped());
-}
-
-reporter = builder.build();
-} catch (IOException e) {
-LOG.error(e.getMessage(),e);
-}
-}
-
-@Override
-public void start(long period, TimeUnit unit) {
-reporter.start(period, TimeUnit.SECONDS);
-}
-
-@Override
-public void stop() {
-reporter.stop();
-reporter.close();
-}
-
-@Override
-public void report() {
-reporter.report();
-}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/metric/sink/JmxSink.java
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/metric/sink/JmxSink.java
 
b/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/metric/sink/JmxSink.java
deleted file mode 100644
index fddaf19..000
--- 
a/eagle-core/eagle-alert/alert/alert-common/src/main/java/org/apache/eagle/alert/metric/sink/JmxSink.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.metric.sink;
-
-import java.util.concurrent.TimeUnit;
-
-import com.codahale.metrics.JmxReporter;

[31/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/scheme/JsonScheme.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/scheme/JsonScheme.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/scheme/JsonScheme.java
new file mode 100644
index 000..a3487d3
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/scheme/JsonScheme.java
@@ -0,0 +1,71 @@
+/*
+ *
+ *  * 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.engine.scheme;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.slf4j.Logger;
+
+import backtype.storm.spout.Scheme;
+import backtype.storm.tuple.Fields;
+
+/**
+ * Expects flat Json scheme
+ */
+public class JsonScheme implements Scheme {
+private static final long serialVersionUID = -8352896475656975577L;
+private static final Logger LOG = 
org.slf4j.LoggerFactory.getLogger(JsonScheme.class);
+private static final ObjectMapper mapper = new ObjectMapper();
+
+private String topic;
+
+public JsonScheme(String topic) {
+this.topic = topic;
+}
+
+@Override
+public Fields getOutputFields() {
+return new Fields("f1");
+}
+
+@Override
+@SuppressWarnings("rawtypes")
+public List deserialize(byte[] ser) {
+try {
+if(ser != null ) {
+Map map = mapper.readValue(ser, Map.class);
+return Arrays.asList(topic, map);
+}else{
+if(LOG.isDebugEnabled()) LOG.debug("Content is null, ignore");
+}
+} catch (IOException e) {
+try {
+LOG.error("Failed to deserialize as JSON: {}", new String(ser, 
"UTF-8"), e);
+}catch(Exception ex){
+LOG.error(ex.getMessage(), ex);
+}
+}
+return null;
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/scheme/JsonStringStreamNameSelector.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/scheme/JsonStringStreamNameSelector.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/scheme/JsonStringStreamNameSelector.java
new file mode 100644
index 000..1182e3f
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/scheme/JsonStringStreamNameSelector.java
@@ -0,0 +1,74 @@
+/*
+ *
+ *  * 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.engine.scheme;
+
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.eagle.alert.coordination.model.StreamNameSelector;
+import org.slf4j.Logger;
+import 

[30/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/sorter/StreamWindowManager.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/sorter/StreamWindowManager.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/sorter/StreamWindowManager.java
new file mode 100644
index 000..a5f43aa
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/sorter/StreamWindowManager.java
@@ -0,0 +1,64 @@
+/**
+ * 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.engine.sorter;
+
+import java.io.Closeable;
+import java.util.Collection;
+
+/**
+ * TODO: Reuse existing expired window to avoid recreating new windows again 
and again
+ *
+ * Single stream window manager
+ */
+public interface StreamWindowManager extends StreamTimeClockListener, 
Closeable {
+
+/**
+ * @param initialTime
+ * @return
+ */
+StreamWindow addNewWindow(long initialTime);
+
+/**
+ * @param window
+ */
+void removeWindow(StreamWindow window);
+
+/**
+ * @param window
+ * @return
+ */
+boolean hasWindow(StreamWindow window);
+
+/**
+ * @param timestamp time
+ * @return whether window exists for time
+ */
+boolean hasWindowFor(long timestamp);
+
+/**
+ * @return Internal collection for performance optimization
+ */
+Collection getWindows();
+
+/**
+ * @param timestamp
+ * @return
+ */
+StreamWindow getWindowFor(long timestamp);
+
+boolean reject(long timestamp);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/sorter/StreamWindowRepository.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/sorter/StreamWindowRepository.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/sorter/StreamWindowRepository.java
new file mode 100755
index 000..3e035c5
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/sorter/StreamWindowRepository.java
@@ -0,0 +1,257 @@
+/**
+ * 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.engine.sorter;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.eagle.alert.engine.sorter.impl.StreamSortedWindowInMapDB;
+import org.apache.eagle.alert.engine.sorter.impl.StreamSortedWindowOnHeap;
+import org.mapdb.DB;
+import org.mapdb.DBMaker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Preconditions;
+
+/**
+ *
+ * = Benchmark Result Report =
+ *
+ * Num. Operation   TypeTime
+ *  -   
+ * 1000FlushTime   DIRECT_MEMORY   :   55
+ * 1000FlushTime  

[39/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/AlertStreamEvent.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/AlertStreamEvent.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/AlertStreamEvent.java
new file mode 100644
index 000..f36d3cb
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/AlertStreamEvent.java
@@ -0,0 +1,89 @@
+/**
+ * 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.engine.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.apache.eagle.alert.utils.DateTimeUtil;
+
+/**
+ * streamId stands for alert type instead of source event streamId
+ */
+public class AlertStreamEvent extends StreamEvent {
+private static final long serialVersionUID = 2392131134670106397L;
+
+// TODO: Keep policy name only instead of policy entity
+private PolicyDefinition policy;
+private StreamDefinition schema;
+private String createdBy;
+private long createdTime;
+
+public PolicyDefinition getPolicy() {
+return policy;
+}
+
+public void setPolicy(PolicyDefinition policy) {
+this.policy = policy;
+}
+
+
+public String getPolicyId() {
+return policy.getName();
+}
+
+@Override
+public String toString() {
+List dataStrings = new ArrayList<>(this.getData().length);
+for(Object obj: this.getData()){
+if(obj!=null) {
+dataStrings.add(obj.toString());
+}else{
+dataStrings.add(null);
+}
+}
+return 
String.format("AlertStreamEvent[stream=%S,timestamp=%s,data=[%s], policy=%s, 
createdBy=%s]",
+this.getStreamId(), 
DateTimeUtil.millisecondsToHumanDateWithMilliseconds(this.getTimestamp()), 
StringUtils.join(dataStrings,","),this.getPolicy().getName(),this.getCreatedBy());
+}
+
+public String getCreatedBy() {
+return createdBy;
+}
+
+public void setCreatedBy(String createdBy) {
+this.createdBy = createdBy;
+}
+
+public StreamDefinition getSchema() {
+return schema;
+}
+
+public void setSchema(StreamDefinition schema) {
+this.schema = schema;
+}
+
+public long getCreatedTime() {
+return createdTime;
+}
+
+public void setCreatedTime(long createdTime) {
+this.createdTime = createdTime;
+}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/PartitionedEvent.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/PartitionedEvent.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/PartitionedEvent.java
new file mode 100644
index 000..cfed3e2
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/model/PartitionedEvent.java
@@ -0,0 +1,149 @@
+/**
+ * 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 

[35/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert/alert-devtools/bin/start-integration2.sh
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-devtools/bin/start-integration2.sh
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-devtools/bin/start-integration2.sh
new file mode 100755
index 000..5821309
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-devtools/bin/start-integration2.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+echo $(dirname $0)
+
+export MAVEN_OPTS=-Xms256M -Xmx1024M
+
+#start topology
+echo "starting topology..."
+cd $(dirname $0)/../../alert-engine/alert-engine-base/
+
+
+echo " as dev tests, tail -f test.log | grep AlertStreamEvent for alert 
stream."
+
+
+mvn test -Dtest=org.apache.eagle.alert.engine.e2e.Integration2 | tee test.log
+
+# tail log output
+# tail -f test.log | grep AlertStreamEvent
+

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert/alert-devtools/bin/start-metadata.sh
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-devtools/bin/start-metadata.sh
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-devtools/bin/start-metadata.sh
new file mode 100755
index 000..1732c04
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-devtools/bin/start-metadata.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cd $(dirname $0)/../../alert-metadata-parent/alert-metadata-service
+
+mvn jetty:run 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert/alert-devtools/bin/start-sampleclient1.sh
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-devtools/bin/start-sampleclient1.sh
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-devtools/bin/start-sampleclient1.sh
new file mode 100755
index 000..df60739
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-devtools/bin/start-sampleclient1.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cd $(dirname $0)/../../alert-assembly/
+
+java -cp 
${MAVEN_REPO}/org/apache/storm/storm-core/0.9.3/storm-core-0.9.3.jar:target/alert-engine-0.0.1-SNAPSHOT-alert-assembly.jar
 org.apache.eagle.alert.engine.e2e.SampleClient1
+


[45/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailGenerator.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailGenerator.java
 
b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailGenerator.java
new file mode 100644
index 000..fd6b794
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/email/AlertEmailGenerator.java
@@ -0,0 +1,138 @@
+/*
+ * 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 =6;
+
+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 components = new 
ArrayList();
+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() {
+

[32/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/router/impl/BasicStreamRoutePartitioner.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/router/impl/BasicStreamRoutePartitioner.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/router/impl/BasicStreamRoutePartitioner.java
new file mode 100644
index 000..afb9a6f
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/router/impl/BasicStreamRoutePartitioner.java
@@ -0,0 +1,77 @@
+/**
+ * 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.engine.router.impl;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.apache.eagle.alert.engine.coordinator.StreamPartition;
+import org.apache.eagle.alert.engine.model.StreamEvent;
+import org.apache.eagle.alert.engine.router.StreamRoute;
+import org.apache.eagle.alert.engine.router.StreamRoutePartitioner;
+
+public class BasicStreamRoutePartitioner implements StreamRoutePartitioner {
+private final List outputComponentIds;
+private final StreamDefinition streamDefinition;
+private final StreamPartition streamPartition;
+
+public BasicStreamRoutePartitioner(List outputComponentIds, 
StreamDefinition streamDefinition, StreamPartition partition) {
+this.outputComponentIds = outputComponentIds;
+this.streamDefinition = streamDefinition;
+this.streamPartition = partition;
+}
+
+@Override
+public List partition(StreamEvent event) {
+switch (this.streamPartition.getType()){
+case GLOBAL:
+return routeToAll(event);
+case GROUPBY:
+return routeByGroupByKey(event);
+default:
+return routeByShuffle(event);
+}
+}
+
+protected List routeByGroupByKey(StreamEvent event) {
+int partitionKey = new 
HashCodeBuilder().append(event.getData(streamDefinition,this.streamPartition.getColumns())).build();
+String selectedOutputStream = 
outputComponentIds.get(Math.abs(partitionKey) % this.outputComponentIds.size());
+return Collections.singletonList(new StreamRoute(selectedOutputStream, 
partitionKey, StreamPartition.Type.GROUPBY));
+}
+
+protected List routeByShuffle(StreamEvent event) {
+long random = System.currentTimeMillis();
+int hash = Math.abs((int)random);
+return Arrays.asList(new StreamRoute(outputComponentIds.get(hash % 
outputComponentIds.size()),-1,StreamPartition.Type.SHUFFLE));
+}
+
+protected List routeToAll(StreamEvent event) {
+if(_globalRoutingKeys!=null) {
+_globalRoutingKeys = new ArrayList<>();
+for (String targetId : outputComponentIds) {
+_globalRoutingKeys.add(new StreamRoute(targetId, -1, 
StreamPartition.Type.GLOBAL));
+}
+}
+return _globalRoutingKeys;
+}
+
+private List _globalRoutingKeys = null;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/router/impl/RoutePhysicalGrouping.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/router/impl/RoutePhysicalGrouping.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/router/impl/RoutePhysicalGrouping.java
new file mode 100644
index 000..d0bf012
--- /dev/null
+++ 

[08/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/java/org/apache/eagle/alert/engine/topology/TestMetadataSpecSerDeser.java
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/java/org/apache/eagle/alert/engine/topology/TestMetadataSpecSerDeser.java
 
b/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/java/org/apache/eagle/alert/engine/topology/TestMetadataSpecSerDeser.java
deleted file mode 100644
index 65b16d9..000
--- 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/java/org/apache/eagle/alert/engine/topology/TestMetadataSpecSerDeser.java
+++ /dev/null
@@ -1,266 +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.engine.topology;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.eagle.alert.coordination.model.AlertBoltSpec;
-import org.apache.eagle.alert.coordination.model.Kafka2TupleMetadata;
-import org.apache.eagle.alert.coordination.model.PolicyWorkerQueue;
-import org.apache.eagle.alert.coordination.model.RouterSpec;
-import org.apache.eagle.alert.coordination.model.SpoutSpec;
-import org.apache.eagle.alert.coordination.model.StreamRepartitionMetadata;
-import org.apache.eagle.alert.coordination.model.StreamRepartitionStrategy;
-import org.apache.eagle.alert.coordination.model.StreamRouterSpec;
-import org.apache.eagle.alert.coordination.model.Tuple2StreamMetadata;
-import org.apache.eagle.alert.coordination.model.WorkSlot;
-import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
-import org.apache.eagle.alert.engine.coordinator.StreamColumn;
-import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import org.apache.eagle.alert.engine.coordinator.StreamPartition;
-import org.apache.eagle.alert.engine.coordinator.StreamSortSpec;
-import org.apache.eagle.alert.engine.evaluator.PolicyStreamHandlers;
-import org.apache.eagle.alert.engine.utils.MetadataSerDeser;
-import org.codehaus.jackson.type.TypeReference;
-import org.joda.time.Period;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Since 5/6/16.
- */
-public class TestMetadataSpecSerDeser {
-private String getStreamNameByTopic(String topic){
-return topic + "Stream";
-}
-
-@Test
-public void testStreamDefinitions(){
-Map sds = new HashMap<>();
-List topics = Arrays.asList("testTopic3", "testTopic4", 
"testTopic5");
-for(String topic : topics) {
-String streamId = getStreamNameByTopic(topic);
-if (topic.equals("testTopic3") || topic.equals("testTopic4")) {
-StreamDefinition schema = new StreamDefinition();
-schema.setStreamId(streamId);
-StreamColumn column = new StreamColumn();
-column.setName("value");
-column.setType(StreamColumn.Type.STRING);
-schema.setColumns(Collections.singletonList(column));
-sds.put(schema.getStreamId(), schema);
-}else if(topic.equals("testTopic5")){
-StreamDefinition schema = new StreamDefinition();
-schema.setStreamId(streamId);
-StreamColumn column = new StreamColumn();
-column.setName("value");
-column.setType(StreamColumn.Type.STRING);
-schema.setColumns(Collections.singletonList(column));
-sds.put(schema.getStreamId(), schema);
-}
-}
-
-String json = MetadataSerDeser.serialize(sds);
-System.out.println(json);
-
-Map deserializedSpec = 
MetadataSerDeser.deserialize(json, new TypeReference>(){});
-Assert.assertEquals(3, deserializedSpec.size());
-}
-
-@SuppressWarnings("unused")
-

[07/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/resources/testStreamRouterBoltSpec.json
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/resources/testStreamRouterBoltSpec.json
 
b/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/resources/testStreamRouterBoltSpec.json
deleted file mode 100644
index f4e72bf..000
--- 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/resources/testStreamRouterBoltSpec.json
+++ /dev/null
@@ -1,123 +0,0 @@
-{
-  "version": null,
-  "topologyName": "testTopology",
-  "routerSpecs": [
-{
-  "streamId": "testTopic3Stream",
-  "partition": {
-"streamId": "testTopic3Stream",
-"type": "GROUPBY",
-"columns": [
-  "value"
-],
-"sortSpec": {
-  "windowPeriod": "PT10S",
-  "windowMargin": 1000
-}
-  },
-  "targetQueue": [
-{
-  "partition": {
-"streamId": "testTopic3Stream",
-"type": "GROUPBY",
-"columns": [
-  "value"
-],
-"sortSpec": {
-  "windowPeriod": "PT10S",
-  "windowMargin": 1000
-}
-  },
-  "workers": [
-{
-  "topologyName": "testTopology",
-  "boltId": "alertBolt0"
-},
-{
-  "topologyName": "testTopology",
-  "boltId": "alertBolt1"
-}
-  ]
-}
-  ]
-},
-{
-  "streamId": "testTopic4Stream",
-  "partition": {
-"streamId": "testTopic4Stream",
-"type": "GROUPBY",
-"columns": [
-  "value"
-],
-"sortSpec": {
-  "windowPeriod": "PT10S",
-  "windowMargin": 1000
-}
-  },
-  "targetQueue": [
-{
-  "partition": {
-"streamId": "testTopic4Stream",
-"type": "GROUPBY",
-"columns": [
-  "value"
-],
-"sortSpec": {
-  "windowPeriod": "PT10S",
-  "windowMargin": 1000
-}
-  },
-  "workers": [
-{
-  "topologyName": "testTopology",
-  "boltId": "alertBolt0"
-},
-{
-  "topologyName": "testTopology",
-  "boltId": "alertBolt1"
-}
-  ]
-}
-  ]
-},
-{
-  "streamId": "testTopic5Stream",
-  "partition": {
-"streamId": "testTopic5Stream",
-"type": "GROUPBY",
-"columns": [
-  "value"
-],
-"sortSpec": {
-  "windowPeriod": "PT10S",
-  "windowMargin": 1000
-}
-  },
-  "targetQueue": [
-{
-  "partition": {
-"streamId": "testTopic5Stream",
-"type": "GROUPBY",
-"columns": [
-  "value"
-],
-"sortSpec": {
-  "windowPeriod": "PT10S",
-  "windowMargin": 1000
-}
-  },
-  "workers": [
-{
-  "topologyName": "testTopology",
-  "boltId": "alertBolt0"
-},
-{
-  "topologyName": "testTopology",
-  "boltId": "alertBolt1"
-}
-  ]
-}
-  ]
-}
-  ]
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/resources/topic.json
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/resources/topic.json
 
b/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/resources/topic.json
deleted file mode 100644
index b49d6ad..000
--- 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/resources/topic.json
+++ /dev/null
@@ -1 +0,0 @@
-nn_jmx_metric_sandbox
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/resources/topologies.json
--
diff --git 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/resources/topologies.json
 
b/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/resources/topologies.json
deleted file mode 100644
index 411cc48..000
--- 
a/eagle-core/eagle-alert/alert/alert-engine/alert-engine-base/src/test/resources/topologies.json
+++ /dev/null
@@ -1,31 +0,0 @@
-[
-{
-   "name": "alertUnitTopology_1",
-   "numOfSpout":1,
-   "numOfAlertBolt": 10,
-   "numOfGroupBolt": 4,
-   "spoutId": 

[28/46] incubator-eagle git commit: [EAGLE-325] Initialize next-gen alert engine code on branch-0.5

2016-06-02 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/737e5a2d/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/evaluator/SiddhiCEPPolicyEventHandlerTest.java
--
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/evaluator/SiddhiCEPPolicyEventHandlerTest.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/evaluator/SiddhiCEPPolicyEventHandlerTest.java
new file mode 100755
index 000..ab19801
--- /dev/null
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/evaluator/SiddhiCEPPolicyEventHandlerTest.java
@@ -0,0 +1,161 @@
+/**
+ * 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.engine.evaluator;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.eagle.alert.engine.Collector;
+import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.apache.eagle.alert.engine.evaluator.impl.SiddhiPolicyHandler;
+import org.apache.eagle.alert.engine.mock.MockSampleMetadataFactory;
+import org.apache.eagle.alert.engine.mock.MockStreamCollector;
+import org.apache.eagle.alert.engine.model.AlertStreamEvent;
+import org.apache.eagle.alert.engine.model.StreamEvent;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import backtype.storm.metric.api.MultiCountMetric;
+
+public class SiddhiCEPPolicyEventHandlerTest {
+private final static Logger LOG = 
LoggerFactory.getLogger(SiddhiCEPPolicyEventHandlerTest.class);
+
+private Map createDefinition(String ... 
streamIds) {
+Map sds = new HashMap<>();
+for(String streamId:streamIds) {
+// construct StreamDefinition
+StreamDefinition sd = 
MockSampleMetadataFactory.createSampleStreamDefinition(streamId);
+sds.put(streamId, sd);
+}
+return sds;
+}
+
+@SuppressWarnings("serial")
+@Test
+public void testBySendSimpleEvent() throws Exception {
+SiddhiPolicyHandler handler;
+MockStreamCollector collector;
+
+handler = new 
SiddhiPolicyHandler(createDefinition("sampleStream_1","sampleStream_2"));
+collector = new MockStreamCollector();
+PolicyDefinition policyDefinition = 
MockSampleMetadataFactory.createSingleMetricSamplePolicy();
+PolicyHandlerContext context = new PolicyHandlerContext();
+context.setPolicyDefinition(policyDefinition);
+context.setPolicyCounter(new MultiCountMetric());
+handler.prepare(collector,context);
+StreamEvent event = StreamEvent.Builder()
+
.schema(MockSampleMetadataFactory.createSampleStreamDefinition("sampleStream_1"))
+.streamId("sampleStream_1")
+.timestamep(System.currentTimeMillis())
+.attributes(new HashMap(){{
+put("name","cpu");
+put("value",60.0);
+put("bad","bad column value");
+}}).build();
+handler.send(event);
+handler.close();
+}
+
+@SuppressWarnings("serial")
+@Test
+public void testWithTwoStreamJoinPolicy() throws Exception {
+Map ssd = 
createDefinition("sampleStream_1","sampleStream_2");
+
+PolicyDefinition policyDefinition = new PolicyDefinition();
+policyDefinition.setName("SampleJoinPolicyForTest");
+
policyDefinition.setInputStreams(Arrays.asList("sampleStream_1","sampleStream_2"));
+
policyDefinition.setOutputStreams(Collections.singletonList("joinedStream"));
+policyDefinition.setDefinition(new 

incubator-eagle git commit: Branch 0.5 fix license

2016-06-01 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/branch-0.5 614c118ef -> 656dd2305


Branch 0.5 fix license

Author: Ralph, Su <suliang...@gmail.com>
Author: Hao Chen <h...@apache.org>

Closes #212 from haoch/branch-0.5-fix-license.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/656dd230
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/656dd230
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/656dd230

Branch: refs/heads/branch-0.5
Commit: 656dd2305754e5ed0d19f36008c11276ca4010a1
Parents: 614c118
Author: Chen, Hao <h...@apache.org>
Authored: Wed Jun 1 23:23:40 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Wed Jun 1 23:23:40 2016 +0800

--
 eagle-core/eagle-alert/alert/README.md  | 18 +++
 .../eagle-alert/alert/alert-assembly/pom.xml| 16 ++
 .../src/assembly/alert-assembly.xml | 17 ++
 .../eagle/alert/config/ConfigBusBase.java   | 16 ++
 .../eagle/alert/config/ConfigBusConsumer.java   | 17 ++
 .../eagle/alert/config/ConfigBusProducer.java   | 17 ++
 .../alert/config/ConfigChangeCallback.java  | 16 ++
 .../apache/eagle/alert/config/ConfigValue.java  | 17 ++
 .../org/apache/eagle/alert/config/ZKConfig.java | 17 ++
 .../eagle/alert/config/ZKConfigBuilder.java | 33 +---
 .../coordination/model/PolicyWorkerQueue.java   | 16 ++
 .../coordination/model/StreamNameSelector.java  | 16 ++
 .../model/StreamRepartitionMetadata.java| 16 ++
 .../model/Tuple2StreamConverter.java| 16 ++
 .../model/Tuple2StreamMetadata.java | 16 ++
 .../alert/engine/model/StreamEventBuilder.java  | 16 ++
 .../alert/metric/reporter/KafkaReporter.java| 16 ++
 .../eagle/alert/utils/AlertConstants.java   | 12 +++
 .../org/apache/eagle/alert/utils/ByteUtils.java | 16 ++
 .../apache/eagle/alert/utils/ConfigUtils.java   | 16 ++
 .../org/apache/eagle/alert/utils/HostUtils.java | 17 +-
 .../eagle/alert/utils/StreamIdConversion.java   | 16 ++
 .../src/test/resources/application.conf | 15 +
 .../eagle-alert/alert/alert-coordinator/pom.xml | 11 +++
 .../trigger/DynamicPolicyLoader.java| 16 ++
 .../trigger/PolicyChangeListener.java   | 16 ++
 .../src/main/resources/application.conf | 14 +
 .../src/test/resources/test-application.conf| 15 +
 .../alert-devtools/bin/start-integration1.sh| 14 +
 .../alert-devtools/bin/start-integration2.sh| 14 +
 .../alert-devtools/bin/start-sampleclient1.sh   | 14 +
 .../alert-devtools/bin/start-sampleclient2.sh   | 14 +
 .../eagle-alert/alert/alert-devtools/pom.xml| 11 +++
 .../kafka-offset-test.application.conf  | 16 ++
 .../alert-engine/alert-engine-base/pom.xml  | 11 +++
 .../apache/eagle/alert/engine/Collector.java| 12 +++
 .../eagle/alert/engine/StreamContextImpl.java   | 18 +++
 .../impl/StreamEventSerializer.java | 17 ++
 .../impl/StreamPartitionDigestSerializer.java   | 17 ++
 .../impl/StreamPartitionSerializer.java | 17 ++
 .../alert/engine/utils/SerializableUtils.java   | 16 ++
 .../main/java/storm/kafka/KafkaSpoutMetric.java | 16 ++
 ...oltOutputCollectorThreadSafeWrapperTest.java | 16 ++
 .../alert/engine/perf/TestSerDeserPer.java  | 16 ++
 .../sorter/TreeMultisetComparatorTest.java  | 16 ++
 .../src/main/resources/application.conf | 15 +
 .../src/main/resources/application.conf | 15 +
 .../src/test/resources/application-mongo.conf   | 15 +
 48 files changed, 729 insertions(+), 31 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/656dd230/eagle-core/eagle-alert/alert/README.md
--
diff --git a/eagle-core/eagle-alert/alert/README.md 
b/eagle-core/eagle-alert/alert/README.md
index 54cd226..e23ef68 100644
--- a/eagle-core/eagle-alert/alert/README.md
+++ b/eagle-core/eagle-alert/alert/README.md
@@ -1,3 +1,21 @@
+
 
 ## Prerequisites
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/656dd230/eagle-core/eagle-alert/alert/alert-assembly/pom.xml
--
diff --git a/eagle-core/eagle-alert/alert/alert-assembly/pom.xml 
b/eagle-core/eagle-alert/alert/alert-assembly/pom.xml
index b48ee5b..3f5b341 100644
--- a/eagle-core/eagle-alert/alert/alert-assembly/pom.xml
+++ b/eagle-core/eagle-alert/a

[incubator-eagle] Git Push Summary

2016-04-13 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/branch-0.3.0 [created] 8183edad3


[incubator-eagle] Git Push Summary

2016-04-13 Thread hao
Repository: incubator-eagle
Updated Tags:  refs/tags/v0.3.0-incubating [created] 0fb51f06b


incubator-eagle git commit: [EAGLE-196] eagle-topology.sh supports jar file path as parameter

2016-04-13 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 48b595251 -> 4bcf78abc


[EAGLE-196] eagle-topology.sh supports jar file path as parameter

https://issues.apache.org/jira/browse/EAGLE-196

Add optional parameter --jar in EAGLE-HOME/bin/eagle-topology.sh

Author: Zhao, Qingwen <qingwz...@ebay.com>

Closes #147 from qingwen220/EAGLE-196.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/4bcf78ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/4bcf78ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/4bcf78ab

Branch: refs/heads/master
Commit: 4bcf78abcb67836d3b7b204ecb81f9701a76e45f
Parents: 48b5952
Author: Zhao, Qingwen <qingwz...@ebay.com>
Authored: Wed Apr 13 20:37:41 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Wed Apr 13 20:37:41 2016 +0800

--
 eagle-assembly/src/main/bin/eagle-topology.sh | 22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4bcf78ab/eagle-assembly/src/main/bin/eagle-topology.sh
--
diff --git a/eagle-assembly/src/main/bin/eagle-topology.sh 
b/eagle-assembly/src/main/bin/eagle-topology.sh
index e1104ac..06cd7e5 100755
--- a/eagle-assembly/src/main/bin/eagle-topology.sh
+++ b/eagle-assembly/src/main/bin/eagle-topology.sh
@@ -22,13 +22,14 @@ TOPOLOGY_NAME_SET=0
 function print_help() {
echo "Usage: $0 options {start | stop | status}"
echo "Options:   Description:"
-   echo "  --main Default is 
org.apache.eagle.security.auditlog.HdfsAuditLogProcessorMain"
-   echo "  --topology  Default is 
sandbox-hdfsAuditLog-topology"
-   echo "  --configDefault is 
$EAGLE_HOME/conf/sandbox-hdfsAuditLog-application.conf"
+   echo "  --jar (Optional) Default is 
${EAGLE_HOME}/lib/topology/eagle-topology-*-assembly.jar"
+   echo "  --main for example: 
org.apache.eagle.security.auditlog.HdfsAuditLogProcessorMain"
+   echo "  --topology  for example: 
sandbox-hdfsAuditLog-topology"
+   echo "  --configfor example: 
$EAGLE_HOME/conf/sandbox-hdfsAuditLog-application.conf"
echo "  --storm-ui   Execute through storm UI API, 
default: http://localhost:8744;
 
echo "Command Examples:"
-   echo "  $0 --main  [--topology ] --config 
 start"
+   echo "  $0 --main  --topology  --config 
 start"
echo "  $0 --topology  stop"
echo "  $0 --topology  status"
 }
@@ -63,6 +64,14 @@ case $1 in
 cmd=$1
 shift
 ;;
+--jar)
+if [ $# -lt 3 ]; then
+print_help
+exit 1
+fi
+jarName=$2
+shift 2
+;;
 --main)
 if [ $# -lt 3 ]; then
 print_help
@@ -101,11 +110,8 @@ case $1 in
 done
 
 
-jarName=$(ls ${EAGLE_HOME}/lib/topology/eagle-topology-*-assembly.jar)
-
 if [ -z "$jarName" ]; then
-echo "Error: jar file is not found"
-exit 1
+jarName=$(ls ${EAGLE_HOME}/lib/topology/eagle-topology-*-assembly.jar)
 fi
 
 if [ -z "$mainClass" ]; then



incubator-eagle git commit: minor: Fix bad char in eagle-dev/merge-eagle-pr.py

2016-04-13 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 12e4395fd -> 48b595251


minor: Fix bad char in eagle-dev/merge-eagle-pr.py


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/48b59525
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/48b59525
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/48b59525

Branch: refs/heads/master
Commit: 48b59525110c4073ff75b371f58c8ebabd159b7b
Parents: 12e4395
Author: Hao Chen <h...@apache.org>
Authored: Wed Apr 13 20:31:35 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Wed Apr 13 20:34:36 2016 +0800

--
 eagle-dev/merge-eagle-pr.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/48b59525/eagle-dev/merge-eagle-pr.py
--
diff --git a/eagle-dev/merge-eagle-pr.py b/eagle-dev/merge-eagle-pr.py
index 9d25dcc..03a4677 100755
--- a/eagle-dev/merge-eagle-pr.py
+++ b/eagle-dev/merge-eagle-pr.py
@@ -441,4 +441,4 @@ if __name__ == "__main__":
 except:
 clean_up()
 raise
-Status
\ No newline at end of file
+



[incubator-eagle] Git Push Summary

2016-04-12 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/branch-0.3.0 [deleted] 8183edad3


[1/2] incubator-eagle git commit: EAGLE-232 Fix alert engine related bugs, and create local Kafka/Zookeeper/Storm tools for quick-start examples and development

2016-04-12 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 8e338fea1 -> 60325aa2f


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/60325aa2/eagle-devsupport/build.sh
--
diff --git a/eagle-devsupport/build.sh b/eagle-devsupport/build.sh
new file mode 100755
index 000..4e41f3e
--- /dev/null
+++ b/eagle-devsupport/build.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cd $(dirname $0)/../
+mvn clean install -DskipTests
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/60325aa2/eagle-devsupport/clean-all-services.sh
--
diff --git a/eagle-devsupport/clean-all-services.sh 
b/eagle-devsupport/clean-all-services.sh
new file mode 100755
index 000..20e2b3f
--- /dev/null
+++ b/eagle-devsupport/clean-all-services.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+echo "Stopping all service ..."
+$(dirname $0)/stop-all-services.sh
+echo "Cleaning tmp files (including local db, zookeeper data, kafka log, etc.) 
..."
+rm -rf /tmp/eagle-*
+echo "Done."
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/60325aa2/eagle-devsupport/eclipse-java-templates.xml
--
diff --git a/eagle-devsupport/eclipse-java-templates.xml 
b/eagle-devsupport/eclipse-java-templates.xml
new file mode 100644
index 000..8ccc558
--- /dev/null
+++ b/eagle-devsupport/eclipse-java-templates.xml
@@ -0,0 +1,20 @@
+/*
+ * 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_declaration}
+
+${typecomment}
+${type_declaration}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/60325aa2/eagle-devsupport/eclipse-scala-templates.xml
--
diff --git a/eagle-devsupport/eclipse-scala-templates.xml 
b/eagle-devsupport/eclipse-scala-templates.xml
new file mode 100644
index 000..55ce31a
--- /dev/null
+++ b/eagle-devsupport/eclipse-scala-templates.xml
@@ -0,0 +1,117 @@
+/*
+ * 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 

incubator-eagle git commit: EAGLE-224 Add default colomns "site", "application", "policyId" for eagle_metric table

2016-04-09 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/master f6aebe631 -> f311630fb


EAGLE-224 Add default colomns "site","application","policyId" for eagle_metric 
table

https://issues.apache.org/jira/browse/EAGLE-224

Sign-Off-By: @haoch <h...@apache.org>

Closes #139.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/f311630f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/f311630f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/f311630f

Branch: refs/heads/master
Commit: f311630fb8cb7a77d3543c01dd299bbc6f1e9090
Parents: f6aebe6
Author: Hao Chen <h...@apache.org>
Authored: Sat Apr 9 16:58:49 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Sat Apr 9 17:04:40 2016 +0800

--
 .../apache/eagle/log/entity/GenericMetricEntity.java  | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/f311630f/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntity.java
--
diff --git 
a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntity.java
 
b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntity.java
index a9a8c75..ef7d967 100755
--- 
a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntity.java
+++ 
b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntity.java
@@ -17,17 +17,9 @@
 package org.apache.eagle.log.entity;
 
 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.Service;
-import org.apache.eagle.log.entity.meta.ServicePath;
+import org.apache.eagle.log.entity.meta.*;
 import org.codehaus.jackson.map.annotate.JsonSerialize;
 
-import org.apache.eagle.log.entity.meta.Metric;
-import org.apache.eagle.log.entity.meta.Prefix;
-import org.apache.eagle.log.entity.meta.Table;
-import org.apache.eagle.log.entity.meta.TimeSeries;
-
 /**
  * GenericMetricEntity should use prefix field which is extended from 
TaggedLogAPIEntity as metric name
  * metric name is used to partition the metric tables
@@ -40,6 +32,8 @@ import org.apache.eagle.log.entity.meta.TimeSeries;
 @TimeSeries(true)
 @Metric(interval=6)
 @ServicePath(path = "/metric")
+// TODO:
+@Tags({"site","application","policyId"})
 public class GenericMetricEntity extends TaggedLogAPIEntity {
public static final String GENERIC_METRIC_SERVICE = 
"GenericMetricService";
public static final String GENERIC_METRIC_PREFIX_PLACE_HOLDER = 
"GENERIC_METRIC_PREFIX_PLACEHODLER";
@@ -56,4 +50,4 @@ public class GenericMetricEntity extends TaggedLogAPIEntity {
this.value = value;
_pcs.firePropertyChange("value", null, null);
}
-}
+}
\ No newline at end of file



incubator-eagle git commit: minor: Fix eagle-gc dependency groupId

2016-04-06 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 6a0a11f2d -> 48ac798da


minor: Fix eagle-gc dependency groupId


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/48ac798d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/48ac798d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/48ac798d

Branch: refs/heads/master
Commit: 48ac798da4bdfa14c96604b277b14dec4f44181c
Parents: 6a0a11f
Author: Hao Chen <h...@apache.org>
Authored: Wed Apr 6 22:37:17 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Wed Apr 6 22:37:17 2016 +0800

--
 eagle-topology-assembly/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/48ac798d/eagle-topology-assembly/pom.xml
--
diff --git a/eagle-topology-assembly/pom.xml b/eagle-topology-assembly/pom.xml
index 5ac3583..81649a3 100644
--- a/eagle-topology-assembly/pom.xml
+++ b/eagle-topology-assembly/pom.xml
@@ -70,7 +70,7 @@
 ${project.version}
 

-eagle
+org.apache.eagle
 eagle-gc
 ${project.version}
 



incubator-eagle git commit: update development-in-sandbox.md

2016-04-06 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/document 0ea130efe -> 431ce9c49


update development-in-sandbox.md

Changes
* update development-in-sandbox.md to let user know how to build the project 
and how to copy the package file into the sandbox.
* add new doc work-with-configed sandbox.md
* Update deployment-in-sandbox.md
* clean up.
* add new doc for working with configured sandbox

Author: JingGe
Reviewer: Hao Chen <h...@apache.org>

Closes #135.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/431ce9c4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/431ce9c4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/431ce9c4

Branch: refs/heads/document
Commit: 431ce9c4930ef6aab8ab090a263614633af97294
Parents: 0ea130e
Author: jinge <gej...@gmail.com>
Authored: Sun Apr 3 14:46:29 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Wed Apr 6 17:18:52 2016 +0800

--
 website/_config.yml |  2 ++
 website/deployment-in-sandbox.md| 14 ++
 website/work-with-configured-sandbox.md | 12 
 3 files changed, 24 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/431ce9c4/website/_config.yml
--
diff --git a/website/_config.yml b/website/_config.yml
index 0bb112e..5675b49 100644
--- a/website/_config.yml
+++ b/website/_config.yml
@@ -31,6 +31,8 @@ documentations:
 links:
   - title: Deploy Eagle in Sandbox
 url: /docs/deployment-in-sandbox.html
+  - title: Work with configured Sandbox
+url: /docs/work-with-configured-sandbox.html
   - title: Deploy Eagle in the Production
 url: /docs/deployment-in-production.html
   - title: Stream Log Data into Kafka

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/431ce9c4/website/deployment-in-sandbox.md
--
diff --git a/website/deployment-in-sandbox.md b/website/deployment-in-sandbox.md
index 5e862f0..365cf37 100644
--- a/website/deployment-in-sandbox.md
+++ b/website/deployment-in-sandbox.md
@@ -36,15 +36,21 @@ To install Eagle on a sandbox you need to run a HDP sandbox 
image in a virtual m
 
 * **Option 1**: Download eagle jar from 
[here](http://66.211.190.194/eagle-0.1.0.tar.gz).
 
-* **Option 2**: Build form source code [eagle 
github](https://github.com/eBay/Eagle). After successful build, 
‘eagle-xxx-bin.tar.gz’ will be generated under `./eagle-assembly/target`
+* **Option 2**: Build form source code [eagle 
github](https://github.com/eBay/Eagle). After successful build, 
‘eagle-xxx-bin.tar.gz’ will be generated under `./eagle-assembly/target` 
(please refer to[Setup Development Environment on 
Mac](https://github.com/apache/incubator-eagle/blob/master/eagle-tutorial/SetupDevelopmentEnvOnMac.md)
 if you have any issues during the maven build.)
 
   # installed npm is required before compiling
   $ mvn clean install -DskipTests=true
+  
 * **Copy and extract the package to sandbox**
 
-  #extract
-  $ tar -zxvf eagle-0.1.0-bin.tar.gz
-  $ mv eagle-0.1.0 /usr/hdp/current/eagle
+  # copy the file to the sandbox. Please run this command on your local 
machine. 
+  # you will be asked for the password. Please enter "hadoop" - the 
default password for root in the sandbox
+  $ scp 
/eagle-assembly/target/eagle-xxx-bin.tar.gz -p  
root@:/usr/hdp/current
+
+  # Now you can login into the sandbox, got the hdp/current directory and 
extract the package
+  $ cd /usr/hdp/current
+  $ tar -zxvf eagle-0.3.0-bin.tar.gz
+  $ mv eagle-0.3.0 eagle
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/431ce9c4/website/work-with-configured-sandbox.md
--
diff --git a/website/work-with-configured-sandbox.md 
b/website/work-with-configured-sandbox.md
new file mode 100644
index 000..9386502
--- /dev/null
+++ b/website/work-with-configured-sandbox.md
@@ -0,0 +1,12 @@
+---
+layout: doc
+title:  "Work with configed Sandbox"
+permalink: /docs/work-with-configured-sandbox.html
+---
+
+After Eagle has been deployed into the sandbox and all configuration has been 
done, you should have no issue to have a running eagle on your machine. But if 
you restart the sandbox, following steps have to be done to let you have the 
running eagle again:
+
+* You should use a web browser and login into Ambari and start HBase, 
Kafka, and Storm there. Please wait until all of them are running. It will take 
some time.
+* login into the sandbox

incubator-eagle git commit: EAGLE-206 Fix apache-rat by enabling useDefaultExcludes

2016-03-22 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 0605b34fa -> f9b131671


EAGLE-206 Fix apache-rat by enabling useDefaultExcludes

https://issues.apache.org/jira/browse/EAGLE-206

Closes #130.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/f9b13167
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/f9b13167
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/f9b13167

Branch: refs/heads/master
Commit: f9b1316717c0f1083b2b84284ddb2ddfd44d3ca7
Parents: 0605b34
Author: Hao Chen <h...@apache.org>
Authored: Wed Mar 23 12:06:16 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Wed Mar 23 12:44:02 2016 +0800

--
 pom.xml | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/f9b13167/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 7c0e90d..0d81c84 100755
--- a/pom.xml
+++ b/pom.xml
@@ -889,6 +889,7 @@
 check
 
 
+true
 
 
 .git/



incubator-eagle git commit: EAGLE-204 Support jdbc groupBy, timeseries, aggregation

2016-03-22 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/master c4bdb63f8 -> 0605b34fa


EAGLE-204 Support jdbc groupBy, timeseries, aggregation

https://issues.apache.org/jira/browse/EAGLE-204

Support timeseries metric query in front-end


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/0605b34f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/0605b34f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/0605b34f

Branch: refs/heads/master
Commit: 0605b34faaff218a847bb8b2b7ea9e2ae114b32f
Parents: c4bdb63
Author: Hao Chen <h...@apache.org>
Authored: Tue Mar 22 14:45:54 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Tue Mar 22 15:07:51 2016 +0800

--
 .../timeseries/AbstractAggregator.java  |   8 ++
 .../eagle/storage/operation/CompiledQuery.java  |  14 ++
 .../apache/eagle/storage/jdbc/JdbcStorage.java  |   1 +
 .../criteria/impl/QueryCriteriaBuilder.java |  48 ---
 .../jdbc/entity/JdbcEntitySerDeserHelper.java   |   4 +-
 .../jdbc/entity/impl/JdbcEntityReaderImpl.java  |  26 +++-
 .../jdbc/schema/JdbcEntityDefinition.java   |  42 +-
 .../schema/JdbcEntityDefinitionManager.java |   7 +-
 .../schema/serializer/MetricJdbcSerDeser.java   |  56 
 .../eagle/storage/jdbc/JdbcStorageTestBase.java |  46 +++
 .../storage/jdbc/TestGenericMetricStorage.java  | 129 +++
 .../eagle/storage/jdbc/TestJdbcStorage.java |  23 +---
 .../src/main/resources/application.conf |   7 +-
 .../app/public/feature/common/controller.js |   2 +-
 .../src/main/webapp/app/public/js/app.config.js |   4 +-
 15 files changed, 366 insertions(+), 51 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0605b34f/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/aggregate/timeseries/AbstractAggregator.java
--
diff --git 
a/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/aggregate/timeseries/AbstractAggregator.java
 
b/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/aggregate/timeseries/AbstractAggregator.java
index 0837382..deb0838 100755
--- 
a/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/aggregate/timeseries/AbstractAggregator.java
+++ 
b/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/aggregate/timeseries/AbstractAggregator.java
@@ -178,6 +178,14 @@ public abstract class AbstractAggregator implements 
Aggregator, EntityCreationLi
return new Double(0.0);
}
}
+   if(obj instanceof double[]){
+   double[] value = (double[]) obj;
+   if(value.length > 0){
+   return new Double(value[0]);
+   }else{
+   return new Double(0.0);
+   }
+   }

throw new 
IllegalAggregateFieldTypeException(obj.getClass().toString() + " type is not 
support. The aggregated field must be numeric type, int, long or double");
}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0605b34f/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/operation/CompiledQuery.java
--
diff --git 
a/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/operation/CompiledQuery.java
 
b/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/operation/CompiledQuery.java
index eacdcca..34761cb 100644
--- 
a/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/operation/CompiledQuery.java
+++ 
b/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/operation/CompiledQuery.java
@@ -41,6 +41,7 @@ import java.util.Set;
  */
 public class CompiledQuery {
 private final static Logger LOG = 
LoggerFactory.getLogger(CompiledQuery.class);
+private boolean timeSeries;
 
 public boolean isHasAgg() {
 return hasAgg;
@@ -202,6 +203,7 @@ public class CompiledQuery {
 this.sortFunctions = compiler.sortFunctions();
 this.groupByFields = compiler.groupbyFields();
 this.aggregateFields = compiler.aggregateFields();
+this.timeSeries = this.getRawQuery().isTimeSeries();
 
 final List<String[]> partitionValues = 
compiler.getQueryPartitionValues();
 if (partitionValues != null) {
@@ -255,4 +257,16 @@ public class CompiledQuery {
 }
 }
 }

[2/3] incubator-eagle git commit: EAGLE-202 Fix primary key length for mysql and add mysql webservice sample configuration

2016-03-19 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/c4bdb63f/eagle-external/eagle-ambari/lib/EAGLE/package/patches/app.js
--
diff --git a/eagle-external/eagle-ambari/lib/EAGLE/package/patches/app.js 
b/eagle-external/eagle-ambari/lib/EAGLE/package/patches/app.js
index ee8bd57..bfc0678 100644
--- a/eagle-external/eagle-ambari/lib/EAGLE/package/patches/app.js
+++ b/eagle-external/eagle-ambari/lib/EAGLE/package/patches/app.js
@@ -1,3 +1,20 @@
+/**
+ * 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.
+ */
+
 (function(/*! Brunch !*/) {
   'use strict';
 
@@ -805,7 +822,7 @@ App.ApplicationController = 
Em.Controller.extend(App.UserPref, {
 templateName: require('templates/common/about'),
 ambariVersion: this.get('ambariVersion')
   })
-});
+});
   }
 
 });
@@ -1021,7 +1038,7 @@ App.BackgroundOperationsController = 
Em.Controller.extend({
 var currentRequestIds = [];
 var countIssued = this.get('operationsCount');
 var countGot = data.itemTotal;
-   
+
 data.items.forEach(function (request) {
   if (this.isUpgradeRequest(request)) {
 return;
@@ -4687,7 +4704,7 @@ App.HighAvailabilityWizardStep4Controller = 
Em.Controller.extend({
   this.set("isNextEnabled", true);
   return;
 }
-
+
 window.setTimeout(function () {
   self.pullCheckPointStatus();
 }, self.POLL_INTERVAL);
@@ -6699,7 +6716,7 @@ App.MainAdminKerberosController = 
App.KerberosWizardStep4Controller.extend({
   self.loadClusterDescriptorConfigs().then(function() {
 dfd.resolve();
   }, function() {
-// if kerberos descriptor doesn't exist in cluster artifacts we 
have to kerberize cluster. 
+// if kerberos descriptor doesn't exist in cluster artifacts we 
have to kerberize cluster.
 // Show `Enable kerberos` button and set unsecure status.
 self.set('securityEnabled', false);
 dfd.resolve();
@@ -6746,12 +6763,12 @@ App.MainAdminKerberosController = 
App.KerberosWizardStep4Controller.extend({
 this.get('stepConfigs').clear();
 this._super(properties);
   },
-  
+
   /**
* Override App.KerberosWizardStep4Controller
-   * 
+   *
* @param {App.ServiceConfigProperty[]} configs
-   * @returns {App.ServiceConfigProperty[]} 
+   * @returns {App.ServiceConfigProperty[]}
*/
   prepareConfigProperties: function(configs) {
 var configProperties = configs.slice(0);
@@ -7330,7 +7347,7 @@ App.KerberosWizardStep2Controller = 
App.WizardStep7Controller.extend({
   },
 
   /**
-   * shows popup with to warn user  
+   * shows popup with to warn user
* @param primary
*/
   showConnectionInProgressPopup: function(primary) {
@@ -7480,13 +7497,13 @@ App.KerberosWizardStep4Controller = 
App.WizardStep7Controller.extend(App.AddSecu
   name: 'kerberosWizardStep4Controller',
 
   adminPropertyNames: [{name: 'admin_principal', displayName: 'Admin 
principal'}, {name: 'admin_password', displayName: 'Admin password'}],
-  
+
   clearStep: function() {
 this.set('isRecommendedLoaded', false);
 this.set('selectedService', null);
 this.set('stepConfigs', []);
   },
-  
+
   loadStep: function() {
 if (this.get('wizardController.skipConfigureIdentitiesStep')) {
   App.router.send('next');
@@ -7504,7 +7521,7 @@ App.KerberosWizardStep4Controller = 
App.WizardStep7Controller.extend(App.AddSecu
* Create service config object for Kerberos service.
*
* @param {App.ServiceConfigProperty[]} configs
-   * @returns {Em.Object} 
+   * @returns {Em.Object}
*/
   createServiceConfig: function(configs) {
 // Identity configs related to user principal
@@ -7560,7 +7577,7 @@ App.KerberosWizardStep4Controller = 
App.WizardStep7Controller.extend(App.AddSecu
 
   /**
* Prepare step configs using stack descriptor properties.
-   * 
+   *
* @param {App.ServiceConfigProperty[]} configs
*/
   setStepConfigs: function(configs) {
@@ -7675,7 +7692,7 @@ App.KerberosWizardStep4Controller = 
App.WizardStep7Controller.extend(App.AddSecu
 
   /**
* Sync up values between inherited property and its reference.
-   * 
+   *
* @param 

[2/5] incubator-eagle git commit: Copy external license content for six, Google Fonts, AdminLTE

2016-03-19 Thread hao
Copy external license content for six,Google Fonts,AdminLTE


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/e0529d4d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/e0529d4d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/e0529d4d

Branch: refs/heads/master
Commit: e0529d4d59287fa7d18b6d636a4d28b50b9ff408
Parents: 877ca93
Author: Hao Chen <h...@apache.org>
Authored: Wed Mar 16 17:09:23 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Wed Mar 16 17:09:23 2016 +0800

--
 LICENSE | 137 +--
 1 file changed, 125 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e0529d4d/LICENSE
--
diff --git a/LICENSE b/LICENSE
index 0be472c..92168b5 100755
--- a/LICENSE
+++ b/LICENSE
@@ -211,8 +211,28 @@ licenses.
 ==
 For AdminLTE:
 ==
-This product bundles AdminLTE, which is available under a
-"MIT" license. 
+This product bundles AdminLTE, which is available under a "MIT" license.
+
+The MIT License (MIT)
+
+Copyright (c) 2014-2016 Abdullah Almsaeed
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 For details, see https://github.com/almasaeed2010/AdminLTE/blob/master/LICENSE.
 
@@ -221,27 +241,120 @@ For Google Fonts: Source Sans Pro
 ==
 This product bundles "Google Fonts: Source Sans Pro", which is available under 
a "SIL Open Font License, 1.1" license. 
 
-For details, see https://www.google.com/fonts/attribution and 
http://scripts.sil.org/OFL.
+SIL OPEN FONT LICENSE
+
+Version 1.1 - 26 February 2007
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting — in part or in whole — any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to

[2/2] incubator-eagle git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-eagle

2016-03-19 Thread hao
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-eagle


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/45f7c706
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/45f7c706
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/45f7c706

Branch: refs/heads/master
Commit: 45f7c7067b8a44c6fe630b859998c1bbb707e65d
Parents: 34aec7e 8ce8d38
Author: Hao Chen <h...@apache.org>
Authored: Thu Mar 17 10:59:09 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Thu Mar 17 10:59:09 2016 +0800

--

--




[3/3] incubator-eagle git commit: EAGLE-202 Fix primary key length for mysql and add mysql webservice sample configuration

2016-03-19 Thread hao
EAGLE-202 Fix primary key length for mysql and add mysql webservice sample 
configuration

https://issues.apache.org/jira/browse/EAGLE-202

Author: @haoch <h...@apache.org>

Closes #127.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/c4bdb63f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/c4bdb63f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/c4bdb63f

Branch: refs/heads/master
Commit: c4bdb63f83e5d7d12924466e5eea778fbd061a8e
Parents: c6b76b9
Author: Hao Chen <h...@apache.org>
Authored: Fri Mar 18 17:56:36 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Fri Mar 18 18:03:18 2016 +0800

--
 .../jdbc/schema/JdbcEntitySchemaManager.java|3 +-
 .../lib/EAGLE/package/patches/app.js| 2689 +-
 .../src/main/resources/application-mysql.conf   |   28 +
 3 files changed, 1382 insertions(+), 1338 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/c4bdb63f/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/schema/JdbcEntitySchemaManager.java
--
diff --git 
a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/schema/JdbcEntitySchemaManager.java
 
b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/schema/JdbcEntitySchemaManager.java
index 8489da7..4cd1967 100644
--- 
a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/schema/JdbcEntitySchemaManager.java
+++ 
b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/schema/JdbcEntitySchemaManager.java
@@ -179,8 +179,7 @@ public class JdbcEntitySchemaManager implements 
IJdbcEntityDDLManager {
 pkColumn.setPrimaryKey(true);
 pkColumn.setRequired(true);
 pkColumn.setTypeCode(Types.VARCHAR);
-pkColumn.setSize("1024");
-//pkColumn.setSizeAndScale(1024,10240);
+//pkColumn.setSize("256");
 
 pkColumn.setDescription("eagle entity row-key column");
 table.addColumn(pkColumn);



[1/2] incubator-eagle git commit: Remove kafka-python from top level license as it's under Apache License

2016-03-19 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 8ce8d384c -> 45f7c7067


Remove kafka-python from top level license as it's under Apache License

Copy external license content for six,Google Fonts,AdminLTE

Add missed license header

Remove AdminLTE and Google fonts from top level LICENSE

Add AL for eagle-core/eagle-data-process/eagle-stream-pipeline/README.md


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/34aec7e9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/34aec7e9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/34aec7e9

Branch: refs/heads/master
Commit: 34aec7e9a99e231be74193f4446943ca49488f0f
Parents: ffd84fa
Author: Hao Chen <h...@apache.org>
Authored: Wed Mar 16 16:52:21 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Thu Mar 17 10:58:17 2016 +0800

--
 LICENSE | 56 +++-
 .../main/conf/sandbox-userprofile-topology.conf | 15 ++
 .../eagle-stream-pipeline/README.md | 19 +++
 .../webapp/app/partials/config/application.html | 18 +++
 .../webapp/app/partials/config/feature.html | 18 +++
 .../main/webapp/app/partials/config/site.html   | 18 +++
 .../src/main/webapp/app/partials/landing.html   | 18 +++
 7 files changed, 126 insertions(+), 36 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/34aec7e9/LICENSE
--
diff --git a/LICENSE b/LICENSE
index a40f8bd..a32cd9a 100755
--- a/LICENSE
+++ b/LICENSE
@@ -209,45 +209,29 @@ subcomponents is subject to the terms and conditions of 
the following
 licenses.
 
 ==
-For AdminLTE:
+For "six": eagle-external/hadoop_jmx_collector/lib/six/
 ==
-This product bundles AdminLTE, which is available under a
-"MIT" license. 
+This product bundles "six: a Python 2 and 3 compatibility library", which is 
available under
 
-For details, see https://github.com/almasaeed2010/AdminLTE/blob/master/LICENSE.
+"
+Copyright (c) 2010-2016 Benjamin Peterson
 
-==
-For Google Fonts: Source Sans Pro
-==
-This product bundles "Google Fonts: Source Sans Pro", which is available under 
a "SIL Open Font License, 1.1" license. 
-
-For details, see https://www.google.com/fonts/attribution and 
http://scripts.sil.org/OFL.
-
-==
-For kafka-python: Kafka Python client
-==
-This product bundles "kafka-python: Kafka Python client", which is available 
under a " Apache License Version 2.0" license. 
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
 
-For details, see https://github.com/dpkp/kafka-python and 
https://pypi.python.org/pypi/kafka-python.
-
-==
-For six: Python 2 and 3 compatibility library
-==
-This product bundles "six: a Python 2 and 3 compatibility library", which is 
avaiblable under Copyright (c) 2010-2014 Benjamin Peterson. 
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal 
in the Software without restriction, including without limitation the rights to 
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
of the Software, and to permit persons to whom the Software is furnished to do 
so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 

[1/3] incubator-eagle git commit: EAGLE-202 Fix primary key length for mysql and add mysql webservice sample configuration

2016-03-18 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/master c6b76b9d7 -> c4bdb63f8


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/c4bdb63f/eagle-webservice/src/main/resources/application-mysql.conf
--
diff --git a/eagle-webservice/src/main/resources/application-mysql.conf 
b/eagle-webservice/src/main/resources/application-mysql.conf
new file mode 100644
index 000..61a899f
--- /dev/null
+++ b/eagle-webservice/src/main/resources/application-mysql.conf
@@ -0,0 +1,28 @@
+# 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.
+
+eagle {
+   service {
+   storage-type="jdbc"
+   storage-adapter="mysql"
+   storage-username="eagle"
+   storage-password=eagle
+   storage-database=eagle
+   storage-connection-url="jdbc:mysql://localhost:3306/eagle"
+   storage-connection-props="encoding=UTF-8"
+   storage-driver-class="com.mysql.jdbc.Driver"
+   storage-connection-max=8
+   }
+}
\ No newline at end of file



[3/3] incubator-eagle git commit: EAGLE-190 JBDC metadata storage extension and support derby embedded database as default storage

2016-03-15 Thread hao
EAGLE-190 JBDC metadata storage extension and support derby embedded database 
as default storage

https://issues.apache.org/jira/browse/EAGLE-190

* Support embedded Derby in local/memory: The JDBC can support derby and
mysql completely, and use derby in memory by default, so that user don’t
have to install any additional dependencies even mysql to get started,
and also our unit test could easily pass without any tricky
modifications.
* Automatic DDL Schema Manager: JdbcEntitySchemaManager could
automatically create all required tables if not existing when
application is started.
* Fixed JDBC reserved field name like desc, group and so on
* Force update while inserting failed due to duplicated key exception

Closes #118.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/ffd84fa0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/ffd84fa0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/ffd84fa0

Branch: refs/heads/master
Commit: ffd84fa0e2dcf2fd3a8d444e1b589341789f6bcd
Parents: 4c1831a
Author: Hao Chen <h...@apache.org>
Authored: Wed Mar 16 13:17:10 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Wed Mar 16 13:17:10 2016 +0800

--
 .../src/main/bin/eagle-topology-init.sh |  32 +-
 eagle-assembly/src/main/conf/eagle-service.conf |  37 +--
 .../src/main/lib/jdbc/eagle-jdbc-mysql.sql  | 331 +++
 .../notification/email/AlertEmailGenerator.java |   8 +-
 .../testcases/TestAlertKafkaPlugin.java |   6 +-
 .../alert/notification/AlertEmailGenerator.java | 135 
 .../siddhi/SiddhiAlertAPIEntityRender.java  |   2 +-
 .../TestSiddhiStateSnapshotAndRestore.java  |   1 +
 .../eagle/ml/impl/MLAnomalyCallbackImpl.java|   2 +-
 .../eagle/alert/entity/AlertAPIEntity.java  |  23 +-
 .../alert/entity/AlertDataSourceEntity.java |  10 +-
 .../alert/entity/AlertDefinitionAPIEntity.java  |  13 +-
 .../eagle/alert/entity/AlertExecutorEntity.java |  14 +-
 .../eagle/alert/entity/AlertStreamEntity.java   |  16 +-
 .../entity/ApplicationDescServiceEntity.java|  24 +-
 .../alert/entity/FeatureDescServiceEntity.java  |  12 +-
 .../org/apache/eagle/common/DateTimeUtil.java   |   2 +-
 .../eagle/common/config/EagleConfigFactory.java |   4 +-
 .../eagle/common/metric/AlertContext.java   |  33 +-
 .../eagle/common/metric/TestAlertContext.java   |  39 +++
 .../eagle/log/entity/meta/EntityDefinition.java |   8 +
 .../entity/meta/EntityDefinitionManager.java|  12 +-
 .../entity/test/TestTimeSeriesAPIEntity.java|   8 +-
 .../eagle/storage/DataStorageManager.java   |   4 +-
 .../eagle/storage/operation/CompiledQuery.java  |   5 +
 .../eagle-query/eagle-storage-jdbc/pom.xml  |   4 +
 .../eagle/storage/jdbc/JdbcConstants.java   |   9 +
 .../apache/eagle/storage/jdbc/JdbcStorage.java  |  25 +-
 .../impl/EncodedRowkeyPrimaryKeyBuilder.java|  45 +++
 .../jdbc/conn/impl/TorqueStatementPeerImpl.java |   3 +-
 .../impl/ExpressionCriterionBuilder.java|  64 +++-
 .../criteria/impl/QueryCriteriaBuilder.java |  27 +-
 .../jdbc/entity/JdbcEntitySerDeserHelper.java   |  72 +++-
 .../storage/jdbc/entity/JdbcEntityUtils.java|  26 ++
 .../storage/jdbc/entity/JdbcEntityWriter.java   |   2 +-
 .../jdbc/entity/impl/JdbcEntityDeleterImpl.java |   2 +-
 .../jdbc/entity/impl/JdbcEntityReaderImpl.java  |   5 +-
 .../jdbc/entity/impl/JdbcEntityUpdaterImpl.java |  10 +-
 .../jdbc/entity/impl/JdbcEntityWriterImpl.java  |  27 +-
 .../jdbc/schema/IJdbcEntityDDLManager.java  |  26 ++
 .../jdbc/schema/JdbcEntityDefinition.java   |  82 +++--
 .../schema/JdbcEntityDefinitionManager.java |  54 ++-
 .../jdbc/schema/JdbcEntitySchemaManager.java| 224 +
 .../jdbc/schema/ddl/JdbcEntityDdlManager.java   |  24 --
 .../storage/jdbc/schema/ddl/package-info.java   |  24 --
 .../eagle/storage/jdbc/schema/package-info.java |  24 ++
 .../schema/serializer/DefaultJdbcSerDeser.java  |  29 +-
 .../jdbc/schema/serializer/JdbcSerDeser.java|  20 +-
 .../schema/serializer/JsonJdbcSerDeser.java |  10 +-
 .../eagle/storage/jdbc/TestJdbcStorage.java |  79 +++--
 .../jdbc/conn/TestConnectionFactory.java|  55 ---
 .../jdbc/criteria/TestQueryCriteriaBuilder.java |  13 +-
 .../jdbc/schema/TestJdbcEntityDefinition.java   |  33 ++
 .../schema/TestJdbcEntitySchemaManager.java |  27 ++
 .../src/test/resources/application-derby.conf   |  28 ++
 .../src/test/resources/application-mysql.conf   |  28 ++
 .../src/test/resources/application.conf |   6 +-
 .../resources/ddl/unittest_testtsentity.sql |  43 ---
 .../src/test/resources/log4j.properties |   2 +-
 .../test/resources/unittest.application.conf|  28 ++
 .../src/test/resources/unittest_ddl.derby.sql   |  34 ++
 .../src/test/resources/unittest_ddl.mysql

[2/3] incubator-eagle git commit: EAGLE-190 JBDC metadata storage extension and support derby embedded database as default storage

2016-03-15 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/ffd84fa0/eagle-core/eagle-query/eagle-storage-jdbc/pom.xml
--
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/pom.xml 
b/eagle-core/eagle-query/eagle-storage-jdbc/pom.xml
index c099e98..c37247e 100644
--- a/eagle-core/eagle-query/eagle-storage-jdbc/pom.xml
+++ b/eagle-core/eagle-query/eagle-storage-jdbc/pom.xml
@@ -51,5 +51,9 @@
 org.apache.torque
 torque-runtime
 
+
+org.apache.derby
+derby
+
 
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/ffd84fa0/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/JdbcConstants.java
--
diff --git 
a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/JdbcConstants.java
 
b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/JdbcConstants.java
index 7fb4dbd..af5be8f 100644
--- 
a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/JdbcConstants.java
+++ 
b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/JdbcConstants.java
@@ -16,6 +16,8 @@
  */
 package org.apache.eagle.storage.jdbc;
 
+import java.sql.Types;
+
 /**
  * Jdbc Storage Constants
  */
@@ -25,6 +27,9 @@ public class JdbcConstants {
 public static final String METRIC_NAME_COLUMN_NAME = "metric";
 public static final String ROW_KEY_COLUMN_NAME = "uuid";
 
+public static final int DEFAULT_TYPE_FOR_COMPLEX_TYPE = Types.BLOB;
+public static final int DEFAULT_VARCHAR_SIZE =1024;
+
 // Eagle JDBC Storage Configuration
 public final static String EAGLE_DB_USERNAME = 
"eagle.service.storage-username";
 public final static String EAGLE_DB_PASSWORD = 
"eagle.service.storage-password";
@@ -34,4 +39,8 @@ public class JdbcConstants {
 public final static String EAGLE_DATABASE= 
"eagle.service.storage-database";
 public final static String EAGLE_DRIVER_CLASS= 
"eagle.service.storage-driver-class";
 public final static String EAGLE_CONN_MAX_SIZE= 
"eagle.service.storage-connection-max";
+
+public static final boolean isReservedField(String columnName){
+return TIMESTAMP_COLUMN_NAME.equals(columnName) || 
METRIC_NAME_COLUMN_NAME.equals(columnName) || 
ROW_KEY_COLUMN_NAME.equals(columnName);
+}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/ffd84fa0/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/JdbcStorage.java
--
diff --git 
a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/JdbcStorage.java
 
b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/JdbcStorage.java
index 66b3c5a..c490dcd 100644
--- 
a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/JdbcStorage.java
+++ 
b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/JdbcStorage.java
@@ -30,13 +30,17 @@ import 
org.apache.eagle.storage.jdbc.entity.impl.JdbcEntityUpdaterImpl;
 import org.apache.eagle.storage.jdbc.entity.impl.JdbcEntityWriterImpl;
 import org.apache.eagle.storage.jdbc.schema.JdbcEntityDefinition;
 import org.apache.eagle.storage.jdbc.schema.JdbcEntityDefinitionManager;
+import org.apache.eagle.storage.jdbc.schema.JdbcEntitySchemaManager;
 import org.apache.eagle.storage.operation.CompiledQuery;
 import org.apache.eagle.storage.result.ModifyResult;
 import org.apache.eagle.storage.result.QueryResult;
+import org.apache.torque.ConstraintViolationException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
+import java.sql.SQLIntegrityConstraintViolationException;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
@@ -52,8 +56,9 @@ public class JdbcStorage extends DataStorageBase {
 try {
 JdbcEntityDefinitionManager.load();
 ConnectionManagerFactory.getInstance();
+JdbcEntitySchemaManager.getInstance().init();
 } catch (Exception e) {
-LOG.error("Failed to initialize connection manager",e);
+LOG.error("Failed to start connection manager",e);
 throw new IOException(e);
 }
 }
@@ -70,14 +75,14 @@ public class JdbcStorage extends DataStorageBase {
 } catch (Exception e) {
 LOG.error(e.getMessage(), e);
 result.setSuccess(false);
-throw new IOException(e);
+throw new IOException(e.getCause());
 }
 return result;
 }
 
 @Override
 public  ModifyResult create(List 
entities, EntityDefinition entityDefinition) 

[4/5] incubator-eagle git commit: update eagle version to 0.3.0-incubating.

2016-03-14 Thread hao
update eagle version to 0.3.0-incubating.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/cad5d965
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/cad5d965
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/cad5d965

Branch: refs/heads/master
Commit: cad5d965ca597fc52109a38f1d0b265abb7cbe45
Parents: 37c0fe1
Author: hdendukuri 
Authored: Tue Mar 8 11:41:29 2016 -0800
Committer: hdendukuri 
Committed: Tue Mar 8 11:41:29 2016 -0800

--
 eagle-assembly/pom.xml | 2 +-
 eagle-core/eagle-alert/eagle-alert-base/pom.xml| 2 +-
 eagle-core/eagle-alert/eagle-alert-notification-plugin/pom.xml | 2 +-
 eagle-core/eagle-alert/eagle-alert-process/pom.xml | 2 +-
 eagle-core/eagle-alert/eagle-alert-service/pom.xml | 2 +-
 eagle-core/eagle-alert/pom.xml | 2 +-
 eagle-core/eagle-data-process/eagle-job-common/pom.xml | 2 +-
 eagle-core/eagle-data-process/eagle-storm-jobrunning-spout/pom.xml | 2 +-
 eagle-core/eagle-data-process/eagle-stream-pipeline/pom.xml| 2 +-
 eagle-core/eagle-data-process/eagle-stream-process-api/pom.xml | 2 +-
 eagle-core/eagle-data-process/eagle-stream-process-base/pom.xml| 2 +-
 eagle-core/eagle-data-process/pom.xml  | 2 +-
 eagle-core/eagle-embed/eagle-embed-hbase/pom.xml   | 2 +-
 eagle-core/eagle-embed/eagle-embed-server/pom.xml  | 2 +-
 eagle-core/eagle-embed/pom.xml | 2 +-
 .../eagle-machinelearning/eagle-machinelearning-base/pom.xml   | 2 +-
 eagle-core/eagle-machinelearning/pom.xml   | 2 +-
 eagle-core/eagle-metric/pom.xml| 2 +-
 eagle-core/eagle-policy/eagle-policy-base/pom.xml  | 2 +-
 eagle-core/eagle-policy/pom.xml| 2 +-
 eagle-core/eagle-query/eagle-antlr/pom.xml | 2 +-
 eagle-core/eagle-query/eagle-audit-base/pom.xml| 2 +-
 eagle-core/eagle-query/eagle-client-base/pom.xml   | 2 +-
 eagle-core/eagle-query/eagle-common/pom.xml| 2 +-
 eagle-core/eagle-query/eagle-entity-base/pom.xml   | 2 +-
 eagle-core/eagle-query/eagle-query-base/pom.xml| 2 +-
 eagle-core/eagle-query/eagle-service-base/pom.xml  | 2 +-
 eagle-core/eagle-query/eagle-storage-base/pom.xml  | 2 +-
 eagle-core/eagle-query/eagle-storage-hbase/pom.xml | 2 +-
 eagle-core/eagle-query/eagle-storage-jdbc/pom.xml  | 2 +-
 eagle-core/eagle-query/pom.xml | 2 +-
 eagle-core/pom.xml | 2 +-
 eagle-examples/eagle-topology-example/pom.xml  | 2 +-
 eagle-examples/pom.xml | 2 +-
 eagle-external/eagle-log4jkafka/pom.xml| 2 +-
 eagle-external/pom.xml | 2 +-
 eagle-gc/pom.xml   | 2 +-
 eagle-hadoop-metric/pom.xml| 2 +-
 eagle-security/eagle-metric-collection/pom.xml | 2 +-
 eagle-security/eagle-security-common/pom.xml   | 2 +-
 eagle-security/eagle-security-hbase-securitylog/pom.xml| 2 +-
 eagle-security/eagle-security-hbase-web/pom.xml| 2 +-
 eagle-security/eagle-security-hdfs-auditlog/pom.xml| 2 +-
 eagle-security/eagle-security-hdfs-securitylog/pom.xml | 2 +-
 eagle-security/eagle-security-hdfs-web/pom.xml | 2 +-
 eagle-security/eagle-security-hive-web/pom.xml | 2 +-
 eagle-security/eagle-security-hive/pom.xml | 2 +-
 eagle-security/eagle-security-userprofile/common/pom.xml   | 2 +-
 eagle-security/eagle-security-userprofile/detection/pom.xml| 2 +-
 eagle-security/eagle-security-userprofile/pom.xml  | 2 +-
 eagle-security/eagle-security-userprofile/training/pom.xml | 2 +-
 eagle-security/pom.xml | 2 +-
 eagle-topology-assembly/pom.xml| 2 +-
 eagle-webservice/pom.xml   | 2 +-
 pom.xml| 2 +-
 55 files changed, 55 insertions(+), 55 deletions(-)
--



[3/5] incubator-eagle git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-eagle

2016-03-14 Thread hao
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-eagle


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/37c0fe16
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/37c0fe16
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/37c0fe16

Branch: refs/heads/master
Commit: 37c0fe16afbbd6bccb7c0d24b9afd464b807655d
Parents: 1b74ed6 6625897
Author: hdendukuri 
Authored: Tue Mar 8 11:05:34 2016 -0800
Committer: hdendukuri 
Committed: Tue Mar 8 11:05:34 2016 -0800

--
 README.md   |   6 +-
 eagle-assembly/src/main/bin/eagle-service.sh|   6 +
 .../src/main/bin/eagle-topology-init.sh |  67 +-
 .../bin/hdfs-securitylog-metadata-create.sh |   8 +-
 eagle-assembly/src/main/conf/eagle-service.conf |   6 +
 eagle-assembly/src/main/conf/ldap.properties|  25 +
 .../main/conf/sandbox-hadoopjmx-pipeline.conf   |   2 +-
 .../main/conf/sandbox-hadoopjmx-topology.conf   |   2 +-
 .../sandbox-hbaseSecurityLog-application.conf   |   2 +-
 .../conf/sandbox-hdfsAuditLog-application.conf  |   2 +-
 .../sandbox-hdfsSecurityLog-application.conf|   2 +-
 .../conf/sandbox-hiveQueryLog-application.conf  |   2 +-
 .../main/conf/sandbox-userprofile-topology.conf |   2 +-
 .../examples/hadoop-metric-policy-create.sh |   2 +-
 .../src/main/examples/sample-policy-create.sh   |   4 +-
 .../plugin/NotificationPluginManagerImpl.java   |   4 +-
 .../src/test/resources/application.conf |   2 +-
 .../dedup/AlertDeduplicationExecutorBase.java   |   2 +-
 .../notification/AlertNotificationExecutor.java |   6 +-
 .../siddhi/SiddhiAlertAPIEntityRender.java  |   6 +-
 .../eagle/alert/cep/TestSiddhiEvaluator.java|   4 +-
 .../dao/TestSiddhiStreamMetadataUtils.java  |   4 +-
 .../alert/dao/TestStreamDefinitionDAOImpl.java  |   2 +-
 .../policy/TestPolicyDistributionUpdater.java   |   4 +-
 .../src/test/resources/application.conf |   2 +-
 .../src/test/resources/unittest.conf|   2 +-
 .../src/test/resources/pipeline_1.conf  |   2 +-
 .../src/test/resources/pipeline_2.conf  |   2 +-
 .../src/test/resources/pipeline_3.conf  |   2 +-
 .../src/test/resources/pipeline_4.conf  |   2 +-
 .../src/test/resources/pipeline_5.conf  |   2 +-
 .../src/test/resources/application.conf |   2 +-
 .../eagle/ml/impl/MLAnomalyCallbackImpl.java|  10 +-
 .../src/test/resources/application.conf |   2 +-
 .../alert/entity/AlertDefinitionAPIEntity.java  |   2 +-
 .../eagle/alert/entity/AlertExecutorEntity.java |   2 +-
 .../eagle/alert/entity/AlertStreamEntity.java   |   2 +-
 .../alert/entity/AlertStreamSchemaEntity.java   |   2 +-
 .../eagle/policy/DynamicPolicyLoader.java   |   2 +-
 .../eagle/policy/dao/AlertExecutorDAO.java  |   4 +-
 .../eagle/policy/dao/AlertExecutorDAOImpl.java  |   8 +-
 .../eagle/policy/dao/AlertStreamDAOImpl.java|   4 +-
 .../eagle/policy/dao/AlertStreamSchemaDAO.java  |   2 +-
 .../policy/dao/AlertStreamSchemaDAOImpl.java|   4 +-
 .../eagle/policy/dao/PolicyDefinitionDAO.java   |   2 +-
 .../dao/PolicyDefinitionEntityDAOImpl.java  |   8 +-
 .../policy/executor/PolicyProcessExecutor.java  |   8 +-
 .../policy/siddhi/StreamMetadataManager.java|   4 +-
 .../apache/eagle/policy/dao/TestSchemaDao.java  |   2 +-
 .../eagle/audit/dao/ServiceAuditDAOImpl.java|   8 +-
 .../common/config/EagleConfigConstants.java |   3 +
 .../eagle/common/config/EagleConfigHelper.java  |   4 +-
 .../main/resources/application-plugintest.conf  |   2 +-
 .../src/main/resources/application.conf |   2 +-
 .../lib/EAGLE/package/scripts/actions.py|   6 +-
 .../eagle/log4j/kafka/KafkaLog4jAppender.scala  |   7 +-
 .../eagle/log4j/kafka/TestGenericLogKeyer.scala |  58 +-
 .../log4j/kafka/TestKafkaLog4jAppender.scala|  25 +-
 .../hadoop_jmx_collector/hadoop_ha_checker.py   |   2 +-
 .../hadoop_jmx_collector/hadoop_jmx_kafka.py|  11 +-
 .../gc/executor/GCMetricGeneratorExecutor.java  |   2 +-
 eagle-gc/src/main/resources/application.conf|   2 +-
 .../src/main/resources/application.conf |   2 +-
 .../resources/capacityused-policy-import.sh |   2 +-
 .../src/main/resources/hadoop-metric-init.sh|   4 +-
 .../src/main/resources/hastate-policy-import.sh |   2 +-
 .../lastcheckpointtime-policy-import.sh |   2 +-
 .../resources/missingblock-policy-import.sh |   2 +-
 .../main/resources/namenodelag-policy-import.sh |   2 +-
 .../main/resources/nodecount-policy-import.sh   |   2 +-
 .../resources/safemodecheck-policy-import.sh|   2 +-
 .../resolver/MetadataAccessConfigRepo.java  |  59 ++
 .../eagle/security/util/HadoopSecurityUtil.java |  46 ++
 .../eagle/security/util/LogParseUtil.java   

[2/5] incubator-eagle git commit: Updated licences to the files which had wrong copyright message.

2016-03-14 Thread hao
Updated licences to the files which had wrong copyright message.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/1b74ed64
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/1b74ed64
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/1b74ed64

Branch: refs/heads/master
Commit: 1b74ed649371518d00cc750d3aa72acb2b9bb8be
Parents: ce2d54c
Author: hdendukuri 
Authored: Mon Mar 7 15:32:13 2016 -0800
Committer: hdendukuri 
Committed: Mon Mar 7 15:32:13 2016 -0800

--
 .../siddhi/extension/ContainsIgnoreCaseExtension.java  | 13 +++--
 .../siddhi/extension/EqualsIgnoreCaseExtension.java| 13 +++--
 .../extension/RegexpIgnoreCaseFunctionExtension.java   | 13 +++--
 3 files changed, 21 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1b74ed64/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/extension/ContainsIgnoreCaseExtension.java
--
diff --git 
a/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/extension/ContainsIgnoreCaseExtension.java
 
b/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/extension/ContainsIgnoreCaseExtension.java
index 6d3a0e4..d80888e 100644
--- 
a/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/extension/ContainsIgnoreCaseExtension.java
+++ 
b/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/extension/ContainsIgnoreCaseExtension.java
@@ -1,11 +1,12 @@
 /*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * 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
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+ *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,

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1b74ed64/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/extension/EqualsIgnoreCaseExtension.java
--
diff --git 
a/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/extension/EqualsIgnoreCaseExtension.java
 
b/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/extension/EqualsIgnoreCaseExtension.java
index 3a622e2..b0c1662 100644
--- 
a/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/extension/EqualsIgnoreCaseExtension.java
+++ 
b/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/extension/EqualsIgnoreCaseExtension.java
@@ -1,11 +1,12 @@
 /*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * 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
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+ *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,

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1b74ed64/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/extension/RegexpIgnoreCaseFunctionExtension.java
--
diff --git 

[1/5] incubator-eagle git commit: Removed unnecessary copy right message in the templets.

2016-03-14 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 986a9996f -> c8c826b30


Removed unnecessary copy right message in the templets.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/ce2d54c1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/ce2d54c1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/ce2d54c1

Branch: refs/heads/master
Commit: ce2d54c1d9fc5d85d2d4a8b143f9a05f02f8d4d6
Parents: 1965b4a
Author: hdendukuri 
Authored: Mon Mar 7 15:14:01 2016 -0800
Committer: hdendukuri 
Committed: Mon Mar 7 15:14:01 2016 -0800

--
 .../src/main/resources/ALERT_DEFAULT.vm  | 2 +-
 .../eagle-alert-process/src/main/resources/ALERT_DEFAULT.vm  | 2 +-
 .../eagle-common/src/main/resources/templates/tec_alert.vm   | 4 ++--
 .../eagle-common/src/test/resources/templates/tec_alert.vm   | 4 ++--
 .../src/test/resources/templates/test_anomaly_alert.vm   | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/ce2d54c1/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/resources/ALERT_DEFAULT.vm
--
diff --git 
a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/resources/ALERT_DEFAULT.vm
 
b/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/resources/ALERT_DEFAULT.vm
index 4ceabad..887d759 100644
--- 
a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/resources/ALERT_DEFAULT.vm
+++ 
b/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/resources/ALERT_DEFAULT.vm
@@ -264,7 +264,7 @@



-   http://123.xyz.com/alerts/alertlist.html;>Copyright 2014 @ Hadoop 
Eagle
+   Apache Eagle




http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/ce2d54c1/eagle-core/eagle-alert/eagle-alert-process/src/main/resources/ALERT_DEFAULT.vm
--
diff --git 
a/eagle-core/eagle-alert/eagle-alert-process/src/main/resources/ALERT_DEFAULT.vm
 
b/eagle-core/eagle-alert/eagle-alert-process/src/main/resources/ALERT_DEFAULT.vm
index d4571f3..ca0f79c 100644
--- 
a/eagle-core/eagle-alert/eagle-alert-process/src/main/resources/ALERT_DEFAULT.vm
+++ 
b/eagle-core/eagle-alert/eagle-alert-process/src/main/resources/ALERT_DEFAULT.vm
@@ -255,7 +255,7 @@



-   http://123.xyz.com/alerts/alertlist.html;>Copyright 2014 @ Hadoop 
Eagle
+   Apache Eagle




http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/ce2d54c1/eagle-core/eagle-query/eagle-common/src/main/resources/templates/tec_alert.vm
--
diff --git 
a/eagle-core/eagle-query/eagle-common/src/main/resources/templates/tec_alert.vm 
b/eagle-core/eagle-query/eagle-common/src/main/resources/templates/tec_alert.vm
index 75c47d1..fa3eee5 100755
--- 
a/eagle-core/eagle-query/eagle-common/src/main/resources/templates/tec_alert.vm
+++ 
b/eagle-core/eagle-query/eagle-common/src/main/resources/templates/tec_alert.vm
@@ -104,8 +104,8 @@
   
 
   
- Copyright  2013 http://123.dc1.xyz.com:9090/eagle-web/ui/eagle.html;
-  target ="_blank" title="Hadoop Eagle">Hadoop Eagle
+ Apache Eagle Apache Eagle
   
 
   

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/ce2d54c1/eagle-core/eagle-query/eagle-common/src/test/resources/templates/tec_alert.vm
--
diff --git 
a/eagle-core/eagle-query/eagle-common/src/test/resources/templates/tec_alert.vm 
b/eagle-core/eagle-query/eagle-common/src/test/resources/templates/tec_alert.vm
index b2cf35b..2219ebf 100755
--- 
a/eagle-core/eagle-query/eagle-common/src/test/resources/templates/tec_alert.vm
+++ 

[5/5] incubator-eagle git commit: Merge branch 'master' of https://github.com/hdendukuri/incubator-eagle

2016-03-14 Thread hao
Merge branch 'master' of https://github.com/hdendukuri/incubator-eagle


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/c8c826b3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/c8c826b3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/c8c826b3

Branch: refs/heads/master
Commit: c8c826b3017983830a372aef66612569cd31201a
Parents: 986a999 cad5d96
Author: Hao Chen <h...@apache.org>
Authored: Mon Mar 14 18:38:23 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Mon Mar 14 18:38:23 2016 +0800

--

--




incubator-eagle git commit: Update dependency license file

2016-03-14 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/master bdd79e46c -> 986a9996f


Update dependency license file


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/986a9996
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/986a9996
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/986a9996

Branch: refs/heads/master
Commit: 986a9996f9d9e80f53f841bbfe61cffab566eacf
Parents: bdd79e4
Author: Hao Chen <h...@apache.org>
Authored: Mon Mar 14 16:35:32 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Mon Mar 14 16:35:32 2016 +0800

--
 LICENSE | 39 +++
 1 file changed, 35 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/986a9996/LICENSE
--
diff --git a/LICENSE b/LICENSE
index b474223..a40f8bd 100755
--- a/LICENSE
+++ b/LICENSE
@@ -212,11 +212,42 @@ licenses.
 For AdminLTE:
 ==
 This product bundles AdminLTE, which is available under a
-"MIT" license.  For details, see
-https://github.com/almasaeed2010/AdminLTE/blob/master/LICENSE.
+"MIT" license. 
+
+For details, see https://github.com/almasaeed2010/AdminLTE/blob/master/LICENSE.
 
 ==
 For Google Fonts: Source Sans Pro
 ==
-This product bundles "Google Fonts: Source Sans Pro", which is available under 
a "SIL Open Font License, 1.1" license.  
-For details, see https://www.google.com/fonts/attribution and 
http://scripts.sil.org/OFL
+This product bundles "Google Fonts: Source Sans Pro", which is available under 
a "SIL Open Font License, 1.1" license. 
+
+For details, see https://www.google.com/fonts/attribution and 
http://scripts.sil.org/OFL.
+
+==
+For kafka-python: Kafka Python client
+==
+This product bundles "kafka-python: Kafka Python client", which is available 
under a " Apache License Version 2.0" license. 
+
+For details, see https://github.com/dpkp/kafka-python and 
https://pypi.python.org/pypi/kafka-python.
+
+==
+For six: Python 2 and 3 compatibility library
+==
+This product bundles "six: a Python 2 and 3 compatibility library", which is 
avaiblable under Copyright (c) 2010-2014 Benjamin Peterson. 
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal 
in the Software without restriction, including without limitation the rights to 
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
of the Software, and to permit persons to whom the Software is furnished to do 
so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
+
+For details, see https://pypi.python.org/pypi/six
+
+
+



[3/3] incubator-eagle git commit: EAGLE-199 gzip lib/EAGLE/package/patches/app.js lib/EAGLE/package/patches/app.js.gz avoiding binary file in source code

2016-03-14 Thread hao
EAGLE-199 gzip lib/EAGLE/package/patches/app.js 
lib/EAGLE/package/patches/app.js.gz avoiding binary file in source code


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/bdd79e46
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/bdd79e46
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/bdd79e46

Branch: refs/heads/master
Commit: bdd79e46c3cc4a422065a7c829f5a9d320538332
Parents: 91b1956
Author: Hao Chen <h...@apache.org>
Authored: Mon Mar 14 14:21:44 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Mon Mar 14 14:21:44 2016 +0800

--
 eagle-external/eagle-ambari/bin/eagle-ambari.sh |  3 +
 .../lib/EAGLE/package/patches/app.js| 173797 
 .../lib/EAGLE/package/patches/app.js.gz |Bin 768285 -> 0 bytes
 3 files changed, 173800 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/bdd79e46/eagle-external/eagle-ambari/bin/eagle-ambari.sh
--
diff --git a/eagle-external/eagle-ambari/bin/eagle-ambari.sh 
b/eagle-external/eagle-ambari/bin/eagle-ambari.sh
index d392e61..63f831b 100755
--- a/eagle-external/eagle-ambari/bin/eagle-ambari.sh
+++ b/eagle-external/eagle-ambari/bin/eagle-ambari.sh
@@ -101,6 +101,9 @@ function install(){
 
# 3. Install eagle quick links
echo "> Installing eagle quick links"
+   if [ ! -e lib/EAGLE/package/patches/app.js.gz ];then
+   gzip lib/EAGLE/package/patches/app.js 
lib/EAGLE/package/patches/app.js.gz
+   fi
cp lib/EAGLE/package/patches/app.js.gz $AMBARI_SERVER_APP_JS
 
# create



[2/3] incubator-eagle git commit: EAGLE-199 gzip lib/EAGLE/package/patches/app.js lib/EAGLE/package/patches/app.js.gz avoiding binary file in source code

2016-03-14 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/bdd79e46/eagle-external/eagle-ambari/lib/EAGLE/package/patches/app.js
--
diff --git a/eagle-external/eagle-ambari/lib/EAGLE/package/patches/app.js 
b/eagle-external/eagle-ambari/lib/EAGLE/package/patches/app.js
new file mode 100644
index 000..ee8bd57
--- /dev/null
+++ b/eagle-external/eagle-ambari/lib/EAGLE/package/patches/app.js
@@ -0,0 +1,173797 @@
+(function(/*! Brunch !*/) {
+  'use strict';
+
+  var globals = typeof window !== 'undefined' ? window : global;
+  if (typeof globals.require === 'function') return;
+
+  var modules = {};
+  var cache = {};
+
+  var has = function(object, name) {
+return ({}).hasOwnProperty.call(object, name);
+  };
+
+  var expand = function(root, name) {
+var results = [], parts, part;
+if (/^\.\.?(\/|$)/.test(name)) {
+  parts = [root, name].join('/').split('/');
+} else {
+  parts = name.split('/');
+}
+for (var i = 0, length = parts.length; i < length; i++) {
+  part = parts[i];
+  if (part === '..') {
+results.pop();
+  } else if (part !== '.' && part !== '') {
+results.push(part);
+  }
+}
+return results.join('/');
+  };
+
+  var dirname = function(path) {
+return path.split('/').slice(0, -1).join('/');
+  };
+
+  var localRequire = function(path) {
+return function(name) {
+  var dir = dirname(path);
+  var absolute = expand(dir, name);
+  return globals.require(absolute, path);
+};
+  };
+
+  var initModule = function(name, definition) {
+var module = {id: name, exports: {}};
+cache[name] = module;
+definition(module.exports, localRequire(name), module);
+return module.exports;
+  };
+
+  var require = function(name, loaderPath) {
+var path = expand(name, '.');
+if (loaderPath == null) loaderPath = '/';
+
+if (has(cache, path)) return cache[path].exports;
+if (has(modules, path)) return initModule(path, modules[path]);
+
+var dirIndex = expand(path, './index');
+if (has(cache, dirIndex)) return cache[dirIndex].exports;
+if (has(modules, dirIndex)) return initModule(dirIndex, modules[dirIndex]);
+
+throw new Error('Cannot find module "' + name + '" from '+ '"' + 
loaderPath + '"');
+  };
+
+  var define = function(bundle, fn) {
+if (typeof bundle === 'object') {
+  for (var key in bundle) {
+if (has(bundle, key)) {
+  modules[key] = bundle[key];
+}
+  }
+} else {
+  modules[bundle] = fn;
+}
+  };
+
+  var list = function() {
+var result = [];
+for (var item in modules) {
+  if (has(modules, item)) {
+result.push(item);
+  }
+}
+return result;
+  };
+
+  globals.require = require;
+  globals.require.define = define;
+  globals.require.register = define;
+  globals.require.list = list;
+  globals.require.brunch = true;
+})();
+require.register("app", function(exports, require, module) {
+/**
+ * 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.
+ */
+
+// Application bootstrapper
+require('utils/ember_reopen');
+var stringUtils = require('utils/string_utils');
+
+module.exports = Em.Application.create({
+  name: 'Ambari Web',
+  rootElement: '#wrapper',
+
+  store: DS.Store.create({
+revision: 4,
+adapter: DS.FixtureAdapter.create({
+  simulateRemoteResponse: false
+}),
+typeMaps: {},
+recordCache: []
+  }),
+  isAdmin: false,
+  isOperator: false,
+
+  /**
+   * state of stack upgrade process
+   * states:
+   *  - INIT
+   *  - PENDING
+   *  - IN_PROGRESS
+   *  - HOLDING
+   *  - COMPLETED
+   * @type {String}
+   */
+  upgradeState: 'INIT',
+
+  /**
+   * flag is true when upgrade process is running
+   * @returns {boolean}
+   */
+  upgradeInProgress: function() {
+return ["IN_PROGRESS"].contains(this.get('upgradeState'));
+  }.property('upgradeState'),
+
+  /**
+   * flag is true when upgrade process is waiting for user action
+   * to procced, retry, perform manual steps etc.
+   * @returns {boolean}
+   */
+  upgradeHolding: function() {
+return this.get('upgradeState').contains("HOLDING");
+  }.property('upgradeState'),
+
+  /**
+  

[1/3] [incubator-eagle] Git Push Summary

2016-03-14 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 91b195650 -> bdd79e46c


incubator-eagle git commit: EAGLE-186 Support hadoop.namenode.fsnamesystemstate.capacityusage and fix resource manager metric bug

2016-03-04 Thread hao
Repository: incubator-eagle
Updated Branches:
  refs/heads/master d394a8e34 -> a641aca15


EAGLE-186 Support hadoop.namenode.fsnamesystemstate.capacityusage and fix 
resource manager metric bug

https://issues.apache.org/jira/browse/EAGLE-186

Sign-off: Hao Chen <h...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/a641aca1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/a641aca1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/a641aca1

Branch: refs/heads/master
Commit: a641aca155531edaf4e6ab843d6aa2c7f4eff022
Parents: d394a8e
Author: Hao Chen <h...@apache.org>
Authored: Fri Mar 4 09:52:01 2016 -0800
Committer: Hao Chen <h...@apache.org>
Committed: Fri Mar 4 09:52:01 2016 -0800

--
 eagle-external/hadoop_jmx_collector/hadoop_ha_checker.py |  2 +-
 eagle-external/hadoop_jmx_collector/hadoop_jmx_kafka.py  | 11 ++-
 2 files changed, 11 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a641aca1/eagle-external/hadoop_jmx_collector/hadoop_ha_checker.py
--
diff --git a/eagle-external/hadoop_jmx_collector/hadoop_ha_checker.py 
b/eagle-external/hadoop_jmx_collector/hadoop_ha_checker.py
index 2a5096b..c33b327 100644
--- a/eagle-external/hadoop_jmx_collector/hadoop_ha_checker.py
+++ b/eagle-external/hadoop_jmx_collector/hadoop_ha_checker.py
@@ -86,7 +86,7 @@ class HadoopRMHAChecker(MetricCollector):
 total_count = len(hosts)
 
 self.collect({
-"component": "namenode",
+"component": "resourcemanager",
 "metric": "hadoop.resourcemanager.hastate.total.count",
 "value": total_count
 })

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a641aca1/eagle-external/hadoop_jmx_collector/hadoop_jmx_kafka.py
--
diff --git a/eagle-external/hadoop_jmx_collector/hadoop_jmx_kafka.py 
b/eagle-external/hadoop_jmx_collector/hadoop_jmx_kafka.py
index 8837c30..286d0be 100644
--- a/eagle-external/hadoop_jmx_collector/hadoop_jmx_kafka.py
+++ b/eagle-external/hadoop_jmx_collector/hadoop_jmx_kafka.py
@@ -56,6 +56,14 @@ class MemortUsageMetric(JmxMetricListener):
 self.collector.on_bean_kv(self.PREFIX, "memheapcommittedusage", 
memheapcommittedusage)
 
 
+class NNCapacityUsageMetric(JmxMetricListener):
+PREFIX = "hadoop.namenode.fsnamesystemstate"
+
+def on_bean(self, bean):
+if bean["name"] == "Hadoop:service=NameNode,name=FSNamesystemState":
+capacityusage = round(float(bean['CapacityUsed']) / 
float(bean['CapacityTotal']) * 100, 2)
+self.collector.on_bean_kv(self.PREFIX, "capacityusage", 
capacityusage)
+
 class JournalTransactionInfoMetric(JmxMetricListener):
 PREFIX = "hadoop.namenode.journaltransaction"
 
@@ -74,6 +82,7 @@ if __name__ == '__main__':
 NNSafeModeMetric(),
 NNHAMetric(),
 MemortUsageMetric(),
-JournalTransactionInfoMetric()
+JournalTransactionInfoMetric(),
+NNCapacityUsageMetric()
 )
 Runner.run(collector)



[34/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-data-process/eagle-stream-process-api/src/test/java/org/apache/eagle/datastream/TestSimpleAggregateExecutor.java
--
diff --git 
a/eagle-core/eagle-data-process/eagle-stream-process-api/src/test/java/org/apache/eagle/datastream/TestSimpleAggregateExecutor.java
 
b/eagle-core/eagle-data-process/eagle-stream-process-api/src/test/java/org/apache/eagle/datastream/TestSimpleAggregateExecutor.java
deleted file mode 100644
index 0d0638d..000
--- 
a/eagle-core/eagle-data-process/eagle-stream-process-api/src/test/java/org/apache/eagle/datastream/TestSimpleAggregateExecutor.java
+++ /dev/null
@@ -1,73 +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.datastream;
-
-import com.typesafe.config.Config;
-import com.typesafe.config.ConfigFactory;
-import junit.framework.Assert;
-import org.apache.eagle.dataproc.impl.aggregate.SimpleAggregateExecutor;
-import org.apache.eagle.dataproc.impl.aggregate.entity.AggregateEntity;
-import org.junit.Test;
-import scala.Tuple2;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * Created on 1/20/16.
- */
-public class TestSimpleAggregateExecutor {
-
-@Test
-public void test() throws Exception {
-SimpleAggregateExecutor sae = new SimpleAggregateExecutor(new 
String[]{"s1"},
-"define stream s1(eagleAlertContext object, timestamp long, 
metric string);" +
-" @info(name='query')" +
-" from s1 select * insert into tmp;"
-,
-"siddhiCEPEngine",
-0,
-1);
-
-Config config = ConfigFactory.empty();
-sae.prepareConfig(config);
-sae.init();
-
-List tuple = new ArrayList<>(3);
-tuple.add(0, "groupbykey");
-tuple.add(1, "s1");
-SortedMap value = new TreeMap();
-value.put("timestamp", System.currentTimeMillis());
-value.put("metric", "name-of-the-metric");
-tuple.add(2, value);
-
-final AtomicInteger count = new AtomicInteger();
-sae.flatMap(tuple, new Collector>(){
-@Override
-public void collect(Tuple2 
stringAggregateEntityTuple2) {
-System.out.print(stringAggregateEntityTuple2._1());
-count.incrementAndGet();
-}
-});
-
-Thread.sleep(3000);
-Assert.assertEquals(1, count.get());
-}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-data-process/eagle-stream-process-api/src/test/java/org/apache/eagle/datastream/TestStreamAggregate.java
--
diff --git 
a/eagle-core/eagle-data-process/eagle-stream-process-api/src/test/java/org/apache/eagle/datastream/TestStreamAggregate.java
 
b/eagle-core/eagle-data-process/eagle-stream-process-api/src/test/java/org/apache/eagle/datastream/TestStreamAggregate.java
deleted file mode 100644
index ed5d705..000
--- 
a/eagle-core/eagle-data-process/eagle-stream-process-api/src/test/java/org/apache/eagle/datastream/TestStreamAggregate.java
+++ /dev/null
@@ -1,152 +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 

[40/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-data-process/eagle-storm-jobrunning-spout/src/main/java/org/apache/eagle/jobrunning/counter/parser/JobCountersParser.java
--
diff --git 
a/eagle-core/eagle-data-process/eagle-storm-jobrunning-spout/src/main/java/org/apache/eagle/jobrunning/counter/parser/JobCountersParser.java
 
b/eagle-core/eagle-data-process/eagle-storm-jobrunning-spout/src/main/java/org/apache/eagle/jobrunning/counter/parser/JobCountersParser.java
deleted file mode 100644
index d0f3ae9..000
--- 
a/eagle-core/eagle-data-process/eagle-storm-jobrunning-spout/src/main/java/org/apache/eagle/jobrunning/counter/parser/JobCountersParser.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.jobrunning.counter.parser;
-
-import java.util.Map;
-
-import org.jsoup.nodes.Document;
-
-public interface JobCountersParser {
-   
-   Map parse(Document doc);
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-data-process/eagle-storm-jobrunning-spout/src/main/java/org/apache/eagle/jobrunning/counter/parser/JobCountersParserImpl.java
--
diff --git 
a/eagle-core/eagle-data-process/eagle-storm-jobrunning-spout/src/main/java/org/apache/eagle/jobrunning/counter/parser/JobCountersParserImpl.java
 
b/eagle-core/eagle-data-process/eagle-storm-jobrunning-spout/src/main/java/org/apache/eagle/jobrunning/counter/parser/JobCountersParserImpl.java
deleted file mode 100644
index f098c54..000
--- 
a/eagle-core/eagle-data-process/eagle-storm-jobrunning-spout/src/main/java/org/apache/eagle/jobrunning/counter/parser/JobCountersParserImpl.java
+++ /dev/null
@@ -1,44 +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.jobrunning.counter.parser;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.jsoup.nodes.Document;
-import org.jsoup.nodes.Element;
-import org.jsoup.select.Elements;
-
-public class JobCountersParserImpl implements JobCountersParser {
-
-   @Override
-   public Map parse(Document doc) {
-   Elements elements = doc.select("a[href*=singlejobcounter]");
-   Iterator iter = elements.iterator();
-   Map counters = new HashMap();
-   while(iter.hasNext()) {
-   Element element = iter.next().parent();
-   String metricName = element.text();
-   long metricValue = 
Long.parseLong(element.nextElementSibling()
-  
.nextElementSibling().nextElementSibling().text()
-   
.replace(",", "").trim());
-   counters.put(metricName, metricValue);
-   }
-   return counters;
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-data-process/eagle-storm-jobrunning-spout/src/main/java/org/apache/eagle/jobrunning/crawler/ConfigWorkTask.java
--
diff --git 

[33/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-data-process/eagle-stream-process-base/src/main/java/org/apache/eagle/partition/PartitionStrategyImpl.java
--
diff --git 
a/eagle-core/eagle-data-process/eagle-stream-process-base/src/main/java/org/apache/eagle/partition/PartitionStrategyImpl.java
 
b/eagle-core/eagle-data-process/eagle-stream-process-base/src/main/java/org/apache/eagle/partition/PartitionStrategyImpl.java
deleted file mode 100644
index eacefd5..000
--- 
a/eagle-core/eagle-data-process/eagle-stream-process-base/src/main/java/org/apache/eagle/partition/PartitionStrategyImpl.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.partition;
-
-import org.apache.commons.lang3.time.DateUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.Map;
-
-public class PartitionStrategyImpl implements PartitionStrategy {
-
-public DataDistributionDao dao;
-public PartitionAlgorithm algorithm;
-public Map routingTable;
-public long lastRefreshTime;
-public long refreshInterval;
-public long timeRange;
-public static long DEFAULT_TIME_RANGE = 2 * DateUtils.MILLIS_PER_DAY;
-public static long DEFAULT_REFRESH_INTERVAL = 2 * 
DateUtils.MILLIS_PER_HOUR;
-private final Logger LOG = 
LoggerFactory.getLogger(PartitionStrategyImpl.class);
-
-public PartitionStrategyImpl(DataDistributionDao dao, PartitionAlgorithm 
algorithm, long refreshInterval, long timeRange) {
-this.dao = dao;
-this.algorithm = algorithm;
-this.refreshInterval = refreshInterval;
-this.timeRange = timeRange;
-}
-
-public PartitionStrategyImpl(DataDistributionDao dao, PartitionAlgorithm 
algorithm) {
-this(dao, algorithm, DEFAULT_REFRESH_INTERVAL, DEFAULT_TIME_RANGE);
-}
-
-public boolean needRefresh() {
-if (System.currentTimeMillis() > lastRefreshTime + refreshInterval) {
-lastRefreshTime = System.currentTimeMillis();
-return true;
-}
-return false;
-}
-
-public Map generateRoutingTable(int buckNum) {
-try {
-long currentTime = System.currentTimeMillis();
-List weights = dao.fetchDataDistribution(currentTime - 
timeRange, currentTime);
-routingTable = algorithm.partition(weights, buckNum);
-return routingTable;
-}
-catch (Exception ex) {
-throw new RuntimeException(ex);
-}
-}
-
-@Override
-public int balance(String key, int buckNum) {
-if (needRefresh()) {
-LOG.info("Going to refresh routing table");
-routingTable = generateRoutingTable(buckNum);
-LOG.info("Finish refresh routing table");
-}
-if (routingTable.containsKey(key)) {
-return routingTable.get(key);
-}
-else {
-return Math.abs(key.hashCode()) % buckNum;
-}
-}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-data-process/eagle-stream-process-base/src/main/java/org/apache/eagle/partition/Weight.java
--
diff --git 
a/eagle-core/eagle-data-process/eagle-stream-process-base/src/main/java/org/apache/eagle/partition/Weight.java
 
b/eagle-core/eagle-data-process/eagle-stream-process-base/src/main/java/org/apache/eagle/partition/Weight.java
deleted file mode 100644
index 14d005d..000
--- 
a/eagle-core/eagle-data-process/eagle-stream-process-base/src/main/java/org/apache/eagle/partition/Weight.java
+++ /dev/null
@@ -1,30 +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 

[31/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-metric/src/main/java/org/apache/eagle/metric/reportor/EagleServiceReporterMetricListener.java
--
diff --git 
a/eagle-core/eagle-metric/src/main/java/org/apache/eagle/metric/reportor/EagleServiceReporterMetricListener.java
 
b/eagle-core/eagle-metric/src/main/java/org/apache/eagle/metric/reportor/EagleServiceReporterMetricListener.java
deleted file mode 100644
index 49a8cdc..000
--- 
a/eagle-core/eagle-metric/src/main/java/org/apache/eagle/metric/reportor/EagleServiceReporterMetricListener.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.metric.reportor;
-
-import org.apache.eagle.log.entity.GenericMetricEntity;
-import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
-import org.apache.eagle.service.client.impl.EagleServiceClientImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class EagleServiceReporterMetricListener implements EagleMetricListener{
-
-private EagleServiceClientImpl client;
-private static final Logger LOG = 
LoggerFactory.getLogger(EagleServiceReporterMetricListener.class);
-
-public EagleServiceReporterMetricListener(String host, int port, String 
username, String password) {
-client = new EagleServiceClientImpl(host, port, username, password);
-}
-
-public EagleServiceReporterMetricListener(String host, int port) {
-client = new EagleServiceClientImpl(host, port, null, null);
-}
-
-public void onMetricFlushed(List metrics) {
-List entities = new ArrayList<>();
-for (EagleMetric metric : metrics) {
-String metricName = metric.name;
-entities.add(MetricEntityAdaptor.convert(metricName, metric));
-}
-try {
-int total = entities.size();
-GenericServiceAPIResponseEntity response = 
client.create(entities, GenericMetricEntity.GENERIC_METRIC_SERVICE);
-if(response.isSuccess()) {
-LOG.info("Wrote " + total + " entities to service");
-}else{
-LOG.error("Failed to write " + total + " entities to service, 
due to server exception: "+ response.getException());
-}
-}
-catch (Exception ex) {
-LOG.error("Got exception while writing entities: ", ex);
-}
-}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-metric/src/main/java/org/apache/eagle/metric/reportor/IEagleMetric.java
--
diff --git 
a/eagle-core/eagle-metric/src/main/java/org/apache/eagle/metric/reportor/IEagleMetric.java
 
b/eagle-core/eagle-metric/src/main/java/org/apache/eagle/metric/reportor/IEagleMetric.java
deleted file mode 100644
index 43f8092..000
--- 
a/eagle-core/eagle-metric/src/main/java/org/apache/eagle/metric/reportor/IEagleMetric.java
+++ /dev/null
@@ -1,40 +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.metric.reportor;
-
-import com.codahale.metrics.Gauge;
-
-/**
- * It's just a workaround to extends Gauge instead of Metric interface
- * For 

[41/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-alert/eagle-alert-service/src/main/java/org/apache/eagle/service/alert/SiddhiAlertPolicyValidateProvider.java
--
diff --git 
a/eagle-core/eagle-alert/eagle-alert-service/src/main/java/org/apache/eagle/service/alert/SiddhiAlertPolicyValidateProvider.java
 
b/eagle-core/eagle-alert/eagle-alert-service/src/main/java/org/apache/eagle/service/alert/SiddhiAlertPolicyValidateProvider.java
deleted file mode 100644
index 43bcfe2..000
--- 
a/eagle-core/eagle-alert/eagle-alert-service/src/main/java/org/apache/eagle/service/alert/SiddhiAlertPolicyValidateProvider.java
+++ /dev/null
@@ -1,133 +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;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.eagle.service.generic.GenericEntityServiceResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.wso2.siddhi.core.ExecutionPlanRuntime;
-import org.wso2.siddhi.core.SiddhiManager;
-
-import org.apache.eagle.policy.common.Constants;
-import org.apache.eagle.alert.entity.AlertStreamSchemaEntity;
-import org.apache.eagle.policy.siddhi.AttributeType;
-import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
-import org.apache.eagle.common.DateTimeUtil;
-import com.fasterxml.jackson.databind.Module;
-import com.fasterxml.jackson.databind.jsontype.NamedType;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-
-public class SiddhiAlertPolicyValidateProvider extends 
AlertPolicyValidateProvider{
-
-   public String type;
-   public List streamNames;
-   public String policyDefinition; 
-   public static Logger LOG = 
LoggerFactory.getLogger(PolicyValidateResource.class);
-   public static final String EXECUTION_PLAN_NAME = "query";
-   
-   @SuppressWarnings({"unchecked"})
-   public String getStreamDef(String streamName) {
-   GenericEntityServiceResource resource = new 
GenericEntityServiceResource();
-   String startTime = "1969-01-01 00:00:00";
-   String endTime = 
DateTimeUtil.millisecondsToHumanDateWithSeconds(Long.MAX_VALUE);
-   int pageSize = 1000;
-   String query = 
Constants.ALERT_STREAM_SCHEMA_SERVICE_ENDPOINT_NAME + "[@streamName=\"" + 
streamName + "\"]{*}";
-   GenericServiceAPIResponseEntity 
streamResponse = resource.search(query, startTime, endTime, pageSize, null, 
false, false, 0L, 0, true, 0, null, false);
-   List list = streamResponse.getObj();
-   
-   Map map = new HashMap();
-   for(AlertStreamSchemaEntity entity : list){
-   map.put(entity.getTags().get("attrName"), 
entity.getAttrType());
-   }
-   StringBuilder sb = new StringBuilder();
-   sb.append("dataobj object,");
-   for(Map.Entry entry : map.entrySet()){
-   String attrName = entry.getKey();
-   sb.append(attrName);
-   sb.append(" ");
-   String attrType = entry.getValue();
-   
if(attrType.equalsIgnoreCase(AttributeType.STRING.name())){
-   sb.append("string");
-   }else 
if(attrType.equalsIgnoreCase(AttributeType.INTEGER.name())){
-   sb.append("int");
-   }else 
if(attrType.equalsIgnoreCase(AttributeType.LONG.name())){
-   sb.append("long");
-   }else 
if(attrType.equalsIgnoreCase(AttributeType.BOOL.name())){
-   sb.append("bool");
-   }else{
-   LOG.error("AttrType is not recognized, ignore : 
" + attrType);
-   }
-   sb.append(",");
-   }
-   if(sb.length() > 0){
-   sb.deleteCharAt(sb.length()-1);
-   

[36/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-data-process/eagle-stream-process-api/src/main/scala/org/apache/eagle/datastream/core/AbstractTopologyExecutor.scala
--
diff --git 
a/eagle-core/eagle-data-process/eagle-stream-process-api/src/main/scala/org/apache/eagle/datastream/core/AbstractTopologyExecutor.scala
 
b/eagle-core/eagle-data-process/eagle-stream-process-api/src/main/scala/org/apache/eagle/datastream/core/AbstractTopologyExecutor.scala
deleted file mode 100644
index 1e1664a..000
--- 
a/eagle-core/eagle-data-process/eagle-stream-process-api/src/main/scala/org/apache/eagle/datastream/core/AbstractTopologyExecutor.scala
+++ /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.
- */
-package org.apache.eagle.datastream.core
-
-trait AbstractTopologyExecutor {
-  def execute
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-data-process/eagle-stream-process-api/src/main/scala/org/apache/eagle/datastream/core/Configuration.scala
--
diff --git 
a/eagle-core/eagle-data-process/eagle-stream-process-api/src/main/scala/org/apache/eagle/datastream/core/Configuration.scala
 
b/eagle-core/eagle-data-process/eagle-stream-process-api/src/main/scala/org/apache/eagle/datastream/core/Configuration.scala
deleted file mode 100644
index e3f3050..000
--- 
a/eagle-core/eagle-data-process/eagle-stream-process-api/src/main/scala/org/apache/eagle/datastream/core/Configuration.scala
+++ /dev/null
@@ -1,74 +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.datastream.core
-
-import com.typesafe.config.{Config, _}
-
-import scala.reflect.runtime.universe._
-
-/**
- * @since  12/4/15
- */
-case class Configuration(private var config:Config) extends Serializable{
-  def get:Config = config
-
-  def set[T<:AnyRef](key:String,value:T): Unit = {
-config = config.withValue(key,ConfigValueFactory.fromAnyRef(value))
-  }
-
-  /**
-   *
-   * @param key config key
-   * @param default default value
-   * @tparam T return type
-   * @return
-   */
-  def get[T](key:String,default:T=null)(implicit tag:TypeTag[T]):T = {
-if(get.hasPath(key)) {
-  get(key)
-} else default
-  }
-
-  def get[T](key:String)(implicit tag: TypeTag[T]):T = tag.tpe match {
-case STRING_TYPE => config.getString(key).asInstanceOf[T]
-case TypeTag.Double => get.getDouble(key).asInstanceOf[T]
-case TypeTag.Long => get.getLong(key).asInstanceOf[T]
-case TypeTag.Int => get.getInt(key).asInstanceOf[T]
-case TypeTag.Byte => get.getBytes(key).asInstanceOf[T]
-case TypeTag.Boolean => get.getBoolean(key).asInstanceOf[T]
-case NUMBER_TYPE => get.getNumber(key).asInstanceOf[T]
-case OBJECT_TYPE => get.getObject(key).asInstanceOf[T]
-case VALUE_TYPE => get.getValue(key).asInstanceOf[T]
-case ANY_REF_TYPE => get.getAnyRef(key).asInstanceOf[T]
-case INT_LIST_TYPE => get.getIntList(key).asInstanceOf[T]
-case DOUBLE_LIST_TYPE => get.getDoubleList(key).asInstanceOf[T]
-case BOOL_LIST_TYPE => get.getBooleanList(key).asInstanceOf[T]
-case LONG_LIST_TYPE => get.getLongList(key).asInstanceOf[T]
-case _ => throw new UnsupportedOperationException(s"$tag is not supported 
yet")
-  }
-
-  val STRING_TYPE = typeOf[String]
-  val 

[38/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-data-process/eagle-stream-pipeline/src/main/scala/org/apache/eagle/stream/pipeline/extension/ModuleManager.scala
--
diff --git 
a/eagle-core/eagle-data-process/eagle-stream-pipeline/src/main/scala/org/apache/eagle/stream/pipeline/extension/ModuleManager.scala
 
b/eagle-core/eagle-data-process/eagle-stream-pipeline/src/main/scala/org/apache/eagle/stream/pipeline/extension/ModuleManager.scala
deleted file mode 100644
index 2174560..000
--- 
a/eagle-core/eagle-data-process/eagle-stream-pipeline/src/main/scala/org/apache/eagle/stream/pipeline/extension/ModuleManager.scala
+++ /dev/null
@@ -1,186 +0,0 @@
-package org.apache.eagle.stream.pipeline.extension
-
-import java.util.Properties
-import java.util.concurrent.atomic.AtomicBoolean
-
-import com.typesafe.config.ConfigFactory
-import org.apache.eagle.dataproc.impl.storm.kafka.KafkaSourcedSpoutProvider
-import org.apache.eagle.datastream.core._
-import org.apache.eagle.partition.PartitionStrategy
-import org.apache.eagle.stream.pipeline.parser.Processor
-import org.apache.kafka.clients.producer.{Callback, KafkaProducer, 
ProducerRecord, RecordMetadata}
-//import org.slf4j.LoggerFactory
-
-import scala.collection.JavaConverters._
-
-/**
-  * 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.
-  */
-
-
-object ModuleManager{
-  def getModuleMapperByType(moduleType:String):ModuleMapper = {
-classOfProcessorMapping(moduleType)
-  }
-
-  def findModuleType(moduleType:String):Boolean = 
classOfProcessorMapping.contains(moduleType)
-
-  val classOfProcessorMapping = Map[String,ModuleMapper](
-"KafkaSource" -> KafkaSourceStreamProducer,
-"KafkaSink" -> KafkaSinkStreamProducer,
-"Alert" -> AlertStreamProducer,
-"Persistence" -> PersistProducer,
-"Aggregator" -> AggregatorProducer,
-"Console" -> ConsoleStreamProducer
-  )
-}
-
-trait ModuleMapper{
-  def getType:String
-  def map(module:Processor):StreamProducer[Any]
-}
-object KafkaSourceStreamProducer extends ModuleMapper{
-  def getType = "KafkaSource"
-  override def map(module:Processor): StreamProducer[Any] = {
-val config = module.getConfig
-new StormSourceProducer[Any](new 
KafkaSourcedSpoutProvider(null).getSpout(ConfigFactory.parseMap(config.asJava)))
-  }
-}
-object KafkaSinkStreamProducer extends ModuleMapper{
-  def getType = "KafkaSink"
-  override def map(module:Processor): StreamProducer[Any] = {
-val config = module.getConfig
-ForeachProducer[AnyRef](KafkaSinkExecutor(config))
-  }
-}
-object ConsoleStreamProducer extends ModuleMapper{
-  override def getType: String = "Stdout"
-  override def map(module:Processor): StreamProducer[Any] = 
ForeachProducer[Any](m=>print(s"$m\n"))
-}
-object AlertStreamProducer extends ModuleMapper{
-  def getType:String = "Alert"
-  override def map(module:Processor): StreamProducer[Any] = {
-val config = module.getConfig
-val moduleId = module.getId
-// Support create functional AlertStreamProducer constructor
-new AlertStreamProducer (
-  upStreamNames = 
config.getOrElse("upStreamNames",if(module.inputIds!=null) 
module.inputIds.asJava else null).asInstanceOf[java.util.List[String]],
-  alertExecutorId = 
config.getOrElse("alertExecutorId",moduleId).asInstanceOf[String],
-  consume = config.getOrElse("consume",true).asInstanceOf[Boolean],
-  strategy = config.get("strategy") match {case Some(strategy)=> 
Class.forName(strategy.asInstanceOf[String]).newInstance().asInstanceOf[PartitionStrategy]
 case None => null}
-)
-  }
-}
-
-object PersistProducer extends ModuleMapper{
-  override def getType = "Persistence"
-  override def map(module:Processor): StreamProducer[Any] = {
-val config = module.getConfig
-new 
PersistProducer(config.getOrElse("executorId",module.getId).asInstanceOf[String],StorageType.withName(config.getOrElse("storageType",null).asInstanceOf[String]))
-  }
-}
-
-object AggregatorProducer extends ModuleMapper{
-  override def getType: String = "Aggregator"
-  override def map(module:Processor): StreamProducer[Any] = {
-val config = module.getConfig
-new 

[29/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/SiddhiPolicyEvaluator.java
--
diff --git 
a/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/SiddhiPolicyEvaluator.java
 
b/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/SiddhiPolicyEvaluator.java
deleted file mode 100644
index 1929b16..000
--- 
a/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/siddhi/SiddhiPolicyEvaluator.java
+++ /dev/null
@@ -1,315 +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.policy.siddhi;
-
-import com.typesafe.config.Config;
-import org.apache.eagle.alert.entity.AbstractPolicyDefinitionEntity;
-import org.apache.eagle.alert.entity.AlertStreamSchemaEntity;
-import org.apache.eagle.dataproc.core.JsonSerDeserUtils;
-import org.apache.eagle.dataproc.core.ValuesArray;
-import org.apache.eagle.datastream.Collector;
-import org.apache.eagle.policy.PolicyEvaluationContext;
-import org.apache.eagle.policy.PolicyEvaluator;
-import org.apache.eagle.policy.PolicyManager;
-import org.apache.eagle.policy.common.Constants;
-import org.apache.eagle.policy.config.AbstractPolicyDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.wso2.siddhi.core.ExecutionPlanRuntime;
-import org.wso2.siddhi.core.SiddhiManager;
-import org.wso2.siddhi.core.query.output.callback.QueryCallback;
-import org.wso2.siddhi.core.stream.input.InputHandler;
-import org.wso2.siddhi.query.api.execution.query.Query;
-import org.wso2.siddhi.query.api.execution.query.selection.OutputAttribute;
-import org.wso2.siddhi.query.compiler.exception.SiddhiParserException;
-
-import java.lang.reflect.Field;
-import java.util.*;
-
-/**
- * when policy is updated or deleted, SiddhiManager.shutdown should be invoked 
to release resources.
- * during this time, synchronization is important
- */
-public class SiddhiPolicyEvaluator implements PolicyEvaluator {
-
-private final static String EXECUTION_PLAN_NAME = "query";
-private final static Logger LOG = 
LoggerFactory.getLogger(SiddhiPolicyEvaluator.class);
-
-private volatile SiddhiRuntime siddhiRuntime;
-private final String[] sourceStreams;
-private final boolean needValidation;
-private final Config config;
-private final PolicyEvaluationContext context;
-
-/**
- * everything dependent on policyDef should be together and switched in 
runtime
- */
-public static class SiddhiRuntime {
-QueryCallback queryCallback;
-Map siddhiInputHandlers;
-SiddhiManager siddhiManager;
-SiddhiPolicyDefinition policyDef;
-List outputFields;
-String executionPlanName;
-boolean markdownEnabled;
-String markdownReason;
-}
-
-public SiddhiPolicyEvaluator(Config config, PolicyEvaluationContext 
context, AbstractPolicyDefinition policyDef, String[] sourceStreams) {
-this(config, context, policyDef, sourceStreams, false);
-}
-
-public SiddhiPolicyEvaluator(Config config, PolicyEvaluationContext 
context, AbstractPolicyDefinition policyDef, String[] sourceStreams, boolean 
needValidation) {
-this.config = config;
-this.context = context;
-this.context.evaluator = this;
-this.needValidation = needValidation;
-this.sourceStreams = sourceStreams;
-init(policyDef);
-}
-
-public void init(AbstractPolicyDefinition policyDef) {
-siddhiRuntime = createSiddhiRuntime((SiddhiPolicyDefinition) 
policyDef);
-}
-
-public static String addContextFieldIfNotExist(String expression) {
-// select fieldA, fieldB --> select eagleAlertContext, fieldA, fieldB
-int pos = expression.indexOf("select ") + 7;
-int index = pos;
-boolean isSelectStarPattern = true;
-while (index < expression.length()) {
-if (expression.charAt(index) == ' ') index++;
-else if (expression.charAt(index) == '*') 

[48/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-assembly/src/main/lib/tomcat/LICENSE
--
diff --git a/eagle-assembly/src/main/lib/tomcat/LICENSE 
b/eagle-assembly/src/main/lib/tomcat/LICENSE
deleted file mode 100644
index 0532f5b..000
--- a/eagle-assembly/src/main/lib/tomcat/LICENSE
+++ /dev/null
@@ -1,1050 +0,0 @@
-
- Apache License
-   Version 2.0, January 2004
-http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-  "License" shall mean the terms and conditions for use, reproduction,
-  and distribution as defined by Sections 1 through 9 of this document.
-
-  "Licensor" shall mean the copyright owner or entity authorized by
-  the copyright owner that is granting the License.
-
-  "Legal Entity" shall mean the union of the acting entity and all
-  other entities that control, are controlled by, or are under common
-  control with that entity. For the purposes of this definition,
-  "control" means (i) the power, direct or indirect, to cause the
-  direction or management of such entity, whether by contract or
-  otherwise, or (ii) ownership of fifty percent (50%) or more of the
-  outstanding shares, or (iii) beneficial ownership of such entity.
-
-  "You" (or "Your") shall mean an individual or Legal Entity
-  exercising permissions granted by this License.
-
-  "Source" form shall mean the preferred form for making modifications,
-  including but not limited to software source code, documentation
-  source, and configuration files.
-
-  "Object" form shall mean any form resulting from mechanical
-  transformation or translation of a Source form, including but
-  not limited to compiled object code, generated documentation,
-  and conversions to other media types.
-
-  "Work" shall mean the work of authorship, whether in Source or
-  Object form, made available under the License, as indicated by a
-  copyright notice that is included in or attached to the work
-  (an example is provided in the Appendix below).
-
-  "Derivative Works" shall mean any work, whether in Source or Object
-  form, that is based on (or derived from) the Work and for which the
-  editorial revisions, annotations, elaborations, or other modifications
-  represent, as a whole, an original work of authorship. For the purposes
-  of this License, Derivative Works shall not include works that remain
-  separable from, or merely link (or bind by name) to the interfaces of,
-  the Work and Derivative Works thereof.
-
-  "Contribution" shall mean any work of authorship, including
-  the original version of the Work and any modifications or additions
-  to that Work or Derivative Works thereof, that is intentionally
-  submitted to Licensor for inclusion in the Work by the copyright owner
-  or by an individual or Legal Entity authorized to submit on behalf of
-  the copyright owner. For the purposes of this definition, "submitted"
-  means any form of electronic, verbal, or written communication sent
-  to the Licensor or its representatives, including but not limited to
-  communication on electronic mailing lists, source code control systems,
-  and issue tracking systems that are managed by, or on behalf of, the
-  Licensor for the purpose of discussing and improving the Work, but
-  excluding communication that is conspicuously marked or otherwise
-  designated in writing by the copyright owner as "Not a Contribution."
-
-  "Contributor" shall mean Licensor and any individual or Legal Entity
-  on behalf of whom a Contribution has been received by Licensor and
-  subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-  this License, each Contributor hereby grants to You a perpetual,
-  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-  copyright license to reproduce, prepare Derivative Works of,
-  publicly display, publicly perform, sublicense, and distribute the
-  Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-  this License, each Contributor hereby grants to You a perpetual,
-  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-  (except as stated in this section) patent license to make, have made,
-  use, offer to sell, sell, import, and otherwise transfer the Work,
-  where such license applies only to those patent claims licensable
-  by such Contributor that are necessarily infringed by their
-  Contribution(s) alone or by combination of their Contribution(s)
-  with 

[32/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-embed/eagle-embed-server/pom.xml
--
diff --git a/eagle-core/eagle-embed/eagle-embed-server/pom.xml 
b/eagle-core/eagle-embed/eagle-embed-server/pom.xml
deleted file mode 100644
index d5b5e50..000
--- a/eagle-core/eagle-embed/eagle-embed-server/pom.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-
-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;>
-   4.0.0
-   
-   eagle
-   eagle-embed-parent
-   0.3.0
-../pom.xml
-   
-   eagle-embed-server
-   jar
-   eagle-embed-server
-   
-   
-   org.apache.tomcat.embed
-   tomcat-embed-core
-   
-   
-   org.apache.tomcat.embed
-   tomcat-embed-el
-   
-   
-   org.apache.tomcat.embed
-   tomcat-embed-jasper
-   
-   
-   org.apache.tomcat.embed
-   tomcat-embed-logging-juli
-   
-   
-   org.apache.tomcat.embed
-   tomcat-embed-logging-log4j
-   
-   
-   org.apache.tomcat.embed
-   tomcat-embed-websocket
-   
-   
-   log4j
-   log4j
-
-
-
-
-
-   
-   org.slf4j
-   log4j-over-slf4j
-   
-   
-
-
-
-maven-jar-plugin
-
-
-test-jar
-test-compile
-
-test-jar
-
-
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-embed/eagle-embed-server/runEmbeddedServer.sh
--
diff --git a/eagle-core/eagle-embed/eagle-embed-server/runEmbeddedServer.sh 
b/eagle-core/eagle-embed/eagle-embed-server/runEmbeddedServer.sh
deleted file mode 100755
index a1ac537..000
--- a/eagle-core/eagle-embed/eagle-embed-server/runEmbeddedServer.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
-mvn -X exec:java 
-Dexec.mainClass="org.apache.eagle.service.embedded.tomcat.EmbeddedServer" 
-Dexec.args="../../../eagle-security/eagle-security-webservice/target/eagle-service
 38080"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-embed/eagle-embed-server/src/main/java/org/apache/eagle/service/embedded/tomcat/EmbeddedServer.java
--
diff --git 
a/eagle-core/eagle-embed/eagle-embed-server/src/main/java/org/apache/eagle/service/embedded/tomcat/EmbeddedServer.java
 
b/eagle-core/eagle-embed/eagle-embed-server/src/main/java/org/apache/eagle/service/embedded/tomcat/EmbeddedServer.java
deleted file mode 100644
index 35d3967..000
--- 
a/eagle-core/eagle-embed/eagle-embed-server/src/main/java/org/apache/eagle/service/embedded/tomcat/EmbeddedServer.java
+++ /dev/null
@@ -1,109 +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
- * 

[50/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/.travis.yml
--
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index aa8bcd3..000
--- a/.travis.yml
+++ /dev/null
@@ -1,22 +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.
-
-language: java
-
-jdk: openjdk7
-
-install : mvn install -DskipTests
-
-script: mvn clean compile test

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/KEYS
--
diff --git a/KEYS b/KEYS
deleted file mode 100644
index 116d19d..000
--- a/KEYS
+++ /dev/null
@@ -1,71 +0,0 @@
-This file contains the PGP keys of various developers.
-Please don't use them for email unless you have to. Their main
-purpose is code signing.
-
-Examples of importing this file in your keystore:
- gpg --import KEYS
- (need pgp and other examples here)
-
-Examples of adding your key to this file:
- pgp -kxa  and append it to this file.
- (pgpk -ll  && pgpk -xa ) >> this file.
- (gpg --list-sigs  && gpg --armor --export ) >> this 
file.
-

-
-pub   4096R/855D61B1 2015-11-21
-uid  Hao Chen <h...@apache.org>
-sig 3855D61B1 2015-11-21  Hao Chen <h...@apache.org>
-sub   4096R/E8A36316 2015-11-21
-sig  855D61B1 2015-11-21  Hao Chen <h...@apache.org>
-
--BEGIN PGP PUBLIC KEY BLOCK-
-
-mQINBFZQNn8BEADSDOUw1kLBxI/P3npkqvkE5TcZjcowDx9xeSQQIZ4UhChRslc3
-rrgTzcbpzEsybRV7VHMBYBSxRS0pWKPN6N6EZdsLxz+WL4GENzMTNHN0RhJuXw2t
-bThsEqKawXeP/qdH/NgXdLiy0C0rtY1W5T8AKDsNEiVC+snbsEm6EKdRA+72grPw
-FW5CqJfJPPOjE85O11T2s++qZdgU0Cn/F566rODBRQKgrtk1FiKUC0Rko+zmGfxl
-HInhxFS+YlIhC5iCsy6kG3EhZHluAs7rlsF2qOqPDXGedw9XdL97DA9j3KL6i+e0
-5ggV58J4C4UImIseLTofTQlKD8y7O7meuhQzZXoT1prIOBr1gvCgLzKJI1XQEFvC
-2PFGNUbiJBff05i3ogYzl1Q4XriTS+CyIeGX50nWVOXLsJpiu94/xz/T0pmz1vPG
-Zs1bITSbbscIufcmv5BoS/volwiuQqMEoB+QsYJRo4psKGZz3NDzKjl+Hyt88k+L
-dPGBuwt/433w2RDWmmEIO6V01ROjW7AH+raXfzujHQgj/q0aN7zNThQ/ATqkBYir
-6Dlnf/8219p+1+rCWk+UxrWh2lQuhuS5SNidrm63QkdcNEvm5TrHUdo8MDS3wtQb
-Nasbiy7eGcD7j7WkJTeRWo6a71YAFOaxnWV3o7ZCKUD4RDOqxY78lshm/wARAQAB
-tBlIYW8gQ2hlbiA8aGFvQGFwYWNoZS5vcmc+iQI4BBMBAgAiBQJWUDZ/AhsDBgsJ
-CAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRCFTl4ehV1hsb2pEACth7FD/aD4p77m
-K+w186eL5bH0oAyDH05OiVe+Iv+1PrlOHobBM6LOXp8amVTJNXOMAkfWUM+YEVYh
-uNUTYBoYnbiBHT+5fPun/7J65wiHNQpkYvAq7P3PI6kSeEWrT/yB7zxApkkydRQV
-WTMWinYxKwfCFv5uQ8l11lqsDTYU1xoU4rYJ6F0pjasU9GWanoeUsw6Q8Ye+L8Rd
-WMcNt+WcEtEd/1itpUs429gZbGf4U8w47prnr5BO8nJS1vl0ghloasWZK3jEDpAc
-Uxe3+v8HEE3nGrSWenRisv9Jmy4VFq7vRSfizP3UiMmowabsAmc4lS8ed1BygflR
-3mk38dd95zvi5QxfMfK1etDjVTxr0jr0SnLfRL/JOfYg3rnPNM6czHhNXe8k8jd2
-5majf+b3MZUQ62OXcOIgt/Yht9iAJSguGXQ4GYobUQRJ0LbuVyEJnnTT3h1ViiTL
-Lj91cCbd4oPBk0zTFRWb/E6LMu1OzZrfJ2+6Tg8kW+asEw70KWx1kSNBqNUCk6IW
-kbjhv7REyWPJlTj+jgC5tZQstA6OkA/hxJkRVqGEvKzV8gmdYt57VrDsu99nyNYB
-4GEGUQ1+3VobLaDuNd0EcWKhiVSkbCJHuhvKaCak0M/71UrkH34LAUjjqxxORX6q
-MrTE42ZzxwxCfBL5mLgcbFoCayqzpLkCDQRWUDZ/ARAA1Nc8VG9GhecrgcXhgc/2
-OFCcEKLKS97cNt9CJe4qg7ZBg1WGjSb65VmJMxLAP2mZchXqmqLriNS4VTiiDAT+
-6qOKkVsFhtGu9zoxzF6JnBSkmZ616D0oKBv05AIGaaLm5h3U2wMxwluhP1dv80zK
-OYY0hjwdMaN7q16wklTe/DlusRV1CFCGqBQV560j+ml4zRvqe6kV4RA5eCNLMEIO
-D6ghps5xDk7X+1cZC7tlfSwDI19SIOrX/2/EfpVvninHzHPvw9RNjOIgAjXaqGfV
-AI769e67FDXMDdyR04U9OHVpB1Bx46YFXwfMjLu+zxw9ZO2zgDtCk10nwp1kl1lu
-0QVqZYYUoqyEdBYhd+MOEdRGYejkx9xOIaPYaA3Qbrny8ZPfptxj3fnSaNfuo4ox
-F1Q6V27kCXlA2Y8FbVq3gus5M/VQddEmX7UElIw2XouSh2e8eLOu7foGywWlLjgf
-JDqgQxq6YzhqkGsJpc3NbhLi9MKEtZ3O98iJGcceK7S7ytW/mGnxEX/oU/W/iU9L
-sjHmLXG01IMgKFBxENvRRGXmMhjbc244duEXMh2/V98mfqRuAFKt+cYGSkxw9sL7
-OpcQ1J1cBcj+hcozTWzXjIXgM05/xz2m3b1G76C/TCciAy5XXWuBJz6oQ4InWGRE
-fGV39jScRk+EVFoVLrnLFLEAEQEAAYkCHwQYAQIACQUCVlA2fwIbDAAKCRCFTl4e
-hV1hsfOVEACOou7e22jXhP5DjqNeSl8Qr6r9/SPRANhhgSZoF9xSjZjOfcly2dtQ
-sgS/ndYu67/KTtPSMYugi1kaogXqohm3yVOZfwe3Nsye9jSpU1kHSIelRYQs366Q
-9tzAheqG/BlmN8EkleUTFFN9PHh8IqjJMS7SyhnIZ7Tma6uUrUGRGQ5noacLn2cX
-fcVUySl8z3Pv2K7T9HhxrfLX5ZWLUcM45yaiDbFtMNTgEuH+bLs1FwQwWx8Xy8L1
-wcu3GdNsoZ/+PEaWhxIeUrRTkmLQMXMA7d6HJgLj/yunJ8rDI1+InTch37Fbi4Ob

[49/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-assembly/src/main/bin/hadoop-metric-monitor.sh
--
diff --git a/eagle-assembly/src/main/bin/hadoop-metric-monitor.sh 
b/eagle-assembly/src/main/bin/hadoop-metric-monitor.sh
deleted file mode 100644
index 327bec1..000
--- a/eagle-assembly/src/main/bin/hadoop-metric-monitor.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-##!/bin/bash
-#
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements.  See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License.  You may obtain a copy of the License at
-##
-##http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-#
-source $(dirname $0)/eagle-env.sh
-
-##
-##Import stream metadata for HADOOP METRIC
-##
-${EAGLE_HOME}/bin/hadoop-metric-init.sh
-
-##
-##Run topology for HADOOP METRIC
-##
-### if topology exists, we should shutdown it
-echo "check topology status ..."
-active=$(${EAGLE_HOME}/bin/eagle-topology.sh --topology 
sandbox-hadoopjmx-topology status | grep ACTIVE)
-echo "topology status $active"
-if [ "$active" ]; then
- echo "stop topology ..."
- ${EAGLE_HOME}/bin/eagle-topology.sh --topology sandbox-hadoopjmx-topology stop
-fi
-echo "start Eagle Hadoop Metric Monitoring topology"
-${EAGLE_HOME}/bin/eagle-topology.sh --main 
org.apache.eagle.hadoop.metric.HadoopJmxMetricMonitor --topology 
sandbox-hadoopjmx-topology --config 
${EAGLE_HOME}/conf/sandbox-hadoopjmx-topology.conf start
-
-##
-##Setup minutely crontab job for HADOOP METRIC
-##
-echo "set up crontab script"
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-cp $DIR/../tools/hadoop_jmx_collector/config-sample.json 
$DIR/../tools/hadoop_jmx_collector/config.json
-command="python $DIR/../tools/hadoop_jmx_collector/hadoop_jmx_kafka.py"
-job="* * * * * $command >> $DIR/../logs/hadoop_metric.log"
-echo "$job"
-cat <(fgrep -i -v "$command" <(crontab -l)) <(echo "$job") | crontab -
-
-echo "$(crontab -l)"

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-assembly/src/main/bin/hdfs-securitylog-metadata-create.sh
--
diff --git a/eagle-assembly/src/main/bin/hdfs-securitylog-metadata-create.sh 
b/eagle-assembly/src/main/bin/hdfs-securitylog-metadata-create.sh
deleted file mode 100755
index 0d50376..000
--- a/eagle-assembly/src/main/bin/hdfs-securitylog-metadata-create.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with`
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-source $(dirname $0)/eagle-env.sh
-
-echo "Importing metadata for HDFS security log... "
-
- AlertStreamService: alert streams generated from data source
-
-curl -u ${EAGLE_SERVICE_USER}:${EAGLE_SERVICE_PASSWD} -X POST -H 
'Content-Type:application/json' 
"http://${EAGLE_SERVICE_HOST}:${EAGLE_SERVICE_PORT}/eagle-service/rest/entities?serviceName=AlertStreamService;
 -d 
'[{"prefix":"alertStream","tags":{"application":"hdfsSecurityLog","streamName":"hdfsSecurityLogEventStream"},"desc":"alert
 event stream from HDFS security audit log"}]'
-
-
- AlertExecutorService: what alert streams are consumed by alert executor
-
-curl -u 

[43/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-alert/eagle-alert-process/src/main/java/org/apache/eagle/alert/executor/AlertExecutorCreationUtils.java
--
diff --git 
a/eagle-core/eagle-alert/eagle-alert-process/src/main/java/org/apache/eagle/alert/executor/AlertExecutorCreationUtils.java
 
b/eagle-core/eagle-alert/eagle-alert-process/src/main/java/org/apache/eagle/alert/executor/AlertExecutorCreationUtils.java
deleted file mode 100644
index 8ab290e..000
--- 
a/eagle-core/eagle-alert/eagle-alert-process/src/main/java/org/apache/eagle/alert/executor/AlertExecutorCreationUtils.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.executor;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.eagle.policy.dao.PolicyDefinitionDAO;
-import org.apache.eagle.alert.entity.AlertDefinitionAPIEntity;
-import org.apache.eagle.policy.DefaultPolicyPartitioner;
-import org.apache.eagle.policy.PolicyPartitioner;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.typesafe.config.Config;
-import com.typesafe.config.ConfigValue;
-
-/**
- * Create alert executors and provide callback for programmer to link alert 
executor to immediate parent executors
- *
- * 
- * Explanations for programId, alertExecutorId and policy
- * - programId - distributed or single-process program for example one storm 
topology
- * - alertExecutorId - one process/thread which executes multiple policies
- * - policy - some rules to be evaluated
- *
- * 
- *
- * Normally the mapping is like following:
- * 
- * programId (1:N) alertExecutorId
- * alertExecutorId (1:N) policy
- * 
- */
-public class AlertExecutorCreationUtils {
-   private final static Logger LOG = 
LoggerFactory.getLogger(AlertExecutorCreationUtils.class);
-
-
-/**
- * Build DAG Tasks based on persisted alert definition and schemas from 
eagle store.
- *
- * Require configuration:
- *
- * 
- * eagleProps.site: program site id.
- * eagleProps.dataSource: program data source.
- * alertExecutorConfigs: only configured executor will be built into 
execution tasks.
- * 
- *
- * Steps:
- *
- * 
- * (upstreamTasks) => Map[streamName:String,upstreamTask:Task]
- * (dataSource) => 
Map[alertExecutorId:String,streamName:List[String]]
- * (site,dataSource) => 
Map[alertExecutorId,Map[policyId,alertDefinition]]
- * (config["alertExecutorConfigs"]) => AlertExecutor(alertExecutorID, 
partitioner, numPartitions, partitionSeq, alertDefs, alertDefDAO, 
sourceStreams)[]
- * 
- */
-   public static AlertExecutor[] createAlertExecutors(Config config, 
PolicyDefinitionDAO alertDefDAO,
-   List streamNames, String alertExecutorId) 
throws Exception{
-   // Read `alertExecutorConfigs` from configuration and get 
config for this alertExecutorId
-int numPartitions =1;
-String partitionerCls = 
DefaultPolicyPartitioner.class.getCanonicalName();
-String alertExecutorConfigsKey = "alertExecutorConfigs";
-if(config.hasPath(alertExecutorConfigsKey)) {
-Map alertExecutorConfigs = 
config.getObject(alertExecutorConfigsKey);
-if(alertExecutorConfigs !=null && 
alertExecutorConfigs.containsKey(alertExecutorId)) {
-Map alertExecutorConfig = (Map) alertExecutorConfigs.get(alertExecutorId).unwrapped();
-int parts = 0;
-if(alertExecutorConfig.containsKey("parallelism")) parts = 
(int) (alertExecutorConfig.get("parallelism"));
-numPartitions = parts == 0 ? 1 : parts;
-if(alertExecutorConfig.containsKey("partitioner")) 
partitionerCls = (String) alertExecutorConfig.get("partitioner");
-}
-}
-
-return createAlertExecutors(alertDefDAO, streamNames, alertExecutorId, 
numPartitions, partitionerCls);
-   }
-
-/**
- * Build alert executors and assign alert definitions between these 
executors by partitioner 

[24/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayListSortedSet.java
--
diff --git 
a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayListSortedSet.java
 
b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayListSortedSet.java
deleted file mode 100644
index ef47624..000
--- 
a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayListSortedSet.java
+++ /dev/null
@@ -1,106 +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.common;
-
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-public class CircularArrayListSortedSet {
-
-   private final CircularArrayList list;
-private final Comparator comparator;
-
-   public CircularArrayListSortedSet(E[] array) {
-   this.list = new CircularArrayList(array);
-   this.comparator = null;
-   }
-   
-   public CircularArrayListSortedSet(E[] array, Comparator 
comparator) {
-   this.list = new CircularArrayList(array);
-   this.comparator = comparator;
-   }
-   
-public int capacity() {
-return list.capacity();
-}
-
-public int head() {
-   return list.head();
-}
-
-public int tail() {
-   return list.tail();
-}
-
-public boolean isFull() {
-   return list.isFull();
-}
-  
-public void clear() {
-   list.clear();
-}
-
-public int size() {
-   return list.size();
-}
-  
-public E get(int i) {
-return list.get(i);
-}
-
-@SuppressWarnings("unchecked")
-   public int binarySearch(E e) {
-   if (comparator != null) {
-   return Collections.binarySearch(list, e, comparator);
-   } else {
-   return Collections.binarySearch((List>)list, e);
-   }
-}
-
-public int replace(E e) {
-   int index = binarySearch(e);
-   if (index < 0) {
-   return -1;
-   }
-   list.set(index, e);
-   return index;
-}
-  
-public int insert(E e) {
-   int index = binarySearch(e);
-   if (index > 0) {
-   return -1;
-   }
-   index = 0 - index - 1;
-   list.add(index, e);
-   return index;
-}
-  
-public E remove(int i) {
-   return list.remove(i);
-}
-
-public int remove(E e) {
-   final int index = binarySearch(e);
-   if (index > 0) {
-   list.remove(index);
-   return index;
-   }
-   return -1;
-}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java
--
diff --git 
a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java
 
b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java
deleted file mode 100644
index 58794ca..000
--- 
a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.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.
- */

[47/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-assembly/src/main/lib/tomcat/bin/catalina.sh
--
diff --git a/eagle-assembly/src/main/lib/tomcat/bin/catalina.sh 
b/eagle-assembly/src/main/lib/tomcat/bin/catalina.sh
deleted file mode 100644
index 2d0a6c3..000
--- a/eagle-assembly/src/main/lib/tomcat/bin/catalina.sh
+++ /dev/null
@@ -1,551 +0,0 @@
-#!/bin/sh
-
-# 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.
-
-# -
-# Control Script for the CATALINA Server
-#
-# Environment Variable Prerequisites
-#
-#   Do not set the variables in this script. Instead put them into a script
-#   setenv.sh in CATALINA_BASE/bin to keep your customizations separate.
-#
-#   CATALINA_HOME   May point at your Catalina "build" directory.
-#
-#   CATALINA_BASE   (Optional) Base directory for resolving dynamic portions
-#   of a Catalina installation.  If not present, resolves to
-#   the same directory that CATALINA_HOME points to.
-#
-#   CATALINA_OUT(Optional) Full path to a file where stdout and stderr
-#   will be redirected.
-#   Default is $CATALINA_BASE/logs/catalina.out
-#
-#   CATALINA_OPTS   (Optional) Java runtime options used when the "start",
-#   "run" or "debug" command is executed.
-#   Include here and not in JAVA_OPTS all options, that should
-#   only be used by Tomcat itself, not by the stop process,
-#   the version command etc.
-#   Examples are heap size, GC logging, JMX ports etc.
-#
-#   CATALINA_TMPDIR (Optional) Directory path location of temporary directory
-#   the JVM should use (java.io.tmpdir).  Defaults to
-#   $CATALINA_BASE/temp.
-#
-#   JAVA_HOME   Must point at your Java Development Kit installation.
-#   Required to run the with the "debug" argument.
-#
-#   JRE_HOMEMust point at your Java Runtime installation.
-#   Defaults to JAVA_HOME if empty. If JRE_HOME and JAVA_HOME
-#   are both set, JRE_HOME is used.
-#
-#   JAVA_OPTS   (Optional) Java runtime options used when any command
-#   is executed.
-#   Include here and not in CATALINA_OPTS all options, that
-#   should be used by Tomcat and also by the stop process,
-#   the version command etc.
-#   Most options should go into CATALINA_OPTS.
-#
-#   JAVA_ENDORSED_DIRS (Optional) Lists of of colon separated directories
-#   containing some jars in order to allow replacement of APIs
-#   created outside of the JCP (i.e. DOM and SAX from W3C).
-#   It can also be used to update the XML parser 
implementation.
-#   Defaults to $CATALINA_HOME/endorsed.
-#
-#   JPDA_TRANSPORT  (Optional) JPDA transport used when the "jpda start"
-#   command is executed. The default is "dt_socket".
-#
-#   JPDA_ADDRESS(Optional) Java runtime options used when the "jpda start"
-#   command is executed. The default is 8000.
-#
-#   JPDA_SUSPEND(Optional) Java runtime options used when the "jpda start"
-#   command is executed. Specifies whether JVM should suspend
-#   execution immediately after startup. Default is "n".
-#
-#   JPDA_OPTS   (Optional) Java runtime options used when the "jpda start"
-#   command is executed. If used, JPDA_TRANSPORT, JPDA_ADDRESS,
-#   and JPDA_SUSPEND are ignored. Thus, all required jpda
-#   options MUST be specified. The default is:
-#
-#   -agentlib:jdwp=transport=$JPDA_TRANSPORT,
-#   address=$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND
-#
-#   CATALINA_PID(Optional) Path of the file which should contains the pid
-#   of the catalina startup java process, when start (fork) is
-#   used
-#
-#   LOGGING_CONFIG  (Optional) Override Tomcat's logging config 

[42/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-alert/eagle-alert-process/src/test/java/org/apache/eagle/alert/siddhi/TestExternalBatchWindow.java
--
diff --git 
a/eagle-core/eagle-alert/eagle-alert-process/src/test/java/org/apache/eagle/alert/siddhi/TestExternalBatchWindow.java
 
b/eagle-core/eagle-alert/eagle-alert-process/src/test/java/org/apache/eagle/alert/siddhi/TestExternalBatchWindow.java
deleted file mode 100644
index 7903e0d..000
--- 
a/eagle-core/eagle-alert/eagle-alert-process/src/test/java/org/apache/eagle/alert/siddhi/TestExternalBatchWindow.java
+++ /dev/null
@@ -1,307 +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.siddhi;
-
-import java.text.MessageFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Random;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.wso2.siddhi.core.ExecutionPlanRuntime;
-import org.wso2.siddhi.core.SiddhiManager;
-import org.wso2.siddhi.core.event.Event;
-import org.wso2.siddhi.core.query.output.callback.QueryCallback;
-import org.wso2.siddhi.core.stream.input.InputHandler;
-import org.wso2.siddhi.core.stream.output.StreamCallback;
-
-/**
- * @since Dec 23, 2015
- *
- */
-public class TestExternalBatchWindow {
-
-private static SiddhiManager siddhiManager;
-
-@BeforeClass
-public static void beforeClass() {
-siddhiManager = new SiddhiManager();
-}
-
-@AfterClass
-public static void afterClass() {
-siddhiManager.shutdown();
-}
-
-@Test
-public void test02NoMsg() throws Exception {
-ExecutionPlanRuntime runtime = simpleQueryRuntime();
-
-final AtomicBoolean recieved = new AtomicBoolean();
-runtime.addCallback("query", new QueryCallback() {
-
-@Override
-public void receive(long arg0, Event[] arg1, Event[] arg2) {
-recieved.set(true);
-System.out.println(arg1);
-}
-});
-
-InputHandler input = runtime.getInputHandler("jmxMetric");
-
-runtime.start();
-// external events' time stamp less than the window, should not have 
event recieved in call back.
-long now = System.currentTimeMillis();
-int length = 5;
-for (int i = 0; i < length; i++) {
-input.send(new Object[] { 15, now + i * 1000 });
-}
-
-Thread.sleep(1000);
-Assert.assertFalse("Event happens inner external time batch window, 
should not have event recieved in callback!", recieved.get());
-
-runtime.shutdown();
-}
-
-private ExecutionPlanRuntime simpleQueryRuntime() {
-String query = "define stream jmxMetric(cpu int, timestamp long); " 
-+ "@info(name='query')"
-+ "from jmxMetric#window.eagle:externalTimeBatch(timestamp, 10 
sec) " 
-+ "select avg(cpu) as avgCpu, count(1) as count insert into 
tmp;";
-
-return siddhiManager.createExecutionPlanRuntime(query);
-}
-
-/**
- * This case try to capture the case that the window get a chunk of event 
that exceed the time batch.
- * In this case, two next processor should be triggered.
- */
-@Test
-public void test03BunchChunkExceedBatch() {
-// TODO
-}
-@Test
-public void test04MultiThread() {
-// TODO
-}
-
-@Test
-public void test05ExternalJoin() {
-// TODO
-}
-
-@Test
-public void test06EdgeCase() throws Exception {
-// every 10 sec
-ExecutionPlanRuntime runtime = simpleQueryRuntime();
-
-final AtomicInteger recCount = new AtomicInteger(0);
-//final CountDownLatch latch = new CountDownLatch(2);// for debug
-runtime.addCallback("query", new QueryCallback() {
-@Override
-public void receive(long arg0, Event[] arg1, Event[] arg2) {
-//latch.countDown();
-

[05/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/package-info.java
--
diff --git 
a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/package-info.java
 
b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/package-info.java
deleted file mode 100644
index 88e6187..000
--- 
a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/package-info.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.
- */
-/**
- * Consistency Guarantee
- * 
- *  Rollback all changes if any single entity throws exception to make 
sure consistency guarantee 
- * 
- *
- * @since 3/31/15
- */
-package org.apache.eagle.storage.jdbc.entity;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/package-info.java
--
diff --git 
a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/package-info.java
 
b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/package-info.java
deleted file mode 100644
index 79e1b94..000
--- 
a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/package-info.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.
- */
-/**
- * Eagle Storage Extension - JDBC
- *
- * Configuration
- * 
- *  
- * eagle.storage.type: jdbc
- *  
- *  
- * eagle.storage.adapter:
- *  mysql
- *  mysql
- *  oracle
- *  postgres
- *  mssql
- *  hsqldb
- *  derby
- *  
- *  eagle.storage.username
- *  eagle.storage.password
- *  eagle.storage.database
- *  eagle.storage.connection.url
- *  eagle.storage.connection.props
- *  eagle.storage.driver.class
- *  eagle.storage.connection.max
- * 
- *
- * Sample:
- * 
- *   eagle.storage.type=jdbc
- *   eagle.storage.adapter=mysql
- *   eagle.storage.username=eagle
- *   eagle.storage.password=eagle
- *   eagle.storage.database=eagle
- *   eagle.storage.connection.url=jdbc:mysql://localhost:3306/eagle
- *   eagle.storage.connection.props=encoding=UTF-8
- *   eagle.storage.driver.class=com.mysql.jdbc.Driver
- *   eagle.storage.connection.max=8
- * 
- *
- * Rowkey
- *
- * We simply use UUID as row key of entities and use the key as the primary 
key named "uuid" in RDBMS table schema
- *
- * Features
- * 
- *  Support basic entity operation like  CREATE, READ, UPDATE and 
DELETE
- *  Support flatten aggregation query
- *  Support customized entity field type 
(JdbcEntityDefinitionManager#registerJdbcSerDeser) 
- * 
- *
- * Dependencies
- * 
- * Apache DB - Torque: 
http://db.apache.org/torque/torque-4.0/index.html
- * Apache DB - DdlUtils: https://db.apache.org/ddlutils/
- * 
- *
- * TO-DO
- * 
- * Support time-series based aggregation
- * Investigate why writing performance becomes slower as records count 
in table increases
- * Implement batch insert in JdbcEntityWriterImpl
- * Implement DDL Management to generate default table schema DDL 
according entity definition
- * 
- *

[37/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-data-process/eagle-stream-process-api/src/main/java/org/apache/eagle/dataproc/impl/aggregate/SimpleAggregateExecutor.java
--
diff --git 
a/eagle-core/eagle-data-process/eagle-stream-process-api/src/main/java/org/apache/eagle/dataproc/impl/aggregate/SimpleAggregateExecutor.java
 
b/eagle-core/eagle-data-process/eagle-stream-process-api/src/main/java/org/apache/eagle/dataproc/impl/aggregate/SimpleAggregateExecutor.java
deleted file mode 100644
index e0dadbf..000
--- 
a/eagle-core/eagle-data-process/eagle-stream-process-api/src/main/java/org/apache/eagle/dataproc/impl/aggregate/SimpleAggregateExecutor.java
+++ /dev/null
@@ -1,189 +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.dataproc.impl.aggregate;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.typesafe.config.Config;
-import org.apache.eagle.dataproc.core.JsonSerDeserUtils;
-import org.apache.eagle.dataproc.core.ValuesArray;
-import 
org.apache.eagle.dataproc.impl.aggregate.entity.AggregateDefinitionAPIEntity;
-import org.apache.eagle.dataproc.impl.aggregate.entity.AggregateEntity;
-import org.apache.eagle.datastream.Collector;
-import org.apache.eagle.datastream.JavaStormStreamExecutor2;
-import org.apache.eagle.policy.PolicyEvaluationContext;
-import org.apache.eagle.policy.PolicyEvaluator;
-import org.apache.eagle.policy.PolicyManager;
-import org.apache.eagle.policy.common.Constants;
-import org.apache.eagle.policy.config.AbstractPolicyDefinition;
-import org.apache.eagle.policy.executor.IPolicyExecutor;
-import org.apache.eagle.policy.siddhi.SiddhiEvaluationHandler;
-import org.apache.hadoop.hbase.util.MD5Hash;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import scala.Tuple2;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Only one policy for one simple aggregate executor
- *
- * Created on 1/10/16.
- */
-public class SimpleAggregateExecutor
-extends JavaStormStreamExecutor2
-implements SiddhiEvaluationHandler, IPolicyExecutor {
-
-private static final Logger LOG = 
LoggerFactory.getLogger(SimpleAggregateExecutor.class);
-
-private final String cql;
-private final int partitionSeq;
-private final int totalPartitionNum;
-
-private final String[] upStreamNames;
-private String policyId;
-private String executorId;
-private Config config;
-private AggregateDefinitionAPIEntity aggDef;
-private PolicyEvaluator evaluator;
-
-public SimpleAggregateExecutor(String[] upStreams, String cql, String 
policyType, int partitionSeq, int totalPartitionNum) {
-this.cql = cql;
-this.partitionSeq = partitionSeq;
-this.upStreamNames = upStreams;
-this.totalPartitionNum = totalPartitionNum;
-// create an fixed definition policy api entity, and indicate it has 
full definition
-aggDef = new AggregateDefinitionAPIEntity();
-aggDef.setTags(new HashMap());
-aggDef.getTags().put(Constants.POLICY_TYPE, policyType);
-// TODO make it more general, not only hard code siddhi cep support 
here.
-try {
-Map template = new HashMap<>();
-template.put("type","siddhiCEPEngine");
-template.put("expression",this.cql);
-template.put("containsDefinition",true);
-aggDef.setPolicyDef(new 
ObjectMapper().writer().writeValueAsString(template));
-} catch (Exception e) {
-LOG.error("Simple aggregate generate policy definition failed!", 
e);
-}
-aggDef.setCreatedTime(new Date().getTime());
-aggDef.setLastModifiedDate(new Date().getTime());
-aggDef.setName("anonymous-aggregation-def");
-aggDef.setOwner("anonymous");
-aggDef.setEnabled(true);
-aggDef.setDescription("anonymous aggregation definition");
-
-String random = 

[16/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/QueryConstants.java
--
diff --git 
a/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/QueryConstants.java
 
b/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/QueryConstants.java
deleted file mode 100644
index 231cc99..000
--- 
a/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/QueryConstants.java
+++ /dev/null
@@ -1,24 +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.query;
-
-/**
- * @since 3/25/15
- */
-public class QueryConstants {
-public final static String CHARSET ="UTF-8";
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/aggregate/AggregateAPIEntity.java
--
diff --git 
a/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/aggregate/AggregateAPIEntity.java
 
b/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/aggregate/AggregateAPIEntity.java
deleted file mode 100644
index 1f3214f..000
--- 
a/eagle-core/eagle-query/eagle-query-base/src/main/java/org/apache/eagle/query/aggregate/AggregateAPIEntity.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.query.aggregate;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
-public class AggregateAPIEntity {
-   private long numDirectDescendants;
-   private long numTotalDescendants;
-   private String key;
-   private SortedMap entityList = new 
TreeMap();
-   private List sortedList = new 
ArrayList();
-
-   public String getKey() {
-   return key;
-   }
-   public void setKey(String key) {
-   this.key = key;
-   }
-   @JsonProperty("sL")
-   public List getSortedList() {
-   return sortedList;
-   }
-   public void setSortedList(List sortedList) {
-   this.sortedList = sortedList;
-   }
-   @JsonProperty("eL")
-   public SortedMap getEntityList() {
-   return entityList;
-   }
-   public void setEntityList(SortedMap 
entityList) {
-   this.entityList = entityList;
-   }
-   @JsonProperty("nDD")
-   public long getNumDirectDescendants() {
-   return numDirectDescendants;
-   }
-   public void setNumDirectDescendants(long numDirectDescendants) {
-   this.numDirectDescendants = numDirectDescendants;
-   }
-   @JsonProperty("nTD")
-   public long getNumTotalDescendants() {
-   return numTotalDescendants;
-   }
-   public void setNumTotalDescendants(long numTotalDescendants) {
-   this.numTotalDescendants = numTotalDescendants;
-   }
-}
\ No newline at end of file


[22/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericCreateAPIResponseEntity.java
--
diff --git 
a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericCreateAPIResponseEntity.java
 
b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericCreateAPIResponseEntity.java
deleted file mode 100644
index 6ffa621..000
--- 
a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericCreateAPIResponseEntity.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.log.entity;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(propOrder = {"success", "exception", "encodedRowkeys"})
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
-@JsonIgnoreProperties(ignoreUnknown=true)
-public class GenericCreateAPIResponseEntity{
-   private boolean success;
-   private String exception;
-   private List encodedRowkeys;
-   
-   public List getEncodedRowkeys() {
-   return encodedRowkeys;
-   }
-   public void setEncodedRowkeys(List encodedRowkeys) {
-   this.encodedRowkeys = encodedRowkeys;
-   }
-   public boolean isSuccess() {
-   return success;
-   }
-   public void setSuccess(boolean success) {
-   this.success = success;
-   }
-   public String getException() {
-   return exception;
-   }
-   public void setException(String exception) {
-   this.exception = exception;
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericEntityBatchReader.java
--
diff --git 
a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericEntityBatchReader.java
 
b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericEntityBatchReader.java
deleted file mode 100755
index 9c42ab2..000
--- 
a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericEntityBatchReader.java
+++ /dev/null
@@ -1,58 +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.log.entity;
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class GenericEntityBatchReader implements EntityCreationListener{
-   private static final Logger LOG = 
LoggerFactory.getLogger(GenericEntityBatchReader.class);
-   
-   private List entities = new 
ArrayList();
-   private StreamReader reader;
-   
-   public GenericEntityBatchReader(String serviceName, SearchCondition 
condition) throws 

[30/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/PolicyDistributionStatsDAO.java
--
diff --git 
a/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/PolicyDistributionStatsDAO.java
 
b/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/PolicyDistributionStatsDAO.java
deleted file mode 100644
index 12b2b83..000
--- 
a/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/PolicyDistributionStatsDAO.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.policy;
-
-import java.util.Set;
-
-public interface PolicyDistributionStatsDAO {
-public void reportPolicyMembership(String policyGroupId, Set 
policyIds);
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/PolicyDistroStatsLogReporter.java
--
diff --git 
a/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/PolicyDistroStatsLogReporter.java
 
b/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/PolicyDistroStatsLogReporter.java
deleted file mode 100644
index c4033f0..000
--- 
a/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/PolicyDistroStatsLogReporter.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  * contributor license agreements.  See the NOTICE file distributed with
- *  * this work for additional information regarding copyright ownership.
- *  * The ASF licenses this file to You under the Apache License, Version 2.0
- *  * (the "License"); you may not use this file except in compliance with
- *  * the License.  You may obtain a copy of the License at
- *  *
- *  *http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.
- *
- */
-
-package org.apache.eagle.policy;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Set;
-
-/**
- * just append log
- */
-public class PolicyDistroStatsLogReporter implements 
PolicyDistributionStatsDAO{
-private static Logger LOG = 
LoggerFactory.getLogger(PolicyDistroStatsLogReporter.class);
-
-@Override
-public void reportPolicyMembership(String policyGroupId, Set 
policyIds) {
-if(policyIds != null){
-StringBuilder sb = new StringBuilder();
-sb.append("policyDistributionStats for " + policyGroupId +", 
total: " + policyIds.size() + ", [");
-for(String policyId : policyIds){
-sb.append(policyId + ",");
-}
-if(policyIds.size() > 0){
-sb.deleteCharAt(sb.length()-1);
-}
-sb.append("]");
-LOG.info(sb.toString());
-}else{
-LOG.warn("No policies are assigned to " + policyGroupId);
-}
-}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/PolicyEvaluationContext.java
--
diff --git 
a/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/PolicyEvaluationContext.java
 
b/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/PolicyEvaluationContext.java
deleted file mode 100644
index 7dad895..000
--- 
a/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/policy/PolicyEvaluationContext.java
+++ /dev/null
@@ 

[12/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/ListQueryResource.java
--
diff --git 
a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/ListQueryResource.java
 
b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/ListQueryResource.java
deleted file mode 100755
index b14dc22..000
--- 
a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/ListQueryResource.java
+++ /dev/null
@@ -1,504 +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.generic;
-
-import org.apache.eagle.common.config.EagleConfigFactory;
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.*;
-import org.apache.eagle.log.entity.meta.EntityDefinition;
-import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
-import org.apache.eagle.query.GenericQuery;
-import org.apache.eagle.query.ListQueryCompiler;
-import org.apache.eagle.service.common.EagleExceptionWrapper;
-import org.apache.eagle.storage.hbase.query.GenericQueryBuilder;
-import org.apache.eagle.common.DateTimeUtil;
-import com.sun.jersey.api.json.JSONWithPadding;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.time.StopWatch;
-import org.apache.eagle.query.aggregate.timeseries.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.GenericEntity;
-import javax.ws.rs.core.MediaType;
-import java.util.*;
-
-@Path("list")
-public class ListQueryResource {
-   private static final Logger LOG = 
LoggerFactory.getLogger(ListQueryResource.class);
-
-   /**
-* Support old interface without verbose parameter
-*/
-   public ListQueryAPIResponseEntity listQuery(@QueryParam("query") String 
query,
-   
@QueryParam("startTime") String startTime, 
@QueryParam("endTime") String endTime,
-   
@QueryParam("pageSize") int pageSize, 
@QueryParam("startRowkey") String startRowkey,
-   
@QueryParam("treeAgg") boolean treeAgg, 
@QueryParam("timeSeries") boolean timeSeries,
-   
@QueryParam("intervalmin") long intervalmin, @QueryParam("top") 
int top,
-   
@QueryParam("filterIfMissing") boolean filterIfMissing,
-   
@QueryParam("parallel") int parallel,
-   
@QueryParam("metricName") String metricName){
-   return listQuery(query, startTime, endTime, pageSize, 
startRowkey, treeAgg, timeSeries, intervalmin, top, filterIfMissing, parallel, 
metricName,true);
-   }
-
-   /**
-* TODO refactor the code structure,  now it's messy
-* @param query
-* @param startTime
-* @param endTime
-* @param pageSize
-* @param startRowkey
-* @param treeAgg
-* @param timeSeries
-* @param intervalmin
-* @return
-*/
-   @GET
-   @Produces({MediaType.APPLICATION_JSON})
-   public ListQueryAPIResponseEntity listQuery(@QueryParam("query") String 
query, 
-   @QueryParam("startTime") String startTime, 
@QueryParam("endTime") String endTime,
-   @QueryParam("pageSize") int pageSize, 
@QueryParam("startRowkey") String startRowkey, 
-   @QueryParam("treeAgg") boolean treeAgg, 

[02/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-external/eagle-docker/resource/eagle-singlenode.json
--
diff --git a/eagle-external/eagle-docker/resource/eagle-singlenode.json 
b/eagle-external/eagle-docker/resource/eagle-singlenode.json
deleted file mode 100644
index a693c7d..000
--- a/eagle-external/eagle-docker/resource/eagle-singlenode.json
+++ /dev/null
@@ -1,122 +0,0 @@
-{
-"configurations": [
-{
-  "hdfs-site": {
-"dfs.permissions.enabled": "false"
-  },
-  "hive-site": {
-"javax.jdo.option.ConnectionUserName": "hive",
-"javax.jdo.option.ConnectionPassword": "hive"
-  }
-},
-{
-   "hadoop-env": {
-  "properties" : {
-"content" : "\r\n# Set Hadoop-specific environment variables 
here.\r\n\r\n# The only required environment variable is JAVA_HOME.  All others 
are\r\n# optional.  When running a distributed configuration it is best to\r\n# 
set JAVA_HOME in this file, so that it is correctly defined on\r\n# remote 
nodes.\r\n\r\n# The java implementation to use.  Required.\r\nexport 
JAVA_HOME={{java_home}}\r\nexport HADOOP_HOME_WARN_SUPPRESS=1\r\n\r\n# Hadoop 
home directory\r\nexport HADOOP_HOME=${HADOOP_HOME:-{{hadoop_home}}}\r\n\r\n# 
Hadoop Configuration Directory\r\n\r\n{# this is different for HDP1 #}\r\n# 
Path to jsvc required by secure HDP 2.0 datanode\r\nexport 
JSVC_HOME={{jsvc_path}}\r\n\r\n\r\n# The maximum amount of heap to use, in MB. 
Default is 1000.\r\nexport 
HADOOP_HEAPSIZE=\"{{hadoop_heapsize}}\"\r\n\r\nexport 
HADOOP_NAMENODE_INIT_HEAPSIZE=\"-Xms{{namenode_heapsize}}\"\r\n\r\n# Extra Java 
runtime options.  Empty by default.\r\nexport 
HADOOP_OPTS=\"-Djava.net.preferIPv4Stack=tr
 ue ${HADOOP_OPTS}\"\r\n\r\n# Command specific options appended to HADOOP_OPTS 
when specified\r\nexport HADOOP_NAMENODE_OPTS=\"-server -XX:ParallelGCThreads=8 
-XX:+UseConcMarkSweepGC 
-XX:ErrorFile={{hdfs_log_dir_prefix}}/$USER/hs_err_pid%p.log 
-XX:NewSize={{namenode_opt_newsize}} -XX:MaxNewSize={{namenode_opt_maxnewsize}} 
-XX:PermSize={{namenode_opt_permsize}} 
-XX:MaxPermSize={{namenode_opt_maxpermsize}} 
-Xloggc:{{hdfs_log_dir_prefix}}/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc 
-XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps 
-Xms{{namenode_heapsize}} -Xmx{{namenode_heapsize}} 
-Dhadoop.security.logger=INFO,DRFAS 
-Dhdfs.audit.logger=INFO,DRFAAUDIT,KAFKA_HDFS_AUDIT 
${HADOOP_NAMENODE_OPTS}\"\r\nHADOOP_JOBTRACKER_OPTS=\"-server 
-XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC 
-XX:ErrorFile={{hdfs_log_dir_prefix}}/$USER/hs_err_pid%p.log 
-XX:NewSize={{jtnode_opt_newsize}} -XX:MaxNewSize={{jtnode_opt_maxnewsize}} 
-Xloggc:{{hdfs_log_dir_prefix}}/$USER/gc.log-`date +'%Y%m%d
 %H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps 
-XX:+PrintGCDateStamps -Xmx{{jtnode_heapsize}} 
-Dhadoop.security.logger=INFO,DRFAS -Dmapred.audit.logger=INFO,MRAUDIT 
-Dhadoop.mapreduce.jobsummary.logger=INFO,JSA 
${HADOOP_JOBTRACKER_OPTS}\"\r\n\r\nHADOOP_TASKTRACKER_OPTS=\"-server 
-Xmx{{ttnode_heapsize}} -Dhadoop.security.logger=ERROR,console 
-Dmapred.audit.logger=ERROR,console ${HADOOP_TASKTRACKER_OPTS}\"\r\nexport 
HADOOP_DATANODE_OPTS=\"-server -XX:ParallelGCThreads=4 -XX:+UseConcMarkSweepGC 
-XX:ErrorFile=/var/log/hadoop/$USER/hs_err_pid%p.log -XX:NewSize=200m 
-XX:MaxNewSize=200m -XX:PermSize=128m -XX:MaxPermSize=256m 
-Xloggc:/var/log/hadoop/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc 
-XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps 
-Xms{{dtnode_heapsize}} -Xmx{{dtnode_heapsize}} 
-Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT 
${HADOOP_DATANODE_OPTS}\"\r\nHADOOP_BALANCER_OPTS=\"-server 
-Xmx{{hadoop_heapsize}}m ${HADOOP_BALANCE
 R_OPTS}\"\r\n\r\nexport 
HADOOP_SECONDARYNAMENODE_OPTS=$HADOOP_NAMENODE_OPTS\r\n\r\n# The following 
applies to multiple commands (fs, dfs, fsck, distcp etc)\r\nexport 
HADOOP_CLIENT_OPTS=\"-Xmx${HADOOP_HEAPSIZE}m -XX:MaxPermSize=512m 
$HADOOP_CLIENT_OPTS\"\r\n\r\n# On secure datanodes, user to run the datanode as 
after dropping privileges\r\nexport 
HADOOP_SECURE_DN_USER=${HADOOP_SECURE_DN_USER:-{{hadoop_secure_dn_user}}}\r\n\r\n#
 Extra ssh options.  Empty by default.\r\nexport HADOOP_SSH_OPTS=\"-o 
ConnectTimeout=5 -o SendEnv=HADOOP_CONF_DIR\"\r\n\r\n# Where log files are 
stored.  $HADOOP_HOME/logs by default.\r\nexport 
HADOOP_LOG_DIR={{hdfs_log_dir_prefix}}/$USER\r\n\r\n# History server 
logs\r\nexport HADOOP_MAPRED_LOG_DIR={{mapred_log_dir_prefix}}/$USER\r\n\r\n# 
Where log files are stored in the secure data environment.\r\nexport 
HADOOP_SECURE_DN_LOG_DIR={{hdfs_log_dir_prefix}}/$HADOOP_SECURE_DN_USER\r\n\r\n#
 File naming remote slave hosts.  $HADOOP_HOME/conf/slaves by default.\r\n# e
 xport HADOOP_SLAVES=${HADOOP_HOME}/conf/slaves\r\n\r\n# host:path where hadoop 
code should be rsync'd from.  Unset by default.\r\n# export 

[10/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/result/ModifyResult.java
--
diff --git 
a/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/result/ModifyResult.java
 
b/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/result/ModifyResult.java
deleted file mode 100644
index 4c0f56b..000
--- 
a/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/result/ModifyResult.java
+++ /dev/null
@@ -1,34 +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.storage.result;
-
-import java.util.List;
-
-/**
- * @since 3/18/15
- */
-public class ModifyResult extends Result {
-public List getIdentifiers() {
-return identifiers;
-}
-
-public void setIdentifiers(List identifiers) {
-this.identifiers = identifiers;
-}
-
-private List identifiers;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/result/QueryResult.java
--
diff --git 
a/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/result/QueryResult.java
 
b/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/result/QueryResult.java
deleted file mode 100644
index 496315a..000
--- 
a/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/result/QueryResult.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.storage.result;
-
-import java.util.List;
-
-/**
- * @since 3/18/15
- */
-public class QueryResult extends Result {
-
-
-public List getData() {
-return data;
-}
-
-public void setData(List data) {
-this.data = data;
-}
-
-private List data;
-private Long firstTimestamp;
-
-public Long getLastTimestamp() {
-return lastTimestamp;
-}
-
-public void setLastTimestamp(Long lastTimestamp) {
-this.lastTimestamp = lastTimestamp;
-}
-
-public Long getFirstTimestamp() {
-return firstTimestamp;
-}
-
-public void setFirstTimestamp(Long firstTimestamp) {
-this.firstTimestamp = firstTimestamp;
-}
-
-private Long lastTimestamp;
-
-public Class getEntityType() {
-return entityType;
-}
-
-public void setEntityType(Class entityType) {
-this.entityType = entityType;
-}
-
-private Class entityType;
-
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/result/Result.java
--
diff --git 
a/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/result/Result.java
 
b/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/result/Result.java
deleted file mode 100644
index 492be08..000
--- 
a/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/result/Result.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 

[25/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-client-base/src/main/java/org/apache/eagle/service/client/impl/EagleServiceBaseClient.java
--
diff --git 
a/eagle-core/eagle-query/eagle-client-base/src/main/java/org/apache/eagle/service/client/impl/EagleServiceBaseClient.java
 
b/eagle-core/eagle-query/eagle-client-base/src/main/java/org/apache/eagle/service/client/impl/EagleServiceBaseClient.java
deleted file mode 100644
index 70e92bf..000
--- 
a/eagle-core/eagle-query/eagle-client-base/src/main/java/org/apache/eagle/service/client/impl/EagleServiceBaseClient.java
+++ /dev/null
@@ -1,339 +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.client.impl;
-
-import com.sun.jersey.api.client.AsyncWebResource;
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
-import org.apache.eagle.common.Base64;
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
-import org.apache.eagle.log.entity.meta.EntityDefinition;
-import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
-import org.apache.eagle.service.client.EagleServiceAsyncClient;
-import org.apache.eagle.service.client.EagleServiceClientException;
-import org.apache.eagle.service.client.IEagleServiceClient;
-import org.apache.eagle.service.client.security.SecurityConstants;
-import org.codehaus.jackson.JsonFactory;
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.jaxrs.JacksonJsonProvider;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.core.MediaType;
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-public abstract class EagleServiceBaseClient implements IEagleServiceClient {
-public final static String SERVICE_NAME="serviceName";
-public final static String DELETE_BY_ID="byId";
-
-private final String host;
-private final int port;
-private final String basePath;
-private String username;
-private String password;
-protected boolean silence = false;
-
-public String getBaseEndpoint() {
-return baseEndpoint;
-}
-
-private final String baseEndpoint;
-
-private final static Logger LOG = 
LoggerFactory.getLogger(EagleServiceBaseClient.class);
-
-protected static final String DEFAULT_BASE_PATH = "/eagle-service/rest";
-protected static final MediaType DEFAULT_MEDIA_TYPE = 
MediaType.APPLICATION_JSON_TYPE;
-protected static final String DEFAULT_HTTP_HEADER_CONTENT_TYPE = 
"application/json";
-protected static final String CONTENT_TYPE = "Content-Type";
-
-protected final static String GENERIC_ENTITY_PATH = "/entities";
-protected final static String GENERIC_ENTITY_DELETE_PATH = 
GENERIC_ENTITY_PATH+"/delete";
-private final Client client;
-private final List closeables = new LinkedList();
-
-private volatile boolean isStopped = false;
-
-public EagleServiceBaseClient(String host, int port, String basePath, 
String username, String password) {
-this.host = host;
-this.port = port;
-this.basePath = basePath;
-this.baseEndpoint = buildBathPath().toString();
-this.username = username;
-this.password = password;
-
-ClientConfig cc = new DefaultClientConfig();
-cc.getProperties().put(DefaultClientConfig.PROPERTY_CONNECT_TIMEOUT, 
60 * 1000);
-cc.getProperties().put(DefaultClientConfig.PROPERTY_READ_TIMEOUT, 60 * 
1000);
-cc.getClasses().add(JacksonJsonProvider.class);
-
cc.getProperties().put(URLConnectionClientHandler.PROPERTY_HTTP_URL_CONNECTION_SET_METHOD_WORKAROUND,
 true);
-

[44/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginManagerImpl.java
--
diff --git 
a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginManagerImpl.java
 
b/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginManagerImpl.java
deleted file mode 100644
index 2c77f1f..000
--- 
a/eagle-core/eagle-alert/eagle-alert-notification-plugin/src/main/java/org/apache/eagle/notification/plugin/NotificationPluginManagerImpl.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.notification.plugin;
-
-import com.typesafe.config.Config;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.eagle.alert.entity.AlertAPIEntity;
-import org.apache.eagle.alert.entity.AlertDefinitionAPIEntity;
-import org.apache.eagle.notification.base.NotificationConstants;
-import org.apache.eagle.notification.utils.NotificationPluginUtils;
-import org.apache.eagle.policy.common.Constants;
-import org.apache.eagle.policy.dao.PolicyDefinitionDAO;
-import org.apache.eagle.policy.dao.PolicyDefinitionEntityDAOImpl;
-import org.apache.eagle.service.client.EagleServiceConnector;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Created on 2/10/16.
- */
-public class NotificationPluginManagerImpl implements 
NotificationPluginManager {
-private static final Logger LOG = 
LoggerFactory.getLogger(NotificationPluginManagerImpl.class);
-// mapping from policy Id to NotificationPlugin instance
-private Map 
policyNotificationMapping = new ConcurrentHashMap<>(1); //only one write thread
-private Config config;
-
-public NotificationPluginManagerImpl(Config config){
-this.config = config;
-internalInit();
-}
-
-private void internalInit(){
-// iterate all policy ids, keep those notification which belong to 
plugins
-PolicyDefinitionDAO policyDefinitionDao = new 
PolicyDefinitionEntityDAOImpl(new EagleServiceConnector( config ) , 
Constants.ALERT_DEFINITION_SERVICE_ENDPOINT_NAME);
-String site = config.getString("eagleProps.site");
-String application = config.getString("eagleProps.application");
-try{
-List activeAlertDefs = 
policyDefinitionDao.findActivePolicies( site , application);
-// initialize all loaded plugins
-NotificationPluginLoader.getInstance().init(config);
-for(NotificationPlugin plugin : 
NotificationPluginLoader.getInstance().getNotificationMapping().values()){
-plugin.init(config, activeAlertDefs);
-}
-// build policy and plugin mapping
-for( AlertDefinitionAPIEntity entity : activeAlertDefs ){
-Map plugins = 
pluginsForPolicy(entity);
-
policyNotificationMapping.put(entity.getTags().get(Constants.POLICY_ID) , 
plugins.values());
-}
-}catch (Exception ex ){
-LOG.error("Error initializing poliy/notification mapping ", ex);
-throw new IllegalStateException(ex);
-}
-}
-
-@Override
-public void notifyAlert(AlertAPIEntity entity) {
-String policyId = entity.getTags().get(Constants.POLICY_ID);
-Collection plugins = 
policyNotificationMapping.get(policyId);
-if(plugins == null || plugins.size() == 0) {
-LOG.debug("no plugin found for policy " + policyId);
-return;
-}
-for(NotificationPlugin plugin : plugins){
-try {
-LOG.info("execute notification plugin " + plugin);
-plugin.onAlert(entity);
-}catch(Exception ex){
-LOG.error("fail invoking plugin's onAlert, continue ", ex);
-}
-}
-}
-
-

[28/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch

2016-03-03 Thread hao
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-antlr/src/main/java/org/apache/eagle/query/antlr/generated/EagleFilterLexer.tokens
--
diff --git 
a/eagle-core/eagle-query/eagle-antlr/src/main/java/org/apache/eagle/query/antlr/generated/EagleFilterLexer.tokens
 
b/eagle-core/eagle-query/eagle-antlr/src/main/java/org/apache/eagle/query/antlr/generated/EagleFilterLexer.tokens
deleted file mode 100755
index 5ebca36..000
--- 
a/eagle-core/eagle-query/eagle-antlr/src/main/java/org/apache/eagle/query/antlr/generated/EagleFilterLexer.tokens
+++ /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.
- */
-WHITESPACE=1
-OP=2
-AND=3
-OR=4
-ID=5
-VALUE=6
-SINGLE_VALUE=7
-EXPR=8
-NUMBER=9
-NULL=10
-SET=11
-DOUBLEQUOTED_STRING=12
-LPAREN=13
-RPAREN=14
-LBRACE=15
-RBRACE=16
-'('=13
-')'=14
-'{'=15
-'}'=16

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-antlr/src/main/java/org/apache/eagle/query/antlr/generated/EagleFilterListener.java
--
diff --git 
a/eagle-core/eagle-query/eagle-antlr/src/main/java/org/apache/eagle/query/antlr/generated/EagleFilterListener.java
 
b/eagle-core/eagle-query/eagle-antlr/src/main/java/org/apache/eagle/query/antlr/generated/EagleFilterListener.java
deleted file mode 100755
index 1d7cb57..000
--- 
a/eagle-core/eagle-query/eagle-antlr/src/main/java/org/apache/eagle/query/antlr/generated/EagleFilterListener.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// Generated from EagleFilter.g4 by ANTLR 4.5
-package org.apache.eagle.query.antlr.generated;
-
-import org.antlr.v4.runtime.tree.ParseTreeListener;
-
-/**
- * This interface defines a complete listener for a parse tree produced by
- * {@link EagleFilterParser}.
- */
-public interface EagleFilterListener extends ParseTreeListener {
-   /**
-* Enter a parse tree produced by {@link EagleFilterParser#filter}.
-* @param ctx the parse tree
-*/
-   void enterFilter(EagleFilterParser.FilterContext ctx);
-   /**
-* Exit a parse tree produced by {@link EagleFilterParser#filter}.
-* @param ctx the parse tree
-*/
-   void exitFilter(EagleFilterParser.FilterContext ctx);
-   /**
-* Enter a parse tree produced by {@link EagleFilterParser#combine}.
-* @param ctx the parse tree
-*/
-   void enterCombine(EagleFilterParser.CombineContext ctx);
-   /**
-* Exit a parse tree produced by {@link EagleFilterParser#combine}.
-* @param ctx the parse tree
-*/
-   void exitCombine(EagleFilterParser.CombineContext ctx);
-   /**
-* Enter a parse tree produced by {@link EagleFilterParser#equation}.
-* @param ctx the parse tree
-*/
-   void enterEquation(EagleFilterParser.EquationContext ctx);
-   /**
-* Exit a parse tree produced by {@link EagleFilterParser#equation}.
-* @param ctx the parse tree
-*/
-   void exitEquation(EagleFilterParser.EquationContext ctx);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-antlr/src/main/java/org/apache/eagle/query/antlr/generated/EagleFilterParser.java

<    1   2   3   4   >