You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by ha...@apache.org on 2016/07/21 12:28:45 UTC

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

Repository: incubator-eagle
Updated Branches:
  refs/heads/develop f0af3e5dc -> e21b073f6


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/service/InMemMetadataDaoImpl.java
----------------------------------------------------------------------
diff --git a/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/service/InMemMetadataDaoImpl.java b/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/service/InMemMetadataDaoImpl.java
index db38556..53d7132 100644
--- a/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/service/InMemMetadataDaoImpl.java
+++ b/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/service/InMemMetadataDaoImpl.java
@@ -16,6 +16,7 @@
  */
 package org.apache.eagle.security.service;
 
+import com.google.inject.Inject;
 import com.typesafe.config.Config;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.apache.commons.lang3.tuple.Pair;
@@ -37,7 +38,9 @@ public class InMemMetadataDaoImpl implements ISecurityMetadataDAO {
 
     private Map<Pair<String, String>, HBaseSensitivityEntity> hBaseSensitivityEntities = new HashMap<>();
 
+    @Inject
     public InMemMetadataDaoImpl(Config config) {
+        
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-server/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-server/pom.xml b/eagle-server/pom.xml
new file mode 100644
index 0000000..f2aaa41
--- /dev/null
+++ b/eagle-server/pom.xml
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eagle-parent</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>eagle-server</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>io.dropwizard</groupId>
+            <artifactId>dropwizard-core</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>log4j-over-slf4j</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>io.dropwizard</groupId>
+            <artifactId>dropwizard-jersey</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>io.swagger</groupId>
+            <artifactId>swagger-jersey-jaxrs</artifactId>
+            <scope>compile</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.sun.jersey</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.typesafe</groupId>
+            <artifactId>config</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.hubspot.dropwizard</groupId>
+            <artifactId>dropwizard-guice</artifactId>
+            <version>0.7.0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>io.dropwizard</groupId>
+            <artifactId>dropwizard-assets</artifactId>
+            <version>${dropwizard.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>alert-metadata-service</artifactId>
+            <version>${project.version}</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>xercesImpl</artifactId>
+                    <groupId>xerces</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>alert-coordinator</artifactId>
+            <version>${project.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-metadata-base</artifactId>
+            <version>${project.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-app-base</artifactId>
+            <version>${project.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-app-example</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/webapp/app</directory>
+                <targetPath>assets</targetPath>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-server/src/main/java/org/apache/eagle/server/RESTExceptionMapper.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/RESTExceptionMapper.java b/eagle-server/src/main/java/org/apache/eagle/server/RESTExceptionMapper.java
new file mode 100644
index 0000000..2d257a4
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/RESTExceptionMapper.java
@@ -0,0 +1,62 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.server;
+
+import io.dropwizard.jersey.errors.LoggingExceptionMapper;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.util.concurrent.ThreadLocalRandom;
+
+public class RESTExceptionMapper extends LoggingExceptionMapper<Throwable> {
+    @Override
+    public Response toResponse(Throwable throwable) {
+        if (throwable instanceof WebApplicationException) {
+            return ((WebApplicationException) throwable).getResponse();
+        }
+        final long id = ThreadLocalRandom.current().nextLong();
+        logException(id, throwable);
+       return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(new ExceptionResponseEntity(throwable)).type(MediaType.APPLICATION_JSON_TYPE).build();
+    }
+
+    public static class ExceptionResponseEntity {
+        public ExceptionResponseEntity(Throwable throwable){
+            this.setMessage(ExceptionUtils.getMessage(throwable));
+            this.setException(ExceptionUtils.getStackTrace(throwable));
+        }
+        private String message;
+        private String exception;
+
+        public String getException() {
+            return exception;
+        }
+
+        public void setException(String exception) {
+            this.exception = exception;
+        }
+
+        public String getMessage() {
+            return message;
+        }
+
+        public void setMessage(String message) {
+            this.message = message;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-server/src/main/java/org/apache/eagle/server/ServerApplication.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/ServerApplication.java b/eagle-server/src/main/java/org/apache/eagle/server/ServerApplication.java
new file mode 100644
index 0000000..c64fa83
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/ServerApplication.java
@@ -0,0 +1,80 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.server;
+
+import com.hubspot.dropwizard.guice.GuiceBundle;
+import com.sun.jersey.api.core.PackagesResourceConfig;
+import io.dropwizard.Application;
+import io.dropwizard.assets.AssetsBundle;
+import io.dropwizard.setup.Bootstrap;
+import io.dropwizard.setup.Environment;
+import io.swagger.jaxrs.config.BeanConfig;
+import io.swagger.jaxrs.listing.ApiListingResource;
+import org.apache.eagle.alert.coordinator.CoordinatorListener;
+import org.apache.eagle.alert.resource.SimpleCORSFiler;
+import org.apache.eagle.app.ApplicationGuiceModule;
+import org.apache.eagle.common.module.CommonGuiceModule;
+import org.apache.eagle.metadata.persistence.MetadataStore;
+
+import javax.servlet.DispatcherType;
+import java.util.EnumSet;
+
+public class ServerApplication extends Application<ServerConfig> {
+
+    @Override
+    public void initialize(Bootstrap<ServerConfig> bootstrap) {
+        GuiceBundle<ServerConfig> guiceBundle = GuiceBundle.<ServerConfig>newBuilder()
+                .addModule(new CommonGuiceModule())
+                .addModule(MetadataStore.getInstance())
+                .addModule(new ApplicationGuiceModule())
+                .setConfigClass(ServerConfig.class)
+                .build();
+        bootstrap.addBundle(guiceBundle);
+        bootstrap.addBundle(new AssetsBundle("/assets","/","index.html","/"));
+    }
+
+    @Override
+    public String getName() {
+        return ServerConfig.getServerName();
+    }
+
+    @Override
+    public void run(ServerConfig configuration, Environment environment) throws Exception {
+        environment.getApplicationContext().setContextPath(ServerConfig.getContextPath());
+        environment.jersey().register(RESTExceptionMapper.class);
+        environment.jersey().setUrlPattern(ServerConfig.getApiBasePath());
+
+        // Automatically scan all REST resources
+        new PackagesResourceConfig(ServerConfig.getResourcePackage()).getClasses().forEach(environment.jersey()::register);
+
+        // Swagger resources
+        environment.jersey().register(ApiListingResource.class);
+        BeanConfig swaggerConfig = new BeanConfig();
+        swaggerConfig.setTitle(ServerConfig.getServerName());
+        swaggerConfig.setVersion(ServerConfig.getServerName());
+        swaggerConfig.setBasePath(ServerConfig.getApiBasePath());
+        swaggerConfig.setResourcePackage(ServerConfig.getResourcePackage());
+        swaggerConfig.setScan(true);
+
+        // Simple CORS filter
+        environment.servlets().addFilter(SimpleCORSFiler.class.getName(), new SimpleCORSFiler())
+                .addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/*");
+
+        // context listener
+        environment.servlets().addServletListeners(new CoordinatorListener());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-server/src/main/java/org/apache/eagle/server/ServerConfig.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/ServerConfig.java b/eagle-server/src/main/java/org/apache/eagle/server/ServerConfig.java
new file mode 100644
index 0000000..5ca9256
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/ServerConfig.java
@@ -0,0 +1,52 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.server;
+
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import io.dropwizard.Configuration;
+
+public class ServerConfig extends Configuration {
+    private final static String SERVER_NAME = "Apache Eagle";
+    private final static String SERVER_VERSION = "0.5.0-incubating";
+    private final static String API_BASE_PATH = "/rest/*";
+    private final static String CONTEXT_PATH="/";
+    private final static String RESOURCE_PACKAGE = "org.apache.eagle";
+
+    public Config getConfig(){
+        return ConfigFactory.load();
+    }
+
+    public static String getServerName(){
+        return SERVER_NAME;
+    }
+
+    public static String getServerVersion(){
+        return SERVER_VERSION;
+    }
+
+    public static String getApiBasePath(){
+        return API_BASE_PATH;
+    }
+    public static String getResourcePackage(){
+        return RESOURCE_PACKAGE;
+    }
+
+    public static String getContextPath(){
+        return CONTEXT_PATH;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-server/src/main/java/org/apache/eagle/server/ServerMain.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/ServerMain.java b/eagle-server/src/main/java/org/apache/eagle/server/ServerMain.java
new file mode 100644
index 0000000..50bd878
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/ServerMain.java
@@ -0,0 +1,23 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.server;
+
+public class ServerMain {
+    public static void main(String[] args) throws Exception {
+        new ServerApplication().run(args);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-server/src/main/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/resources/application.conf b/eagle-server/src/main/resources/application.conf
new file mode 100644
index 0000000..48a2723
--- /dev/null
+++ b/eagle-server/src/main/resources/application.conf
@@ -0,0 +1,57 @@
+# 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.
+
+{
+	"coordinator" : {
+		"policiesPerBolt" : 5,
+		"boltParallelism" : 5,
+		"policyDefaultParallelism" : 5,
+		"boltLoadUpbound": 0.8,
+		"topologyLoadUpbound" : 0.8,
+		"numOfAlertBoltsPerTopology" : 5,
+		"zkConfig" : {
+			"zkQuorum" : "127.0.0.1:2181",
+			"zkRoot" : "/alert",
+			"zkSessionTimeoutMs" : 10000,
+			"connectionTimeoutMs" : 10000,
+			"zkRetryTimes" : 3,
+			"zkRetryInterval" : 3000
+		},
+		"metadataService" : {
+			"host" : "localhost",
+			"port" : 8080,
+			"context" : "/rest"
+		},
+		"metadataDynamicCheck" : {
+			"initDelayMillis" : 1000,
+			"delayMillis" : 30000
+		}
+	},
+	"datastore": {
+		"metadataDao": "org.apache.eagle.alert.metadata.impl.InMemMetadataDaoImpl"
+	}
+	"metadata":{
+		"store": "org.apache.eagle.metadata.persistence.MemoryMetadataStore"
+	},
+	"application":{
+		"sink":{
+			"type":"org.apache.eagle.app.sink.KafkaStreamSink"
+		}
+		"storm": {
+			"nimbusHost": "localhost"
+			"nimbusThriftPort": 6627
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-server/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/resources/log4j.properties b/eagle-server/src/main/resources/log4j.properties
new file mode 100644
index 0000000..d59ded6
--- /dev/null
+++ b/eagle-server/src/main/resources/log4j.properties
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+log4j.rootLogger=INFO, stdout
+
+# standard output
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/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
new file mode 100644
index 0000000..b434715
--- /dev/null
+++ b/eagle-server/src/main/resources/providers.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<providers>
+    <provider>
+        <jarPath>target/apache-eagle-example-app.jar</jarPath>
+        <className>org.apache.eagle.app.example.ExampleApplicationProvider</className>
+    </provider>
+    <provider>
+        <jarPath>target/apache-eagle-example-app.jar</jarPath>
+        <className>org.apache.eagle.app.example.ExampleApplicationProvider2</className>
+    </provider>
+</providers>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-server/src/main/webapp/app/index.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/index.html b/eagle-server/src/main/webapp/app/index.html
new file mode 100644
index 0000000..f3d3c80
--- /dev/null
+++ b/eagle-server/src/main/webapp/app/index.html
@@ -0,0 +1,19 @@
+<!--
+  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 Server has started!
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-server/src/main/webapp/package.json
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/package.json b/eagle-server/src/main/webapp/package.json
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-server/src/test/java/org/apache/eagle/server/ServerApplicationTest.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/test/java/org/apache/eagle/server/ServerApplicationTest.java b/eagle-server/src/test/java/org/apache/eagle/server/ServerApplicationTest.java
new file mode 100644
index 0000000..1ef5127
--- /dev/null
+++ b/eagle-server/src/test/java/org/apache/eagle/server/ServerApplicationTest.java
@@ -0,0 +1,26 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.server;
+
+import org.junit.Test;
+
+public class ServerApplicationTest {
+    @Test
+    public void testServerMain() throws Exception {
+        ServerMain.main(new String[]{"server"});
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-webservice/src/main/java/org/apache/eagle/service/security/pwdgen/PasswordEncoderGenerator.java
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/java/org/apache/eagle/service/security/pwdgen/PasswordEncoderGenerator.java b/eagle-webservice/src/main/java/org/apache/eagle/service/security/pwdgen/PasswordEncoderGenerator.java
index 6543f92..1a855e2 100644
--- a/eagle-webservice/src/main/java/org/apache/eagle/service/security/pwdgen/PasswordEncoderGenerator.java
+++ b/eagle-webservice/src/main/java/org/apache/eagle/service/security/pwdgen/PasswordEncoderGenerator.java
@@ -20,7 +20,7 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 
 public class PasswordEncoderGenerator {
     public static void main(String[] args) {
-        String password = "secret";
+        String password = "eagle@ebay.com";
         BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
         String hashedPassword = passwordEncoder.encode(password);
         System.out.println(hashedPassword);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0de71b9..d7d0ccb 100755
--- a/pom.xml
+++ b/pom.xml
@@ -133,6 +133,7 @@
         <module>eagle-examples</module>
         <module>eagle-gc</module>
         <module>eagle-hadoop-metric</module>
+        <module>eagle-server</module>
         <module>eagle-jpm</module>
     </modules>
     <properties>
@@ -190,6 +191,7 @@
         <commons-collections4.version>4.0</commons-collections4.version>
         <commons-collections.version>3.2.1</commons-collections.version>
         <commons-io.version>2.4</commons-io.version>
+        <guice.version>3.0</guice.version>
 
         <!-- Configuration -->
         <archaius.version>0.6.1</archaius.version>
@@ -385,6 +387,16 @@
                 <artifactId>asm-all</artifactId>
                 <version>${asm.version}</version>
             </dependency>
+            <dependency>
+                <groupId>com.google.inject.extensions</groupId>
+                <artifactId>guice-servlet</artifactId>
+                <version>${guice.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.google.inject</groupId>
+                <artifactId>guice</artifactId>
+                <version>${guice.version}</version>
+            </dependency>
 
             <!-- Configuration -->
             <dependency>
@@ -773,6 +785,41 @@
                 <artifactId>ejml</artifactId>
                 <version>${ejml.version}</version>
             </dependency>
+
+            <dependency>
+                <groupId>io.dropwizard</groupId>
+                <artifactId>dropwizard-core</artifactId>
+                <version>${dropwizard.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>slf4j-log4j12</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>io.dropwizard</groupId>
+                <artifactId>dropwizard-jersey</artifactId>
+                <version>${dropwizard.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>slf4j-log4j12</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>io.swagger</groupId>
+                <artifactId>swagger-jersey-jaxrs</artifactId>
+                <version>${swagger.version}</version>
+                <scope>compile</scope>
+                <exclusions>
+                    <exclusion>
+                        <groupId>com.sun.jersey</groupId>
+                        <artifactId>*</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
         </dependencies>
     </dependencyManagement>
     <profiles>
@@ -873,6 +920,8 @@
                             </exclusion>
                         </exclusions>
                     </dependency>
+
+
                 </dependencies>
             </dependencyManagement>
         </profile>
@@ -1073,7 +1122,7 @@
                                 <exclude>**/.classpath</exclude>
                                 <exclude>**/.settings/**</exclude>
                                 <exclude>**/.project</exclude>
-                                <exclude>**/.metadata/</exclude>
+                                <exclude>**/.descriptor/</exclude>
                                 <!-- Maven working directory -->
                                 <exclude>**/target/**</exclude>
                                 <!-- Patch files which can be lying around -->


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

Posted by ha...@apache.org.
[EAGLE-382][EAGLE-385] Monitoring Application Framework Core

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

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

Closes #270 from haoch/EAGLE-382.


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

Branch: refs/heads/develop
Commit: e21b073f6a21e2b9b6aa580d11dbadfa474c9c4c
Parents: f0af3e5
Author: Hao Chen <ha...@apache.org>
Authored: Thu Jul 21 20:28:32 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Thu Jul 21 20:28:32 2016 +0800

----------------------------------------------------------------------
 .../alert/engine/coordinator/StreamColumn.java  |  64 ++++
 .../engine/coordinator/StreamDefinition.java    |   5 +-
 .../engine/mock/MockSampleMetadataFactory.java  |   5 -
 .../metadata/resource/MetadataResource.java     |  11 +-
 .../alert-metadata/pom.xml                      |   5 +
 .../metadata/impl/InMemMetadataDaoImpl.java     |   4 +-
 .../metadata/impl/JdbcDatabaseHandler.java      |   8 +-
 .../metadata/impl/JdbcMetadataDaoImpl.java      |   2 +
 .../metadata/impl/MongoMetadataDaoImpl.java     |   2 +
 .../apache/eagle/service/app/ServiceApp.java    |   7 +-
 .../eagle-alert-parent/eagle-alert/pom.xml      |  36 ---
 eagle-core/eagle-app/eagle-app-base/pom.xml     | 106 +++++++
 .../apache/eagle/app/AbstractApplication.java   | 143 +++++++++
 .../java/org/apache/eagle/app/Application.java  |  40 +++
 .../apache/eagle/app/ApplicationContext.java    | 108 +++++++
 .../eagle/app/ApplicationGuiceModule.java       |  36 +++
 .../app/config/ApplicationProviderConfig.java   |  55 ++++
 .../config/ApplicationProviderDescConfig.java   | 147 +++++++++
 .../app/config/ApplicationProvidersConfig.java  |  39 +++
 .../eagle/app/resource/ApplicationResource.java | 155 ++++++++++
 .../apache/eagle/app/service/AppOperations.java | 161 ++++++++++
 .../service/ApplicationManagementService.java   |  49 +++
 .../ApplicationManagementServiceImpl.java       |  96 ++++++
 .../app/service/ApplicationProviderLoader.java  |  74 +++++
 .../app/service/ApplicationProviderService.java |  31 ++
 .../service/ApplicationProviderServiceImpl.java |  87 ++++++
 .../loader/ApplicationProviderConfigLoader.java | 128 ++++++++
 .../loader/ApplicationProviderSPILoader.java    |  89 ++++++
 .../apache/eagle/app/sink/KafkaStreamSink.java  |  65 ++++
 .../eagle/app/sink/LoggingStreamSink.java       |  43 +++
 .../org/apache/eagle/app/sink/StreamSink.java   |  82 +++++
 .../app/spi/AbstractApplicationProvider.java    | 144 +++++++++
 .../eagle/app/spi/ApplicationProvider.java      |  37 +++
 .../org/apache/eagle/app/test/AppSimulator.java |  51 ++++
 .../apache/eagle/app/test/AppSimulatorImpl.java |  89 ++++++
 .../eagle/app/test/AppTestGuiceModule.java      |  33 ++
 .../eagle/app/test/AppUnitTestRunner.java       |  84 +++++
 .../java/org/apache/eagle/app/test/Modules.java |  39 +++
 .../org/apache/eagle/app/test/package-info.java |  46 +++
 .../eagle/app/tools/DynamicJarPathFinder.java   | 121 ++++++++
 .../src/main/resources/applications.xml         |  42 +++
 .../src/main/resources/log4j.properties         |  21 ++
 .../app/ApplicationProviderDescConfigTest.java  |  53 ++++
 .../app/ApplicationProviderServiceTest.java     |  47 +++
 .../eagle/app/ConfigurationHelperTest.java      |  33 ++
 .../org/apache/eagle/app/StreamDefinitions.java |  37 +++
 .../apache/eagle/app/TestApplicationImpl.java   |  82 +++++
 .../eagle/app/TestApplicationTestSuite.java     |  82 +++++
 .../test/resources/ExampleApplicationConf.xml   |  31 ++
 ...org.apache.eagle.app.spi.ApplicationProvider |  16 +
 .../src/test/resources/TestApplicationConf.xml  |  31 ++
 .../test/resources/TestApplicationMetadata.xml  | 103 +++++++
 .../test/resources/TestStreamDefinitionConf.xml |  37 +++
 .../src/test/resources/application.conf         |  54 ++++
 .../src/test/resources/config_template.xml      |  35 +++
 .../src/test/resources/log4j.properties         |  21 ++
 .../src/test/resources/providers.xml            |  23 ++
 .../eagle-app/eagle-application-service/pom.xml |  54 ++++
 .../application/AppManagerConstants.java        |  43 +++
 .../ApplicationManagementResource.java          | 109 +++++++
 .../application/dao/ApplicationManagerDAO.java  |  33 ++
 .../dao/ApplicationManagerDaoImpl.java          |  91 ++++++
 .../entity/ApplicationEntityRepo.java           |  30 ++
 .../entity/TopologyDescriptionEntity.java       | 104 +++++++
 .../entity/TopologyExecutionEntity.java         | 132 ++++++++
 .../entity/TopologyExecutionStatus.java         |  38 +++
 .../entity/TopologyOperationEntity.java         | 105 +++++++
 .../eagle-stream-application-manager/pom.xml    | 142 +++++++++
 .../stream/application/TopologyException.java   |  26 ++
 .../stream/application/TopologyExecutable.java  |  27 ++
 .../stream/application/TopologyFactory.java     |  55 ++++
 .../AbstractDynamicApplication.scala            |  32 ++
 .../stream/application/ApplicationManager.scala | 126 ++++++++
 .../application/ApplicationManagerUtils.scala   |  38 +++
 .../ApplicationSchedulerAsyncDAO.scala          | 179 +++++++++++
 .../stream/application/ExecutionPlatform.scala  |  30 ++
 .../application/ExecutionPlatformFactory.scala  |  49 +++
 .../eagle/stream/application/TaskExecutor.scala |  41 +++
 .../application/impl/StormDynamicTopology.scala |  44 +++
 .../impl/StormExecutionPlatform.scala           | 197 ++++++++++++
 .../scheduler/AppCommandExecutor.scala          | 170 +++++++++++
 .../scheduler/AppCommandLoader.scala            |  78 +++++
 .../scheduler/ApplicationScheduler.scala        |  81 +++++
 .../scheduler/StreamAppCoordinator.scala        |  54 ++++
 .../src/test/resources/application.conf         |  42 +++
 .../src/test/resources/log4j.properties         |  35 +++
 .../application/scheduler/MockTopology.scala    |  30 ++
 .../scheduler/StormApplicationManagerSpec.scala |  40 +++
 .../application/scheduler/TestScheduler.scala   |  61 ++++
 eagle-core/eagle-app/pom.xml                    |  38 +++
 .../eagle-application-service/pom.xml           |  54 ----
 .../application/AppManagerConstants.java        |  43 ---
 .../ApplicationManagementResource.java          | 109 -------
 .../application/dao/ApplicationManagerDAO.java  |  33 --
 .../dao/ApplicationManagerDaoImpl.java          |  91 ------
 .../entity/ApplicationEntityRepo.java           |  30 --
 .../entity/TopologyDescriptionEntity.java       | 104 -------
 .../entity/TopologyExecutionEntity.java         | 132 --------
 .../entity/TopologyExecutionStatus.java         |  38 ---
 .../entity/TopologyOperationEntity.java         | 105 -------
 .../eagle-stream-application-manager/pom.xml    | 142 ---------
 .../stream/application/TopologyException.java   |  26 --
 .../stream/application/TopologyExecutable.java  |  27 --
 .../stream/application/TopologyFactory.java     |  55 ----
 .../AbstractDynamicApplication.scala            |  32 --
 .../stream/application/ApplicationManager.scala | 126 --------
 .../application/ApplicationManagerUtils.scala   |  38 ---
 .../ApplicationSchedulerAsyncDAO.scala          | 179 -----------
 .../stream/application/ExecutionPlatform.scala  |  30 --
 .../application/ExecutionPlatformFactory.scala  |  49 ---
 .../eagle/stream/application/TaskExecutor.scala |  41 ---
 .../application/impl/StormDynamicTopology.scala |  44 ---
 .../impl/StormExecutionPlatform.scala           | 197 ------------
 .../scheduler/AppCommandExecutor.scala          | 170 -----------
 .../scheduler/AppCommandLoader.scala            |  78 -----
 .../scheduler/ApplicationScheduler.scala        |  81 -----
 .../scheduler/StreamAppCoordinator.scala        |  54 ----
 .../src/test/resources/application.conf         |  42 ---
 .../src/test/resources/log4j.properties         |  35 ---
 .../application/scheduler/MockTopology.scala    |  30 --
 .../scheduler/StormApplicationManagerSpec.scala |  40 ---
 .../application/scheduler/TestScheduler.scala   |  61 ----
 eagle-core/eagle-application-management/pom.xml |  38 ---
 eagle-core/eagle-common/pom.xml                 |  82 +++++
 .../src/main/java/META-INF/MANIFEST.MF          |  19 ++
 .../java/org/apache/eagle/common/Base64.java    |  44 +++
 .../java/org/apache/eagle/common/ByteUtil.java  | 178 +++++++++++
 .../apache/eagle/common/CircularArrayList.java  | 149 +++++++++
 .../common/CircularArrayListSortedSet.java      | 106 +++++++
 .../org/apache/eagle/common/DateTimeUtil.java   | 150 +++++++++
 .../apache/eagle/common/EagleBase64Wrapper.java |  32 ++
 .../eagle/common/EagleExceptionWrapper.java     |  42 +++
 .../org/apache/eagle/common/Environment.java    |  23 ++
 .../main/java/org/apache/eagle/common/OS.java   |  41 +++
 .../apache/eagle/common/SerializableUtils.java  | 126 ++++++++
 .../apache/eagle/common/config/EagleConfig.java |  60 ++++
 .../common/config/EagleConfigConstants.java     |  65 ++++
 .../eagle/common/config/EagleConfigFactory.java | 198 ++++++++++++
 .../eagle/common/config/EagleConfigHelper.java  |  51 ++++
 .../eagle/common/email/EagleMailClient.java     | 253 ++++++++++++++++
 .../eagle/common/metric/AlertContext.java       |  94 ++++++
 .../eagle/common/module/CommonGuiceModule.java  |  28 ++
 .../common/module/ConfigServiceProvider.java    |  30 ++
 .../common/service/HadoopAccountService.java    |  23 ++
 .../apache/eagle/common/service/HadoopUser.java |  44 +++
 .../eagle/common/service/LdapService.java       | 259 ++++++++++++++++
 .../common/service/POSTResultEntityBase.java    |  42 +++
 .../service/TrustAllSSLSocketFactory.java       |  94 ++++++
 .../eagle-common/src/main/resources/footer.vm   |  25 ++
 .../eagle-common/src/main/resources/header.vm   | 303 +++++++++++++++++++
 .../src/main/resources/templates/tec_alert.vm   | 113 +++++++
 .../org/apache/eagle/common/TestByteUtil.java   | 111 +++++++
 .../eagle/common/TestCircularArrayList.java     |  74 +++++
 .../common/TestCircularArrayListSortedSet.java  |  58 ++++
 .../apache/eagle/common/TestDateTimeUtil.java   |  87 ++++++
 .../eagle/common/TestEagleBase64Wrapper.java    |  38 +++
 .../eagle/common/config/TestEagleConfig.java    |  43 +++
 .../eagle/common/metric/TestAlertContext.java   |  39 +++
 .../eagle-common/src/test/resources/footer.vm   |  25 ++
 .../eagle-common/src/test/resources/header.vm   | 299 ++++++++++++++++++
 .../src/test/resources/log4j.properties         |  34 +++
 .../src/test/resources/templates/tec_alert.vm   | 119 ++++++++
 .../resources/templates/test_anomaly_alert.vm   | 137 +++++++++
 .../src/test/resources/test-service-config.conf |  30 ++
 .../eagle-metadata/eagle-metadata-base/pom.xml  |  53 ++++
 .../eagle/metadata/model/ApplicationDesc.java   | 141 +++++++++
 .../eagle/metadata/model/ApplicationDocs.java   |  38 +++
 .../eagle/metadata/model/ApplicationEntity.java | 153 ++++++++++
 .../metadata/model/ApplicationRawEntity.java    |  72 +++++
 .../eagle/metadata/model/Configuration.java     |  74 +++++
 .../apache/eagle/metadata/model/Property.java   |  56 ++++
 .../apache/eagle/metadata/model/SiteEntity.java |  68 +++++
 .../apache/eagle/metadata/model/StreamDesc.java |  60 ++++
 .../persistence/MemoryMetadataStore.java        |  33 ++
 .../metadata/persistence/MetadataStore.java     |  50 +++
 .../metadata/persistence/PersistenceEntity.java |  64 ++++
 .../persistence/PersistenceService.java         |  25 ++
 .../metadata/persistence/package-info.java      |  17 ++
 .../eagle/metadata/resource/RestResponse.java   | 259 ++++++++++++++++
 .../eagle/metadata/resource/SiteResource.java   |  59 ++++
 .../metadata/resource/UncheckedFunction.java    |  29 ++
 .../metadata/resource/UnhandledConsumer.java    |  22 ++
 .../metadata/resource/UnhandledSupplier.java    |  29 ++
 .../service/ApplicationDescService.java         |  26 ++
 .../service/ApplicationEntityService.java       |  30 ++
 .../metadata/service/SiteEntityService.java     |  25 ++
 .../ApplicationEntityServiceMemoryImpl.java     | 101 +++++++
 .../SiteEntityEntityServiceMemoryImpl.java      |  64 ++++
 .../metadata/utils/ConfigTemplateHelper.java    |  68 +++++
 .../eagle/metadata/utils/UUIDGenerator.java     |  25 ++
 .../eagle-metadata/eagle-metadata-jdbc/pom.xml  |  37 +++
 .../store/mysql/MySQLMetadataStore.java         |  29 ++
 .../eagle-metadata/eagle-metadata-mongo/pom.xml |  37 +++
 .../store/mongo/MongoMetadataStore.java         |  29 ++
 eagle-core/eagle-metadata/pom.xml               |  36 +++
 eagle-core/eagle-query/eagle-common/pom.xml     |  83 -----
 .../src/main/java/META-INF/MANIFEST.MF          |  19 --
 .../java/org/apache/eagle/common/Base64.java    |  44 ---
 .../java/org/apache/eagle/common/ByteUtil.java  | 178 -----------
 .../apache/eagle/common/CircularArrayList.java  | 149 ---------
 .../common/CircularArrayListSortedSet.java      | 106 -------
 .../org/apache/eagle/common/DateTimeUtil.java   | 150 ---------
 .../apache/eagle/common/EagleBase64Wrapper.java |  32 --
 .../eagle/common/EagleExceptionWrapper.java     |  42 ---
 .../org/apache/eagle/common/Environment.java    |  23 --
 .../main/java/org/apache/eagle/common/OS.java   |  41 ---
 .../apache/eagle/common/SerializableUtils.java  | 126 --------
 .../apache/eagle/common/config/EagleConfig.java |  60 ----
 .../common/config/EagleConfigConstants.java     |  65 ----
 .../eagle/common/config/EagleConfigFactory.java | 198 ------------
 .../eagle/common/config/EagleConfigHelper.java  |  51 ----
 .../eagle/common/email/EagleMailClient.java     | 253 ----------------
 .../eagle/common/metric/AlertContext.java       |  95 ------
 .../common/service/HadoopAccountService.java    |  23 --
 .../apache/eagle/common/service/HadoopUser.java |  44 ---
 .../eagle/common/service/LdapService.java       | 259 ----------------
 .../common/service/POSTResultEntityBase.java    |  42 ---
 .../service/TrustAllSSLSocketFactory.java       |  94 ------
 .../eagle-common/src/main/resources/footer.vm   |  25 --
 .../eagle-common/src/main/resources/header.vm   | 303 -------------------
 .../src/main/resources/templates/tec_alert.vm   | 113 -------
 .../org/apache/eagle/common/TestByteUtil.java   | 111 -------
 .../eagle/common/TestCircularArrayList.java     |  74 -----
 .../common/TestCircularArrayListSortedSet.java  |  58 ----
 .../apache/eagle/common/TestDateTimeUtil.java   |  87 ------
 .../eagle/common/TestEagleBase64Wrapper.java    |  38 ---
 .../eagle/common/config/TestEagleConfig.java    |  43 ---
 .../eagle/common/metric/TestAlertContext.java   |  39 ---
 .../eagle-common/src/test/resources/footer.vm   |  25 --
 .../eagle-common/src/test/resources/header.vm   | 299 ------------------
 .../src/test/resources/log4j.properties         |  34 ---
 .../src/test/resources/templates/tec_alert.vm   | 119 --------
 .../resources/templates/test_anomaly_alert.vm   | 137 ---------
 .../src/test/resources/test-service-config.conf |  30 --
 .../generic/GenericObjectMapperProvider.java    |   2 +
 eagle-core/eagle-query/pom.xml                  |   1 -
 eagle-core/pom.xml                              |   4 +-
 eagle-examples/eagle-app-example/pom.xml        |  52 ++++
 .../eagle/app/example/ExampleApplication.java   |  30 ++
 .../app/example/ExampleApplicationProvider.java |  63 ++++
 .../example/ExampleApplicationProvider2.java    |  33 ++
 .../eagle/app/example/RandomEventSpout.java     |  59 ++++
 .../main/resources/ExampleApplicationConf.xml   |  31 ++
 .../resources/ExampleApplicationMetadata.xml    | 101 +++++++
 ...org.apache.eagle.app.spi.ApplicationProvider |  17 ++
 .../src/main/webapp/app/apps/example/index.html |   6 +
 .../src/main/webapp/package.json                |   0
 .../app/example/ExampleApplicationTest.java     |  91 ++++++
 eagle-examples/pom.xml                          |   1 +
 .../security/service/InMemMetadataDaoImpl.java  |   3 +
 eagle-server/pom.xml                            | 143 +++++++++
 .../eagle/server/RESTExceptionMapper.java       |  62 ++++
 .../apache/eagle/server/ServerApplication.java  |  80 +++++
 .../org/apache/eagle/server/ServerConfig.java   |  52 ++++
 .../org/apache/eagle/server/ServerMain.java     |  23 ++
 .../src/main/resources/application.conf         |  57 ++++
 .../src/main/resources/log4j.properties         |  21 ++
 eagle-server/src/main/resources/providers.xml   |  27 ++
 eagle-server/src/main/webapp/app/index.html     |  19 ++
 eagle-server/src/main/webapp/package.json       |   0
 .../eagle/server/ServerApplicationTest.java     |  26 ++
 .../pwdgen/PasswordEncoderGenerator.java        |   2 +-
 pom.xml                                         |  51 +++-
 263 files changed, 12206 insertions(+), 6123 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamColumn.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamColumn.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamColumn.java
index bbfb942..b11729d 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamColumn.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamColumn.java
@@ -16,7 +16,14 @@
  */
 package org.apache.eagle.alert.engine.coordinator;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.io.IOException;
 import java.io.Serializable;
+import java.util.HashMap;
 
 
 public class StreamColumn implements Serializable {
@@ -40,6 +47,7 @@ public class StreamColumn implements Serializable {
         this.name = name;
     }
 
+    @XmlJavaTypeAdapter(StreamColumnTypeAdapter.class)
     public Type getType() {
         return type;
     }
@@ -48,12 +56,43 @@ public class StreamColumn implements Serializable {
         this.type = type;
     }
 
+    @XmlJavaTypeAdapter(value = DefaultValueAdapter.class)
     public Object getDefaultValue() {
         return defaultValue;
     }
 
+    private void ensureDefaultValueType() {
+        if(this.getDefaultValue()!=null && (this.getDefaultValue() instanceof String) && this.getType() != Type.STRING){
+            switch (this.getType()) {
+                case INT:
+                    this.setDefaultValue(Integer.valueOf((String) this.getDefaultValue()));
+                    break;
+                case LONG:
+                    this.setDefaultValue(Long.valueOf((String) this.getDefaultValue()));
+                    break;
+                case FLOAT:
+                    this.setDefaultValue(Float.valueOf((String) this.getDefaultValue()));
+                    break;
+                case DOUBLE:
+                    this.setDefaultValue(Double.valueOf((String) this.getDefaultValue()));
+                    break;
+                case BOOL:
+                    this.setDefaultValue(Double.valueOf((String) this.getDefaultValue()));
+                    break;
+                case OBJECT:
+                    try {
+                        this.setDefaultValue(new ObjectMapper().readValue((String) this.getDefaultValue(),HashMap.class));
+                    } catch (IOException e) {
+                        throw new IllegalArgumentException(e);
+                    }
+                    break;
+            }
+        }
+    }
+
     public void setDefaultValue(Object defaultValue) {
         this.defaultValue = defaultValue;
+        ensureDefaultValueType();
     }
 
     public boolean isRequired() {
@@ -98,6 +137,31 @@ public class StreamColumn implements Serializable {
         }
     }
 
+    public static class StreamColumnTypeAdapter extends XmlAdapter<String,Type>{
+
+        @Override
+        public Type unmarshal(String v) throws Exception {
+            return Type.getEnumFromValue(v);
+        }
+
+        @Override
+        public String marshal(Type v) throws Exception {
+            return v.name;
+        }
+    }
+
+    public static class DefaultValueAdapter extends XmlAdapter<String,Object>{
+        @Override
+        public Object unmarshal(String v) throws Exception {
+            return v;
+        }
+
+        @Override
+        public String marshal(Object v) throws Exception {
+            return v.toString();
+        }
+    }
+
     public static class Builder {
         private StreamColumn column;
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamDefinition.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamDefinition.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamDefinition.java
index cd5773a..beb8491 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamDefinition.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamDefinition.java
@@ -16,6 +16,7 @@
  */
 package org.apache.eagle.alert.engine.coordinator;
 
+import javax.xml.bind.annotation.*;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
@@ -34,7 +35,7 @@ public class StreamDefinition implements Serializable{
     private boolean validate;
     private boolean timeseries;
 
-    private List<StreamColumn> columns = new ArrayList<StreamColumn>();
+    private List<StreamColumn> columns = new ArrayList<>();
 
     public String toString(){
         return String.format("StreamDefinition[streamId=%s, dataSource=%s, description=%s, validate=%s, timeseries=%s, columns=%s",
@@ -78,6 +79,8 @@ public class StreamDefinition implements Serializable{
         this.timeseries = timeseries;
     }
 
+    @XmlElementWrapper(name="columns")
+    @XmlElement(name = "column")
     public List<StreamColumn> getColumns() {
         return columns;
     }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/mock/MockSampleMetadataFactory.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/mock/MockSampleMetadataFactory.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/mock/MockSampleMetadataFactory.java
index 97e6310..22c13a2 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/mock/MockSampleMetadataFactory.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/mock/MockSampleMetadataFactory.java
@@ -63,11 +63,6 @@ public class MockSampleMetadataFactory {
         streamColumns.add(new StreamColumn.Builder().name("flag").type(StreamColumn.Type.BOOL).build());
         streamColumns.add(new StreamColumn.Builder().name("timestamp").type(StreamColumn.Type.LONG).build());
         streamColumns.add(new StreamColumn.Builder().name("value").type(StreamColumn.Type.DOUBLE).build());
-//        streamColumns.add(new StreamColumn.Builder().name("value1").type(StreamColumn.Type.DOUBLE).build());
-//        streamColumns.add(new StreamColumn.Builder().name("value2").type(StreamColumn.Type.DOUBLE).build());
-//        streamColumns.add(new StreamColumn.Builder().name("value3").type(StreamColumn.Type.DOUBLE).build());
-//        streamColumns.add(new StreamColumn.Builder().name("value4").type(StreamColumn.Type.DOUBLE).build());
-//        streamColumns.add(new StreamColumn.Builder().name("value5").type(StreamColumn.Type.DOUBLE).build());
         sampleStreamDefinition.setColumns(streamColumns);
         return sampleStreamDefinition;
     }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/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/service/metadata/resource/MetadataResource.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/MetadataResource.java
index 7e4dea7..8712241 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/MetadataResource.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/MetadataResource.java
@@ -27,6 +27,7 @@ import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 
+import com.google.inject.Inject;
 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;
@@ -36,8 +37,8 @@ import org.apache.eagle.alert.engine.coordinator.Publishment;
 import org.apache.eagle.alert.engine.coordinator.PublishmentType;
 import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
 import org.apache.eagle.alert.engine.coordinator.StreamingCluster;
-import org.apache.eagle.alert.metadata.impl.MetadataDaoFactory;
 import org.apache.eagle.alert.metadata.IMetadataDao;
+import org.apache.eagle.alert.metadata.impl.MetadataDaoFactory;
 import org.apache.eagle.alert.metadata.resource.Models;
 import org.apache.eagle.alert.metadata.resource.OpResult;
 
@@ -50,7 +51,13 @@ import org.apache.eagle.alert.metadata.resource.OpResult;
 @Consumes("application/json")
 public class MetadataResource {
 
-    private IMetadataDao dao = MetadataDaoFactory.getInstance().getMetadataDao();
+//    private IMetadataDao dao = MetadataDaoFactory.getInstance().getMetadataDao();
+    private final IMetadataDao dao;
+
+    @Inject
+    public MetadataResource(IMetadataDao dao){
+        this.dao = dao;
+    }
 
     @Path("/clusters")
     @GET

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/pom.xml b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/pom.xml
index 7b789ab..1c0506b 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/pom.xml
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/pom.xml
@@ -58,5 +58,10 @@
 			<version>1.50.5</version>
 			<scope>test</scope>
 		</dependency>
+		<dependency>
+			<groupId>com.google.inject</groupId>
+			<artifactId>guice</artifactId>
+			<version>3.0</version>
+		</dependency>
 	</dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/InMemMetadataDaoImpl.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/InMemMetadataDaoImpl.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/InMemMetadataDaoImpl.java
index fc1bbaa..ecd9a6e 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/InMemMetadataDaoImpl.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/InMemMetadataDaoImpl.java
@@ -25,6 +25,7 @@ import java.util.SortedMap;
 import java.util.TreeMap;
 import java.util.function.Predicate;
 
+import com.google.inject.Inject;
 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;
@@ -64,7 +65,8 @@ public class InMemMetadataDaoImpl implements IMetadataDao {
     private SortedMap<String, ScheduleState> scheduleStates = new TreeMap<String, ScheduleState>();
     private List<PolicyAssignment> assignments = new ArrayList<PolicyAssignment>();
     private List<Topology> topologies = new ArrayList<Topology>();
-    
+
+    @Inject
     public InMemMetadataDaoImpl(Config config) {
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/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
index a5448a4..08d670a 100644
--- 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
@@ -98,17 +98,19 @@ public class JdbcDatabaseHandler {
             LOG.info("update {} entities", status);
             connection.commit();
         } catch (SQLException e) {
-            //e.printStackTrace();
+            LOG.error(e.getMessage(),e.getCause());
             if(e.getMessage().toLowerCase().contains("duplicate")){
+                LOG.info("Detected duplicated entity");
                 try {
                     connection.rollback(savepoint);
                     update(tb, key, value);
                 } catch (SQLException e1) {
                     //e1.printStackTrace();
-                    LOG.warn("Rollback failed");
+                    LOG.warn("Rollback failed",e1);
                 }
             }
         } catch (JsonProcessingException e) {
+            LOG.error("Got JsonProcessingException: {}",e.getMessage(),e.getCause());
             result.code = OpResult.FAILURE;
             result.message = e.getMessage();
         } finally {
@@ -116,7 +118,7 @@ public class JdbcDatabaseHandler {
                 try {
                     statement.close();
                 } catch (SQLException e) {
-                    e.printStackTrace();
+                    LOG.error("Failed to close statement: {}",e.getMessage(),e.getCause());
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/JdbcMetadataDaoImpl.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/JdbcMetadataDaoImpl.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/JdbcMetadataDaoImpl.java
index 6233938..639edd6 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/JdbcMetadataDaoImpl.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/JdbcMetadataDaoImpl.java
@@ -19,6 +19,7 @@ package org.apache.eagle.alert.metadata.impl;
 import java.io.IOException;
 import java.util.List;
 
+import com.google.inject.Inject;
 import com.typesafe.config.Config;
 import org.apache.eagle.alert.coordination.model.Kafka2TupleMetadata;
 import org.apache.eagle.alert.coordination.model.ScheduleState;
@@ -40,6 +41,7 @@ import org.apache.eagle.alert.metadata.resource.Models;
 public class JdbcMetadataDaoImpl implements IMetadataDao {
     private JdbcDatabaseHandler handler;
 
+    @Inject
     public JdbcMetadataDaoImpl(Config config) {
         handler = new JdbcDatabaseHandler(config);
     }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/MongoMetadataDaoImpl.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/MongoMetadataDaoImpl.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/MongoMetadataDaoImpl.java
index 4e2beab..a990b13 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/MongoMetadataDaoImpl.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/impl/MongoMetadataDaoImpl.java
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.util.LinkedList;
 import java.util.List;
 
+import com.google.inject.Inject;
 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;
@@ -80,6 +81,7 @@ public class MongoMetadataDaoImpl implements IMetadataDao {
     private MongoCollection<Document> assignments;
     private MongoCollection<Document> topologies;
 
+    @Inject
     public MongoMetadataDaoImpl(Config config) {
         this.connection = config.getString("connection");
         this.client = new MongoClient(new MongoClientURI(this.connection));

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-alert-parent/eagle-alert/alert-service/src/main/java/org/apache/eagle/service/app/ServiceApp.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-service/src/main/java/org/apache/eagle/service/app/ServiceApp.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-service/src/main/java/org/apache/eagle/service/app/ServiceApp.java
index e4c1a42..8e6fa88 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-service/src/main/java/org/apache/eagle/service/app/ServiceApp.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-service/src/main/java/org/apache/eagle/service/app/ServiceApp.java
@@ -66,11 +66,8 @@ public class ServiceApp extends Application<AlertDropWizardConfiguration> {
         environment.getApplicationContext().setContextPath("/rest");
         environment.getObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
 
-        MetadataResource resource = new MetadataResource();
-        environment.jersey().register(resource);
-
-        CoordinatorResource coorResource = new CoordinatorResource();
-        environment.jersey().register(coorResource);
+        environment.jersey().register(MetadataResource.class);
+        environment.jersey().register(CoordinatorResource.class);
 
         // swagger resources
         environment.jersey().register(new ApiListingResource());

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-alert-parent/eagle-alert/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/pom.xml b/eagle-core/eagle-alert-parent/eagle-alert/pom.xml
index 4c143ec..af6193d 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/pom.xml
+++ b/eagle-core/eagle-alert-parent/eagle-alert/pom.xml
@@ -291,42 +291,6 @@
 				<artifactId>commons-cli</artifactId>
 				<version>${common.cli.version}</version>
 			</dependency>
-
-			<!-- dropwizard -->
-		    <dependency>
-		        <groupId>io.dropwizard</groupId>
-		        <artifactId>dropwizard-core</artifactId>
-		        <version>${dropwizard.version}</version>
-		        <exclusions>
-			        <exclusion>
-						<groupId>org.slf4j</groupId>
-						<artifactId>slf4j-log4j12</artifactId>
-					</exclusion>
-		        </exclusions>
-		    </dependency>
-		    <dependency>
-		        <groupId>io.dropwizard</groupId>
-		        <artifactId>dropwizard-jersey</artifactId>
-		        <version>${dropwizard.version}</version>
-		        <exclusions>
-			        <exclusion>
-						<groupId>org.slf4j</groupId>
-						<artifactId>slf4j-log4j12</artifactId>
-					</exclusion>
-		        </exclusions>
-		    </dependency>
-		    <dependency>
-				<groupId>io.swagger</groupId>
-				<artifactId>swagger-jersey-jaxrs</artifactId>
-				<version>${swagger.version}</version>
-				<scope>compile</scope>
-				<exclusions>
-					<exclusion>
-						<groupId>com.sun.jersey</groupId>
-						<artifactId>*</artifactId>
-					</exclusion>
-				</exclusions>
-			</dependency>
 		</dependencies>
 	</dependencyManagement>
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/pom.xml b/eagle-core/eagle-app/eagle-app-base/pom.xml
new file mode 100644
index 0000000..500db86
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/pom.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eagle-app-parent</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>eagle-app-base</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+            <version>${guice.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.typesafe</groupId>
+            <artifactId>config</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.google.inject.extensions</groupId>
+            <artifactId>guice-servlet</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>jsr311-api</artifactId>
+            <version>1.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>alert-metadata</artifactId>
+            <version>${project.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>xerces</groupId>
+                    <artifactId>xercesImpl</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-server</artifactId>
+            <version>${jersey.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-metadata-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-metadata-base</artifactId>
+            <version>0.5.0-incubating-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

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/AbstractApplication.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/AbstractApplication.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/AbstractApplication.java
new file mode 100644
index 0000000..1cb2625
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/AbstractApplication.java
@@ -0,0 +1,143 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+import backtype.storm.Config;
+import backtype.storm.LocalCluster;
+import backtype.storm.StormSubmitter;
+import backtype.storm.generated.*;
+import backtype.storm.topology.TopologyBuilder;
+import backtype.storm.utils.NimbusClient;
+import org.apache.eagle.metadata.model.ApplicationEntity;
+import org.apache.thrift7.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import scala.Int;
+import storm.trident.spout.RichSpoutBatchExecutor;
+
+import java.io.Serializable;
+
+public abstract class AbstractApplication implements Application,Serializable {
+    private final static Logger LOG = LoggerFactory.getLogger(AbstractApplication.class);
+    private static LocalCluster _localCluster;
+
+    static {
+        Runtime.getRuntime().addShutdownHook(new Thread(){
+            @Override
+            public void run() {
+                if(_localCluster != null) {
+                    LOG.info("Shutting down local storm cluster instance");
+                    _localCluster.shutdown();
+                }
+            }
+        });
+    }
+
+    private static LocalCluster getLocalCluster(){
+        if(_localCluster == null){
+            _localCluster = new LocalCluster();
+        }
+
+        return _localCluster;
+    }
+
+    @Override
+    public void start(ApplicationContext context){
+        ApplicationEntity appEntity = context.getAppEntity();
+        String topologyName = context.getAppEntity().getAppId();
+
+        TopologyBuilder builder = new TopologyBuilder();
+        buildTopology(builder,context);
+        StormTopology topology = builder.createTopology();
+        Config conf = getClusterStormConfig(context);
+        if(appEntity.getMode() == ApplicationEntity.Mode.CLUSTER){
+            String jarFile = context.getAppEntity().getDescriptor().getJarPath();
+            synchronized (AbstractApplication.class) {
+                System.setProperty("storm.jar", jarFile);
+                LOG.info("Submitting as cluster mode");
+                try {
+                    StormSubmitter.submitTopologyWithProgressBar(topologyName, conf, topology);
+                } catch (AlreadyAliveException | InvalidTopologyException e) {
+                    LOG.error(e.getMessage(), e);
+                    throw new RuntimeException(e.getMessage(),e);
+                } finally {
+                    System.clearProperty("storm.jar");
+                }
+            }
+        }else{
+            LOG.info("Submitting as local mode");
+            getLocalCluster().submitTopology(topologyName, conf, topology);
+        }
+    }
+
+    private final static String STORM_NIMBUS_HOST_CONF_PATH = "application.storm.nimbusHost";
+    private final static String STORM_NIMBUS_HOST_DEFAULT = "localhost";
+    private final static Integer STORM_NIMBUS_THRIFT_DEFAULT = 6627;
+    private final static String STORM_NIMBUS_THRIFT_CONF_PATH = "application.storm.nimbusThriftPort";
+
+    private static Config getClusterStormConfig(ApplicationContext context){
+        Config conf = new Config();
+        conf.put(RichSpoutBatchExecutor.MAX_BATCH_SIZE_CONF, Int.box(64 * 1024));
+        conf.put(Config.TOPOLOGY_RECEIVER_BUFFER_SIZE, Int.box(8));
+        conf.put(Config.TOPOLOGY_TRANSFER_BUFFER_SIZE, Int.box(32));
+        conf.put(Config.TOPOLOGY_EXECUTOR_RECEIVE_BUFFER_SIZE, Int.box(16384));
+        conf.put(Config.TOPOLOGY_EXECUTOR_SEND_BUFFER_SIZE, Int.box(16384));
+        conf.put(Config.NIMBUS_THRIFT_MAX_BUFFER_SIZE, Int.box(20480000));
+        String nimbusHost = STORM_NIMBUS_HOST_DEFAULT;
+
+        if(context.getEnvConfig().hasPath(STORM_NIMBUS_HOST_CONF_PATH)) {
+            nimbusHost = context.getEnvConfig().getString(STORM_NIMBUS_HOST_CONF_PATH);
+            LOG.info("Overriding {} = {}",STORM_NIMBUS_HOST_CONF_PATH,nimbusHost);
+        } else {
+            LOG.info("Using default {} = {}",STORM_NIMBUS_HOST_CONF_PATH,STORM_NIMBUS_HOST_DEFAULT);
+        }
+        Integer nimbusThriftPort =  STORM_NIMBUS_THRIFT_DEFAULT;
+        if(context.getEnvConfig().hasPath(STORM_NIMBUS_THRIFT_CONF_PATH)) {
+            nimbusThriftPort = context.getEnvConfig().getInt(STORM_NIMBUS_THRIFT_CONF_PATH);
+            LOG.info("Overriding {} = {}",STORM_NIMBUS_THRIFT_CONF_PATH,nimbusThriftPort);
+        } else {
+            LOG.info("Using default {} = {}",STORM_NIMBUS_THRIFT_CONF_PATH,STORM_NIMBUS_THRIFT_DEFAULT);
+        }
+        conf.put(backtype.storm.Config.NIMBUS_HOST, nimbusHost);
+        conf.put(backtype.storm.Config.NIMBUS_THRIFT_PORT, nimbusThriftPort);
+        return conf;
+    }
+
+    protected abstract void buildTopology(TopologyBuilder builder, ApplicationContext context);
+
+    @Override
+    public void stop(ApplicationContext context) {
+        ApplicationEntity appEntity = context.getAppEntity();
+        String appId = appEntity.getAppId();
+        if(appEntity.getMode() == ApplicationEntity.Mode.CLUSTER){
+            Nimbus.Client stormClient = NimbusClient.getConfiguredClient(getClusterStormConfig(context)).getClient();
+            try {
+                stormClient.killTopology(appId);
+            } catch (NotAliveException | TException e) {
+                LOG.error("Failed to kill topology named {}, due to: {}",appId,e.getMessage(),e.getCause());
+            }
+        } else {
+            getLocalCluster().killTopology(appId);
+        }
+    }
+
+    @Override
+    public void status(ApplicationContext context) {
+        // TODO: Not implemented yet!
+        throw new RuntimeException("TODO: Not implemented yet!");
+    }
+}
\ No newline at end of file

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/Application.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/Application.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/Application.java
new file mode 100644
index 0000000..ffe5339
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/Application.java
@@ -0,0 +1,40 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+/**
+ * Application Lifecycle Interface
+ */
+public interface Application {
+    /**
+     *
+     * @param context
+     */
+    void start(ApplicationContext context);
+
+    /**
+     *
+     * @param context
+     */
+    void stop(ApplicationContext context);
+
+    /**
+     * 
+     * @param context
+     */
+    void status(ApplicationContext context);
+}
\ No newline at end of file

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/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
new file mode 100644
index 0000000..1723250
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/ApplicationContext.java
@@ -0,0 +1,108 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+import com.typesafe.config.Config;
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.apache.eagle.app.sink.StreamSink;
+import org.apache.eagle.metadata.model.ApplicationEntity;
+import org.apache.eagle.metadata.model.StreamDesc;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Application Execution Context
+ */
+public class ApplicationContext implements Serializable {
+    private final Config envConfig;
+    private final ApplicationEntity appEntity;
+    private final static Logger LOG = LoggerFactory.getLogger(ApplicationContext.class);
+    private final Map<String, StreamSink> streamSinkMap;
+    private final Map<String,StreamDesc> streamDescMap;
+
+    public ApplicationContext(ApplicationEntity appEntity, Config envConfig){
+        this.appEntity = appEntity;
+        this.envConfig = envConfig;
+        this.streamSinkMap = new HashMap<>();
+        this.streamDescMap = new HashMap<>();
+
+        // TODO: Decouple out of ApplicationContext constructor
+        doInit();
+    }
+
+    private void doInit() {
+        try {
+            Class<?> sinkClass = appEntity.getDescriptor().getSinkClass();
+            List<StreamDefinition> outputStreams = appEntity.getDescriptor().getStreams();
+            if(null != outputStreams){
+                Constructor constructor = sinkClass.getConstructor(StreamDefinition.class,ApplicationContext.class);
+                outputStreams.forEach((stream) -> {
+                    try {
+                        StreamSink streamSink = (StreamSink) constructor.newInstance(stream,this);
+                        streamSinkMap.put(stream.getStreamId(), streamSink);
+                        StreamDesc streamDesc = new StreamDesc();
+                        streamDesc.setStreamSchema(stream);
+                        streamDesc.setSinkContext(streamSink.getSinkContext());
+                        streamDesc.setSinkType(sinkClass);
+                        streamDesc.setStreamId(stream.getStreamId());
+                        streamDescMap.put(streamDesc.getStreamId(),streamDesc);
+                    } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
+                        LOG.error("Failed to initialize instance "+sinkClass.getCanonicalName()+" for application: {}",this.getAppEntity());
+                        throw new RuntimeException("Failed to initialize instance "+sinkClass.getCanonicalName()+" for application:"+this.getAppEntity(),e);
+                    }
+                });
+            }
+        } catch (NoSuchMethodException e) {
+            LOG.error(e.getMessage(),e);
+            throw new RuntimeException(e.getMessage(),e.getCause());
+        }
+    }
+
+    public ApplicationEntity getAppEntity() {
+        return appEntity;
+    }
+
+    public Config getEnvConfig() {
+        return envConfig;
+    }
+
+    /**
+     * Make sure streamId is declared in Application Providers
+     *
+     * @param streamId
+     * @return
+     */
+    public StreamSink getStreamSink(String streamId){
+        if(streamSinkMap.containsKey(streamId)) {
+            return streamSinkMap.get(streamId);
+        } else {
+            throw new IllegalStateException("Stream (ID: "+streamId+") was not declared in "+this.appEntity.getDescriptor().getProviderClass().getCanonicalName()+" before being called");
+        }
+    }
+
+    public Collection<StreamDesc> getStreamSinkDescs(){
+        return streamDescMap.values();
+    }
+}
\ No newline at end of file

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/ApplicationGuiceModule.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/ApplicationGuiceModule.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/ApplicationGuiceModule.java
new file mode 100644
index 0000000..9a66b6c
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/ApplicationGuiceModule.java
@@ -0,0 +1,36 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Singleton;
+import org.apache.eagle.app.service.ApplicationManagementService;
+import org.apache.eagle.app.service.ApplicationManagementServiceImpl;
+import org.apache.eagle.app.service.ApplicationProviderService;
+import org.apache.eagle.app.service.ApplicationProviderServiceImpl;
+import org.apache.eagle.metadata.service.ApplicationDescService;
+
+
+public class ApplicationGuiceModule extends AbstractModule {
+    @Override
+    protected void configure() {
+        bind(ApplicationProviderServiceImpl.class).in(Singleton.class);
+        bind(ApplicationProviderService.class).to(ApplicationProviderServiceImpl.class).in(Singleton.class);
+        bind(ApplicationDescService.class).to(ApplicationProviderServiceImpl.class).in(Singleton.class);
+        bind(ApplicationManagementService.class).to(ApplicationManagementServiceImpl.class).in(Singleton.class);
+    }
+}
\ No newline at end of file

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/config/ApplicationProviderConfig.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/config/ApplicationProviderConfig.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/config/ApplicationProviderConfig.java
new file mode 100644
index 0000000..e3cd9e7
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/config/ApplicationProviderConfig.java
@@ -0,0 +1,55 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.config;
+
+import org.apache.eagle.app.spi.ApplicationProvider;
+
+public class ApplicationProviderConfig {
+    private String jarPath;
+    private String className;
+
+    public ApplicationProviderConfig(){}
+    public ApplicationProviderConfig(String jarPath, Class<? extends ApplicationProvider> className){
+        this.jarPath = jarPath;
+        this.className = className.getCanonicalName();
+    }
+    public ApplicationProviderConfig(String jarPath, String className){
+        this.jarPath = jarPath;
+        this.className = className;
+    }
+    @Override
+    public String toString() {
+        return String.format("ApplicationProviderConfig[jarPath=%s,className=%s]",this.getJarPath(),this.getClassName());
+    }
+
+    public String getJarPath() {
+        return jarPath;
+    }
+
+    public void setJarPath(String jarPath) {
+        this.jarPath = jarPath;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+}
\ No newline at end of file

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/config/ApplicationProviderDescConfig.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/config/ApplicationProviderDescConfig.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/config/ApplicationProviderDescConfig.java
new file mode 100644
index 0000000..1fbae16
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/config/ApplicationProviderDescConfig.java
@@ -0,0 +1,147 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.config;
+
+
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.apache.eagle.metadata.model.ApplicationDocs;
+import org.apache.eagle.metadata.model.Configuration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.annotation.*;
+import java.io.InputStream;
+import java.util.List;
+
+@XmlRootElement(name = "application")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class ApplicationProviderDescConfig {
+    private String type;
+    private String name;
+    private String version;
+    private String description;
+    private String appClass;
+    private String viewPath;
+    private Configuration configuration;
+    private ApplicationDocs docs;
+
+    @XmlElementWrapper(name="streams")
+    @XmlElement(name = "stream")
+    private List<StreamDefinition> streams;
+
+    public String getDescription() {
+        return description;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public Configuration getConfiguration() {
+        return configuration;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getViewPath() {
+        return viewPath;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public void setViewPath(String viewPath) {
+        this.viewPath = viewPath;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("ApplicationDesc [type=%s, name=%s, version=%s, appClass=%s, viewPath=%s, configuration= %s properties, description=%s",
+                getType(),getName(),getVersion(),getAppClass(), getViewPath(), getConfiguration() == null ? 0: getConfiguration().size(),getDescription());
+    }
+
+    public void setConfiguration(Configuration configuration) {
+        this.configuration = configuration;
+    }
+
+
+    public List<StreamDefinition> getStreams() {
+        return streams;
+    }
+
+    public void setStreams(List<StreamDefinition> streams) {
+        this.streams = streams;
+    }
+
+    private final static Logger LOG = LoggerFactory.getLogger(ApplicationProviderDescConfig.class);
+
+    public static ApplicationProviderDescConfig loadFromXML(String configXmlFile){
+        try {
+            JAXBContext jc = JAXBContext.newInstance(ApplicationProviderDescConfig.class);
+            Unmarshaller unmarshaller = jc.createUnmarshaller();
+            InputStream is = ApplicationProviderDescConfig.class.getResourceAsStream(configXmlFile);
+            if(is == null){
+                is = ApplicationProviderDescConfig.class.getResourceAsStream("/"+configXmlFile);
+            }
+            if(is == null){
+                LOG.error("Application descriptor configuration {} is not found",configXmlFile);
+                throw new IllegalStateException("Application descriptor configuration "+configXmlFile+" is not found");
+            }
+            return (ApplicationProviderDescConfig) unmarshaller.unmarshal(is);
+        }catch (Exception ex){
+            LOG.error("Failed to load application descriptor configuration: {}",configXmlFile,ex);
+            throw new RuntimeException("Failed to load application descriptor configuration: "+configXmlFile,ex);
+        }
+    }
+
+    public String getAppClass() {
+        return appClass;
+    }
+
+    public void setAppClass(String appClass) {
+        this.appClass = appClass;
+    }
+
+    public ApplicationDocs getDocs() {
+        return docs;
+    }
+
+    public void setDocs(ApplicationDocs docs) {
+        this.docs = docs;
+    }
+}

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/config/ApplicationProvidersConfig.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/config/ApplicationProvidersConfig.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/config/ApplicationProvidersConfig.java
new file mode 100644
index 0000000..f5aaa9f
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/config/ApplicationProvidersConfig.java
@@ -0,0 +1,39 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.config;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
+
+@XmlRootElement(name = "providers")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class ApplicationProvidersConfig {
+
+    @XmlElement(name = "provider")
+    private List<ApplicationProviderConfig> providers;
+
+    public List<ApplicationProviderConfig> getProviders() {
+        return providers;
+    }
+
+    public void setProviders(List<ApplicationProviderConfig> providers) {
+        this.providers = providers;
+    }
+}
\ No newline at end of file

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/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
new file mode 100644
index 0000000..a0654ff
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/resource/ApplicationResource.java
@@ -0,0 +1,155 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.resource;
+
+
+import com.google.inject.Inject;
+import org.apache.eagle.app.service.ApplicationManagementService;
+import org.apache.eagle.app.service.AppOperations;
+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.service.ApplicationEntityService;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import java.util.Collection;
+
+@Path("/apps")
+public class ApplicationResource {
+    private final ApplicationProviderService providerService;
+    private final ApplicationManagementService applicationManagementService;
+    private final ApplicationEntityService entityService;
+
+    @Inject
+    public ApplicationResource(
+            ApplicationProviderService providerService,
+            ApplicationManagementService applicationManagementService,
+            ApplicationEntityService entityService){
+        this.providerService = providerService;
+        this.applicationManagementService = applicationManagementService;
+        this.entityService = entityService;
+    }
+
+    @GET
+    @Path("/providers")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Collection<ApplicationDesc> getApplicationDescs(){
+        return providerService.getApplicationDescs();
+    }
+
+    @GET
+    @Path("/providers/{type}")
+    @Produces(MediaType.APPLICATION_JSON)
+    public ApplicationDesc getApplicationDescs(@PathParam("type") String type){
+        return providerService.getApplicationDescByType(type);
+    }
+
+    @POST
+    @Path("/providers/reload")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Collection<ApplicationDesc> reloadApplicationDescs(){
+        providerService.reload();
+        return providerService.getApplicationDescs();
+    }
+
+    @GET
+    @Path("/")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Collection<ApplicationEntity> getApplicationEntities(@QueryParam("siteId") String siteId){
+        if(siteId == null) {
+            return entityService.findAll();
+        } else {
+            return entityService.findBySiteId(siteId);
+        }
+    }
+
+    @GET
+    @Path("/{appUuid}")
+    @Produces(MediaType.APPLICATION_JSON)
+    public ApplicationEntity getApplicationEntityByUUID(@PathParam("appUuid") String appUuid){
+        return entityService.getByUUID(appUuid);
+    }
+
+    /**
+     * <b>Request:</b>
+     * <pre>
+     * {
+     *      uuid: APPLICATION_UUID
+     * }
+     * </pre>
+     */
+    @POST
+    @Path("/install")
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    public ApplicationEntity installApplication(AppOperations.InstallOperation operation){
+        return applicationManagementService.install(operation);
+    }
+
+    /**
+     * <b>Request:</b>
+     * <pre>
+     * {
+     *      uuid: APPLICATION_UUID
+     * }
+     * </pre>
+     *
+     * @param operation
+     */
+    @POST
+    @Path("/uninstall")
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    public ApplicationEntity uninstallApplication(AppOperations.UninstallOperation operation){
+        return applicationManagementService.uninstall(operation);
+    }
+
+    /**
+     * <b>Request:</b>
+     * <pre>
+     * {
+     *      uuid: APPLICATION_UUID
+     * }
+     *operation
+     * @param operation
+     */
+    @POST
+    @Path("/start")
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    public ApplicationEntity startApplication(AppOperations.StartOperation operation){
+        return applicationManagementService.start(operation);
+    }
+
+    /**
+     * <b>Request:</b>
+     * <pre>
+     * {
+     *      uuid: APPLICATION_UUID
+     * }
+     * </pre>
+     * @param operation
+     */
+    @POST
+    @Path("/stop")
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    public ApplicationEntity stopApplication(AppOperations.StopOperation operation){
+        return applicationManagementService.stop(operation);
+    }
+}
\ No newline at end of file

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/AppOperations.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/AppOperations.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/AppOperations.java
new file mode 100644
index 0000000..f2395d6
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/AppOperations.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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 org.apache.eagle.metadata.model.ApplicationEntity;
+
+import java.io.Serializable;
+import java.util.Map;
+
+public class AppOperations {
+    interface Operation extends Serializable {
+        //
+    }
+
+    public static class InstallOperation implements Operation{
+        private String siteId;
+        private String appType;
+        private ApplicationEntity.Mode mode = ApplicationEntity.Mode.LOCAL;
+        private Map<String,Object> configuration;
+
+        public InstallOperation(){}
+        public InstallOperation(String siteId,String appType){
+            this.setSiteId(siteId);
+            this.setAppType(appType);
+        }
+        public InstallOperation(String siteId,String appType,ApplicationEntity.Mode mode){
+            this.setSiteId(siteId);
+            this.setAppType(appType);
+            this.setMode(mode);
+        }
+        public InstallOperation(String siteId,String appType,ApplicationEntity.Mode mode,Map<String,Object> configuration){
+            this.setSiteId(siteId);
+            this.setAppType(appType);
+            this.setMode(mode);
+            this.setConfiguration(configuration);
+        }
+
+        public String getSiteId() {
+           return siteId;
+       }
+        public void setSiteId(String siteId) {
+           this.siteId = siteId;
+       }
+        public String getAppType() {
+           return appType;
+       }
+        public void setAppType(String appType) {
+           this.appType = appType;
+       }
+
+        public Map<String, Object> getConfiguration() {
+            return configuration;
+        }
+
+        public void setConfiguration(Map<String, Object> configuration) {
+            this.configuration = configuration;
+        }
+
+        public ApplicationEntity.Mode getMode() {
+            return mode;
+        }
+
+        public void setMode(ApplicationEntity.Mode mode) {
+            this.mode = mode;
+        }
+    }
+
+    public static class UninstallOperation implements Operation{
+        private String uuid;
+        private String appId;
+        public UninstallOperation(String uuid){
+            this.setUuid(uuid);
+        }
+        public UninstallOperation(String uuid,String appId){
+            this.setUuid(uuid);
+            this.setAppId(appId);
+        }
+
+        public String getUuid() {
+            return uuid;
+        }
+        public void setUuid(String uuid) {
+            this.uuid = uuid;
+        }
+
+        public String getAppId() {
+            return appId;
+        }
+
+        public void setAppId(String appId) {
+            this.appId = appId;
+        }
+    }
+
+    public static class StartOperation implements Operation{
+        private String uuid;
+        private String appId;
+        public StartOperation(String uuid){
+            this.setUuid(uuid);
+        }
+        public StartOperation(String uuid,String appId){
+            this.setUuid(uuid);
+            this.setAppId(appId);
+        }
+        public String getUuid() {
+            return uuid;
+        }
+        public void setUuid(String uuid) {
+            this.uuid = uuid;
+        }
+
+        public String getAppId() {
+            return appId;
+        }
+
+        public void setAppId(String appId) {
+            this.appId = appId;
+        }
+    }
+
+    public static class StopOperation implements Operation{
+        private String uuid;
+        private String appId;
+
+        public StopOperation(String uuid){
+            this.setUuid(uuid);
+        }
+        public StopOperation(String uuid,String appId){
+            this.setUuid(uuid);
+            this.setAppId(appId);
+        }
+        public String getUuid() {
+            return uuid;
+        }
+        public void setUuid(String uuid) {
+            this.uuid = uuid;
+        }
+
+        public String getAppId() {
+            return appId;
+        }
+
+        public void setAppId(String appId) {
+            this.appId = appId;
+        }
+    }
+}
\ No newline at end of file

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/ApplicationManagementService.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationManagementService.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationManagementService.java
new file mode 100644
index 0000000..965a3fa
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationManagementService.java
@@ -0,0 +1,49 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 org.apache.eagle.metadata.model.ApplicationEntity;
+
+public interface ApplicationManagementService {
+    /**
+     *
+     * @param operation
+     * @return
+     */
+    ApplicationEntity install(AppOperations.InstallOperation operation);
+
+    /**
+     *
+     * @param operation
+     * @return
+     */
+    ApplicationEntity uninstall(AppOperations.UninstallOperation operation);
+
+    /**
+     *
+     * @param operation
+     * @return
+     */
+    ApplicationEntity start(AppOperations.StartOperation operation);
+
+    /**
+     *
+     * @param operation
+     * @return
+     */
+    ApplicationEntity stop(AppOperations.StopOperation operation);
+}
\ No newline at end of file

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/ApplicationManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationManagementServiceImpl.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationManagementServiceImpl.java
new file mode 100644
index 0000000..566fb62
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationManagementServiceImpl.java
@@ -0,0 +1,96 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.google.common.base.Preconditions;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.typesafe.config.Config;
+import org.apache.eagle.app.Application;
+import org.apache.eagle.app.ApplicationContext;
+import org.apache.eagle.metadata.model.ApplicationDesc;
+import org.apache.eagle.metadata.model.ApplicationEntity;
+import org.apache.eagle.metadata.model.SiteEntity;
+import org.apache.eagle.metadata.service.ApplicationEntityService;
+import org.apache.eagle.metadata.service.SiteEntityService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Singleton
+public class ApplicationManagementServiceImpl implements ApplicationManagementService {
+    private final SiteEntityService siteEntityService;
+    private final ApplicationProviderService applicationProviderService;
+    private final ApplicationEntityService applicationEntityService;
+    private final Config config;
+    private final static Logger LOGGER = LoggerFactory.getLogger(ApplicationManagementServiceImpl.class);
+
+    @Inject
+    public ApplicationManagementServiceImpl(
+            Config config,
+            SiteEntityService siteEntityService,
+            ApplicationProviderService applicationProviderService,
+            ApplicationEntityService applicationEntityService){
+        this.config = config;
+        this.siteEntityService = siteEntityService;
+        this.applicationProviderService = applicationProviderService;
+        this.applicationEntityService = applicationEntityService;
+    }
+
+    public ApplicationEntity install(AppOperations.InstallOperation operation) {
+        Preconditions.checkNotNull(operation.getSiteId(),"siteId is null");
+        Preconditions.checkNotNull(operation.getAppType(),"appType is null");
+        SiteEntity siteEntity = siteEntityService.getBySiteId(operation.getSiteId());
+        Preconditions.checkNotNull(siteEntity,"Site with ID: "+operation.getSiteId()+" is not found");
+        ApplicationDesc appDesc = applicationProviderService.getApplicationDescByType(operation.getAppType());
+        Preconditions.checkNotNull("Application with TYPE: "+operation.getAppType()+" is not found");
+        ApplicationEntity applicationEntity = new ApplicationEntity();
+        applicationEntity.setDescriptor(appDesc);
+        applicationEntity.setSite(siteEntity);
+        applicationEntity.setConfiguration(operation.getConfiguration());
+        applicationEntity.setMode(operation.getMode());
+        ApplicationContext applicationContext = new ApplicationContext(applicationEntity,config);
+        applicationEntity.setStreams(applicationContext.getStreamSinkDescs());
+        applicationEntityService.create(applicationEntity);
+        return applicationEntity;
+    }
+
+    public ApplicationEntity uninstall(AppOperations.UninstallOperation operation) {
+        ApplicationEntity applicationEntity = applicationEntityService.getByUUIDOrAppId(operation.getUuid(),operation.getAppId());
+        Application application = applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType()).getApplication();
+        // TODO: Check status, skip stop if already STOPPED
+        try {
+            application.stop(new ApplicationContext(applicationEntity, this.config));
+        }catch (Throwable throwable){
+            LOGGER.error(throwable.getMessage(),throwable);
+        }
+        return applicationEntityService.delete(applicationEntity);
+    }
+
+    public ApplicationEntity start(AppOperations.StartOperation operation) {
+        ApplicationEntity applicationEntity = applicationEntityService.getByUUIDOrAppId(operation.getUuid(),operation.getAppId());
+        Application application = applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType()).getApplication();
+        application.start(new ApplicationContext(applicationEntity,this.config));
+        return applicationEntity;
+    }
+
+    public ApplicationEntity stop(AppOperations.StopOperation operation) {
+        ApplicationEntity applicationEntity = applicationEntityService.getByUUIDOrAppId(operation.getUuid(),operation.getAppId());
+        Application application = applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType()).getApplication();
+        application.stop(new ApplicationContext(applicationEntity,this.config));
+        return applicationEntity;
+    }
+}
\ No newline at end of file



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

Posted by ha...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatformFactory.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatformFactory.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatformFactory.scala
new file mode 100644
index 0000000..6b9c033
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatformFactory.scala
@@ -0,0 +1,49 @@
+/*
+ * 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
+
+import org.apache.eagle.service.application.AppManagerConstants
+import org.apache.eagle.stream.application.impl.StormExecutionPlatform
+import org.slf4j.{LoggerFactory, Logger}
+
+import scala.collection.mutable
+
+
+object ExecutionPlatformFactory {
+  private val LOG: Logger = LoggerFactory.getLogger(ExecutionPlatformFactory.getClass)
+
+  var managerCache = new mutable.HashMap[String, ExecutionPlatform] with
+    mutable.SynchronizedMap[String, ExecutionPlatform]
+
+  def getApplicationManager(managerType: String): ExecutionPlatform = {
+    if(managerCache.contains(managerType)) {
+      managerCache.get(managerType).get
+    } else {
+      managerType match {
+        case AppManagerConstants.EAGLE_CLUSTER_STORM =>
+          val instance = new StormExecutionPlatform
+          managerCache.put(managerType, instance)
+          instance
+        case _ =>
+          throw new Exception(s"Invalid managerType $managerType")
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/TaskExecutor.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/TaskExecutor.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/TaskExecutor.scala
new file mode 100644
index 0000000..07737ac
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/TaskExecutor.scala
@@ -0,0 +1,41 @@
+/*
+ * 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
+
+import org.codehaus.jackson.annotate.JsonIgnore
+
+class TaskExecutor(runnable: Runnable) extends Thread(runnable) {
+
+  @JsonIgnore override def getContextClassLoader: ClassLoader = {
+    return super.getContextClassLoader
+  }
+
+  @JsonIgnore override def getUncaughtExceptionHandler: Thread.UncaughtExceptionHandler = {
+    return super.getUncaughtExceptionHandler
+  }
+
+  def shutdown {
+    this.interrupt
+  }
+
+  def restart {
+    this.interrupt
+    this.start
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormDynamicTopology.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormDynamicTopology.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormDynamicTopology.scala
new file mode 100644
index 0000000..7d52649
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormDynamicTopology.scala
@@ -0,0 +1,44 @@
+/*
+ * 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.impl
+
+import com.typesafe.config.Config
+import org.apache.eagle.datastream.ExecutionEnvironments
+import org.apache.eagle.datastream.storm.StormExecutionEnvironment
+import org.apache.eagle.stream.application.AbstractDynamicApplication
+import org.slf4j.LoggerFactory
+
+
+object StormDynamicTopology extends AbstractDynamicApplication {
+  val LOG = LoggerFactory.getLogger(classOf[AbstractDynamicApplication])
+
+  override def submit(application: String, config: Config) {
+    val stream = compileStream(application, config)
+    var ret = true
+
+    try {
+      val stormEnv = ExecutionEnvironments.getWithConfig[StormExecutionEnvironment](stream.getConfig)
+      stream.submit(stormEnv)
+    } catch {
+      case e: Throwable =>
+        ret = false
+        LOG.error(e.toString)
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormExecutionPlatform.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormExecutionPlatform.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormExecutionPlatform.scala
new file mode 100644
index 0000000..af4cafa
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormExecutionPlatform.scala
@@ -0,0 +1,197 @@
+/*
+ * 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.impl
+
+import java.net.URLDecoder
+import java.nio.file.{Files, Paths}
+
+import backtype.storm.generated.InvalidTopologyException
+import backtype.storm.utils.{NimbusClient, Utils}
+import com.typesafe.config.{Config, ConfigFactory}
+import org.apache.eagle.common.config.EagleConfigConstants
+import org.apache.eagle.service.application.AppManagerConstants
+import org.apache.eagle.service.application.entity.{TopologyDescriptionEntity, TopologyExecutionEntity, TopologyExecutionStatus}
+import org.apache.eagle.stream.application.{ApplicationManager, ApplicationManagerUtils, ExecutionPlatform, TopologyFactory}
+import org.slf4j.LoggerFactory
+
+import scala.collection.JavaConversions
+
+object StormExecutionPlatform {
+  val ACTIVE: String = "ACTIVE"
+  val INACTIVE: String = "INACTIVE"
+  val KILLED: String = "KILLED"
+  val REBALANCING: String = "REBALANCING"
+}
+
+class StormExecutionPlatform extends ExecutionPlatform {
+  val LOG = LoggerFactory.getLogger(classOf[StormExecutionPlatform])
+
+  private def getNimbusClient(appConfig: com.typesafe.config.Config): NimbusClient = {
+    val conf = Utils.readStormConfig().asInstanceOf[java.util.HashMap[String, Object]]
+    conf.putAll(Utils.readCommandLineOpts().asInstanceOf[java.util.HashMap[String, Object]])
+
+    if(appConfig.hasPath("envContextConfig.nimbusHost")) {
+      LOG.info(s"Setting ${backtype.storm.Config.NIMBUS_HOST} as ${appConfig.getString("envContextConfig.nimbusHost")}")
+      conf.put(backtype.storm.Config.NIMBUS_HOST, appConfig.getString("envContextConfig.nimbusHost"))
+    }
+
+    if(appConfig.hasPath("envContextConfig.nimbusThriftPort")) {
+      LOG.info(s"Setting ${backtype.storm.Config.NIMBUS_THRIFT_PORT} as ${appConfig.getString("envContextConfig.nimbusThriftPort")}")
+      conf.put(backtype.storm.Config.NIMBUS_THRIFT_PORT, appConfig.getNumber("envContextConfig.nimbusThriftPort"))
+    }
+    NimbusClient.getConfiguredClient(conf)
+  }
+
+  def startLocal(topologyName: String, topology: TopologyDescriptionEntity, topologyExecution: TopologyExecutionEntity, config: Config): Unit = {
+    val worker: Thread = ApplicationManager.submit(topologyName, new Runnable {
+      override def run(): Unit = {
+        try {
+          val topologyType = topology.getType.toUpperCase()
+          topologyType match {
+            case TopologyDescriptionEntity.TYPE.CLASS =>
+              TopologyFactory.submit(topology.getExeClass, config)
+            case TopologyDescriptionEntity.TYPE.DYNAMIC =>
+              StormDynamicTopology.submit(topology.getExeClass, config)
+            case m@_ =>
+              LOG.error("Unsupported topology type: " + topology.getType)
+          }
+        } catch {
+          case ex: Throwable =>
+            LOG.error(s"topology $topologyName in local mode is interrupted with ${ex.toString}")
+        }
+      }
+    })
+    topologyExecution.setFullName(topologyName)
+    topologyExecution.setStatus(ApplicationManager.getWorkerStatus(worker.getState))
+    topologyExecution.setDescription("Running inside " + worker.toString + " in local mode")
+  }
+
+  override def start(topology: TopologyDescriptionEntity, topologyExecution: TopologyExecutionEntity, config: Config): Unit = {
+    val stormJarPath: String = URLDecoder.decode(classOf[ExecutionPlatform].getProtectionDomain.getCodeSource.getLocation.getPath, "UTF-8")
+    if (stormJarPath == null || !Files.exists(Paths.get(stormJarPath)) || !stormJarPath.endsWith(".jar")) {
+      val errMsg = s"storm jar file $stormJarPath does not exists, or is a invalid jar file"
+      LOG.error(errMsg)
+      throw new Exception(errMsg)
+    }
+    LOG.info(s"Detected a storm.jar location at: $stormJarPath")
+    System.setProperty("storm.jar", stormJarPath)
+
+    val fullName = ApplicationManagerUtils.generateTopologyFullName(topologyExecution)
+    val extConfigStr = "envContextConfig.topologyName=%s".format(fullName)
+    val extConfig = ConfigFactory.parseString(extConfigStr)
+    val newConfig = extConfig.withFallback(config)
+
+    val mode = if(config.hasPath(AppManagerConstants.RUNNING_MODE)) config.getString(AppManagerConstants.RUNNING_MODE) else EagleConfigConstants.LOCAL_MODE
+    topologyExecution.setMode(mode)
+    if (topologyExecution.getMode.equalsIgnoreCase(EagleConfigConstants.LOCAL_MODE)) {
+      startLocal(fullName, topology, topologyExecution, newConfig)
+      return
+    }
+
+    val topologyType = topology.getType.toUpperCase()
+    topologyType match {
+      case TopologyDescriptionEntity.TYPE.CLASS =>
+        TopologyFactory.submit(topology.getExeClass, newConfig)
+      case TopologyDescriptionEntity.TYPE.DYNAMIC =>
+        StormDynamicTopology.submit(topology.getExeClass, newConfig)
+      case m@_ =>
+        throw new InvalidTopologyException("Unsupported topology type: " + topology.getType)
+    }
+    topologyExecution.setFullName(fullName)
+    //topologyExecution.setStatus(TopologyExecutionStatus.STARTED)
+  }
+
+  override def stop(topologyExecution: TopologyExecutionEntity, config: Config): Unit = {
+    val name: String = ApplicationManagerUtils.generateTopologyFullName(topologyExecution)
+
+    if(topologyExecution.getMode.equalsIgnoreCase(EagleConfigConstants.LOCAL_MODE)) {
+      stopLocal(name, topologyExecution)
+    } else {
+      getNimbusClient(config).getClient.killTopology(name)
+      topologyExecution.setStatus(TopologyExecutionStatus.STOPPING)
+      //topologyExecution.setDescription("")
+    }
+  }
+
+  def stopLocal(name: String, topologyExecution: TopologyExecutionEntity): Unit = {
+      val taskWorker = ApplicationManager.stop(name)
+      topologyExecution.setStatus(ApplicationManager.getWorkerStatus(taskWorker.getState))
+      topologyExecution.setDescription(s"topology status is ${taskWorker.getState}")
+      /*try{
+        ApplicationManager.remove(name)
+      } catch {
+        case ex: IllegalArgumentException =>
+          LOG.warn(s"ApplicationManager.remove($name) failed as it has been removed")
+      }*/
+  }
+
+
+  def getTopology(topologyName: String, config: Config) = {
+    val topologySummery = getNimbusClient(config).getClient.getClusterInfo.get_topologies
+    JavaConversions.collectionAsScalaIterable(topologySummery).find { t => t.get_name.equals(topologyName) }
+    match {
+      case Some(t) => Some(t)
+      case None    => None
+    }
+  }
+
+  override def status(topologyExecution: TopologyExecutionEntity, config: Config): Unit = {
+    val name: String = ApplicationManagerUtils.generateTopologyFullName(topologyExecution)
+
+    if(topologyExecution.getMode.equalsIgnoreCase(EagleConfigConstants.LOCAL_MODE)) {
+      statusLocal(name, topologyExecution)
+    } else {
+      val topology = getTopology(name, config)
+      topology match {
+        case Some(topology) =>
+          topologyExecution.setStatus(ApplicationManager.getTopologyStatus(topology.get_status()))
+          topologyExecution.setUrl(ApplicationManagerUtils.buildStormTopologyURL(config, topology.get_id()))
+          topologyExecution.setDescription(topology.toString)
+        case None =>
+          topologyExecution.setStatus(TopologyExecutionStatus.STOPPED)
+          topologyExecution.setUrl("")
+          topologyExecution.setDescription("")
+      }
+    }
+  }
+
+  def statusLocal(name: String, topologyExecution: TopologyExecutionEntity): Unit = {
+    try {
+      val currentStatus = topologyExecution.getStatus()
+      val newStatus = ApplicationManager.getWorkerStatus(ApplicationManager.get(name).getState())
+      if (!currentStatus.equals(newStatus)) {
+        LOG.info("Status of topology: %s changed from %s to %s".format(topologyExecution.getFullName, currentStatus, newStatus))
+        topologyExecution.setStatus(newStatus)
+        topologyExecution.setDescription(String.format("Status of topology: %s changed from %s to %s", name, currentStatus, newStatus))
+      } else if(currentStatus.equalsIgnoreCase(TopologyExecutionStatus.STOPPED)) {
+        ApplicationManager.remove(name)
+      }
+    }catch {
+      case ex: Throwable =>
+        topologyExecution.setDescription("")
+        topologyExecution.setStatus(TopologyExecutionStatus.STOPPED)
+    }
+  }
+
+  override def status(topologyExecutions: java.util.List[TopologyExecutionEntity], config: Config): Unit = {
+    JavaConversions.collectionAsScalaIterable(topologyExecutions) foreach {
+      topologyExecution => status(topologyExecution, config)
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandExecutor.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandExecutor.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandExecutor.scala
new file mode 100644
index 0000000..8fbf60d
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandExecutor.scala
@@ -0,0 +1,170 @@
+/*
+ * 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 java.util.concurrent.Callable
+
+import akka.actor.{Actor, ActorLogging}
+import akka.dispatch.Futures
+import com.typesafe.config.{Config, ConfigFactory, ConfigParseOptions, ConfigSyntax}
+import org.apache.eagle.common.config.EagleConfigConstants
+import org.apache.eagle.service.application.AppManagerConstants
+import org.apache.eagle.service.application.entity.TopologyOperationEntity.OPERATION
+import org.apache.eagle.service.application.entity.{TopologyExecutionEntity, TopologyExecutionStatus, TopologyOperationEntity}
+import org.apache.eagle.stream.application.{ApplicationSchedulerAsyncDAO, ExecutionPlatformFactory}
+
+import scala.collection.JavaConversions
+import scala.util.{Failure, Success}
+
+
+private[scheduler] class AppCommandExecutor extends Actor with ActorLogging {
+  @volatile var _config: Config = _
+  @volatile var _dao: ApplicationSchedulerAsyncDAO = _
+
+  import context.dispatcher
+
+  def start(topologyExecution: TopologyExecutionEntity, topologyOperation: TopologyOperationEntity) = {
+    val options: ConfigParseOptions = ConfigParseOptions.defaults.setSyntax(ConfigSyntax.PROPERTIES).setAllowMissing(false)
+    _dao.loadTopologyDescriptionByName(topologyOperation.getSite, topologyOperation.getApplication, topologyOperation.getTopology) onComplete {
+      case Success(topology) =>
+        val topologyConfig: Config = ConfigFactory.parseString(topology.getContext, options)
+
+        if(!topologyConfig.hasPath(EagleConfigConstants.APP_CONFIG)) {
+          topologyOperation.setMessage("Fail to detect topology configuration")
+          topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.FAILED)
+          _dao.updateOperationStatus(topologyOperation)
+        } else {
+          val config = topologyConfig.getConfig(EagleConfigConstants.APP_CONFIG).withFallback(_config)
+          val clusterType = if(config.hasPath(AppManagerConstants.CLUSTER_ENV)) config.getString(AppManagerConstants.CLUSTER_ENV) else AppManagerConstants.EAGLE_CLUSTER_STORM
+          topologyExecution.setEnvironment(clusterType)
+
+          Futures.future(new Callable[TopologyExecutionEntity]{
+            override def call(): TopologyExecutionEntity = {
+              topologyExecution.setStatus(TopologyExecutionStatus.STARTING)
+              _dao.updateTopologyExecutionStatus(topologyExecution)
+              ExecutionPlatformFactory.getApplicationManager(clusterType).start(topology, topologyExecution, config)
+              topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.SUCCESS)
+              topologyExecution
+            }
+          }, context.dispatcher) onComplete {
+            case Success(topologyExecutionEntity) =>
+              topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.SUCCESS)
+              updateStatus(topologyExecution, topologyOperation)
+            case Failure(ex) =>
+              topologyOperation.setMessage(ex.getMessage)
+              topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.FAILED)
+              _dao.updateOperationStatus(topologyOperation)
+          }
+        }
+
+      case Failure(ex) =>
+        topologyOperation.setMessage(ex.getMessage)
+        topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.FAILED)
+        _dao.updateOperationStatus(topologyOperation)
+    }
+  }
+
+  def stop(topologyExecution: TopologyExecutionEntity, topologyOperation: TopologyOperationEntity) = {
+    val clusterType = topologyExecution.getEnvironment
+
+    Futures.future(new Callable[TopologyExecutionEntity]{
+      override def call(): TopologyExecutionEntity = {
+        topologyExecution.setStatus(TopologyExecutionStatus.STOPPING)
+        _dao.updateTopologyExecutionStatus(topologyExecution)
+        ExecutionPlatformFactory.getApplicationManager(clusterType).stop(topologyExecution, _config)
+        topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.SUCCESS)
+        topologyExecution
+      }
+    }, context.dispatcher) onComplete {
+      case Success(topologyExecutionEntity) =>
+        topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.SUCCESS)
+        updateStatus(topologyExecution, topologyOperation)
+      case Failure(ex) =>
+        topologyOperation.setMessage(ex.toString)
+        topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.FAILED)
+        _dao.updateOperationStatus(topologyOperation)
+    }
+  }
+
+  def status(topologyExecution: TopologyExecutionEntity) = {
+    val clusterType = topologyExecution.getEnvironment
+
+    Futures.future(new Callable[TopologyExecutionEntity]{
+      override def call(): TopologyExecutionEntity = {
+        ExecutionPlatformFactory.getApplicationManager(clusterType).status(topologyExecution, _config)
+        topologyExecution
+      }
+    }, context.dispatcher) onComplete {
+      case _ =>
+        _dao.updateTopologyExecutionStatus(topologyExecution)
+    }
+  }
+
+  def updateStatus(topologyExecution: TopologyExecutionEntity, topologyOperation: TopologyOperationEntity): Unit = {
+    _dao.updateOperationStatus(topologyOperation)
+    _dao.updateTopologyExecutionStatus(topologyExecution)
+  }
+
+  def execute(topologyExecution: TopologyExecutionEntity, topologyOperation: TopologyOperationEntity): Unit = {
+    try {
+      topologyOperation.getOperation match {
+        case OPERATION.START =>
+          start(topologyExecution, topologyOperation)
+        case OPERATION.STOP =>
+          stop(topologyExecution, topologyOperation)
+        case m@_ =>
+          log.warning("Unsupported operation: " + topologyOperation)
+          throw new Exception(s"Unsupported operation: ${topologyOperation.getOperation}, possible values are START/STOP")
+      }
+    } catch {
+      case e: Throwable =>
+        topologyOperation.setMessage(e.getMessage)
+        topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.FAILED)
+        _dao.updateOperationStatus(topologyOperation)
+    }
+  }
+
+  override def receive = {
+    case InitializationEvent(config: Config) =>
+      _config = config
+      _dao = new ApplicationSchedulerAsyncDAO(config, context.dispatcher)
+    case SchedulerCommand(topologyExecution, topologyOperation) =>
+      execute(topologyExecution, topologyOperation)
+    case HealthCheckerEvent =>
+      _dao.loadAllTopologyExecutionEntities() onComplete {
+        case Success(topologyExecutions) =>
+          log.info(s"Load ${topologyExecutions.size()} topologies in execution")
+          JavaConversions.collectionAsScalaIterable(topologyExecutions) foreach { topologyExecution =>
+            try{
+              status(topologyExecution)
+            } catch {
+              case ex: Throwable =>
+                log.error(ex.getMessage)
+            }
+          }
+        case Failure(ex) =>
+          log.error(s"Fail to load any topologyExecutionEntity due to Exception: ${ex.getMessage}")
+      }
+    case TerminatedEvent =>
+      context.stop(self)
+    case m@_ =>
+      log.warning("Unsupported operation $m")
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandLoader.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandLoader.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandLoader.scala
new file mode 100644
index 0000000..c731846
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandLoader.scala
@@ -0,0 +1,78 @@
+/*
+ * 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.{Actor, ActorLogging}
+import com.typesafe.config.Config
+import org.apache.eagle.service.application.entity.TopologyOperationEntity.OPERATION_STATUS
+import org.apache.eagle.stream.application.ApplicationSchedulerAsyncDAO
+
+import scala.collection.JavaConversions
+import scala.util.{Failure, Success}
+
+
+private[scheduler] class AppCommandLoader extends Actor with ActorLogging {
+  @volatile var _config: Config = null
+  @volatile var _dao: ApplicationSchedulerAsyncDAO = null
+
+  import context.dispatcher
+
+  override def receive = {
+    case InitializationEvent(config: Config) =>
+      _config = config
+      _dao = new ApplicationSchedulerAsyncDAO(config, context.dispatcher)
+    case ClearPendingOperation =>
+      if(_dao == null) _dao = new ApplicationSchedulerAsyncDAO(_config, context.dispatcher)
+      _dao.clearPendingOperations()
+    case CommandLoaderEvent => {
+      val _sender = sender()
+      _dao.readOperationsByStatus(OPERATION_STATUS.INITIALIZED) onComplete {
+        case Success(commands) => {
+          log.info(s"Load ${commands.size()} new commands")
+          JavaConversions.collectionAsScalaIterable(commands) foreach { command =>
+            command.setStatus(OPERATION_STATUS.PENDING)
+            _dao.updateOperationStatus(command) onComplete {
+              case Success(response) =>
+                _dao.loadTopologyExecutionByName(command.getSite, command.getApplication, command.getTopology) onComplete {
+                  case Success(topologyExecution) => {
+                    _sender ! SchedulerCommand(topologyExecution, command)
+                  }
+                  case Failure(ex) =>
+                    log.error(ex.getMessage)
+                    command.setMessage(ex.getMessage)
+                    command.setStatus(OPERATION_STATUS.FAILED)
+                    _dao.updateOperationStatus(command)
+                }
+              case Failure(ex) =>
+                log.error(s"Got an exception to update command status $command: ${ex.getMessage}")
+                command.setMessage(ex.getMessage)
+                command.setStatus(OPERATION_STATUS.FAILED)
+                _dao.updateOperationStatus(command)
+            }
+          }
+        }
+        case Failure(ex) =>
+          log.error(s"Failed to get commands due to exception ${ex.getMessage}")
+      }
+    }
+    case TerminatedEvent =>
+      context.stop(self)
+    case m@_ => throw new UnsupportedOperationException(s"Event is not supported $m")
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/ApplicationScheduler.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/ApplicationScheduler.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/ApplicationScheduler.scala
new file mode 100644
index 0000000..476a3fb
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/ApplicationScheduler.scala
@@ -0,0 +1,81 @@
+/*
+ * 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 com.typesafe.config.Config
+import org.apache.eagle.service.application.AppManagerConstants
+import org.apache.eagle.service.application.entity.{TopologyExecutionEntity, TopologyOperationEntity}
+import org.apache.eagle.stream.application.ApplicationManager
+
+import scala.concurrent.duration._
+
+
+private[scheduler] class ScheduleEvent
+private[scheduler] case class InitializationEvent(config: Config) extends ScheduleEvent
+private[scheduler] case class TerminatedEvent() extends ScheduleEvent
+private[scheduler] case class CommandLoaderEvent() extends ScheduleEvent
+private[scheduler] case class HealthCheckerEvent() extends ScheduleEvent
+private[scheduler] case class ClearPendingOperation() extends ScheduleEvent
+private[scheduler] case class SchedulerCommand(topologyExecution: TopologyExecutionEntity, topologyOperation: TopologyOperationEntity) extends ScheduleEvent
+
+case class EagleServiceUnavailableException(message:String) extends Exception(message)
+case class DuplicatedDefinitionException(message:String) extends Exception(message)
+case class LoadTopologyFailureException(message:String) extends Exception(message)
+
+
+/**
+ * 1. Sync command from eagle service
+ * 2. Coordinate command to different actor
+ * 3. Actor execute command as requested
+ */
+class ApplicationScheduler {
+  //val config = ConfigFactory.load()
+  val DEFAULT_COMMAND_LOADER_INTERVAL_SECS = 2
+  val DEFAULT_HEALTH_CHECK_INTERVAL_SECS = 5
+
+  def start(config: Config) = {
+    val system = ActorSystem("application-manager-scheduler", config)
+    system.log.info(s"Started actor system: $system")
+
+    import system.dispatcher
+
+    val commandLoaderIntervalSecs: Long = if(config.hasPath(AppManagerConstants.APP_COMMAND_LOADER_INTERVAL_SECS)) config.getLong(AppManagerConstants.APP_COMMAND_LOADER_INTERVAL_SECS) else DEFAULT_COMMAND_LOADER_INTERVAL_SECS
+    val healthCheckIntervalSecs: Long = if(config.hasPath(AppManagerConstants.APP_HEALTH_CHECK_INTERVAL_SECS)) config.getLong(AppManagerConstants.APP_HEALTH_CHECK_INTERVAL_SECS) else DEFAULT_HEALTH_CHECK_INTERVAL_SECS
+
+    val coordinator = system.actorOf(Props[StreamAppCoordinator])
+    system.scheduler.scheduleOnce(0 seconds, coordinator, InitializationEvent(config))
+    system.scheduler.scheduleOnce(1 seconds, coordinator, ClearPendingOperation)
+    system.scheduler.schedule(2.seconds, commandLoaderIntervalSecs.seconds, coordinator, CommandLoaderEvent)
+    system.scheduler.schedule(10.seconds, healthCheckIntervalSecs.seconds, coordinator, HealthCheckerEvent)
+
+    /*
+     registerOnTermination is called when you have shut down the ActorSystem (system.shutdown),
+     and the callbacks will be executed after all actors have been stopped.
+     */
+    system.registerOnTermination(new Runnable {
+      override def run(): Unit = {
+        coordinator ! TerminatedEvent
+        ApplicationManager.stopAll()
+      }
+    })
+    system
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/StreamAppCoordinator.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/StreamAppCoordinator.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/StreamAppCoordinator.scala
new file mode 100644
index 0000000..17006ee
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/StreamAppCoordinator.scala
@@ -0,0 +1,54 @@
+/*
+ * 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.{Actor, ActorLogging, ActorRef, Props}
+
+private[scheduler] class StreamAppCoordinator extends Actor with ActorLogging {
+  var commandLoader: ActorRef = null
+  var commandExecutor: ActorRef = null
+
+
+  override def preStart(): Unit = {
+    commandLoader = context.actorOf(Props[AppCommandLoader], "command-loader")
+    commandExecutor = context.actorOf(Props[AppCommandExecutor], "command-worker")
+  }
+
+  override def receive = {
+    case InitializationEvent(config) => {
+      log.info(s"Config updated: $config")
+      commandLoader ! InitializationEvent(config)
+      commandExecutor ! InitializationEvent(config)
+    }
+    case ClearPendingOperation =>
+      commandLoader ! ClearPendingOperation
+    case CommandLoaderEvent =>
+      commandLoader ! CommandLoaderEvent
+    case command: SchedulerCommand =>
+      log.info(s"Executing command: $SchedulerCommand")
+      commandExecutor ! command
+    case HealthCheckerEvent =>
+      commandExecutor ! HealthCheckerEvent
+    case TerminatedEvent =>
+      log.info("Coordinator exit ...")
+      context.stop(self)
+    case m@_ =>
+      log.warning(s"Coordinator Unsupported message: $m")
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/test/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/test/resources/application.conf b/eagle-core/eagle-app/eagle-stream-application-manager/src/test/resources/application.conf
new file mode 100644
index 0000000..4c21a7c
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/test/resources/application.conf
@@ -0,0 +1,42 @@
+# 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.
+
+
+### scheduler propertise
+appCommandLoaderIntervalSecs = 1
+appHealthCheckIntervalSecs = 5
+
+### execution platform properties
+envContextConfig.env = "storm"
+envContextConfig.url = "http://sandbox.hortonworks.com:8744"
+envContextConfig.nimbusHost = "sandbox.hortonworks.com"
+envContextConfig.nimbusThriftPort = 6627
+envContextConfig.jarFile = "/dir-to-jar/eagle-topology-0.3.0-incubating-assembly.jar"
+
+### default topology properties
+eagleProps.mailHost = "mailHost.com"
+eagleProps.mailSmtpPort = "25"
+eagleProps.mailDebug = "true"
+eagleProps.eagleService.host = "localhost"
+eagleProps.eagleService.port = 9099
+eagleProps.eagleService.username = "admin"
+eagleProps.eagleService.password = "secret"
+eagleProps.dataJoinPollIntervalSec = 30
+
+dynamicConfigSource.enabled = true
+dynamicConfigSource.initDelayMillis = 0
+dynamicConfigSource.delayMillis = 30000
+
+

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/test/resources/log4j.properties b/eagle-core/eagle-app/eagle-stream-application-manager/src/test/resources/log4j.properties
new file mode 100644
index 0000000..25331ab
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/test/resources/log4j.properties
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+log4j.rootLogger=INFO, stdout
+
+ eagle.log.dir=../logs
+ eagle.log.file=eagle.log
+
+# standard output
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n
+
+# Daily Rolling File Appender
+ log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender
+ log4j.appender.DRFA.File=${eagle.log.dir}/${eagle.log.file}
+ log4j.appender.DRFA.DatePattern=.yyyy-MM-dd
+## 30-day backup
+# log4j.appender.DRFA.MaxBackupIndex=30
+ log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout
+
+# Pattern format: Date LogLevel LoggerName LogMessage
+log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/MockTopology.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/MockTopology.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/MockTopology.scala
new file mode 100644
index 0000000..e87ee92
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/MockTopology.scala
@@ -0,0 +1,30 @@
+/*
+ * 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 com.typesafe.config.Config
+import org.apache.eagle.stream.application.TopologyExecutable
+import org.slf4j.LoggerFactory
+
+class MockTopology extends TopologyExecutable {
+  private val LOG = LoggerFactory.getLogger(classOf[MockTopology])
+  override def submit(topology: String, config: Config): Unit = {
+    LOG.info(s"$topology is running")
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/StormApplicationManagerSpec.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/StormApplicationManagerSpec.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/StormApplicationManagerSpec.scala
new file mode 100644
index 0000000..1cad3a7
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/StormApplicationManagerSpec.scala
@@ -0,0 +1,40 @@
+package org.apache.eagle.stream.application.scheduler
+
+import com.typesafe.config.ConfigFactory
+import org.apache.eagle.common.config.EagleConfigConstants
+import org.apache.eagle.stream.application.ExecutionPlatform
+import org.apache.eagle.stream.application.impl.StormExecutionPlatform
+
+/*
+ * 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 StormApplicationManagerSpec extends App {
+  val manager: ExecutionPlatform = new StormExecutionPlatform
+  val baseConfig = ConfigFactory.load()
+  val topoConfigStr: String = "webConfig{\"hbase.zookeeper.property.clientPort\":\"2181\", \"hbase.zookeeper.quorum\":\"localhost\"}\nappConfig{\n  \"envContextConfig\" : {\n    \"env\" : \"storm\",\n    \"mode\" : \"cluster\",\n    \"topologyName\" : \"sandbox-hbaseSecurityLog-topology\",\n    \"stormConfigFile\" : \"security-auditlog-storm.yaml\",\n    \"parallelismConfig\" : {\n      \"kafkaMsgConsumer\" : 1,\n      \"hbaseSecurityLogAlertExecutor*\" : 1\n    }\n  },\n  \"dataSourceConfig\": {\n    \"topic\" : \"sandbox_hbase_security_log\",\n    \"zkConnection\" : \"127.0.0.1:2181\",\n    \"zkConnectionTimeoutMS\" : 15000,\n    \"brokerZkPath\" : \"/brokers\",\n    \"fetchSize\" : 1048586,\n    \"deserializerClass\" : \"org.apache.eagle.security.hbase.parse.HbaseAuditLogKafkaDeserializer\",\n    \"transactionZKServers\" : \"127.0.0.1\",\n    \"transactionZKPort\" : 2181,\n    \"transactionZKRoot\" : \"/consumers\",\n    \"consumerGroupId\" : \"eagle.hbasesecurity.consumer\",\n  
   \"transactionStateUpdateMS\" : 2000\n  },\n  \"alertExecutorConfigs\" : {\n     \"hbaseSecurityLogAlertExecutor\" : {\n       \"parallelism\" : 1,\n       \"partitioner\" : \"org.apache.eagle.policy.DefaultPolicyPartitioner\"\n       \"needValidation\" : \"true\"\n     }\n  },\n  \"eagleProps\" : {\n    \"site\" : \"sandbox\",\n    \"application\": \"hbaseSecurityLog\",\n    \"dataJoinPollIntervalSec\" : 30,\n    \"mailHost\" : \"mailHost.com\",\n    \"mailSmtpPort\":\"25\",\n    \"mailDebug\" : \"true\",\n    \"eagleService\": {\n      \"host\": \"localhost\",\n      \"port\": 9099\n      \"username\": \"admin\",\n      \"password\": \"secret\"\n    }\n  },\n  \"dynamicConfigSource\" : {\n    \"enabled\" : true,\n    \"initDelayMillis\" : 0,\n    \"delayMillis\" : 30000\n  }\n}"
+
+  val topoConfig = ConfigFactory.parseString(topoConfigStr)
+  val conf = topoConfig.getConfig(EagleConfigConstants.APP_CONFIG).withFallback(baseConfig)
+
+  //val (ret, nextState) = manager.execute("START", topologyDescModel, null, conf)
+  //println(s"Result: ret=$ret, nextState=$nextState")
+}
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/TestScheduler.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/TestScheduler.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/TestScheduler.scala
new file mode 100644
index 0000000..3db2d67
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/TestScheduler.scala
@@ -0,0 +1,61 @@
+/**
+ * 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-app/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/pom.xml b/eagle-core/eagle-app/pom.xml
new file mode 100644
index 0000000..6f3069c
--- /dev/null
+++ b/eagle-core/eagle-app/pom.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eagle-core</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>eagle-app-parent</artifactId>
+    <packaging>pom</packaging>
+    <description>Eagle Applications</description>
+
+    <modules>
+        <module>eagle-app-base</module>
+        <module>eagle-stream-application-manager</module>
+        <module>eagle-application-service</module>
+    </modules>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-application-service/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-application-service/pom.xml b/eagle-core/eagle-application-management/eagle-application-service/pom.xml
deleted file mode 100644
index 377ead5..0000000
--- a/eagle-core/eagle-application-management/eagle-application-service/pom.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~  Unless required by applicable law or agreed to in writing, software
-  ~  distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  ~
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>eagle-application-management</artifactId>
-        <groupId>org.apache.eagle</groupId>
-        <version>0.5.0-incubating-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>eagle-application-service</artifactId>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.eagle</groupId>
-            <artifactId>eagle-policy-base</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.eagle</groupId>
-            <artifactId>eagle-service-base</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <configuration>
-                    <skipTests>true</skipTests>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>

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/AppManagerConstants.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/AppManagerConstants.java b/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/AppManagerConstants.java
deleted file mode 100644
index 3aa3579..0000000
--- a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/AppManagerConstants.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-package org.apache.eagle.service.application;
-
-
-public class AppManagerConstants {
-    public final static String SITE_TAG = "site";
-    public final static String APPLICATION_TAG = "application";
-    public final static String OPERATION_TAG = "operation";
-    public final static String OPERATION_ID_TAG = "operationID";
-    public final static String TOPOLOGY_TAG = "topology";
-    public final static String FULLNAME = "fullName";
-    public final static String APPLICATION_ID = "id";
-
-    public final static String CLUSTER_ENV = "envContextConfig.env";
-    public final static String CLUSTER_URL = "envContextConfig.url";
-    public final static String DEFAULT_CLUSTER_URL = "http://sandbox.hortonworks.com:8744";
-
-    public final static String RUNNING_MODE = "envContextConfig.mode";
-    public final static String EAGLE_CLUSTER_STORM = "storm";
-    public final static String EAGLE_CLUSTER_SPARK = "spark";
-
-    public final static String APP_COMMAND_LOADER_ENABLED = "appCommandLoaderEnabled";
-    public final static String APP_COMMAND_LOADER_INTERVAL_SECS = "appCommandLoaderIntervalSecs";
-    public final static String APP_HEALTH_CHECK_INTERVAL_SECS = "appHealthCheckIntervalSecs";
-
-}

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/ApplicationManagementResource.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/ApplicationManagementResource.java b/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/ApplicationManagementResource.java
deleted file mode 100644
index 6e4521d..0000000
--- a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/ApplicationManagementResource.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
- *  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;
-
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
-import org.apache.eagle.policy.common.Constants;
-import org.apache.eagle.service.application.dao.ApplicationManagerDAO;
-import org.apache.eagle.service.application.dao.ApplicationManagerDaoImpl;
-import org.apache.eagle.service.application.entity.TopologyExecutionStatus;
-import org.apache.eagle.service.application.entity.TopologyOperationEntity;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.type.TypeFactory;
-
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.*;
-
-@Path(ApplicationManagementResource.ROOT_PATH)
-public class ApplicationManagementResource {
-    private final static ApplicationManagerDAO dao = new ApplicationManagerDaoImpl();
-    public final static String ROOT_PATH = "/app";
-
-    @Path("operation")
-    @POST
-    @Consumes(MediaType.APPLICATION_JSON)
-    @Produces(MediaType.APPLICATION_JSON)
-    public GenericServiceAPIResponseEntity createOperation(InputStream inputStream) {
-        GenericServiceAPIResponseEntity response = new GenericServiceAPIResponseEntity<>();
-        List<TopologyOperationEntity> operations = new LinkedList<>();
-        try {
-            List<TopologyOperationEntity> entities = (List<TopologyOperationEntity>) unmarshalOperationEntities(inputStream);
-            if (entities == null) {
-                throw new IllegalArgumentException("inputStream cannot convert to TopologyOperationEntity");
-            }
-            for (TopologyOperationEntity entity : entities) {
-                String status = dao.loadTopologyExecutionStatus(entity.getSite(), entity.getApplication(), entity.getTopology());
-                if(status == null) {
-                    throw new Exception(String.format("Fail to fetch the topology execution status by site=%s, application=%s, topology=%s", entity.getSite(), entity.getApplication(), entity.getTopology()));
-                }
-                int operationsInRunning = dao.loadTopologyOperationsInRunning(entity.getSite(), entity.getApplication(), entity.getTopology());
-                if(operationsInRunning !=0) {
-                    throw new Exception(operationsInRunning + "operations are running, please wait for a minute");
-                }
-                if (validateOperation(entity.getOperation(), status)) {
-                    Map<String, String> tags = entity.getTags();
-                    tags.put(AppManagerConstants.OPERATION_ID_TAG, UUID.randomUUID().toString());
-                    entity.setTags(tags);
-                    entity.setLastModifiedDate(System.currentTimeMillis());
-                    entity.setTimestamp(System.currentTimeMillis());
-                    operations.add(entity);
-                } else {
-                    throw new Exception(String.format("%s is an invalid operation, as the topology's current status is %s", entity.getOperation(), status));
-                }
-            }
-            response = dao.createOperation(operations);
-        } catch (Exception e) {
-            response.setSuccess(false);
-            response.setException(e);
-        }
-        return response;
-    }
-
-    private boolean validateOperation(String operation, String status) {
-        boolean ret = false;
-        switch (operation) {
-            case TopologyOperationEntity.OPERATION.START:
-                return TopologyExecutionStatus.isReadyToStart(status);
-            case TopologyOperationEntity.OPERATION.STOP:
-                return TopologyExecutionStatus.isReadyToStop(status);
-            default: break;
-        }
-        return ret;
-    }
-
-    private List<? extends TaggedLogAPIEntity> unmarshalOperationEntities(InputStream inputStream) throws IllegalAccessException, InstantiationException, IOException {
-        ObjectMapper objectMapper = new ObjectMapper();
-        return objectMapper.readValue(inputStream, TypeFactory.defaultInstance().constructCollectionType(LinkedList.class, TopologyOperationEntity.class));
-    }
-
-    @Path("topology")
-    @DELETE
-    @Consumes(MediaType.APPLICATION_JSON)
-    @Produces(MediaType.APPLICATION_JSON)
-    public GenericServiceAPIResponseEntity deleteTopology(@QueryParam("topology") String topology) {
-        return dao.deleteTopology(topology);
-    }
-
-
-}

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/dao/ApplicationManagerDAO.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/dao/ApplicationManagerDAO.java b/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/dao/ApplicationManagerDAO.java
deleted file mode 100644
index dfa261b..0000000
--- a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/dao/ApplicationManagerDAO.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-package org.apache.eagle.service.application.dao;
-
-
-import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
-import org.apache.eagle.service.application.entity.TopologyExecutionStatus;
-import org.apache.eagle.service.application.entity.TopologyOperationEntity;
-
-import java.util.List;
-
-public interface ApplicationManagerDAO {
-    String loadTopologyExecutionStatus(String site, String application, String topology);
-    int loadTopologyOperationsInRunning(String site, String application, String topology) throws Exception;
-    GenericServiceAPIResponseEntity createOperation(List<TopologyOperationEntity> entities) throws Exception;
-    GenericServiceAPIResponseEntity deleteTopology(String topology);
-}

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/dao/ApplicationManagerDaoImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/dao/ApplicationManagerDaoImpl.java b/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/dao/ApplicationManagerDaoImpl.java
deleted file mode 100644
index 4881cf4..0000000
--- a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/dao/ApplicationManagerDaoImpl.java
+++ /dev/null
@@ -1,91 +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.dao;
-
-import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
-import org.apache.eagle.policy.common.Constants;
-import org.apache.eagle.service.application.entity.TopologyExecutionEntity;
-import org.apache.eagle.service.application.entity.TopologyOperationEntity;
-import org.apache.eagle.service.generic.GenericEntityServiceResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-public class ApplicationManagerDaoImpl implements ApplicationManagerDAO {
-    private static Logger LOG = LoggerFactory.getLogger(ApplicationManagerDaoImpl.class);
-    GenericEntityServiceResource resource = new GenericEntityServiceResource();
-
-    @Override
-    public String loadTopologyExecutionStatus(String site, String application, String topology) {
-        String query = String.format("%s[@site=\"%s\" AND @application=\"%s\" AND @topology=\"%s\"]{*}", Constants.TOPOLOGY_EXECUTION_SERVICE_ENDPOINT_NAME, site, application, topology);
-        GenericServiceAPIResponseEntity<TopologyExecutionEntity> response = resource.search(query,  null, null, Integer.MAX_VALUE, null, false, false, 0L, 0, false, 0, null, false);
-        if(!response.isSuccess()) {
-            LOG.error(response.getException());
-            return null;
-        }
-        List<TopologyExecutionEntity> list = response.getObj();
-        if(list == null || list.size() != 1) {
-            LOG.error("ERROR: fetching 0 or more than 1 topology execution entities");
-            return null;
-        }
-        return list.get(0).getStatus();
-    }
-
-    @Override
-    public int loadTopologyOperationsInRunning(String site, String application, String topology) throws Exception {
-        int ret = 0;
-        String query = String.format("%s[@site=\"%s\" AND @application=\"%s\" AND @topology=\"%s\" AND (@status=\"%s\" OR @status=\"%s\")]{*}", Constants.TOPOLOGY_OPERATION_SERVICE_ENDPOINT_NAME, site, application, topology, TopologyOperationEntity.OPERATION_STATUS.INITIALIZED, TopologyOperationEntity.OPERATION_STATUS.PENDING);
-        GenericServiceAPIResponseEntity<TopologyExecutionEntity> response = resource.search(query, null, null, Integer.MAX_VALUE, null, false, false, 0L, 0, false, 0, null, false);
-        if(!response.isSuccess()) {
-            throw new Exception(response.getException());
-        }
-        if(response.getObj() != null && response.getObj().size() != 0) {
-            ret = response.getObj().size();
-        }
-        return ret;
-    }
-
-    @Override
-    public GenericServiceAPIResponseEntity createOperation(List<TopologyOperationEntity> entities) throws Exception {
-        if(entities.size() == 0) {
-            LOG.info("TopologyOperationEntity set is empty.");
-        }
-        GenericServiceAPIResponseEntity response = resource.updateEntities(entities, Constants.TOPOLOGY_OPERATION_SERVICE_ENDPOINT_NAME);
-        return response;
-    }
-
-    @Override
-    public GenericServiceAPIResponseEntity deleteTopology(String topology) {
-        String topologyQuery = Constants.TOPOLOGY_DESCRIPTION_SERVICE_ENDPOINT_NAME+ "[@topology=\"" + topology + "\"]{*}";
-        String executionQuery = Constants.TOPOLOGY_EXECUTION_SERVICE_ENDPOINT_NAME + "[@topology=\"" + topology + "\"]{*}";
-        int pageSize = Integer.MAX_VALUE;
-
-        GenericServiceAPIResponseEntity response = resource.deleteByQuery(topologyQuery, null, null, pageSize, null, false, false, 0L, 0, true, 0, null, false);
-        if(response.isSuccess()) {
-            response = resource.deleteByQuery(executionQuery, null, null, pageSize, null, false, false, 0L, 0, true, 0, null, false);
-        }
-        if(!response.isSuccess()) {
-            LOG.error(response.getException());
-        }
-        return response;
-    }
-
-}
-

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/ApplicationEntityRepo.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/ApplicationEntityRepo.java b/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/ApplicationEntityRepo.java
deleted file mode 100644
index 3226650..0000000
--- a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/ApplicationEntityRepo.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 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.entity.repo.EntityRepository;
-
-public class ApplicationEntityRepo  extends EntityRepository {
-    public ApplicationEntityRepo() {
-        this.registerEntity(TopologyDescriptionEntity.class);
-        this.registerEntity(TopologyExecutionEntity.class);
-        this.registerEntity(TopologyOperationEntity.class);
-    }
-}
\ No newline at end of file

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/TopologyDescriptionEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyDescriptionEntity.java b/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyDescriptionEntity.java
deleted file mode 100644
index 6442e6c..0000000
--- a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyDescriptionEntity.java
+++ /dev/null
@@ -1,104 +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("topologyDescription")
-@Service(Constants.TOPOLOGY_DESCRIPTION_SERVICE_ENDPOINT_NAME)
-@JsonIgnoreProperties(ignoreUnknown = true)
-@TimeSeries(false)
-@Tags({"topology"})
-public class TopologyDescriptionEntity extends TaggedLogAPIEntity {
-    @Column("a")
-    private String exeClass;
-    @Column("b")
-    private String type;
-    @Column("c")
-    private String description;
-    @Column("d")
-    private String version;
-    private String context;
-    public String getContext() {
-        return context;
-    }
-
-    public void setContext(String context) {
-        this.context = context;
-    }
-
-    public String getExeClass() {
-        return exeClass;
-    }
-
-    public void setExeClass(String exeClass) {
-        this.exeClass = exeClass;
-        valueChanged("exeClass");
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-        valueChanged("type");
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-        valueChanged("description");
-    }
-
-    public String getVersion() {
-        return version;
-    }
-
-    public void setVersion(String version) {
-        this.version = version;
-        valueChanged("version");
-    }
-
-    public String getTopology() {
-        return this.getTags().get(AppManagerConstants.TOPOLOGY_TAG);
-    }
-
-    public final static class TYPE {
-        public final static String DYNAMIC = "DYNAMIC";
-        public final static String CLASS = "CLASS";
-    }
-
-}

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/TopologyExecutionEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyExecutionEntity.java b/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyExecutionEntity.java
deleted file mode 100644
index 9991d3b..0000000
--- a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyExecutionEntity.java
+++ /dev/null
@@ -1,132 +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("topologyExecution")
-@Service(Constants.TOPOLOGY_EXECUTION_SERVICE_ENDPOINT_NAME)
-@JsonIgnoreProperties(ignoreUnknown = true)
-@TimeSeries(false)
-@Tags({"site", "application", "topology"})
-public class TopologyExecutionEntity extends TaggedLogAPIEntity {
-    @Column("a")
-    private String fullName;
-    @Column("b")
-    private String url;
-    @Column("c")
-    private String description;
-    @Column("d")
-    private String status;
-    @Column("e")
-    private long lastModifiedDate;
-    @Column("f")
-    private String mode;
-    @Column("g")
-    private String environment;
-
-    public String getEnvironment() {
-        return environment;
-    }
-
-    public void setEnvironment(String environment) {
-        this.environment = environment;
-        valueChanged("environment");
-    }
-
-    public String getMode() {
-        return mode;
-    }
-
-    public void setMode(String mode) {
-        this.mode = mode;
-        valueChanged("mode");
-    }
-
-    public String getFullName() {
-        return fullName;
-    }
-
-    public void setFullName(String fullName) {
-        this.fullName = fullName;
-        valueChanged("fullName");
-    }
-
-    public String getUrl() {
-        return url;
-    }
-
-    public void setUrl(String url) {
-        this.url = url;
-        valueChanged("url");
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-        valueChanged("description");
-    }
-
-    public String getStatus() {
-        return status;
-    }
-
-    public void setStatus(String status) {
-        this.status = status;
-        valueChanged("status");
-    }
-
-    public long getLastModifiedDate() {
-        return lastModifiedDate;
-    }
-
-    public void setLastModifiedDate(long lastModifiedDate) {
-        this.lastModifiedDate = lastModifiedDate;
-        valueChanged("lastModifiedDate");
-    }
-
-    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);
-    }
-
-}

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/TopologyExecutionStatus.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyExecutionStatus.java b/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyExecutionStatus.java
deleted file mode 100644
index f62ad8a..0000000
--- a/eagle-core/eagle-application-management/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyExecutionStatus.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-package org.apache.eagle.service.application.entity;
-
-
-public class TopologyExecutionStatus {
-    public final static String STOPPED = "STOPPED";
-    public final static String STARTED = "STARTED";
-    public final static String STARTING = "STARTING";
-    public final static String STOPPING = "STOPPING";
-    public final static String NEW = "NEW";
-
-    public static boolean isReadyToStart(String status){
-        return status.equals(STOPPED) || status.equals(NEW);
-    }
-
-    public static boolean isReadyToStop(String status){
-        return status.equals(STARTED);
-    }
-
-}
-


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

Posted by ha...@apache.org.
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..0000000
--- 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..0000000
--- a/eagle-core/eagle-application-management/pom.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~  Unless required by applicable law or agreed to in writing, software
-  ~  distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  ~
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>eagle-core</artifactId>
-        <groupId>org.apache.eagle</groupId>
-        <version>0.5.0-incubating-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>eagle-application-management</artifactId>
-    <packaging>pom</packaging>
-    <description>Eagle Application Management</description>
-
-    <modules>
-        <module>eagle-stream-application-manager</module>
-        <module>eagle-application-service</module>
-    </modules>
-
-
-</project>

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 0000000..a8b8124
--- /dev/null
+++ b/eagle-core/eagle-common/pom.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+		<groupId>org.apache.eagle</groupId>
+		<artifactId>eagle-query-parent</artifactId>
+		<version>0.5.0-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+	</parent>
+
+	<artifactId>eagle-common</artifactId>
+	<packaging>jar</packaging>
+	<name>eagle-common</name>
+
+	<dependencies>
+		<dependency>
+			<groupId>commons-configuration</groupId>
+			<artifactId>commons-configuration</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.hbase</groupId>
+			<artifactId>hbase-client</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.hadoop</groupId>
+			<artifactId>hadoop-common</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>javax.mail</groupId>
+			<artifactId>mail</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.velocity</groupId>
+			<artifactId>velocity</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.google.code.gson</groupId>
+			<artifactId>gson</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>com.google.guava</groupId>
+			<artifactId>guava</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.netflix.archaius</groupId>
+			<artifactId>archaius-core</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.mortbay.jetty</groupId>
+			<artifactId>jetty</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.mortbay.jetty</groupId>
+			<artifactId>jetty-util</artifactId>
+		</dependency>
+        <dependency>
+            <groupId>com.typesafe</groupId>
+            <artifactId>config</artifactId>
+        </dependency>
+	</dependencies>
+</project>
+

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/META-INF/MANIFEST.MF b/eagle-core/eagle-common/src/main/java/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..c67816b
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+Manifest-Version: 1.0
+Class-Path: 
+

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/Base64.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/Base64.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/Base64.java
new file mode 100644
index 0000000..aec84a3
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/Base64.java
@@ -0,0 +1,44 @@
+/*
+ * 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.io.UnsupportedEncodingException;
+
+import javax.xml.bind.DatatypeConverter;
+
+public class Base64 {
+
+	public static String decode(String salted) {
+		try {
+			return new String(DatatypeConverter.parseBase64Binary(salted), "UTF-8");
+		} catch (UnsupportedEncodingException e) {
+			throw new RuntimeException("UTF-8 must be supported", e);
+		}
+	}
+
+	public static String encode(String plain) {
+		try {
+			return DatatypeConverter.printBase64Binary(plain.getBytes("UTF-8"));
+		} catch (UnsupportedEncodingException e) {
+			throw new RuntimeException("UTF-8 must be supported", e);
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/ByteUtil.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/ByteUtil.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/ByteUtil.java
new file mode 100644
index 0000000..c1d4976
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/ByteUtil.java
@@ -0,0 +1,178 @@
+/*
+ * 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){
+		shortToBytes(v, bytes, 0);
+	}
+	
+	public static void shortToBytes(short v, byte[] bytes, int offset){
+		int tmp = v;
+		for(int i=0; i < 2; i++){
+			bytes[offset + 1 - i] = (byte)(tmp & 0xFF);
+			tmp >>= 8;
+		}
+	}
+
+	public static byte[] shortToBytes(short v){
+		int tmp = v;
+		byte[] b = new byte[2];
+		for(int i=0; i<2; i++){
+			b[1-i] = (byte)(tmp & 0xFF);
+			tmp >>= 8;
+		}
+		return b;
+	}
+
+	public static byte[] concat(byte[]... arrays) {
+        int length = 0;
+        for (byte[] array : arrays) {
+            length += array.length;
+        }
+        byte[] result = new byte[length];
+        int pos = 0;
+        for (byte[] array : arrays) {
+            System.arraycopy(array, 0, result, pos, array.length);
+            pos += array.length;
+        }
+        return result;
+    }
+	
+//    public static void main(String[] args){ 
+//    	int a = "ThreadName".hashCode();
+//    	byte[] b = intToBytes(a);
+//    	byte[] c = intToBytes(1676687583);
+//    	String s = new String(b);
+//    	System.out.println(s);
+    	
+//    	byte[] d = intToBytes(8652353);
+//    	System.out.println(bytesToInt(d));
+    	
+//    	byte[] e = longToBytes(12131513513l);
+//    	System.out.println(bytesToLong(e));
+//    	if(12131513513l == bytesToLong(e)){
+//    		System.out.println("yes");
+//    	}
+//    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayList.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayList.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayList.java
new file mode 100644
index 0000000..49695e5
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayList.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 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.AbstractList;
+import java.util.RandomAccess;
+
+/**
+ * Circular array implementation
+ *
+ * @param <E>
+ */
+public class CircularArrayList<E> extends AbstractList<E> implements RandomAccess {
+  
+    private final E[] buf; // a List implementing RandomAccess
+    private int head = 0;
+    private int tail = 0;
+    private boolean full = false;
+  
+    public CircularArrayList(E[] array) {
+        buf = array;
+        full = (buf.length == 0);
+    }
+  
+    public int capacity() {
+        return buf.length;
+    }
+    
+    public int head() {
+    	return head;
+    }
+    
+    public int tail() {
+    	return tail;
+    }
+    
+    public boolean isFull() {
+    	return full;
+    }
+    
+    @Override
+    public void clear() {
+        head = 0;
+        tail = 0;
+        full = false;
+        for (int i = 0; i < buf.length; ++i) {
+        	buf[i] = null;
+        }
+    }
+
+    private int wrapIndex(int i) {
+        int m = i % buf.length;
+        if (m < 0) { // java modulus can be negative
+            throw new IndexOutOfBoundsException();
+        }
+        return m;
+    }
+  
+    // This method is O(n) but will never be called if the
+    // CircularArrayList is used in its typical/intended role.
+    private void shiftBlock(int startIndex, int endIndex) {
+        assert (endIndex > startIndex);
+        for (int i = endIndex - 1; i >= startIndex; i--) {
+            set(i + 1, get(i));
+        }
+    }
+    
+    public int find(E e) {
+    	final int size = size();
+    	for (int i = 0; i < size; ++i) {
+    		if (e.equals(get(i))) {
+    			return i;
+    		}
+    	}
+    	return -1;
+    }
+  
+    @Override
+    public int size() {
+    	if (full) {
+    		return buf.length;
+    	}
+        return tail - head + (tail < head ? buf.length : 0);
+    }
+  
+    @Override
+    public E get(int i) {
+        if (i < 0 || i >= size()) {
+            throw new IndexOutOfBoundsException();
+        }
+        return buf[wrapIndex(head + i)];
+    }
+  
+    @Override
+    public E set(int i, E e) {
+        if (i < 0 || i >= size()) {
+            throw new IndexOutOfBoundsException();
+        }
+        return buf[wrapIndex(head + i)] =  e;
+    }
+  
+    @Override
+    public void add(int i, E e) {
+        int s = size();
+        if (s == buf.length) {
+            throw new IllegalStateException("Cannot add element."
+                    + " CircularArrayList is filled to capacity.");
+        }
+        full = (s + 1 == buf.length);
+        if (i < 0 || i > s) {
+            throw new IndexOutOfBoundsException();
+        }
+        tail = wrapIndex(tail + 1);
+        if (i < s) {
+            shiftBlock(i, s);
+        }
+        set(i, e);
+    }
+  
+    @Override
+    public E remove(int i) {
+        int s = size();
+        if (i < 0 || i >= s) {
+            throw new IndexOutOfBoundsException();
+        }
+        final E e = get(i);
+        if (i > 0) {
+            shiftBlock(0, i);
+        }
+    	buf[head] = null;
+        head = wrapIndex(head + 1);
+        full = false;
+        return e;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayListSortedSet.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayListSortedSet.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayListSortedSet.java
new file mode 100644
index 0000000..ef47624
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayListSortedSet.java
@@ -0,0 +1,106 @@
+/*
+ * 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<E> {
+
+	private final CircularArrayList<E> list;
+    private final Comparator<? super E> comparator;
+
+	public CircularArrayListSortedSet(E[] array) {
+		this.list = new CircularArrayList<E>(array);
+		this.comparator = null;
+	}
+	
+	public CircularArrayListSortedSet(E[] array, Comparator<? super E> comparator) {
+		this.list = new CircularArrayList<E>(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<? extends Comparable<? super E>>)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/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java
new file mode 100644
index 0000000..0f5b189
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java
@@ -0,0 +1,150 @@
+/*
+ * 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 org.apache.eagle.common.config.EagleConfigFactory;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+/**
+ * be aware that SimpleDateFormat instantiation is expensive, so if that's under a tight loop, probably we need
+ * a thread local SimpleDateFormat object
+ */
+public class DateTimeUtil {
+	public static final long ONESECOND = 1L * 1000L;
+	public static final long ONEMINUTE = 1L * 60L * 1000L;
+	public static final long ONEHOUR = 1L * 60L * 60L * 1000L;
+	public static final long ONEDAY = 24L * 60L * 60L * 1000L;
+    private static TimeZone CURRENT_TIME_ZONE = EagleConfigFactory.load().getTimeZone();
+	
+	public static Date humanDateToDate(String date) throws ParseException{
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        sdf.setTimeZone(CURRENT_TIME_ZONE);
+		return sdf.parse(date);
+	}
+	
+	public static String secondsToHumanDate(long seconds){
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        sdf.setTimeZone(CURRENT_TIME_ZONE);
+		Date t = new Date();
+		t.setTime(seconds*1000);
+		return sdf.format(t);
+	}
+	
+	public static String millisecondsToHumanDateWithMilliseconds(long milliseconds){
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
+        sdf.setTimeZone(CURRENT_TIME_ZONE);
+		Date t = new Date();
+		t.setTime(milliseconds);
+		return sdf.format(t);
+	}
+	
+	public static String millisecondsToHumanDateWithSeconds(long milliseconds){
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        sdf.setTimeZone(CURRENT_TIME_ZONE);
+		Date t = new Date();
+		t.setTime(milliseconds);
+		return sdf.format(t);
+	}
+	
+	public static long humanDateToSeconds(String date) throws ParseException{
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        sdf.setTimeZone(CURRENT_TIME_ZONE);
+		Date d = sdf.parse(date);
+		return d.getTime()/1000;
+	}
+	
+	public static long humanDateToMilliseconds(String date) throws ParseException{
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
+        sdf.setTimeZone(CURRENT_TIME_ZONE);
+		Date d = sdf.parse(date);
+		return d.getTime();
+	}
+	
+	
+	public static long humanDateToMillisecondsWithoutException(String date){
+		try{
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
+            sdf.setTimeZone(CURRENT_TIME_ZONE);
+			Date d = sdf.parse(date);
+			return d.getTime();
+		}catch(ParseException ex){
+			return 0L;
+		}
+	}
+	
+	public static long humanDateToSecondsWithoutException(String date){
+		try{
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            sdf.setTimeZone(CURRENT_TIME_ZONE);
+			Date d = sdf.parse(date);
+			return (d.getTime() / 1000);
+		}catch(ParseException ex){
+			return 0L;
+		}
+	}
+
+	//For mapr
+	//exp: 2015-06-06T10:44:22.800Z
+	public static long maprhumanDateToMilliseconds(String date) throws ParseException{
+		date = date.replace('T',' ');
+		date = date.replace('Z',' ');
+		date = date.replace('.',',');
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS ");
+		sdf.setTimeZone(CURRENT_TIME_ZONE);
+		Date d = sdf.parse(date);
+		return d.getTime();
+	}
+	/**
+	 * this could be accurate only when timezone is UTC
+	 * for the timezones other than UTC, there is possibly issue, for example
+	 * assume timezone is GMT+8 in China
+	 * When user time is "2014-07-15 05:00:00", it will be converted to timestamp first, internally it would be  "2014-07-14 21:00:00" in UTC timezone. When rounded down to day, the internal time would 
+	 * be changed to "2014-07-14 00:00:00", and that means the user time is "2014-07-14 08:00:00". But originally user wants to round it to "2014-07-15 00:00:00"
+	 * 
+	 * @param field
+	 * @param timeInMillis the seconds elapsed since 1970-01-01 00:00:00
+	 * @return
+	 */
+	public static long roundDown(int field, long timeInMillis){
+		switch(field){
+			case Calendar.DAY_OF_MONTH:
+			case Calendar.DAY_OF_WEEK:
+			case Calendar.DAY_OF_YEAR:
+				return (timeInMillis - timeInMillis % (24*60*60*1000));
+			case Calendar.HOUR:
+				return (timeInMillis - timeInMillis % (60*60*1000));
+			case Calendar.MINUTE:
+				return (timeInMillis - timeInMillis % (60*1000));
+			case Calendar.SECOND:
+				return (timeInMillis - timeInMillis % (1000));
+			default:
+				return 0L;
+		}
+	}
+
+	public static String format(long milliseconds, String format) {
+		SimpleDateFormat sdf = new SimpleDateFormat(format);
+        sdf.setTimeZone(CURRENT_TIME_ZONE);
+		Date t = new Date();
+		t.setTime(milliseconds);
+		return sdf.format(t);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/EagleBase64Wrapper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/EagleBase64Wrapper.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/EagleBase64Wrapper.java
new file mode 100644
index 0000000..e31ef99
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/EagleBase64Wrapper.java
@@ -0,0 +1,32 @@
+/*
+ * 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 org.apache.commons.net.util.Base64;
+
+/**
+ * wrap base64 encoding and decoding, so reduce the confuse of using many Base64 methods. 
+ */
+public class EagleBase64Wrapper {
+	public static String encodeByteArray2URLSafeString(byte[] bytes){
+		return Base64.encodeBase64URLSafeString(bytes);
+	}
+	
+	public static byte[] decode(String input){
+		return Base64.decodeBase64(input);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/EagleExceptionWrapper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/EagleExceptionWrapper.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/EagleExceptionWrapper.java
new file mode 100644
index 0000000..1fc4e85
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/EagleExceptionWrapper.java
@@ -0,0 +1,42 @@
+/*
+ * 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 EagleExceptionWrapper {
+	private final static int MAX_DEPTH = 10;
+	
+	public static String wrap(Exception ex){
+		return wrap(ex, EagleExceptionWrapper.MAX_DEPTH);
+	}
+	
+	public static String wrap(Exception ex, int maxdepth){
+		int d = maxdepth;
+		if(d <= 0)
+			d = EagleExceptionWrapper.MAX_DEPTH;
+		int index = 0;
+		StringBuffer sb = new StringBuffer();
+		sb.append(ex);
+		sb.append(System.getProperty("line.separator"));
+		for(StackTraceElement element : ex.getStackTrace()){
+			sb.append(element.toString());
+			sb.append(System.getProperty("line.separator"));
+			if(++index >= d)
+				break;
+		}
+		return sb.toString();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/Environment.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/Environment.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/Environment.java
new file mode 100644
index 0000000..dd69ed5
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/Environment.java
@@ -0,0 +1,23 @@
+/*
+ * 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 enum Environment {
+	dev,
+	test,
+	prod,
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/OS.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/OS.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/OS.java
new file mode 100644
index 0000000..05e8db1
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/OS.java
@@ -0,0 +1,41 @@
+/*
+ * 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 OS {
+
+	private final static String os = System.getProperty("os.name")
+			.toLowerCase();
+
+	public static boolean isWindows() {
+		return (os.indexOf("win") >= 0);
+	}
+
+	public static boolean isMac() {
+		return (os.indexOf("mac") >= 0);
+	}
+
+	public static boolean isUnix() {
+		return (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0 || os
+				.indexOf("aix") > 0);
+	}
+
+	public static boolean isSolaris() {
+		return (os.indexOf("sunos") >= 0);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/SerializableUtils.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/SerializableUtils.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/SerializableUtils.java
new file mode 100644
index 0000000..c5823ea
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/SerializableUtils.java
@@ -0,0 +1,126 @@
+/*
+ *
+ *  * 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 org.xerial.snappy.SnappyInputStream;
+import org.xerial.snappy.SnappyOutputStream;
+
+import java.io.*;
+
+/**
+ * Utilities for working with Serializables.
+ *
+ * Derived from "com.google.cloud.dataflow.sdk.util.SerializableUtils":
+ * https://github.com/apache/incubator-beam/blob/master/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/util/SerializableUtils.java
+ */
+public class SerializableUtils {
+  /**
+   * Serializes the argument into an array of bytes, and returns it.
+   *
+   * @throws IllegalArgumentException if there are errors when serializing
+   */
+  public static byte[] serializeToCompressedByteArray(Object value) {
+    try {
+      ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+      try (ObjectOutputStream oos = new ObjectOutputStream(new SnappyOutputStream(buffer))) {
+        oos.writeObject(value);
+      }
+      return buffer.toByteArray();
+    } catch (IOException exn) {
+      throw new IllegalArgumentException(
+          "unable to serialize " + value,
+          exn);
+    }
+  }
+
+  /**
+   * Serializes the argument into an array of bytes, and returns it.
+   *
+   * @throws IllegalArgumentException if there are errors when serializing
+   */
+  public static byte[] serializeToByteArray(Object value) {
+    try {
+      ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+      try (ObjectOutputStream oos = new ObjectOutputStream(buffer)) {
+        oos.writeObject(value);
+      }
+      return buffer.toByteArray();
+    } catch (IOException exn) {
+      throw new IllegalArgumentException("unable to serialize " + value, exn);
+    }
+  }
+
+  /**
+   * Deserializes an object from the given array of bytes, e.g., as
+   * serialized using {@link #serializeToCompressedByteArray}, and returns it.
+   *
+   * @throws IllegalArgumentException if there are errors when
+   * deserializing, using the provided description to identify what
+   * was being deserialized
+   */
+  public static Object deserializeFromByteArray(byte[] encodedValue,
+                                                          String description) {
+    try {
+      try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(encodedValue))) {
+        return ois.readObject();
+      }
+    } catch (IOException | ClassNotFoundException exn) {
+      throw new IllegalArgumentException(
+          "unable to deserialize " + description,
+          exn);
+    }
+  }
+
+  /**
+   * Deserializes an object from the given array of bytes, e.g., as
+   * serialized using {@link #serializeToCompressedByteArray}, and returns it.
+   *
+   * @throws IllegalArgumentException if there are errors when
+   * deserializing, using the provided description to identify what
+   * was being deserialized
+   */
+  public static Object deserializeFromCompressedByteArray(byte[] encodedValue,
+                                                          String description) {
+    try {
+      try (ObjectInputStream ois = new ObjectInputStream(
+          new SnappyInputStream(new ByteArrayInputStream(encodedValue)))) {
+        return ois.readObject();
+      }
+    } catch (IOException | ClassNotFoundException exn) {
+      throw new IllegalArgumentException(
+          "unable to deserialize " + description,
+          exn);
+    }
+  }
+
+  public static <T extends Serializable> T ensureSerializable(T value) {
+    @SuppressWarnings("unchecked")
+    T copy = (T) deserializeFromCompressedByteArray(serializeToCompressedByteArray(value),
+        value.toString());
+    return copy;
+  }
+
+  public static <T extends Serializable> T clone(T value) {
+    @SuppressWarnings("unchecked")
+    T copy = (T) deserializeFromCompressedByteArray(serializeToCompressedByteArray(value),
+        value.toString());
+    return copy;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfig.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfig.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfig.java
new file mode 100755
index 0000000..6226057
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfig.java
@@ -0,0 +1,60 @@
+/*
+ * 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.config;
+
+import com.typesafe.config.Config;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.client.HTableInterface;
+
+import java.util.TimeZone;
+import java.util.concurrent.ThreadPoolExecutor;
+
+public interface EagleConfig {
+
+    boolean isCoprocessorEnabled();
+
+	HTableInterface getHTable(String tableName);
+
+    Configuration getHbaseConf();
+
+    String getStorageType();
+
+    ThreadPoolExecutor getExecutor();
+
+	String getZKQuorum();
+
+	String getZKPort();
+
+	String getServiceHost();
+
+	int getServicePort();
+
+    String getEnv();
+
+    boolean isTableNamePrefixedWithEnvironment();
+	
+    int getHBaseClientScanCacheSize();
+
+    TimeZone getTimeZone();
+    
+    boolean isServiceAuditingEnabled();
+
+    /**
+     * @return root config
+     */
+    Config getConfig();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigConstants.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigConstants.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigConstants.java
new file mode 100644
index 0000000..26d7b49
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigConstants.java
@@ -0,0 +1,65 @@
+/*
+ * 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.config;
+
+public final class EagleConfigConstants {
+    public final static String SERVICE_ENV = "eagle.service.env";
+    public final static String SERVICE_HOST = "eagle.service.host";
+    public final static String SERVICE_PORT = "eagle.service.port";
+    public final static String SERVICE_HBASE_ZOOKEEPER_QUORUM = "eagle.service.hbase-zookeeper-quorum";
+    public final static String SERVICE_HBASE_ZOOKEEPER_PROPERTY_CLIENTPORT = "eagle.service.hbase-zookeeper-property-clientPort";
+    public final static String SERVICE_ZOOKEEPER_ZNODE_PARENT = "eagle.service.zookeeper-znode-parent";
+    public final static String SERVICE_HBASE_CLIENT_IPC_POOL_SIZE = "eagle.service.hbase-client-ipc-pool-size";
+    public final static String SERVICE_STORAGE_TYPE = "eagle.service.storage-type";
+    public final static String SERVICE_COPROCESSOR_ENABLED = "eagle.service.coprocessor-enabled";
+    public final static String SERVICE_TABLE_NAME_PREFIXED_WITH_ENVIRONMENT = "eagle.service.table-name-prefixed-with-environment";
+    public final static String SERVICE_HBASE_CLIENT_SCAN_CACHE_SIZE = "eagle.service.hbase-client-scan-cache-size";
+    public final static String SERVICE_THREADPOOL_CORE_SIZE = "eagle.service.threadpool-core-size";
+    public final static String SERVICE_THREADPOOL_MAX_SIZE = "eagle.service.threadpool-max-size";
+    public final static String SERVICE_THREADPOOL_SHRINK_SIZE = "eagle.service.threadpool-shrink-size";
+    public final static String SERVICE_AUDITING_ENABLED = "eagle.service.audit-enabled";
+
+    public final static String EAGLE_TIME_ZONE = "eagle.timezone";
+    public final static String DEFAULT_EAGLE_TIME_ZONE = "UTC";
+
+    public final static int DEFAULT_THREAD_POOL_CORE_SIZE = 10;
+    public final static int DEFAULT_THREAD_POOL_MAX_SIZE = 20;
+    public final static long DEFAULT_THREAD_POOL_SHRINK_TIME = 60000L;
+    public final static String DEFAULT_SERVICE_HOST = "localhost";
+    public final static String DEFAULT_STORAGE_TYPE = "hbase";
+    public final static int DEFAULT_SERVICE_PORT = 8080;
+    public final static String DEFAULT_ZOOKEEPER_ZNODE_PARENT = "/hbase-unsecure";
+
+    public final static String EAGLE_PROPS="eagleProps";
+    public final static String EAGLE_SERVICE = "eagleService";
+    public final static String HOST = "host";
+    public final static String PORT = "port";
+    public final static String USERNAME = "username";
+    public final static String PASSWORD = "password";
+
+    public final static String SITE = "site";
+    @Deprecated
+    public final static String DATA_SOURCE = "dataSource";
+    public final static String APPLICATION = "application";
+
+    public final static String WEB_CONFIG = "web";
+    public final static String APP_CONFIG = "app";
+    public final static String CLASSIFICATION_CONFIG = "classification";
+
+    public final static String LOCAL_MODE = "local";
+    public final static String CLUSTER_MODE = "cluster";
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigFactory.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigFactory.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigFactory.java
new file mode 100755
index 0000000..0d73743
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigFactory.java
@@ -0,0 +1,198 @@
+/*
+ * 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.config;
+
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.client.HTableInterface;
+import org.apache.hadoop.hbase.client.HTablePool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.TimeZone;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+public class EagleConfigFactory implements EagleConfig {
+	private static final Logger LOG = LoggerFactory.getLogger(EagleConfigFactory.class);
+
+	private String env;
+	private String zkQuorum;
+	private String zkPort;
+
+    private Configuration hbaseConf;
+	private String eagleServiceHost;
+	private int eagleServicePort;
+    private String storageType;
+    private Config config;
+    private TimeZone timeZone;
+
+    public boolean isCoprocessorEnabled() {
+		return isCoprocessorEnabled;
+	}
+
+	private boolean isCoprocessorEnabled;
+
+	private boolean tableNamePrefixedWithEnv;
+
+	private HTablePool pool;
+	private int hbaseClientScanCacheSize = 1000;
+
+	private ThreadPoolExecutor executor = null;
+
+	private static EagleConfigFactory manager = new EagleConfigFactory();
+
+	private EagleConfigFactory(){
+		init();
+		if(this.getStorageType() == null || this.getStorageType().equalsIgnoreCase("hbase")) {
+			this.pool = new HTablePool(this.hbaseConf, 10);
+		}
+	}
+	
+	public static EagleConfig load(){
+		return manager;
+	}
+	
+	public HTableInterface getHTable(String tableName){
+        return pool.getTable(tableName);
+    }
+
+    private String getString(Config config,String path,String defaultValue){
+        if(config.hasPath(path)){
+            return config.getString(path);
+        }else{
+            return defaultValue;
+        }
+    }
+
+    public String getStorageType() {
+        return storageType;
+    }
+
+    public ThreadPoolExecutor getExecutor() {
+        return executor;
+    }
+
+    private void init(){
+        this.config = ConfigFactory.load();
+        this.timeZone = TimeZone.getTimeZone((config.hasPath(EagleConfigConstants.EAGLE_TIME_ZONE)? config.getString(EagleConfigConstants.EAGLE_TIME_ZONE): EagleConfigConstants.DEFAULT_EAGLE_TIME_ZONE));
+        this.env = config.hasPath(EagleConfigConstants.SERVICE_ENV) ? config.getString(EagleConfigConstants.SERVICE_ENV):"dev";
+		this.zkQuorum = config.hasPath(EagleConfigConstants.SERVICE_HBASE_ZOOKEEPER_QUORUM) ? config.getString(EagleConfigConstants.SERVICE_HBASE_ZOOKEEPER_QUORUM):null;
+		this.zkPort = config.hasPath(EagleConfigConstants.SERVICE_HBASE_ZOOKEEPER_PROPERTY_CLIENTPORT) ? config.getString(EagleConfigConstants.SERVICE_HBASE_ZOOKEEPER_PROPERTY_CLIENTPORT): null;
+        String zkZnodeParent = config.hasPath(EagleConfigConstants.SERVICE_ZOOKEEPER_ZNODE_PARENT)? config.getString(EagleConfigConstants.SERVICE_ZOOKEEPER_ZNODE_PARENT): EagleConfigConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT;
+		String clientIPCPoolSize = getString(config, EagleConfigConstants.SERVICE_HBASE_CLIENT_IPC_POOL_SIZE, "10");
+		this.hbaseConf = HBaseConfiguration.create();
+
+        if (this.zkQuorum != null)
+            this.hbaseConf.set("hbase.zookeeper.quorum", this.zkQuorum);
+
+		if (this.zkPort != null)
+            this.hbaseConf.set("hbase.zookeeper.property.clientPort", this.zkPort);
+
+        if(zkZnodeParent != null)
+            this.hbaseConf.set("zookeeper.znode.parent", zkZnodeParent);
+        else
+            this.hbaseConf.set("zookeeper.znode.parent", EagleConfigConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT);
+
+        this.hbaseConf.set("hbase.client.ipc.pool.size", clientIPCPoolSize);
+
+		this.eagleServiceHost = config.hasPath(EagleConfigConstants.SERVICE_HOST) ? config.getString(EagleConfigConstants.SERVICE_HOST) : EagleConfigConstants.DEFAULT_SERVICE_HOST;
+        this.storageType = config.hasPath(EagleConfigConstants.SERVICE_STORAGE_TYPE) ? config.getString(EagleConfigConstants.SERVICE_STORAGE_TYPE) : EagleConfigConstants.DEFAULT_STORAGE_TYPE;
+        this.isCoprocessorEnabled = config.hasPath(EagleConfigConstants.SERVICE_COPROCESSOR_ENABLED) && config.getBoolean(EagleConfigConstants.SERVICE_COPROCESSOR_ENABLED);
+		this.eagleServicePort = config.hasPath(EagleConfigConstants.SERVICE_PORT) ? config.getInt(EagleConfigConstants.SERVICE_PORT) : EagleConfigConstants.DEFAULT_SERVICE_PORT;
+        this.tableNamePrefixedWithEnv = config.hasPath(EagleConfigConstants.SERVICE_TABLE_NAME_PREFIXED_WITH_ENVIRONMENT) && config.getBoolean(EagleConfigConstants.SERVICE_TABLE_NAME_PREFIXED_WITH_ENVIRONMENT);
+        this.hbaseClientScanCacheSize = config.hasPath(EagleConfigConstants.SERVICE_HBASE_CLIENT_SCAN_CACHE_SIZE)? config.getInt(EagleConfigConstants.SERVICE_HBASE_CLIENT_SCAN_CACHE_SIZE) : hbaseClientScanCacheSize;
+        // initilize eagle service thread pool for parallel execution of hbase scan etc.
+		int threadPoolCoreSize = config.hasPath(EagleConfigConstants.SERVICE_THREADPOOL_CORE_SIZE)? config.getInt(EagleConfigConstants.SERVICE_THREADPOOL_CORE_SIZE): EagleConfigConstants.DEFAULT_THREAD_POOL_CORE_SIZE;
+		int threadPoolMaxSize = config.hasPath(EagleConfigConstants.SERVICE_THREADPOOL_MAX_SIZE) ? config.getInt(EagleConfigConstants.SERVICE_THREADPOOL_MAX_SIZE) : EagleConfigConstants.DEFAULT_THREAD_POOL_MAX_SIZE;
+		long threadPoolShrinkTime = config.hasPath(EagleConfigConstants.SERVICE_THREADPOOL_SHRINK_SIZE) ? config.getLong(EagleConfigConstants.SERVICE_THREADPOOL_SHRINK_SIZE) : EagleConfigConstants.DEFAULT_THREAD_POOL_SHRINK_TIME;
+		this.isServiceAuditingEnabled = config.hasPath(EagleConfigConstants.SERVICE_AUDITING_ENABLED) && config.getBoolean(EagleConfigConstants.SERVICE_AUDITING_ENABLED);
+		
+		this.executor = new ThreadPoolExecutor(threadPoolCoreSize, threadPoolMaxSize, threadPoolShrinkTime, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
+
+		LOG.info("Successfully initialized config");
+
+		if(LOG.isDebugEnabled()) {
+			if(this.isCoprocessorEnabled){
+				LOG.debug("Eagle HBase Coprocessor is enabled");
+			}else{
+				LOG.debug("Eagle HBase Coprocessor is disabled");
+			}
+		}
+	}
+
+    @Override
+	public Configuration getHbaseConf() {
+		return hbaseConf;
+	}
+
+    @Override
+	public String getZKQuorum(){
+		return this.zkQuorum;
+    }
+
+    @Override
+	public String getZKPort(){
+		return this.zkPort;
+	}
+
+    @Override
+	public String getServiceHost() {
+		return eagleServiceHost;
+	}
+
+    @Override
+	public int getServicePort() {
+		return eagleServicePort;
+	}
+
+    @Override
+	public String getEnv() {
+		return env;
+	}
+
+    @Override
+	public boolean isTableNamePrefixedWithEnvironment(){
+		return this.tableNamePrefixedWithEnv;
+	}
+
+    @Override
+	public int getHBaseClientScanCacheSize(){
+		return this.hbaseClientScanCacheSize;
+	}
+
+    @Override
+    public TimeZone getTimeZone() {
+        return this.timeZone;
+    }
+
+    @Override
+    public Config getConfig() {
+        return this.config;
+    }
+    
+    // added for jira EAGLE-47
+    boolean isServiceAuditingEnabled;
+    
+    @Override
+	public boolean isServiceAuditingEnabled() {
+		return isServiceAuditingEnabled;
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigHelper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigHelper.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigHelper.java
new file mode 100644
index 0000000..fe3e190
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigHelper.java
@@ -0,0 +1,51 @@
+/*
+ *
+ *    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.config;
+
+import com.typesafe.config.Config;
+
+public class EagleConfigHelper {
+
+    public static String getServiceHost(Config config) {
+        return config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.HOST);
+    }
+
+    public static int getServicePort(Config config) {
+        return config.getInt(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PORT);
+    }
+
+    public static String getServiceUser(Config config) {
+        return config.hasPath(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.USERNAME) ?
+               config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.USERNAME) : null;
+    }
+
+    public static String getServicePassword(Config config) {
+        return config.hasPath(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PASSWORD) ?
+                config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PASSWORD) : null;
+    }
+
+    public static String getSite(Config config) {
+        return config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.SITE);
+    }
+
+    public static String getApplication(Config config) {
+        return config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.APPLICATION);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/email/EagleMailClient.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/email/EagleMailClient.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/email/EagleMailClient.java
new file mode 100755
index 0000000..6edac0a
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/email/EagleMailClient.java
@@ -0,0 +1,253 @@
+/*
+ * 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.email;
+
+import java.io.File;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.activation.FileDataSource;
+import javax.mail.Authenticator;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.AddressException;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+
+import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.exception.ResourceNotFoundException;
+import org.apache.velocity.runtime.RuntimeConstants;
+import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.netflix.config.ConcurrentMapConfiguration;
+
+public class EagleMailClient {
+//	private static final String CONFIG_FILE = "config.properties";
+	private static final String BASE_PATH = "templates/";
+	private static final String AUTH_CONFIG = "mail.smtp.auth";
+	private static final String DEBUG_CONFIG = "mail.debug";
+	private static final String USER_CONFIG = "mail.user";
+	private static final String PASSWORD_CONFIG = "mail.password";
+
+	private VelocityEngine velocityEngine;
+	private Session session;
+	private static final Logger LOG = LoggerFactory.getLogger(EagleMailClient.class);
+
+	public EagleMailClient() {
+		this(new ConcurrentMapConfiguration());
+	}
+
+	public EagleMailClient(AbstractConfiguration configuration) {
+		try {
+			ConcurrentMapConfiguration con = (ConcurrentMapConfiguration)configuration;
+			velocityEngine = new VelocityEngine();
+			velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
+			velocityEngine.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
+			velocityEngine.init();
+
+			con.setProperty("mail.transport.protocol", "smtp");
+			final Properties config = con.getProperties();
+			if(Boolean.parseBoolean(config.getProperty(AUTH_CONFIG))){
+				session = Session.getDefaultInstance(config, new Authenticator() {
+					protected PasswordAuthentication getPasswordAuthentication() {
+						return new PasswordAuthentication(config.getProperty(USER_CONFIG), config.getProperty(PASSWORD_CONFIG));
+					}
+				});
+			}
+			else session = Session.getDefaultInstance(config, new Authenticator() {});
+			final String debugMode = config.getProperty(DEBUG_CONFIG, "false");
+			final boolean debug = Boolean.parseBoolean(debugMode);
+			session.setDebug(debug);
+		} catch (Exception e) {
+            LOG.error("Failed connect to smtp server",e);
+		}
+	}
+
+	private boolean _send(String from, String to, String cc, String title,
+			String content) {
+		Message msg = new MimeMessage(session);
+		try {
+			msg.setFrom(new InternetAddress(from));
+			msg.setSubject(title);
+			if (to != null) {
+				msg.setRecipients(Message.RecipientType.TO,
+						InternetAddress.parse(to));
+			}
+			if (cc != null) {
+				msg.setRecipients(Message.RecipientType.CC,
+						InternetAddress.parse(cc));
+			}
+			//msg.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(DEFAULT_BCC_ADDRESS));
+			msg.setContent(content, "text/html;charset=utf-8");
+			LOG.info(String.format("Going to send mail: from[%s], to[%s], cc[%s], title[%s]", from, to, cc, title));
+
+			Transport.send(msg);
+
+			return true;
+		} catch (AddressException e) {
+			LOG.info("Send mail failed, got an AddressException: " + e.getMessage(), e);
+			return false;
+		} catch (MessagingException e) {
+			LOG.info("Send mail failed, got an AddressException: " + e.getMessage(), e);
+			return false;
+		}
+	}
+
+	private boolean _send(String from,String to,String cc,String title,String content,List<MimeBodyPart> attachments){
+		MimeMessage mail = new MimeMessage(session);
+		try {
+			mail.setFrom(new InternetAddress(from));
+			mail.setSubject(title);
+			if (to != null) {
+				mail.setRecipients(Message.RecipientType.TO,
+						InternetAddress.parse(to));
+			}
+			if (cc != null) {
+				mail.setRecipients(Message.RecipientType.CC,
+						InternetAddress.parse(cc));
+			}
+
+			//mail.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(DEFAULT_BCC_ADDRESS));
+
+			MimeBodyPart mimeBodyPart = new MimeBodyPart();
+			mimeBodyPart.setContent(content,"text/html;charset=utf-8");
+
+			Multipart multipart = new MimeMultipart();
+			multipart.addBodyPart(mimeBodyPart);
+
+			for(MimeBodyPart attachment:attachments){
+				multipart.addBodyPart(attachment);
+			}
+
+			mail.setContent(multipart);
+//			mail.setContent(content, "text/html;charset=utf-8");
+			LOG.info(String.format("Going to send mail: from[%s], to[%s], cc[%s], title[%s]", from, to, cc, title));
+
+			Transport.send(mail);
+
+			return true;
+		} catch (AddressException e) {
+			LOG.info("Send mail failed, got an AddressException: " + e.getMessage(), e);
+			return false;
+		} catch (MessagingException e) {
+			LOG.info("Send mail failed, got an AddressException: " + e.getMessage(), e);
+			return false;
+		}
+	}
+
+	public boolean send(String from, String to, String cc, String title,
+			String content) {
+		return this._send(from, to, cc, title, content);
+	}
+
+	public boolean send(String from, String to, String cc, String title,
+			String templatePath, VelocityContext context) {
+		Template t = null;
+		try {
+			t = velocityEngine.getTemplate(BASE_PATH + templatePath);
+		} catch (ResourceNotFoundException ex) {
+
+		}
+		if (t == null) {
+			try {
+				t = velocityEngine.getTemplate(templatePath);
+			} catch (ResourceNotFoundException e) {
+				t = velocityEngine.getTemplate("/" + templatePath);
+			}
+		}
+		final StringWriter writer = new StringWriter();
+		t.merge(context, writer);
+		if(LOG.isDebugEnabled()) LOG.debug(writer.toString());
+		return this.send(from, to, cc, title, writer.toString());
+	}
+
+	public boolean send(String from, String to, String cc, String title,
+	                    String templatePath, VelocityContext context, Map<String,File> attachments) {
+		if (attachments == null || attachments.isEmpty()) {
+			return send(from, to, cc, title, templatePath, context);
+		}
+		Template t = null;
+
+		List<MimeBodyPart> mimeBodyParts = new ArrayList<MimeBodyPart>();
+		Map<String,String> cid = new HashMap<String,String>();
+
+		for (Map.Entry<String,File> entry : attachments.entrySet()) {
+			final String attachment = entry.getKey();
+			final File attachmentFile  = entry.getValue();
+			final MimeBodyPart mimeBodyPart = new MimeBodyPart();
+			if(attachmentFile !=null && attachmentFile.exists()){
+				DataSource source = new FileDataSource(attachmentFile);
+				try {
+					mimeBodyPart.setDataHandler(new DataHandler(source));
+					mimeBodyPart.setFileName(attachment);
+					mimeBodyPart.setDisposition(MimeBodyPart.ATTACHMENT);
+					mimeBodyPart.setContentID(attachment);
+					cid.put(attachment,mimeBodyPart.getContentID());
+					mimeBodyParts.add(mimeBodyPart);
+				} catch (MessagingException e) {
+					LOG.error("Generate mail failed, got exception while attaching files: " + e.getMessage(), e);
+				}
+			}else{
+				LOG.error("Attachment: " + attachment + " is null or not exists");
+			}
+		}
+		//TODO remove cid, because not used at all
+		if(LOG.isDebugEnabled()) LOG.debug("Cid maps: "+cid);
+		context.put("cid", cid);
+
+		try {
+			t = velocityEngine.getTemplate(BASE_PATH + templatePath);
+		} catch (ResourceNotFoundException ex) {
+//			LOGGER.error("Template not found:"+BASE_PATH + templatePath, ex);
+		}
+
+		if (t == null) {
+			try {
+				t = velocityEngine.getTemplate(templatePath);
+			} catch (ResourceNotFoundException e) {
+				try {
+					t = velocityEngine.getTemplate("/" + templatePath);
+				}
+				catch (Exception ex) {
+					LOG.error("Template not found:"+ "/" + templatePath, ex);
+				}
+			}
+		}
+
+		final StringWriter writer = new StringWriter();
+		t.merge(context, writer);
+		if(LOG.isDebugEnabled()) LOG.debug(writer.toString());
+		return this._send(from, to, cc, title, writer.toString(), mimeBodyParts);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/metric/AlertContext.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/metric/AlertContext.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/metric/AlertContext.java
new file mode 100644
index 0000000..f8b11c3
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/metric/AlertContext.java
@@ -0,0 +1,94 @@
+/*
+ * 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.metric;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.slf4j.Logger;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * not thread safe
+ */
+public class AlertContext implements Serializable{
+	private static final Logger LOG = org.slf4j.LoggerFactory.getLogger(AlertContext.class);
+
+	private Map<String, String> properties = new HashMap<String, String>();
+	
+	public AlertContext(){
+	}
+	
+	public AlertContext(AlertContext context){
+		this.properties = new HashMap<String, String>(context.properties);
+	}
+	
+	public String removeProperty(String name)
+	{
+		return properties.remove(name);
+	}
+	
+	public AlertContext addProperty(String name, String value){
+		properties.put(name, value);
+		return this;
+	}
+
+	public AlertContext addAll(Map<String,String> propHash){
+		this.properties.putAll(propHash);
+		return this;
+	}
+
+	public String toJsonString(){
+		ObjectMapper objectMapper = new ObjectMapper();
+		try {
+			return objectMapper.writeValueAsString(properties);
+		}catch(Exception ex){
+			LOG.error("fail converting alertcontext into string", ex);
+			return null;
+		}
+	}
+
+	public static AlertContext fromJsonString(String json){
+		ObjectMapper objectMapper = new ObjectMapper();
+		try{
+			Map m = objectMapper.readValue(json, Map.class);
+			AlertContext c = new AlertContext();
+			c.addAll(m);
+			return c;
+		}catch(Exception ex){
+			LOG.error("fail converting string into alertcontext", ex);
+			return null;
+		}
+	}
+
+	public String getProperty(String name){
+		return properties.get(name);
+	}
+	
+	public String toString(){
+		return properties.toString();
+	}
+
+	public Map<String, String> getProperties(){
+		return properties;
+	}
+	
+	public void setProperties(Map<String, String> properties){
+		this.properties = properties;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/module/CommonGuiceModule.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/module/CommonGuiceModule.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/module/CommonGuiceModule.java
new file mode 100644
index 0000000..c44ca01
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/module/CommonGuiceModule.java
@@ -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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.module;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Singleton;
+import com.typesafe.config.Config;
+
+public class CommonGuiceModule extends AbstractModule{
+    @Override
+    protected void configure() {
+        bind(Config.class).toProvider(ConfigServiceProvider.class).in(Singleton.class);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/module/ConfigServiceProvider.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/module/ConfigServiceProvider.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/module/ConfigServiceProvider.java
new file mode 100644
index 0000000..37da582
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/module/ConfigServiceProvider.java
@@ -0,0 +1,30 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.module;
+
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+
+@Singleton
+public class ConfigServiceProvider implements Provider<Config> {
+    @Override
+    public Config get() {
+        return ConfigFactory.load();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/HadoopAccountService.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/HadoopAccountService.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/HadoopAccountService.java
new file mode 100644
index 0000000..0b4893a
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/HadoopAccountService.java
@@ -0,0 +1,23 @@
+/*
+ * 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 java.util.List;
+
+public interface HadoopAccountService {
+	public List<HadoopUser> searchByUsername(List<String> username);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/HadoopUser.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/HadoopUser.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/HadoopUser.java
new file mode 100644
index 0000000..2e84f77
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/HadoopUser.java
@@ -0,0 +1,44 @@
+/*
+ * 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 java.util.List;
+
+/**
+ * @since : 7/11/14,2014
+ */
+public class HadoopUser {
+	public String getUsername() {
+		return username;
+	}
+
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+	protected String username;
+
+	public List<String> getEmail() {
+		return email;
+	}
+
+	public void setEmail(List<String> emails) {
+		this.email = emails;
+	}
+
+	protected List<String> email;
+}
\ No newline at end of file


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

Posted by ha...@apache.org.
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 0000000..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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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<String,Object> configuration = new HashMap<>();
+    private Map<String,String> context = new HashMap<>();
+    private Collection<StreamDesc> 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<String, Object> getConfiguration() {
+        return configuration;
+    }
+
+    public void setConfiguration(Map<String, Object> 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<String, String> getContext() {
+        return context;
+    }
+
+    public void setContext(Map<String, String> 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<StreamDesc> getStreams() {
+        return streams;
+    }
+
+    public void setStreams(Collection<StreamDesc> 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
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationRawEntity.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationRawEntity.java
new file mode 100644
index 0000000..38d6aa7
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationRawEntity.java
@@ -0,0 +1,72 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 java.util.Map;
+
+/**
+ * Site app management entity
+ */
+public class ApplicationRawEntity extends PersistenceEntity {
+    private String siteUuid;
+    private String appType;
+    private Map<String,Map> configuration;
+    private long createdTime;
+    private long modifiedTime;
+
+    public String getSiteUuid() {
+        return siteUuid;
+    }
+
+    public void setSiteUuid(String siteUuid) {
+        this.siteUuid = siteUuid;
+    }
+
+    public Map<String, Map> getConfiguration() {
+        return configuration;
+    }
+
+    public void setConfiguration(Map<String, Map> configuration) {
+        this.configuration = configuration;
+    }
+
+    public long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    public long getModifiedTime() {
+        return modifiedTime;
+    }
+
+    public void setModifiedTime(long modifiedTime) {
+        this.modifiedTime = modifiedTime;
+    }
+
+    public String getAppType() {
+        return appType;
+    }
+
+    public void setAppType(String appType) {
+        this.appType = appType;
+    }
+}
\ 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/Configuration.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Configuration.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Configuration.java
new file mode 100644
index 0000000..345c935
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Configuration.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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.utils.ConfigTemplateHelper;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.InputStream;
+import java.util.List;
+
+@XmlRootElement(name = "configuration")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class Configuration {
+    @XmlElement(name = "property")
+    private List<Property> properties;
+
+    public List<Property> getProperties() {
+        return properties;
+    }
+
+    public Property getProperty(String name){
+        for(Property property :properties){
+            if(property.getName().equals(name)){
+                return property;
+            }
+        }
+        return null;
+    }
+
+    public boolean hasProperty(String name){
+        for(Property property :properties){
+            if(property.getName().equals(name)){
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static Configuration fromStream(InputStream inputStream) throws JAXBException {
+        return ConfigTemplateHelper.unmarshallFromXmlStream(inputStream);
+    }
+
+    public static Configuration fromResource(String resourceName) throws JAXBException {
+        return ConfigTemplateHelper.unmarshallFromResource(resourceName);
+    }
+    public static Configuration fromString(String xmlContent) throws JAXBException {
+        return ConfigTemplateHelper.unmarshallFromXMLString(xmlContent);
+    }
+
+    public int size(){
+        if(this.properties == null){
+            return 0;
+        }
+        return this.properties.size();
+    }
+}
\ 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/Property.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Property.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Property.java
new file mode 100644
index 0000000..642f760
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Property.java
@@ -0,0 +1,56 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+public class Property {
+    private String name;
+    private String displayName;
+    private String value;
+    private String description;
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
+    }
+}
\ 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/SiteEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/SiteEntity.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/SiteEntity.java
new file mode 100644
index 0000000..5421c87
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/SiteEntity.java
@@ -0,0 +1,68 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 java.util.Map;
+
+/**
+ * Dynamically registered site
+ */
+public class SiteEntity extends PersistenceEntity {
+    private String siteId;
+    private String siteName;
+    private String description;
+    private Map<String,String> context;
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("SiteEntity[siteId = %s, siteName =%s, description = %s, uuid = %s]",getSiteId(),getSiteName(),getDescription(),getUuid());
+    }
+
+    public String getSiteId() {
+        return siteId;
+    }
+
+    public void setSiteId(String siteId) {
+        this.siteId = siteId;
+    }
+
+    public String getSiteName() {
+        return siteName;
+    }
+
+    public void setSiteName(String siteName) {
+        this.siteName = siteName;
+    }
+
+    public Map<String, String> getContext() {
+        return context;
+    }
+
+    public void setContext(Map<String, String> context) {
+        this.context = context;
+    }
+}
\ 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/StreamDesc.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/StreamDesc.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/StreamDesc.java
new file mode 100644
index 0000000..c9f1e7f
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/StreamDesc.java
@@ -0,0 +1,60 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.alert.engine.coordinator.StreamDefinition;
+
+import java.util.Map;
+
+public class StreamDesc {
+    private String streamId;
+    private StreamDefinition streamSchema;
+    private Class<?> sinkType;
+    private Map<String,Object> sinkContext;
+
+    public String getStreamId() {
+        return streamId;
+    }
+
+    public void setStreamId(String streamId) {
+        this.streamId = streamId;
+    }
+
+    public StreamDefinition getStreamSchema() {
+        return streamSchema;
+    }
+
+    public void setStreamSchema(StreamDefinition streamSchema) {
+        this.streamSchema = streamSchema;
+    }
+
+    public Class<?> getSinkType() {
+        return sinkType;
+    }
+
+    public void setSinkType(Class<?> sinkType) {
+        this.sinkType = sinkType;
+    }
+
+    public Map<String, Object> getSinkContext() {
+        return sinkContext;
+    }
+
+    public void setSinkContext(Map<String, Object> sinkContext) {
+        this.sinkContext = sinkContext;
+    }
+}
\ 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/persistence/MemoryMetadataStore.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MemoryMetadataStore.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MemoryMetadataStore.java
new file mode 100644
index 0000000..5e3c2f4
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MemoryMetadataStore.java
@@ -0,0 +1,33 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.persistence;
+
+import org.apache.eagle.alert.metadata.IMetadataDao;
+import org.apache.eagle.alert.metadata.impl.InMemMetadataDaoImpl;
+import org.apache.eagle.metadata.service.ApplicationEntityService;
+import org.apache.eagle.metadata.service.SiteEntityService;
+import org.apache.eagle.metadata.service.memory.ApplicationEntityServiceMemoryImpl;
+import org.apache.eagle.metadata.service.memory.SiteEntityEntityServiceMemoryImpl;
+
+public class MemoryMetadataStore extends MetadataStore {
+    @Override
+    protected void configure() {
+        bind(SiteEntityService.class).to(SiteEntityEntityServiceMemoryImpl.class);
+        bind(ApplicationEntityService.class).to(ApplicationEntityServiceMemoryImpl.class);
+        bind(IMetadataDao.class).to(InMemMetadataDaoImpl.class);
+    }
+}
\ 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/persistence/MetadataStore.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStore.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStore.java
new file mode 100644
index 0000000..71b1476
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStore.java
@@ -0,0 +1,50 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.persistence;
+
+import com.google.inject.AbstractModule;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class MetadataStore extends AbstractModule {
+    private final static Logger LOG = LoggerFactory.getLogger(MetadataStore.class);
+    public static final String METADATA_STORE_CONFIG_KEY = "metadata.store";
+
+    private static MetadataStore instance;
+    public static MetadataStore getInstance(){
+        String metadataStoreClass = null;
+        if(instance == null) {
+            try {
+                Config config = ConfigFactory.load();
+                if (config.hasPath(METADATA_STORE_CONFIG_KEY)) {
+                    metadataStoreClass = config.getString(METADATA_STORE_CONFIG_KEY);
+                    LOG.info("Using {} = {}",METADATA_STORE_CONFIG_KEY,metadataStoreClass);
+                }else{
+                    metadataStoreClass = MemoryMetadataStore.class.getCanonicalName();
+                    LOG.info("{} is not set, using default {}",METADATA_STORE_CONFIG_KEY,metadataStoreClass);
+                }
+                instance = (MetadataStore) Class.forName(metadataStoreClass).newInstance();
+            } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
+                LOG.error("Failed to instantiate {}",metadataStoreClass,e);
+                throw new RuntimeException(e.getMessage(), e.getCause());
+            }
+        }
+        return instance;
+    }
+}
\ 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/persistence/PersistenceEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/PersistenceEntity.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/PersistenceEntity.java
new file mode 100644
index 0000000..b63fb09
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/PersistenceEntity.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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.persistence;
+
+import org.apache.eagle.metadata.utils.UUIDGenerator;
+
+import java.io.Serializable;
+
+/**
+ * Metadata Persistence Entity
+ */
+public abstract class PersistenceEntity implements Serializable{
+    private String uuid;
+    private long createdTime;
+    private long modifiedTime;
+
+    public String getUuid(){
+        return this.uuid;
+    }
+
+    public void setUuid(String uuid){
+        this.uuid = uuid;
+    }
+
+    public long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    public long getModifiedTime() {
+        return modifiedTime;
+    }
+
+    public void setModifiedTime(long modifiedTime) {
+        this.modifiedTime = modifiedTime;
+    }
+
+    public void ensureDefault(){
+        if(this.uuid == null || this.uuid.isEmpty()){
+            this.uuid = UUIDGenerator.newUUID();
+        }
+        if(createdTime == 0){
+            this.createdTime = System.currentTimeMillis();
+        }
+        this.modifiedTime = System.currentTimeMillis();
+    }
+}
\ 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/persistence/PersistenceService.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/PersistenceService.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/PersistenceService.java
new file mode 100644
index 0000000..d525936
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/PersistenceService.java
@@ -0,0 +1,25 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.persistence;
+
+import java.util.Collection;
+
+public interface PersistenceService<T extends PersistenceEntity> {
+    Collection<T> findAll();
+    T getByUUID(String uuid);
+    T create(T entity);
+}
\ 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/persistence/package-info.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/package-info.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/package-info.java
new file mode 100644
index 0000000..bcc68c4
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/package-info.java
@@ -0,0 +1,17 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.persistence;
\ 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/resource/RestResponse.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RestResponse.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RestResponse.java
new file mode 100644
index 0000000..995693a
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RestResponse.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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.resource;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.apache.commons.lang3.time.StopWatch;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.Response;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class RestResponse<T>{
+    private Long timestamp;
+    private boolean success = false;
+    private String message;
+    private String exception;
+    private T data;
+    private Long time;
+
+    public T getData() {
+        return data;
+    }
+
+    public void setData(T data) {
+        this.data = data;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    public static <E> RestResponseBuilder<E> builder(){
+        return new RestResponseBuilder<>();
+    }
+
+    public static <E> RestResponseBuilder<E> of(E data){
+        return RestResponse.<E>builder().data(data);
+    }
+
+    public static <E> RestResponseBuilder<E> of(Consumer<RestResponseBuilder<E>> func){
+        return RestResponse.<E>builder().of(func);
+    }
+
+    public static <E> RestResponseBuilder<E> of(Supplier<E> func){
+        return RestResponse.<E>builder().of(func);
+    }
+
+    public static <E> RestResponseBuilder<E> async(UnhandledSupplier<E,Exception> func) {
+        return RestResponse.<E>builder().async(func);
+    }
+
+    public static <E> RestResponseBuilder<E> async(UnhandledConsumer<RestResponseBuilder<E>, Exception> func){
+        return RestResponse.<E>builder().async(func);
+    }
+
+    public static <E> RestResponseBuilder<E> verbose(boolean verbose) {
+        return RestResponse.<E>builder().verbose(verbose);
+    }
+
+    public String getException() {
+        return exception;
+    }
+
+    public void setThrowable(Throwable exception) {
+        this.setException(ExceptionUtils.getStackTrace(exception));
+    }
+
+    public void setException(String exception) {
+        this.exception = exception;
+    }
+
+    public Long getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(Long timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public Long getTime() {
+        return time;
+    }
+
+    public void setTime(Long time) {
+        this.time = time;
+    }
+
+    public static class RestResponseBuilder<E>{
+        RestResponse<E> current;
+        Response.Status status = Response.Status.OK;
+        boolean verbose = true;
+
+        public RestResponseBuilder(){
+            current = new RestResponse<>();
+        }
+
+        public RestResponseBuilder<E> success(boolean success){
+            this.current.setSuccess(success);
+            return this;
+        }
+
+        public RestResponseBuilder<E> message(String message){
+            this.current.setMessage(message);
+            return this;
+        }
+
+        public RestResponseBuilder<E> data(E data){
+            this.current.setData(data);
+            return this;
+        }
+
+        public RestResponseBuilder<E> status(Response.Status status){
+            this.status = status;
+            return this;
+        }
+        public RestResponseBuilder<E> exception(Throwable exception){
+            this.current.setThrowable(exception);
+            return this;
+        }
+
+        public RestResponseBuilder<E> type(Class<?> clazz){
+            return this;
+        }
+
+        public RestResponseBuilder<E> spend(Long spendMillis){
+            this.current.setTime(spendMillis);
+            return this;
+        }
+
+        public RestResponseBuilder<E> verbose(boolean verbose){
+            this.verbose = verbose;
+            return this;
+        }
+
+        public RestResponseBuilder<E> of(Consumer<RestResponseBuilder<E>> func){
+            StopWatch stopWatch = new StopWatch();
+            try {
+                stopWatch.start();
+                this.success(true).status(Response.Status.OK);
+                func.accept(this);
+            } catch (Exception ex){
+                this.success(false).data(null).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage());
+            } finally {
+                stopWatch.stop();
+                this.spend(stopWatch.getTime());
+            }
+            return this;
+        }
+
+        public RestResponseBuilder<E>  of(Supplier<E> func){
+            StopWatch stopWatch = new StopWatch();
+            try {
+                stopWatch.start();
+                this.success(true).status(Response.Status.OK).data(func.get());
+            } catch (Throwable ex){
+                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage());
+            } finally {
+                stopWatch.stop();
+                this.spend(stopWatch.getTime());
+            }
+            return this;
+        }
+
+        public RestResponseBuilder<E> async(UnhandledSupplier<E,Exception> func) {
+            CompletableFuture future = CompletableFuture.runAsync(() -> {
+                try {
+                    this.status(Response.Status.OK).success(true).data(func.get());
+                } catch (Throwable e) {
+                    this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(e.getMessage()).exception(e);
+                }
+            });
+            runAsync(future);
+            return this;
+        }
+
+        private void runAsync(CompletableFuture future){
+            StopWatch stopWatch = new StopWatch();
+            try {
+                stopWatch.start();
+                future.get();
+            } catch (InterruptedException ex) {
+                Thread.currentThread().interrupt();
+                future.cancel(true);
+                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
+            } catch (Throwable ex) {
+                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
+            } finally {
+                stopWatch.stop();
+                this.spend(stopWatch.getTime());
+            }
+        }
+
+        public RestResponseBuilder<E> async(UnhandledConsumer<RestResponseBuilder<E>, Exception> func){
+            CompletableFuture future = CompletableFuture.runAsync(() -> {
+                try {
+                    func.accept(this);
+                    this.success(true);
+                } catch (Throwable ex) {
+                    this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
+                }
+            });
+            runAsync(future);
+            return this;
+        }
+
+        public RestResponseBuilder<E> then(UnhandledConsumer<RestResponseBuilder<E>, Exception> func){
+            try {
+                func.accept(this);
+            } catch (Throwable ex) {
+                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
+            }
+            return this;
+        }
+
+        public Response get(){
+            this.current.setTimestamp(System.currentTimeMillis());
+            if(!this.verbose){
+                this.current.setException(null);
+            }
+            return Response.status(this.status).entity(this.current).build();
+        }
+
+        public RestResponseBuilder<E> status(boolean success, Response.Status status) {
+            this.success(success);
+            this.status(status);
+            return this;
+        }
+    }
+}
\ 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/resource/SiteResource.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/SiteResource.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/SiteResource.java
new file mode 100644
index 0000000..0e09e7c
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/SiteResource.java
@@ -0,0 +1,59 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.resource;
+
+import org.apache.eagle.metadata.model.SiteEntity;
+import org.apache.eagle.metadata.service.SiteEntityService;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import java.util.Collection;
+
+@Path("/sites")
+@Singleton
+public class SiteResource {
+    private final SiteEntityService siteEntityService;
+
+    @Inject
+    public SiteResource(SiteEntityService siteEntityService){
+        this.siteEntityService = siteEntityService;
+    }
+
+    @GET
+    @Path("/")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Collection<SiteEntity> getAllSites(){
+        return siteEntityService.findAll();
+    }
+
+    @POST
+    @Path("/")
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    public SiteEntity createSite(SiteEntity siteEntity){
+        return siteEntityService.create(siteEntity);
+    }
+
+    @GET
+    @Path("/{siteIdOrUUID}")
+    @Produces(MediaType.APPLICATION_JSON)
+    public SiteEntity getSiteByNameOrUUID(@PathParam("siteIdOrUUID") String siteIdOrUUID){
+        return siteEntityService.getBySiteIdOrUUID(siteIdOrUUID);
+    }
+}
\ 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/resource/UncheckedFunction.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UncheckedFunction.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UncheckedFunction.java
new file mode 100644
index 0000000..ecaba49
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UncheckedFunction.java
@@ -0,0 +1,29 @@
+package org.apache.eagle.metadata.resource;
+
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+@FunctionalInterface
+public interface UncheckedFunction<T, R> {
+
+    /**
+     * Applies this function to the given argument.
+     *
+     * @param t the function argument
+     * @return the function result
+     */
+    R apply(T t) throws Exception;
+}

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/resource/UnhandledConsumer.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UnhandledConsumer.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UnhandledConsumer.java
new file mode 100644
index 0000000..a777977
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UnhandledConsumer.java
@@ -0,0 +1,22 @@
+package org.apache.eagle.metadata.resource;
+
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+@FunctionalInterface
+public interface UnhandledConsumer<T, E extends Exception> {
+    void accept(T o) throws E;
+}
\ 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/resource/UnhandledSupplier.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UnhandledSupplier.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UnhandledSupplier.java
new file mode 100644
index 0000000..d8e2e88
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UnhandledSupplier.java
@@ -0,0 +1,29 @@
+package org.apache.eagle.metadata.resource;
+
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ *
+ * @see java.util.function.Supplier
+ */
+@FunctionalInterface
+public interface UnhandledSupplier<T, E extends Exception> {
+    /**
+     * Gets a result.
+     *
+     * @return a result
+     */
+    T get() throws E;
+}
\ 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/service/ApplicationDescService.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/ApplicationDescService.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/ApplicationDescService.java
new file mode 100644
index 0000000..33ab3dd
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/ApplicationDescService.java
@@ -0,0 +1,26 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.service;
+
+import org.apache.eagle.metadata.model.ApplicationDesc;
+
+import java.util.Collection;
+
+public interface ApplicationDescService {
+    Collection<ApplicationDesc> getApplicationDescs();
+    ApplicationDesc getApplicationDescByType(String appType);
+}
\ 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/service/ApplicationEntityService.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/ApplicationEntityService.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/ApplicationEntityService.java
new file mode 100644
index 0000000..9e05f9b
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/ApplicationEntityService.java
@@ -0,0 +1,30 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.service;
+
+
+import org.apache.eagle.metadata.model.ApplicationEntity;
+import org.apache.eagle.metadata.persistence.PersistenceService;
+
+import java.util.Collection;
+
+public interface ApplicationEntityService extends PersistenceService<ApplicationEntity> {
+    Collection<ApplicationEntity> findBySiteId(String siteId);
+    ApplicationEntity getBySiteIdAndAppType(String siteId,String appType);
+    ApplicationEntity getByUUIDOrAppId(String uuid,String appId);
+    ApplicationEntity delete(ApplicationEntity applicationEntity);
+}
\ 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/service/SiteEntityService.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/SiteEntityService.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/SiteEntityService.java
new file mode 100644
index 0000000..2f5254d
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/SiteEntityService.java
@@ -0,0 +1,25 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.service;
+
+import org.apache.eagle.metadata.model.SiteEntity;
+import org.apache.eagle.metadata.persistence.PersistenceService;
+
+public interface SiteEntityService extends PersistenceService<SiteEntity>{
+    SiteEntity getBySiteId(String siteId);
+    SiteEntity getBySiteIdOrUUID(String siteIdOrUUID);
+}
\ 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/service/memory/ApplicationEntityServiceMemoryImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/ApplicationEntityServiceMemoryImpl.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/ApplicationEntityServiceMemoryImpl.java
new file mode 100644
index 0000000..200b5f2
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/ApplicationEntityServiceMemoryImpl.java
@@ -0,0 +1,101 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.service.memory;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import org.apache.eagle.metadata.model.ApplicationEntity;
+import org.apache.eagle.metadata.service.ApplicationDescService;
+import org.apache.eagle.metadata.service.ApplicationEntityService;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Singleton
+public class ApplicationEntityServiceMemoryImpl implements ApplicationEntityService {
+
+    private final ApplicationDescService applicationDescService;
+    private final Map<String,ApplicationEntity> applicationEntityMap;
+
+    @Inject
+    public ApplicationEntityServiceMemoryImpl(ApplicationDescService applicationDescService){
+        this.applicationDescService = applicationDescService;
+        this.applicationEntityMap = new HashMap<>();
+    }
+
+    @Override
+    public Collection<ApplicationEntity> findAll() {
+        return applicationEntityMap.values();
+    }
+
+    @Override
+    public ApplicationEntity getByUUID(String uuid) {
+        if(applicationEntityMap.containsKey(uuid)) {
+            return applicationEntityMap.get(uuid);
+        } else {
+            throw new IllegalArgumentException("Application (UUID: "+uuid+") is not found");
+        }
+    }
+
+    @Override
+    public ApplicationEntity create(ApplicationEntity entity) {
+        entity.ensureDefault();
+        if(getBySiteIdAndAppType(entity.getSite().getSiteId(),entity.getDescriptor().getType()) != null)
+            throw new IllegalArgumentException("Duplicated appId: "+entity.getAppId());
+        applicationEntityMap.put(entity.getUuid(),entity);
+        return entity;
+    }
+
+    @Override
+    public Collection<ApplicationEntity> findBySiteId(String siteId) {
+        return applicationEntityMap.values().stream().filter((app) -> siteId.equals(app.getSite().getSiteId())).collect(Collectors.toList());
+    }
+
+    @Override
+    public ApplicationEntity getBySiteIdAndAppType(String siteId, String appType) {
+        Optional<ApplicationEntity>  optional =
+                applicationEntityMap.values().stream()
+                        .filter((app) -> siteId.equals(app.getSite().getSiteId()) && appType.equals(app.getDescriptor().getType())).findAny();
+        if(optional.isPresent()){
+            return optional.get();
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public ApplicationEntity getByUUIDOrAppId(String uuid, String appId) {
+        if(uuid == null && appId == null)
+            throw new IllegalArgumentException("uuid and appId are both null");
+        else if(uuid !=null){
+            return getByUUID(uuid);
+        }else {
+            Optional<ApplicationEntity> applicationEntity = applicationEntityMap.values().stream().filter((app) -> appId.equals(app.getAppId())).findAny();
+            if(applicationEntity.isPresent()){
+                return applicationEntity.get();
+            }else{
+                throw new IllegalArgumentException("Application with appId: "+appId+" not found");
+            }
+        }
+    }
+
+    @Override
+    public ApplicationEntity delete(ApplicationEntity applicationEntity) {
+        ApplicationEntity entity = getByUUIDOrAppId(applicationEntity.getUuid(),applicationEntity.getAppId());
+        return applicationEntityMap.remove(entity.getUuid());
+    }
+}
\ 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/service/memory/SiteEntityEntityServiceMemoryImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/SiteEntityEntityServiceMemoryImpl.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/SiteEntityEntityServiceMemoryImpl.java
new file mode 100644
index 0000000..8e27c53
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/SiteEntityEntityServiceMemoryImpl.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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.service.memory;
+
+import com.google.inject.Singleton;
+import org.apache.eagle.metadata.model.SiteEntity;
+import org.apache.eagle.metadata.service.SiteEntityService;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+@Singleton
+public class SiteEntityEntityServiceMemoryImpl implements SiteEntityService {
+    private Map<String,SiteEntity> nameSiteMap = new HashMap<>();
+
+    @Override
+    public Collection<SiteEntity> findAll() {
+        return nameSiteMap.values();
+    }
+
+    @Override
+    public SiteEntity getByUUID(String uuid) {
+        return nameSiteMap.values().stream().filter((site) -> uuid.equals(site.getUuid())).findAny().get();
+    }
+
+    @Override
+    public SiteEntity create(SiteEntity entity) {
+        if(getBySiteId(entity.getSiteId()) != null){
+            throw new IllegalArgumentException("Duplicated site: "+entity);
+        }
+        entity.ensureDefault();
+        nameSiteMap.put(entity.getSiteId(),entity);
+        return entity;
+    }
+
+    @Override
+    public SiteEntity getBySiteId(String siteName) {
+        return nameSiteMap.get(siteName);
+    }
+
+    @Override
+    public SiteEntity getBySiteIdOrUUID(String siteNameOrUUID) {
+        if(nameSiteMap.containsKey(siteNameOrUUID)){
+            return nameSiteMap.get(siteNameOrUUID);
+        } else {
+            return getByUUID(siteNameOrUUID);
+        }
+    }
+}
\ 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/utils/ConfigTemplateHelper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/ConfigTemplateHelper.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/ConfigTemplateHelper.java
new file mode 100644
index 0000000..2d4fa5f
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/ConfigTemplateHelper.java
@@ -0,0 +1,68 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.utils;
+
+import com.google.common.base.Preconditions;
+import org.apache.eagle.metadata.model.Configuration;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import java.io.InputStream;
+import java.io.StringReader;
+
+public class ConfigTemplateHelper {
+    private final static Logger LOG = LoggerFactory.getLogger(ConfigTemplateHelper.class);
+    public static Configuration unmarshallFromXmlStream(InputStream inputStream) throws JAXBException {
+        Preconditions.checkNotNull(inputStream,"Input stream is null");
+        try {
+            JAXBContext jc = JAXBContext.newInstance(Configuration.class);
+            Unmarshaller unmarshaller = jc.createUnmarshaller();
+            return  (Configuration) unmarshaller.unmarshal(inputStream);
+        }catch (Exception ex){
+            LOG.error("Failed to unmarshall ConfigTemplate from stream",ex);
+            throw ex;
+        }
+    }
+
+    public static Configuration unmarshallFromResource(String resourceName) throws JAXBException {
+        String source = resourceName;
+        InputStream inputStream = ConfigTemplateHelper.class.getResourceAsStream(resourceName);
+        if(inputStream == null){
+            source = "/"+resourceName;
+//            LOG.debug("Unable to get resource from {}, retrying with ",resourceName,source);
+            inputStream = ConfigTemplateHelper.class.getResourceAsStream(source);
+        }
+        Preconditions.checkNotNull(inputStream, "Unable to load stream from resource " + source);
+        Configuration configuration =  unmarshallFromXmlStream(inputStream);
+        return configuration;
+    }
+
+    public static Configuration unmarshallFromXMLString(String xmlConfiguration) throws JAXBException {
+        try {
+            JAXBContext jc = JAXBContext.newInstance(Configuration.class);
+            Unmarshaller unmarshaller = jc.createUnmarshaller();
+            return  (Configuration) unmarshaller.unmarshal(new StringReader(xmlConfiguration));
+        }catch (Exception ex){
+            LOG.error("Failed to unmarshall ConfigTemplate from string",ex);
+            throw ex;
+        }
+    }
+}
\ 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/utils/UUIDGenerator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/UUIDGenerator.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/UUIDGenerator.java
new file mode 100644
index 0000000..e9efd99
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/UUIDGenerator.java
@@ -0,0 +1,25 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.utils;
+
+import java.util.UUID;
+
+public class UUIDGenerator {
+    public static String newUUID(){
+        return UUID.randomUUID().toString();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-jdbc/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/pom.xml b/eagle-core/eagle-metadata/eagle-metadata-jdbc/pom.xml
new file mode 100644
index 0000000..dd14854
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eagle-metadata</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>eagle-metadata-jdbc</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-metadata-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/mysql/MySQLMetadataStore.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/mysql/MySQLMetadataStore.java b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/mysql/MySQLMetadataStore.java
new file mode 100644
index 0000000..1fe2100
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/mysql/MySQLMetadataStore.java
@@ -0,0 +1,29 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.store.mysql;
+
+import com.google.inject.Singleton;
+import org.apache.eagle.alert.metadata.IMetadataDao;
+import org.apache.eagle.alert.metadata.impl.JdbcMetadataDaoImpl;
+import org.apache.eagle.metadata.persistence.MetadataStore;
+
+public class MySQLMetadataStore extends MetadataStore{
+    @Override
+    protected void configure() {
+        bind(IMetadataDao.class).to(JdbcMetadataDaoImpl.class).in(Singleton.class);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-mongo/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-mongo/pom.xml b/eagle-core/eagle-metadata/eagle-metadata-mongo/pom.xml
new file mode 100644
index 0000000..f54b76c
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-mongo/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eagle-metadata</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>eagle-metadata-mongo</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-metadata-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-mongo/src/main/java/org/apache/eagle/metadata/store/mongo/MongoMetadataStore.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-mongo/src/main/java/org/apache/eagle/metadata/store/mongo/MongoMetadataStore.java b/eagle-core/eagle-metadata/eagle-metadata-mongo/src/main/java/org/apache/eagle/metadata/store/mongo/MongoMetadataStore.java
new file mode 100644
index 0000000..81f12e6
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-mongo/src/main/java/org/apache/eagle/metadata/store/mongo/MongoMetadataStore.java
@@ -0,0 +1,29 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.store.mongo;
+
+import com.google.inject.Singleton;
+import org.apache.eagle.alert.metadata.IMetadataDao;
+import org.apache.eagle.alert.metadata.impl.MongoMetadataDaoImpl;
+import org.apache.eagle.metadata.persistence.MetadataStore;
+
+public class MongoMetadataStore extends MetadataStore {
+    @Override
+    protected void configure() {
+        bind(IMetadataDao.class).to(MongoMetadataDaoImpl.class).in(Singleton.class);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/pom.xml b/eagle-core/eagle-metadata/pom.xml
new file mode 100644
index 0000000..676327e
--- /dev/null
+++ b/eagle-core/eagle-metadata/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eagle-core</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>eagle-metadata</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>eagle-metadata-jdbc</module>
+        <module>eagle-metadata-mongo</module>
+        <module>eagle-metadata-base</module>
+    </modules>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/pom.xml b/eagle-core/eagle-query/eagle-common/pom.xml
deleted file mode 100644
index af93aba..0000000
--- a/eagle-core/eagle-query/eagle-common/pom.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~    http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-
-	<parent>
-		<groupId>org.apache.eagle</groupId>
-		<artifactId>eagle-query-parent</artifactId>
-		<version>0.5.0-incubating-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-	</parent>
-
-	<artifactId>eagle-common</artifactId>
-	<packaging>jar</packaging>
-	<name>eagle-common</name>
-
-	<dependencies>
-		<dependency>
-			<groupId>commons-configuration</groupId>
-			<artifactId>commons-configuration</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.hbase</groupId>
-			<artifactId>hbase-client</artifactId>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.hadoop</groupId>
-			<artifactId>hadoop-common</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>javax.mail</groupId>
-			<artifactId>mail</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.velocity</groupId>
-			<artifactId>velocity</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>com.google.code.gson</groupId>
-			<artifactId>gson</artifactId>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>com.google.guava</groupId>
-			<artifactId>guava</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>com.netflix.archaius</groupId>
-			<artifactId>archaius-core</artifactId>
-		</dependency>
-		
-		<dependency>
-			<groupId>org.mortbay.jetty</groupId>
-			<artifactId>jetty</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.mortbay.jetty</groupId>
-			<artifactId>jetty-util</artifactId>
-		</dependency>
-        <dependency>
-            <groupId>com.typesafe</groupId>
-            <artifactId>config</artifactId>
-        </dependency>
-	</dependencies>
-</project>
-

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/main/java/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/META-INF/MANIFEST.MF b/eagle-core/eagle-query/eagle-common/src/main/java/META-INF/MANIFEST.MF
deleted file mode 100644
index c67816b..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,19 +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.
- */
-Manifest-Version: 1.0
-Class-Path: 
-

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/Base64.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/Base64.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/Base64.java
deleted file mode 100644
index aec84a3..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/Base64.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.common;
-
-import java.io.UnsupportedEncodingException;
-
-import javax.xml.bind.DatatypeConverter;
-
-public class Base64 {
-
-	public static String decode(String salted) {
-		try {
-			return new String(DatatypeConverter.parseBase64Binary(salted), "UTF-8");
-		} catch (UnsupportedEncodingException e) {
-			throw new RuntimeException("UTF-8 must be supported", e);
-		}
-	}
-
-	public static String encode(String plain) {
-		try {
-			return DatatypeConverter.printBase64Binary(plain.getBytes("UTF-8"));
-		} catch (UnsupportedEncodingException e) {
-			throw new RuntimeException("UTF-8 must be supported", e);
-		}
-	}
-
-}


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

Posted by ha...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider b/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider
new file mode 100644
index 0000000..75096f8
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider
@@ -0,0 +1,16 @@
+# 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.
+
+org.apache.eagle.app.TestApplicationImpl$Provider
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestApplicationConf.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestApplicationConf.xml b/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestApplicationConf.xml
new file mode 100644
index 0000000..4a31c5e
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestApplicationConf.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<configuration>
+    <property>
+        <name>kafka.topic</name>
+        <displayName>Kafka Topic</displayName>
+        <value>hdfs_audit</value>
+        <description>Kafka Topic</description>
+    </property>
+    <property>
+        <name>zookeeper.server</name>
+        <displayName>Zookeeper Server</displayName>
+        <value>localhost:2181</value>
+        <description>Zookeeper Server address</description>
+    </property>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestApplicationMetadata.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestApplicationMetadata.xml b/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestApplicationMetadata.xml
new file mode 100644
index 0000000..36a64d0
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestApplicationMetadata.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<application>
+    <type>TEST_APPLICATION</type>
+    <name>Test Monitoring Application</name>
+    <version>0.5.0-incubating</version>
+    <appClass>org.apache.eagle.app.TestApplicationImpl</appClass>
+    <viewPath>/apps/example</viewPath>
+    <configuration>
+        <property>
+            <name>message.content</name>
+            <displayName>Message</displayName>
+            <value>Hello, example application!</value>
+            <description>Just an sample configuration property</description>
+        </property>
+    </configuration>
+
+    <!-- Output components -->
+    <streams>
+        <stream>
+            <streamId>TEST_STREAM_1</streamId>
+            <description>Example output stream #1</description>
+            <validate>true</validate>
+            <timeseries>true</timeseries>
+            <columns>
+                <column>
+                    <name>metric</name>
+                    <type>string</type>
+                </column>
+                <column>
+                    <name>value</name>
+                    <type>double</type>
+                    <defaultValue>0.0</defaultValue>
+                </column>
+            </columns>
+        </stream>
+        <stream>
+            <streamId>TEST_STREAM_2</streamId>
+            <description>Example output stream #2</description>
+            <validate>true</validate>
+            <timeseries>true</timeseries>
+            <columns>
+                <column>
+                    <name>metric</name>
+                    <type>string</type>
+                </column>
+                <column>
+                    <name>value</name>
+                    <type>double</type>
+                    <defaultValue>0.0</defaultValue>
+                </column>
+            </columns>
+        </stream>
+    </streams>
+    <docs>
+        <install>
+# Step 1: Create source kafka topic named "${site}_example_source_topic"
+
+./bin/kafka-topics.sh --create --topic example_source_topic --replication-factor 1 --replication 1
+
+# Step 2: Set up data collector to flow data into kafka topic in
+
+./bin/logstash -f log_collector.conf
+
+## `log_collector.conf` sample as following:
+
+input {
+
+}
+filter {
+
+}
+output{
+
+}
+
+# Step 3: start application
+
+# Step 4: monitor with featured portal or alert with policies
+        </install>
+        <uninstall>
+# Step 1: stop and uninstall application
+# Step 2: delete kafka topic named "${site}_example_source_topic"
+# Step 3: stop logstash
+        </uninstall>
+    </docs>
+</application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestStreamDefinitionConf.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestStreamDefinitionConf.xml b/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestStreamDefinitionConf.xml
new file mode 100644
index 0000000..0bb0012
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/resources/TestStreamDefinitionConf.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<streams>
+    <stream>
+        <streamId>OUTPUT_STREAM_1</streamId>
+        <description>Example output stream</description>
+        <validate>true</validate>
+        <timeseries>true</timeseries>
+        <columns>
+            <column>
+                <name>metric</name>
+                <type>string</type>
+            </column>
+            <column>
+                <name>value</name>
+                <type>double</type>
+                <defaultValue>0.0</defaultValue>
+            </column>
+        </columns>
+    </stream>
+</streams>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/application.conf b/eagle-core/eagle-app/eagle-app-base/src/test/resources/application.conf
new file mode 100644
index 0000000..49654c0
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/resources/application.conf
@@ -0,0 +1,54 @@
+# 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.
+
+{
+	"coordinator" : {
+		"policiesPerBolt" : 5,
+		"boltParallelism" : 5,
+		"policyDefaultParallelism" : 5,
+		"boltLoadUpbound": 0.8,
+		"topologyLoadUpbound" : 0.8,
+		"numOfAlertBoltsPerTopology" : 5,
+		"zkConfig" : {
+			"zkQuorum" : "127.0.0.1:2181",
+			"zkRoot" : "/alert",
+			"zkSessionTimeoutMs" : 10000,
+			"connectionTimeoutMs" : 10000,
+			"zkRetryTimes" : 3,
+			"zkRetryInterval" : 3000
+		},
+		"metadataService" : {
+			"host" : "localhost",
+			"port" : 8080,
+			"context" : "/rest"
+		},
+		"metadataDynamicCheck" : {
+			"initDelayMillis" : 1000,
+			"delayMillis" : 30000
+		}
+	},
+	"metadata":{
+		"store": "org.apache.eagle.metadata.persistence.MemoryMetadataStore"
+	},
+	"application":{
+		"sink":{
+			"type": "org.apache.eagle.app.sink.KafkaStreamSink"
+			"boostrap.server":"localhost:9092"
+		}
+		"provider":{
+			"loader":"org.apache.eagle.app.service.loader.ApplicationProviderSPILoader"
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/resources/config_template.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/config_template.xml b/eagle-core/eagle-app/eagle-app-base/src/test/resources/config_template.xml
new file mode 100644
index 0000000..da79abc
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/resources/config_template.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  -->
+<configuration>
+    <obj>
+        some object
+    </obj>
+    <property>
+        <name>kafka.topic</name>
+        <displayName>Kafka Topic</displayName>
+        <value>hdfs_audit</value>
+        <description>Kafka Topic</description>
+    </property>
+    <property>
+        <name>zookeeper.server</name>
+        <displayName>Zookeeper Server</displayName>
+        <value>localhost:2181</value>
+        <description>Zookeeper Server address</description>
+    </property>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/log4j.properties b/eagle-core/eagle-app/eagle-app-base/src/test/resources/log4j.properties
new file mode 100644
index 0000000..fb13ad5
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/resources/log4j.properties
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+log4j.rootLogger=DEBUG, stdout
+
+# standard output
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/resources/providers.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/providers.xml b/eagle-core/eagle-app/eagle-app-base/src/test/resources/providers.xml
new file mode 100644
index 0000000..3af7733
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/resources/providers.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<providers>
+    <provider>
+        <jarPath>target/apache-eagle-example-app.jar</jarPath>
+        <className>org.apache.eagle.app.TestApplicationImpl$Provider</className>
+    </provider>
+</providers>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-application-service/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-application-service/pom.xml b/eagle-core/eagle-app/eagle-application-service/pom.xml
new file mode 100644
index 0000000..3e3e8f4
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-application-service/pom.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eagle-app-parent</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>eagle-application-service</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-policy-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-service-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/AppManagerConstants.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/AppManagerConstants.java b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/AppManagerConstants.java
new file mode 100644
index 0000000..3aa3579
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/AppManagerConstants.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+
+public class AppManagerConstants {
+    public final static String SITE_TAG = "site";
+    public final static String APPLICATION_TAG = "application";
+    public final static String OPERATION_TAG = "operation";
+    public final static String OPERATION_ID_TAG = "operationID";
+    public final static String TOPOLOGY_TAG = "topology";
+    public final static String FULLNAME = "fullName";
+    public final static String APPLICATION_ID = "id";
+
+    public final static String CLUSTER_ENV = "envContextConfig.env";
+    public final static String CLUSTER_URL = "envContextConfig.url";
+    public final static String DEFAULT_CLUSTER_URL = "http://sandbox.hortonworks.com:8744";
+
+    public final static String RUNNING_MODE = "envContextConfig.mode";
+    public final static String EAGLE_CLUSTER_STORM = "storm";
+    public final static String EAGLE_CLUSTER_SPARK = "spark";
+
+    public final static String APP_COMMAND_LOADER_ENABLED = "appCommandLoaderEnabled";
+    public final static String APP_COMMAND_LOADER_INTERVAL_SECS = "appCommandLoaderIntervalSecs";
+    public final static String APP_HEALTH_CHECK_INTERVAL_SECS = "appHealthCheckIntervalSecs";
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/ApplicationManagementResource.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/ApplicationManagementResource.java b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/ApplicationManagementResource.java
new file mode 100644
index 0000000..6e4521d
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/ApplicationManagementResource.java
@@ -0,0 +1,109 @@
+/*
+ * 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;
+
+
+import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
+import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
+import org.apache.eagle.policy.common.Constants;
+import org.apache.eagle.service.application.dao.ApplicationManagerDAO;
+import org.apache.eagle.service.application.dao.ApplicationManagerDaoImpl;
+import org.apache.eagle.service.application.entity.TopologyExecutionStatus;
+import org.apache.eagle.service.application.entity.TopologyOperationEntity;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.type.TypeFactory;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.*;
+
+@Path(ApplicationManagementResource.ROOT_PATH)
+public class ApplicationManagementResource {
+    private final static ApplicationManagerDAO dao = new ApplicationManagerDaoImpl();
+    public final static String ROOT_PATH = "/app";
+
+    @Path("operation")
+    @POST
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    public GenericServiceAPIResponseEntity createOperation(InputStream inputStream) {
+        GenericServiceAPIResponseEntity response = new GenericServiceAPIResponseEntity<>();
+        List<TopologyOperationEntity> operations = new LinkedList<>();
+        try {
+            List<TopologyOperationEntity> entities = (List<TopologyOperationEntity>) unmarshalOperationEntities(inputStream);
+            if (entities == null) {
+                throw new IllegalArgumentException("inputStream cannot convert to TopologyOperationEntity");
+            }
+            for (TopologyOperationEntity entity : entities) {
+                String status = dao.loadTopologyExecutionStatus(entity.getSite(), entity.getApplication(), entity.getTopology());
+                if(status == null) {
+                    throw new Exception(String.format("Fail to fetch the topology execution status by site=%s, application=%s, topology=%s", entity.getSite(), entity.getApplication(), entity.getTopology()));
+                }
+                int operationsInRunning = dao.loadTopologyOperationsInRunning(entity.getSite(), entity.getApplication(), entity.getTopology());
+                if(operationsInRunning !=0) {
+                    throw new Exception(operationsInRunning + "operations are running, please wait for a minute");
+                }
+                if (validateOperation(entity.getOperation(), status)) {
+                    Map<String, String> tags = entity.getTags();
+                    tags.put(AppManagerConstants.OPERATION_ID_TAG, UUID.randomUUID().toString());
+                    entity.setTags(tags);
+                    entity.setLastModifiedDate(System.currentTimeMillis());
+                    entity.setTimestamp(System.currentTimeMillis());
+                    operations.add(entity);
+                } else {
+                    throw new Exception(String.format("%s is an invalid operation, as the topology's current status is %s", entity.getOperation(), status));
+                }
+            }
+            response = dao.createOperation(operations);
+        } catch (Exception e) {
+            response.setSuccess(false);
+            response.setException(e);
+        }
+        return response;
+    }
+
+    private boolean validateOperation(String operation, String status) {
+        boolean ret = false;
+        switch (operation) {
+            case TopologyOperationEntity.OPERATION.START:
+                return TopologyExecutionStatus.isReadyToStart(status);
+            case TopologyOperationEntity.OPERATION.STOP:
+                return TopologyExecutionStatus.isReadyToStop(status);
+            default: break;
+        }
+        return ret;
+    }
+
+    private List<? extends TaggedLogAPIEntity> unmarshalOperationEntities(InputStream inputStream) throws IllegalAccessException, InstantiationException, IOException {
+        ObjectMapper objectMapper = new ObjectMapper();
+        return objectMapper.readValue(inputStream, TypeFactory.defaultInstance().constructCollectionType(LinkedList.class, TopologyOperationEntity.class));
+    }
+
+    @Path("topology")
+    @DELETE
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    public GenericServiceAPIResponseEntity deleteTopology(@QueryParam("topology") String topology) {
+        return dao.deleteTopology(topology);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/dao/ApplicationManagerDAO.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/dao/ApplicationManagerDAO.java b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/dao/ApplicationManagerDAO.java
new file mode 100644
index 0000000..dfa261b
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/dao/ApplicationManagerDAO.java
@@ -0,0 +1,33 @@
+/*
+ * 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.dao;
+
+
+import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
+import org.apache.eagle.service.application.entity.TopologyExecutionStatus;
+import org.apache.eagle.service.application.entity.TopologyOperationEntity;
+
+import java.util.List;
+
+public interface ApplicationManagerDAO {
+    String loadTopologyExecutionStatus(String site, String application, String topology);
+    int loadTopologyOperationsInRunning(String site, String application, String topology) throws Exception;
+    GenericServiceAPIResponseEntity createOperation(List<TopologyOperationEntity> entities) throws Exception;
+    GenericServiceAPIResponseEntity deleteTopology(String topology);
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/dao/ApplicationManagerDaoImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/dao/ApplicationManagerDaoImpl.java b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/dao/ApplicationManagerDaoImpl.java
new file mode 100644
index 0000000..4881cf4
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/dao/ApplicationManagerDaoImpl.java
@@ -0,0 +1,91 @@
+/*
+ * 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.dao;
+
+import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
+import org.apache.eagle.policy.common.Constants;
+import org.apache.eagle.service.application.entity.TopologyExecutionEntity;
+import org.apache.eagle.service.application.entity.TopologyOperationEntity;
+import org.apache.eagle.service.generic.GenericEntityServiceResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+public class ApplicationManagerDaoImpl implements ApplicationManagerDAO {
+    private static Logger LOG = LoggerFactory.getLogger(ApplicationManagerDaoImpl.class);
+    GenericEntityServiceResource resource = new GenericEntityServiceResource();
+
+    @Override
+    public String loadTopologyExecutionStatus(String site, String application, String topology) {
+        String query = String.format("%s[@site=\"%s\" AND @application=\"%s\" AND @topology=\"%s\"]{*}", Constants.TOPOLOGY_EXECUTION_SERVICE_ENDPOINT_NAME, site, application, topology);
+        GenericServiceAPIResponseEntity<TopologyExecutionEntity> response = resource.search(query,  null, null, Integer.MAX_VALUE, null, false, false, 0L, 0, false, 0, null, false);
+        if(!response.isSuccess()) {
+            LOG.error(response.getException());
+            return null;
+        }
+        List<TopologyExecutionEntity> list = response.getObj();
+        if(list == null || list.size() != 1) {
+            LOG.error("ERROR: fetching 0 or more than 1 topology execution entities");
+            return null;
+        }
+        return list.get(0).getStatus();
+    }
+
+    @Override
+    public int loadTopologyOperationsInRunning(String site, String application, String topology) throws Exception {
+        int ret = 0;
+        String query = String.format("%s[@site=\"%s\" AND @application=\"%s\" AND @topology=\"%s\" AND (@status=\"%s\" OR @status=\"%s\")]{*}", Constants.TOPOLOGY_OPERATION_SERVICE_ENDPOINT_NAME, site, application, topology, TopologyOperationEntity.OPERATION_STATUS.INITIALIZED, TopologyOperationEntity.OPERATION_STATUS.PENDING);
+        GenericServiceAPIResponseEntity<TopologyExecutionEntity> response = resource.search(query, null, null, Integer.MAX_VALUE, null, false, false, 0L, 0, false, 0, null, false);
+        if(!response.isSuccess()) {
+            throw new Exception(response.getException());
+        }
+        if(response.getObj() != null && response.getObj().size() != 0) {
+            ret = response.getObj().size();
+        }
+        return ret;
+    }
+
+    @Override
+    public GenericServiceAPIResponseEntity createOperation(List<TopologyOperationEntity> entities) throws Exception {
+        if(entities.size() == 0) {
+            LOG.info("TopologyOperationEntity set is empty.");
+        }
+        GenericServiceAPIResponseEntity response = resource.updateEntities(entities, Constants.TOPOLOGY_OPERATION_SERVICE_ENDPOINT_NAME);
+        return response;
+    }
+
+    @Override
+    public GenericServiceAPIResponseEntity deleteTopology(String topology) {
+        String topologyQuery = Constants.TOPOLOGY_DESCRIPTION_SERVICE_ENDPOINT_NAME+ "[@topology=\"" + topology + "\"]{*}";
+        String executionQuery = Constants.TOPOLOGY_EXECUTION_SERVICE_ENDPOINT_NAME + "[@topology=\"" + topology + "\"]{*}";
+        int pageSize = Integer.MAX_VALUE;
+
+        GenericServiceAPIResponseEntity response = resource.deleteByQuery(topologyQuery, null, null, pageSize, null, false, false, 0L, 0, true, 0, null, false);
+        if(response.isSuccess()) {
+            response = resource.deleteByQuery(executionQuery, null, null, pageSize, null, false, false, 0L, 0, true, 0, null, false);
+        }
+        if(!response.isSuccess()) {
+            LOG.error(response.getException());
+        }
+        return response;
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/ApplicationEntityRepo.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/ApplicationEntityRepo.java b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/ApplicationEntityRepo.java
new file mode 100644
index 0000000..3226650
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/ApplicationEntityRepo.java
@@ -0,0 +1,30 @@
+/*
+ * 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.entity.repo.EntityRepository;
+
+public class ApplicationEntityRepo  extends EntityRepository {
+    public ApplicationEntityRepo() {
+        this.registerEntity(TopologyDescriptionEntity.class);
+        this.registerEntity(TopologyExecutionEntity.class);
+        this.registerEntity(TopologyOperationEntity.class);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyDescriptionEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyDescriptionEntity.java b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyDescriptionEntity.java
new file mode 100644
index 0000000..6442e6c
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyDescriptionEntity.java
@@ -0,0 +1,104 @@
+/*
+ * 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("topologyDescription")
+@Service(Constants.TOPOLOGY_DESCRIPTION_SERVICE_ENDPOINT_NAME)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@TimeSeries(false)
+@Tags({"topology"})
+public class TopologyDescriptionEntity extends TaggedLogAPIEntity {
+    @Column("a")
+    private String exeClass;
+    @Column("b")
+    private String type;
+    @Column("c")
+    private String description;
+    @Column("d")
+    private String version;
+    private String context;
+    public String getContext() {
+        return context;
+    }
+
+    public void setContext(String context) {
+        this.context = context;
+    }
+
+    public String getExeClass() {
+        return exeClass;
+    }
+
+    public void setExeClass(String exeClass) {
+        this.exeClass = exeClass;
+        valueChanged("exeClass");
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+        valueChanged("type");
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+        valueChanged("description");
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+        valueChanged("version");
+    }
+
+    public String getTopology() {
+        return this.getTags().get(AppManagerConstants.TOPOLOGY_TAG);
+    }
+
+    public final static class TYPE {
+        public final static String DYNAMIC = "DYNAMIC";
+        public final static String CLASS = "CLASS";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyExecutionEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyExecutionEntity.java b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyExecutionEntity.java
new file mode 100644
index 0000000..9991d3b
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyExecutionEntity.java
@@ -0,0 +1,132 @@
+/*
+ * 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("topologyExecution")
+@Service(Constants.TOPOLOGY_EXECUTION_SERVICE_ENDPOINT_NAME)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@TimeSeries(false)
+@Tags({"site", "application", "topology"})
+public class TopologyExecutionEntity extends TaggedLogAPIEntity {
+    @Column("a")
+    private String fullName;
+    @Column("b")
+    private String url;
+    @Column("c")
+    private String description;
+    @Column("d")
+    private String status;
+    @Column("e")
+    private long lastModifiedDate;
+    @Column("f")
+    private String mode;
+    @Column("g")
+    private String environment;
+
+    public String getEnvironment() {
+        return environment;
+    }
+
+    public void setEnvironment(String environment) {
+        this.environment = environment;
+        valueChanged("environment");
+    }
+
+    public String getMode() {
+        return mode;
+    }
+
+    public void setMode(String mode) {
+        this.mode = mode;
+        valueChanged("mode");
+    }
+
+    public String getFullName() {
+        return fullName;
+    }
+
+    public void setFullName(String fullName) {
+        this.fullName = fullName;
+        valueChanged("fullName");
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+        valueChanged("url");
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+        valueChanged("description");
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+        valueChanged("status");
+    }
+
+    public long getLastModifiedDate() {
+        return lastModifiedDate;
+    }
+
+    public void setLastModifiedDate(long lastModifiedDate) {
+        this.lastModifiedDate = lastModifiedDate;
+        valueChanged("lastModifiedDate");
+    }
+
+    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);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyExecutionStatus.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyExecutionStatus.java b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyExecutionStatus.java
new file mode 100644
index 0000000..f62ad8a
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyExecutionStatus.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+
+public class TopologyExecutionStatus {
+    public final static String STOPPED = "STOPPED";
+    public final static String STARTED = "STARTED";
+    public final static String STARTING = "STARTING";
+    public final static String STOPPING = "STOPPING";
+    public final static String NEW = "NEW";
+
+    public static boolean isReadyToStart(String status){
+        return status.equals(STOPPED) || status.equals(NEW);
+    }
+
+    public static boolean isReadyToStop(String status){
+        return status.equals(STARTED);
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyOperationEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyOperationEntity.java b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyOperationEntity.java
new file mode 100644
index 0000000..6d8f1a0
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-application-service/src/main/java/org/apache/eagle/service/application/entity/TopologyOperationEntity.java
@@ -0,0 +1,105 @@
+/*
+ * 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-app/eagle-stream-application-manager/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/pom.xml b/eagle-core/eagle-app/eagle-stream-application-manager/pom.xml
new file mode 100644
index 0000000..919188f
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/pom.xml
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eagle-app-parent</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>eagle-stream-application-manager</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-application-service</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-stream-pipeline</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.storm</groupId>
+            <artifactId>storm-core</artifactId>
+            <version>${storm.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>ch.qos.logback</groupId>
+                    <artifactId>logback-classic</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>log4j</groupId>
+                    <artifactId>log4j</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>log4j-over-slf4j</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.scala-lang</groupId>
+            <artifactId>scala-reflect</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.scala-lang</groupId>
+            <artifactId>scala-compiler</artifactId>
+            <version>${scala.version}.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.scalatest</groupId>
+            <artifactId>scalatest_${scala.version}</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.typesafe.akka</groupId>
+            <artifactId>akka-actor_${scala.version}</artifactId>
+            <version>${akka.actor.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.typesafe.akka</groupId>
+            <artifactId>akka-testkit_${scala.version}</artifactId>
+            <version>${akka.actor.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.scala-tools</groupId>
+                <artifactId>maven-scala-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>scala-compile-first</id>
+                        <phase>process-resources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                            <goal>compile</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>scala-test-compile</id>
+                        <phase>process-test-resources</phase>
+                        <goals>
+                            <goal>testCompile</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.scalatest</groupId>
+                <artifactId>scalatest-maven-plugin</artifactId>
+                <configuration>
+                    <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
+                    <junitxml>.</junitxml>
+                    <filereports>TestSuite.txt</filereports>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>test</id>
+                        <goals>
+                            <goal>test</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyException.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyException.java b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyException.java
new file mode 100644
index 0000000..d382629
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyException.java
@@ -0,0 +1,26 @@
+/*
+ * 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;
+
+
+public class TopologyException extends Exception {
+    public TopologyException(String s, Exception e) { super(s,e); }
+    public TopologyException(Exception e) { super(e); }
+    public TopologyException(String s) { super(s); }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyExecutable.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyExecutable.java b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyExecutable.java
new file mode 100644
index 0000000..8f625c7
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyExecutable.java
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+
+import com.typesafe.config.Config;
+
+
+public interface TopologyExecutable {
+    void submit(String topology, Config config);
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyFactory.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyFactory.java b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyFactory.java
new file mode 100644
index 0000000..e32f48e
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyFactory.java
@@ -0,0 +1,55 @@
+/*
+ * 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;
+
+
+import com.typesafe.config.Config;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public final class TopologyFactory {
+    public static Logger LOG = LoggerFactory.getLogger(TopologyFactory.class);
+    private final static Map<String, TopologyExecutable> topologyCache = Collections.synchronizedMap(new HashMap<String, TopologyExecutable>());
+    public static TopologyExecutable getTopologyInstance(String topologyClass) throws TopologyException {
+        TopologyExecutable instance;
+        if(topologyCache.containsKey(topologyClass)){
+            instance = topologyCache.get(topologyClass);
+        } else {
+            try {
+                LOG.info("load class " + topologyClass + "with classLoader " + TopologyFactory.class.getClassLoader().toString());
+                instance = (TopologyExecutable) Class.forName(topologyClass).newInstance();
+                topologyCache.put(topologyClass, instance);
+            } catch (ClassNotFoundException e) {
+                throw new TopologyException("Topology in type of " + topologyClass + " is not found",e);
+            } catch (InstantiationException | IllegalAccessException e) {
+                throw new TopologyException(e);
+            }
+        }
+        return instance;
+    }
+
+    public static void submit(String topologyClass, Config config) throws TopologyException {
+        TopologyExecutable topology = getTopologyInstance(topologyClass);
+        topology.submit(topologyClass, config);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/AbstractDynamicApplication.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/AbstractDynamicApplication.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/AbstractDynamicApplication.scala
new file mode 100644
index 0000000..3e918cc
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/AbstractDynamicApplication.scala
@@ -0,0 +1,32 @@
+/*
+ * 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
+
+import com.typesafe.config.Config
+import org.apache.eagle.datastream.core.StreamContext
+import org.apache.eagle.stream.pipeline.Pipeline
+
+
+trait AbstractDynamicApplication extends TopologyExecutable {
+  def compileStream(application: String, config: Config): StreamContext = {
+    val pipeline = Pipeline.parseStringWithConfig(application, config)
+    Pipeline.compile(pipeline)
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManager.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManager.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManager.scala
new file mode 100644
index 0000000..bbfaedd
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManager.scala
@@ -0,0 +1,126 @@
+/*
+ * 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
+
+import java.util
+
+import com.google.common.base.Preconditions
+import org.apache.eagle.service.application.entity.TopologyExecutionStatus
+import org.apache.eagle.stream.application.impl.StormExecutionPlatform
+import org.slf4j.{Logger, LoggerFactory}
+
+import scala.collection.JavaConversions
+
+
+object ApplicationManager {
+  private val LOG: Logger = LoggerFactory.getLogger(ApplicationManager.getClass)
+  private val workerMap: util.Map[AnyRef, TaskExecutor] = new util.TreeMap[AnyRef, TaskExecutor]
+
+  def getWorkerMap: util.Map[AnyRef, TaskExecutor] = {
+    return workerMap
+  }
+
+  def submit(id: AnyRef, runnable: Runnable): TaskExecutor = {
+    if (workerMap.containsKey(id)) {
+      val executor: Thread = workerMap.get(id)
+      if (!executor.isAlive || executor.getState.equals() ) {
+        LOG.info("Replacing dead executor: {}", executor)
+        workerMap.remove(id)
+      }
+      else {
+        throw new IllegalArgumentException("Duplicated id '" + id + "'")
+      }
+    }
+    val worker: TaskExecutor = new TaskExecutor(runnable)
+    LOG.info("Registering new executor %s: %s".format(id, worker))
+    workerMap.put(id, worker)
+    worker.setName(id.toString)
+    worker.setDaemon(true)
+    worker.start
+    return worker
+  }
+
+  def get(id: AnyRef): TaskExecutor = {
+    Preconditions.checkArgument(workerMap.containsKey(id))
+    return workerMap.get(id)
+  }
+
+  @throws(classOf[Exception])
+  def stop(id: AnyRef): TaskExecutor = {
+    val worker: TaskExecutor = get(id)
+    worker.interrupt
+    //this.workerMap.remove(id)
+    return worker
+  }
+
+  def getWorkerStatus(state: Thread.State): String = {
+    if (whereIn(state, java.lang.Thread.State.RUNNABLE, java.lang.Thread.State.TIMED_WAITING, java.lang.Thread.State.WAITING)) {
+      return TopologyExecutionStatus.STARTED
+    }
+    else if (whereIn(state, java.lang.Thread.State.NEW)) {
+      return TopologyExecutionStatus.STARTING
+    }
+    else if (whereIn(state, java.lang.Thread.State.TERMINATED)) {
+      return TopologyExecutionStatus.STOPPED
+    }
+    throw new IllegalStateException("Unknown state: " + state)
+  }
+
+  def getTopologyStatus(status: String): String = {
+    if(whereIn(status, StormExecutionPlatform.KILLED))
+      return TopologyExecutionStatus.STOPPING
+    return TopologyExecutionStatus.STARTED
+  }
+
+  private def whereIn(status: String, inStatuses: String*): Boolean = {
+    for (_status <- inStatuses) {
+      if (_status.equalsIgnoreCase(status)) {
+        return true
+      }
+    }
+    return false
+  }
+  private def whereIn(state: Thread.State, inStates: Thread.State*): Boolean = {
+    for (_state <- inStates) {
+      if (_state eq state) {
+        return true
+      }
+    }
+    return false
+  }
+
+  def remove(id: AnyRef) {
+    val executor: TaskExecutor = this.get(id)
+    if (executor.isAlive) {
+      throw new RuntimeException("Failed to remove alive executor '" + id + "'")
+    }
+    else {
+      this.workerMap.remove(id)
+    }
+  }
+
+  def stopAll(): Unit ={
+    JavaConversions.collectionAsScalaIterable(workerMap.values()) foreach { worker =>
+      if(!worker.isInterrupted) {
+        worker.interrupt()
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManagerUtils.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManagerUtils.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManagerUtils.scala
new file mode 100644
index 0000000..4c2df77
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManagerUtils.scala
@@ -0,0 +1,38 @@
+/*
+ * 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
+
+import com.typesafe.config.Config
+import org.apache.eagle.service.application.AppManagerConstants
+import org.apache.eagle.service.application.entity.TopologyExecutionEntity
+
+
+object ApplicationManagerUtils {
+
+  def generateTopologyFullName(topologyExecution: TopologyExecutionEntity) = {
+    val fullName = "eagle-%s-%s-%s".format(topologyExecution.getSite, topologyExecution.getApplication, topologyExecution.getTopology)
+    fullName
+  }
+
+  def buildStormTopologyURL(config: Config, topologyID: String): String = {
+    val clusterURL = if(config.hasPath(AppManagerConstants.CLUSTER_URL)) config.getString(AppManagerConstants.CLUSTER_URL) else AppManagerConstants.DEFAULT_CLUSTER_URL
+    val topologyURL = clusterURL + "/topology.html?id=" + topologyID
+    topologyURL
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationSchedulerAsyncDAO.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationSchedulerAsyncDAO.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationSchedulerAsyncDAO.scala
new file mode 100644
index 0000000..ae0f6e8
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationSchedulerAsyncDAO.scala
@@ -0,0 +1,179 @@
+/*
+ * 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
+
+import java.util
+import java.util.concurrent.Callable
+
+import akka.dispatch.Futures
+import com.typesafe.config.Config
+import org.apache.eagle.alert.entity.SiteApplicationServiceEntity
+import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity
+import org.apache.eagle.policy.common.Constants
+import org.apache.eagle.service.application.entity.{TopologyDescriptionEntity, TopologyExecutionEntity, TopologyExecutionStatus, TopologyOperationEntity}
+import org.apache.eagle.service.client.EagleServiceConnector
+import org.apache.eagle.service.client.impl.EagleServiceClientImpl
+import org.slf4j.{Logger, LoggerFactory}
+
+import scala.collection.JavaConversions
+import scala.concurrent.ExecutionContext
+
+
+class ApplicationSchedulerAsyncDAO(config: Config, ex: ExecutionContext) {
+  private val LOG: Logger = LoggerFactory.getLogger(classOf[ApplicationSchedulerAsyncDAO])
+  private val connector: EagleServiceConnector = new EagleServiceConnector(config)
+
+  def getEagleServiceClient(): EagleServiceClientImpl = {
+    return new EagleServiceClientImpl(connector)
+  }
+
+  def readOperationsByStatus(status: String) = {
+    Futures.future(new Callable[util.List[TopologyOperationEntity]]{
+      override def call(): util.List[TopologyOperationEntity] = {
+        val client = getEagleServiceClient()
+        val query = "%s[@status=\"%s\"]{*}".format(Constants.TOPOLOGY_OPERATION_SERVICE_ENDPOINT_NAME, status)
+        val response: GenericServiceAPIResponseEntity[TopologyOperationEntity] = client.search(query).pageSize(Int.MaxValue).send()
+        if(client != null) client.close()
+        if(!response.isSuccess || response.getObj == null)
+          throw new Exception(s"Fail to load operations with status $status")
+        response.getObj
+      }
+    }, ex)
+  }
+
+  def loadAllTopologyExecutionEntities() = {
+    Futures.future(new Callable[util.List[TopologyExecutionEntity]]{
+      override def call(): util.List[TopologyExecutionEntity] = {
+        val client = getEagleServiceClient()
+        val query = "%s[@status != \"%s\"]{*}".format(Constants.TOPOLOGY_EXECUTION_SERVICE_ENDPOINT_NAME, TopologyExecutionStatus.NEW)
+        val response: GenericServiceAPIResponseEntity[TopologyExecutionEntity] = client.search(query).pageSize(Int.MaxValue).send()
+        if(client != null) client.close()
+        if(!response.isSuccess || response.getObj == null) throw new Exception(response.getException)
+        response.getObj
+      }
+    }, ex)
+  }
+
+  def loadTopologyExecutionByName(site: String, appName: String, topologyName: String) = {
+    Futures.future(new Callable[TopologyExecutionEntity]{
+      override def call(): TopologyExecutionEntity = {
+        val client = getEagleServiceClient()
+        val query = "%s[@site=\"%s\" AND @application=\"%s\" AND @topology=\"%s\"]{*}".format(Constants.TOPOLOGY_EXECUTION_SERVICE_ENDPOINT_NAME, site, appName, topologyName)
+        LOG.info(s"query=$query")
+        val response: GenericServiceAPIResponseEntity[TopologyExecutionEntity] = client.search(query).pageSize(Int.MaxValue).send()
+        if(client != null) client.close()
+        if(!response.isSuccess || response.getObj == null)
+          throw new Exception(s"Fail to load topologyExecutionEntity with application=$appName topology=$topologyName due to Exception: ${response.getException}")
+        if(response.getObj.size() == 0 || response.getObj.size() > 1) {
+          throw new Exception(s"Get 0 or more than 1 topologyExecutionEntity with application=$appName topology=$topologyName")
+        }
+        response.getObj.get(0)
+      }
+    }, ex)
+  }
+
+  def loadTopologyDescriptionByName(site: String, application: String, topologyName: String) = {
+    Futures.future(new Callable[TopologyDescriptionEntity]{
+      override def call(): TopologyDescriptionEntity = {
+        val client = getEagleServiceClient()
+        var query = "%s[@topology=\"%s\"]{*}".format(Constants.TOPOLOGY_DESCRIPTION_SERVICE_ENDPOINT_NAME, topologyName)
+        val response: GenericServiceAPIResponseEntity[TopologyDescriptionEntity] = client.search(query).pageSize(Int.MaxValue).send()
+        if(!response.isSuccess || response.getObj == null || response.getObj.size() == 0)
+          throw new Exception(s"Fail to load TopologyDescriptionEntity with site=$site application=$application topology=$topologyName due to Exception: ${response.getException}")
+        val topologyDescriptionEntity = response.getObj.get(0)
+
+        query = "%s[@site=\"%s\" AND @application=\"%s\"]{*}".format(Constants.SITE_APPLICATION_SERVICE_ENDPOINT_NAME, site, application)
+        val configResponse: GenericServiceAPIResponseEntity[SiteApplicationServiceEntity] = client.search(query).pageSize(Int.MaxValue).send()
+        if (client != null) client.close()
+        if(!configResponse.isSuccess || configResponse.getObj == null || configResponse.getObj.size() == 0)
+          throw new Exception(s"Fail to load topology configuration with query=$query due to Exception: ${configResponse.getException}")
+        val siteApplicationEntity = configResponse.getObj.get(0)
+        topologyDescriptionEntity.setContext(siteApplicationEntity.getConfig)
+        topologyDescriptionEntity
+      }
+    }, ex)
+  }
+
+  def updateOperationStatus(operation: TopologyOperationEntity) = {
+    Futures.future(new Callable[GenericServiceAPIResponseEntity[String]]{
+      override def call(): GenericServiceAPIResponseEntity[String] = {
+        if(LOG.isDebugEnabled()) LOG.debug(s"Updating status of command[$operation] as ${operation.getStatus}")
+        val client = getEagleServiceClient()
+        operation.setLastModifiedDate(System.currentTimeMillis())
+        val response= client.update(java.util.Arrays.asList(operation), classOf[TopologyOperationEntity])
+        if(client != null) client.close()
+        if(response.isSuccess) {
+          LOG.info(s"Updated operation status [$operation] as: ${operation.getStatus}")
+        } else {
+          LOG.error(s"Failed to update status as ${operation.getStatus} of command[$operation]")
+          throw new RuntimeException(s"Failed to update command due to exception: ${response.getException}")
+        }
+        response
+      }
+    }, ex)
+  }
+
+  def updateTopologyExecutionStatus(topology: TopologyExecutionEntity) = {
+    Futures.future(new Callable[GenericServiceAPIResponseEntity[String]]{
+      override def call(): GenericServiceAPIResponseEntity[String] = {
+        if(LOG.isDebugEnabled()) LOG.debug(s"Updating status of app[$topology] as ${topology.getStatus}")
+        val client = getEagleServiceClient()
+        topology.setLastModifiedDate(System.currentTimeMillis())
+        if(client != null) client.close()
+        val response= client.update(java.util.Arrays.asList(topology), classOf[TopologyExecutionEntity])
+        if(response.isSuccess) {
+          LOG.info(s"Updated status application[$topology] as: ${topology.getStatus}")
+        } else {
+          LOG.error(s"Failed to update status as ${topology.getStatus} of application[$topology] due to ${response.getException}")
+        }
+        response
+      }
+    }, ex)
+  }
+
+  def clearPendingOperations() = {
+    Futures.future(new Callable[GenericServiceAPIResponseEntity[String]]{
+      override def call(): GenericServiceAPIResponseEntity[String] = {
+        LOG.info("start to clear operation")
+        val query: String = "%s[@status=\"%s\"]{*}".format(Constants.TOPOLOGY_OPERATION_SERVICE_ENDPOINT_NAME, TopologyOperationEntity.OPERATION_STATUS.PENDING)
+        val client = getEagleServiceClient()
+        val response: GenericServiceAPIResponseEntity[TopologyOperationEntity] = client.search(query).pageSize(Int.MaxValue).send()
+        var ret: GenericServiceAPIResponseEntity[String] = new GenericServiceAPIResponseEntity[String]()
+        if (response.isSuccess && response.getObj.size != 0) {
+          val pendingOperations: util.List[TopologyOperationEntity] = response.getObj
+          val failedOperations: util.List[TopologyOperationEntity] = new util.ArrayList[TopologyOperationEntity]
+          JavaConversions.collectionAsScalaIterable(pendingOperations) foreach { operation =>
+            operation.setStatus(TopologyOperationEntity.OPERATION_STATUS.FAILED)
+            failedOperations.add(operation)
+          }
+          ret = client.update(failedOperations, Constants.TOPOLOGY_OPERATION_SERVICE_ENDPOINT_NAME)
+          if (client != null) client.close()
+          if (ret.isSuccess) {
+            LOG.info(s"Successfully clear ${failedOperations.size()} pending operations")
+          } else {
+            LOG.error(s"Failed to clear pending operations due to exception:" + ret.getException)
+          }
+        }
+        ret
+      }
+    }, ex)
+  }
+}
+
+

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatform.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatform.scala b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatform.scala
new file mode 100644
index 0000000..88271bb
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatform.scala
@@ -0,0 +1,30 @@
+/*
+ * 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
+
+import com.typesafe.config.Config
+import org.apache.eagle.service.application.entity.{TopologyExecutionEntity, TopologyDescriptionEntity}
+
+
+trait ExecutionPlatform {
+  def start(topology: TopologyDescriptionEntity, topologyExecution: TopologyExecutionEntity, config: Config)
+  def stop(topologyExecution: TopologyExecutionEntity, config: Config)
+  def status(topologyExecutions: java.util.List[TopologyExecutionEntity], config: Config)
+  def status(topologyExecution: TopologyExecutionEntity, config: Config)
+}


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

Posted by ha...@apache.org.
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..0000000
--- 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
- *#
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
-  <title></title>
-  <style type="text/css">
-    /* 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 whatever your want */
-        pointer-events: none;
-        cursor: default;
-      }
-
-      .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
-        text-decoration: default;
-        color: orange !important;
-        pointer-events: auto;
-        cursor: default;
-      }
-
-    }
-
-    /* More Specific Targeting */
-
-    @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
-      /* You guessed it, ipad (tablets, smaller screens, etc) */
-      /* repeating for the ipad */
-      a[href^="tel"], a[href^="sms"] {
-        text-decoration: none;
-        color: blue; /* or whatever your want */
-        pointer-events: none;
-        cursor: default;
-      }
-
-      .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
-        text-decoration: default;
-        color: orange !important;
-        pointer-events: auto;
-        cursor: default;
-      }
-    }
-
-    @media only screen and (-webkit-min-device-pixel-ratio: 2) {
-      /* Put your iPhone 4g styles in here */
-    }
-
-    /* Android targeting */
-    @media only screen and (-webkit-device-pixel-ratio: .75) {
-      /* Put CSS for low density (ldpi) Android layouts in here */
-    }
-
-    @media only screen and (-webkit-device-pixel-ratio: 1) {
-      /* Put CSS for medium density (mdpi) Android layouts in here */
-    }
-
-    @media only screen and (-webkit-device-pixel-ratio: 1.5) {
-      /* Put CSS for high density (hdpi) Android layouts in here */
-    }
-
-    /* end Android targeting */
-    .head{
-      font-family:Helvetica, Arial;
-      font-size:30px;
-      text-decoration:none;
-      text-align:left;
-      color:#333;
-      align:left;
-      padding: 25px 0 15px 0;
-      valign:middle;
-      font-weight: 500;
-      border-bottom: 1px solid #cccccc;
-    }
-
-    .head2{
-      font-family:Helvetica, Arial;
-      font-size:24px;
-      text-decoration:none;
-      text-align:left;
-      color:#333;
-      align:left;
-      padding: 20px 0 10px 0;
-      valign:middle;
-      font-weight: 500;
-    }
-
-    .text{
-      font-family:Helvetica, Arial;
-      font-size:14px;
-      text-decoration:none;
-      text-align:left;
-      color:#333;
-      align:left;
-      padding: 0.5em 0em 0.5em 0em;
-      valign:middle;
-    }
-
-    .info {
-      font-family:Helvetica, Arial;
-      font-size:16px;
-      text-decoration:none;
-      text-align:left;
-      padding-left:10px;
-      border-left: 3px solid #396A92;
-      background-color: #9AB4CB;
-      color:#091D42;
-      align:left;
-      padding: 1em 0em 1em 1em;
-      valign:middle;
-    }
-
-    .table-border{
-      border: 1px solid #ddd;
-      border-radius: 4px 4px 0 0;
-      box-shadow: none;
-    }
-
-    .table-border-th{
-      font-family:Helvetica, Arial;
-      font-size:14px;
-      text-decoration:none;
-      text-align:left;
-      border-top: 1px solid #cccccc;
-      border-right: 1px solid #cccccc;
-      padding: 8px;
-    }
-    .table-border-td{
-      font-family:Helvetica, Arial;
-      font-size:14px;
-      text-decoration:none;
-      text-align:left;
-      border-top: 1px solid #cccccc;
-      border-right: 1px solid #cccccc;
-      padding: 8px;
-      word-break: break-all;
-    }
-
-    .foot{
-      font-family:Arial;
-      font-size:14px;
-      text-decoration:none;
-      text-align:left;
-      padding: 0.5em 0em 0.5em 0.5em;
-      border-top: 1px solid #cccccc;
-      color:#777;
-    }
-
-  /* extend by hchen9 */
-
-  </style>
-
-  <!-- Targeting Windows Mobile -->
-  <!--[if IEMobile 7]>
-  <style type="text/css">
-
-  </style>
-  <![endif]-->
-
-  <!-- ***********************************************
-  ****************************************************
-  END MOBILE TARGETING
-  ****************************************************
-  ************************************************ -->
-
-  <!--[if gte mso 9]>
-  <style>
-    /* Target Outlook 2007 and 2010 */
-  </style>
-  <![endif]-->
-</head>
-<body>
-<!-- Wrapper/Container Table: Use a wrapper table to control the width and the background color consistently of your email. Use this approach instead of setting attributes on the body tag. -->
-<table cellpadding="0" cellspacing="0" border="0" id="backgroundTable" width="100%">
-  <tr>
-    <td valign="top" style="padding-left: 10px">

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/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
deleted file mode 100755
index fa3eee5..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/resources/templates/tec_alert.vm
+++ /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.
- *
- * @version 0.3.0
- *#
-#parse("header.vm")
-<table cellpadding="0" cellspacing="0" border="0" align="left" width="800" style="">
-  <tr>
-    <td class="head" width="800">
-      <span style="color: #091D42">Eagle Service <small style="color: #999999;">$startTime ~ $endTime</small></span>
-    </td>
-  </tr>
-  <tr>
-    <td class="head2" width="800">
-      <span>
-        Statistics
-      </span>
-    </td>
-  </tr>
-  <tr>
-    <td valign="top" style="padding: 0.5em 0em 0.5em 0em;">
-      <table cellpadding="0" cellspacing="0" border="0" align="left" width="800" class="table-border">
-        <thead>
-        <tr>
-          <th class="table-border-th" style="width: 25%">type</th>
-          <th class="table-border-th" style="width: 25%">count</th>
-          <th class="table-border-th" style="width: 25%">type</th>
-          <th class="table-border-th" style="width: 25%">count</th>
-        </tr>
-        </thead>
-        <tbody>
-        #foreach($key in $statistics.keySet())
-          #if( $foreach.count % 2 == 1 )
-          <tr>
-          #end
-            <td class="table-border-td">$key</td>
-            <td class="table-border-td">$statistics.get($key)</td>
-          #if( $foreach.count % 2 == 0)
-          </tr>
-          #end
-          #if( $foreach.count % 2 == 1 && !$foreach.hasNext )
-          	<td class="table-border-td"></td>
-            <td class="table-border-td"></td>
-          </tr>
-          #end
-       	#end
-        </tbody>
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td class="head2" width="800">
-      <span>
-        Detail Info
-      </span>
-    </td>
-  </tr>
-  <tr>
-    <td class="info" width="800">
-      <span>
-          These are the alerts that we can not find its hostname.
-      </span>
-    </td>
-  </tr>
-  <tr>
-    <td valign="top" style="padding: 0.5em 0em 0.5em 0em;">
-      <table cellpadding="0" cellspacing="0" border="0" align="left" width="800" class="table-border">
-        <thead>
-          <tr>
-            <th class="table-border-th">hostname</th>
-            <th class="table-border-th">date_reception</th>
-            <th class="table-border-th">type</th>
-            <th class="table-border-th">origin</th>
-            <th class="table-border-th">msg</th>
-          </tr>
-        </thead>
-        <tbody>
-        #foreach($entry in $noHostnameItems)
-          <tr>
-            <td class="table-border-td">$entry.hostname</td>
-            <td class="table-border-td">$entry.date_reception</td>
-            <td class="table-border-td">$entry.type</td>
-            <td class="table-border-td">$entry.origin</td>
-            <td class="table-border-td">$entry.msg</td>
-          </tr>
-       	#end
-        </tbody>
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td class="foot" width="800">
-      <span class="outlook">
-         Apache Eagle <a href="http://<Eagle-Host>:9090/eagle-web/ui/eagle.html"
-                  target ="_blank" title="Hadoop Eagle">Apache Eagle</a>
-      </span>
-    </td>
-  </tr>
-</table>
-#parse("footer.vm")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestByteUtil.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestByteUtil.java b/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestByteUtil.java
deleted file mode 100644
index a08c3d1..0000000
--- a/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestByteUtil.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.common;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestByteUtil {
-	
-	@Test
-	public void testLongAndBytesConversion() {
-		long origValue = 0x1234567812345678L;
-		byte[] bytes = ByteUtil.longToBytes(origValue);
-		checkNonZeros(bytes);
-		long value = ByteUtil.bytesToLong(bytes);
-		Assert.assertEquals(origValue, value);
-		bytes = new byte[16];
-		checkZeros(bytes);
-		ByteUtil.longToBytes(origValue, bytes, 4);
-		checkZeros(bytes, 0, 4);
-		checkZeros(bytes, 12, 16);
-		checkNonZeros(bytes, 4, 12);
-		value = ByteUtil.bytesToLong(bytes, 4);
-		Assert.assertEquals(origValue, value);
-	}
-	
-	@Test
-	public void testDoubleAndBytesConversion() {
-		double origValue =  (double)0x1234567812345678L;
-		byte[] bytes = ByteUtil.doubleToBytes(origValue);
-		checkNonZeros(bytes);
-		double value = ByteUtil.bytesToDouble(bytes);
-		Assert.assertEquals(origValue, value, 0.0001);
-		bytes = new byte[16];
-		checkZeros(bytes);
-		ByteUtil.doubleToBytes(origValue, bytes, 4);
-		checkZeros(bytes, 0, 4);
-		checkZeros(bytes, 12, 16);
-		checkNonZeros(bytes, 4, 12);
-		value = ByteUtil.bytesToDouble(bytes, 4);
-		Assert.assertEquals(origValue, value, 0.0001);
-	}
-	
-	@Test
-	public void testIntAndBytesConversion() {
-		int origValue = 0x12345678;
-		byte[] bytes = ByteUtil.intToBytes(origValue);
-		Assert.assertEquals(4, bytes.length);
-		Assert.assertEquals(0x12, bytes[0]);
-		Assert.assertEquals(0x34, bytes[1]);
-		Assert.assertEquals(0x56, bytes[2]);
-		Assert.assertEquals(0x78, bytes[3]);
-		checkNonZeros(bytes);
-		int value = ByteUtil.bytesToInt(bytes);
-		Assert.assertEquals(origValue, value);
-		bytes = new byte[12];
-		checkZeros(bytes);
-		ByteUtil.intToBytes(origValue, bytes, 4);
-		checkZeros(bytes, 0, 4);
-		checkZeros(bytes, 8, 12);
-		checkNonZeros(bytes, 4, 8);
-		value = ByteUtil.bytesToInt(bytes, 4);
-		Assert.assertEquals(origValue, value);
-	}
-
-	@Test
-	public void testShortAndBytesConversion() {
-		short origValue = 0x1234;
-		byte[] bytes = ByteUtil.shortToBytes(origValue);
-		Assert.assertEquals(2, bytes.length);
-		Assert.assertEquals(0x12, bytes[0]);
-		Assert.assertEquals(0x34, bytes[1]);
-		checkNonZeros(bytes);
-		short value = ByteUtil.bytesToShort(bytes);
-		Assert.assertEquals(origValue, value);
-	}
-
-	private void checkZeros(byte[] bytes) {
-		checkZeros(bytes, 0, bytes.length);
-	}
-	
-	private void checkZeros(byte[] bytes, int i, int j) {
-		for (int k = i; k < j; ++k) {
-			Assert.assertEquals((byte)0, bytes[k]);
-		}
-	}
-
-	private void checkNonZeros(byte[] bytes) {
-		checkNonZeros(bytes, 0, bytes.length);
-	}
-	
-	private void checkNonZeros(byte[] bytes, int i, int j) {
-		for (int k = i; k < j; ++k) {
-			Assert.assertNotSame((byte)0, bytes[k]);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayList.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayList.java b/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayList.java
deleted file mode 100644
index 3642635..0000000
--- a/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayList.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.common;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestCircularArrayList {
-
-	@Test
-	public void testAddAndRemove() {
-		Long[] array = new Long[5];
-		CircularArrayList<Long> list = new CircularArrayList<Long>(array);
-		
-		for (long i = 0 ; i < 5; ++i) {
-			list.add(i);
-			Assert.assertEquals((Long)i, array[(int) i]);
-			Assert.assertTrue(list.contains(i));
-			Assert.assertEquals(i, list.find(i));
-		}
-		Assert.assertFalse(list.contains(6L));
-		Exception e = null;
-		try {
-			list.add((long)5);
-		} catch (Exception ex) {
-			e = ex;
-		}
-		Assert.assertNotNull(e);
-		Assert.assertEquals(0, list.tail());
-		Assert.assertEquals(0, list.head());
-		Assert.assertEquals(5, list.size());
-		Assert.assertTrue(list.isFull());
-		Long v = list.remove(1);
-		Assert.assertEquals((Long)1L, v);
-		Assert.assertEquals(4, list.size());
-		Assert.assertEquals(1, list.head());
-		Assert.assertEquals(0, list.tail());
-		list.add((long)5);
-		Assert.assertEquals(5, list.size());
-		Assert.assertEquals(1, list.head());
-		Assert.assertEquals(1, list.tail());
-		Assert.assertEquals((Long)0L, list.remove(0));
-		Assert.assertEquals(2, list.head());
-		Assert.assertEquals(1, list.tail());
-		Assert.assertEquals((Long)2L, list.remove(0));
-		Assert.assertEquals(3, list.head());
-		Assert.assertEquals(1, list.tail());
-		Assert.assertEquals((Long)3L, list.remove(0));
-		Assert.assertEquals(4, list.head());
-		Assert.assertEquals(1, list.tail());
-		Assert.assertEquals((Long)4L, list.remove(0));
-		Assert.assertEquals(0, list.head());
-		Assert.assertEquals(1, list.tail());
-		Assert.assertEquals((Long)5L, list.remove(0));
-		Assert.assertEquals(1, list.head());
-		Assert.assertEquals(1, list.tail());
-		Assert.assertTrue(list.isEmpty());
-		Assert.assertFalse(list.isFull());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayListSortedSet.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayListSortedSet.java b/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayListSortedSet.java
deleted file mode 100644
index e4fbb18..0000000
--- a/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayListSortedSet.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.common;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestCircularArrayListSortedSet {
-
-	@Test
-	public void testInsertAndRemove() {
-		Long[] array = new Long[5];
-		CircularArrayListSortedSet<Long> set = new CircularArrayListSortedSet<Long>(array);
-		
-		set.insert(3L);
-		set.insert(2L);
-		set.insert(1L);
-		set.insert(5L);
-		set.insert(4L);
-		
-		for (int i = 0; i < 5; ++i) {
-			Assert.assertEquals((Long)(long)(i + 1),set.get(i));
-			Assert.assertEquals(i, set.binarySearch((Long)(long)(i + 1)));
-		}
-		Assert.assertEquals(0, set.head());
-		Assert.assertEquals(0, set.tail());
-		Assert.assertTrue(set.isFull());
-		Assert.assertEquals(-(5 + 1), set.binarySearch(6L));
-		
-		Assert.assertEquals(2, set.remove(3L));
-		Assert.assertEquals(2, set.remove(4L));
-		Assert.assertEquals(-(2 + 1), set.binarySearch(3L));
-		set.insert(3L);
-		set.insert(4L);
-		
-		for (int i = 0; i < 5; ++i) {
-			Assert.assertEquals((Long)(long)(i + 1),set.get(i));
-			Assert.assertEquals(i, set.binarySearch((Long)(long)(i + 1)));
-		}
-		Assert.assertEquals(2, set.head());
-		Assert.assertEquals(2, set.tail());
-		Assert.assertTrue(set.isFull());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestDateTimeUtil.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestDateTimeUtil.java b/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestDateTimeUtil.java
deleted file mode 100755
index 062d44a..0000000
--- a/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestDateTimeUtil.java
+++ /dev/null
@@ -1,87 +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.Calendar;
-import java.util.GregorianCalendar;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestDateTimeUtil {
-	@Test
-	public void testRound1(){
-		long tsInMS = 1397016731576L;
-		long tsInMin = DateTimeUtil.roundDown(Calendar.MINUTE, tsInMS);
-		Assert.assertEquals(1397016720000L, tsInMin);
-		
-		GregorianCalendar cal = new GregorianCalendar();
-		cal.setTimeInMillis(tsInMS);
-		cal.set(Calendar.SECOND, 0);
-		cal.set(Calendar.MILLISECOND, 0);
-		Assert.assertEquals(tsInMin, cal.getTimeInMillis());
-	}
-	
-	@Test
-	public void testRound2(){
-		long tsInMS = 1397016731576L;
-		long tsInHour = DateTimeUtil.roundDown(Calendar.HOUR, tsInMS);
-		Assert.assertEquals(1397016000000L, tsInHour);
-		
-		GregorianCalendar cal = new GregorianCalendar();
-		cal.setTimeInMillis(tsInMS);
-		cal.set(Calendar.MINUTE, 0);
-		cal.set(Calendar.SECOND, 0);
-		cal.set(Calendar.MILLISECOND, 0);
-		Assert.assertEquals(tsInHour, cal.getTimeInMillis());
-	}
-	
-	@Test
-	public void testRound3(){
-		long tsInMS = 1L;
-		long tsInDay = DateTimeUtil.roundDown(Calendar.DATE, tsInMS);
-		Assert.assertEquals(0L, tsInDay);
-//		Assert.assertEquals("1970-01-01 08:00:00", DateTimeUtil.millisecondsToHumanDateWithSeconds(tsInDay));
-	}
-	
-	@Test
-	public void testRound4(){
-		long tsInMS = 0L;
-		long tsInDay = DateTimeUtil.roundDown(Calendar.DATE, tsInMS);
-		Assert.assertEquals(0L, tsInDay);
-		String str = DateTimeUtil.millisecondsToHumanDateWithSeconds(tsInMS);
-		System.out.println(str);
-	}
-	
-	@Test
-	public void testRound5(){
-		long tsInMS = 8*3600*1000L;
-		long tsInDay = DateTimeUtil.roundDown(Calendar.DATE, tsInMS);
-		Assert.assertEquals(0L, tsInDay);
-		String str = DateTimeUtil.millisecondsToHumanDateWithSeconds(tsInDay);
-		System.out.println(str);
-	}
-	
-	@Test
-	public void testDayOfWeek() {
-		GregorianCalendar cal = new GregorianCalendar();
-		long tsInMS = 0L;
-		cal.setTimeInMillis(tsInMS);
-		//cal.setTimeInMillis(System.currentTimeMillis());
-		System.out.println(cal.get(Calendar.DAY_OF_WEEK));
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestEagleBase64Wrapper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestEagleBase64Wrapper.java b/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestEagleBase64Wrapper.java
deleted file mode 100755
index 384c274..0000000
--- a/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/TestEagleBase64Wrapper.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.common;
-
-import org.junit.Test;
-
-public class TestEagleBase64Wrapper {
-	@Test
-	public void test(){
-		byte[] b = EagleBase64Wrapper.decode("BgVz-6vkdM8AAbGAf__-trtos5aqSGPod4Q1GwA268vF50iNBgmpmAxLXKkGbxkREWcmOzT3YIx3hDUb");
-		byte[] c = EagleBase64Wrapper.decode("BgVz-6vkdM8AAbGAf__-trtos5aqSGPod4Q1G6pLeJcAATVuADbry8XnSI0GCamYDEtcqQZvGRERZyY7NPdgjHeENRs");
-		
-		System.out.println(new String(b));
-		System.out.println(new String(c));
-		
-		int hash = "jobType".hashCode();
-		byte b1 = (byte)((hash >> 24) & 0xff);
-		byte b2 = (byte)(((hash << 8) >> 24) & 0xff);
-		byte b3 = (byte)(((hash << 16) >> 24) & 0xff);
-		byte b4 = (byte)(((hash << 24) >> 24) & 0xff);
-		
-		System.out.println(b1 + "," + b2 + "," + b3 + "," + b4);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/config/TestEagleConfig.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/config/TestEagleConfig.java b/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/config/TestEagleConfig.java
deleted file mode 100644
index 892db0c..0000000
--- a/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/config/TestEagleConfig.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.common.config;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @since 9/22/15
- */
-public class TestEagleConfig {
-    private EagleConfig config;
-
-    @Before
-    public void setUp(){
-        System.setProperty("config.resource","test-service-config.conf");
-        config = EagleConfigFactory.load();
-    }
-
-    @Test
-    public void testInit(){
-        Assert.assertEquals("test",config.getEnv());
-        Assert.assertEquals("localhost",config.getServiceHost());
-        Assert.assertEquals(9090,config.getServicePort());
-        Assert.assertEquals("hbase",config.getStorageType());
-        Assert.assertEquals(false,config.isCoprocessorEnabled());
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/metric/TestAlertContext.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/metric/TestAlertContext.java b/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/metric/TestAlertContext.java
deleted file mode 100644
index 894961b..0000000
--- a/eagle-core/eagle-query/eagle-common/src/test/java/org/apache/eagle/common/metric/TestAlertContext.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.common.metric;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.HashMap;
-
-/**
- * since 1/20/16.
- */
-public class TestAlertContext {
-    @Test
-    public void test(){
-        HashMap<String, String> map = new HashMap<String, String>();
-        map.put("key1", "value1");
-        map.put("key2", "value2");
-        AlertContext context = new AlertContext();
-        context.addAll(map);
-        String json = context.toJsonString();
-        System.out.println(json);
-        Assert.assertEquals(map, AlertContext.fromJsonString(json).getProperties());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/test/resources/footer.vm
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/test/resources/footer.vm b/eagle-core/eagle-query/eagle-common/src/test/resources/footer.vm
deleted file mode 100755
index 8df4b06..0000000
--- a/eagle-core/eagle-query/eagle-common/src/test/resources/footer.vm
+++ /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.
- *
- * @version 0.3.0
- *#
-    </td>
-  </tr>
-  </tr>
-</table>
-<!-- End of wrapper table -->
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/test/resources/header.vm
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/test/resources/header.vm b/eagle-core/eagle-query/eagle-common/src/test/resources/header.vm
deleted file mode 100755
index 8bd4388..0000000
--- a/eagle-core/eagle-query/eagle-common/src/test/resources/header.vm
+++ /dev/null
@@ -1,299 +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
- *#
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
-  <title></title>
-  <style type="text/css">
-    /* 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;
-    }
-
-    /* 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. */
-    }
-
-    /* Outlook 07, 10 Padding issue fix
-    Bring inline: No.*/
-    table td {
-      border-collapse: collapse;
-    }
-
-    table{
-        width: 100%;
-    }
-
-    /* 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 whatever your want */
-        pointer-events: none;
-        cursor: default;
-      }
-
-      .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
-        text-decoration: default;
-        color: orange !important;
-        pointer-events: auto;
-        cursor: default;
-      }
-
-    }
-
-    /* More Specific Targeting */
-
-    @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
-      /* You guessed it, ipad (tablets, smaller screens, etc) */
-      /* repeating for the ipad */
-      a[href^="tel"], a[href^="sms"] {
-        text-decoration: none;
-        color: blue; /* or whatever your want */
-        pointer-events: none;
-        cursor: default;
-      }
-
-      .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
-        text-decoration: default;
-        color: orange !important;
-        pointer-events: auto;
-        cursor: default;
-      }
-    }
-
-    @media only screen and (-webkit-min-device-pixel-ratio: 2) {
-      /* Put your iPhone 4g styles in here */
-    }
-
-    /* Android targeting */
-    @media only screen and (-webkit-device-pixel-ratio: .75) {
-      /* Put CSS for low density (ldpi) Android layouts in here */
-    }
-
-    @media only screen and (-webkit-device-pixel-ratio: 1) {
-      /* Put CSS for medium density (mdpi) Android layouts in here */
-    }
-
-    @media only screen and (-webkit-device-pixel-ratio: 1.5) {
-      /* Put CSS for high density (hdpi) Android layouts in here */
-    }
-
-    /* end Android targeting */
-    .head{
-      font-family:Helvetica, Arial;
-      font-size:30px;
-      text-decoration:none;
-      text-align:left;
-      color:#333;
-      align:left;
-      padding: 25px 0 15px 0;
-      valign:middle;
-      font-weight: 500;
-      border-bottom: 1px solid #cccccc;
-    }
-
-    .head2{
-      font-family:Helvetica, Arial;
-      font-size:24px;
-      text-decoration:none;
-      text-align:left;
-      color:#333;
-      align:left;
-      padding: 20px 0 10px 0;
-      valign:middle;
-      font-weight: 500;
-    }
-
-    .text{
-      font-family:Helvetica, Arial;
-      font-size:14px;
-      text-decoration:none;
-      text-align:left;
-      color:#333;
-      align:left;
-      padding: 0.5em 0em 0.5em 0em;
-      valign:middle;
-    }
-
-    .info {
-      font-family:Helvetica, Arial;
-      font-size:16px;
-      text-decoration:none;
-      text-align:left;
-      padding-left:10px;
-      border-left: 3px solid #396A92;
-      background-color: #9AB4CB;
-      color:#091D42;
-      align:left;
-      padding: 1em 0em 1em 1em;
-      valign:middle;
-    }
-
-    .table-border{
-      border: 1px solid #ddd;
-      border-radius: 4px 4px 0 0;
-      box-shadow: none;
-    }
-
-    .table-border-th{
-      font-family:Helvetica, Arial;
-      font-size:14px;
-      text-decoration:none;
-      text-align:left;
-      border-top: 1px solid #cccccc;
-      border-right: 1px solid #cccccc;
-      padding: 8px;
-    }
-    .table-border-td{
-      font-family:Helvetica, Arial;
-      font-size:14px;
-      text-decoration:none;
-      text-align:left;
-      border-top: 1px solid #cccccc;
-      border-right: 1px solid #cccccc;
-      padding: 8px;
-      word-break: break-all;
-    }
-
-    .foot{
-      font-family:Arial;
-      font-size:14px;
-      text-decoration:none;
-      text-align:left;
-      padding: 0.5em 0em 0.5em 0.5em;
-      border-top: 1px solid #cccccc;
-      color:#777;
-    }
-
-  </style>
-
-  <!-- Targeting Windows Mobile -->
-  <!--[if IEMobile 7]>
-  <style type="text/css">
-
-  </style>
-  <![endif]-->
-
-  <!-- ***********************************************
-  ****************************************************
-  END MOBILE TARGETING
-  ****************************************************
-  ************************************************ -->
-
-  <!--[if gte mso 9]>
-  <style>
-    /* Target Outlook 2007 and 2010 */
-  </style>
-  <![endif]-->
-</head>
-<body>
-<!-- Wrapper/Container Table: Use a wrapper table to control the width and the background color consistently of your email. Use this approach instead of setting attributes on the body tag. -->
-<table cellpadding="0" cellspacing="0" border="0" id="backgroundTable">
-  <tr>
-    <td valign="top" style="padding-left: 10px">

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/test/resources/log4j.properties b/eagle-core/eagle-query/eagle-common/src/test/resources/log4j.properties
deleted file mode 100644
index 5a5709e..0000000
--- a/eagle-core/eagle-query/eagle-common/src/test/resources/log4j.properties
+++ /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.
-
-log4j.rootLogger=INFO, DRFA, stdout
-eagle.log.dir=./logs
-eagle.log.file=eagle.log
-
-# standard output
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n
-
-# Daily Rolling File Appender
-log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.DRFA.File=${eagle.log.dir}/${eagle.log.file}
-log4j.appender.DRFA.DatePattern=.yyyy-MM-dd
-# 30-day backup
-#log4j.appender.DRFA.MaxBackupIndex=30
-log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout
-
-# Pattern format: Date LogLevel LoggerName LogMessage
-log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/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
deleted file mode 100755
index 2219ebf..0000000
--- a/eagle-core/eagle-query/eagle-common/src/test/resources/templates/tec_alert.vm
+++ /dev/null
@@ -1,119 +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
- *#
-#parse("header.vm")
-<table cellpadding="0" cellspacing="0" border="0" align="left" width="800" style="">
-  <tr>
-    <td class="head" width="800">
-      <span style="color: #091D42">Eagle Service <small style="color: #999999;">$startTime ~ $endTime</small></span>
-    </td>
-  </tr>
-  <tr>
-    <td class="head2" width="800">
-      <span>
-        Statistics
-      </span>
-    </td>
-  </tr>
-  <tr>
-    <td valign="top" style="padding: 0.5em 0em 0.5em 0em;">
-      <table cellpadding="0" cellspacing="0" border="0" align="left" width="800" class="table-border">
-        <thead>
-        <tr>
-          <th class="table-border-th" style="width: 25%">type</th>
-          <th class="table-border-th" style="width: 25%">count</th>
-          <th class="table-border-th" style="width: 25%">type</th>
-          <th class="table-border-th" style="width: 25%">count</th>
-        </tr>
-        </thead>
-        <tbody>
-        #foreach($key in $statistics.keySet())
-          #if( $foreach.count % 2 == 1 )
-          <tr>
-          #end
-            <td class="table-border-td">$key</td>
-            <td class="table-border-td">$statistics.get($key)</td>
-          #if( $foreach.count % 2 == 0)
-          </tr>
-          #end
-          #if( $foreach.count % 2 == 1 && !$foreach.hasNext )
-          	<td class="table-border-td"></td>
-            <td class="table-border-td"></td>
-          </tr>
-          #end
-       	#end
-        </tbody>
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td class="head2" width="800">
-      <span>
-        Detail Info
-      </span>
-    </td>
-  </tr>
-  <tr>
-    <td class="info" width="800">
-      <span>
-          These are the alerts that we can not find its hostname.
-      </span>
-    </td>
-  </tr>
-  <tr>
-    <td valign="top" style="padding: 0.5em 0em 0.5em 0em;">
-      <table cellpadding="0" cellspacing="0" border="0" align="left" width="800" class="table-border">
-        <thead>
-          <tr>
-            <th class="table-border-th">hostname</th>
-            <th class="table-border-th">date_reception</th>
-            <th class="table-border-th">type</th>
-            <th class="table-border-th">origin</th>
-            <th class="table-border-th">msg</th>
-          </tr>
-        </thead>
-        <tbody>
-        #foreach($entry in $noHostnameItems)
-          <tr>
-            <td class="table-border-td">$entry.hostname</td>
-            <td class="table-border-td">$entry.date_reception</td>
-            <td class="table-border-td">$entry.type</td>
-            <td class="table-border-td">$entry.origin</td>
-            <td class="table-border-td">$entry.msg</td>
-          </tr>
-       	#end
-        </tbody>
-      </table>
-    </td>
-  </tr>
-    <tr>
-        <td>
-            <img src="cid:$cid.get("chart.png")"/>
-        </td>
-    </tr>
-  <tr>
-    <td class="foot" width="800">
-      <span class="outlook">
-         Apache Eagle <a href="http://<Eagle-Host>:9090/eagle-web/ui/eagle.html"
-                  target ="_blank" title="Hadoop Eagle">Apache Eagle</a>
-      </span>
-    </td>
-  </tr>
-</table>
-
-#parse("footer.vm")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/test/resources/templates/test_anomaly_alert.vm
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/test/resources/templates/test_anomaly_alert.vm b/eagle-core/eagle-query/eagle-common/src/test/resources/templates/test_anomaly_alert.vm
deleted file mode 100644
index da1f8d0..0000000
--- a/eagle-core/eagle-query/eagle-common/src/test/resources/templates/test_anomaly_alert.vm
+++ /dev/null
@@ -1,137 +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
- *#
-#parse("header.vm")
-<table cellpadding="0" cellspacing="0" border="0" align="left" width="800" style="">
-  <tr>
-    <td class="head" width="800">
-      <span style="color: #091D42">Eagle Job Anomaly Host Detection <small style="color: #999999;"><br>$startTime ~ $endTime</small></span>
-    </td>
-  </tr>
-  <tr>
-    <td class="head2" width="800">
-      <span>
-        Statistics
-      </span>
-    </td>
-  </tr>
-  <tr>
-    <td valign="top" style="padding: 0.5em 0em 0.5em 0em;">
-      <table cellpadding="0" cellspacing="0" border="0" align="left" width="800" class="table-border">
-        <thead>
-        <tr>
-          <th class="table-border-th" style="width: 25%">Cluster</th>
-          <th class="table-border-th" style="width: 25%">Datacener</th>
-          <th class="table-border-th" style="width: 25%">Count</th>
-        </tr>
-        </thead>
-        <tbody>
-          <tr>
-              <td class="table-border-td">$cluster</td>
-              <td class="table-border-td">$datacenter</td>
-              <td class="table-border-td">$count</td>
-          </tr>
-        </tbody>
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td class="head2" width="800">
-      <span>
-        Anomaly detector configurations
-      </span>
-    </td>
-  </tr>
-  <tr>
-    <td valign="top" style="padding: 0.5em 0em 0.5em 0em;">
-      <table cellpadding="0" cellspacing="0" border="0" align="left" width="800" class="table-border">
-        <thead>
-        <tr>
-          <th class="table-border-th" style="width: 25%">Parameter Name</th>
-          <th class="table-border-th" style="width: 25%">Value</th>
-          <th class="table-border-th" style="width: 25%">Description</th>
-        </tr>
-        </thead>
-        <tbody>
-        #foreach($key in $configMap.keySet())
-        <tr>
-            <td class="table-border-td">$key</td>
-            <td class="table-border-td">$configMap.get($key)</td>
-            <td class="table-border-td">$configDescMap.get($key)</td>
-        </tr>
-       	#end
-         </tbody>
-        </table>
-      </td>
-  </tr>
-  <tr>
-    <td class="head2" width="800">
-      <span>
-        Detail Information
-      </span>
-    </td>
-  </tr>
-  <tr>
-    <td class="info" width="800">
-      <span>
-          These are the anomaly hosts detected by Hadoop Eagle:
-      </span>
-    </td>
-  </tr>
-  <tr>
-    <td valign="top" style="padding: 0.5em 0em 0.5em 0em;">
-      <table cellpadding="0" cellspacing="0" border="0" align="left" width="800" class="table-border">
-        <thead>
-          <tr>
-            <th class="table-border-th">Cluster</th>
-            <th class="table-border-th">Datacenter</th>
-            <th class="table-border-th">Hostname</th>
-            <th class="table-border-th">Description</th>
-            <th class="table-border-th">Job Types</th>
-            <th class="table-border-th">Errors</th>
-          </tr>
-        </thead>
-        <tbody>
-        #foreach($key in $anomalyHostMap.keySet())
-        <tr>
-            <td class="table-border-td">$cluster</td>
-            <td class="table-border-td">$datacenter</td>
-            <td class="table-border-td"><a href="http://123.dc1.xyz.com:9090/eagle-web/ui/AnomalyDetection.html?cluster=$cluster&datacenter=$datacenter&intervalmin=1&startTime=$startTime&endTime=$endTime&top=20">$key</a></td>
-            <td class="table-border-td">$anomalyHostMap.get($key)</td>
-            <td class="table-border-td">$jobNameMap.get($key)</td>
-            <td class="table-border-td"><a href="http://hadoop-eagle.vip.dc1.xyz.com/eagle-service/rest/list?query=TaskExecutionService[@cluster=%22$cluster%22%20AND%20@datacenter=%22$datacenter%22%20AND%20@hostname=%22$key%22%20AND%20@taskStatus=%22FAILED%22]{@error,@jobID,@taskID,@normJobName}&pageSize=1000&startTime=$startTime&endTime=$endTime">$errorMap.get($key)</a></td>
-        </tr>
-       	#end
-        </tbody>
-      </table>
-    </td>
-  </tr>
-  <br>
-  <tr>
-    <td class="foot" width="800">
-      <span class="outlook">
-         Apache Eagle <a href="http://hadoop-eagle.vip.dc1.xyz.com"
-                  target ="_blank" title="Hadoop Eagle">Apache Eagle</a>
-      </span>
-    </td>
-  </tr>
-</table>
-<br>
-<br>
-
-#parse("footer.vm")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/test/resources/test-service-config.conf
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/test/resources/test-service-config.conf b/eagle-core/eagle-query/eagle-common/src/test/resources/test-service-config.conf
deleted file mode 100644
index 848391d..0000000
--- a/eagle-core/eagle-query/eagle-common/src/test/resources/test-service-config.conf
+++ /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 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 {
-	timezone = "UTC"
-
-	service {
-		env = "test"
-		host = "localhost"
-		port = 9090
-		storage-type = "hbase"
-		table-name-prefixed-with-environment = true
-		hbase-zookeeper-quorum = "localhost"
-		hbase-zookeeper-property-clientPort = 2181
-		zookeeper-znode-parent = "/hbase-unsecure"
-		coprocessor-enabled = false
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericObjectMapperProvider.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericObjectMapperProvider.java b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericObjectMapperProvider.java
index c10c28d..35dd4b7 100755
--- a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericObjectMapperProvider.java
+++ b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/GenericObjectMapperProvider.java
@@ -16,6 +16,7 @@
  */
 package org.apache.eagle.service.generic;
 
+import com.google.inject.Singleton;
 import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
 import org.codehaus.jackson.map.ObjectMapper;
 import org.codehaus.jackson.map.ser.FilterProvider;
@@ -27,6 +28,7 @@ import javax.ws.rs.ext.Provider;
 
 @Provider
 @Produces(MediaType.APPLICATION_JSON)
+@Singleton
 public class GenericObjectMapperProvider implements ContextResolver<ObjectMapper> {
     private final static ObjectMapper OBJECT_MAPPER = new ObjectMapper();
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/pom.xml b/eagle-core/eagle-query/pom.xml
index 798e138..bc6f729 100644
--- a/eagle-core/eagle-query/pom.xml
+++ b/eagle-core/eagle-query/pom.xml
@@ -31,7 +31,6 @@
 	<name>eagle-query-parent</name>
 
 	<modules>
-		<module>eagle-common</module>
 		<module>eagle-antlr</module>
 		<module>eagle-entity-base</module>
 		<module>eagle-audit-base</module>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/pom.xml b/eagle-core/pom.xml
index 0bcab2a..320ea74 100644
--- a/eagle-core/pom.xml
+++ b/eagle-core/pom.xml
@@ -41,6 +41,8 @@
         <module>eagle-query</module>
         <module>eagle-embed</module>
         <module>eagle-metric</module>
-        <module>eagle-application-management</module>
+        <module>eagle-metadata</module>
+        <module>eagle-common</module>
+        <module>eagle-app</module>
     </modules>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-examples/eagle-app-example/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-examples/eagle-app-example/pom.xml b/eagle-examples/eagle-app-example/pom.xml
new file mode 100644
index 0000000..45c887c
--- /dev/null
+++ b/eagle-examples/eagle-app-example/pom.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eagle-examples</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>eagle-app-example</artifactId>
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-app-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <version>1.10.19</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/webapp/app</directory>
+                <targetPath>assets/</targetPath>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/ExampleApplication.java
----------------------------------------------------------------------
diff --git a/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/ExampleApplication.java b/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/ExampleApplication.java
new file mode 100644
index 0000000..71037b3
--- /dev/null
+++ b/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/ExampleApplication.java
@@ -0,0 +1,30 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.example;
+
+import backtype.storm.topology.TopologyBuilder;
+import backtype.storm.tuple.Fields;
+import org.apache.eagle.app.ApplicationContext;
+import org.apache.eagle.app.AbstractApplication;
+
+public class ExampleApplication extends AbstractApplication {
+    protected void buildTopology(TopologyBuilder builder, ApplicationContext context) {
+        builder.setSpout("mockMetricSpout", new RandomEventSpout(), 4);
+        builder.setBolt("sink_1",context.getStreamSink("SAMPLE_STREAM_1")).fieldsGrouping("mockMetricSpout",new Fields("key"));
+        builder.setBolt("sink_2",context.getStreamSink("SAMPLE_STREAM_2")).fieldsGrouping("mockMetricSpout",new Fields("key"));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/ExampleApplicationProvider.java
----------------------------------------------------------------------
diff --git a/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/ExampleApplicationProvider.java b/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/ExampleApplicationProvider.java
new file mode 100644
index 0000000..bd4e9b1
--- /dev/null
+++ b/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/ExampleApplicationProvider.java
@@ -0,0 +1,63 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.example;
+
+import org.apache.eagle.alert.engine.coordinator.StreamColumn;
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.apache.eagle.app.spi.AbstractApplicationProvider;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Define application provider programmatically
+ */
+public class ExampleApplicationProvider extends AbstractApplicationProvider<ExampleApplication> {
+    @Override
+    protected void configure() {
+        setType("EXAMPLE_APPLICATION");
+        setName("Example Monitoring Application");
+        setVersion("0.5.0-incubating");
+        setAppClass(ExampleApplication.class);
+        setViewPath("/apps/example");
+        setAppConfig("ExampleApplicationConf.xml");
+        setStreams(Arrays.asList(createSampleStreamDefinition("SAMPLE_STREAM_1"), createSampleStreamDefinition("SAMPLE_STREAM_2")));
+    }
+
+    private static StreamDefinition createSampleStreamDefinition(String streamId){
+        StreamDefinition sampleStreamDefinition = new StreamDefinition();
+        sampleStreamDefinition.setStreamId(streamId);
+        sampleStreamDefinition.setTimeseries(true);
+        sampleStreamDefinition.setValidate(true);
+        sampleStreamDefinition.setDescription("Auto generated sample Schema for "+streamId);
+        List<StreamColumn> streamColumns = new ArrayList<>();
+
+        streamColumns.add(new StreamColumn.Builder().name("name").type(StreamColumn.Type.STRING).build());
+        streamColumns.add(new StreamColumn.Builder().name("host").type(StreamColumn.Type.STRING).build());
+        streamColumns.add(new StreamColumn.Builder().name("flag").type(StreamColumn.Type.BOOL).build());
+        streamColumns.add(new StreamColumn.Builder().name("timestamp").type(StreamColumn.Type.LONG).build());
+        streamColumns.add(new StreamColumn.Builder().name("value").type(StreamColumn.Type.DOUBLE).build());
+        sampleStreamDefinition.setColumns(streamColumns);
+        return sampleStreamDefinition;
+    }
+
+    @Override
+    public ExampleApplication getApplication() {
+        return new ExampleApplication();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/ExampleApplicationProvider2.java
----------------------------------------------------------------------
diff --git a/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/ExampleApplicationProvider2.java b/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/ExampleApplicationProvider2.java
new file mode 100644
index 0000000..f4b3f2f
--- /dev/null
+++ b/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/ExampleApplicationProvider2.java
@@ -0,0 +1,33 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.example;
+
+import org.apache.eagle.app.spi.AbstractApplicationProvider;
+
+/**
+ * Define application provider with metadata.xml
+ */
+public class ExampleApplicationProvider2 extends AbstractApplicationProvider<ExampleApplication> {
+    public ExampleApplicationProvider2() {
+        super("ExampleApplicationMetadata.xml");
+    }
+
+    @Override
+    public ExampleApplication getApplication() {
+        return new ExampleApplication();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/RandomEventSpout.java
----------------------------------------------------------------------
diff --git a/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/RandomEventSpout.java b/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/RandomEventSpout.java
new file mode 100644
index 0000000..ac507b6
--- /dev/null
+++ b/eagle-examples/eagle-app-example/src/main/java/org/apache/eagle/app/example/RandomEventSpout.java
@@ -0,0 +1,59 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.example;
+
+import backtype.storm.spout.SpoutOutputCollector;
+import backtype.storm.task.TopologyContext;
+import backtype.storm.topology.OutputFieldsDeclarer;
+import backtype.storm.topology.base.BaseRichSpout;
+import backtype.storm.tuple.Fields;
+import backtype.storm.tuple.Values;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+public class RandomEventSpout extends BaseRichSpout {
+        private final static Logger LOG = LoggerFactory.getLogger(RandomEventSpout.class);
+        SpoutOutputCollector _collector;
+
+        @SuppressWarnings("rawtypes")
+        @Override
+        public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
+            _collector = collector;
+        }
+
+        @Override
+        public void nextTuple() {
+
+        }
+
+        @Override
+        public void ack(Object id) {
+            //Ignored
+        }
+
+        @Override
+        public void fail(Object id) {
+            _collector.emit(new Values(id), id);
+        }
+
+        @Override
+        public void declareOutputFields(OutputFieldsDeclarer declarer) {
+            declarer.declare(new Fields("key","event"));
+        }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-examples/eagle-app-example/src/main/resources/ExampleApplicationConf.xml
----------------------------------------------------------------------
diff --git a/eagle-examples/eagle-app-example/src/main/resources/ExampleApplicationConf.xml b/eagle-examples/eagle-app-example/src/main/resources/ExampleApplicationConf.xml
new file mode 100644
index 0000000..4a31c5e
--- /dev/null
+++ b/eagle-examples/eagle-app-example/src/main/resources/ExampleApplicationConf.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<configuration>
+    <property>
+        <name>kafka.topic</name>
+        <displayName>Kafka Topic</displayName>
+        <value>hdfs_audit</value>
+        <description>Kafka Topic</description>
+    </property>
+    <property>
+        <name>zookeeper.server</name>
+        <displayName>Zookeeper Server</displayName>
+        <value>localhost:2181</value>
+        <description>Zookeeper Server address</description>
+    </property>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-examples/eagle-app-example/src/main/resources/ExampleApplicationMetadata.xml
----------------------------------------------------------------------
diff --git a/eagle-examples/eagle-app-example/src/main/resources/ExampleApplicationMetadata.xml b/eagle-examples/eagle-app-example/src/main/resources/ExampleApplicationMetadata.xml
new file mode 100644
index 0000000..b61ed54
--- /dev/null
+++ b/eagle-examples/eagle-app-example/src/main/resources/ExampleApplicationMetadata.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<application>
+    <type>EXAMPLE_APPLICATION_2</type>
+    <name>Example Monitoring Application</name>
+    <version>0.5.0-incubating</version>
+    <appClass>org.apache.eagle.app.example.ExampleApplication</appClass>
+    <viewPath>/apps/example</viewPath>
+    <configuration>
+        <property>
+            <name>message</name>
+            <displayName>Message</displayName>
+            <value>Hello, example application!</value>
+            <description>Just an sample configuration property</description>
+        </property>
+    </configuration>
+    <streams>
+        <stream>
+            <streamId>SAMPLE_STREAM_1</streamId>
+            <description>Sample output stream #1</description>
+            <validate>true</validate>
+            <timeseries>true</timeseries>
+            <columns>
+                <column>
+                    <name>metric</name>
+                    <type>string</type>
+                </column>
+                <column>
+                    <name>value</name>
+                    <type>double</type>
+                    <defaultValue>0.0</defaultValue>
+                </column>
+            </columns>
+        </stream>
+        <stream>
+            <streamId>SAMPLE_STREAM_2</streamId>
+            <description>Sample output stream #2</description>
+            <validate>true</validate>
+            <timeseries>true</timeseries>
+            <columns>
+                <column>
+                    <name>metric</name>
+                    <type>string</type>
+                </column>
+                <column>
+                    <name>value</name>
+                    <type>double</type>
+                    <defaultValue>0.0</defaultValue>
+                </column>
+            </columns>
+        </stream>
+    </streams>
+    <docs>
+        <install>
+# Step 1: Create source kafka topic named "${site}_example_source_topic"
+
+./bin/kafka-topics.sh --create --topic example_source_topic --replication-factor 1 --replication 1
+
+# Step 2: Set up data collector to flow data into kafka topic in
+
+./bin/logstash -f log_collector.conf
+
+## `log_collector.conf` sample as following:
+
+input {
+
+}
+filter {
+
+}
+output{
+
+}
+
+# Step 3: start application
+
+# Step 4: monitor with featured portal or alert with policies
+        </install>
+        <uninstall>
+# Step 1: stop and uninstall application
+# Step 2: delete kafka topic named "${site}_example_source_topic"
+# Step 3: stop logstash
+        </uninstall>
+    </docs>
+</application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-examples/eagle-app-example/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider
----------------------------------------------------------------------
diff --git a/eagle-examples/eagle-app-example/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider b/eagle-examples/eagle-app-example/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider
new file mode 100644
index 0000000..808e4ab
--- /dev/null
+++ b/eagle-examples/eagle-app-example/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider
@@ -0,0 +1,17 @@
+# 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.
+
+org.apache.eagle.app.example.ExampleApplicationProvider
+org.apache.eagle.app.example.ExampleApplicationProvider2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-examples/eagle-app-example/src/main/webapp/app/apps/example/index.html
----------------------------------------------------------------------
diff --git a/eagle-examples/eagle-app-example/src/main/webapp/app/apps/example/index.html b/eagle-examples/eagle-app-example/src/main/webapp/app/apps/example/index.html
new file mode 100644
index 0000000..1164793
--- /dev/null
+++ b/eagle-examples/eagle-app-example/src/main/webapp/app/apps/example/index.html
@@ -0,0 +1,6 @@
+<htm>
+    <body>
+        <h1>Example Application!</h1>
+        <i><b>url</b>: /apps/example</i>
+    </body>
+</htm>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-examples/eagle-app-example/src/main/webapp/package.json
----------------------------------------------------------------------
diff --git a/eagle-examples/eagle-app-example/src/main/webapp/package.json b/eagle-examples/eagle-app-example/src/main/webapp/package.json
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-examples/eagle-app-example/src/test/java/org/apache/eagle/app/example/ExampleApplicationTest.java
----------------------------------------------------------------------
diff --git a/eagle-examples/eagle-app-example/src/test/java/org/apache/eagle/app/example/ExampleApplicationTest.java b/eagle-examples/eagle-app-example/src/test/java/org/apache/eagle/app/example/ExampleApplicationTest.java
new file mode 100644
index 0000000..3002025
--- /dev/null
+++ b/eagle-examples/eagle-app-example/src/test/java/org/apache/eagle/app/example/ExampleApplicationTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.example;
+
+import com.google.inject.Inject;
+import org.apache.eagle.app.resource.ApplicationResource;
+import org.apache.eagle.app.service.AppOperations;
+import org.apache.eagle.app.test.AppSimulator;
+import org.apache.eagle.app.test.AppUnitTestRunner;
+import org.apache.eagle.metadata.model.ApplicationDesc;
+import org.apache.eagle.metadata.model.ApplicationEntity;
+import org.apache.eagle.metadata.model.SiteEntity;
+import org.apache.eagle.metadata.resource.SiteResource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Collection;
+
+@RunWith(AppUnitTestRunner.class)
+public class ExampleApplicationTest {
+    @Inject private SiteResource siteResource;
+    @Inject private ApplicationResource applicationResource;
+    @Inject private AppSimulator simulator;
+
+    @Test
+    public void testApplicationProviderLoading(){
+        Collection<ApplicationDesc> applicationDescs = applicationResource.getApplicationDescs();
+        Assert.assertNotNull(applicationDescs);
+        Assert.assertEquals(2,applicationDescs.size());
+    }
+
+    /**
+     * register site
+     * install app
+     * start app
+     * stop app
+     * uninstall app
+     *
+     * @throws InterruptedException
+     */
+    @Test
+    public void testApplicationLifecycle() throws InterruptedException {
+        // Create local site
+        SiteEntity siteEntity = new SiteEntity();
+        siteEntity.setSiteId("test_site");
+        siteEntity.setSiteName("Test Site");
+        siteEntity.setDescription("Test Site for ExampleApplicationTest");
+        siteResource.createSite(siteEntity);
+        Assert.assertNotNull(siteEntity.getUuid());
+
+        // Install application
+        ApplicationEntity applicationEntity = applicationResource.installApplication(new AppOperations.InstallOperation("test_site","EXAMPLE_APPLICATION", ApplicationEntity.Mode.LOCAL));
+        // Start application
+        applicationResource.startApplication(new AppOperations.StartOperation(applicationEntity.getUuid()));
+        // Stop application
+        applicationResource.stopApplication(new AppOperations.StopOperation(applicationEntity.getUuid()));
+        // Uninstall application
+        applicationResource.uninstallApplication(new AppOperations.UninstallOperation(applicationEntity.getUuid()));
+        try {
+            applicationResource.getApplicationEntityByUUID(applicationEntity.getUuid());
+            Assert.fail("Application instance (UUID: "+applicationEntity.getUuid()+") should have been uninstalled");
+        } catch (Exception ex){
+            // Expected exception
+        }
+    }
+
+    @Test
+    public void testApplicationQuickRunWithAppType(){
+        simulator.submit("EXAMPLE_APPLICATION");
+    }
+
+    @Test
+    public void testApplicationQuickRunWithAppProvider(){
+        simulator.submit(ExampleApplicationProvider.class);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-examples/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-examples/pom.xml b/eagle-examples/pom.xml
index 9b0f38f..108c649 100644
--- a/eagle-examples/pom.xml
+++ b/eagle-examples/pom.xml
@@ -27,5 +27,6 @@
     <packaging>pom</packaging>
     <modules>
         <module>eagle-topology-example</module>
+        <module>eagle-app-example</module>
     </modules>
 </project>



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

Posted by ha...@apache.org.
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 0000000..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<String> 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<String, String> env = new Hashtable<String, String>();
+//		if (ldapCerts != null) {
+        env.put(Context.SECURITY_PROTOCOL, "ssl");
+//		}
+        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+        env.put(Context.PROVIDER_URL, host);
+        env.put(Context.SECURITY_AUTHENTICATION, "simple");
+        env.put(Context.SECURITY_PRINCIPAL, securityPrincipal);
+        env.put(Context.SECURITY_CREDENTIALS, securityCredentials);
+        env.put("java.naming.ldap.attributes.binary", "objectSID");
+        env.put("java.naming.ldap.factory.socket","hadoop.eagle.common.service.TrustAllSSLSocketFactory");
+
+        DirContext ctx = null;
+        try {
+            ctx = new InitialDirContext(env);
+        } catch (Exception e) {
+            ctx = null;
+            LOG.error("LDAP authentication failed with exception: " + e.getMessage(), e);
+        }
+        return ctx;
+    }
+
+    public final static String CN= "cn";
+    public final static String DISPLAY_NAME =  "displayName";
+    public final static String DESCRIPTION= "description";
+    public final static String SAMACCOUNT_NAME= "sAMAccountName";
+    public final static String TELEPHONE_NUMBER= "telephonenumber";
+    public final static String GIVEN_NAME= "givenName";
+    public final static String UID_NUMBER =  "uidNumber";
+    public final static String L = "l";
+    public final static String ST = "st";
+    public final static String CO = "co";
+    public final static String MEMBER_OF = "memberof";
+    public final static String SN =  "sn";
+    public final static String MAIL = "mail";
+    public final static String DISTINGUISHED_NAME =  "distinguishedName";
+
+    protected SearchControls getSearchControl() {
+        SearchControls sc = new SearchControls();
+
+        String[] attributeFilter = new String[15];
+        attributeFilter[0] = CN;
+        attributeFilter[1] =  DISPLAY_NAME ;
+        attributeFilter[2] = DESCRIPTION;
+        attributeFilter[3] =  SAMACCOUNT_NAME;
+        attributeFilter[4] =  TELEPHONE_NUMBER;
+        attributeFilter[5] = GIVEN_NAME;
+        attributeFilter[6] = UID_NUMBER;
+        attributeFilter[7] = L;
+        attributeFilter[8] = ST;
+        attributeFilter[9] =CO;
+        attributeFilter[10] = MEMBER_OF;
+        attributeFilter[11] = SN;
+        attributeFilter[12] = MAIL;
+        attributeFilter[13] = DISTINGUISHED_NAME;
+
+        sc.setReturningAttributes(attributeFilter);
+        sc.setSearchScope(SearchControls.SUBTREE_SCOPE);
+
+        return sc;
+    }
+
+    public Map<String, String> getUserInfo(String userName) {
+        Map<String, String> infos = null;
+        for (int i = 0; i < ldapSrvs.size(); i++) {
+            if(LOG.isDebugEnabled()) LOG.debug("Using server: "+ldapSrvs.get(i));
+            infos = getUserInfo(i, userName);
+            if (infos.size() > 0)
+                break;
+        }
+        return infos;
+    }
+
+    public Map<String, String> getUserInfo(int id, String userName) {
+        if(LOG.isDebugEnabled()) LOG.debug("Ldap get user information for id:"+id+", username:"+userName);
+        DirContext ctx = getDirContext(id);
+        Map<String, String> infos = new HashMap<String, String>();
+
+        if (ctx != null) {
+            try {
+                SearchControls sc = getSearchControl();
+                String filter = "(&(objectClass=user)(sAMAccountName=" + userName + "))";
+                NamingEnumeration<?> results = ctx.search("OU=Accounts_User,DC=corp,DC=company1,DC=com", filter, sc);
+
+                while (results.hasMore()) {
+                    SearchResult sr = (SearchResult) results.next();
+                    Attributes attrs = sr.getAttributes();
+
+                    for (NamingEnumeration<?> ae = attrs.getAll(); ae.hasMoreElements();) {
+                        Attribute attr = (Attribute) ae.next();
+                        String attrId = attr.getID();
+                        for (NamingEnumeration<?> vals = attr.getAll(); vals.hasMore();) {
+                            String thing = vals.next().toString();
+                            infos.put(attrId, thing);
+                        }
+                    }
+                }
+            } catch (NamingException e) {
+                LOG.error("LDAP authentication failed with exception: "+e.getMessage(),e);
+            }
+        }
+
+        if(LOG.isDebugEnabled()) LOG.debug(infos.toString());
+        return infos;
+    }
+
+    public boolean authenticate(String userName, String password) {
+        for (int i = 0; i < ldapSrvs.size(); i++) {
+            if (authenticate(i, userName, password))
+                return true;
+        }
+        return false;
+    }
+
+    public boolean authenticate(int id, String userName, String password) {
+        boolean result = false;
+
+        DirContext ctx = getDirContext(id);
+        if (ctx != null) {
+            try {
+                SearchControls sc = getSearchControl();
+                String filter = "(&(objectClass=user)(sAMAccountName=" + userName + "))";
+                NamingEnumeration<?> results = ctx.search("OU=Accounts_User,DC=corp,DC=company1,DC=com", filter, sc);
+
+                String userDN = null;
+                if (results.hasMore()) {
+                    while (results.hasMore()) {
+                        SearchResult sr = (SearchResult) results.next();
+                        Attributes attrs = sr.getAttributes();
+
+                        userDN = attrs.get("distinguishedName").get().toString();
+                    }
+                }
+                ctx.close();
+
+                if (userDN != null) {
+                    Hashtable<String, String> uenv = new Hashtable<String, String>();
+//					if (ldapCerts != null) {
+                    uenv.put(Context.SECURITY_PROTOCOL, "ssl");
+//					}
+                    uenv.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+                    uenv.put(Context.PROVIDER_URL, ldapSrvs.get(id));
+                    uenv.put(Context.SECURITY_AUTHENTICATION, "simple");
+                    uenv.put(Context.SECURITY_PRINCIPAL, userDN);
+                    uenv.put(Context.SECURITY_CREDENTIALS, password);
+                    uenv.put("java.naming.ldap.factory.socket","hadoop.eagle.common.service.TrustAllSSLSocketFactory");
+                    DirContext uctx = new InitialDirContext(uenv);
+                    uctx.close();
+
+                    result = true;
+                }
+            } catch (NamingException e) {
+                LOG.error("LDAP authentication failed with exception: " + e.getMessage(), e);
+            }
+        }
+
+        return result;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/POSTResultEntityBase.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/POSTResultEntityBase.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/POSTResultEntityBase.java
new file mode 100644
index 0000000..e0daeb7
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/POSTResultEntityBase.java
@@ -0,0 +1,42 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(propOrder = {"success", "exception"})
+public class POSTResultEntityBase {
+	private boolean success;
+	private String exception;
+	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/e21b073f/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/TrustAllSSLSocketFactory.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/TrustAllSSLSocketFactory.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/TrustAllSSLSocketFactory.java
new file mode 100644
index 0000000..9facc82
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/service/TrustAllSSLSocketFactory.java
@@ -0,0 +1,94 @@
+/*
+ * 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 javax.net.SocketFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.security.cert.X509Certificate;
+
+public class TrustAllSSLSocketFactory extends SSLSocketFactory
+{
+	private SSLSocketFactory socketFactory;
+	public TrustAllSSLSocketFactory()
+	{
+		try {
+			SSLContext ctx = SSLContext.getInstance("SSL");
+//			ctx.init(null, new TrustManager[]{new TrustAnyTrustManager() {}}, new SecureRandom());
+			ctx.init(null, new TrustManager[]{new TrustAnyTrustManager() {}}, null);
+			socketFactory = ctx.getSocketFactory();
+		} catch ( Exception ex ){ ex.printStackTrace(System.err);  /* handle exception */ }
+	}
+	public static SocketFactory getDefault(){
+		return new TrustAllSSLSocketFactory();
+	}
+	@Override
+	public String[] getDefaultCipherSuites()
+	{
+		return socketFactory.getDefaultCipherSuites();
+	}
+	@Override
+	public String[] getSupportedCipherSuites()
+	{
+		return socketFactory.getSupportedCipherSuites();
+	}
+	@Override
+	public Socket createSocket(Socket socket, String string, int i, boolean bln) throws IOException
+	{
+		return socketFactory.createSocket(socket, string, i, bln);
+	}
+	@Override
+	public Socket createSocket(String string, int i) throws IOException, UnknownHostException
+	{
+		return socketFactory.createSocket(string, i);
+	}
+	@Override
+	public Socket createSocket(String string, int i, InetAddress ia, int i1) throws IOException, UnknownHostException
+	{
+		return socketFactory.createSocket(string, i, ia, i1);
+	}
+	@Override
+	public Socket createSocket(InetAddress ia, int i) throws IOException
+	{
+		return socketFactory.createSocket(ia, i);
+	}
+	@Override
+	public Socket createSocket(InetAddress ia, int i, InetAddress ia1, int i1) throws IOException
+	{
+		return socketFactory.createSocket(ia, i, ia1, i1);
+	}
+
+	private static class TrustAnyTrustManager implements X509TrustManager {
+		@Override
+		public void checkClientTrusted( final X509Certificate[] chain, final String authType ) {
+		}
+		@Override
+		public void checkServerTrusted( final X509Certificate[] chain, final String authType ) {
+		}
+		@Override
+		public X509Certificate[] getAcceptedIssuers() {
+			return null;
+		}
+	}
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/resources/footer.vm
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/resources/footer.vm b/eagle-core/eagle-common/src/main/resources/footer.vm
new file mode 100755
index 0000000..89cf245
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/resources/footer.vm
@@ -0,0 +1,25 @@
+#*
+ * 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
+ *#
+	</td>
+  </tr>
+  </tr>
+</table>
+<!-- End of wrapper table -->
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/resources/header.vm
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/resources/header.vm b/eagle-core/eagle-common/src/main/resources/header.vm
new file mode 100755
index 0000000..6731aee
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/resources/header.vm
@@ -0,0 +1,303 @@
+#*
+ * 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
+ *#
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+  <title></title>
+  <style type="text/css">
+    /* 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 whatever your want */
+        pointer-events: none;
+        cursor: default;
+      }
+
+      .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
+        text-decoration: default;
+        color: orange !important;
+        pointer-events: auto;
+        cursor: default;
+      }
+
+    }
+
+    /* More Specific Targeting */
+
+    @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
+      /* You guessed it, ipad (tablets, smaller screens, etc) */
+      /* repeating for the ipad */
+      a[href^="tel"], a[href^="sms"] {
+        text-decoration: none;
+        color: blue; /* or whatever your want */
+        pointer-events: none;
+        cursor: default;
+      }
+
+      .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
+        text-decoration: default;
+        color: orange !important;
+        pointer-events: auto;
+        cursor: default;
+      }
+    }
+
+    @media only screen and (-webkit-min-device-pixel-ratio: 2) {
+      /* Put your iPhone 4g styles in here */
+    }
+
+    /* Android targeting */
+    @media only screen and (-webkit-device-pixel-ratio: .75) {
+      /* Put CSS for low density (ldpi) Android layouts in here */
+    }
+
+    @media only screen and (-webkit-device-pixel-ratio: 1) {
+      /* Put CSS for medium density (mdpi) Android layouts in here */
+    }
+
+    @media only screen and (-webkit-device-pixel-ratio: 1.5) {
+      /* Put CSS for high density (hdpi) Android layouts in here */
+    }
+
+    /* end Android targeting */
+    .head{
+      font-family:Helvetica, Arial;
+      font-size:30px;
+      text-decoration:none;
+      text-align:left;
+      color:#333;
+      align:left;
+      padding: 25px 0 15px 0;
+      valign:middle;
+      font-weight: 500;
+      border-bottom: 1px solid #cccccc;
+    }
+
+    .head2{
+      font-family:Helvetica, Arial;
+      font-size:24px;
+      text-decoration:none;
+      text-align:left;
+      color:#333;
+      align:left;
+      padding: 20px 0 10px 0;
+      valign:middle;
+      font-weight: 500;
+    }
+
+    .text{
+      font-family:Helvetica, Arial;
+      font-size:14px;
+      text-decoration:none;
+      text-align:left;
+      color:#333;
+      align:left;
+      padding: 0.5em 0em 0.5em 0em;
+      valign:middle;
+    }
+
+    .info {
+      font-family:Helvetica, Arial;
+      font-size:16px;
+      text-decoration:none;
+      text-align:left;
+      padding-left:10px;
+      border-left: 3px solid #396A92;
+      background-color: #9AB4CB;
+      color:#091D42;
+      align:left;
+      padding: 1em 0em 1em 1em;
+      valign:middle;
+    }
+
+    .table-border{
+      border: 1px solid #ddd;
+      border-radius: 4px 4px 0 0;
+      box-shadow: none;
+    }
+
+    .table-border-th{
+      font-family:Helvetica, Arial;
+      font-size:14px;
+      text-decoration:none;
+      text-align:left;
+      border-top: 1px solid #cccccc;
+      border-right: 1px solid #cccccc;
+      padding: 8px;
+    }
+    .table-border-td{
+      font-family:Helvetica, Arial;
+      font-size:14px;
+      text-decoration:none;
+      text-align:left;
+      border-top: 1px solid #cccccc;
+      border-right: 1px solid #cccccc;
+      padding: 8px;
+      word-break: break-all;
+    }
+
+    .foot{
+      font-family:Arial;
+      font-size:14px;
+      text-decoration:none;
+      text-align:left;
+      padding: 0.5em 0em 0.5em 0.5em;
+      border-top: 1px solid #cccccc;
+      color:#777;
+    }
+
+  /* extend by hchen9 */
+
+  </style>
+
+  <!-- Targeting Windows Mobile -->
+  <!--[if IEMobile 7]>
+  <style type="text/css">
+
+  </style>
+  <![endif]-->
+
+  <!-- ***********************************************
+  ****************************************************
+  END MOBILE TARGETING
+  ****************************************************
+  ************************************************ -->
+
+  <!--[if gte mso 9]>
+  <style>
+    /* Target Outlook 2007 and 2010 */
+  </style>
+  <![endif]-->
+</head>
+<body>
+<!-- Wrapper/Container Table: Use a wrapper table to control the width and the background color consistently of your email. Use this approach instead of setting attributes on the body tag. -->
+<table cellpadding="0" cellspacing="0" border="0" id="backgroundTable" width="100%">
+  <tr>
+    <td valign="top" style="padding-left: 10px">

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/main/resources/templates/tec_alert.vm
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/resources/templates/tec_alert.vm b/eagle-core/eagle-common/src/main/resources/templates/tec_alert.vm
new file mode 100755
index 0000000..fa3eee5
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/resources/templates/tec_alert.vm
@@ -0,0 +1,113 @@
+#*
+ * 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
+ *#
+#parse("header.vm")
+<table cellpadding="0" cellspacing="0" border="0" align="left" width="800" style="">
+  <tr>
+    <td class="head" width="800">
+      <span style="color: #091D42">Eagle Service <small style="color: #999999;">$startTime ~ $endTime</small></span>
+    </td>
+  </tr>
+  <tr>
+    <td class="head2" width="800">
+      <span>
+        Statistics
+      </span>
+    </td>
+  </tr>
+  <tr>
+    <td valign="top" style="padding: 0.5em 0em 0.5em 0em;">
+      <table cellpadding="0" cellspacing="0" border="0" align="left" width="800" class="table-border">
+        <thead>
+        <tr>
+          <th class="table-border-th" style="width: 25%">type</th>
+          <th class="table-border-th" style="width: 25%">count</th>
+          <th class="table-border-th" style="width: 25%">type</th>
+          <th class="table-border-th" style="width: 25%">count</th>
+        </tr>
+        </thead>
+        <tbody>
+        #foreach($key in $statistics.keySet())
+          #if( $foreach.count % 2 == 1 )
+          <tr>
+          #end
+            <td class="table-border-td">$key</td>
+            <td class="table-border-td">$statistics.get($key)</td>
+          #if( $foreach.count % 2 == 0)
+          </tr>
+          #end
+          #if( $foreach.count % 2 == 1 && !$foreach.hasNext )
+          	<td class="table-border-td"></td>
+            <td class="table-border-td"></td>
+          </tr>
+          #end
+       	#end
+        </tbody>
+      </table>
+    </td>
+  </tr>
+  <tr>
+    <td class="head2" width="800">
+      <span>
+        Detail Info
+      </span>
+    </td>
+  </tr>
+  <tr>
+    <td class="info" width="800">
+      <span>
+          These are the alerts that we can not find its hostname.
+      </span>
+    </td>
+  </tr>
+  <tr>
+    <td valign="top" style="padding: 0.5em 0em 0.5em 0em;">
+      <table cellpadding="0" cellspacing="0" border="0" align="left" width="800" class="table-border">
+        <thead>
+          <tr>
+            <th class="table-border-th">hostname</th>
+            <th class="table-border-th">date_reception</th>
+            <th class="table-border-th">type</th>
+            <th class="table-border-th">origin</th>
+            <th class="table-border-th">msg</th>
+          </tr>
+        </thead>
+        <tbody>
+        #foreach($entry in $noHostnameItems)
+          <tr>
+            <td class="table-border-td">$entry.hostname</td>
+            <td class="table-border-td">$entry.date_reception</td>
+            <td class="table-border-td">$entry.type</td>
+            <td class="table-border-td">$entry.origin</td>
+            <td class="table-border-td">$entry.msg</td>
+          </tr>
+       	#end
+        </tbody>
+      </table>
+    </td>
+  </tr>
+  <tr>
+    <td class="foot" width="800">
+      <span class="outlook">
+         Apache Eagle <a href="http://<Eagle-Host>:9090/eagle-web/ui/eagle.html"
+                  target ="_blank" title="Hadoop Eagle">Apache Eagle</a>
+      </span>
+    </td>
+  </tr>
+</table>
+#parse("footer.vm")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestByteUtil.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestByteUtil.java b/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestByteUtil.java
new file mode 100644
index 0000000..a08c3d1
--- /dev/null
+++ b/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestByteUtil.java
@@ -0,0 +1,111 @@
+/*
+ * 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 org.junit.Assert;
+import org.junit.Test;
+
+public class TestByteUtil {
+	
+	@Test
+	public void testLongAndBytesConversion() {
+		long origValue = 0x1234567812345678L;
+		byte[] bytes = ByteUtil.longToBytes(origValue);
+		checkNonZeros(bytes);
+		long value = ByteUtil.bytesToLong(bytes);
+		Assert.assertEquals(origValue, value);
+		bytes = new byte[16];
+		checkZeros(bytes);
+		ByteUtil.longToBytes(origValue, bytes, 4);
+		checkZeros(bytes, 0, 4);
+		checkZeros(bytes, 12, 16);
+		checkNonZeros(bytes, 4, 12);
+		value = ByteUtil.bytesToLong(bytes, 4);
+		Assert.assertEquals(origValue, value);
+	}
+	
+	@Test
+	public void testDoubleAndBytesConversion() {
+		double origValue =  (double)0x1234567812345678L;
+		byte[] bytes = ByteUtil.doubleToBytes(origValue);
+		checkNonZeros(bytes);
+		double value = ByteUtil.bytesToDouble(bytes);
+		Assert.assertEquals(origValue, value, 0.0001);
+		bytes = new byte[16];
+		checkZeros(bytes);
+		ByteUtil.doubleToBytes(origValue, bytes, 4);
+		checkZeros(bytes, 0, 4);
+		checkZeros(bytes, 12, 16);
+		checkNonZeros(bytes, 4, 12);
+		value = ByteUtil.bytesToDouble(bytes, 4);
+		Assert.assertEquals(origValue, value, 0.0001);
+	}
+	
+	@Test
+	public void testIntAndBytesConversion() {
+		int origValue = 0x12345678;
+		byte[] bytes = ByteUtil.intToBytes(origValue);
+		Assert.assertEquals(4, bytes.length);
+		Assert.assertEquals(0x12, bytes[0]);
+		Assert.assertEquals(0x34, bytes[1]);
+		Assert.assertEquals(0x56, bytes[2]);
+		Assert.assertEquals(0x78, bytes[3]);
+		checkNonZeros(bytes);
+		int value = ByteUtil.bytesToInt(bytes);
+		Assert.assertEquals(origValue, value);
+		bytes = new byte[12];
+		checkZeros(bytes);
+		ByteUtil.intToBytes(origValue, bytes, 4);
+		checkZeros(bytes, 0, 4);
+		checkZeros(bytes, 8, 12);
+		checkNonZeros(bytes, 4, 8);
+		value = ByteUtil.bytesToInt(bytes, 4);
+		Assert.assertEquals(origValue, value);
+	}
+
+	@Test
+	public void testShortAndBytesConversion() {
+		short origValue = 0x1234;
+		byte[] bytes = ByteUtil.shortToBytes(origValue);
+		Assert.assertEquals(2, bytes.length);
+		Assert.assertEquals(0x12, bytes[0]);
+		Assert.assertEquals(0x34, bytes[1]);
+		checkNonZeros(bytes);
+		short value = ByteUtil.bytesToShort(bytes);
+		Assert.assertEquals(origValue, value);
+	}
+
+	private void checkZeros(byte[] bytes) {
+		checkZeros(bytes, 0, bytes.length);
+	}
+	
+	private void checkZeros(byte[] bytes, int i, int j) {
+		for (int k = i; k < j; ++k) {
+			Assert.assertEquals((byte)0, bytes[k]);
+		}
+	}
+
+	private void checkNonZeros(byte[] bytes) {
+		checkNonZeros(bytes, 0, bytes.length);
+	}
+	
+	private void checkNonZeros(byte[] bytes, int i, int j) {
+		for (int k = i; k < j; ++k) {
+			Assert.assertNotSame((byte)0, bytes[k]);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayList.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayList.java b/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayList.java
new file mode 100644
index 0000000..3642635
--- /dev/null
+++ b/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayList.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.common;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestCircularArrayList {
+
+	@Test
+	public void testAddAndRemove() {
+		Long[] array = new Long[5];
+		CircularArrayList<Long> list = new CircularArrayList<Long>(array);
+		
+		for (long i = 0 ; i < 5; ++i) {
+			list.add(i);
+			Assert.assertEquals((Long)i, array[(int) i]);
+			Assert.assertTrue(list.contains(i));
+			Assert.assertEquals(i, list.find(i));
+		}
+		Assert.assertFalse(list.contains(6L));
+		Exception e = null;
+		try {
+			list.add((long)5);
+		} catch (Exception ex) {
+			e = ex;
+		}
+		Assert.assertNotNull(e);
+		Assert.assertEquals(0, list.tail());
+		Assert.assertEquals(0, list.head());
+		Assert.assertEquals(5, list.size());
+		Assert.assertTrue(list.isFull());
+		Long v = list.remove(1);
+		Assert.assertEquals((Long)1L, v);
+		Assert.assertEquals(4, list.size());
+		Assert.assertEquals(1, list.head());
+		Assert.assertEquals(0, list.tail());
+		list.add((long)5);
+		Assert.assertEquals(5, list.size());
+		Assert.assertEquals(1, list.head());
+		Assert.assertEquals(1, list.tail());
+		Assert.assertEquals((Long)0L, list.remove(0));
+		Assert.assertEquals(2, list.head());
+		Assert.assertEquals(1, list.tail());
+		Assert.assertEquals((Long)2L, list.remove(0));
+		Assert.assertEquals(3, list.head());
+		Assert.assertEquals(1, list.tail());
+		Assert.assertEquals((Long)3L, list.remove(0));
+		Assert.assertEquals(4, list.head());
+		Assert.assertEquals(1, list.tail());
+		Assert.assertEquals((Long)4L, list.remove(0));
+		Assert.assertEquals(0, list.head());
+		Assert.assertEquals(1, list.tail());
+		Assert.assertEquals((Long)5L, list.remove(0));
+		Assert.assertEquals(1, list.head());
+		Assert.assertEquals(1, list.tail());
+		Assert.assertTrue(list.isEmpty());
+		Assert.assertFalse(list.isFull());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayListSortedSet.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayListSortedSet.java b/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayListSortedSet.java
new file mode 100644
index 0000000..e4fbb18
--- /dev/null
+++ b/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestCircularArrayListSortedSet.java
@@ -0,0 +1,58 @@
+/*
+ * 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 org.junit.Assert;
+import org.junit.Test;
+
+public class TestCircularArrayListSortedSet {
+
+	@Test
+	public void testInsertAndRemove() {
+		Long[] array = new Long[5];
+		CircularArrayListSortedSet<Long> set = new CircularArrayListSortedSet<Long>(array);
+		
+		set.insert(3L);
+		set.insert(2L);
+		set.insert(1L);
+		set.insert(5L);
+		set.insert(4L);
+		
+		for (int i = 0; i < 5; ++i) {
+			Assert.assertEquals((Long)(long)(i + 1),set.get(i));
+			Assert.assertEquals(i, set.binarySearch((Long)(long)(i + 1)));
+		}
+		Assert.assertEquals(0, set.head());
+		Assert.assertEquals(0, set.tail());
+		Assert.assertTrue(set.isFull());
+		Assert.assertEquals(-(5 + 1), set.binarySearch(6L));
+		
+		Assert.assertEquals(2, set.remove(3L));
+		Assert.assertEquals(2, set.remove(4L));
+		Assert.assertEquals(-(2 + 1), set.binarySearch(3L));
+		set.insert(3L);
+		set.insert(4L);
+		
+		for (int i = 0; i < 5; ++i) {
+			Assert.assertEquals((Long)(long)(i + 1),set.get(i));
+			Assert.assertEquals(i, set.binarySearch((Long)(long)(i + 1)));
+		}
+		Assert.assertEquals(2, set.head());
+		Assert.assertEquals(2, set.tail());
+		Assert.assertTrue(set.isFull());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestDateTimeUtil.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestDateTimeUtil.java b/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestDateTimeUtil.java
new file mode 100755
index 0000000..062d44a
--- /dev/null
+++ b/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestDateTimeUtil.java
@@ -0,0 +1,87 @@
+/*
+ * 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.Calendar;
+import java.util.GregorianCalendar;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestDateTimeUtil {
+	@Test
+	public void testRound1(){
+		long tsInMS = 1397016731576L;
+		long tsInMin = DateTimeUtil.roundDown(Calendar.MINUTE, tsInMS);
+		Assert.assertEquals(1397016720000L, tsInMin);
+		
+		GregorianCalendar cal = new GregorianCalendar();
+		cal.setTimeInMillis(tsInMS);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+		Assert.assertEquals(tsInMin, cal.getTimeInMillis());
+	}
+	
+	@Test
+	public void testRound2(){
+		long tsInMS = 1397016731576L;
+		long tsInHour = DateTimeUtil.roundDown(Calendar.HOUR, tsInMS);
+		Assert.assertEquals(1397016000000L, tsInHour);
+		
+		GregorianCalendar cal = new GregorianCalendar();
+		cal.setTimeInMillis(tsInMS);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+		Assert.assertEquals(tsInHour, cal.getTimeInMillis());
+	}
+	
+	@Test
+	public void testRound3(){
+		long tsInMS = 1L;
+		long tsInDay = DateTimeUtil.roundDown(Calendar.DATE, tsInMS);
+		Assert.assertEquals(0L, tsInDay);
+//		Assert.assertEquals("1970-01-01 08:00:00", DateTimeUtil.millisecondsToHumanDateWithSeconds(tsInDay));
+	}
+	
+	@Test
+	public void testRound4(){
+		long tsInMS = 0L;
+		long tsInDay = DateTimeUtil.roundDown(Calendar.DATE, tsInMS);
+		Assert.assertEquals(0L, tsInDay);
+		String str = DateTimeUtil.millisecondsToHumanDateWithSeconds(tsInMS);
+		System.out.println(str);
+	}
+	
+	@Test
+	public void testRound5(){
+		long tsInMS = 8*3600*1000L;
+		long tsInDay = DateTimeUtil.roundDown(Calendar.DATE, tsInMS);
+		Assert.assertEquals(0L, tsInDay);
+		String str = DateTimeUtil.millisecondsToHumanDateWithSeconds(tsInDay);
+		System.out.println(str);
+	}
+	
+	@Test
+	public void testDayOfWeek() {
+		GregorianCalendar cal = new GregorianCalendar();
+		long tsInMS = 0L;
+		cal.setTimeInMillis(tsInMS);
+		//cal.setTimeInMillis(System.currentTimeMillis());
+		System.out.println(cal.get(Calendar.DAY_OF_WEEK));
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestEagleBase64Wrapper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestEagleBase64Wrapper.java b/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestEagleBase64Wrapper.java
new file mode 100755
index 0000000..384c274
--- /dev/null
+++ b/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/TestEagleBase64Wrapper.java
@@ -0,0 +1,38 @@
+/*
+ * 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 org.junit.Test;
+
+public class TestEagleBase64Wrapper {
+	@Test
+	public void test(){
+		byte[] b = EagleBase64Wrapper.decode("BgVz-6vkdM8AAbGAf__-trtos5aqSGPod4Q1GwA268vF50iNBgmpmAxLXKkGbxkREWcmOzT3YIx3hDUb");
+		byte[] c = EagleBase64Wrapper.decode("BgVz-6vkdM8AAbGAf__-trtos5aqSGPod4Q1G6pLeJcAATVuADbry8XnSI0GCamYDEtcqQZvGRERZyY7NPdgjHeENRs");
+		
+		System.out.println(new String(b));
+		System.out.println(new String(c));
+		
+		int hash = "jobType".hashCode();
+		byte b1 = (byte)((hash >> 24) & 0xff);
+		byte b2 = (byte)(((hash << 8) >> 24) & 0xff);
+		byte b3 = (byte)(((hash << 16) >> 24) & 0xff);
+		byte b4 = (byte)(((hash << 24) >> 24) & 0xff);
+		
+		System.out.println(b1 + "," + b2 + "," + b3 + "," + b4);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/config/TestEagleConfig.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/config/TestEagleConfig.java b/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/config/TestEagleConfig.java
new file mode 100644
index 0000000..892db0c
--- /dev/null
+++ b/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/config/TestEagleConfig.java
@@ -0,0 +1,43 @@
+/*
+ * 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.config;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @since 9/22/15
+ */
+public class TestEagleConfig {
+    private EagleConfig config;
+
+    @Before
+    public void setUp(){
+        System.setProperty("config.resource","test-service-config.conf");
+        config = EagleConfigFactory.load();
+    }
+
+    @Test
+    public void testInit(){
+        Assert.assertEquals("test",config.getEnv());
+        Assert.assertEquals("localhost",config.getServiceHost());
+        Assert.assertEquals(9090,config.getServicePort());
+        Assert.assertEquals("hbase",config.getStorageType());
+        Assert.assertEquals(false,config.isCoprocessorEnabled());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/metric/TestAlertContext.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/metric/TestAlertContext.java b/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/metric/TestAlertContext.java
new file mode 100644
index 0000000..894961b
--- /dev/null
+++ b/eagle-core/eagle-common/src/test/java/org/apache/eagle/common/metric/TestAlertContext.java
@@ -0,0 +1,39 @@
+/*
+ * 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.metric;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.HashMap;
+
+/**
+ * since 1/20/16.
+ */
+public class TestAlertContext {
+    @Test
+    public void test(){
+        HashMap<String, String> map = new HashMap<String, String>();
+        map.put("key1", "value1");
+        map.put("key2", "value2");
+        AlertContext context = new AlertContext();
+        context.addAll(map);
+        String json = context.toJsonString();
+        System.out.println(json);
+        Assert.assertEquals(map, AlertContext.fromJsonString(json).getProperties());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/test/resources/footer.vm
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/test/resources/footer.vm b/eagle-core/eagle-common/src/test/resources/footer.vm
new file mode 100755
index 0000000..8df4b06
--- /dev/null
+++ b/eagle-core/eagle-common/src/test/resources/footer.vm
@@ -0,0 +1,25 @@
+#*
+ * 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
+ *#
+    </td>
+  </tr>
+  </tr>
+</table>
+<!-- End of wrapper table -->
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/test/resources/header.vm
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/test/resources/header.vm b/eagle-core/eagle-common/src/test/resources/header.vm
new file mode 100755
index 0000000..8bd4388
--- /dev/null
+++ b/eagle-core/eagle-common/src/test/resources/header.vm
@@ -0,0 +1,299 @@
+#*
+ * 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
+ *#
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+  <title></title>
+  <style type="text/css">
+    /* 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;
+    }
+
+    /* 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. */
+    }
+
+    /* Outlook 07, 10 Padding issue fix
+    Bring inline: No.*/
+    table td {
+      border-collapse: collapse;
+    }
+
+    table{
+        width: 100%;
+    }
+
+    /* 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 whatever your want */
+        pointer-events: none;
+        cursor: default;
+      }
+
+      .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
+        text-decoration: default;
+        color: orange !important;
+        pointer-events: auto;
+        cursor: default;
+      }
+
+    }
+
+    /* More Specific Targeting */
+
+    @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
+      /* You guessed it, ipad (tablets, smaller screens, etc) */
+      /* repeating for the ipad */
+      a[href^="tel"], a[href^="sms"] {
+        text-decoration: none;
+        color: blue; /* or whatever your want */
+        pointer-events: none;
+        cursor: default;
+      }
+
+      .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
+        text-decoration: default;
+        color: orange !important;
+        pointer-events: auto;
+        cursor: default;
+      }
+    }
+
+    @media only screen and (-webkit-min-device-pixel-ratio: 2) {
+      /* Put your iPhone 4g styles in here */
+    }
+
+    /* Android targeting */
+    @media only screen and (-webkit-device-pixel-ratio: .75) {
+      /* Put CSS for low density (ldpi) Android layouts in here */
+    }
+
+    @media only screen and (-webkit-device-pixel-ratio: 1) {
+      /* Put CSS for medium density (mdpi) Android layouts in here */
+    }
+
+    @media only screen and (-webkit-device-pixel-ratio: 1.5) {
+      /* Put CSS for high density (hdpi) Android layouts in here */
+    }
+
+    /* end Android targeting */
+    .head{
+      font-family:Helvetica, Arial;
+      font-size:30px;
+      text-decoration:none;
+      text-align:left;
+      color:#333;
+      align:left;
+      padding: 25px 0 15px 0;
+      valign:middle;
+      font-weight: 500;
+      border-bottom: 1px solid #cccccc;
+    }
+
+    .head2{
+      font-family:Helvetica, Arial;
+      font-size:24px;
+      text-decoration:none;
+      text-align:left;
+      color:#333;
+      align:left;
+      padding: 20px 0 10px 0;
+      valign:middle;
+      font-weight: 500;
+    }
+
+    .text{
+      font-family:Helvetica, Arial;
+      font-size:14px;
+      text-decoration:none;
+      text-align:left;
+      color:#333;
+      align:left;
+      padding: 0.5em 0em 0.5em 0em;
+      valign:middle;
+    }
+
+    .info {
+      font-family:Helvetica, Arial;
+      font-size:16px;
+      text-decoration:none;
+      text-align:left;
+      padding-left:10px;
+      border-left: 3px solid #396A92;
+      background-color: #9AB4CB;
+      color:#091D42;
+      align:left;
+      padding: 1em 0em 1em 1em;
+      valign:middle;
+    }
+
+    .table-border{
+      border: 1px solid #ddd;
+      border-radius: 4px 4px 0 0;
+      box-shadow: none;
+    }
+
+    .table-border-th{
+      font-family:Helvetica, Arial;
+      font-size:14px;
+      text-decoration:none;
+      text-align:left;
+      border-top: 1px solid #cccccc;
+      border-right: 1px solid #cccccc;
+      padding: 8px;
+    }
+    .table-border-td{
+      font-family:Helvetica, Arial;
+      font-size:14px;
+      text-decoration:none;
+      text-align:left;
+      border-top: 1px solid #cccccc;
+      border-right: 1px solid #cccccc;
+      padding: 8px;
+      word-break: break-all;
+    }
+
+    .foot{
+      font-family:Arial;
+      font-size:14px;
+      text-decoration:none;
+      text-align:left;
+      padding: 0.5em 0em 0.5em 0.5em;
+      border-top: 1px solid #cccccc;
+      color:#777;
+    }
+
+  </style>
+
+  <!-- Targeting Windows Mobile -->
+  <!--[if IEMobile 7]>
+  <style type="text/css">
+
+  </style>
+  <![endif]-->
+
+  <!-- ***********************************************
+  ****************************************************
+  END MOBILE TARGETING
+  ****************************************************
+  ************************************************ -->
+
+  <!--[if gte mso 9]>
+  <style>
+    /* Target Outlook 2007 and 2010 */
+  </style>
+  <![endif]-->
+</head>
+<body>
+<!-- Wrapper/Container Table: Use a wrapper table to control the width and the background color consistently of your email. Use this approach instead of setting attributes on the body tag. -->
+<table cellpadding="0" cellspacing="0" border="0" id="backgroundTable">
+  <tr>
+    <td valign="top" style="padding-left: 10px">

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/test/resources/log4j.properties b/eagle-core/eagle-common/src/test/resources/log4j.properties
new file mode 100644
index 0000000..5a5709e
--- /dev/null
+++ b/eagle-core/eagle-common/src/test/resources/log4j.properties
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+log4j.rootLogger=INFO, DRFA, stdout
+eagle.log.dir=./logs
+eagle.log.file=eagle.log
+
+# standard output
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n
+
+# Daily Rolling File Appender
+log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.DRFA.File=${eagle.log.dir}/${eagle.log.file}
+log4j.appender.DRFA.DatePattern=.yyyy-MM-dd
+# 30-day backup
+#log4j.appender.DRFA.MaxBackupIndex=30
+log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout
+
+# Pattern format: Date LogLevel LoggerName LogMessage
+log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/test/resources/templates/tec_alert.vm
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/test/resources/templates/tec_alert.vm b/eagle-core/eagle-common/src/test/resources/templates/tec_alert.vm
new file mode 100755
index 0000000..2219ebf
--- /dev/null
+++ b/eagle-core/eagle-common/src/test/resources/templates/tec_alert.vm
@@ -0,0 +1,119 @@
+#*
+ * 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
+ *#
+#parse("header.vm")
+<table cellpadding="0" cellspacing="0" border="0" align="left" width="800" style="">
+  <tr>
+    <td class="head" width="800">
+      <span style="color: #091D42">Eagle Service <small style="color: #999999;">$startTime ~ $endTime</small></span>
+    </td>
+  </tr>
+  <tr>
+    <td class="head2" width="800">
+      <span>
+        Statistics
+      </span>
+    </td>
+  </tr>
+  <tr>
+    <td valign="top" style="padding: 0.5em 0em 0.5em 0em;">
+      <table cellpadding="0" cellspacing="0" border="0" align="left" width="800" class="table-border">
+        <thead>
+        <tr>
+          <th class="table-border-th" style="width: 25%">type</th>
+          <th class="table-border-th" style="width: 25%">count</th>
+          <th class="table-border-th" style="width: 25%">type</th>
+          <th class="table-border-th" style="width: 25%">count</th>
+        </tr>
+        </thead>
+        <tbody>
+        #foreach($key in $statistics.keySet())
+          #if( $foreach.count % 2 == 1 )
+          <tr>
+          #end
+            <td class="table-border-td">$key</td>
+            <td class="table-border-td">$statistics.get($key)</td>
+          #if( $foreach.count % 2 == 0)
+          </tr>
+          #end
+          #if( $foreach.count % 2 == 1 && !$foreach.hasNext )
+          	<td class="table-border-td"></td>
+            <td class="table-border-td"></td>
+          </tr>
+          #end
+       	#end
+        </tbody>
+      </table>
+    </td>
+  </tr>
+  <tr>
+    <td class="head2" width="800">
+      <span>
+        Detail Info
+      </span>
+    </td>
+  </tr>
+  <tr>
+    <td class="info" width="800">
+      <span>
+          These are the alerts that we can not find its hostname.
+      </span>
+    </td>
+  </tr>
+  <tr>
+    <td valign="top" style="padding: 0.5em 0em 0.5em 0em;">
+      <table cellpadding="0" cellspacing="0" border="0" align="left" width="800" class="table-border">
+        <thead>
+          <tr>
+            <th class="table-border-th">hostname</th>
+            <th class="table-border-th">date_reception</th>
+            <th class="table-border-th">type</th>
+            <th class="table-border-th">origin</th>
+            <th class="table-border-th">msg</th>
+          </tr>
+        </thead>
+        <tbody>
+        #foreach($entry in $noHostnameItems)
+          <tr>
+            <td class="table-border-td">$entry.hostname</td>
+            <td class="table-border-td">$entry.date_reception</td>
+            <td class="table-border-td">$entry.type</td>
+            <td class="table-border-td">$entry.origin</td>
+            <td class="table-border-td">$entry.msg</td>
+          </tr>
+       	#end
+        </tbody>
+      </table>
+    </td>
+  </tr>
+    <tr>
+        <td>
+            <img src="cid:$cid.get("chart.png")"/>
+        </td>
+    </tr>
+  <tr>
+    <td class="foot" width="800">
+      <span class="outlook">
+         Apache Eagle <a href="http://<Eagle-Host>:9090/eagle-web/ui/eagle.html"
+                  target ="_blank" title="Hadoop Eagle">Apache Eagle</a>
+      </span>
+    </td>
+  </tr>
+</table>
+
+#parse("footer.vm")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/test/resources/templates/test_anomaly_alert.vm
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/test/resources/templates/test_anomaly_alert.vm b/eagle-core/eagle-common/src/test/resources/templates/test_anomaly_alert.vm
new file mode 100644
index 0000000..da1f8d0
--- /dev/null
+++ b/eagle-core/eagle-common/src/test/resources/templates/test_anomaly_alert.vm
@@ -0,0 +1,137 @@
+#*
+ * 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
+ *#
+#parse("header.vm")
+<table cellpadding="0" cellspacing="0" border="0" align="left" width="800" style="">
+  <tr>
+    <td class="head" width="800">
+      <span style="color: #091D42">Eagle Job Anomaly Host Detection <small style="color: #999999;"><br>$startTime ~ $endTime</small></span>
+    </td>
+  </tr>
+  <tr>
+    <td class="head2" width="800">
+      <span>
+        Statistics
+      </span>
+    </td>
+  </tr>
+  <tr>
+    <td valign="top" style="padding: 0.5em 0em 0.5em 0em;">
+      <table cellpadding="0" cellspacing="0" border="0" align="left" width="800" class="table-border">
+        <thead>
+        <tr>
+          <th class="table-border-th" style="width: 25%">Cluster</th>
+          <th class="table-border-th" style="width: 25%">Datacener</th>
+          <th class="table-border-th" style="width: 25%">Count</th>
+        </tr>
+        </thead>
+        <tbody>
+          <tr>
+              <td class="table-border-td">$cluster</td>
+              <td class="table-border-td">$datacenter</td>
+              <td class="table-border-td">$count</td>
+          </tr>
+        </tbody>
+      </table>
+    </td>
+  </tr>
+  <tr>
+    <td class="head2" width="800">
+      <span>
+        Anomaly detector configurations
+      </span>
+    </td>
+  </tr>
+  <tr>
+    <td valign="top" style="padding: 0.5em 0em 0.5em 0em;">
+      <table cellpadding="0" cellspacing="0" border="0" align="left" width="800" class="table-border">
+        <thead>
+        <tr>
+          <th class="table-border-th" style="width: 25%">Parameter Name</th>
+          <th class="table-border-th" style="width: 25%">Value</th>
+          <th class="table-border-th" style="width: 25%">Description</th>
+        </tr>
+        </thead>
+        <tbody>
+        #foreach($key in $configMap.keySet())
+        <tr>
+            <td class="table-border-td">$key</td>
+            <td class="table-border-td">$configMap.get($key)</td>
+            <td class="table-border-td">$configDescMap.get($key)</td>
+        </tr>
+       	#end
+         </tbody>
+        </table>
+      </td>
+  </tr>
+  <tr>
+    <td class="head2" width="800">
+      <span>
+        Detail Information
+      </span>
+    </td>
+  </tr>
+  <tr>
+    <td class="info" width="800">
+      <span>
+          These are the anomaly hosts detected by Hadoop Eagle:
+      </span>
+    </td>
+  </tr>
+  <tr>
+    <td valign="top" style="padding: 0.5em 0em 0.5em 0em;">
+      <table cellpadding="0" cellspacing="0" border="0" align="left" width="800" class="table-border">
+        <thead>
+          <tr>
+            <th class="table-border-th">Cluster</th>
+            <th class="table-border-th">Datacenter</th>
+            <th class="table-border-th">Hostname</th>
+            <th class="table-border-th">Description</th>
+            <th class="table-border-th">Job Types</th>
+            <th class="table-border-th">Errors</th>
+          </tr>
+        </thead>
+        <tbody>
+        #foreach($key in $anomalyHostMap.keySet())
+        <tr>
+            <td class="table-border-td">$cluster</td>
+            <td class="table-border-td">$datacenter</td>
+            <td class="table-border-td"><a href="http://123.dc1.xyz.com:9090/eagle-web/ui/AnomalyDetection.html?cluster=$cluster&datacenter=$datacenter&intervalmin=1&startTime=$startTime&endTime=$endTime&top=20">$key</a></td>
+            <td class="table-border-td">$anomalyHostMap.get($key)</td>
+            <td class="table-border-td">$jobNameMap.get($key)</td>
+            <td class="table-border-td"><a href="http://hadoop-eagle.vip.dc1.xyz.com/eagle-service/rest/list?query=TaskExecutionService[@cluster=%22$cluster%22%20AND%20@datacenter=%22$datacenter%22%20AND%20@hostname=%22$key%22%20AND%20@taskStatus=%22FAILED%22]{@error,@jobID,@taskID,@normJobName}&pageSize=1000&startTime=$startTime&endTime=$endTime">$errorMap.get($key)</a></td>
+        </tr>
+       	#end
+        </tbody>
+      </table>
+    </td>
+  </tr>
+  <br>
+  <tr>
+    <td class="foot" width="800">
+      <span class="outlook">
+         Apache Eagle <a href="http://hadoop-eagle.vip.dc1.xyz.com"
+                  target ="_blank" title="Hadoop Eagle">Apache Eagle</a>
+      </span>
+    </td>
+  </tr>
+</table>
+<br>
+<br>
+
+#parse("footer.vm")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-common/src/test/resources/test-service-config.conf
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/test/resources/test-service-config.conf b/eagle-core/eagle-common/src/test/resources/test-service-config.conf
new file mode 100644
index 0000000..848391d
--- /dev/null
+++ b/eagle-core/eagle-common/src/test/resources/test-service-config.conf
@@ -0,0 +1,30 @@
+# 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 {
+	timezone = "UTC"
+
+	service {
+		env = "test"
+		host = "localhost"
+		port = 9090
+		storage-type = "hbase"
+		table-name-prefixed-with-environment = true
+		hbase-zookeeper-quorum = "localhost"
+		hbase-zookeeper-property-clientPort = 2181
+		zookeeper-znode-parent = "/hbase-unsecure"
+		coprocessor-enabled = false
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/pom.xml b/eagle-core/eagle-metadata/eagle-metadata-base/pom.xml
new file mode 100644
index 0000000..5e74a41
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/pom.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eagle-metadata</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>eagle-metadata-base</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.typesafe</groupId>
+            <artifactId>config</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>alert-metadata</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.inject.extensions</groupId>
+            <artifactId>guice-servlet</artifactId>
+        </dependency>
+    </dependencies>
+</project>
\ 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/ApplicationDesc.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationDesc.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationDesc.java
new file mode 100644
index 0000000..46b5dbe
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationDesc.java
@@ -0,0 +1,141 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.alert.engine.coordinator.StreamDefinition;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Static metadata provided by installed apps
+ */
+public class ApplicationDesc implements Serializable {
+    private String type;
+    private String name;
+    private String version;
+    private String description;
+    private Class<?> appClass;
+    private String jarPath;
+    private String viewPath;
+    private Class<?> providerClass;
+    private Configuration configuration;
+    private List<StreamDefinition> streams;
+    private Class<?> sinkClass;
+    private ApplicationDocs docs;
+
+    public String getDescription() {
+        return description;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public Configuration getConfiguration() {
+        return configuration;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getViewPath() {
+        return viewPath;
+    }
+
+    public String getJarPath() {
+        return jarPath;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+    public void setJarPath(String jarPath) {
+        this.jarPath = jarPath;
+    }
+
+    public void setViewPath(String viewPath) {
+        this.viewPath = viewPath;
+    }
+
+    public Class<?> getAppClass() {
+        return appClass;
+    }
+
+    public void setAppClass(Class<?> appClass) {
+        this.appClass = appClass;
+    }
+
+    public Class<?> getProviderClass() {
+        return providerClass;
+    }
+
+    public void setProviderClass(Class<?> providerClass) {
+        this.providerClass = providerClass;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("ApplicationDesc [type=%s, name=%s, version=%s, appClass=%s, viewPath=%s, jarPath=%s, providerClass=%s, configuration= %s properties, description=%s",
+                    getType(),getName(),getVersion(),getAppClass(), getViewPath(),getJarPath(),getProviderClass(), getConfiguration() == null ? 0: getConfiguration().size(),getDescription());
+    }
+
+    public void setConfiguration(Configuration configuration) {
+        this.configuration = configuration;
+    }
+
+    public Class<?> getSinkClass() {
+        return sinkClass;
+    }
+
+    public void setSinkClass(Class<?> sinkClass) {
+        this.sinkClass = sinkClass;
+    }
+
+    public List<StreamDefinition> getStreams() {
+        return streams;
+    }
+
+    public void setStreams(List<StreamDefinition> streams) {
+        this.streams = streams;
+    }
+
+    public ApplicationDocs getDocs() {
+        return docs;
+    }
+
+    public void setDocs(ApplicationDocs docs) {
+        this.docs = docs;
+    }
+}
\ 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/ApplicationDocs.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationDocs.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationDocs.java
new file mode 100644
index 0000000..f83f377
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationDocs.java
@@ -0,0 +1,38 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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;
+
+public class ApplicationDocs {
+    private String install;
+    private String uninstall;
+
+    public String getInstall() {
+        return install;
+    }
+
+    public void setInstall(String install) {
+        this.install = install;
+    }
+
+    public String getUninstall() {
+        return uninstall;
+    }
+
+    public void setUninstall(String uninstall) {
+        this.uninstall = uninstall;
+    }
+}


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

Posted by ha...@apache.org.
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..0000000
--- 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..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/pom.xml
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~  Unless required by applicable law or agreed to in writing, software
-  ~  distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  ~
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>eagle-application-management</artifactId>
-        <groupId>org.apache.eagle</groupId>
-        <version>0.5.0-incubating-SNAPSHOT</version>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>eagle-stream-application-manager</artifactId>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.eagle</groupId>
-            <artifactId>eagle-application-service</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.eagle</groupId>
-            <artifactId>eagle-stream-pipeline</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.storm</groupId>
-            <artifactId>storm-core</artifactId>
-            <version>${storm.version}</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>ch.qos.logback</groupId>
-                    <artifactId>logback-classic</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>log4j</groupId>
-                    <artifactId>log4j</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>log4j-over-slf4j</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.scala-lang</groupId>
-            <artifactId>scala-reflect</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.scala-lang</groupId>
-            <artifactId>scala-compiler</artifactId>
-            <version>${scala.version}.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.scalatest</groupId>
-            <artifactId>scalatest_${scala.version}</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>com.typesafe.akka</groupId>
-            <artifactId>akka-actor_${scala.version}</artifactId>
-            <version>${akka.actor.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.typesafe.akka</groupId>
-            <artifactId>akka-testkit_${scala.version}</artifactId>
-            <version>${akka.actor.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <scope>compile</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.scala-tools</groupId>
-                <artifactId>maven-scala-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>scala-compile-first</id>
-                        <phase>process-resources</phase>
-                        <goals>
-                            <goal>add-source</goal>
-                            <goal>compile</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>scala-test-compile</id>
-                        <phase>process-test-resources</phase>
-                        <goals>
-                            <goal>testCompile</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <configuration>
-                    <skipTests>true</skipTests>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.scalatest</groupId>
-                <artifactId>scalatest-maven-plugin</artifactId>
-                <configuration>
-                    <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
-                    <junitxml>.</junitxml>
-                    <filereports>TestSuite.txt</filereports>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>test</id>
-                        <goals>
-                            <goal>test</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyException.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyException.java b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyException.java
deleted file mode 100644
index d382629..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyException.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.stream.application;
-
-
-public class TopologyException extends Exception {
-    public TopologyException(String s, Exception e) { super(s,e); }
-    public TopologyException(Exception e) { super(e); }
-    public TopologyException(String s) { super(s); }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyExecutable.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyExecutable.java b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyExecutable.java
deleted file mode 100644
index 8f625c7..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyExecutable.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 express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-package org.apache.eagle.stream.application;
-
-
-import com.typesafe.config.Config;
-
-
-public interface TopologyExecutable {
-    void submit(String topology, Config config);
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyFactory.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyFactory.java b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyFactory.java
deleted file mode 100644
index e32f48e..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/java/org/apache/eagle/stream/application/TopologyFactory.java
+++ /dev/null
@@ -1,55 +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;
-
-
-import com.typesafe.config.Config;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-
-public final class TopologyFactory {
-    public static Logger LOG = LoggerFactory.getLogger(TopologyFactory.class);
-    private final static Map<String, TopologyExecutable> topologyCache = Collections.synchronizedMap(new HashMap<String, TopologyExecutable>());
-    public static TopologyExecutable getTopologyInstance(String topologyClass) throws TopologyException {
-        TopologyExecutable instance;
-        if(topologyCache.containsKey(topologyClass)){
-            instance = topologyCache.get(topologyClass);
-        } else {
-            try {
-                LOG.info("load class " + topologyClass + "with classLoader " + TopologyFactory.class.getClassLoader().toString());
-                instance = (TopologyExecutable) Class.forName(topologyClass).newInstance();
-                topologyCache.put(topologyClass, instance);
-            } catch (ClassNotFoundException e) {
-                throw new TopologyException("Topology in type of " + topologyClass + " is not found",e);
-            } catch (InstantiationException | IllegalAccessException e) {
-                throw new TopologyException(e);
-            }
-        }
-        return instance;
-    }
-
-    public static void submit(String topologyClass, Config config) throws TopologyException {
-        TopologyExecutable topology = getTopologyInstance(topologyClass);
-        topology.submit(topologyClass, config);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/AbstractDynamicApplication.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/AbstractDynamicApplication.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/AbstractDynamicApplication.scala
deleted file mode 100644
index 3e918cc..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/AbstractDynamicApplication.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-package org.apache.eagle.stream.application
-
-import com.typesafe.config.Config
-import org.apache.eagle.datastream.core.StreamContext
-import org.apache.eagle.stream.pipeline.Pipeline
-
-
-trait AbstractDynamicApplication extends TopologyExecutable {
-  def compileStream(application: String, config: Config): StreamContext = {
-    val pipeline = Pipeline.parseStringWithConfig(application, config)
-    Pipeline.compile(pipeline)
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManager.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManager.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManager.scala
deleted file mode 100644
index bbfaedd..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManager.scala
+++ /dev/null
@@ -1,126 +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
-
-import java.util
-
-import com.google.common.base.Preconditions
-import org.apache.eagle.service.application.entity.TopologyExecutionStatus
-import org.apache.eagle.stream.application.impl.StormExecutionPlatform
-import org.slf4j.{Logger, LoggerFactory}
-
-import scala.collection.JavaConversions
-
-
-object ApplicationManager {
-  private val LOG: Logger = LoggerFactory.getLogger(ApplicationManager.getClass)
-  private val workerMap: util.Map[AnyRef, TaskExecutor] = new util.TreeMap[AnyRef, TaskExecutor]
-
-  def getWorkerMap: util.Map[AnyRef, TaskExecutor] = {
-    return workerMap
-  }
-
-  def submit(id: AnyRef, runnable: Runnable): TaskExecutor = {
-    if (workerMap.containsKey(id)) {
-      val executor: Thread = workerMap.get(id)
-      if (!executor.isAlive || executor.getState.equals() ) {
-        LOG.info("Replacing dead executor: {}", executor)
-        workerMap.remove(id)
-      }
-      else {
-        throw new IllegalArgumentException("Duplicated id '" + id + "'")
-      }
-    }
-    val worker: TaskExecutor = new TaskExecutor(runnable)
-    LOG.info("Registering new executor %s: %s".format(id, worker))
-    workerMap.put(id, worker)
-    worker.setName(id.toString)
-    worker.setDaemon(true)
-    worker.start
-    return worker
-  }
-
-  def get(id: AnyRef): TaskExecutor = {
-    Preconditions.checkArgument(workerMap.containsKey(id))
-    return workerMap.get(id)
-  }
-
-  @throws(classOf[Exception])
-  def stop(id: AnyRef): TaskExecutor = {
-    val worker: TaskExecutor = get(id)
-    worker.interrupt
-    //this.workerMap.remove(id)
-    return worker
-  }
-
-  def getWorkerStatus(state: Thread.State): String = {
-    if (whereIn(state, java.lang.Thread.State.RUNNABLE, java.lang.Thread.State.TIMED_WAITING, java.lang.Thread.State.WAITING)) {
-      return TopologyExecutionStatus.STARTED
-    }
-    else if (whereIn(state, java.lang.Thread.State.NEW)) {
-      return TopologyExecutionStatus.STARTING
-    }
-    else if (whereIn(state, java.lang.Thread.State.TERMINATED)) {
-      return TopologyExecutionStatus.STOPPED
-    }
-    throw new IllegalStateException("Unknown state: " + state)
-  }
-
-  def getTopologyStatus(status: String): String = {
-    if(whereIn(status, StormExecutionPlatform.KILLED))
-      return TopologyExecutionStatus.STOPPING
-    return TopologyExecutionStatus.STARTED
-  }
-
-  private def whereIn(status: String, inStatuses: String*): Boolean = {
-    for (_status <- inStatuses) {
-      if (_status.equalsIgnoreCase(status)) {
-        return true
-      }
-    }
-    return false
-  }
-  private def whereIn(state: Thread.State, inStates: Thread.State*): Boolean = {
-    for (_state <- inStates) {
-      if (_state eq state) {
-        return true
-      }
-    }
-    return false
-  }
-
-  def remove(id: AnyRef) {
-    val executor: TaskExecutor = this.get(id)
-    if (executor.isAlive) {
-      throw new RuntimeException("Failed to remove alive executor '" + id + "'")
-    }
-    else {
-      this.workerMap.remove(id)
-    }
-  }
-
-  def stopAll(): Unit ={
-    JavaConversions.collectionAsScalaIterable(workerMap.values()) foreach { worker =>
-      if(!worker.isInterrupted) {
-        worker.interrupt()
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManagerUtils.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManagerUtils.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManagerUtils.scala
deleted file mode 100644
index 4c2df77..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationManagerUtils.scala
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-package org.apache.eagle.stream.application
-
-import com.typesafe.config.Config
-import org.apache.eagle.service.application.AppManagerConstants
-import org.apache.eagle.service.application.entity.TopologyExecutionEntity
-
-
-object ApplicationManagerUtils {
-
-  def generateTopologyFullName(topologyExecution: TopologyExecutionEntity) = {
-    val fullName = "eagle-%s-%s-%s".format(topologyExecution.getSite, topologyExecution.getApplication, topologyExecution.getTopology)
-    fullName
-  }
-
-  def buildStormTopologyURL(config: Config, topologyID: String): String = {
-    val clusterURL = if(config.hasPath(AppManagerConstants.CLUSTER_URL)) config.getString(AppManagerConstants.CLUSTER_URL) else AppManagerConstants.DEFAULT_CLUSTER_URL
-    val topologyURL = clusterURL + "/topology.html?id=" + topologyID
-    topologyURL
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationSchedulerAsyncDAO.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationSchedulerAsyncDAO.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationSchedulerAsyncDAO.scala
deleted file mode 100644
index ae0f6e8..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ApplicationSchedulerAsyncDAO.scala
+++ /dev/null
@@ -1,179 +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
-
-import java.util
-import java.util.concurrent.Callable
-
-import akka.dispatch.Futures
-import com.typesafe.config.Config
-import org.apache.eagle.alert.entity.SiteApplicationServiceEntity
-import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity
-import org.apache.eagle.policy.common.Constants
-import org.apache.eagle.service.application.entity.{TopologyDescriptionEntity, TopologyExecutionEntity, TopologyExecutionStatus, TopologyOperationEntity}
-import org.apache.eagle.service.client.EagleServiceConnector
-import org.apache.eagle.service.client.impl.EagleServiceClientImpl
-import org.slf4j.{Logger, LoggerFactory}
-
-import scala.collection.JavaConversions
-import scala.concurrent.ExecutionContext
-
-
-class ApplicationSchedulerAsyncDAO(config: Config, ex: ExecutionContext) {
-  private val LOG: Logger = LoggerFactory.getLogger(classOf[ApplicationSchedulerAsyncDAO])
-  private val connector: EagleServiceConnector = new EagleServiceConnector(config)
-
-  def getEagleServiceClient(): EagleServiceClientImpl = {
-    return new EagleServiceClientImpl(connector)
-  }
-
-  def readOperationsByStatus(status: String) = {
-    Futures.future(new Callable[util.List[TopologyOperationEntity]]{
-      override def call(): util.List[TopologyOperationEntity] = {
-        val client = getEagleServiceClient()
-        val query = "%s[@status=\"%s\"]{*}".format(Constants.TOPOLOGY_OPERATION_SERVICE_ENDPOINT_NAME, status)
-        val response: GenericServiceAPIResponseEntity[TopologyOperationEntity] = client.search(query).pageSize(Int.MaxValue).send()
-        if(client != null) client.close()
-        if(!response.isSuccess || response.getObj == null)
-          throw new Exception(s"Fail to load operations with status $status")
-        response.getObj
-      }
-    }, ex)
-  }
-
-  def loadAllTopologyExecutionEntities() = {
-    Futures.future(new Callable[util.List[TopologyExecutionEntity]]{
-      override def call(): util.List[TopologyExecutionEntity] = {
-        val client = getEagleServiceClient()
-        val query = "%s[@status != \"%s\"]{*}".format(Constants.TOPOLOGY_EXECUTION_SERVICE_ENDPOINT_NAME, TopologyExecutionStatus.NEW)
-        val response: GenericServiceAPIResponseEntity[TopologyExecutionEntity] = client.search(query).pageSize(Int.MaxValue).send()
-        if(client != null) client.close()
-        if(!response.isSuccess || response.getObj == null) throw new Exception(response.getException)
-        response.getObj
-      }
-    }, ex)
-  }
-
-  def loadTopologyExecutionByName(site: String, appName: String, topologyName: String) = {
-    Futures.future(new Callable[TopologyExecutionEntity]{
-      override def call(): TopologyExecutionEntity = {
-        val client = getEagleServiceClient()
-        val query = "%s[@site=\"%s\" AND @application=\"%s\" AND @topology=\"%s\"]{*}".format(Constants.TOPOLOGY_EXECUTION_SERVICE_ENDPOINT_NAME, site, appName, topologyName)
-        LOG.info(s"query=$query")
-        val response: GenericServiceAPIResponseEntity[TopologyExecutionEntity] = client.search(query).pageSize(Int.MaxValue).send()
-        if(client != null) client.close()
-        if(!response.isSuccess || response.getObj == null)
-          throw new Exception(s"Fail to load topologyExecutionEntity with application=$appName topology=$topologyName due to Exception: ${response.getException}")
-        if(response.getObj.size() == 0 || response.getObj.size() > 1) {
-          throw new Exception(s"Get 0 or more than 1 topologyExecutionEntity with application=$appName topology=$topologyName")
-        }
-        response.getObj.get(0)
-      }
-    }, ex)
-  }
-
-  def loadTopologyDescriptionByName(site: String, application: String, topologyName: String) = {
-    Futures.future(new Callable[TopologyDescriptionEntity]{
-      override def call(): TopologyDescriptionEntity = {
-        val client = getEagleServiceClient()
-        var query = "%s[@topology=\"%s\"]{*}".format(Constants.TOPOLOGY_DESCRIPTION_SERVICE_ENDPOINT_NAME, topologyName)
-        val response: GenericServiceAPIResponseEntity[TopologyDescriptionEntity] = client.search(query).pageSize(Int.MaxValue).send()
-        if(!response.isSuccess || response.getObj == null || response.getObj.size() == 0)
-          throw new Exception(s"Fail to load TopologyDescriptionEntity with site=$site application=$application topology=$topologyName due to Exception: ${response.getException}")
-        val topologyDescriptionEntity = response.getObj.get(0)
-
-        query = "%s[@site=\"%s\" AND @application=\"%s\"]{*}".format(Constants.SITE_APPLICATION_SERVICE_ENDPOINT_NAME, site, application)
-        val configResponse: GenericServiceAPIResponseEntity[SiteApplicationServiceEntity] = client.search(query).pageSize(Int.MaxValue).send()
-        if (client != null) client.close()
-        if(!configResponse.isSuccess || configResponse.getObj == null || configResponse.getObj.size() == 0)
-          throw new Exception(s"Fail to load topology configuration with query=$query due to Exception: ${configResponse.getException}")
-        val siteApplicationEntity = configResponse.getObj.get(0)
-        topologyDescriptionEntity.setContext(siteApplicationEntity.getConfig)
-        topologyDescriptionEntity
-      }
-    }, ex)
-  }
-
-  def updateOperationStatus(operation: TopologyOperationEntity) = {
-    Futures.future(new Callable[GenericServiceAPIResponseEntity[String]]{
-      override def call(): GenericServiceAPIResponseEntity[String] = {
-        if(LOG.isDebugEnabled()) LOG.debug(s"Updating status of command[$operation] as ${operation.getStatus}")
-        val client = getEagleServiceClient()
-        operation.setLastModifiedDate(System.currentTimeMillis())
-        val response= client.update(java.util.Arrays.asList(operation), classOf[TopologyOperationEntity])
-        if(client != null) client.close()
-        if(response.isSuccess) {
-          LOG.info(s"Updated operation status [$operation] as: ${operation.getStatus}")
-        } else {
-          LOG.error(s"Failed to update status as ${operation.getStatus} of command[$operation]")
-          throw new RuntimeException(s"Failed to update command due to exception: ${response.getException}")
-        }
-        response
-      }
-    }, ex)
-  }
-
-  def updateTopologyExecutionStatus(topology: TopologyExecutionEntity) = {
-    Futures.future(new Callable[GenericServiceAPIResponseEntity[String]]{
-      override def call(): GenericServiceAPIResponseEntity[String] = {
-        if(LOG.isDebugEnabled()) LOG.debug(s"Updating status of app[$topology] as ${topology.getStatus}")
-        val client = getEagleServiceClient()
-        topology.setLastModifiedDate(System.currentTimeMillis())
-        if(client != null) client.close()
-        val response= client.update(java.util.Arrays.asList(topology), classOf[TopologyExecutionEntity])
-        if(response.isSuccess) {
-          LOG.info(s"Updated status application[$topology] as: ${topology.getStatus}")
-        } else {
-          LOG.error(s"Failed to update status as ${topology.getStatus} of application[$topology] due to ${response.getException}")
-        }
-        response
-      }
-    }, ex)
-  }
-
-  def clearPendingOperations() = {
-    Futures.future(new Callable[GenericServiceAPIResponseEntity[String]]{
-      override def call(): GenericServiceAPIResponseEntity[String] = {
-        LOG.info("start to clear operation")
-        val query: String = "%s[@status=\"%s\"]{*}".format(Constants.TOPOLOGY_OPERATION_SERVICE_ENDPOINT_NAME, TopologyOperationEntity.OPERATION_STATUS.PENDING)
-        val client = getEagleServiceClient()
-        val response: GenericServiceAPIResponseEntity[TopologyOperationEntity] = client.search(query).pageSize(Int.MaxValue).send()
-        var ret: GenericServiceAPIResponseEntity[String] = new GenericServiceAPIResponseEntity[String]()
-        if (response.isSuccess && response.getObj.size != 0) {
-          val pendingOperations: util.List[TopologyOperationEntity] = response.getObj
-          val failedOperations: util.List[TopologyOperationEntity] = new util.ArrayList[TopologyOperationEntity]
-          JavaConversions.collectionAsScalaIterable(pendingOperations) foreach { operation =>
-            operation.setStatus(TopologyOperationEntity.OPERATION_STATUS.FAILED)
-            failedOperations.add(operation)
-          }
-          ret = client.update(failedOperations, Constants.TOPOLOGY_OPERATION_SERVICE_ENDPOINT_NAME)
-          if (client != null) client.close()
-          if (ret.isSuccess) {
-            LOG.info(s"Successfully clear ${failedOperations.size()} pending operations")
-          } else {
-            LOG.error(s"Failed to clear pending operations due to exception:" + ret.getException)
-          }
-        }
-        ret
-      }
-    }, ex)
-  }
-}
-
-

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatform.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatform.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatform.scala
deleted file mode 100644
index 88271bb..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatform.scala
+++ /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 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
-
-import com.typesafe.config.Config
-import org.apache.eagle.service.application.entity.{TopologyExecutionEntity, TopologyDescriptionEntity}
-
-
-trait ExecutionPlatform {
-  def start(topology: TopologyDescriptionEntity, topologyExecution: TopologyExecutionEntity, config: Config)
-  def stop(topologyExecution: TopologyExecutionEntity, config: Config)
-  def status(topologyExecutions: java.util.List[TopologyExecutionEntity], config: Config)
-  def status(topologyExecution: TopologyExecutionEntity, config: Config)
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatformFactory.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatformFactory.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatformFactory.scala
deleted file mode 100644
index 6b9c033..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/ExecutionPlatformFactory.scala
+++ /dev/null
@@ -1,49 +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
-
-import org.apache.eagle.service.application.AppManagerConstants
-import org.apache.eagle.stream.application.impl.StormExecutionPlatform
-import org.slf4j.{LoggerFactory, Logger}
-
-import scala.collection.mutable
-
-
-object ExecutionPlatformFactory {
-  private val LOG: Logger = LoggerFactory.getLogger(ExecutionPlatformFactory.getClass)
-
-  var managerCache = new mutable.HashMap[String, ExecutionPlatform] with
-    mutable.SynchronizedMap[String, ExecutionPlatform]
-
-  def getApplicationManager(managerType: String): ExecutionPlatform = {
-    if(managerCache.contains(managerType)) {
-      managerCache.get(managerType).get
-    } else {
-      managerType match {
-        case AppManagerConstants.EAGLE_CLUSTER_STORM =>
-          val instance = new StormExecutionPlatform
-          managerCache.put(managerType, instance)
-          instance
-        case _ =>
-          throw new Exception(s"Invalid managerType $managerType")
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/TaskExecutor.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/TaskExecutor.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/TaskExecutor.scala
deleted file mode 100644
index 07737ac..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/TaskExecutor.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-package org.apache.eagle.stream.application
-
-import org.codehaus.jackson.annotate.JsonIgnore
-
-class TaskExecutor(runnable: Runnable) extends Thread(runnable) {
-
-  @JsonIgnore override def getContextClassLoader: ClassLoader = {
-    return super.getContextClassLoader
-  }
-
-  @JsonIgnore override def getUncaughtExceptionHandler: Thread.UncaughtExceptionHandler = {
-    return super.getUncaughtExceptionHandler
-  }
-
-  def shutdown {
-    this.interrupt
-  }
-
-  def restart {
-    this.interrupt
-    this.start
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormDynamicTopology.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormDynamicTopology.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormDynamicTopology.scala
deleted file mode 100644
index 7d52649..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormDynamicTopology.scala
+++ /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.stream.application.impl
-
-import com.typesafe.config.Config
-import org.apache.eagle.datastream.ExecutionEnvironments
-import org.apache.eagle.datastream.storm.StormExecutionEnvironment
-import org.apache.eagle.stream.application.AbstractDynamicApplication
-import org.slf4j.LoggerFactory
-
-
-object StormDynamicTopology extends AbstractDynamicApplication {
-  val LOG = LoggerFactory.getLogger(classOf[AbstractDynamicApplication])
-
-  override def submit(application: String, config: Config) {
-    val stream = compileStream(application, config)
-    var ret = true
-
-    try {
-      val stormEnv = ExecutionEnvironments.getWithConfig[StormExecutionEnvironment](stream.getConfig)
-      stream.submit(stormEnv)
-    } catch {
-      case e: Throwable =>
-        ret = false
-        LOG.error(e.toString)
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormExecutionPlatform.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormExecutionPlatform.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormExecutionPlatform.scala
deleted file mode 100644
index af4cafa..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/impl/StormExecutionPlatform.scala
+++ /dev/null
@@ -1,197 +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.impl
-
-import java.net.URLDecoder
-import java.nio.file.{Files, Paths}
-
-import backtype.storm.generated.InvalidTopologyException
-import backtype.storm.utils.{NimbusClient, Utils}
-import com.typesafe.config.{Config, ConfigFactory}
-import org.apache.eagle.common.config.EagleConfigConstants
-import org.apache.eagle.service.application.AppManagerConstants
-import org.apache.eagle.service.application.entity.{TopologyDescriptionEntity, TopologyExecutionEntity, TopologyExecutionStatus}
-import org.apache.eagle.stream.application.{ApplicationManager, ApplicationManagerUtils, ExecutionPlatform, TopologyFactory}
-import org.slf4j.LoggerFactory
-
-import scala.collection.JavaConversions
-
-object StormExecutionPlatform {
-  val ACTIVE: String = "ACTIVE"
-  val INACTIVE: String = "INACTIVE"
-  val KILLED: String = "KILLED"
-  val REBALANCING: String = "REBALANCING"
-}
-
-class StormExecutionPlatform extends ExecutionPlatform {
-  val LOG = LoggerFactory.getLogger(classOf[StormExecutionPlatform])
-
-  private def getNimbusClient(appConfig: com.typesafe.config.Config): NimbusClient = {
-    val conf = Utils.readStormConfig().asInstanceOf[java.util.HashMap[String, Object]]
-    conf.putAll(Utils.readCommandLineOpts().asInstanceOf[java.util.HashMap[String, Object]])
-
-    if(appConfig.hasPath("envContextConfig.nimbusHost")) {
-      LOG.info(s"Setting ${backtype.storm.Config.NIMBUS_HOST} as ${appConfig.getString("envContextConfig.nimbusHost")}")
-      conf.put(backtype.storm.Config.NIMBUS_HOST, appConfig.getString("envContextConfig.nimbusHost"))
-    }
-
-    if(appConfig.hasPath("envContextConfig.nimbusThriftPort")) {
-      LOG.info(s"Setting ${backtype.storm.Config.NIMBUS_THRIFT_PORT} as ${appConfig.getString("envContextConfig.nimbusThriftPort")}")
-      conf.put(backtype.storm.Config.NIMBUS_THRIFT_PORT, appConfig.getNumber("envContextConfig.nimbusThriftPort"))
-    }
-    NimbusClient.getConfiguredClient(conf)
-  }
-
-  def startLocal(topologyName: String, topology: TopologyDescriptionEntity, topologyExecution: TopologyExecutionEntity, config: Config): Unit = {
-    val worker: Thread = ApplicationManager.submit(topologyName, new Runnable {
-      override def run(): Unit = {
-        try {
-          val topologyType = topology.getType.toUpperCase()
-          topologyType match {
-            case TopologyDescriptionEntity.TYPE.CLASS =>
-              TopologyFactory.submit(topology.getExeClass, config)
-            case TopologyDescriptionEntity.TYPE.DYNAMIC =>
-              StormDynamicTopology.submit(topology.getExeClass, config)
-            case m@_ =>
-              LOG.error("Unsupported topology type: " + topology.getType)
-          }
-        } catch {
-          case ex: Throwable =>
-            LOG.error(s"topology $topologyName in local mode is interrupted with ${ex.toString}")
-        }
-      }
-    })
-    topologyExecution.setFullName(topologyName)
-    topologyExecution.setStatus(ApplicationManager.getWorkerStatus(worker.getState))
-    topologyExecution.setDescription("Running inside " + worker.toString + " in local mode")
-  }
-
-  override def start(topology: TopologyDescriptionEntity, topologyExecution: TopologyExecutionEntity, config: Config): Unit = {
-    val stormJarPath: String = URLDecoder.decode(classOf[ExecutionPlatform].getProtectionDomain.getCodeSource.getLocation.getPath, "UTF-8")
-    if (stormJarPath == null || !Files.exists(Paths.get(stormJarPath)) || !stormJarPath.endsWith(".jar")) {
-      val errMsg = s"storm jar file $stormJarPath does not exists, or is a invalid jar file"
-      LOG.error(errMsg)
-      throw new Exception(errMsg)
-    }
-    LOG.info(s"Detected a storm.jar location at: $stormJarPath")
-    System.setProperty("storm.jar", stormJarPath)
-
-    val fullName = ApplicationManagerUtils.generateTopologyFullName(topologyExecution)
-    val extConfigStr = "envContextConfig.topologyName=%s".format(fullName)
-    val extConfig = ConfigFactory.parseString(extConfigStr)
-    val newConfig = extConfig.withFallback(config)
-
-    val mode = if(config.hasPath(AppManagerConstants.RUNNING_MODE)) config.getString(AppManagerConstants.RUNNING_MODE) else EagleConfigConstants.LOCAL_MODE
-    topologyExecution.setMode(mode)
-    if (topologyExecution.getMode.equalsIgnoreCase(EagleConfigConstants.LOCAL_MODE)) {
-      startLocal(fullName, topology, topologyExecution, newConfig)
-      return
-    }
-
-    val topologyType = topology.getType.toUpperCase()
-    topologyType match {
-      case TopologyDescriptionEntity.TYPE.CLASS =>
-        TopologyFactory.submit(topology.getExeClass, newConfig)
-      case TopologyDescriptionEntity.TYPE.DYNAMIC =>
-        StormDynamicTopology.submit(topology.getExeClass, newConfig)
-      case m@_ =>
-        throw new InvalidTopologyException("Unsupported topology type: " + topology.getType)
-    }
-    topologyExecution.setFullName(fullName)
-    //topologyExecution.setStatus(TopologyExecutionStatus.STARTED)
-  }
-
-  override def stop(topologyExecution: TopologyExecutionEntity, config: Config): Unit = {
-    val name: String = ApplicationManagerUtils.generateTopologyFullName(topologyExecution)
-
-    if(topologyExecution.getMode.equalsIgnoreCase(EagleConfigConstants.LOCAL_MODE)) {
-      stopLocal(name, topologyExecution)
-    } else {
-      getNimbusClient(config).getClient.killTopology(name)
-      topologyExecution.setStatus(TopologyExecutionStatus.STOPPING)
-      //topologyExecution.setDescription("")
-    }
-  }
-
-  def stopLocal(name: String, topologyExecution: TopologyExecutionEntity): Unit = {
-      val taskWorker = ApplicationManager.stop(name)
-      topologyExecution.setStatus(ApplicationManager.getWorkerStatus(taskWorker.getState))
-      topologyExecution.setDescription(s"topology status is ${taskWorker.getState}")
-      /*try{
-        ApplicationManager.remove(name)
-      } catch {
-        case ex: IllegalArgumentException =>
-          LOG.warn(s"ApplicationManager.remove($name) failed as it has been removed")
-      }*/
-  }
-
-
-  def getTopology(topologyName: String, config: Config) = {
-    val topologySummery = getNimbusClient(config).getClient.getClusterInfo.get_topologies
-    JavaConversions.collectionAsScalaIterable(topologySummery).find { t => t.get_name.equals(topologyName) }
-    match {
-      case Some(t) => Some(t)
-      case None    => None
-    }
-  }
-
-  override def status(topologyExecution: TopologyExecutionEntity, config: Config): Unit = {
-    val name: String = ApplicationManagerUtils.generateTopologyFullName(topologyExecution)
-
-    if(topologyExecution.getMode.equalsIgnoreCase(EagleConfigConstants.LOCAL_MODE)) {
-      statusLocal(name, topologyExecution)
-    } else {
-      val topology = getTopology(name, config)
-      topology match {
-        case Some(topology) =>
-          topologyExecution.setStatus(ApplicationManager.getTopologyStatus(topology.get_status()))
-          topologyExecution.setUrl(ApplicationManagerUtils.buildStormTopologyURL(config, topology.get_id()))
-          topologyExecution.setDescription(topology.toString)
-        case None =>
-          topologyExecution.setStatus(TopologyExecutionStatus.STOPPED)
-          topologyExecution.setUrl("")
-          topologyExecution.setDescription("")
-      }
-    }
-  }
-
-  def statusLocal(name: String, topologyExecution: TopologyExecutionEntity): Unit = {
-    try {
-      val currentStatus = topologyExecution.getStatus()
-      val newStatus = ApplicationManager.getWorkerStatus(ApplicationManager.get(name).getState())
-      if (!currentStatus.equals(newStatus)) {
-        LOG.info("Status of topology: %s changed from %s to %s".format(topologyExecution.getFullName, currentStatus, newStatus))
-        topologyExecution.setStatus(newStatus)
-        topologyExecution.setDescription(String.format("Status of topology: %s changed from %s to %s", name, currentStatus, newStatus))
-      } else if(currentStatus.equalsIgnoreCase(TopologyExecutionStatus.STOPPED)) {
-        ApplicationManager.remove(name)
-      }
-    }catch {
-      case ex: Throwable =>
-        topologyExecution.setDescription("")
-        topologyExecution.setStatus(TopologyExecutionStatus.STOPPED)
-    }
-  }
-
-  override def status(topologyExecutions: java.util.List[TopologyExecutionEntity], config: Config): Unit = {
-    JavaConversions.collectionAsScalaIterable(topologyExecutions) foreach {
-      topologyExecution => status(topologyExecution, config)
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandExecutor.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandExecutor.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandExecutor.scala
deleted file mode 100644
index 8fbf60d..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandExecutor.scala
+++ /dev/null
@@ -1,170 +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 java.util.concurrent.Callable
-
-import akka.actor.{Actor, ActorLogging}
-import akka.dispatch.Futures
-import com.typesafe.config.{Config, ConfigFactory, ConfigParseOptions, ConfigSyntax}
-import org.apache.eagle.common.config.EagleConfigConstants
-import org.apache.eagle.service.application.AppManagerConstants
-import org.apache.eagle.service.application.entity.TopologyOperationEntity.OPERATION
-import org.apache.eagle.service.application.entity.{TopologyExecutionEntity, TopologyExecutionStatus, TopologyOperationEntity}
-import org.apache.eagle.stream.application.{ApplicationSchedulerAsyncDAO, ExecutionPlatformFactory}
-
-import scala.collection.JavaConversions
-import scala.util.{Failure, Success}
-
-
-private[scheduler] class AppCommandExecutor extends Actor with ActorLogging {
-  @volatile var _config: Config = _
-  @volatile var _dao: ApplicationSchedulerAsyncDAO = _
-
-  import context.dispatcher
-
-  def start(topologyExecution: TopologyExecutionEntity, topologyOperation: TopologyOperationEntity) = {
-    val options: ConfigParseOptions = ConfigParseOptions.defaults.setSyntax(ConfigSyntax.PROPERTIES).setAllowMissing(false)
-    _dao.loadTopologyDescriptionByName(topologyOperation.getSite, topologyOperation.getApplication, topologyOperation.getTopology) onComplete {
-      case Success(topology) =>
-        val topologyConfig: Config = ConfigFactory.parseString(topology.getContext, options)
-
-        if(!topologyConfig.hasPath(EagleConfigConstants.APP_CONFIG)) {
-          topologyOperation.setMessage("Fail to detect topology configuration")
-          topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.FAILED)
-          _dao.updateOperationStatus(topologyOperation)
-        } else {
-          val config = topologyConfig.getConfig(EagleConfigConstants.APP_CONFIG).withFallback(_config)
-          val clusterType = if(config.hasPath(AppManagerConstants.CLUSTER_ENV)) config.getString(AppManagerConstants.CLUSTER_ENV) else AppManagerConstants.EAGLE_CLUSTER_STORM
-          topologyExecution.setEnvironment(clusterType)
-
-          Futures.future(new Callable[TopologyExecutionEntity]{
-            override def call(): TopologyExecutionEntity = {
-              topologyExecution.setStatus(TopologyExecutionStatus.STARTING)
-              _dao.updateTopologyExecutionStatus(topologyExecution)
-              ExecutionPlatformFactory.getApplicationManager(clusterType).start(topology, topologyExecution, config)
-              topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.SUCCESS)
-              topologyExecution
-            }
-          }, context.dispatcher) onComplete {
-            case Success(topologyExecutionEntity) =>
-              topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.SUCCESS)
-              updateStatus(topologyExecution, topologyOperation)
-            case Failure(ex) =>
-              topologyOperation.setMessage(ex.getMessage)
-              topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.FAILED)
-              _dao.updateOperationStatus(topologyOperation)
-          }
-        }
-
-      case Failure(ex) =>
-        topologyOperation.setMessage(ex.getMessage)
-        topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.FAILED)
-        _dao.updateOperationStatus(topologyOperation)
-    }
-  }
-
-  def stop(topologyExecution: TopologyExecutionEntity, topologyOperation: TopologyOperationEntity) = {
-    val clusterType = topologyExecution.getEnvironment
-
-    Futures.future(new Callable[TopologyExecutionEntity]{
-      override def call(): TopologyExecutionEntity = {
-        topologyExecution.setStatus(TopologyExecutionStatus.STOPPING)
-        _dao.updateTopologyExecutionStatus(topologyExecution)
-        ExecutionPlatformFactory.getApplicationManager(clusterType).stop(topologyExecution, _config)
-        topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.SUCCESS)
-        topologyExecution
-      }
-    }, context.dispatcher) onComplete {
-      case Success(topologyExecutionEntity) =>
-        topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.SUCCESS)
-        updateStatus(topologyExecution, topologyOperation)
-      case Failure(ex) =>
-        topologyOperation.setMessage(ex.toString)
-        topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.FAILED)
-        _dao.updateOperationStatus(topologyOperation)
-    }
-  }
-
-  def status(topologyExecution: TopologyExecutionEntity) = {
-    val clusterType = topologyExecution.getEnvironment
-
-    Futures.future(new Callable[TopologyExecutionEntity]{
-      override def call(): TopologyExecutionEntity = {
-        ExecutionPlatformFactory.getApplicationManager(clusterType).status(topologyExecution, _config)
-        topologyExecution
-      }
-    }, context.dispatcher) onComplete {
-      case _ =>
-        _dao.updateTopologyExecutionStatus(topologyExecution)
-    }
-  }
-
-  def updateStatus(topologyExecution: TopologyExecutionEntity, topologyOperation: TopologyOperationEntity): Unit = {
-    _dao.updateOperationStatus(topologyOperation)
-    _dao.updateTopologyExecutionStatus(topologyExecution)
-  }
-
-  def execute(topologyExecution: TopologyExecutionEntity, topologyOperation: TopologyOperationEntity): Unit = {
-    try {
-      topologyOperation.getOperation match {
-        case OPERATION.START =>
-          start(topologyExecution, topologyOperation)
-        case OPERATION.STOP =>
-          stop(topologyExecution, topologyOperation)
-        case m@_ =>
-          log.warning("Unsupported operation: " + topologyOperation)
-          throw new Exception(s"Unsupported operation: ${topologyOperation.getOperation}, possible values are START/STOP")
-      }
-    } catch {
-      case e: Throwable =>
-        topologyOperation.setMessage(e.getMessage)
-        topologyOperation.setStatus(TopologyOperationEntity.OPERATION_STATUS.FAILED)
-        _dao.updateOperationStatus(topologyOperation)
-    }
-  }
-
-  override def receive = {
-    case InitializationEvent(config: Config) =>
-      _config = config
-      _dao = new ApplicationSchedulerAsyncDAO(config, context.dispatcher)
-    case SchedulerCommand(topologyExecution, topologyOperation) =>
-      execute(topologyExecution, topologyOperation)
-    case HealthCheckerEvent =>
-      _dao.loadAllTopologyExecutionEntities() onComplete {
-        case Success(topologyExecutions) =>
-          log.info(s"Load ${topologyExecutions.size()} topologies in execution")
-          JavaConversions.collectionAsScalaIterable(topologyExecutions) foreach { topologyExecution =>
-            try{
-              status(topologyExecution)
-            } catch {
-              case ex: Throwable =>
-                log.error(ex.getMessage)
-            }
-          }
-        case Failure(ex) =>
-          log.error(s"Fail to load any topologyExecutionEntity due to Exception: ${ex.getMessage}")
-      }
-    case TerminatedEvent =>
-      context.stop(self)
-    case m@_ =>
-      log.warning("Unsupported operation $m")
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandLoader.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandLoader.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandLoader.scala
deleted file mode 100644
index c731846..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/AppCommandLoader.scala
+++ /dev/null
@@ -1,78 +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.{Actor, ActorLogging}
-import com.typesafe.config.Config
-import org.apache.eagle.service.application.entity.TopologyOperationEntity.OPERATION_STATUS
-import org.apache.eagle.stream.application.ApplicationSchedulerAsyncDAO
-
-import scala.collection.JavaConversions
-import scala.util.{Failure, Success}
-
-
-private[scheduler] class AppCommandLoader extends Actor with ActorLogging {
-  @volatile var _config: Config = null
-  @volatile var _dao: ApplicationSchedulerAsyncDAO = null
-
-  import context.dispatcher
-
-  override def receive = {
-    case InitializationEvent(config: Config) =>
-      _config = config
-      _dao = new ApplicationSchedulerAsyncDAO(config, context.dispatcher)
-    case ClearPendingOperation =>
-      if(_dao == null) _dao = new ApplicationSchedulerAsyncDAO(_config, context.dispatcher)
-      _dao.clearPendingOperations()
-    case CommandLoaderEvent => {
-      val _sender = sender()
-      _dao.readOperationsByStatus(OPERATION_STATUS.INITIALIZED) onComplete {
-        case Success(commands) => {
-          log.info(s"Load ${commands.size()} new commands")
-          JavaConversions.collectionAsScalaIterable(commands) foreach { command =>
-            command.setStatus(OPERATION_STATUS.PENDING)
-            _dao.updateOperationStatus(command) onComplete {
-              case Success(response) =>
-                _dao.loadTopologyExecutionByName(command.getSite, command.getApplication, command.getTopology) onComplete {
-                  case Success(topologyExecution) => {
-                    _sender ! SchedulerCommand(topologyExecution, command)
-                  }
-                  case Failure(ex) =>
-                    log.error(ex.getMessage)
-                    command.setMessage(ex.getMessage)
-                    command.setStatus(OPERATION_STATUS.FAILED)
-                    _dao.updateOperationStatus(command)
-                }
-              case Failure(ex) =>
-                log.error(s"Got an exception to update command status $command: ${ex.getMessage}")
-                command.setMessage(ex.getMessage)
-                command.setStatus(OPERATION_STATUS.FAILED)
-                _dao.updateOperationStatus(command)
-            }
-          }
-        }
-        case Failure(ex) =>
-          log.error(s"Failed to get commands due to exception ${ex.getMessage}")
-      }
-    }
-    case TerminatedEvent =>
-      context.stop(self)
-    case m@_ => throw new UnsupportedOperationException(s"Event is not supported $m")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/ApplicationScheduler.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/ApplicationScheduler.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/ApplicationScheduler.scala
deleted file mode 100644
index 476a3fb..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/ApplicationScheduler.scala
+++ /dev/null
@@ -1,81 +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 com.typesafe.config.Config
-import org.apache.eagle.service.application.AppManagerConstants
-import org.apache.eagle.service.application.entity.{TopologyExecutionEntity, TopologyOperationEntity}
-import org.apache.eagle.stream.application.ApplicationManager
-
-import scala.concurrent.duration._
-
-
-private[scheduler] class ScheduleEvent
-private[scheduler] case class InitializationEvent(config: Config) extends ScheduleEvent
-private[scheduler] case class TerminatedEvent() extends ScheduleEvent
-private[scheduler] case class CommandLoaderEvent() extends ScheduleEvent
-private[scheduler] case class HealthCheckerEvent() extends ScheduleEvent
-private[scheduler] case class ClearPendingOperation() extends ScheduleEvent
-private[scheduler] case class SchedulerCommand(topologyExecution: TopologyExecutionEntity, topologyOperation: TopologyOperationEntity) extends ScheduleEvent
-
-case class EagleServiceUnavailableException(message:String) extends Exception(message)
-case class DuplicatedDefinitionException(message:String) extends Exception(message)
-case class LoadTopologyFailureException(message:String) extends Exception(message)
-
-
-/**
- * 1. Sync command from eagle service
- * 2. Coordinate command to different actor
- * 3. Actor execute command as requested
- */
-class ApplicationScheduler {
-  //val config = ConfigFactory.load()
-  val DEFAULT_COMMAND_LOADER_INTERVAL_SECS = 2
-  val DEFAULT_HEALTH_CHECK_INTERVAL_SECS = 5
-
-  def start(config: Config) = {
-    val system = ActorSystem("application-manager-scheduler", config)
-    system.log.info(s"Started actor system: $system")
-
-    import system.dispatcher
-
-    val commandLoaderIntervalSecs: Long = if(config.hasPath(AppManagerConstants.APP_COMMAND_LOADER_INTERVAL_SECS)) config.getLong(AppManagerConstants.APP_COMMAND_LOADER_INTERVAL_SECS) else DEFAULT_COMMAND_LOADER_INTERVAL_SECS
-    val healthCheckIntervalSecs: Long = if(config.hasPath(AppManagerConstants.APP_HEALTH_CHECK_INTERVAL_SECS)) config.getLong(AppManagerConstants.APP_HEALTH_CHECK_INTERVAL_SECS) else DEFAULT_HEALTH_CHECK_INTERVAL_SECS
-
-    val coordinator = system.actorOf(Props[StreamAppCoordinator])
-    system.scheduler.scheduleOnce(0 seconds, coordinator, InitializationEvent(config))
-    system.scheduler.scheduleOnce(1 seconds, coordinator, ClearPendingOperation)
-    system.scheduler.schedule(2.seconds, commandLoaderIntervalSecs.seconds, coordinator, CommandLoaderEvent)
-    system.scheduler.schedule(10.seconds, healthCheckIntervalSecs.seconds, coordinator, HealthCheckerEvent)
-
-    /*
-     registerOnTermination is called when you have shut down the ActorSystem (system.shutdown),
-     and the callbacks will be executed after all actors have been stopped.
-     */
-    system.registerOnTermination(new Runnable {
-      override def run(): Unit = {
-        coordinator ! TerminatedEvent
-        ApplicationManager.stopAll()
-      }
-    })
-    system
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/StreamAppCoordinator.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/StreamAppCoordinator.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/StreamAppCoordinator.scala
deleted file mode 100644
index 17006ee..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/main/scala/org/apache/eagle/stream/application/scheduler/StreamAppCoordinator.scala
+++ /dev/null
@@ -1,54 +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.{Actor, ActorLogging, ActorRef, Props}
-
-private[scheduler] class StreamAppCoordinator extends Actor with ActorLogging {
-  var commandLoader: ActorRef = null
-  var commandExecutor: ActorRef = null
-
-
-  override def preStart(): Unit = {
-    commandLoader = context.actorOf(Props[AppCommandLoader], "command-loader")
-    commandExecutor = context.actorOf(Props[AppCommandExecutor], "command-worker")
-  }
-
-  override def receive = {
-    case InitializationEvent(config) => {
-      log.info(s"Config updated: $config")
-      commandLoader ! InitializationEvent(config)
-      commandExecutor ! InitializationEvent(config)
-    }
-    case ClearPendingOperation =>
-      commandLoader ! ClearPendingOperation
-    case CommandLoaderEvent =>
-      commandLoader ! CommandLoaderEvent
-    case command: SchedulerCommand =>
-      log.info(s"Executing command: $SchedulerCommand")
-      commandExecutor ! command
-    case HealthCheckerEvent =>
-      commandExecutor ! HealthCheckerEvent
-    case TerminatedEvent =>
-      log.info("Coordinator exit ...")
-      context.stop(self)
-    case m@_ =>
-      log.warning(s"Coordinator Unsupported message: $m")
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/resources/application.conf b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/resources/application.conf
deleted file mode 100644
index 4c21a7c..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/resources/application.conf
+++ /dev/null
@@ -1,42 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-### scheduler propertise
-appCommandLoaderIntervalSecs = 1
-appHealthCheckIntervalSecs = 5
-
-### execution platform properties
-envContextConfig.env = "storm"
-envContextConfig.url = "http://sandbox.hortonworks.com:8744"
-envContextConfig.nimbusHost = "sandbox.hortonworks.com"
-envContextConfig.nimbusThriftPort = 6627
-envContextConfig.jarFile = "/dir-to-jar/eagle-topology-0.3.0-incubating-assembly.jar"
-
-### default topology properties
-eagleProps.mailHost = "mailHost.com"
-eagleProps.mailSmtpPort = "25"
-eagleProps.mailDebug = "true"
-eagleProps.eagleService.host = "localhost"
-eagleProps.eagleService.port = 9099
-eagleProps.eagleService.username = "admin"
-eagleProps.eagleService.password = "secret"
-eagleProps.dataJoinPollIntervalSec = 30
-
-dynamicConfigSource.enabled = true
-dynamicConfigSource.initDelayMillis = 0
-dynamicConfigSource.delayMillis = 30000
-
-

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/resources/log4j.properties b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/resources/log4j.properties
deleted file mode 100644
index 25331ab..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-log4j.rootLogger=INFO, stdout
-
- eagle.log.dir=../logs
- eagle.log.file=eagle.log
-
-# standard output
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n
-
-# Daily Rolling File Appender
- log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender
- log4j.appender.DRFA.File=${eagle.log.dir}/${eagle.log.file}
- log4j.appender.DRFA.DatePattern=.yyyy-MM-dd
-## 30-day backup
-# log4j.appender.DRFA.MaxBackupIndex=30
- log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout
-
-# Pattern format: Date LogLevel LoggerName LogMessage
-log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/MockTopology.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/MockTopology.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/MockTopology.scala
deleted file mode 100644
index e87ee92..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/MockTopology.scala
+++ /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 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 com.typesafe.config.Config
-import org.apache.eagle.stream.application.TopologyExecutable
-import org.slf4j.LoggerFactory
-
-class MockTopology extends TopologyExecutable {
-  private val LOG = LoggerFactory.getLogger(classOf[MockTopology])
-  override def submit(topology: String, config: Config): Unit = {
-    LOG.info(s"$topology is running")
-  }
-}
\ No newline at end of file

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/StormApplicationManagerSpec.scala
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/StormApplicationManagerSpec.scala b/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/StormApplicationManagerSpec.scala
deleted file mode 100644
index 1cad3a7..0000000
--- a/eagle-core/eagle-application-management/eagle-stream-application-manager/src/test/scala/org/apache/eagle/stream/application/scheduler/StormApplicationManagerSpec.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.apache.eagle.stream.application.scheduler
-
-import com.typesafe.config.ConfigFactory
-import org.apache.eagle.common.config.EagleConfigConstants
-import org.apache.eagle.stream.application.ExecutionPlatform
-import org.apache.eagle.stream.application.impl.StormExecutionPlatform
-
-/*
- * 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 StormApplicationManagerSpec extends App {
-  val manager: ExecutionPlatform = new StormExecutionPlatform
-  val baseConfig = ConfigFactory.load()
-  val topoConfigStr: String = "webConfig{\"hbase.zookeeper.property.clientPort\":\"2181\", \"hbase.zookeeper.quorum\":\"localhost\"}\nappConfig{\n  \"envContextConfig\" : {\n    \"env\" : \"storm\",\n    \"mode\" : \"cluster\",\n    \"topologyName\" : \"sandbox-hbaseSecurityLog-topology\",\n    \"stormConfigFile\" : \"security-auditlog-storm.yaml\",\n    \"parallelismConfig\" : {\n      \"kafkaMsgConsumer\" : 1,\n      \"hbaseSecurityLogAlertExecutor*\" : 1\n    }\n  },\n  \"dataSourceConfig\": {\n    \"topic\" : \"sandbox_hbase_security_log\",\n    \"zkConnection\" : \"127.0.0.1:2181\",\n    \"zkConnectionTimeoutMS\" : 15000,\n    \"brokerZkPath\" : \"/brokers\",\n    \"fetchSize\" : 1048586,\n    \"deserializerClass\" : \"org.apache.eagle.security.hbase.parse.HbaseAuditLogKafkaDeserializer\",\n    \"transactionZKServers\" : \"127.0.0.1\",\n    \"transactionZKPort\" : 2181,\n    \"transactionZKRoot\" : \"/consumers\",\n    \"consumerGroupId\" : \"eagle.hbasesecurity.consumer\",\n  
   \"transactionStateUpdateMS\" : 2000\n  },\n  \"alertExecutorConfigs\" : {\n     \"hbaseSecurityLogAlertExecutor\" : {\n       \"parallelism\" : 1,\n       \"partitioner\" : \"org.apache.eagle.policy.DefaultPolicyPartitioner\"\n       \"needValidation\" : \"true\"\n     }\n  },\n  \"eagleProps\" : {\n    \"site\" : \"sandbox\",\n    \"application\": \"hbaseSecurityLog\",\n    \"dataJoinPollIntervalSec\" : 30,\n    \"mailHost\" : \"mailHost.com\",\n    \"mailSmtpPort\":\"25\",\n    \"mailDebug\" : \"true\",\n    \"eagleService\": {\n      \"host\": \"localhost\",\n      \"port\": 9099\n      \"username\": \"admin\",\n      \"password\": \"secret\"\n    }\n  },\n  \"dynamicConfigSource\" : {\n    \"enabled\" : true,\n    \"initDelayMillis\" : 0,\n    \"delayMillis\" : 30000\n  }\n}"
-
-  val topoConfig = ConfigFactory.parseString(topoConfigStr)
-  val conf = topoConfig.getConfig(EagleConfigConstants.APP_CONFIG).withFallback(baseConfig)
-
-  //val (ret, nextState) = manager.execute("START", topologyDescModel, null, conf)
-  //println(s"Result: ret=$ret, nextState=$nextState")
-}
-
-
-



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

Posted by ha...@apache.org.
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 0000000..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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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<String,ApplicationProvider> 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<ApplicationProvider> 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 0000000..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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 org.apache.eagle.app.Application;
+import org.apache.eagle.app.spi.ApplicationProvider;
+import org.apache.eagle.app.config.ApplicationProviderConfig;
+import org.apache.eagle.metadata.service.ApplicationDescService;
+
+import java.util.Collection;
+
+public interface ApplicationProviderService extends ApplicationDescService {
+    void reload();
+    Collection<ApplicationProvider> getProviders();
+    <T extends Application> ApplicationProvider<T> getApplicationProviderByType(String type);
+}
\ No newline at end of file

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/ApplicationProviderServiceImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderServiceImpl.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderServiceImpl.java
new file mode 100644
index 0000000..6ce463f
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationProviderServiceImpl.java
@@ -0,0 +1,87 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.typesafe.config.Config;
+import org.apache.eagle.app.spi.ApplicationProvider;
+import org.apache.eagle.metadata.model.ApplicationDesc;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * Support to load application provider from application.provider.config = "providers.xml" configuration file
+ * or application.provider.dir = "lib/apps" with SPI Class loader
+ *
+ * TODO: hot-manage application provider loading
+ */
+@Singleton
+public class ApplicationProviderServiceImpl implements ApplicationProviderService {
+    private final Config config;
+    private final static Logger LOG = LoggerFactory.getLogger(ApplicationProviderServiceImpl.class);
+    private final ApplicationProviderLoader appProviderLoader;
+    public final static String APP_PROVIDER_LOADER_CLASS_KEY = "application.provider.loader";
+
+    @Inject
+    public ApplicationProviderServiceImpl(Config config){
+        LOG.info("Initializing {}",this.getClass().getCanonicalName());
+        this.config = config;
+        String appProviderLoaderClass = this.config.hasPath(APP_PROVIDER_LOADER_CLASS_KEY)?
+                this.config.getString(APP_PROVIDER_LOADER_CLASS_KEY):ApplicationProviderLoader.getDefaultAppProviderLoader();
+        LOG.info("Initializing {} = {}",APP_PROVIDER_LOADER_CLASS_KEY,appProviderLoaderClass);
+        appProviderLoader = initializeAppProviderLoader(appProviderLoaderClass);
+        LOG.info("Initialized {}",appProviderLoader);
+        reload();
+    }
+
+    private ApplicationProviderLoader initializeAppProviderLoader(String appProviderLoaderClass){
+        try {
+            return (ApplicationProviderLoader) Class.forName(appProviderLoaderClass).getConstructor(Config.class).newInstance(this.config);
+        } catch (Throwable e) {
+            LOG.error("Failed to initialize ApplicationProviderLoader: "+appProviderLoaderClass,e);
+            throw new IllegalStateException("Failed to initialize ApplicationProviderLoader: "+appProviderLoaderClass,e);
+        }
+    }
+
+    public synchronized void reload(){
+        appProviderLoader.reset();
+        LOG.info("Loading application providers ...");
+        appProviderLoader.load();
+        LOG.info("Loaded {} application providers",appProviderLoader.getProviders().size());
+    }
+
+    public Collection<ApplicationProvider> getProviders(){
+        return appProviderLoader.getProviders();
+    }
+
+    public Collection<ApplicationDesc> getApplicationDescs(){
+        return getProviders().stream().map(ApplicationProvider::getApplicationDesc).collect(Collectors.toList());
+    }
+
+    public ApplicationProvider<?> getApplicationProviderByType(String type) {
+        return appProviderLoader.getApplicationProviderByType(type);
+    }
+
+    @Deprecated
+    public ApplicationDesc getApplicationDescByType(String appType) {
+        return appProviderLoader.getApplicationProviderByType(appType).getApplicationDesc();
+    }
+}
\ No newline at end of file

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/loader/ApplicationProviderConfigLoader.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/loader/ApplicationProviderConfigLoader.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/loader/ApplicationProviderConfigLoader.java
new file mode 100644
index 0000000..11d9905
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/loader/ApplicationProviderConfigLoader.java
@@ -0,0 +1,128 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.loader;
+
+import com.google.common.base.Preconditions;
+import com.typesafe.config.Config;
+import org.apache.eagle.app.config.ApplicationProviderConfig;
+import org.apache.eagle.app.config.ApplicationProvidersConfig;
+import org.apache.eagle.app.service.ApplicationProviderLoader;
+import org.apache.eagle.app.spi.ApplicationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+public class ApplicationProviderConfigLoader extends ApplicationProviderLoader {
+    public final static String DEFAULT_APPLICATIONS_CONFIG_FILE = "providers.xml";
+    private final static String APPLICATIONS_CONFIG_PROPS_KEY = "application.provider.config";
+    private final static Logger LOG = LoggerFactory.getLogger(ApplicationProviderConfigLoader.class);
+    public ApplicationProviderConfigLoader(Config config) {
+        super(config);
+    }
+
+    @Override
+    public void load() {
+        List<ApplicationProviderConfig> applicationProviderConfigs = loadProvidersFromProvidersConf();
+        int totalCount = applicationProviderConfigs.size();
+        int loadedCount = 0,failedCount = 0;
+        for(ApplicationProviderConfig providerConfig: applicationProviderConfigs){
+            try {
+                initializeProvider(providerConfig);
+                loadedCount ++;
+            }catch (Throwable ex){
+                LOG.warn("Failed to initialized {}, ignored",providerConfig,ex);
+                failedCount ++;
+            }
+        }
+        LOG.info("Loaded {} app providers (total: {}, failed: {})",loadedCount,totalCount,failedCount);
+    }
+
+    public static boolean appProviderConfExists(String applicationConfFile){
+        InputStream is = ApplicationProviderConfigLoader.class.getResourceAsStream(applicationConfFile);
+        if(is == null){
+            is = ApplicationProviderConfigLoader.class.getResourceAsStream("/"+applicationConfFile);
+        }
+
+        if(is != null){
+            try {
+                return true;
+            } finally {
+                try {
+                    is.close();
+                } catch (IOException e) {
+                    LOG.debug(e.getMessage());
+                }
+            }
+        } else {
+            return false;
+        }
+    }
+
+    private void initializeProvider(ApplicationProviderConfig providerConfig) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
+        LOG.info("Loading application provider {} from {}",providerConfig.getClassName(),providerConfig.getJarPath());
+        String providerClassName = providerConfig.getClassName();
+        if(providerClassName == null) throw new RuntimeException("provider.classname is null: "+providerConfig);
+        if(providerConfig.getJarPath() == null) throw new RuntimeException("provider.jarpath is null: "+providerConfig);
+
+        Class<?> providerClass = Class.forName(providerClassName);
+
+        if(!ApplicationProvider.class.isAssignableFrom(providerClass)){
+            throw new RuntimeException("providerClassName is not implementation of "+ApplicationProvider.class.getCanonicalName());
+        }
+        ApplicationProvider provider = (ApplicationProvider) providerClass.newInstance();
+        provider.prepare(providerConfig,this.getConfig());
+        Preconditions.checkNotNull(provider.getApplicationDesc(),"appDesc is null");
+        Preconditions.checkNotNull(provider.getApplicationDesc().getType(),"type is null");
+        registerProvider(provider);
+    }
+
+    private List<ApplicationProviderConfig> loadProvidersFromProvidersConf() {
+        String providerConfigFile = DEFAULT_APPLICATIONS_CONFIG_FILE;
+        if(getConfig().hasPath(APPLICATIONS_CONFIG_PROPS_KEY)){
+            providerConfigFile = getConfig().getString(APPLICATIONS_CONFIG_PROPS_KEY);
+            LOG.info("Set {} = {}",APPLICATIONS_CONFIG_PROPS_KEY,providerConfigFile);
+        }
+        InputStream is = null;
+        try {
+            JAXBContext jc = JAXBContext.newInstance(ApplicationProvidersConfig.class);
+            Unmarshaller unmarshaller = jc.createUnmarshaller();
+            is = ApplicationProviderConfigLoader.class.getResourceAsStream(providerConfigFile);
+            if(is == null){
+                is = ApplicationProviderConfigLoader.class.getResourceAsStream("/"+providerConfigFile);
+            }
+            if(is == null){
+                LOG.error("Application provider configuration {} is not found",providerConfigFile);
+            }
+            Preconditions.checkNotNull(is,providerConfigFile+" is not found");
+            return ((ApplicationProvidersConfig) unmarshaller.unmarshal(is)).getProviders();
+        }catch (Exception ex){
+            LOG.error("Failed to load application provider configuration: {}",providerConfigFile,ex);
+            throw new RuntimeException("Failed to load application provider configuration: "+providerConfigFile,ex);
+        } finally {
+            if(is != null) try {
+                is.close();
+            } catch (IOException e) {
+                LOG.error(e.getMessage(),e);
+            }
+        }
+    }
+}
\ No newline at end of file

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/loader/ApplicationProviderSPILoader.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/loader/ApplicationProviderSPILoader.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/loader/ApplicationProviderSPILoader.java
new file mode 100644
index 0000000..33cb401
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/loader/ApplicationProviderSPILoader.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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.loader;
+
+import com.typesafe.config.Config;
+import org.apache.eagle.app.config.ApplicationProviderConfig;
+import org.apache.eagle.app.service.ApplicationProviderLoader;
+import org.apache.eagle.app.spi.ApplicationProvider;
+import org.apache.eagle.app.tools.DynamicJarPathFinder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ServiceLoader;
+import java.util.function.Function;
+
+public class ApplicationProviderSPILoader extends ApplicationProviderLoader{
+    private final String appProviderExtDir;
+    private final static Logger LOG = LoggerFactory.getLogger(ApplicationProviderSPILoader.class);
+    private final static String APPLICATIONS_DIR_PROPS_KEY = "application.provider.dir";
+
+    public ApplicationProviderSPILoader(Config config) {
+        super(config);
+        if(config.hasPath(APPLICATIONS_DIR_PROPS_KEY)) {
+            this.appProviderExtDir = config.getString(APPLICATIONS_DIR_PROPS_KEY);
+        }else{
+            this.appProviderExtDir = null;
+        }
+
+        LOG.info("Using {}: {}",APPLICATIONS_DIR_PROPS_KEY,this.appProviderExtDir);
+
+    }
+
+    @Override
+    public void load() {
+        if(appProviderExtDir != null) {
+            LOG.info("Loading application providers from class loader of jars in {}", appProviderExtDir);
+            File loc = new File(appProviderExtDir);
+            File[] jarFiles = loc.listFiles(file -> file.getPath().toLowerCase().endsWith(".jar"));
+            if (jarFiles != null) {
+                for (File jarFile : jarFiles) {
+                    try {
+                        URL jarFileUrl = jarFile.toURI().toURL();
+                        LOG.debug("Loading ApplicationProvider from jar: {}", jarFileUrl.toString());
+                        URLClassLoader jarFileClassLoader = new URLClassLoader(new URL[]{jarFileUrl});
+                        loadProviderFromClassLoader(jarFileClassLoader, (applicationProviderConfig) -> jarFileUrl.getPath());
+                    } catch (Exception e) {
+                        LOG.warn("Failed to load application provider from jar {}", jarFile,e);
+                    }
+                }
+            }
+        } else {
+            LOG.info("Loading application providers from context class loader");
+            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+            loadProviderFromClassLoader(classLoader,(applicationProviderConfig) -> DynamicJarPathFinder.findPath(applicationProviderConfig.getClass()));
+        }
+    }
+
+    private void loadProviderFromClassLoader(ClassLoader jarFileClassLoader, Function<ApplicationProviderConfig,String> jarFileSupplier){
+        ServiceLoader<ApplicationProvider> serviceLoader = ServiceLoader.load(ApplicationProvider.class, jarFileClassLoader);
+        for (ApplicationProvider applicationProvider : serviceLoader) {
+            try {
+                ApplicationProviderConfig providerConfig = new ApplicationProviderConfig();
+                providerConfig.setClassName(applicationProvider.getClass().getCanonicalName());
+                providerConfig.setJarPath(jarFileSupplier.apply(providerConfig));
+                applicationProvider.prepare(providerConfig, getConfig());
+                registerProvider(applicationProvider);
+            }catch (Throwable ex){
+                LOG.warn("Failed to register application provider {}",applicationProvider,ex);
+            }
+        }
+    }
+}

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/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
new file mode 100644
index 0000000..eee2a70
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/KafkaStreamSink.java
@@ -0,0 +1,65 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.apache.eagle.alert.engine.model.StreamEvent;
+import org.apache.eagle.app.ApplicationContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class KafkaStreamSink extends StreamSink {
+    private final static Logger LOGGER = LoggerFactory.getLogger(KafkaStreamSink.class);
+    private final 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(),
+                streamDefinition.getStreamId());
+    }
+
+    @Override
+    public void prepare(Map stormConf, TopologyContext context) {
+        super.prepare(stormConf, context);
+        ensureTopic();
+        // TODO: Create KafkaProducer
+    }
+
+    private void ensureTopic(){
+        LOGGER.info("TODO: ensure kafka topic {} created",this.topicId);
+    }
+
+    @Override
+    protected void onEvent(StreamEvent streamEvent) {
+        LOGGER.info("TODO: producing {}",streamEvent);
+    }
+
+    @Override
+    public Map<String, Object> getSinkContext() {
+        return new HashMap<String,Object>(){
+            {
+                put("kafka.topic",KafkaStreamSink.this.topicId);
+            }
+        };
+    }
+}
\ No newline at end of file

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/sink/LoggingStreamSink.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/LoggingStreamSink.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/LoggingStreamSink.java
new file mode 100644
index 0000000..ca201a8
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/LoggingStreamSink.java
@@ -0,0 +1,43 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.apache.eagle.alert.engine.model.StreamEvent;
+import org.apache.eagle.app.ApplicationContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class LoggingStreamSink extends StreamSink {
+    private final static Logger LOGGER = LoggerFactory.getLogger(KafkaStreamSink.class);
+    public LoggingStreamSink(StreamDefinition streamDefinition, ApplicationContext applicationContext) {
+        super(streamDefinition, applicationContext);
+    }
+
+    @Override
+    protected void onEvent(StreamEvent streamEvent) {
+        LOGGER.info("Receiving {}",streamEvent);
+    }
+
+    @Override
+    public Map<String, Object> getSinkContext() {
+        return new HashMap<>();
+    }
+}
\ No newline at end of file

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/sink/StreamSink.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/StreamSink.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/StreamSink.java
new file mode 100644
index 0000000..e0f2db2
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/StreamSink.java
@@ -0,0 +1,82 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.topology.base.BaseBasicBolt;
+import backtype.storm.tuple.Fields;
+import backtype.storm.tuple.Tuple;
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.apache.eagle.alert.engine.model.StreamEvent;
+import org.apache.eagle.app.ApplicationContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.Map;
+
+public abstract class StreamSink extends BaseBasicBolt {
+    private final static Logger LOG = LoggerFactory.getLogger(StreamSink.class);
+    public final static String KEY_FIELD = "KEY";
+    public final static String VALUE_FIELD = "VALUE";
+
+    public StreamSink(StreamDefinition streamDefinition,ApplicationContext applicationContext){
+        
+    }
+
+    @Override
+    public void prepare(Map stormConf, TopologyContext context) {
+        super.prepare(stormConf, context);
+    }
+
+    @Override
+    public void execute(Tuple input, BasicOutputCollector collector) {
+        List<Object> values = input.getValues();
+        Object inputValue;
+        if(values.size() == 1){
+            inputValue = values.get(0);
+        } else if(values.size() == 2){
+            inputValue = values.get(1);
+        } else{
+            collector.reportError(new IllegalStateException("Expect tuple in size of 1: <StreamEvent> or 2: <Object,StreamEvent>, but got "+values.size()+": "+values));
+            return;
+        }
+
+        if(inputValue instanceof StreamEvent){
+            try {
+                onEvent((StreamEvent) inputValue);
+            }catch (Exception e){
+                LOG.error("Failed to execute event {}",inputValue);
+                collector.reportError(e);
+            }
+        } else {
+            LOG.error("{} is not StreamEvent",inputValue);
+            collector.reportError(new IllegalStateException("Input tuple "+input+"is not type of StreamEvent"));
+        }
+    }
+
+    protected abstract void onEvent(StreamEvent streamEvent);
+
+    public abstract Map<String,Object> getSinkContext();
+
+    @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/e21b073f/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/AbstractApplicationProvider.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/AbstractApplicationProvider.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/AbstractApplicationProvider.java
new file mode 100644
index 0000000..37311eb
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/AbstractApplicationProvider.java
@@ -0,0 +1,144 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.spi;
+
+import com.typesafe.config.Config;
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.apache.eagle.app.Application;
+import org.apache.eagle.app.config.ApplicationProviderConfig;
+import org.apache.eagle.app.config.ApplicationProviderDescConfig;
+import org.apache.eagle.app.sink.KafkaStreamSink;
+import org.apache.eagle.app.sink.StreamSink;
+import org.apache.eagle.metadata.model.ApplicationDesc;
+import org.apache.eagle.metadata.model.ApplicationDocs;
+import org.apache.eagle.metadata.model.Configuration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.xml.bind.JAXBException;
+import java.util.List;
+
+public abstract class AbstractApplicationProvider<T extends Application> implements ApplicationProvider<T> {
+    private final static Logger LOG = LoggerFactory.getLogger(AbstractApplicationProvider.class);
+    private final static String APPLICATIONS_SINK_TYPE_PROPS_KEY = "application.sink.type";
+    private final static String DEFAULT_APPLICATIONS_SINK_TYPE = KafkaStreamSink.class.getCanonicalName();
+    private final ApplicationDesc applicationDesc;
+
+    public AbstractApplicationProvider(){
+        applicationDesc = new ApplicationDesc();
+        applicationDesc.setProviderClass(this.getClass());
+        configure();
+    }
+
+    protected void configure (){
+        // do nothing by default
+    }
+
+    protected AbstractApplicationProvider(String applicationDescConfig) {
+        this();
+        ApplicationProviderDescConfig descWrapperConfig = ApplicationProviderDescConfig.loadFromXML(applicationDescConfig);
+        setType(descWrapperConfig.getType());
+        setVersion(descWrapperConfig.getVersion());
+        setName(descWrapperConfig.getName());
+        setDocs(descWrapperConfig.getDocs());
+        try {
+            if (descWrapperConfig.getAppClass() != null) {
+                setAppClass((Class<T>) Class.forName(descWrapperConfig.getAppClass()));
+                if (!Application.class.isAssignableFrom(applicationDesc.getAppClass())) {
+                    throw new IllegalStateException(descWrapperConfig.getAppClass() + " is not sub-class of " + Application.class.getCanonicalName());
+                }
+            }
+        } catch (ClassNotFoundException e) {
+            LOG.error(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e.getCause());
+        }
+        setViewPath(descWrapperConfig.getViewPath());
+        setConfiguration(descWrapperConfig.getConfiguration());
+        setStreams(descWrapperConfig.getStreams());
+    }
+
+    @Override
+    public void prepare(ApplicationProviderConfig providerConfig, Config envConfig) {
+        this.applicationDesc.setJarPath(providerConfig.getJarPath());
+        String sinkClassName = envConfig.hasPath(APPLICATIONS_SINK_TYPE_PROPS_KEY) ?
+                envConfig.getString(APPLICATIONS_SINK_TYPE_PROPS_KEY) : DEFAULT_APPLICATIONS_SINK_TYPE;
+        try {
+            Class<?> sinkClass = Class.forName(sinkClassName);
+            if(!StreamSink.class.isAssignableFrom(sinkClass)){
+                throw new IllegalStateException(sinkClassName+ "is not assignable from "+StreamSink.class.getCanonicalName());
+            }
+            applicationDesc.setSinkClass(sinkClass);
+        } catch (ClassNotFoundException e) {
+            throw new IllegalStateException(e.getMessage(),e.getCause());
+        }
+    }
+
+    protected void setVersion(String version) {
+        applicationDesc.setVersion(version);
+    }
+
+    protected void setName(String name) {
+        applicationDesc.setName(name);
+    }
+
+    protected void setAppClass(Class<T> appClass) {
+        applicationDesc.setAppClass(appClass);
+    }
+
+    protected void setViewPath(String viewPath) {
+        applicationDesc.setViewPath(viewPath);
+    }
+
+    protected void setConfiguration(Configuration configuration) {
+        applicationDesc.setConfiguration(configuration);
+    }
+
+    protected void setAppConfig(String resourceName) {
+        try {
+            applicationDesc.setConfiguration(Configuration.fromResource(resourceName));
+        } catch (JAXBException e) {
+            LOG.error("Failed to load configuration template from "+resourceName,e);
+            throw new RuntimeException("Failed to load configuration template from "+resourceName,e);
+        }
+    }
+
+    @Override
+    public String toString() {
+        return String.format(
+                "%s[name=%s, type=%s, version=%s, viewPath=%s, appClass=%s, configuration= %s properties]", getClass().getSimpleName(),
+                applicationDesc.getName(),applicationDesc.getType(),applicationDesc.getVersion(), applicationDesc.getViewPath(), applicationDesc.getAppClass(), applicationDesc.getConfiguration().size()
+        );
+    }
+
+    protected void setStreams(List<StreamDefinition> streams) {
+        applicationDesc.setStreams(streams);
+    }
+
+
+    protected void setDocs(ApplicationDocs docs) {
+        applicationDesc.setDocs(docs);
+    }
+
+    public void setType(String type) {
+        applicationDesc.setType(type);
+    }
+
+    @Override
+    public ApplicationDesc getApplicationDesc() {
+        return applicationDesc;
+    }
+}
\ No newline at end of file

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/spi/ApplicationProvider.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/ApplicationProvider.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/ApplicationProvider.java
new file mode 100644
index 0000000..ace0c45
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/ApplicationProvider.java
@@ -0,0 +1,37 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.spi;
+
+import com.typesafe.config.Config;
+import org.apache.eagle.app.Application;
+import org.apache.eagle.app.config.ApplicationProviderConfig;
+import org.apache.eagle.metadata.model.ApplicationDesc;
+
+public interface ApplicationProvider<T extends Application> {
+
+    void prepare(ApplicationProviderConfig providerConfig,Config envConfig);
+
+    /**
+     * @return application descriptor
+     */
+    ApplicationDesc getApplicationDesc();
+
+    /**
+     * @return application instance
+     */
+    T getApplication();
+}
\ No newline at end of file

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/test/AppSimulator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/AppSimulator.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/AppSimulator.java
new file mode 100644
index 0000000..a3ef0ee
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/AppSimulator.java
@@ -0,0 +1,51 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.test;
+
+import org.apache.eagle.app.spi.ApplicationProvider;
+
+import java.util.Map;
+
+/**
+ * Application test simulator for developer to quickly run application without diving into application lifecycle
+ */
+public interface AppSimulator {
+    /**
+     *
+     * @param appType
+     */
+    void submit(String appType);
+    /**
+     *
+     * @param appType
+     * @param appConfig
+     */
+    void submit(String appType, Map<String,Object> appConfig);
+
+    /**
+     *
+     * @param appProviderClass
+     */
+    void submit(Class<? extends ApplicationProvider> appProviderClass);
+
+    /**
+     *
+     * @param appProviderClass
+     * @param appConfig
+     */
+    void submit(Class<? extends ApplicationProvider> appProviderClass, Map<String,Object> appConfig) throws Exception;
+}
\ No newline at end of file

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/test/AppSimulatorImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/AppSimulatorImpl.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/AppSimulatorImpl.java
new file mode 100644
index 0000000..f5af815
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/AppSimulatorImpl.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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.test;
+
+import com.google.inject.Inject;
+import com.typesafe.config.Config;
+import org.apache.eagle.app.config.ApplicationProviderConfig;
+import org.apache.eagle.app.resource.ApplicationResource;
+import org.apache.eagle.app.service.AppOperations;
+import org.apache.eagle.app.spi.ApplicationProvider;
+import org.apache.eagle.app.tools.DynamicJarPathFinder;
+import org.apache.eagle.metadata.model.ApplicationEntity;
+import org.apache.eagle.metadata.model.SiteEntity;
+import org.apache.eagle.metadata.resource.SiteResource;
+import org.junit.Assert;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class AppSimulatorImpl implements AppSimulator {
+    private final Config config;
+    private final SiteResource siteResource;
+    private final ApplicationResource applicationResource;
+
+    @Inject
+    public AppSimulatorImpl(Config config, SiteResource siteResource,ApplicationResource applicationResource){
+        this.config = config;
+        this.siteResource = siteResource;
+        this.applicationResource = applicationResource;
+    }
+
+    @Override
+    public void submit(String appType) {
+        submit(appType, new HashMap<>());
+    }
+
+    @Override
+    public void submit(String appType, Map<String, Object> appConfig) {
+        SiteEntity siteEntity = getUniqueSite();
+        siteResource.createSite(siteEntity);
+        Assert.assertNotNull(siteEntity.getUuid());
+        // Install application
+        ApplicationEntity applicationEntity = applicationResource.installApplication(new AppOperations.InstallOperation(siteEntity.getSiteId(),appType, ApplicationEntity.Mode.LOCAL));
+        // Start application
+        applicationResource.startApplication(new AppOperations.StartOperation(applicationEntity.getUuid()));
+    }
+
+    private final static AtomicInteger incr = new AtomicInteger();
+
+    private SiteEntity getUniqueSite(){
+        // Create local site
+        SiteEntity siteEntity = new SiteEntity();
+        siteEntity.setSiteId("SIMULATED_SITE_"+incr.incrementAndGet());
+        siteEntity.setSiteName(siteEntity.getSiteId());
+        siteEntity.setDescription("Automatically generated unique simulation site "+siteEntity.getSiteId()+" (simulator: "+this+")");
+        return siteEntity;
+    }
+
+    @Override
+    public void submit(Class<? extends ApplicationProvider> appProviderClass) {
+        submit(appProviderClass, new HashMap<>());
+    }
+
+    @Override
+    public void submit(Class<? extends ApplicationProvider> appProviderClass, Map<String, Object> appConfig) {
+        try {
+            ApplicationProvider applicationProvider = appProviderClass.newInstance();
+            applicationProvider.prepare(new ApplicationProviderConfig(DynamicJarPathFinder.findPath(appProviderClass),appProviderClass),config);
+            submit(applicationProvider.getApplicationDesc().getType(),appConfig);
+        } catch (InstantiationException | IllegalAccessException e) {
+            throw new IllegalStateException(e.getMessage(),e);
+        }
+    }
+}
\ No newline at end of file

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/test/AppTestGuiceModule.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/AppTestGuiceModule.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/AppTestGuiceModule.java
new file mode 100644
index 0000000..b2b0194
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/AppTestGuiceModule.java
@@ -0,0 +1,33 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.test;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Singleton;
+import org.apache.eagle.app.ApplicationGuiceModule;
+import org.apache.eagle.common.module.CommonGuiceModule;
+import org.apache.eagle.metadata.persistence.MemoryMetadataStore;
+
+public class AppTestGuiceModule extends AbstractModule{
+    @Override
+    protected void configure() {
+        install(new CommonGuiceModule());
+        install(new ApplicationGuiceModule());
+        install(new MemoryMetadataStore());
+        bind(AppSimulator.class).to(AppSimulatorImpl.class).in(Singleton.class);
+    }
+}
\ No newline at end of file

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/test/AppUnitTestRunner.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/AppUnitTestRunner.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/AppUnitTestRunner.java
new file mode 100644
index 0000000..2dda4d6
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/AppUnitTestRunner.java
@@ -0,0 +1,84 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.test;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.InitializationError;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class AppUnitTestRunner extends BlockJUnit4ClassRunner {
+    private final Injector injector;
+    public AppUnitTestRunner(Class<?> klass) throws InitializationError {
+        super(klass);
+        injector = createInjectorFor(getModulesFor(klass));
+    }
+
+    @Override
+    protected Object createTest() throws Exception {
+        final Object obj = super.createTest();
+        injector.injectMembers(this);
+        this.injector.injectMembers(obj);
+        return obj;
+    }
+
+    /**
+     * Create a Guice Injector for the class under test.
+     * @param classes Guice Modules
+     * @return A Guice Injector instance.
+     * @throws InitializationError If couldn't instantiate a module.
+     */
+    private Injector createInjectorFor(final Class<?>[] classes)
+            throws InitializationError {
+        final List<Module> modules = new ArrayList<>();
+
+        // Add default modules
+        modules.add(new AppTestGuiceModule());
+
+        if(classes!= null) {
+            for (final Class<?> module : Arrays.asList(classes)) {
+                try {
+                    modules.add((Module) module.newInstance());
+                } catch (final ReflectiveOperationException exception) {
+                    throw new InitializationError(exception);
+                }
+            }
+        }
+        return Guice.createInjector(modules);
+    }
+
+    /**
+     * Get the list of Guice Modules request by GuiceModules annotation in the
+     * class under test.
+     * @param klass Class under test.
+     * @return A Class Array of Guice Modules required by this class.
+     * @throws InitializationError If the annotation is not present.
+     */
+    private Class<?>[] getModulesFor(final Class<?> klass)
+            throws InitializationError {
+        final Modules annotation = klass.getAnnotation(Modules.class);
+        if (annotation == null) {
+            return null;
+        }
+        return annotation.value();
+    }
+}
\ No newline at end of file

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/test/Modules.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/Modules.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/Modules.java
new file mode 100644
index 0000000..71a6b79
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/Modules.java
@@ -0,0 +1,39 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.test;
+
+import com.google.inject.AbstractModule;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Defines the Guice Modules in use in the test class.
+ *
+ * @version $Id$
+ */
+@Inherited
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Modules {
+    /**
+     * The Guice Modules classes needed by the class under test.
+     */
+    Class<? extends AbstractModule>[] value();
+}
\ No newline at end of file

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/test/package-info.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/package-info.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/package-info.java
new file mode 100644
index 0000000..aaaf157
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/package-info.java
@@ -0,0 +1,46 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ *
+ *
+ *
+ */
+
+/**
+ * <h1>How to test application ?</h1>
+ *
+ * <h2>Option 1: Test with AppTestRunner</h2>
+ * <pre>
+ * @RunWith(AppTestRunner.class)
+ * public class ExampleApplicationTest {
+ *     @Inject
+ *     private ApplicationResource applicationResource;
+ * }
+ * </pre>
+ *
+ * <h2>Option 2: Manually create injector</h2>
+ * <pre>
+ * public class ExampleApplicationTest {
+ *     @Inject
+ *     private ApplicationResource applicationResource;
+ *
+ *     @Before
+ *     public void setUp(){
+ *         Guice.createInjector(new AppTestModule()).injector.injectMembers(this);
+ *     }
+ * }
+ * </pre>
+ */
+package org.apache.eagle.app.test;
\ No newline at end of file

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/tools/DynamicJarPathFinder.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/tools/DynamicJarPathFinder.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/tools/DynamicJarPathFinder.java
new file mode 100644
index 0000000..fce72fe
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/tools/DynamicJarPathFinder.java
@@ -0,0 +1,121 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.tools;
+
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.nio.charset.Charset;
+
+/**
+ * http://stackoverflow.com/questions/1983839/determine-which-jar-file-a-class-is-from
+ * https://github.com/rzwitserloot/lombok.patcher/blob/master/src/lombok/patcher/inject/LiveInjector.java
+ */
+public class DynamicJarPathFinder {
+    private final static Logger LOG = LoggerFactory.getLogger(DynamicJarPathFinder.class);
+    /**
+     * If the provided class has been loaded from a jar file that is on the local file system, will find the absolute path to that jar file.
+     *
+     * @param context The jar file that contained the class file that represents this class will be found. Specify {@code null} to let {@code LiveInjector}
+     *                find its own jar.
+     * @throws IllegalStateException If the specified class was loaded from a directory or in some other way (such as via HTTP, from a database, or some
+     *                               other custom classloading device).
+     */
+    public static String findPathJar(Class<?> context) throws IllegalStateException {
+        if (context == null) context = DynamicJarPathFinder.class;
+        String rawName = context.getName();
+        String classFileName;
+    /* rawName is something like package.name.ContainingClass$ClassName. We need to turn this into ContainingClass$ClassName.class. */ {
+            int idx = rawName.lastIndexOf('.');
+            classFileName = (idx == -1 ? rawName : rawName.substring(idx+1)) + ".class";
+        }
+
+        String uri = context.getResource(classFileName).toString();
+        if (uri.startsWith("file:")) {
+            throw new IllegalStateException("This class has been loaded from a directory and not from a jar file.");
+        }
+        if (!uri.startsWith("jar:file:")) {
+            int idx = uri.indexOf(':');
+            String protocol = idx == -1 ? "(unknown)" : uri.substring(0, idx);
+            throw new IllegalStateException("This class has been loaded remotely via the " + protocol +
+                    " protocol. Only loading from a jar on the local file system is supported.");
+        }
+
+        int idx = uri.indexOf('!');
+        //As far as I know, the if statement below can't ever trigger, so it's more of a sanity check thing.
+        if (idx == -1) throw new IllegalStateException("You appear to have loaded this class from a local jar file, but I can't make sense of the URL!");
+
+        try {
+            String fileName = URLDecoder.decode(uri.substring("jar:file:".length(), idx), Charset.defaultCharset().name());
+            return new File(fileName).getAbsolutePath();
+        } catch (UnsupportedEncodingException e) {
+            throw new InternalError("default charset doesn't exist. Your VM is borked.");
+        }
+    }
+
+    /**
+     * Similar to JarPathFinder, but not make sure the path must valid jar.
+     *
+     * @see DynamicJarPathFinder#findPathJar(Class)
+     * @return the class path contains the context class
+     */
+    public static String findPath(Class<?> context) throws IllegalStateException {
+        if (context == null) context = DynamicJarPathFinder.class;
+        String rawName = context.getName();
+        String classFileName;
+    /* rawName is something like package.name.ContainingClass$ClassName. We need to turn this into ContainingClass$ClassName.class. */ {
+            int idx = rawName.lastIndexOf('.');
+            classFileName = (idx == -1 ? rawName : rawName.substring(idx+1)) + ".class";
+        }
+
+        String uri = context.getResource(classFileName).toString();
+        if (uri.startsWith("file:")) {
+            LOG.warn("This class has been loaded from a directory and not from a jar file: {}",uri);
+            String fileName = null;
+            try {
+                fileName = URLDecoder.decode(uri.substring("file:".length(), uri.length()), Charset.defaultCharset().name());
+                return new File(fileName).getAbsolutePath();
+            } catch (UnsupportedEncodingException e) {
+                throw new InternalError("default charset doesn't exist. Your VM is borked.");
+            }
+        }
+
+        if (!uri.startsWith("jar:file:")) {
+            int idx = uri.indexOf(':');
+            String protocol = idx == -1 ? "(unknown)" : uri.substring(0, idx);
+            throw new IllegalStateException("This class has been loaded remotely via the " + protocol +
+                    " protocol. Only loading from a jar on the local file system is supported.");
+        }
+
+        int idx = uri.indexOf('!');
+        //As far as I know, the if statement below can't ever trigger, so it's more of a sanity check thing.
+        if (idx == -1) {
+            throw new IllegalStateException("You appear to have loaded this class from a local jar file, but I can't make sense of the URL!");
+        }
+
+        try {
+            String fileName = URLDecoder.decode(uri.substring("jar:file:".length(), idx), Charset.defaultCharset().name());
+            return new File(fileName).getAbsolutePath();
+        } catch (UnsupportedEncodingException e) {
+            throw new InternalError("default charset doesn't exist. Your VM is borked.");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/main/resources/applications.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/resources/applications.xml b/eagle-core/eagle-app/eagle-app-base/src/main/resources/applications.xml
new file mode 100644
index 0000000..5f67807
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/resources/applications.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<applications>
+    <application>
+        <type>EXAMPLE_APP</type>
+        <version>0.2.0</version>
+        <name>Example Application</name>
+        <jarPath>target/apache-eagle-example-app.jar</jarPath>
+        <className>org.apache.eagle.app.base.example.ExampleApplication</className>
+        <!-- 'view' provides UI elements like portal/widget/dashboard, etc. -->
+        <viewPath>webapp/app/example</viewPath>
+        <configuration>
+            <property>
+                <name>kafka.topic</name>
+                <value>hdfs_audit</value>
+                <description>Kafka Topic</description>
+            </property>
+            <property>
+                <name>zookeeper.server</name>
+                <displayName>Zookeeper Server</displayName>
+                <value>localhost:2181</value>
+                <description>Zookeeper Server address</description>
+            </property>
+        </configuration>
+    </application>
+</applications>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/resources/log4j.properties b/eagle-core/eagle-app/eagle-app-base/src/main/resources/log4j.properties
new file mode 100644
index 0000000..fb13ad5
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/resources/log4j.properties
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+log4j.rootLogger=DEBUG, stdout
+
+# standard output
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ApplicationProviderDescConfigTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ApplicationProviderDescConfigTest.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ApplicationProviderDescConfigTest.java
new file mode 100644
index 0000000..5a6980c
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ApplicationProviderDescConfigTest.java
@@ -0,0 +1,53 @@
+package org.apache.eagle.app;
+
+import org.apache.eagle.app.config.ApplicationProviderDescConfig;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import java.io.InputStream;
+
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+public class ApplicationProviderDescConfigTest {
+    @Test
+    public void testApplicationDescWrapperConfigLoadFromXML(){
+        ApplicationProviderDescConfig config = ApplicationProviderDescConfig.loadFromXML("TestApplicationMetadata.xml");
+        Assert.assertNotNull(config);
+    }
+
+    @Test
+    public void testStreamDefinitionLoadFromXML(){
+        String configXmlFile = "TestStreamDefinitionConf.xml";
+        try {
+            JAXBContext jc = JAXBContext.newInstance(StreamDefinitions.class);
+            Unmarshaller unmarshaller = jc.createUnmarshaller();
+            InputStream is = ApplicationProviderDescConfigTest.class.getResourceAsStream(configXmlFile);
+            if(is == null){
+                is = ApplicationProviderDescConfigTest.class.getResourceAsStream("/"+configXmlFile);
+            }
+            if(is == null){
+                throw new IllegalStateException("Stream Definition configuration "+configXmlFile+" is not found");
+            }
+            StreamDefinitions streamDefinitions = (StreamDefinitions) unmarshaller.unmarshal(is);
+            Assert.assertNotNull(streamDefinitions);
+        } catch (Exception ex){
+            throw new RuntimeException("Failed to load application descriptor configuration: "+configXmlFile,ex);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ApplicationProviderServiceTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ApplicationProviderServiceTest.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ApplicationProviderServiceTest.java
new file mode 100644
index 0000000..61f7542
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ApplicationProviderServiceTest.java
@@ -0,0 +1,47 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import org.apache.eagle.app.config.ApplicationProviderConfig;
+import org.apache.eagle.app.service.ApplicationProviderService;
+import org.apache.eagle.app.spi.ApplicationProvider;
+import org.apache.eagle.common.module.CommonGuiceModule;
+import org.apache.eagle.metadata.model.ApplicationDesc;
+import org.apache.eagle.metadata.persistence.MemoryMetadataStore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+
+public class ApplicationProviderServiceTest {
+    private final static Logger LOGGER = LoggerFactory.getLogger(ApplicationProviderServiceTest.class);
+    private Injector injector = Guice.createInjector(new CommonGuiceModule(),new ApplicationGuiceModule(), MemoryMetadataStore.getInstance());
+
+    @Test
+    public void testApplicationProviderManagerInit(){
+        ApplicationProviderService providerManager = injector.getInstance(ApplicationProviderService.class);
+        Collection<ApplicationDesc> applicationDescs = providerManager.getApplicationDescs();
+        Collection<ApplicationProvider> applicationProviders = providerManager.getProviders();
+
+        applicationDescs.forEach((d)-> LOGGER.debug(d.toString()));
+        applicationProviders.forEach((d)-> LOGGER.debug(d.toString()));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ConfigurationHelperTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ConfigurationHelperTest.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ConfigurationHelperTest.java
new file mode 100644
index 0000000..ebdae61
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ConfigurationHelperTest.java
@@ -0,0 +1,33 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+import org.apache.eagle.metadata.model.Configuration;
+import org.apache.eagle.metadata.utils.ConfigTemplateHelper;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.xml.bind.JAXBException;
+
+public class ConfigurationHelperTest {
+    @Test
+    public void testConfigTemplateUnmarshall() throws JAXBException {
+        Configuration configuration = ConfigTemplateHelper.unmarshallFromResource("/config_template.xml");
+        Assert.assertNotNull(configuration);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/StreamDefinitions.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/StreamDefinitions.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/StreamDefinitions.java
new file mode 100644
index 0000000..7ca0176
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/StreamDefinitions.java
@@ -0,0 +1,37 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+
+import javax.xml.bind.annotation.*;
+import java.util.List;
+
+@XmlRootElement(name = "streams")
+public class StreamDefinitions{
+
+    private List<StreamDefinition> streams;
+
+    @XmlElement(name = "stream")
+    public List<StreamDefinition> getStreams() {
+        return streams;
+    }
+
+    public void setStreams(List<StreamDefinition> streams) {
+        this.streams = streams;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestApplicationImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestApplicationImpl.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestApplicationImpl.java
new file mode 100644
index 0000000..90a2b90
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestApplicationImpl.java
@@ -0,0 +1,82 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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;
+
+import backtype.storm.spout.SpoutOutputCollector;
+import backtype.storm.task.TopologyContext;
+import backtype.storm.topology.OutputFieldsDeclarer;
+import backtype.storm.topology.TopologyBuilder;
+import backtype.storm.topology.base.BaseRichSpout;
+import backtype.storm.tuple.Fields;
+import backtype.storm.tuple.Values;
+import org.apache.eagle.app.spi.AbstractApplicationProvider;
+import org.junit.Ignore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+@Ignore
+public class TestApplicationImpl extends AbstractApplication {
+    private final static Logger LOG = LoggerFactory.getLogger(TestApplicationImpl.class);
+    public class RandomEventSpout extends BaseRichSpout {
+        SpoutOutputCollector _collector;
+
+        @SuppressWarnings("rawtypes")
+        @Override
+        public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
+            _collector = collector;
+        }
+
+        @Override
+        public void nextTuple() {
+
+        }
+
+        @Override
+        public void ack(Object id) {
+            //Ignored
+        }
+
+        @Override
+        public void fail(Object id) {
+            _collector.emit(new Values(id), id);
+        }
+
+        @Override
+        public void declareOutputFields(OutputFieldsDeclarer declarer) {
+            declarer.declare(new Fields("key","event"));
+        }
+    }
+
+    protected void buildTopology(TopologyBuilder builder, ApplicationContext context) {
+        builder.setSpout("mockMetricSpout", new RandomEventSpout(), 4);
+        builder.setBolt("sink_1",context.getStreamSink("TEST_STREAM_1")).fieldsGrouping("mockMetricSpout",new Fields("key"));
+        builder.setBolt("sink_2",context.getStreamSink("TEST_STREAM_2")).fieldsGrouping("mockMetricSpout",new Fields("key"));
+    }
+
+    public static class Provider extends AbstractApplicationProvider<TestApplicationImpl> {
+        public Provider(){
+            super("TestApplicationMetadata.xml");
+        }
+
+        @Override
+        public TestApplicationImpl getApplication() {
+            return new TestApplicationImpl();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestApplicationTestSuite.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestApplicationTestSuite.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestApplicationTestSuite.java
new file mode 100644
index 0000000..f86f903
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestApplicationTestSuite.java
@@ -0,0 +1,82 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+import com.google.inject.Inject;
+import org.apache.eagle.app.resource.ApplicationResource;
+import org.apache.eagle.app.service.AppOperations;
+import org.apache.eagle.app.test.AppSimulator;
+import org.apache.eagle.app.test.AppUnitTestRunner;
+import org.apache.eagle.metadata.model.ApplicationDesc;
+import org.apache.eagle.metadata.model.ApplicationEntity;
+import org.apache.eagle.metadata.model.SiteEntity;
+import org.apache.eagle.metadata.resource.SiteResource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Collection;
+
+@RunWith(AppUnitTestRunner.class)
+public class TestApplicationTestSuite {
+    @Inject private SiteResource siteResource;
+    @Inject private ApplicationResource applicationResource;
+    @Inject private AppSimulator simulator;
+
+    @Test
+    public void testApplicationProviderLoading(){
+        Collection<ApplicationDesc> applicationDescs = applicationResource.getApplicationDescs();
+        Assert.assertNotNull(applicationDescs);
+        Assert.assertEquals(1,applicationDescs.size());
+    }
+
+    @Test
+    public void testApplicationLifecycle() throws InterruptedException {
+        // Create local site
+        SiteEntity siteEntity = new SiteEntity();
+        siteEntity.setSiteId("test_site");
+        siteEntity.setSiteName("Test Site");
+        siteEntity.setDescription("Test Site for ExampleApplicationTest");
+        siteResource.createSite(siteEntity);
+        Assert.assertNotNull(siteEntity.getUuid());
+
+        // Install application
+        ApplicationEntity applicationEntity = applicationResource.installApplication(new AppOperations.InstallOperation("test_site","TEST_APPLICATION", ApplicationEntity.Mode.LOCAL));
+        // Start application
+        applicationResource.startApplication(new AppOperations.StartOperation(applicationEntity.getUuid()));
+        // Stop application
+        applicationResource.stopApplication(new AppOperations.StopOperation(applicationEntity.getUuid()));
+        // Uninstall application
+        applicationResource.uninstallApplication(new AppOperations.UninstallOperation(applicationEntity.getUuid()));
+        try {
+            applicationResource.getApplicationEntityByUUID(applicationEntity.getUuid());
+            Assert.fail("Application instance (UUID: "+applicationEntity.getUuid()+") should have been uninstalled");
+        } catch (Exception ex){
+            // Expected exception
+        }
+    }
+
+    @Test
+    public void testApplicationQuickRunWithAppType(){
+        simulator.submit("TEST_APPLICATION");
+    }
+
+    @Test
+    public void testApplicationQuickRunWithAppProvider(){
+        simulator.submit(TestApplicationImpl.Provider.class);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-app/eagle-app-base/src/test/resources/ExampleApplicationConf.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/ExampleApplicationConf.xml b/eagle-core/eagle-app/eagle-app-base/src/test/resources/ExampleApplicationConf.xml
new file mode 100644
index 0000000..4a31c5e
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/resources/ExampleApplicationConf.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<configuration>
+    <property>
+        <name>kafka.topic</name>
+        <displayName>Kafka Topic</displayName>
+        <value>hdfs_audit</value>
+        <description>Kafka Topic</description>
+    </property>
+    <property>
+        <name>zookeeper.server</name>
+        <displayName>Zookeeper Server</displayName>
+        <value>localhost:2181</value>
+        <description>Zookeeper Server address</description>
+    </property>
+</configuration>
\ No newline at end of file



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

Posted by ha...@apache.org.
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..0000000
--- 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){
-		shortToBytes(v, bytes, 0);
-	}
-	
-	public static void shortToBytes(short v, byte[] bytes, int offset){
-		int tmp = v;
-		for(int i=0; i < 2; i++){
-			bytes[offset + 1 - i] = (byte)(tmp & 0xFF);
-			tmp >>= 8;
-		}
-	}
-
-	public static byte[] shortToBytes(short v){
-		int tmp = v;
-		byte[] b = new byte[2];
-		for(int i=0; i<2; i++){
-			b[1-i] = (byte)(tmp & 0xFF);
-			tmp >>= 8;
-		}
-		return b;
-	}
-
-	public static byte[] concat(byte[]... arrays) {
-        int length = 0;
-        for (byte[] array : arrays) {
-            length += array.length;
-        }
-        byte[] result = new byte[length];
-        int pos = 0;
-        for (byte[] array : arrays) {
-            System.arraycopy(array, 0, result, pos, array.length);
-            pos += array.length;
-        }
-        return result;
-    }
-	
-//    public static void main(String[] args){ 
-//    	int a = "ThreadName".hashCode();
-//    	byte[] b = intToBytes(a);
-//    	byte[] c = intToBytes(1676687583);
-//    	String s = new String(b);
-//    	System.out.println(s);
-    	
-//    	byte[] d = intToBytes(8652353);
-//    	System.out.println(bytesToInt(d));
-    	
-//    	byte[] e = longToBytes(12131513513l);
-//    	System.out.println(bytesToLong(e));
-//    	if(12131513513l == bytesToLong(e)){
-//    		System.out.println("yes");
-//    	}
-//    }
-}

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/CircularArrayList.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayList.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayList.java
deleted file mode 100644
index 49695e5..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/CircularArrayList.java
+++ /dev/null
@@ -1,149 +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.AbstractList;
-import java.util.RandomAccess;
-
-/**
- * Circular array implementation
- *
- * @param <E>
- */
-public class CircularArrayList<E> extends AbstractList<E> implements RandomAccess {
-  
-    private final E[] buf; // a List implementing RandomAccess
-    private int head = 0;
-    private int tail = 0;
-    private boolean full = false;
-  
-    public CircularArrayList(E[] array) {
-        buf = array;
-        full = (buf.length == 0);
-    }
-  
-    public int capacity() {
-        return buf.length;
-    }
-    
-    public int head() {
-    	return head;
-    }
-    
-    public int tail() {
-    	return tail;
-    }
-    
-    public boolean isFull() {
-    	return full;
-    }
-    
-    @Override
-    public void clear() {
-        head = 0;
-        tail = 0;
-        full = false;
-        for (int i = 0; i < buf.length; ++i) {
-        	buf[i] = null;
-        }
-    }
-
-    private int wrapIndex(int i) {
-        int m = i % buf.length;
-        if (m < 0) { // java modulus can be negative
-            throw new IndexOutOfBoundsException();
-        }
-        return m;
-    }
-  
-    // This method is O(n) but will never be called if the
-    // CircularArrayList is used in its typical/intended role.
-    private void shiftBlock(int startIndex, int endIndex) {
-        assert (endIndex > startIndex);
-        for (int i = endIndex - 1; i >= startIndex; i--) {
-            set(i + 1, get(i));
-        }
-    }
-    
-    public int find(E e) {
-    	final int size = size();
-    	for (int i = 0; i < size; ++i) {
-    		if (e.equals(get(i))) {
-    			return i;
-    		}
-    	}
-    	return -1;
-    }
-  
-    @Override
-    public int size() {
-    	if (full) {
-    		return buf.length;
-    	}
-        return tail - head + (tail < head ? buf.length : 0);
-    }
-  
-    @Override
-    public E get(int i) {
-        if (i < 0 || i >= size()) {
-            throw new IndexOutOfBoundsException();
-        }
-        return buf[wrapIndex(head + i)];
-    }
-  
-    @Override
-    public E set(int i, E e) {
-        if (i < 0 || i >= size()) {
-            throw new IndexOutOfBoundsException();
-        }
-        return buf[wrapIndex(head + i)] =  e;
-    }
-  
-    @Override
-    public void add(int i, E e) {
-        int s = size();
-        if (s == buf.length) {
-            throw new IllegalStateException("Cannot add element."
-                    + " CircularArrayList is filled to capacity.");
-        }
-        full = (s + 1 == buf.length);
-        if (i < 0 || i > s) {
-            throw new IndexOutOfBoundsException();
-        }
-        tail = wrapIndex(tail + 1);
-        if (i < s) {
-            shiftBlock(i, s);
-        }
-        set(i, e);
-    }
-  
-    @Override
-    public E remove(int i) {
-        int s = size();
-        if (i < 0 || i >= s) {
-            throw new IndexOutOfBoundsException();
-        }
-        final E e = get(i);
-        if (i > 0) {
-            shiftBlock(0, i);
-        }
-    	buf[head] = null;
-        head = wrapIndex(head + 1);
-        full = false;
-        return e;
-    }
-}
\ No newline at end of file

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/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..0000000
--- 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<E> {
-
-	private final CircularArrayList<E> list;
-    private final Comparator<? super E> comparator;
-
-	public CircularArrayListSortedSet(E[] array) {
-		this.list = new CircularArrayList<E>(array);
-		this.comparator = null;
-	}
-	
-	public CircularArrayListSortedSet(E[] array, Comparator<? super E> comparator) {
-		this.list = new CircularArrayList<E>(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<? extends Comparable<? super E>>)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/e21b073f/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 0f5b189..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java
+++ /dev/null
@@ -1,150 +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 org.apache.eagle.common.config.EagleConfigFactory;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.TimeZone;
-
-/**
- * be aware that SimpleDateFormat instantiation is expensive, so if that's under a tight loop, probably we need
- * a thread local SimpleDateFormat object
- */
-public class DateTimeUtil {
-	public static final long ONESECOND = 1L * 1000L;
-	public static final long ONEMINUTE = 1L * 60L * 1000L;
-	public static final long ONEHOUR = 1L * 60L * 60L * 1000L;
-	public static final long ONEDAY = 24L * 60L * 60L * 1000L;
-    private static TimeZone CURRENT_TIME_ZONE = EagleConfigFactory.load().getTimeZone();
-	
-	public static Date humanDateToDate(String date) throws ParseException{
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        sdf.setTimeZone(CURRENT_TIME_ZONE);
-		return sdf.parse(date);
-	}
-	
-	public static String secondsToHumanDate(long seconds){
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        sdf.setTimeZone(CURRENT_TIME_ZONE);
-		Date t = new Date();
-		t.setTime(seconds*1000);
-		return sdf.format(t);
-	}
-	
-	public static String millisecondsToHumanDateWithMilliseconds(long milliseconds){
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
-        sdf.setTimeZone(CURRENT_TIME_ZONE);
-		Date t = new Date();
-		t.setTime(milliseconds);
-		return sdf.format(t);
-	}
-	
-	public static String millisecondsToHumanDateWithSeconds(long milliseconds){
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        sdf.setTimeZone(CURRENT_TIME_ZONE);
-		Date t = new Date();
-		t.setTime(milliseconds);
-		return sdf.format(t);
-	}
-	
-	public static long humanDateToSeconds(String date) throws ParseException{
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        sdf.setTimeZone(CURRENT_TIME_ZONE);
-		Date d = sdf.parse(date);
-		return d.getTime()/1000;
-	}
-	
-	public static long humanDateToMilliseconds(String date) throws ParseException{
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
-        sdf.setTimeZone(CURRENT_TIME_ZONE);
-		Date d = sdf.parse(date);
-		return d.getTime();
-	}
-	
-	
-	public static long humanDateToMillisecondsWithoutException(String date){
-		try{
-			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
-            sdf.setTimeZone(CURRENT_TIME_ZONE);
-			Date d = sdf.parse(date);
-			return d.getTime();
-		}catch(ParseException ex){
-			return 0L;
-		}
-	}
-	
-	public static long humanDateToSecondsWithoutException(String date){
-		try{
-			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-            sdf.setTimeZone(CURRENT_TIME_ZONE);
-			Date d = sdf.parse(date);
-			return (d.getTime() / 1000);
-		}catch(ParseException ex){
-			return 0L;
-		}
-	}
-
-	//For mapr
-	//exp: 2015-06-06T10:44:22.800Z
-	public static long maprhumanDateToMilliseconds(String date) throws ParseException{
-		date = date.replace('T',' ');
-		date = date.replace('Z',' ');
-		date = date.replace('.',',');
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS ");
-		sdf.setTimeZone(CURRENT_TIME_ZONE);
-		Date d = sdf.parse(date);
-		return d.getTime();
-	}
-	/**
-	 * this could be accurate only when timezone is UTC
-	 * for the timezones other than UTC, there is possibly issue, for example
-	 * assume timezone is GMT+8 in China
-	 * When user time is "2014-07-15 05:00:00", it will be converted to timestamp first, internally it would be  "2014-07-14 21:00:00" in UTC timezone. When rounded down to day, the internal time would 
-	 * be changed to "2014-07-14 00:00:00", and that means the user time is "2014-07-14 08:00:00". But originally user wants to round it to "2014-07-15 00:00:00"
-	 * 
-	 * @param field
-	 * @param timeInMillis the seconds elapsed since 1970-01-01 00:00:00
-	 * @return
-	 */
-	public static long roundDown(int field, long timeInMillis){
-		switch(field){
-			case Calendar.DAY_OF_MONTH:
-			case Calendar.DAY_OF_WEEK:
-			case Calendar.DAY_OF_YEAR:
-				return (timeInMillis - timeInMillis % (24*60*60*1000));
-			case Calendar.HOUR:
-				return (timeInMillis - timeInMillis % (60*60*1000));
-			case Calendar.MINUTE:
-				return (timeInMillis - timeInMillis % (60*1000));
-			case Calendar.SECOND:
-				return (timeInMillis - timeInMillis % (1000));
-			default:
-				return 0L;
-		}
-	}
-
-	public static String format(long milliseconds, String format) {
-		SimpleDateFormat sdf = new SimpleDateFormat(format);
-        sdf.setTimeZone(CURRENT_TIME_ZONE);
-		Date t = new Date();
-		t.setTime(milliseconds);
-		return sdf.format(t);
-	}
-}

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/EagleBase64Wrapper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/EagleBase64Wrapper.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/EagleBase64Wrapper.java
deleted file mode 100644
index e31ef99..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/EagleBase64Wrapper.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.common;
-
-import org.apache.commons.net.util.Base64;
-
-/**
- * wrap base64 encoding and decoding, so reduce the confuse of using many Base64 methods. 
- */
-public class EagleBase64Wrapper {
-	public static String encodeByteArray2URLSafeString(byte[] bytes){
-		return Base64.encodeBase64URLSafeString(bytes);
-	}
-	
-	public static byte[] decode(String input){
-		return Base64.decodeBase64(input);
-	}
-}

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/EagleExceptionWrapper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/EagleExceptionWrapper.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/EagleExceptionWrapper.java
deleted file mode 100644
index 1fc4e85..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/EagleExceptionWrapper.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.common;
-
-public class EagleExceptionWrapper {
-	private final static int MAX_DEPTH = 10;
-	
-	public static String wrap(Exception ex){
-		return wrap(ex, EagleExceptionWrapper.MAX_DEPTH);
-	}
-	
-	public static String wrap(Exception ex, int maxdepth){
-		int d = maxdepth;
-		if(d <= 0)
-			d = EagleExceptionWrapper.MAX_DEPTH;
-		int index = 0;
-		StringBuffer sb = new StringBuffer();
-		sb.append(ex);
-		sb.append(System.getProperty("line.separator"));
-		for(StackTraceElement element : ex.getStackTrace()){
-			sb.append(element.toString());
-			sb.append(System.getProperty("line.separator"));
-			if(++index >= d)
-				break;
-		}
-		return sb.toString();
-	}
-}

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/Environment.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/Environment.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/Environment.java
deleted file mode 100644
index dd69ed5..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/Environment.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.common;
-
-public enum Environment {
-	dev,
-	test,
-	prod,
-}

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/OS.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/OS.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/OS.java
deleted file mode 100644
index 05e8db1..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/OS.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.common;
-
-public class OS {
-
-	private final static String os = System.getProperty("os.name")
-			.toLowerCase();
-
-	public static boolean isWindows() {
-		return (os.indexOf("win") >= 0);
-	}
-
-	public static boolean isMac() {
-		return (os.indexOf("mac") >= 0);
-	}
-
-	public static boolean isUnix() {
-		return (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0 || os
-				.indexOf("aix") > 0);
-	}
-
-	public static boolean isSolaris() {
-		return (os.indexOf("sunos") >= 0);
-	}
-
-}

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/SerializableUtils.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/SerializableUtils.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/SerializableUtils.java
deleted file mode 100644
index c5823ea..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/SerializableUtils.java
+++ /dev/null
@@ -1,126 +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 org.xerial.snappy.SnappyInputStream;
-import org.xerial.snappy.SnappyOutputStream;
-
-import java.io.*;
-
-/**
- * Utilities for working with Serializables.
- *
- * Derived from "com.google.cloud.dataflow.sdk.util.SerializableUtils":
- * https://github.com/apache/incubator-beam/blob/master/sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/util/SerializableUtils.java
- */
-public class SerializableUtils {
-  /**
-   * Serializes the argument into an array of bytes, and returns it.
-   *
-   * @throws IllegalArgumentException if there are errors when serializing
-   */
-  public static byte[] serializeToCompressedByteArray(Object value) {
-    try {
-      ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-      try (ObjectOutputStream oos = new ObjectOutputStream(new SnappyOutputStream(buffer))) {
-        oos.writeObject(value);
-      }
-      return buffer.toByteArray();
-    } catch (IOException exn) {
-      throw new IllegalArgumentException(
-          "unable to serialize " + value,
-          exn);
-    }
-  }
-
-  /**
-   * Serializes the argument into an array of bytes, and returns it.
-   *
-   * @throws IllegalArgumentException if there are errors when serializing
-   */
-  public static byte[] serializeToByteArray(Object value) {
-    try {
-      ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-      try (ObjectOutputStream oos = new ObjectOutputStream(buffer)) {
-        oos.writeObject(value);
-      }
-      return buffer.toByteArray();
-    } catch (IOException exn) {
-      throw new IllegalArgumentException("unable to serialize " + value, exn);
-    }
-  }
-
-  /**
-   * Deserializes an object from the given array of bytes, e.g., as
-   * serialized using {@link #serializeToCompressedByteArray}, and returns it.
-   *
-   * @throws IllegalArgumentException if there are errors when
-   * deserializing, using the provided description to identify what
-   * was being deserialized
-   */
-  public static Object deserializeFromByteArray(byte[] encodedValue,
-                                                          String description) {
-    try {
-      try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(encodedValue))) {
-        return ois.readObject();
-      }
-    } catch (IOException | ClassNotFoundException exn) {
-      throw new IllegalArgumentException(
-          "unable to deserialize " + description,
-          exn);
-    }
-  }
-
-  /**
-   * Deserializes an object from the given array of bytes, e.g., as
-   * serialized using {@link #serializeToCompressedByteArray}, and returns it.
-   *
-   * @throws IllegalArgumentException if there are errors when
-   * deserializing, using the provided description to identify what
-   * was being deserialized
-   */
-  public static Object deserializeFromCompressedByteArray(byte[] encodedValue,
-                                                          String description) {
-    try {
-      try (ObjectInputStream ois = new ObjectInputStream(
-          new SnappyInputStream(new ByteArrayInputStream(encodedValue)))) {
-        return ois.readObject();
-      }
-    } catch (IOException | ClassNotFoundException exn) {
-      throw new IllegalArgumentException(
-          "unable to deserialize " + description,
-          exn);
-    }
-  }
-
-  public static <T extends Serializable> T ensureSerializable(T value) {
-    @SuppressWarnings("unchecked")
-    T copy = (T) deserializeFromCompressedByteArray(serializeToCompressedByteArray(value),
-        value.toString());
-    return copy;
-  }
-
-  public static <T extends Serializable> T clone(T value) {
-    @SuppressWarnings("unchecked")
-    T copy = (T) deserializeFromCompressedByteArray(serializeToCompressedByteArray(value),
-        value.toString());
-    return copy;
-  }
-}
\ No newline at end of file

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/config/EagleConfig.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfig.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfig.java
deleted file mode 100755
index 6226057..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfig.java
+++ /dev/null
@@ -1,60 +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.config;
-
-import com.typesafe.config.Config;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.client.HTableInterface;
-
-import java.util.TimeZone;
-import java.util.concurrent.ThreadPoolExecutor;
-
-public interface EagleConfig {
-
-    boolean isCoprocessorEnabled();
-
-	HTableInterface getHTable(String tableName);
-
-    Configuration getHbaseConf();
-
-    String getStorageType();
-
-    ThreadPoolExecutor getExecutor();
-
-	String getZKQuorum();
-
-	String getZKPort();
-
-	String getServiceHost();
-
-	int getServicePort();
-
-    String getEnv();
-
-    boolean isTableNamePrefixedWithEnvironment();
-	
-    int getHBaseClientScanCacheSize();
-
-    TimeZone getTimeZone();
-    
-    boolean isServiceAuditingEnabled();
-
-    /**
-     * @return root config
-     */
-    Config getConfig();
-}
\ No newline at end of file

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/config/EagleConfigConstants.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigConstants.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigConstants.java
deleted file mode 100644
index 26d7b49..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigConstants.java
+++ /dev/null
@@ -1,65 +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.config;
-
-public final class EagleConfigConstants {
-    public final static String SERVICE_ENV = "eagle.service.env";
-    public final static String SERVICE_HOST = "eagle.service.host";
-    public final static String SERVICE_PORT = "eagle.service.port";
-    public final static String SERVICE_HBASE_ZOOKEEPER_QUORUM = "eagle.service.hbase-zookeeper-quorum";
-    public final static String SERVICE_HBASE_ZOOKEEPER_PROPERTY_CLIENTPORT = "eagle.service.hbase-zookeeper-property-clientPort";
-    public final static String SERVICE_ZOOKEEPER_ZNODE_PARENT = "eagle.service.zookeeper-znode-parent";
-    public final static String SERVICE_HBASE_CLIENT_IPC_POOL_SIZE = "eagle.service.hbase-client-ipc-pool-size";
-    public final static String SERVICE_STORAGE_TYPE = "eagle.service.storage-type";
-    public final static String SERVICE_COPROCESSOR_ENABLED = "eagle.service.coprocessor-enabled";
-    public final static String SERVICE_TABLE_NAME_PREFIXED_WITH_ENVIRONMENT = "eagle.service.table-name-prefixed-with-environment";
-    public final static String SERVICE_HBASE_CLIENT_SCAN_CACHE_SIZE = "eagle.service.hbase-client-scan-cache-size";
-    public final static String SERVICE_THREADPOOL_CORE_SIZE = "eagle.service.threadpool-core-size";
-    public final static String SERVICE_THREADPOOL_MAX_SIZE = "eagle.service.threadpool-max-size";
-    public final static String SERVICE_THREADPOOL_SHRINK_SIZE = "eagle.service.threadpool-shrink-size";
-    public final static String SERVICE_AUDITING_ENABLED = "eagle.service.audit-enabled";
-
-    public final static String EAGLE_TIME_ZONE = "eagle.timezone";
-    public final static String DEFAULT_EAGLE_TIME_ZONE = "UTC";
-
-    public final static int DEFAULT_THREAD_POOL_CORE_SIZE = 10;
-    public final static int DEFAULT_THREAD_POOL_MAX_SIZE = 20;
-    public final static long DEFAULT_THREAD_POOL_SHRINK_TIME = 60000L;
-    public final static String DEFAULT_SERVICE_HOST = "localhost";
-    public final static String DEFAULT_STORAGE_TYPE = "hbase";
-    public final static int DEFAULT_SERVICE_PORT = 8080;
-    public final static String DEFAULT_ZOOKEEPER_ZNODE_PARENT = "/hbase-unsecure";
-
-    public final static String EAGLE_PROPS="eagleProps";
-    public final static String EAGLE_SERVICE = "eagleService";
-    public final static String HOST = "host";
-    public final static String PORT = "port";
-    public final static String USERNAME = "username";
-    public final static String PASSWORD = "password";
-
-    public final static String SITE = "site";
-    @Deprecated
-    public final static String DATA_SOURCE = "dataSource";
-    public final static String APPLICATION = "application";
-
-    public final static String WEB_CONFIG = "web";
-    public final static String APP_CONFIG = "app";
-    public final static String CLASSIFICATION_CONFIG = "classification";
-
-    public final static String LOCAL_MODE = "local";
-    public final static String CLUSTER_MODE = "cluster";
-}
\ No newline at end of file

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/config/EagleConfigFactory.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigFactory.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigFactory.java
deleted file mode 100755
index 0d73743..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigFactory.java
+++ /dev/null
@@ -1,198 +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.config;
-
-import com.typesafe.config.Config;
-import com.typesafe.config.ConfigFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.hbase.client.HTableInterface;
-import org.apache.hadoop.hbase.client.HTablePool;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.TimeZone;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-public class EagleConfigFactory implements EagleConfig {
-	private static final Logger LOG = LoggerFactory.getLogger(EagleConfigFactory.class);
-
-	private String env;
-	private String zkQuorum;
-	private String zkPort;
-
-    private Configuration hbaseConf;
-	private String eagleServiceHost;
-	private int eagleServicePort;
-    private String storageType;
-    private Config config;
-    private TimeZone timeZone;
-
-    public boolean isCoprocessorEnabled() {
-		return isCoprocessorEnabled;
-	}
-
-	private boolean isCoprocessorEnabled;
-
-	private boolean tableNamePrefixedWithEnv;
-
-	private HTablePool pool;
-	private int hbaseClientScanCacheSize = 1000;
-
-	private ThreadPoolExecutor executor = null;
-
-	private static EagleConfigFactory manager = new EagleConfigFactory();
-
-	private EagleConfigFactory(){
-		init();
-		if(this.getStorageType() == null || this.getStorageType().equalsIgnoreCase("hbase")) {
-			this.pool = new HTablePool(this.hbaseConf, 10);
-		}
-	}
-	
-	public static EagleConfig load(){
-		return manager;
-	}
-	
-	public HTableInterface getHTable(String tableName){
-        return pool.getTable(tableName);
-    }
-
-    private String getString(Config config,String path,String defaultValue){
-        if(config.hasPath(path)){
-            return config.getString(path);
-        }else{
-            return defaultValue;
-        }
-    }
-
-    public String getStorageType() {
-        return storageType;
-    }
-
-    public ThreadPoolExecutor getExecutor() {
-        return executor;
-    }
-
-    private void init(){
-        this.config = ConfigFactory.load();
-        this.timeZone = TimeZone.getTimeZone((config.hasPath(EagleConfigConstants.EAGLE_TIME_ZONE)? config.getString(EagleConfigConstants.EAGLE_TIME_ZONE): EagleConfigConstants.DEFAULT_EAGLE_TIME_ZONE));
-        this.env = config.hasPath(EagleConfigConstants.SERVICE_ENV) ? config.getString(EagleConfigConstants.SERVICE_ENV):"dev";
-		this.zkQuorum = config.hasPath(EagleConfigConstants.SERVICE_HBASE_ZOOKEEPER_QUORUM) ? config.getString(EagleConfigConstants.SERVICE_HBASE_ZOOKEEPER_QUORUM):null;
-		this.zkPort = config.hasPath(EagleConfigConstants.SERVICE_HBASE_ZOOKEEPER_PROPERTY_CLIENTPORT) ? config.getString(EagleConfigConstants.SERVICE_HBASE_ZOOKEEPER_PROPERTY_CLIENTPORT): null;
-        String zkZnodeParent = config.hasPath(EagleConfigConstants.SERVICE_ZOOKEEPER_ZNODE_PARENT)? config.getString(EagleConfigConstants.SERVICE_ZOOKEEPER_ZNODE_PARENT): EagleConfigConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT;
-		String clientIPCPoolSize = getString(config, EagleConfigConstants.SERVICE_HBASE_CLIENT_IPC_POOL_SIZE, "10");
-		this.hbaseConf = HBaseConfiguration.create();
-
-        if (this.zkQuorum != null)
-            this.hbaseConf.set("hbase.zookeeper.quorum", this.zkQuorum);
-
-		if (this.zkPort != null)
-            this.hbaseConf.set("hbase.zookeeper.property.clientPort", this.zkPort);
-
-        if(zkZnodeParent != null)
-            this.hbaseConf.set("zookeeper.znode.parent", zkZnodeParent);
-        else
-            this.hbaseConf.set("zookeeper.znode.parent", EagleConfigConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT);
-
-        this.hbaseConf.set("hbase.client.ipc.pool.size", clientIPCPoolSize);
-
-		this.eagleServiceHost = config.hasPath(EagleConfigConstants.SERVICE_HOST) ? config.getString(EagleConfigConstants.SERVICE_HOST) : EagleConfigConstants.DEFAULT_SERVICE_HOST;
-        this.storageType = config.hasPath(EagleConfigConstants.SERVICE_STORAGE_TYPE) ? config.getString(EagleConfigConstants.SERVICE_STORAGE_TYPE) : EagleConfigConstants.DEFAULT_STORAGE_TYPE;
-        this.isCoprocessorEnabled = config.hasPath(EagleConfigConstants.SERVICE_COPROCESSOR_ENABLED) && config.getBoolean(EagleConfigConstants.SERVICE_COPROCESSOR_ENABLED);
-		this.eagleServicePort = config.hasPath(EagleConfigConstants.SERVICE_PORT) ? config.getInt(EagleConfigConstants.SERVICE_PORT) : EagleConfigConstants.DEFAULT_SERVICE_PORT;
-        this.tableNamePrefixedWithEnv = config.hasPath(EagleConfigConstants.SERVICE_TABLE_NAME_PREFIXED_WITH_ENVIRONMENT) && config.getBoolean(EagleConfigConstants.SERVICE_TABLE_NAME_PREFIXED_WITH_ENVIRONMENT);
-        this.hbaseClientScanCacheSize = config.hasPath(EagleConfigConstants.SERVICE_HBASE_CLIENT_SCAN_CACHE_SIZE)? config.getInt(EagleConfigConstants.SERVICE_HBASE_CLIENT_SCAN_CACHE_SIZE) : hbaseClientScanCacheSize;
-        // initilize eagle service thread pool for parallel execution of hbase scan etc.
-		int threadPoolCoreSize = config.hasPath(EagleConfigConstants.SERVICE_THREADPOOL_CORE_SIZE)? config.getInt(EagleConfigConstants.SERVICE_THREADPOOL_CORE_SIZE): EagleConfigConstants.DEFAULT_THREAD_POOL_CORE_SIZE;
-		int threadPoolMaxSize = config.hasPath(EagleConfigConstants.SERVICE_THREADPOOL_MAX_SIZE) ? config.getInt(EagleConfigConstants.SERVICE_THREADPOOL_MAX_SIZE) : EagleConfigConstants.DEFAULT_THREAD_POOL_MAX_SIZE;
-		long threadPoolShrinkTime = config.hasPath(EagleConfigConstants.SERVICE_THREADPOOL_SHRINK_SIZE) ? config.getLong(EagleConfigConstants.SERVICE_THREADPOOL_SHRINK_SIZE) : EagleConfigConstants.DEFAULT_THREAD_POOL_SHRINK_TIME;
-		this.isServiceAuditingEnabled = config.hasPath(EagleConfigConstants.SERVICE_AUDITING_ENABLED) && config.getBoolean(EagleConfigConstants.SERVICE_AUDITING_ENABLED);
-		
-		this.executor = new ThreadPoolExecutor(threadPoolCoreSize, threadPoolMaxSize, threadPoolShrinkTime, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
-
-		LOG.info("Successfully initialized config");
-
-		if(LOG.isDebugEnabled()) {
-			if(this.isCoprocessorEnabled){
-				LOG.debug("Eagle HBase Coprocessor is enabled");
-			}else{
-				LOG.debug("Eagle HBase Coprocessor is disabled");
-			}
-		}
-	}
-
-    @Override
-	public Configuration getHbaseConf() {
-		return hbaseConf;
-	}
-
-    @Override
-	public String getZKQuorum(){
-		return this.zkQuorum;
-    }
-
-    @Override
-	public String getZKPort(){
-		return this.zkPort;
-	}
-
-    @Override
-	public String getServiceHost() {
-		return eagleServiceHost;
-	}
-
-    @Override
-	public int getServicePort() {
-		return eagleServicePort;
-	}
-
-    @Override
-	public String getEnv() {
-		return env;
-	}
-
-    @Override
-	public boolean isTableNamePrefixedWithEnvironment(){
-		return this.tableNamePrefixedWithEnv;
-	}
-
-    @Override
-	public int getHBaseClientScanCacheSize(){
-		return this.hbaseClientScanCacheSize;
-	}
-
-    @Override
-    public TimeZone getTimeZone() {
-        return this.timeZone;
-    }
-
-    @Override
-    public Config getConfig() {
-        return this.config;
-    }
-    
-    // added for jira EAGLE-47
-    boolean isServiceAuditingEnabled;
-    
-    @Override
-	public boolean isServiceAuditingEnabled() {
-		return isServiceAuditingEnabled;
-	}
-}
\ No newline at end of file

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/config/EagleConfigHelper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigHelper.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigHelper.java
deleted file mode 100644
index fe3e190..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/config/EagleConfigHelper.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- *    Licensed to the Apache Software Foundation (ASF) under one or more
- *    contributor license agreements.  See the NOTICE file distributed with
- *    this work for additional information regarding copyright ownership.
- *    The ASF licenses this file to You under the Apache License, Version 2.0
- *    (the "License"); you may not use this file except in compliance with
- *    the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- *
- */
-
-package org.apache.eagle.common.config;
-
-import com.typesafe.config.Config;
-
-public class EagleConfigHelper {
-
-    public static String getServiceHost(Config config) {
-        return config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.HOST);
-    }
-
-    public static int getServicePort(Config config) {
-        return config.getInt(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PORT);
-    }
-
-    public static String getServiceUser(Config config) {
-        return config.hasPath(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.USERNAME) ?
-               config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.USERNAME) : null;
-    }
-
-    public static String getServicePassword(Config config) {
-        return config.hasPath(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PASSWORD) ?
-                config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PASSWORD) : null;
-    }
-
-    public static String getSite(Config config) {
-        return config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.SITE);
-    }
-
-    public static String getApplication(Config config) {
-        return config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.APPLICATION);
-    }
-}

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/email/EagleMailClient.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/email/EagleMailClient.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/email/EagleMailClient.java
deleted file mode 100755
index 6edac0a..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/email/EagleMailClient.java
+++ /dev/null
@@ -1,253 +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.email;
-
-import java.io.File;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.activation.DataHandler;
-import javax.activation.DataSource;
-import javax.activation.FileDataSource;
-import javax.mail.Authenticator;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.PasswordAuthentication;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-
-import org.apache.commons.configuration.AbstractConfiguration;
-import org.apache.velocity.Template;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.exception.ResourceNotFoundException;
-import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.netflix.config.ConcurrentMapConfiguration;
-
-public class EagleMailClient {
-//	private static final String CONFIG_FILE = "config.properties";
-	private static final String BASE_PATH = "templates/";
-	private static final String AUTH_CONFIG = "mail.smtp.auth";
-	private static final String DEBUG_CONFIG = "mail.debug";
-	private static final String USER_CONFIG = "mail.user";
-	private static final String PASSWORD_CONFIG = "mail.password";
-
-	private VelocityEngine velocityEngine;
-	private Session session;
-	private static final Logger LOG = LoggerFactory.getLogger(EagleMailClient.class);
-
-	public EagleMailClient() {
-		this(new ConcurrentMapConfiguration());
-	}
-
-	public EagleMailClient(AbstractConfiguration configuration) {
-		try {
-			ConcurrentMapConfiguration con = (ConcurrentMapConfiguration)configuration;
-			velocityEngine = new VelocityEngine();
-			velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
-			velocityEngine.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
-			velocityEngine.init();
-
-			con.setProperty("mail.transport.protocol", "smtp");
-			final Properties config = con.getProperties();
-			if(Boolean.parseBoolean(config.getProperty(AUTH_CONFIG))){
-				session = Session.getDefaultInstance(config, new Authenticator() {
-					protected PasswordAuthentication getPasswordAuthentication() {
-						return new PasswordAuthentication(config.getProperty(USER_CONFIG), config.getProperty(PASSWORD_CONFIG));
-					}
-				});
-			}
-			else session = Session.getDefaultInstance(config, new Authenticator() {});
-			final String debugMode = config.getProperty(DEBUG_CONFIG, "false");
-			final boolean debug = Boolean.parseBoolean(debugMode);
-			session.setDebug(debug);
-		} catch (Exception e) {
-            LOG.error("Failed connect to smtp server",e);
-		}
-	}
-
-	private boolean _send(String from, String to, String cc, String title,
-			String content) {
-		Message msg = new MimeMessage(session);
-		try {
-			msg.setFrom(new InternetAddress(from));
-			msg.setSubject(title);
-			if (to != null) {
-				msg.setRecipients(Message.RecipientType.TO,
-						InternetAddress.parse(to));
-			}
-			if (cc != null) {
-				msg.setRecipients(Message.RecipientType.CC,
-						InternetAddress.parse(cc));
-			}
-			//msg.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(DEFAULT_BCC_ADDRESS));
-			msg.setContent(content, "text/html;charset=utf-8");
-			LOG.info(String.format("Going to send mail: from[%s], to[%s], cc[%s], title[%s]", from, to, cc, title));
-
-			Transport.send(msg);
-
-			return true;
-		} catch (AddressException e) {
-			LOG.info("Send mail failed, got an AddressException: " + e.getMessage(), e);
-			return false;
-		} catch (MessagingException e) {
-			LOG.info("Send mail failed, got an AddressException: " + e.getMessage(), e);
-			return false;
-		}
-	}
-
-	private boolean _send(String from,String to,String cc,String title,String content,List<MimeBodyPart> attachments){
-		MimeMessage mail = new MimeMessage(session);
-		try {
-			mail.setFrom(new InternetAddress(from));
-			mail.setSubject(title);
-			if (to != null) {
-				mail.setRecipients(Message.RecipientType.TO,
-						InternetAddress.parse(to));
-			}
-			if (cc != null) {
-				mail.setRecipients(Message.RecipientType.CC,
-						InternetAddress.parse(cc));
-			}
-
-			//mail.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(DEFAULT_BCC_ADDRESS));
-
-			MimeBodyPart mimeBodyPart = new MimeBodyPart();
-			mimeBodyPart.setContent(content,"text/html;charset=utf-8");
-
-			Multipart multipart = new MimeMultipart();
-			multipart.addBodyPart(mimeBodyPart);
-
-			for(MimeBodyPart attachment:attachments){
-				multipart.addBodyPart(attachment);
-			}
-
-			mail.setContent(multipart);
-//			mail.setContent(content, "text/html;charset=utf-8");
-			LOG.info(String.format("Going to send mail: from[%s], to[%s], cc[%s], title[%s]", from, to, cc, title));
-
-			Transport.send(mail);
-
-			return true;
-		} catch (AddressException e) {
-			LOG.info("Send mail failed, got an AddressException: " + e.getMessage(), e);
-			return false;
-		} catch (MessagingException e) {
-			LOG.info("Send mail failed, got an AddressException: " + e.getMessage(), e);
-			return false;
-		}
-	}
-
-	public boolean send(String from, String to, String cc, String title,
-			String content) {
-		return this._send(from, to, cc, title, content);
-	}
-
-	public boolean send(String from, String to, String cc, String title,
-			String templatePath, VelocityContext context) {
-		Template t = null;
-		try {
-			t = velocityEngine.getTemplate(BASE_PATH + templatePath);
-		} catch (ResourceNotFoundException ex) {
-
-		}
-		if (t == null) {
-			try {
-				t = velocityEngine.getTemplate(templatePath);
-			} catch (ResourceNotFoundException e) {
-				t = velocityEngine.getTemplate("/" + templatePath);
-			}
-		}
-		final StringWriter writer = new StringWriter();
-		t.merge(context, writer);
-		if(LOG.isDebugEnabled()) LOG.debug(writer.toString());
-		return this.send(from, to, cc, title, writer.toString());
-	}
-
-	public boolean send(String from, String to, String cc, String title,
-	                    String templatePath, VelocityContext context, Map<String,File> attachments) {
-		if (attachments == null || attachments.isEmpty()) {
-			return send(from, to, cc, title, templatePath, context);
-		}
-		Template t = null;
-
-		List<MimeBodyPart> mimeBodyParts = new ArrayList<MimeBodyPart>();
-		Map<String,String> cid = new HashMap<String,String>();
-
-		for (Map.Entry<String,File> entry : attachments.entrySet()) {
-			final String attachment = entry.getKey();
-			final File attachmentFile  = entry.getValue();
-			final MimeBodyPart mimeBodyPart = new MimeBodyPart();
-			if(attachmentFile !=null && attachmentFile.exists()){
-				DataSource source = new FileDataSource(attachmentFile);
-				try {
-					mimeBodyPart.setDataHandler(new DataHandler(source));
-					mimeBodyPart.setFileName(attachment);
-					mimeBodyPart.setDisposition(MimeBodyPart.ATTACHMENT);
-					mimeBodyPart.setContentID(attachment);
-					cid.put(attachment,mimeBodyPart.getContentID());
-					mimeBodyParts.add(mimeBodyPart);
-				} catch (MessagingException e) {
-					LOG.error("Generate mail failed, got exception while attaching files: " + e.getMessage(), e);
-				}
-			}else{
-				LOG.error("Attachment: " + attachment + " is null or not exists");
-			}
-		}
-		//TODO remove cid, because not used at all
-		if(LOG.isDebugEnabled()) LOG.debug("Cid maps: "+cid);
-		context.put("cid", cid);
-
-		try {
-			t = velocityEngine.getTemplate(BASE_PATH + templatePath);
-		} catch (ResourceNotFoundException ex) {
-//			LOGGER.error("Template not found:"+BASE_PATH + templatePath, ex);
-		}
-
-		if (t == null) {
-			try {
-				t = velocityEngine.getTemplate(templatePath);
-			} catch (ResourceNotFoundException e) {
-				try {
-					t = velocityEngine.getTemplate("/" + templatePath);
-				}
-				catch (Exception ex) {
-					LOG.error("Template not found:"+ "/" + templatePath, ex);
-				}
-			}
-		}
-
-		final StringWriter writer = new StringWriter();
-		t.merge(context, writer);
-		if(LOG.isDebugEnabled()) LOG.debug(writer.toString());
-		return this._send(from, to, cc, title, writer.toString(), mimeBodyParts);
-	}
-}

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/metric/AlertContext.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/metric/AlertContext.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/metric/AlertContext.java
deleted file mode 100644
index e046edf..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/metric/AlertContext.java
+++ /dev/null
@@ -1,95 +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.metric;
-
-import org.apache.log4j.spi.LoggerFactory;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.slf4j.Logger;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * not thread safe
- */
-public class AlertContext implements Serializable{
-	private static final Logger LOG = org.slf4j.LoggerFactory.getLogger(AlertContext.class);
-
-	private Map<String, String> properties = new HashMap<String, String>();
-	
-	public AlertContext(){
-	}
-	
-	public AlertContext(AlertContext context){
-		this.properties = new HashMap<String, String>(context.properties);
-	}
-	
-	public String removeProperty(String name)
-	{
-		return properties.remove(name);
-	}
-	
-	public AlertContext addProperty(String name, String value){
-		properties.put(name, value);
-		return this;
-	}
-
-	public AlertContext addAll(Map<String,String> propHash){
-		this.properties.putAll(propHash);
-		return this;
-	}
-
-	public String toJsonString(){
-		ObjectMapper objectMapper = new ObjectMapper();
-		try {
-			return objectMapper.writeValueAsString(properties);
-		}catch(Exception ex){
-			LOG.error("fail converting alertcontext into string", ex);
-			return null;
-		}
-	}
-
-	public static AlertContext fromJsonString(String json){
-		ObjectMapper objectMapper = new ObjectMapper();
-		try{
-			Map m = objectMapper.readValue(json, Map.class);
-			AlertContext c = new AlertContext();
-			c.addAll(m);
-			return c;
-		}catch(Exception ex){
-			LOG.error("fail converting string into alertcontext", ex);
-			return null;
-		}
-	}
-
-	public String getProperty(String name){
-		return properties.get(name);
-	}
-	
-	public String toString(){
-		return properties.toString();
-	}
-
-	public Map<String, String> getProperties(){
-		return properties;
-	}
-	
-	public void setProperties(Map<String, String> properties){
-		this.properties = properties;
-	}
-}

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/service/HadoopAccountService.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/HadoopAccountService.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/HadoopAccountService.java
deleted file mode 100644
index 0b4893a..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/HadoopAccountService.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.common.service;
-
-import java.util.List;
-
-public interface HadoopAccountService {
-	public List<HadoopUser> searchByUsername(List<String> username);
-}
\ No newline at end of file

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/service/HadoopUser.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/HadoopUser.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/HadoopUser.java
deleted file mode 100644
index 2e84f77..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/HadoopUser.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.common.service;
-
-import java.util.List;
-
-/**
- * @since : 7/11/14,2014
- */
-public class HadoopUser {
-	public String getUsername() {
-		return username;
-	}
-
-	public void setUsername(String username) {
-		this.username = username;
-	}
-
-	protected String username;
-
-	public List<String> getEmail() {
-		return email;
-	}
-
-	public void setEmail(List<String> emails) {
-		this.email = emails;
-	}
-
-	protected List<String> email;
-}
\ No newline at end of file

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/service/LdapService.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/LdapService.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/LdapService.java
deleted file mode 100644
index 31f1d01..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/LdapService.java
+++ /dev/null
@@ -1,259 +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.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<String> 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<String, String> env = new Hashtable<String, String>();
-//		if (ldapCerts != null) {
-        env.put(Context.SECURITY_PROTOCOL, "ssl");
-//		}
-        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
-        env.put(Context.PROVIDER_URL, host);
-        env.put(Context.SECURITY_AUTHENTICATION, "simple");
-        env.put(Context.SECURITY_PRINCIPAL, securityPrincipal);
-        env.put(Context.SECURITY_CREDENTIALS, securityCredentials);
-        env.put("java.naming.ldap.attributes.binary", "objectSID");
-        env.put("java.naming.ldap.factory.socket","hadoop.eagle.common.service.TrustAllSSLSocketFactory");
-
-        DirContext ctx = null;
-        try {
-            ctx = new InitialDirContext(env);
-        } catch (Exception e) {
-            ctx = null;
-            LOG.error("LDAP authentication failed with exception: " + e.getMessage(), e);
-        }
-        return ctx;
-    }
-
-    public final static String CN= "cn";
-    public final static String DISPLAY_NAME =  "displayName";
-    public final static String DESCRIPTION= "description";
-    public final static String SAMACCOUNT_NAME= "sAMAccountName";
-    public final static String TELEPHONE_NUMBER= "telephonenumber";
-    public final static String GIVEN_NAME= "givenName";
-    public final static String UID_NUMBER =  "uidNumber";
-    public final static String L = "l";
-    public final static String ST = "st";
-    public final static String CO = "co";
-    public final static String MEMBER_OF = "memberof";
-    public final static String SN =  "sn";
-    public final static String MAIL = "mail";
-    public final static String DISTINGUISHED_NAME =  "distinguishedName";
-
-    protected SearchControls getSearchControl() {
-        SearchControls sc = new SearchControls();
-
-        String[] attributeFilter = new String[15];
-        attributeFilter[0] = CN;
-        attributeFilter[1] =  DISPLAY_NAME ;
-        attributeFilter[2] = DESCRIPTION;
-        attributeFilter[3] =  SAMACCOUNT_NAME;
-        attributeFilter[4] =  TELEPHONE_NUMBER;
-        attributeFilter[5] = GIVEN_NAME;
-        attributeFilter[6] = UID_NUMBER;
-        attributeFilter[7] = L;
-        attributeFilter[8] = ST;
-        attributeFilter[9] =CO;
-        attributeFilter[10] = MEMBER_OF;
-        attributeFilter[11] = SN;
-        attributeFilter[12] = MAIL;
-        attributeFilter[13] = DISTINGUISHED_NAME;
-
-        sc.setReturningAttributes(attributeFilter);
-        sc.setSearchScope(SearchControls.SUBTREE_SCOPE);
-
-        return sc;
-    }
-
-    public Map<String, String> getUserInfo(String userName) {
-        Map<String, String> infos = null;
-        for (int i = 0; i < ldapSrvs.size(); i++) {
-            if(LOG.isDebugEnabled()) LOG.debug("Using server: "+ldapSrvs.get(i));
-            infos = getUserInfo(i, userName);
-            if (infos.size() > 0)
-                break;
-        }
-        return infos;
-    }
-
-    public Map<String, String> getUserInfo(int id, String userName) {
-        if(LOG.isDebugEnabled()) LOG.debug("Ldap get user information for id:"+id+", username:"+userName);
-        DirContext ctx = getDirContext(id);
-        Map<String, String> infos = new HashMap<String, String>();
-
-        if (ctx != null) {
-            try {
-                SearchControls sc = getSearchControl();
-                String filter = "(&(objectClass=user)(sAMAccountName=" + userName + "))";
-                NamingEnumeration<?> results = ctx.search("OU=Accounts_User,DC=corp,DC=company1,DC=com", filter, sc);
-
-                while (results.hasMore()) {
-                    SearchResult sr = (SearchResult) results.next();
-                    Attributes attrs = sr.getAttributes();
-
-                    for (NamingEnumeration<?> ae = attrs.getAll(); ae.hasMoreElements();) {
-                        Attribute attr = (Attribute) ae.next();
-                        String attrId = attr.getID();
-                        for (NamingEnumeration<?> vals = attr.getAll(); vals.hasMore();) {
-                            String thing = vals.next().toString();
-                            infos.put(attrId, thing);
-                        }
-                    }
-                }
-            } catch (NamingException e) {
-                LOG.error("LDAP authentication failed with exception: "+e.getMessage(),e);
-            }
-        }
-
-        if(LOG.isDebugEnabled()) LOG.debug(infos.toString());
-        return infos;
-    }
-
-    public boolean authenticate(String userName, String password) {
-        for (int i = 0; i < ldapSrvs.size(); i++) {
-            if (authenticate(i, userName, password))
-                return true;
-        }
-        return false;
-    }
-
-    public boolean authenticate(int id, String userName, String password) {
-        boolean result = false;
-
-        DirContext ctx = getDirContext(id);
-        if (ctx != null) {
-            try {
-                SearchControls sc = getSearchControl();
-                String filter = "(&(objectClass=user)(sAMAccountName=" + userName + "))";
-                NamingEnumeration<?> results = ctx.search("OU=Accounts_User,DC=corp,DC=company1,DC=com", filter, sc);
-
-                String userDN = null;
-                if (results.hasMore()) {
-                    while (results.hasMore()) {
-                        SearchResult sr = (SearchResult) results.next();
-                        Attributes attrs = sr.getAttributes();
-
-                        userDN = attrs.get("distinguishedName").get().toString();
-                    }
-                }
-                ctx.close();
-
-                if (userDN != null) {
-                    Hashtable<String, String> uenv = new Hashtable<String, String>();
-//					if (ldapCerts != null) {
-                    uenv.put(Context.SECURITY_PROTOCOL, "ssl");
-//					}
-                    uenv.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
-                    uenv.put(Context.PROVIDER_URL, ldapSrvs.get(id));
-                    uenv.put(Context.SECURITY_AUTHENTICATION, "simple");
-                    uenv.put(Context.SECURITY_PRINCIPAL, userDN);
-                    uenv.put(Context.SECURITY_CREDENTIALS, password);
-                    uenv.put("java.naming.ldap.factory.socket","hadoop.eagle.common.service.TrustAllSSLSocketFactory");
-                    DirContext uctx = new InitialDirContext(uenv);
-                    uctx.close();
-
-                    result = true;
-                }
-            } catch (NamingException e) {
-                LOG.error("LDAP authentication failed with exception: " + e.getMessage(), e);
-            }
-        }
-
-        return result;
-    }
-}
\ No newline at end of file

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/service/POSTResultEntityBase.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/POSTResultEntityBase.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/POSTResultEntityBase.java
deleted file mode 100644
index e0daeb7..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/POSTResultEntityBase.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.common.service;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(propOrder = {"success", "exception"})
-public class POSTResultEntityBase {
-	private boolean success;
-	private String exception;
-	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/e21b073f/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/TrustAllSSLSocketFactory.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/TrustAllSSLSocketFactory.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/TrustAllSSLSocketFactory.java
deleted file mode 100644
index 9facc82..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/service/TrustAllSSLSocketFactory.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 org.apache.eagle.common.service;
-
-import javax.net.SocketFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSocketFactory;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.security.cert.X509Certificate;
-
-public class TrustAllSSLSocketFactory extends SSLSocketFactory
-{
-	private SSLSocketFactory socketFactory;
-	public TrustAllSSLSocketFactory()
-	{
-		try {
-			SSLContext ctx = SSLContext.getInstance("SSL");
-//			ctx.init(null, new TrustManager[]{new TrustAnyTrustManager() {}}, new SecureRandom());
-			ctx.init(null, new TrustManager[]{new TrustAnyTrustManager() {}}, null);
-			socketFactory = ctx.getSocketFactory();
-		} catch ( Exception ex ){ ex.printStackTrace(System.err);  /* handle exception */ }
-	}
-	public static SocketFactory getDefault(){
-		return new TrustAllSSLSocketFactory();
-	}
-	@Override
-	public String[] getDefaultCipherSuites()
-	{
-		return socketFactory.getDefaultCipherSuites();
-	}
-	@Override
-	public String[] getSupportedCipherSuites()
-	{
-		return socketFactory.getSupportedCipherSuites();
-	}
-	@Override
-	public Socket createSocket(Socket socket, String string, int i, boolean bln) throws IOException
-	{
-		return socketFactory.createSocket(socket, string, i, bln);
-	}
-	@Override
-	public Socket createSocket(String string, int i) throws IOException, UnknownHostException
-	{
-		return socketFactory.createSocket(string, i);
-	}
-	@Override
-	public Socket createSocket(String string, int i, InetAddress ia, int i1) throws IOException, UnknownHostException
-	{
-		return socketFactory.createSocket(string, i, ia, i1);
-	}
-	@Override
-	public Socket createSocket(InetAddress ia, int i) throws IOException
-	{
-		return socketFactory.createSocket(ia, i);
-	}
-	@Override
-	public Socket createSocket(InetAddress ia, int i, InetAddress ia1, int i1) throws IOException
-	{
-		return socketFactory.createSocket(ia, i, ia1, i1);
-	}
-
-	private static class TrustAnyTrustManager implements X509TrustManager {
-		@Override
-		public void checkClientTrusted( final X509Certificate[] chain, final String authType ) {
-		}
-		@Override
-		public void checkServerTrusted( final X509Certificate[] chain, final String authType ) {
-		}
-		@Override
-		public X509Certificate[] getAcceptedIssuers() {
-			return null;
-		}
-	}
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/main/resources/footer.vm
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/resources/footer.vm b/eagle-core/eagle-query/eagle-common/src/main/resources/footer.vm
deleted file mode 100755
index 89cf245..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/resources/footer.vm
+++ /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.
- *
- * @version 0.3.0
- *#
-	</td>
-  </tr>
-  </tr>
-</table>
-<!-- End of wrapper table -->
-</body>
-</html>