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/10/19 03:27:16 UTC

[01/50] incubator-eagle git commit: [EAGLE-598] Create 'ui' building profile and enable Eagle Web UI Building by default [Forced Update!]

Repository: incubator-eagle
Updated Branches:
  refs/heads/master 0474d5916 -> 6dbdb4f72 (forced update)


[EAGLE-598] Create 'ui' building profile and enable Eagle Web UI Building by default

Create "ui" building profile and enable Eagle Web UI Building by default

    mvn clean install -DskipTests

Could also disable UI building with:

    mvn clean install -DskipTests -P!ui

Or (if "!" is reserved command in OS)

    mvn clean install -DskipTests -P\!ui

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

Closes #482 from haoch/EAGLE-598.


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

Branch: refs/heads/master
Commit: 0277ff75e10620cdfc17d01823a37719af63995b
Parents: 1731612
Author: Hao Chen <ha...@apache.org>
Authored: Mon Oct 10 15:54:52 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Mon Oct 10 15:54:52 2016 +0800

----------------------------------------------------------------------
 eagle-server/pom.xml                            | 64 +++++++++++++-------
 .../server/managedtask/ApplicationTask.java     |  4 +-
 eagle-server/ui-build.sh                        |  5 +-
 pom.xml                                         |  6 ++
 4 files changed, 53 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0277ff75/eagle-server/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-server/pom.xml b/eagle-server/pom.xml
index 99de507..aa190e4 100644
--- a/eagle-server/pom.xml
+++ b/eagle-server/pom.xml
@@ -157,13 +157,43 @@
 
     <profiles>
         <profile>
+            <id>ui</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>exec-ui-install</id>
+                                <phase>generate-sources</phase>
+                                <goals>
+                                    <goal>exec</goal>
+                                </goals>
+                                <configuration>
+                                    <executable>bash</executable>
+                                    <arguments>
+                                        <argument>${basedir}/ui-build.sh</argument>
+                                    </arguments>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
             <id>dev</id>
             <activation>
                 <activeByDefault>true</activeByDefault>
             </activation>
 
             <!-- =========================================================================================================
-                 TODO: Decouple following specific application related dependencies into independent module: eagle-develop
+                 Following specific application related dependencies into independent module: eagle-develop
                  ========================================================================================================= -->
 
             <dependencies>
@@ -223,28 +253,16 @@
         </profile>
     </profiles>
     <build>
-        <!-- TODO: Temporarily disable ui-build.sh until INFRA-12669 was resolved -->
-        <!--<plugins>-->
-            <!--<plugin>-->
-                <!--<groupId>org.codehaus.mojo</groupId>-->
-                <!--<artifactId>exec-maven-plugin</artifactId>-->
-                <!--<executions>-->
-                    <!--<execution>-->
-                        <!--<id>exec-ui-install</id>-->
-                        <!--<phase>generate-sources</phase>-->
-                        <!--<goals>-->
-                            <!--<goal>exec</goal>-->
-                        <!--</goals>-->
-                        <!--<configuration>-->
-                            <!--<executable>bash</executable>-->
-                            <!--<arguments>-->
-                                <!--<argument>${basedir}/ui-build.sh</argument>-->
-                            <!--</arguments>-->
-                        <!--</configuration>-->
-                    <!--</execution>-->
-                <!--</executions>-->
-            <!--</plugin>-->
-        <!--</plugins>-->
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <failOnViolation>true</failOnViolation>
+                    <failsOnError>true</failsOnError>
+                </configuration>
+            </plugin>
+        </plugins>
         <resources>
             <resource>
                 <directory>src/main/webapp/app/ui</directory>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0277ff75/eagle-server/src/main/java/org/apache/eagle/server/managedtask/ApplicationTask.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/managedtask/ApplicationTask.java b/eagle-server/src/main/java/org/apache/eagle/server/managedtask/ApplicationTask.java
index d1173a8..b3a1b95 100644
--- a/eagle-server/src/main/java/org/apache/eagle/server/managedtask/ApplicationTask.java
+++ b/eagle-server/src/main/java/org/apache/eagle/server/managedtask/ApplicationTask.java
@@ -23,10 +23,10 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class ApplicationTask implements Managed {
-    private final static Logger LOG = LoggerFactory.getLogger(ApplicationTask.class);
+    private static final Logger LOG = LoggerFactory.getLogger(ApplicationTask.class);
     private final AbstractScheduledService service;
 
-    public ApplicationTask(AbstractScheduledService service){
+    public ApplicationTask(AbstractScheduledService service) {
         this.service = service;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0277ff75/eagle-server/ui-build.sh
----------------------------------------------------------------------
diff --git a/eagle-server/ui-build.sh b/eagle-server/ui-build.sh
index 9f17ba6..928df1f 100644
--- a/eagle-server/ui-build.sh
+++ b/eagle-server/ui-build.sh
@@ -15,7 +15,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-echo "=============== Web APP Building Start ==============="
+echo "=============== Building Web UI ==============="
+
 echo "Environment Check..."
 # Pre-build check
 if [ -z "$(command -v git)" ]
@@ -38,3 +39,5 @@ npm install
 # grunt build
 echo "building..."
 npm run build
+
+echo "=============== Finished ==============="
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0277ff75/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d12fb7d..19a1a1d 100755
--- a/pom.xml
+++ b/pom.xml
@@ -156,6 +156,7 @@
         <maven-source.version>3.0.0</maven-source.version>
         <maven-compiler.version>3.5.1</maven-compiler.version>
         <maven-dependency.version>2.10</maven-dependency.version>
+        <maven-exec.version>1.4.0</maven-exec.version>
         <maven-license.version>2.6</maven-license.version>
         <maven-surefire.version>2.6</maven-surefire.version>
         <maven-jar.version>2.6</maven-jar.version>
@@ -1110,6 +1111,11 @@
                     <version>${maven-assembly.version}</version>
                 </plugin>
                 <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>exec-maven-plugin</artifactId>
+                    <version>${maven-exec.version}</version>
+                </plugin>
+                <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-dependency-plugin</artifactId>
                     <version>${maven-dependency.version}</version>


[34/50] incubator-eagle git commit: [EAGLE-624][UI] Improve ui information and fix bugs

Posted by ha...@apache.org.
[EAGLE-624][UI] Improve ui information and fix bugs

## Improvements
* Show dependencies apps number
* Support XML child node tree as String in app docs
* Cleanup eagle-server dependencies and output
* Move business logic specific logics into dev profile
* Rename header and remove pre fo installation content

## Bugs
* Fix siteName bug in ui
* Installation Doc is not correctly shown in Installation Dialog

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

Closes #513 from haoch/ImproveUIInfo.


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

Branch: refs/heads/master
Commit: 97edbbbe315b9b927bf5e3386a2162e7e4ad99bf
Parents: 1a74b09
Author: Hao Chen <ha...@apache.org>
Authored: Sun Oct 16 22:02:58 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Sun Oct 16 22:02:58 2016 +0800

----------------------------------------------------------------------
 ...e.alert.app.AlertUnitTopologyAppProvider.xml |  18 +++
 .../config/ApplicationProviderDescConfig.java   |   2 +-
 ...he.eagle.app.TestWebApplication$Provider.xml |   8 ++
 .../eagle/metadata/model/ApplicationDocs.java   |  10 +-
 .../metadata/utils/InnerDomAsTextHandler.java   |  66 +++++++++
 .../metadata/utils/InstallDocDomHandler.java    |  23 +++
 .../metadata/utils/UninstallDocDomHandler.java  |  23 +++
 eagle-server-assembly/pom.xml                   |   9 --
 eagle-server/pom.xml                            | 141 +++++++++++--------
 .../org/apache/eagle/server/ServerMain.java     |  11 +-
 .../app/dev/partials/integration/site.html      |  43 +++---
 .../app/dev/public/js/ctrls/integrationCtrl.js  |   4 +
 12 files changed, 261 insertions(+), 97 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97edbbbe/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
index 8e386be..b3e777c 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
+++ b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
@@ -128,8 +128,26 @@
     </configuration>
     <docs>
         <install>
+            <div>
+                <label>Perquisites</label>
+                <ol>
+                    <li>Require permission to READ/WRITE/CREATE on kafka topic</li>
+                </ol>
+                <label>Usage Steps</label>
+                <ol>
+                    <li>Configure kafka connection in <b>settings</b></li>
+                    <li>Install and start alert engine</li>
+                    <li>Integrate streams and define policy</li>
+                </ol>
+            </div>
         </install>
         <uninstall>
+            <div>
+                <label>After uninstalled</label>
+                <ol>
+                    <li>Clean up kafka topics automatically created by alert engine</li>
+                </ol>
+            </div>
         </uninstall>
     </docs>
 </application>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97edbbbe/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
index 2d2b7e2..0a8b81f 100644
--- 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
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97edbbbe/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/providers/org.apache.eagle.app.TestWebApplication$Provider.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/providers/org.apache.eagle.app.TestWebApplication$Provider.xml b/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/providers/org.apache.eagle.app.TestWebApplication$Provider.xml
index 5456bce..19aa5e8 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/providers/org.apache.eagle.app.TestWebApplication$Provider.xml
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/resources/META-INF/providers/org.apache.eagle.app.TestWebApplication$Provider.xml
@@ -27,4 +27,12 @@
             <version>0.5.0-incubating</version>
         </dependency>
     </dependencies>
+    <docs>
+        <install>
+            <h1>Installation Guide</h1>
+        </install>
+        <uninstall>
+            <h1>Un-installation Guide</h1>
+        </uninstall>
+    </docs>
 </application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97edbbbe/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
index f83f377..6aafa90 100644
--- 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
@@ -16,18 +16,26 @@
  */
 package org.apache.eagle.metadata.model;
 
+import org.apache.eagle.metadata.utils.InstallDocDomHandler;
+import org.apache.eagle.metadata.utils.UninstallDocDomHandler;
+
+import javax.xml.bind.annotation.XmlAnyElement;
+
 public class ApplicationDocs {
     private String install;
+
     private String uninstall;
 
     public String getInstall() {
         return install;
     }
 
+    @XmlAnyElement(value=InstallDocDomHandler.class)
     public void setInstall(String install) {
         this.install = install;
     }
 
+    @XmlAnyElement(value= UninstallDocDomHandler.class)
     public String getUninstall() {
         return uninstall;
     }
@@ -35,4 +43,4 @@ public class ApplicationDocs {
     public void setUninstall(String uninstall) {
         this.uninstall = uninstall;
     }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97edbbbe/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/InnerDomAsTextHandler.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/InnerDomAsTextHandler.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/InnerDomAsTextHandler.java
new file mode 100644
index 0000000..1358fff
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/InnerDomAsTextHandler.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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 javax.xml.bind.ValidationEventHandler;
+import javax.xml.bind.annotation.DomHandler;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+public abstract class InnerDomAsTextHandler implements DomHandler<String, StreamResult> {
+    private final String startTag;
+    private final String endTag;
+    private StringWriter xmlWriter = new StringWriter();
+
+    /**
+     * Default constructor.
+     *
+     * It is up to a JAXB provider to decide which DOM implementation
+     * to use or how that is configured.
+     */
+    public InnerDomAsTextHandler(String tagName) {
+        this.startTag = String.format("<%s>",tagName);
+        this.endTag = String.format("</%s>",tagName);
+    }
+
+    @Override
+    public StreamResult createUnmarshaller(ValidationEventHandler errorHandler) {
+        return new StreamResult(xmlWriter);
+    }
+
+    @Override
+    public String getElement(StreamResult rt) {
+        String xml = rt.getWriter().toString();
+        int beginIndex = xml.indexOf(startTag) + startTag.length();
+        int endIndex = xml.indexOf(endTag);
+        return xml.substring(beginIndex, endIndex);
+    }
+
+    @Override
+    public Source marshal(String n, ValidationEventHandler errorHandler) {
+        try {
+            StringReader xmlReader = new StringReader(n);
+            return new StreamSource(xmlReader);
+        } catch(Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97edbbbe/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/InstallDocDomHandler.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/InstallDocDomHandler.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/InstallDocDomHandler.java
new file mode 100644
index 0000000..ae84c29
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/InstallDocDomHandler.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.metadata.utils;
+
+public class InstallDocDomHandler extends InnerDomAsTextHandler {
+    public InstallDocDomHandler() {
+        super("install");
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97edbbbe/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/UninstallDocDomHandler.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/UninstallDocDomHandler.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/UninstallDocDomHandler.java
new file mode 100644
index 0000000..c1812c4
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/UninstallDocDomHandler.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.metadata.utils;
+
+public class UninstallDocDomHandler extends InnerDomAsTextHandler {
+    public UninstallDocDomHandler() {
+        super("uninstall");
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97edbbbe/eagle-server-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-server-assembly/pom.xml b/eagle-server-assembly/pom.xml
index 3bc888e..b080335 100644
--- a/eagle-server-assembly/pom.xml
+++ b/eagle-server-assembly/pom.xml
@@ -29,20 +29,11 @@
     <name>eagle-server-assembly</name>
     <url>http://maven.apache.org</url>
     <dependencies>
-        <!--<dependency>-->
-        <!--<groupId>org.slf4j</groupId>-->
-        <!--<artifactId>slf4j-api</artifactId>-->
-        <!--</dependency>-->
         <dependency>
             <groupId>org.apache.eagle</groupId>
             <artifactId>eagle-server</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <!--<dependency>-->
-        <!--<groupId>org.apache.eagle</groupId>-->
-        <!--<artifactId>eagle-topology-assembly</artifactId>-->
-        <!--<version>${project.version}</version>-->
-        <!--</dependency>-->
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97edbbbe/eagle-server/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-server/pom.xml b/eagle-server/pom.xml
index 7fe4397..37ba4f2 100644
--- a/eagle-server/pom.xml
+++ b/eagle-server/pom.xml
@@ -26,57 +26,13 @@
         <version>0.5.0-incubating-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
-
     <artifactId>eagle-server</artifactId>
+    <name>Eagle::Server</name>
+    <description>
+        Apache Eagle Server
+    </description>
     <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>
-                <exclusion>
-                    <groupId>com.sun.jersey.contribs</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>
-        </dependency>
-        <dependency>
-            <groupId>io.dropwizard</groupId>
-            <artifactId>dropwizard-assets</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.eagle</groupId>
             <artifactId>alert-metadata-service</artifactId>
             <version>${project.version}</version>
@@ -145,25 +101,19 @@
         </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-security-hbase-auditlog</artifactId>
+            <artifactId>eagle-entity-base</artifactId>
             <version>${project.version}</version>
             <exclusions>
                 <exclusion>
                     <groupId>org.slf4j</groupId>
+                    <artifactId>log4j-over-slf4j</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
                     <artifactId>slf4j-log4j12</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
-        <dependency>
-            <groupId>org.apache.eagle</groupId>
-            <artifactId>eagle-security-hbase-web</artifactId>
-            <version>${project.version}</version>
-        </dependency>
 
         <!-- Alert unit topology as an application -->
         <dependency>
@@ -174,6 +124,53 @@
 
         <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>
+                <exclusion>
+                    <groupId>com.sun.jersey.contribs</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>
+        </dependency>
+        <dependency>
+            <groupId>io.dropwizard</groupId>
+            <artifactId>dropwizard-assets</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.dropwizard</groupId>
             <artifactId>dropwizard-auth</artifactId>
         </dependency>
         <dependency>
@@ -216,6 +213,7 @@
         <profile>
             <id>dev</id>
             <activation>
+                <!-- TODO: Should disable "dev" profile by default -->
                 <activeByDefault>true</activeByDefault>
             </activation>
 
@@ -224,6 +222,31 @@
                  ========================================================================================================= -->
 
             <dependencies>
+                <!-- App: Example Application -->
+                <dependency>
+                    <groupId>org.apache.eagle</groupId>
+                    <artifactId>eagle-app-example</artifactId>
+                    <version>${project.version}</version>
+                </dependency>
+
+                <!-- App: HBase Security Monitoring -->
+                <dependency>
+                    <groupId>org.apache.eagle</groupId>
+                    <artifactId>eagle-security-hbase-auditlog</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-security-hbase-web</artifactId>
+                    <version>${project.version}</version>
+                </dependency>
+
                 <!-- App: Oozie  Auditlog monitoring -->
                 <dependency>
                     <groupId>org.apache.eagle</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97edbbbe/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
index a944265..cdb243e 100644
--- a/eagle-server/src/main/java/org/apache/eagle/server/ServerMain.java
+++ b/eagle-server/src/main/java/org/apache/eagle/server/ServerMain.java
@@ -19,16 +19,15 @@ package org.apache.eagle.server;
 public class ServerMain {
     public static void main(String[] args) {
         System.out.println(
-            "Welcome to Apache Eagle (Incubating)\n"
-                + "---------------"
-        );
-        System.out.println(
-            "Starting Eagle Server ..."
+              "----------------------------\n"
+            + " Apache Eagle\u2122 (Incubating)\n"
+            + "----------------------------"
         );
+        System.out.println("\nStarting Eagle Server ...\n");
         try {
             new ServerApplication().run(args);
         } catch (Exception e) {
-            System.err.println("Got exception: " + e.getMessage());
+            System.err.println("Oops, got error to start eagle server: " + e.getMessage());
             e.printStackTrace();
             System.exit(1);
         }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97edbbbe/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
index 6b02a70..db6b7c7 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
@@ -21,7 +21,7 @@
 
 	<div class="form-group">
 		<label>Site</label>
-		<input type="text" class="form-control" readonly ng-model="siteName">
+		<input type="text" class="form-control" readonly ng-model="site.siteName">
 	</div>
 	<div class="form-group">
 		<label>Description</label>
@@ -84,7 +84,7 @@
 						</button>
 					</div>
 					<div class="btn-group btn-group-xs" ng-if="!app.installed">
-						<button class="btn btn-primary btn-sm" ng-click="installApp(app)">Install Application</button>
+						<button class="btn btn-primary btn-sm" ng-click="installApp(app)">Install</button>
 					</div>
 				</td>
 			</tr>
@@ -106,9 +106,9 @@
 			</div>
 			<div class="modal-body">
 				<ul class="nav nav-tabs">
-					<li><a href="[data-id='intro']" data-toggle="tab" data-id="introTab">Application</a></li>
-					<li><a href="[data-id='install']" data-toggle="tab">Install</a></li>
-					<li><a href="[data-id='uninstall']" data-toggle="tab">Uninstall</a></li>
+					<li><a href="[data-id='intro']" data-toggle="tab" data-id="introTab">Introduction</a></li>
+					<li><a href="[data-id='install']" data-toggle="tab">Installation</a></li>
+					<li><a href="[data-id='uninstall']" data-toggle="tab">Uninstallation</a></li>
 				</ul>
 				<div class="tab-content">
 					<div class="tab-pane" data-id="intro">
@@ -180,10 +180,10 @@
 						</table>
 					</div>
 					<div class="tab-pane" data-id="install">
-						<pre ng-bind-html="installHTML"></pre>
+						<div ng-bind-html="installHTML"></div>
 					</div>
 					<div class="tab-pane" data-id="uninstall">
-						<pre ng-bind-html="uninstallHTML"></pre>
+						<div ng-bind-html="uninstallHTML"></div>
 					</div>
 				</div>
 			</div>
@@ -206,27 +206,28 @@
 			</div>
 			<div class="modal-body">
 				<ul class="nav nav-tabs">
-					<li><a href="[data-id='guide']" data-toggle="tab" data-id="guideTab">Guide</a></li>
+					<li><a href="[data-id='guide']" data-toggle="tab" data-id="guideTab">Installation</a></li>
 					<li><a href="[data-id='environment']" data-toggle="tab">Environment</a></li>
 					<li><a href="[data-id='configuration']" data-toggle="tab" data-id="configTab">Configuration</a></li>
 				</ul>
 
 				<div class="tab-content">
 					<div class="tab-pane" data-id="guide">
-						<label>Dependencies</label>
-						<ul>
-							<li ng-repeat="dep in application.dependencies track by $index">
-								<strong class="text-success" ng-if="!!Application.find(dep.type, site.siteId)[0]">[ Installed ]</strong>
-								<strong class="text-danger" ng-if="!Application.find(dep.type, site.siteId)[0]">[
-									<span class="fa fa-exclamation-triangle"></span>Require
-								]</strong>
-								{{Application.findProvider(dep.type).name}}
-								({{dep.type}})
-							</li>
-						</ul>
+						<div ng-bind-html="installHTML"></div>
 
-						<label>Install</label>
-						<pre ng-bind-html="installHTML"></pre>
+						<div ng-if="application.dependencies.length > 0">
+							<label>Dependencies ({{application.dependencies.length}} Apps)</label>
+							<ul>
+								<li ng-repeat="dep in application.dependencies track by $index">
+									<strong class="text-success" ng-if="!!Application.find(dep.type, site.siteId)[0]">[ Installed ]</strong>
+									<strong class="text-danger" ng-if="!Application.find(dep.type, site.siteId)[0]">[
+										<span class="fa fa-exclamation-triangle"></span>Missing
+									]</strong>
+									{{Application.findProvider(dep.type).name}}
+									({{dep.type}})
+								</li>
+							</ul>
+						</div>
 					</div>
 
 					<div class="tab-pane" data-id="environment">

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97edbbbe/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
index e53a11e..9b46814 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
@@ -234,6 +234,10 @@
 			application = application.origin;
 			$scope.installLock = false;
 			$scope.application = application;
+
+			var docs = application.docs || {install: "", uninstall: ""};
+			$scope.installHTML = $sce.trustAsHtml(docs.install);
+
 			$scope.tmpApp = {
 				mode: "CLUSTER",
 				jarPath: application.jarPath,


[28/50] incubator-eagle git commit: [EAGLE-620]: AlertEngine: SpoutWrapper are sending duplicated message

Posted by ha...@apache.org.
[EAGLE-620]: AlertEngine: SpoutWrapper are sending duplicated message

Author: ralphsu

This closes #510


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

Branch: refs/heads/master
Commit: 2e715e3e94a6b98e0f3073d5d384878a0a845b72
Parents: c6ac2eb
Author: Ralph, Su <su...@gmail.com>
Authored: Fri Oct 14 17:30:27 2016 +0800
Committer: Ralph, Su <su...@gmail.com>
Committed: Fri Oct 14 17:32:25 2016 +0800

----------------------------------------------------------------------
 .../alert/coordinator/impl/MonitorMetadataGenerator.java    | 2 +-
 .../alert/engine/spout/SpoutOutputCollectorWrapper.java     | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2e715e3e/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/impl/MonitorMetadataGenerator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/impl/MonitorMetadataGenerator.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/impl/MonitorMetadataGenerator.java
index c5c992b..3f64f86 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/impl/MonitorMetadataGenerator.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/impl/MonitorMetadataGenerator.java
@@ -265,7 +265,7 @@ public class MonitorMetadataGenerator {
             }
         }
         if (targetSm == null) {
-            targetSm = new StreamRepartitionMetadata(datasourceName, schema.getStreamId());
+            targetSm = new StreamRepartitionMetadata(topicName, schema.getStreamId());
             dsStreamMeta.add(targetSm);
         }
         if (!targetSm.groupingStrategies.contains(gs)) {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2e715e3e/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/spout/SpoutOutputCollectorWrapper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/spout/SpoutOutputCollectorWrapper.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/spout/SpoutOutputCollectorWrapper.java
index a8dcc0d..e205da4 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/spout/SpoutOutputCollectorWrapper.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/spout/SpoutOutputCollectorWrapper.java
@@ -18,6 +18,9 @@
  */
 package org.apache.eagle.alert.engine.spout;
 
+import backtype.storm.spout.ISpoutOutputCollector;
+import backtype.storm.spout.SpoutOutputCollector;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.apache.eagle.alert.coordination.model.SpoutSpec;
 import org.apache.eagle.alert.coordination.model.StreamRepartitionMetadata;
 import org.apache.eagle.alert.coordination.model.StreamRepartitionStrategy;
@@ -29,9 +32,6 @@ import org.apache.eagle.alert.engine.model.StreamEvent;
 import org.apache.eagle.alert.engine.serialization.PartitionedEventSerializer;
 import org.apache.eagle.alert.engine.serialization.SerializationMetadataProvider;
 import org.apache.eagle.alert.utils.StreamIdConversion;
-import backtype.storm.spout.ISpoutOutputCollector;
-import backtype.storm.spout.SpoutOutputCollector;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -121,6 +121,9 @@ public class SpoutOutputCollectorWrapper extends SpoutOutputCollector implements
             phase 2: stream repartition
         */
         for (StreamRepartitionMetadata md : streamRepartitionMetadataList) {
+            if (!event.getStreamId().equals(md.getStreamId())) {
+                continue;
+            }
             // one stream may have multiple group-by strategies, each strategy is for a specific group-by
             for (StreamRepartitionStrategy groupingStrategy : md.groupingStrategies) {
                 int hash = 0;


[12/50] incubator-eagle git commit: [EAGLE-556] Install/Update Alert Topology Metadata when start alert engine

Posted by ha...@apache.org.
[EAGLE-556] Install/Update Alert Topology Metadata when start alert engine

Currently alert engine requires additional metadata like TopologyMeta, which in fact could be automatically generated during starting alert engine.

*Changes*

* Add "ApplicationListener" in ApplicationProvider to support extensible application lifecycle management callback listener
* Implement AlertUnitTopologyAppListener to  add topology metadata when topology is running and remove topology metadata when topology is stopped

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

Closes #493 from haoch/EAGLE-556.


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

Branch: refs/heads/master
Commit: fc2407cd53438a31b4c1072ce7d5b08578b8e43d
Parents: fa85dc3
Author: Hao Chen <ha...@apache.org>
Authored: Wed Oct 12 12:10:06 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Wed Oct 12 12:10:06 2016 +0800

----------------------------------------------------------------------
 .../alert/app/AlertUnitTopologyAppListener.java |  90 ++++++++++
 .../alert/app/AlertUnitTopologyAppProvider.java |  10 +-
 ...e.alert.app.AlertUnitTopologyAppProvider.xml |   4 +-
 .../alert/engine/runner/UnitTopologyRunner.java | 164 ++++++++++++------
 .../apache/eagle/app/ApplicationLifecycle.java  |  23 ++-
 .../environment/ExecutionRuntimeManager.java    |   4 +-
 .../environment/impl/StormExecutionRuntime.java |  21 ++-
 .../eagle/app/service/ApplicationAction.java    | 161 ++++++++++++++++++
 .../eagle/app/service/ApplicationListener.java  |  32 ++++
 .../service/ApplicationOperationContext.java    | 167 -------------------
 .../impl/ApplicationManagementServiceImpl.java  | 110 +++++++-----
 .../impl/ApplicationProviderConfigLoader.java   |   1 -
 .../impl/ApplicationProviderSPILoader.java      |   1 -
 .../apache/eagle/app/sink/KafkaStreamSink.java  |   4 +-
 .../eagle/app/sink/LoggingStreamSink.java       |   8 +-
 .../app/spi/AbstractApplicationProvider.java    |  52 +++++-
 .../eagle/app/spi/ApplicationProvider.java      |  19 +--
 .../app/test/ApplicationSimulatorImpl.java      |   1 -
 .../apache/eagle/app/TestStormApplication.java  |   9 +-
 .../app/service/ApplicationActionTest.java      |  48 ++++++
 .../ApplicationOperationContextTest.java        |  48 ------
 .../eagle/metadata/model/ApplicationEntity.java |   6 +
 .../app/example/ExampleApplicationProvider.java |  55 ++++--
 .../hbase/HBaseAuditLogAppProvider.java         |   5 -
 ...ecurity.auditlog.HdfsAuditLogAppProvider.xml |   8 +-
 25 files changed, 672 insertions(+), 379 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/java/org/apache/eagle/alert/app/AlertUnitTopologyAppListener.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/java/org/apache/eagle/alert/app/AlertUnitTopologyAppListener.java b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/java/org/apache/eagle/alert/app/AlertUnitTopologyAppListener.java
new file mode 100644
index 0000000..fd3f9d2
--- /dev/null
+++ b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/java/org/apache/eagle/alert/app/AlertUnitTopologyAppListener.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.alert.app;
+
+import org.apache.eagle.alert.coordination.model.internal.Topology;
+import org.apache.eagle.alert.engine.runner.UnitTopologyRunner;
+import org.apache.eagle.alert.metadata.IMetadataDao;
+import org.apache.eagle.alert.metadata.resource.OpResult;
+import org.apache.eagle.app.service.ApplicationListener;
+import org.apache.eagle.metadata.model.ApplicationEntity;
+import com.typesafe.config.ConfigFactory;
+
+import com.google.inject.Inject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+class AlertUnitTopologyAppListener implements ApplicationListener {
+    private static final Logger LOG = LoggerFactory.getLogger(AlertUnitTopologyAppListener.class);
+
+    @Inject private IMetadataDao metadataDao;
+
+    private ApplicationEntity applicationEntity;
+
+    @Override
+    public void init(ApplicationEntity applicationEntity) {
+        this.applicationEntity = applicationEntity;
+    }
+
+    @Override
+    public void afterInstall() {
+        // Do nothing
+    }
+
+    @Override
+    public void afterUninstall() {
+        removeTopologyMetadata();
+    }
+
+    @Override
+    public void beforeStart() {
+        // Do thing, may do some validation works?
+        updateTopologyMetadata();
+    }
+
+    @Override
+    public void afterStop() {
+        removeTopologyMetadata();
+    }
+
+    // -------------
+    // Internal RPC
+    // -------------
+
+    private void updateTopologyMetadata() {
+        LOG.info("Update topology metadata {}", this.applicationEntity.getAppId());
+        OpResult result = metadataDao.addTopology(createTopologyMeta(this.applicationEntity));
+        if (result.code == OpResult.FAILURE) {
+            LOG.error(result.message);
+            throw new IllegalStateException(result.message);
+        }
+    }
+
+    private void removeTopologyMetadata() {
+        LOG.info("Remove topology metadata {}", this.applicationEntity.getAppId());
+        OpResult result = metadataDao.removeTopology(createTopologyMeta(this.applicationEntity).getName());
+        if (result.code == OpResult.FAILURE) {
+            LOG.error(result.message);
+            throw new IllegalStateException(result.message);
+        }
+    }
+
+    private Topology createTopologyMeta(ApplicationEntity applicationEntity) {
+        return UnitTopologyRunner.buildTopologyMetadata(applicationEntity.getAppId(),ConfigFactory.parseMap(applicationEntity.getConfiguration()));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/java/org/apache/eagle/alert/app/AlertUnitTopologyAppProvider.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/java/org/apache/eagle/alert/app/AlertUnitTopologyAppProvider.java b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/java/org/apache/eagle/alert/app/AlertUnitTopologyAppProvider.java
index 39a4583..5548c8c 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/java/org/apache/eagle/alert/app/AlertUnitTopologyAppProvider.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/java/org/apache/eagle/alert/app/AlertUnitTopologyAppProvider.java
@@ -16,8 +16,11 @@
  */
 
 package org.apache.eagle.alert.app;
+import org.apache.eagle.app.service.ApplicationListener;
 import org.apache.eagle.app.spi.AbstractApplicationProvider;
 
+import java.util.Optional;
+
 /**
  * since 8/25/16.
  */
@@ -26,4 +29,9 @@ public class AlertUnitTopologyAppProvider extends AbstractApplicationProvider<Al
     public AlertUnitTopologyApp getApplication() {
         return new AlertUnitTopologyApp();
     }
-}
+
+    @Override
+    public Optional<ApplicationListener> getApplicationListener() {
+        return Optional.of(new AlertUnitTopologyAppListener());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
index 498cb8d..bf22123 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
+++ b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
@@ -65,7 +65,7 @@
         <property>
             <name>spout.kafkaBrokerZkQuorum</name>
             <displayName>spout.kafkaBrokerZkQuorum</displayName>
-            <value>server.eagle.apache.org:2181</value>
+            <value>localhost:2181</value>
             <description>zookeeper quorum for spout to consume data</description>
         </property>
         <property>
@@ -97,7 +97,7 @@
         <property>
             <name>zkConfig.zkQuorum</name>
             <displayName>zkConfig.zkQuorum</displayName>
-            <value>server.eagle.apache.org:2181</value>
+            <value>localhost:2181</value>
             <description>zk quorum for alert engine</description>
         </property>
         <property>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/UnitTopologyRunner.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/UnitTopologyRunner.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/UnitTopologyRunner.java
index 7a93e72..ec129fe 100755
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/UnitTopologyRunner.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/UnitTopologyRunner.java
@@ -19,6 +19,7 @@
 
 package org.apache.eagle.alert.engine.runner;
 
+import org.apache.eagle.alert.coordination.model.internal.Topology;
 import org.apache.eagle.alert.engine.coordinator.IMetadataChangeNotifyService;
 import org.apache.eagle.alert.engine.coordinator.impl.ZKMetadataChangeNotifyService;
 import org.apache.eagle.alert.engine.spout.CorrelationSpout;
@@ -40,6 +41,8 @@ import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
 
 /**
  * By default
@@ -76,20 +79,78 @@ public class UnitTopologyRunner {
         this.givenStormConfig = stormConfig;
     }
 
+    // -----------------------------
+    // Storm Topology Submit Helper
+    // -----------------------------
+
+    private void run(String topologyId,
+                     int numOfTotalWorkers,
+                     int numOfSpoutTasks,
+                     int numOfRouterBolts,
+                     int numOfAlertBolts,
+                     int numOfPublishTasks,
+                     Config config,
+                     boolean localMode) {
+
+        backtype.storm.Config stormConfig = givenStormConfig == null ? new backtype.storm.Config() : givenStormConfig;
+        // TODO: Configurable metric consumer instance number
+
+        int messageTimeoutSecs = config.hasPath(MESSAGE_TIMEOUT_SECS) ? config.getInt(MESSAGE_TIMEOUT_SECS) : DEFAULT_MESSAGE_TIMEOUT_SECS;
+        LOG.info("Set topology.message.timeout.secs as {}", messageTimeoutSecs);
+        stormConfig.setMessageTimeoutSecs(messageTimeoutSecs);
+
+        if (config.hasPath("metric")) {
+            stormConfig.registerMetricsConsumer(StormMetricTaggedConsumer.class, config.root().render(ConfigRenderOptions.concise()), 1);
+        }
+
+        stormConfig.setNumWorkers(numOfTotalWorkers);
+        StormTopology topology = buildTopology(topologyId, numOfSpoutTasks, numOfRouterBolts, numOfAlertBolts, numOfPublishTasks, config);
+
+        if (localMode) {
+            LOG.info("Submitting as local mode");
+            LocalCluster cluster = new LocalCluster();
+            cluster.submitTopology(topologyId, stormConfig, topology);
+            Utils.sleep(Long.MAX_VALUE);
+        } else {
+            LOG.info("Submitting as cluster mode");
+            try {
+                StormSubmitter.submitTopologyWithProgressBar(topologyId, stormConfig, topology);
+            } catch (Exception ex) {
+                LOG.error("fail submitting topology {}", topology, ex);
+                throw new IllegalStateException(ex);
+            }
+        }
+    }
+
+    public void run(String topologyId, Config config) {
+        int numOfSpoutTasks = config.getInt(SPOUT_TASK_NUM);
+        int numOfRouterBolts = config.getInt(ROUTER_TASK_NUM);
+        int numOfAlertBolts = config.getInt(ALERT_TASK_NUM);
+        int numOfPublishTasks = config.getInt(PUBLISH_TASK_NUM);
+        boolean localMode = config.getBoolean(LOCAL_MODE);
+        int numOfTotalWorkers = config.getInt(TOTAL_WORKER_NUM);
+        run(topologyId, numOfTotalWorkers, numOfSpoutTasks, numOfRouterBolts, numOfAlertBolts, numOfPublishTasks, config, localMode);
+    }
+
+    public IMetadataChangeNotifyService getMetadataChangeNotifyService() {
+        return metadataChangeNotifyService;
+    }
+
+    // ---------------------------
+    // Build Storm Topology
+    // ---------------------------
+
     public StormTopology buildTopology(String topologyId,
                                        int numOfSpoutTasks,
                                        int numOfRouterBolts,
                                        int numOfAlertBolts,
                                        int numOfPublishTasks,
                                        Config config) {
-
         StreamRouterBolt[] routerBolts = new StreamRouterBolt[numOfRouterBolts];
         AlertBolt[] alertBolts = new AlertBolt[numOfAlertBolts];
 
-
         TopologyBuilder builder = new TopologyBuilder();
 
-
         // construct Spout object
         CorrelationSpout spout = new CorrelationSpout(config, topologyId, getMetadataChangeNotifyService(), numOfRouterBolts, spoutName, streamRouterBoltNamePrefix);
         builder.setSpout(spoutName, spout, numOfSpoutTasks).setNumTasks(numOfSpoutTasks);
@@ -147,63 +208,66 @@ public class UnitTopologyRunner {
     }
 
     public StormTopology buildTopology(String topologyId, Config config) {
-        int numOfSpoutTasks = config.getInt("topology.numOfSpoutTasks");
-        int numOfRouterBolts = config.getInt("topology.numOfRouterBolts");
-        int numOfAlertBolts = config.getInt("topology.numOfAlertBolts");
-        int numOfPublishTasks = config.getInt("topology.numOfPublishTasks");
+        int numOfSpoutTasks = config.getInt(SPOUT_TASK_NUM);
+        int numOfRouterBolts = config.getInt(ROUTER_TASK_NUM);
+        int numOfAlertBolts = config.getInt(ALERT_TASK_NUM);
+        int numOfPublishTasks = config.getInt(PUBLISH_TASK_NUM);
+
         return buildTopology(topologyId, numOfSpoutTasks, numOfRouterBolts, numOfAlertBolts, numOfPublishTasks, config);
     }
 
-    private void run(String topologyId,
-                     int numOfTotalWorkers,
-                     int numOfSpoutTasks,
-                     int numOfRouterBolts,
-                     int numOfAlertBolts,
-                     int numOfPublishTasks,
-                     Config config,
-                     boolean localMode) {
+    // ---------------------------
+    // Build Topology Metadata
+    // ---------------------------
 
-        backtype.storm.Config stormConfig = givenStormConfig == null ? new backtype.storm.Config() : givenStormConfig;
-        // TODO: Configurable metric consumer instance number
+    public static Topology buildTopologyMetadata(String topologyId, Config config) {
+        int numOfSpoutTasks = config.getInt(SPOUT_TASK_NUM);
+        int numOfRouterBolts = config.getInt(ROUTER_TASK_NUM);
+        int numOfAlertBolts = config.getInt(ALERT_TASK_NUM);
+        int numOfPublishTasks = config.getInt(PUBLISH_TASK_NUM);
 
-        int messageTimeoutSecs = config.hasPath(MESSAGE_TIMEOUT_SECS) ? config.getInt(MESSAGE_TIMEOUT_SECS) : DEFAULT_MESSAGE_TIMEOUT_SECS;
-        LOG.info("Set topology.message.timeout.secs as {}", messageTimeoutSecs);
-        stormConfig.setMessageTimeoutSecs(messageTimeoutSecs);
+        return buildTopologyMetadata(topologyId, numOfSpoutTasks, numOfRouterBolts, numOfAlertBolts, numOfPublishTasks, config);
+    }
 
-        if (config.hasPath("metric")) {
-            stormConfig.registerMetricsConsumer(StormMetricTaggedConsumer.class, config.root().render(ConfigRenderOptions.concise()), 1);
+    public static Topology buildTopologyMetadata(String topologyId,
+                                                 int numOfSpoutTasks,
+                                                 int numOfRouterBolts,
+                                                 int numOfAlertBolts,
+                                                 int numOfPublishTasks,
+                                                 Config config) {
+        Topology topology = new Topology();
+        topology.setName(topologyId);
+        topology.setNumOfSpout(numOfSpoutTasks);
+        topology.setNumOfAlertBolt(numOfAlertBolts);
+        topology.setNumOfGroupBolt(numOfRouterBolts);
+        topology.setNumOfPublishBolt(numOfPublishTasks);
+
+        // Set Spout ID
+        topology.setSpoutId(spoutName);
+
+        // Set Router (Group) ID
+        Set<String> streamRouterBoltNames = new TreeSet<>();
+        for (int i = 0; i < numOfRouterBolts; i++) {
+            streamRouterBoltNames.add(streamRouterBoltNamePrefix + i);
         }
+        topology.setGroupNodeIds(streamRouterBoltNames);
 
-        stormConfig.setNumWorkers(numOfTotalWorkers);
-        StormTopology topology = buildTopology(topologyId, numOfSpoutTasks, numOfRouterBolts, numOfAlertBolts, numOfPublishTasks, config);
-
-        if (localMode) {
-            LOG.info("Submitting as local mode");
-            LocalCluster cluster = new LocalCluster();
-            cluster.submitTopology(topologyId, stormConfig, topology);
-            Utils.sleep(Long.MAX_VALUE);
-        } else {
-            LOG.info("Submitting as cluster mode");
-            try {
-                StormSubmitter.submitTopologyWithProgressBar(topologyId, stormConfig, topology);
-            } catch (Exception ex) {
-                LOG.error("fail submitting topology {}", topology, ex);
-                throw new IllegalStateException(ex);
-            }
+        // Set Alert Bolt ID
+        Set<String> alertBoltIds = new TreeSet<>();
+        for (int i = 0; i < numOfAlertBolts; i++) {
+            alertBoltIds.add(alertBoltNamePrefix + i);
         }
-    }
+        topology.setAlertBoltIds(alertBoltIds);
 
-    public void run(String topologyId, Config config) {
-        int numOfSpoutTasks = config.getInt(SPOUT_TASK_NUM);
-        int numOfRouterBolts = config.getInt(ROUTER_TASK_NUM);
-        int numOfAlertBolts = config.getInt(ALERT_TASK_NUM);
-        int numOfPublishTasks = config.getInt(PUBLISH_TASK_NUM);
-        boolean localMode = config.getBoolean(LOCAL_MODE);
-        int numOfTotalWorkers = config.getInt(TOTAL_WORKER_NUM);
-        run(topologyId, numOfTotalWorkers, numOfSpoutTasks, numOfRouterBolts, numOfAlertBolts, numOfPublishTasks, config, localMode);
-    }
+        // Set Publisher ID
+        topology.setPubBoltId(alertPublishBoltName);
 
-    public IMetadataChangeNotifyService getMetadataChangeNotifyService() {
-        return metadataChangeNotifyService;
+        // TODO: Load bolts' parallelism from configuration, currently keep 1 by default.
+
+        topology.setSpoutParallelism(1);
+        topology.setGroupParallelism(1);
+        topology.setAlertParallelism(1);
+
+        return topology;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/ApplicationLifecycle.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/ApplicationLifecycle.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/ApplicationLifecycle.java
index 94b6195..e482615 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/ApplicationLifecycle.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/ApplicationLifecycle.java
@@ -16,28 +16,35 @@
  */
 package org.apache.eagle.app;
 
+/**
+ * Application Lifecycle Listener/Callback.
+ */
 public interface ApplicationLifecycle {
     /**
-     * on application installed.
+     * After Application Installed. (Callback)
      */
-    default void onInstall() {
+    default void afterInstall() {
+        // Do nothing by default
     }
 
     /**
-     * on application uninstalled.
+     * After Application Uninstalled. (Callback)
      */
-    default void onUninstall() {
+    default void afterUninstall() {
+        // Do nothing by default
     }
 
     /**
-     * onStart.
+     * Before Application Start. (Prepare)
      */
-    default void onStart() {
+    default void beforeStart() {
+        // Do nothing by default
     }
 
     /**
-     * onStop.
+     * After Application Stopped. (Callback)
      */
-    default void onStop() {
+    default void afterStop() {
+        // Do nothing by default
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/ExecutionRuntimeManager.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/ExecutionRuntimeManager.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/ExecutionRuntimeManager.java
index 96f171e..d51b8b5 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/ExecutionRuntimeManager.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/ExecutionRuntimeManager.java
@@ -64,7 +64,9 @@ public class ExecutionRuntimeManager {
             ExecutionRuntime<E, P> runtime = ((ExecutionRuntimeProvider<E, P>) executionRuntimeProviders.get(environment.getClass())).get();
             runtime.prepare(environment);
             executionRuntimeCache.put(environment, runtime);
-            LOGGER.info("Created new execution runtime {} for environment: {}", runtime, environment);
+            if (LOGGER.isDebugEnabled()) {
+                LOGGER.debug("Created new execution runtime {} for environment: {}", runtime, environment);
+            }
             return runtime;
         } else {
             LOGGER.error("No matched execution runtime found for environment: " + environment);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
index 1994e28..fb4aff9 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
@@ -137,7 +137,7 @@ public class StormExecutionRuntime implements ExecutionRuntime<StormEnvironment,
     @Override
     public void stop(Application<StormEnvironment, StormTopology> executor, com.typesafe.config.Config config) {
         String appId = config.getString("appId");
-        LOG.info("Stopping topology {} ..." + appId);
+        LOG.info("Stopping topology {} ...", appId);
         if (Objects.equals(config.getString("mode"), ApplicationEntity.Mode.CLUSTER.name())) {
             Nimbus.Client stormClient = NimbusClient.getConfiguredClient(getStormConfig(config)).getClient();
             try {
@@ -151,7 +151,7 @@ public class StormExecutionRuntime implements ExecutionRuntime<StormEnvironment,
             killOptions.set_wait_secs(0);
             getLocalCluster().killTopologyWithOpts(appId,killOptions);
         }
-        LOG.info("Stopped topology {} ..." + appId);
+        LOG.info("Stopped topology {}", appId);
     }
 
     @Override
@@ -159,6 +159,7 @@ public class StormExecutionRuntime implements ExecutionRuntime<StormEnvironment,
         String appId = config.getString("appId");
         LOG.info("Fetching status of topology {} ...", appId);
         List<TopologySummary> topologySummaries ;
+        ApplicationEntity.Status status = null;
         try {
             if (Objects.equals(config.getString("mode"), ApplicationEntity.Mode.CLUSTER.name())) {
                 Nimbus.Client stormClient = NimbusClient.getConfiguredClient(getStormConfig(config)).getClient();
@@ -166,22 +167,28 @@ public class StormExecutionRuntime implements ExecutionRuntime<StormEnvironment,
             } else {
                 topologySummaries = getLocalCluster().getClusterInfo().get_topologies();
             }
+
             for (TopologySummary topologySummary : topologySummaries) {
                 if (topologySummary.get_name().equalsIgnoreCase(appId)) {
                     if (topologySummary.get_status().equalsIgnoreCase("ACTIVE")) {
-                        return ApplicationEntity.Status.RUNNING;
+                        status = ApplicationEntity.Status.RUNNING;
                     } else if (topologySummary.get_status().equalsIgnoreCase("INACTIVE")) {
-                        return ApplicationEntity.Status.STOPPED;
+                        status = ApplicationEntity.Status.STOPPED;
                     } else if (topologySummary.get_status().equalsIgnoreCase("KILLED")) {
-                        return ApplicationEntity.Status.REMOVED;
+                        status = ApplicationEntity.Status.REMOVED;
                     }
                 }
             }
             //If not exist, return removed
-            return ApplicationEntity.Status.REMOVED;
+            if (status == null) {
+                status = ApplicationEntity.Status.REMOVED;
+            }
         } catch (TException e) {
-            return ApplicationEntity.Status.UNKNOWN;
+            LOG.error("Got error to fetch status of {}", appId, e);
+            status = ApplicationEntity.Status.UNKNOWN;
         }
+        LOG.info("Status of {}: {}", appId, status);
+        return status;
     }
 
     public static class Provider implements ExecutionRuntimeProvider<StormEnvironment,StormTopology> {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationAction.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationAction.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationAction.java
new file mode 100644
index 0000000..cecd81e
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationAction.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 com.google.common.base.Preconditions;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import org.apache.eagle.alert.coordination.model.Kafka2TupleMetadata;
+import org.apache.eagle.alert.coordination.model.Tuple2StreamMetadata;
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.apache.eagle.alert.engine.scheme.JsonScheme;
+import org.apache.eagle.alert.engine.scheme.JsonStringStreamNameSelector;
+import org.apache.eagle.alert.metadata.IMetadataDao;
+import org.apache.eagle.app.Application;
+import org.apache.eagle.app.environment.ExecutionRuntime;
+import org.apache.eagle.app.environment.ExecutionRuntimeManager;
+import org.apache.eagle.app.sink.KafkaStreamSinkConfig;
+import org.apache.eagle.metadata.model.ApplicationEntity;
+import org.apache.eagle.metadata.model.StreamDesc;
+import org.apache.eagle.metadata.model.StreamSinkConfig;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.stream.Collectors;
+
+/**
+ * Managed Application Action: org.apache.eagle.app.service.ApplicationAction
+ * <ul>
+ * <li>Application Metadata Entity (Persistence): org.apache.eagle.metadata.model.ApplicationEntity</li>
+ * <li>Application Processing Logic (Execution): org.apache.eagle.app.Application</li>
+ * <li>Application Lifecycle Listener (Installation): org.apache.eagle.app.ApplicationLifecycle</li>
+ * </ul>
+ */
+public class ApplicationAction implements Serializable {
+    private final Config config;
+    private final Application application;
+    private final ExecutionRuntime runtime;
+    private final ApplicationEntity metadata;
+    private final IMetadataDao alertMetadataService;
+
+    /**
+     * @param metadata    ApplicationEntity.
+     * @param application Application.
+     */
+    public ApplicationAction(Application application, ApplicationEntity metadata, Config envConfig, IMetadataDao alertMetadataService) {
+        Preconditions.checkNotNull(application, "Application is null");
+        Preconditions.checkNotNull(metadata, "ApplicationEntity is null");
+        this.application = application;
+        this.metadata = metadata;
+        this.runtime = ExecutionRuntimeManager.getInstance().getRuntime(application.getEnvironmentType(), envConfig);
+        Map<String, Object> executionConfig = metadata.getConfiguration();
+        if (executionConfig == null) {
+            executionConfig = Collections.emptyMap();
+        }
+
+        // TODO: Decouple hardcoded configuration key
+        executionConfig.put("siteId", metadata.getSite().getSiteId());
+        executionConfig.put("mode", metadata.getMode().name());
+        executionConfig.put("appId", metadata.getAppId());
+        executionConfig.put("jarPath", metadata.getJarPath());
+        this.config = ConfigFactory.parseMap(executionConfig).withFallback(envConfig);
+        this.alertMetadataService = alertMetadataService;
+    }
+
+    /**
+     * Generate global unique streamId to install.
+     * TODO refactor with streamId and siteId
+     */
+    private static String generateUniqueStreamId(String siteId,String streamTypeId) {
+        return String.format("%s_%s",streamTypeId,siteId).toUpperCase();
+    }   
+
+    public void doInstall() {
+        if (metadata.getDescriptor().getStreams() != null) {
+            List<StreamDesc> streamDescToInstall = metadata.getDescriptor().getStreams().stream().map((streamDefinition -> {
+                StreamDefinition copied = streamDefinition.copy();
+                copied.setSiteId(metadata.getSite().getSiteId());
+                copied.setStreamId(generateUniqueStreamId(metadata.getSite().getSiteId(),copied.getStreamId()));
+                StreamSinkConfig streamSinkConfig = this.runtime.environment().streamSink().getSinkConfig(copied.getStreamId(), this.config);
+                StreamDesc streamDesc = new StreamDesc();
+                streamDesc.setSchema(copied);
+                streamDesc.setSink(streamSinkConfig);
+                streamDesc.setStreamId(copied.getStreamId());
+                return streamDesc;
+            })).collect(Collectors.toList());
+            metadata.setStreams(streamDescToInstall);
+
+            // TODO: Decouple converting from StreamSink to Alert DataSource
+            // iterate each stream descriptor and create alert datasource for each
+            for (StreamDesc streamDesc : streamDescToInstall) {
+                // only take care of Kafka sink
+                if (streamDesc.getSink() instanceof KafkaStreamSinkConfig) {
+                    KafkaStreamSinkConfig kafkaCfg = (KafkaStreamSinkConfig) streamDesc.getSink();
+                    Kafka2TupleMetadata datasource = new Kafka2TupleMetadata();
+                    datasource.setType("KAFKA");
+                    datasource.setName(metadata.getAppId());
+                    datasource.setTopic(kafkaCfg.getTopicId());
+                    datasource.setSchemeCls(JsonScheme.class.getCanonicalName());
+                    Tuple2StreamMetadata tuple2Stream = new Tuple2StreamMetadata();
+                    Properties prop = new Properties();
+                    prop.put(JsonStringStreamNameSelector.USER_PROVIDED_STREAM_NAME_PROPERTY, streamDesc.getStreamId());
+                    tuple2Stream.setStreamNameSelectorProp(prop);
+                    tuple2Stream.setTimestampColumn("timestamp");
+                    tuple2Stream.setStreamNameSelectorCls(JsonStringStreamNameSelector.class.getCanonicalName());
+                    datasource.setCodec(tuple2Stream);
+                    alertMetadataService.addDataSource(datasource);
+
+                    StreamDefinition sd = streamDesc.getSchema();
+                    sd.setDataSource(metadata.getAppId());
+                    alertMetadataService.createStream(streamDesc.getSchema());
+                }
+            }
+        }
+    }
+
+    public void doUninstall() {
+        // we should remove alert data source and stream definition while we do uninstall
+        if (metadata.getStreams() == null) {
+            return;
+        }
+        // iterate each stream descriptor and create alert datasource for each
+        for (StreamDesc streamDesc : metadata.getStreams()) {
+            alertMetadataService.removeDataSource(metadata.getAppId());
+            alertMetadataService.removeStream(streamDesc.getStreamId());
+        }
+    }
+
+    public void doStart() {
+        this.runtime.start(this.application, this.config);
+    }
+
+    @SuppressWarnings("unchecked")
+    public void doStop() {
+        this.runtime.stop(this.application, this.config);
+    }
+
+    public ApplicationEntity.Status getStatus() {
+        return this.runtime.status(this.application, this.config);
+    }
+
+    public ApplicationEntity getMetadata() {
+        return metadata;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationListener.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationListener.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationListener.java
new file mode 100644
index 0000000..4a7f0c6
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationListener.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
+ * <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.ApplicationLifecycle;
+import org.apache.eagle.metadata.model.ApplicationEntity;
+
+/**
+ * Application Lifecycle/Management Listener (Guice Aware).
+ * Currently only listen on application lifecycle , may extend to more later.
+ */
+public interface ApplicationListener extends ApplicationLifecycle {
+    /**
+     * @param applicationEntity ApplicationEntity.
+     */
+    void init(ApplicationEntity applicationEntity);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationOperationContext.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationOperationContext.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationOperationContext.java
deleted file mode 100644
index 3561374..0000000
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationOperationContext.java
+++ /dev/null
@@ -1,167 +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
- * <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.alert.coordination.model.Kafka2TupleMetadata;
-import org.apache.eagle.alert.coordination.model.Tuple2StreamMetadata;
-import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import org.apache.eagle.alert.engine.scheme.JsonScheme;
-import org.apache.eagle.alert.engine.scheme.JsonStringStreamNameSelector;
-import org.apache.eagle.alert.metadata.IMetadataDao;
-import org.apache.eagle.app.Application;
-import org.apache.eagle.app.ApplicationLifecycle;
-import org.apache.eagle.app.environment.ExecutionRuntime;
-import org.apache.eagle.app.environment.ExecutionRuntimeManager;
-import org.apache.eagle.app.sink.KafkaStreamSinkConfig;
-import org.apache.eagle.metadata.model.ApplicationEntity;
-import org.apache.eagle.metadata.model.StreamDesc;
-import org.apache.eagle.metadata.model.StreamSinkConfig;
-import com.google.common.base.Preconditions;
-import com.typesafe.config.Config;
-import com.typesafe.config.ConfigFactory;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.stream.Collectors;
-
-/**
- * Managed Application Interface: org.apache.eagle.app.service.ApplicationOperationContext
- * <ul>
- * <li>Application Metadata Entity (Persistence): org.apache.eagle.metadata.model.ApplicationEntity</li>
- * <li>Application Processing Logic (Execution): org.apache.eagle.app.Application</li>
- * <li>Application Lifecycle Listener (Installation): org.apache.eagle.app.ApplicationLifecycle</li>
- * </ul>
- */
-public class ApplicationOperationContext implements Serializable, ApplicationLifecycle {
-    private final Config config;
-    private final Application application;
-    private final ExecutionRuntime runtime;
-    private final ApplicationEntity metadata;
-    private final IMetadataDao alertMetadataService;
-
-    /**
-     * @param metadata    ApplicationEntity.
-     * @param application Application.
-     */
-    public ApplicationOperationContext(Application application, ApplicationEntity metadata, Config envConfig, IMetadataDao alertMetadataService) {
-        Preconditions.checkNotNull(application, "Application is null");
-        Preconditions.checkNotNull(metadata, "ApplicationEntity is null");
-        this.application = application;
-        this.metadata = metadata;
-        this.runtime = ExecutionRuntimeManager.getInstance().getRuntime(application.getEnvironmentType(), envConfig);
-        Map<String, Object> executionConfig = metadata.getConfiguration();
-        if (executionConfig == null) {
-            executionConfig = Collections.emptyMap();
-        }
-
-        // TODO: Decouple hardcoded configuration key
-        executionConfig.put("siteId", metadata.getSite().getSiteId());
-        executionConfig.put("mode", metadata.getMode().name());
-        executionConfig.put("appId", metadata.getAppId());
-        executionConfig.put("jarPath", metadata.getJarPath());
-        this.config = ConfigFactory.parseMap(executionConfig).withFallback(envConfig);
-        this.alertMetadataService = alertMetadataService;
-    }
-
-    /**
-     * Generate global unique streamId to install.
-     * TODO refactor with streamId and siteId
-     */
-    private static String generateUniqueStreamId(String siteId,String streamTypeId) {
-        return String.format("%s_%s",streamTypeId,siteId).toUpperCase();
-    }   
-
-    @Override
-    public void onInstall() {
-        if (metadata.getDescriptor().getStreams() != null) {
-            List<StreamDesc> streamDescToInstall = metadata.getDescriptor().getStreams().stream().map((streamDefinition -> {
-                StreamDefinition copied = streamDefinition.copy();
-                copied.setSiteId(metadata.getSite().getSiteId());
-                copied.setStreamId(generateUniqueStreamId(metadata.getSite().getSiteId(),copied.getStreamId()));
-                StreamSinkConfig streamSinkConfig = this.runtime.environment().streamSink().getSinkConfig(copied.getStreamId(), this.config);
-                StreamDesc streamDesc = new StreamDesc();
-                streamDesc.setSchema(copied);
-                streamDesc.setSink(streamSinkConfig);
-                streamDesc.setStreamId(copied.getStreamId());
-                return streamDesc;
-            })).collect(Collectors.toList());
-            metadata.setStreams(streamDescToInstall);
-
-            // TODO: Decouple converting from StreamSink to Alert DataSource
-            // iterate each stream descriptor and create alert datasource for each
-            for (StreamDesc streamDesc : streamDescToInstall) {
-                // only take care of Kafka sink
-                if (streamDesc.getSink() instanceof KafkaStreamSinkConfig) {
-                    KafkaStreamSinkConfig kafkaCfg = (KafkaStreamSinkConfig) streamDesc.getSink();
-                    Kafka2TupleMetadata datasource = new Kafka2TupleMetadata();
-                    datasource.setType("KAFKA");
-                    datasource.setName(metadata.getAppId());
-                    datasource.setTopic(kafkaCfg.getTopicId());
-                    datasource.setSchemeCls(JsonScheme.class.getCanonicalName());
-                    Tuple2StreamMetadata tuple2Stream = new Tuple2StreamMetadata();
-                    Properties prop = new Properties();
-                    prop.put(JsonStringStreamNameSelector.USER_PROVIDED_STREAM_NAME_PROPERTY, streamDesc.getStreamId());
-                    tuple2Stream.setStreamNameSelectorProp(prop);
-                    tuple2Stream.setTimestampColumn("timestamp");
-                    tuple2Stream.setStreamNameSelectorCls(JsonStringStreamNameSelector.class.getCanonicalName());
-                    datasource.setCodec(tuple2Stream);
-                    alertMetadataService.addDataSource(datasource);
-
-                    StreamDefinition sd = streamDesc.getSchema();
-                    sd.setDataSource(metadata.getAppId());
-                    alertMetadataService.createStream(streamDesc.getSchema());
-                }
-            }
-        }
-    }
-
-    @Override
-    public void onUninstall() {
-        // we should remove alert data source and stream definition while we do uninstall
-        if (metadata.getStreams() == null) {
-            return;
-        }
-        // iterate each stream descriptor and create alert datasource for each
-        for (StreamDesc streamDesc : metadata.getStreams()) {
-            alertMetadataService.removeDataSource(metadata.getAppId());
-            alertMetadataService.removeStream(streamDesc.getStreamId());
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public void onStart() {
-        this.runtime.start(this.application, this.config);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public void onStop() {
-        this.runtime.stop(this.application, this.config);
-    }
-
-    public ApplicationEntity.Status getStatus() {
-        return this.runtime.status(this.application, this.config);
-    }
-
-    public ApplicationEntity getMetadata() {
-        return metadata;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationManagementServiceImpl.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationManagementServiceImpl.java
index abd9197..6dee1fc 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationManagementServiceImpl.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationManagementServiceImpl.java
@@ -18,14 +18,12 @@ package org.apache.eagle.app.service.impl;
 
 import com.google.common.base.Preconditions;
 import com.google.inject.Inject;
+import com.google.inject.Injector;
 import com.google.inject.Singleton;
 import com.typesafe.config.Config;
 import org.apache.eagle.alert.metadata.IMetadataDao;
 import org.apache.eagle.app.Application;
-import org.apache.eagle.app.service.ApplicationManagementService;
-import org.apache.eagle.app.service.ApplicationOperations;
-import org.apache.eagle.app.service.ApplicationOperationContext;
-import org.apache.eagle.app.service.ApplicationProviderService;
+import org.apache.eagle.app.service.*;
 import org.apache.eagle.app.spi.ApplicationProvider;
 import org.apache.eagle.metadata.exceptions.ApplicationWrongStatusException;
 import org.apache.eagle.metadata.exceptions.EntityNotFoundException;
@@ -41,12 +39,15 @@ import java.util.Map;
 
 @Singleton
 public class ApplicationManagementServiceImpl implements ApplicationManagementService {
+    private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationManagementServiceImpl.class);
+
     private final SiteEntityService siteEntityService;
     private final ApplicationProviderService applicationProviderService;
     private final ApplicationEntityService applicationEntityService;
     private final IMetadataDao alertMetadataService;
     private final Config config;
-    private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationManagementServiceImpl.class);
+
+    @Inject private Injector currentInjector;
 
     @Inject
     public ApplicationManagementServiceImpl(
@@ -99,13 +100,26 @@ public class ApplicationManagementServiceImpl implements ApplicationManagementSe
         }
         applicationEntity.setConfiguration(appConfig);
 
+        // Validate Dependency
         validateDependingApplicationInstalled(applicationEntity);
 
-        ApplicationOperationContext applicationOperationContext = new ApplicationOperationContext(
-            applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType()).getApplication(),
-            applicationEntity, config, alertMetadataService);
-        applicationOperationContext.onInstall();
-        return applicationEntityService.create(applicationEntity);
+        ApplicationProvider<?> applicationProvider = applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType());
+
+        // DoInstall
+        ApplicationAction applicationAction = new ApplicationAction(applicationProvider.getApplication(), applicationEntity, config, alertMetadataService);
+        applicationAction.doInstall();
+
+        // UpdateMetadata
+        ApplicationEntity result =  applicationEntityService.create(applicationEntity);
+
+        // AfterInstall Callback
+        applicationProvider.getApplicationListener().ifPresent((listener) -> {
+            currentInjector.injectMembers(listener);
+            listener.init(result);
+            listener.afterInstall();
+        });
+
+        return result;
     }
 
     private void validateDependingApplicationInstalled(ApplicationEntity applicationEntity) {
@@ -120,18 +134,23 @@ public class ApplicationManagementServiceImpl implements ApplicationManagementSe
 
     @Override
     public ApplicationEntity uninstall(ApplicationOperations.UninstallOperation operation) throws ApplicationWrongStatusException {
-        ApplicationEntity applicationEntity = applicationEntityService.getByUUIDOrAppId(operation.getUuid(), operation.getAppId());
-        ApplicationOperationContext applicationOperationContext = new ApplicationOperationContext(
-            applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType()).getApplication(),
-            applicationEntity, config, alertMetadataService);
+        ApplicationEntity appEntity = applicationEntityService.getByUUIDOrAppId(operation.getUuid(), operation.getAppId());
+        ApplicationProvider<?> appProvider = applicationProviderService.getApplicationProviderByType(appEntity.getDescriptor().getType());
 
-        ApplicationEntity.Status currentStatus = applicationEntity.getStatus();
+        ApplicationAction appAction = new ApplicationAction(appProvider.getApplication(), appEntity, config, alertMetadataService);
+        ApplicationEntity.Status currentStatus = appEntity.getStatus();
         try {
             if (currentStatus == ApplicationEntity.Status.INITIALIZED || currentStatus == ApplicationEntity.Status.STOPPED) {
-                applicationOperationContext.onUninstall();
-                return applicationEntityService.delete(applicationEntity);
+                // AfterUninstall Callback
+                appAction.doUninstall();
+                appProvider.getApplicationListener().ifPresent((listener) -> {
+                    currentInjector.injectMembers(listener);
+                    listener.init(appEntity);
+                    listener.afterUninstall();
+                });
+                return applicationEntityService.delete(appEntity);
             } else {
-                throw new ApplicationWrongStatusException("App: " + applicationEntity.getAppId() + " status is" + currentStatus + ", uninstall operation is not allowed");
+                throw new ApplicationWrongStatusException("App: " + appEntity.getAppId() + " status is" + currentStatus + ", uninstall operation is not allowed");
             }
         } catch (Throwable throwable) {
             LOGGER.error(throwable.getMessage(), throwable);
@@ -141,49 +160,59 @@ public class ApplicationManagementServiceImpl implements ApplicationManagementSe
 
     @Override
     public ApplicationEntity start(ApplicationOperations.StartOperation operation) throws ApplicationWrongStatusException {
-        ApplicationEntity applicationEntity = applicationEntityService.getByUUIDOrAppId(operation.getUuid(), operation.getAppId());
-        Application application = applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType()).getApplication();
+        ApplicationEntity appEntity = applicationEntityService.getByUUIDOrAppId(operation.getUuid(), operation.getAppId());
+        ApplicationProvider<?> appProvider = applicationProviderService.getApplicationProviderByType(appEntity.getDescriptor().getType());
+        Application application = appProvider.getApplication();
         Preconditions.checkArgument(application.isExecutable(), "Application is not executable");
 
-        ApplicationEntity.Status currentStatus = applicationEntity.getStatus();
+        ApplicationEntity.Status currentStatus = appEntity.getStatus();
         try {
             if (currentStatus == ApplicationEntity.Status.INITIALIZED || currentStatus == ApplicationEntity.Status.STOPPED) {
-                ApplicationOperationContext applicationOperationContext = new ApplicationOperationContext(
-                        application, applicationEntity, config, alertMetadataService);
-
-                applicationOperationContext.onStart();
-                //Only when topology submitted successfully can the state change to STARTING
-                applicationEntityService.delete(applicationEntity);
-                applicationEntity.setStatus(ApplicationEntity.Status.STARTING);
-                return applicationEntityService.create(applicationEntity);
+                ApplicationAction applicationAction = new ApplicationAction(application, appEntity, config, alertMetadataService);
+                // AfterInstall Callback
+                appProvider.getApplicationListener().ifPresent((listener) -> {
+                    currentInjector.injectMembers(listener);
+                    listener.init(appEntity);
+                    listener.beforeStart();
+                });
+                applicationAction.doStart();
+
+                //TODO: Only when topology submitted successfully can the state change to STARTING
+                applicationEntityService.delete(appEntity);
+                appEntity.setStatus(ApplicationEntity.Status.STARTING);
+                return applicationEntityService.create(appEntity);
             } else {
-                throw new ApplicationWrongStatusException("App: " + applicationEntity.getAppId() + " status is " + currentStatus + " start operation is not allowed");
+                throw new ApplicationWrongStatusException("App: " + appEntity.getAppId() + " status is " + currentStatus + " start operation is not allowed");
             }
         } catch (ApplicationWrongStatusException e) {
             LOGGER.error(e.getMessage(), e);
             throw e;
         } catch (Exception e) {
-            LOGGER.error("Failed to start app " + applicationEntity.getAppId(), e);
+            LOGGER.error("Failed to start app " + appEntity.getAppId(), e);
             throw e;
         } catch (Throwable throwable) {
             LOGGER.error(throwable.getMessage(), throwable);
             throw throwable;
         }
-
     }
 
     @Override
     public ApplicationEntity stop(ApplicationOperations.StopOperation operation) throws ApplicationWrongStatusException {
         ApplicationEntity applicationEntity = applicationEntityService.getByUUIDOrAppId(operation.getUuid(), operation.getAppId());
-        Application application = applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType()).getApplication();
+        ApplicationProvider<?> appProvider = applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType());
+        Application application = appProvider.getApplication();
         Preconditions.checkArgument(application.isExecutable(), "Application is not executable");
 
-        ApplicationOperationContext applicationOperationContext = new ApplicationOperationContext(
-                application, applicationEntity, config, alertMetadataService);
+        ApplicationAction applicationAction = new ApplicationAction(application, applicationEntity, config, alertMetadataService);
         ApplicationEntity.Status currentStatus = applicationEntity.getStatus();
         try {
             if (currentStatus == ApplicationEntity.Status.RUNNING) {
-                applicationOperationContext.onStop();
+                applicationAction.doStop();
+                appProvider.getApplicationListener().ifPresent((listener) -> {
+                    currentInjector.injectMembers(listener);
+                    listener.init(applicationEntity);
+                    listener.afterStop();
+                });
                 //stop -> directly killed
                 applicationEntityService.delete(applicationEntity);
                 applicationEntity.setStatus(ApplicationEntity.Status.STOPPING);
@@ -210,14 +239,11 @@ public class ApplicationManagementServiceImpl implements ApplicationManagementSe
             Application application = applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType()).getApplication();
             Preconditions.checkArgument(application.isExecutable(), "Application is not executable");
 
-            ApplicationOperationContext applicationOperationContext = new ApplicationOperationContext(
-                    application, applicationEntity, config, alertMetadataService);
-            ApplicationEntity.Status topologyStatus = applicationOperationContext.getStatus();
-            return topologyStatus;
+            ApplicationAction applicationAction = new ApplicationAction(application, applicationEntity, config, alertMetadataService);
+            return applicationAction.getStatus();
         } catch (IllegalArgumentException e) {
             LOGGER.error("application id not exist", e);
             throw e;
         }
     }
-
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderConfigLoader.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderConfigLoader.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderConfigLoader.java
index 025bc7c..1455922 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderConfigLoader.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderConfigLoader.java
@@ -99,7 +99,6 @@ public class ApplicationProviderConfigLoader extends ApplicationProviderLoader {
             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);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java
index 9f52c9c..cbbd438 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java
@@ -81,7 +81,6 @@ public class ApplicationProviderSPILoader extends ApplicationProviderLoader {
                 providerConfig.setClassName(applicationProvider.getClass().getCanonicalName());
                 providerConfig.setJarPath(jarFileSupplier.apply(applicationProvider));
                 applicationProvider.getApplicationDesc().setExecutable(applicationProvider.getApplication().isExecutable());
-                applicationProvider.prepare(providerConfig, getConfig());
                 registerProvider(applicationProvider);
                 LOG.warn("Loaded {}:{} ({}) from {}",
                     applicationProvider.getApplicationDesc().getType(),

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/KafkaStreamSink.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/KafkaStreamSink.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/KafkaStreamSink.java
index 2a03275..2ac4779 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/KafkaStreamSink.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/sink/KafkaStreamSink.java
@@ -65,7 +65,7 @@ public class KafkaStreamSink extends StormStreamSink<KafkaStreamSinkConfig> {
     }
 
     @Override
-    public void onInstall() {
+    public void afterInstall() {
         ensureTopicCreated();
     }
 
@@ -85,7 +85,7 @@ public class KafkaStreamSink extends StormStreamSink<KafkaStreamSinkConfig> {
     }
 
     @Override
-    public void onUninstall() {
+    public void afterUninstall() {
         ensureTopicDeleted();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/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
index 61a6836..8256aba 100644
--- 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
@@ -27,13 +27,13 @@ public class LoggingStreamSink extends StormStreamSink<DefaultStreamSinkConfig>
     private static final Logger LOGGER = LoggerFactory.getLogger(KafkaStreamSink.class);
 
     @Override
-    public void onInstall() {
-        LOGGER.info("Executing onInstall callback, do nothing");
+    public void afterInstall() {
+        LOGGER.info("Executing afterInstall callback, do nothing");
     }
 
     @Override
-    public void onUninstall() {
-        LOGGER.info("Executing onUninstall callback, do nothing");
+    public void afterUninstall() {
+        LOGGER.info("Executing afterUninstall callback, do nothing");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/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
index 06ac703..2a8d7c0 100644
--- 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
@@ -17,20 +17,31 @@
 
 package org.apache.eagle.app.spi;
 
+import com.google.common.base.Preconditions;
+import com.google.inject.AbstractModule;
 import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
 import org.apache.eagle.app.Application;
+import org.apache.eagle.app.service.ApplicationListener;
+import org.apache.eagle.common.module.GlobalScope;
 import org.apache.eagle.common.module.ModuleRegistry;
+import org.apache.eagle.common.module.ModuleScope;
 import org.apache.eagle.metadata.model.ApplicationDesc;
 import org.apache.eagle.metadata.model.ApplicationDocs;
+import org.apache.eagle.metadata.model.ApplicationEntity;
 import org.apache.eagle.metadata.model.Configuration;
+import org.apache.eagle.metadata.persistence.MetadataStore;
+import org.apache.eagle.metadata.service.memory.MemoryMetadataStore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.xml.bind.JAXBException;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
+import java.util.Optional;
 
 /**
- * Describe Application metadata with XML descriptor configuration in path of:  /META-INF/providers/${ApplicationProviderClassName}.xml
+ * Describe Application metadata with XML descriptor configuration in path of:  /META-INF/providers/${ApplicationProviderClassName}.xml.
  */
 public abstract class AbstractApplicationProvider<T extends Application> implements ApplicationProvider<T> {
     private static final Logger LOG = LoggerFactory.getLogger(AbstractApplicationProvider.class);
@@ -96,8 +107,43 @@ public abstract class AbstractApplicationProvider<T extends Application> impleme
         return applicationDesc;
     }
 
+    private ModuleRegistry currentRegistry;
+
     @Override
-    public void register(ModuleRegistry registry) {
+    public final void register(ModuleRegistry registry) {
         LOG.debug("Registering modules {}", this.getClass().getName());
+        this.currentRegistry = registry;
+        onRegister();
+    }
+
+    @Override
+    public Optional<ApplicationListener> getApplicationListener() {
+        return Optional.empty();
+    }
+
+    protected void onRegister() {
+        // Do nothing by default;
+    }
+
+    protected  <M extends ModuleScope,T> void bind(Class<M> scope, Class<T> type, Class<? extends T> impl) {
+        Preconditions.checkNotNull(currentRegistry, "No registry set before being used");
+        currentRegistry.register(scope, new AbstractModule() {
+            @Override
+            protected void configure() {
+                bind(type).to(impl);
+            }
+        });
+    }
+
+    public <T> void bind(Class<T> type, Class<? extends T> impl) {
+        bind(GlobalScope.class,type,impl);
+    }
+
+    protected <M extends MetadataStore,T> void bindToMetaStore(Class<? extends M> scope, Class<T> type, Class<? extends T> impl) {
+        bind(scope,type,impl);
+    }
+
+    public <T> void bindToMemoryMetaStore(Class<T> type, Class<? extends T> impl) {
+        bindToMetaStore(MemoryMetadataStore.class,type,impl);
     }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/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
index 0dceb72..bc70373 100644
--- 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
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -14,15 +14,16 @@
  * 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.app.service.ApplicationListener;
 import org.apache.eagle.common.module.ModuleRegistry;
 import org.apache.eagle.metadata.model.ApplicationDesc;
 
 import java.lang.reflect.ParameterizedType;
+import java.util.Optional;
 
 /**
  * Application Service Provider Interface.
@@ -32,13 +33,6 @@ import java.lang.reflect.ParameterizedType;
 public interface ApplicationProvider<T extends Application> {
 
     /**
-     * Prepare Application Provider before loading.
-     */
-    default void prepare(ApplicationProviderConfig providerConfig, Config envConfig) {
-        // Do nothing by default.
-    }
-
-    /**
      * @return application descriptor.
      */
     ApplicationDesc getApplicationDesc();
@@ -67,6 +61,11 @@ public interface ApplicationProvider<T extends Application> {
     T getApplication();
 
     /**
+     * @return application lifecycle listeners type.
+     */
+    Optional<ApplicationListener> getApplicationListener();
+
+    /**
      * Extend application modules like Web Resource, Metadata Store, etc.
      */
     void register(ModuleRegistry registry);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/ApplicationSimulatorImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/ApplicationSimulatorImpl.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/ApplicationSimulatorImpl.java
index 2094d74..1abdb6b 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/ApplicationSimulatorImpl.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/ApplicationSimulatorImpl.java
@@ -83,7 +83,6 @@ public class ApplicationSimulatorImpl extends ApplicationSimulator {
     public void start(Class<? extends ApplicationProvider> appProviderClass, Map<String, Object> appConfig) {
         try {
             ApplicationProvider applicationProvider = appProviderClass.newInstance();
-            applicationProvider.prepare(new ApplicationProviderConfig(DynamicJarPathFinder.findPath(appProviderClass), appProviderClass), config);
             start(applicationProvider.getApplicationDesc().getType(), appConfig);
         } catch (InstantiationException | IllegalAccessException e) {
             throw new IllegalStateException(e.getMessage(), e);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestStormApplication.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestStormApplication.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestStormApplication.java
index c6ac5db..a47e30a 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestStormApplication.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/TestStormApplication.java
@@ -72,13 +72,8 @@ public class TestStormApplication extends StormApplication{
         }
 
         @Override
-        public void register(ModuleRegistry registry) {
-            registry.register(MemoryMetadataStore.class, new AbstractModule() {
-                @Override
-                protected void configure() {
-                    bind(ExtendedDao.class).to(ExtendedDaoImpl.class);
-                }
-            });
+        public void onRegister() {
+            bindToMemoryMetaStore(ExtendedDao.class,ExtendedDaoImpl.class);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/ApplicationActionTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/ApplicationActionTest.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/ApplicationActionTest.java
new file mode 100644
index 0000000..d076bf7
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/ApplicationActionTest.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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 com.typesafe.config.ConfigFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.HashMap;
+
+public class ApplicationActionTest {
+    /**
+     * appConfig.withFallback(envConfig): appConfig will override envConfig, envConfig is used as default config
+     */
+    @Test
+    public void testTypeSafeConfigMerge(){
+        Config appConfig = ConfigFactory.parseMap(new HashMap<String,String>(){{
+            put("APP_CONFIG",ApplicationActionTest.this.getClass().getCanonicalName());
+            put("SCOPE","APP");
+        }});
+
+        Config envConfig = ConfigFactory.parseMap(new HashMap<String,String>(){{
+            put("ENV_CONFIG",ApplicationActionTest.this.getClass().getCanonicalName());
+            put("SCOPE","ENV");
+        }});
+
+        Config mergedConfig = appConfig.withFallback(envConfig);
+        Assert.assertTrue(mergedConfig.hasPath("APP_CONFIG"));
+        Assert.assertTrue(mergedConfig.hasPath("ENV_CONFIG"));
+        Assert.assertEquals("appConfig.withFallback(envConfig): appConfig will override envConfig, envConfig is used as default config",
+                "APP",mergedConfig.getString("SCOPE"));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/ApplicationOperationContextTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/ApplicationOperationContextTest.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/ApplicationOperationContextTest.java
deleted file mode 100644
index 21044be..0000000
--- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/service/ApplicationOperationContextTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * <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 com.typesafe.config.ConfigFactory;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.HashMap;
-
-public class ApplicationOperationContextTest {
-    /**
-     * appConfig.withFallback(envConfig): appConfig will override envConfig, envConfig is used as default config
-     */
-    @Test
-    public void testTypeSafeConfigMerge(){
-        Config appConfig = ConfigFactory.parseMap(new HashMap<String,String>(){{
-            put("APP_CONFIG",ApplicationOperationContextTest.this.getClass().getCanonicalName());
-            put("SCOPE","APP");
-        }});
-
-        Config envConfig = ConfigFactory.parseMap(new HashMap<String,String>(){{
-            put("ENV_CONFIG",ApplicationOperationContextTest.this.getClass().getCanonicalName());
-            put("SCOPE","ENV");
-        }});
-
-        Config mergedConfig = appConfig.withFallback(envConfig);
-        Assert.assertTrue(mergedConfig.hasPath("APP_CONFIG"));
-        Assert.assertTrue(mergedConfig.hasPath("ENV_CONFIG"));
-        Assert.assertEquals("appConfig.withFallback(envConfig): appConfig will override envConfig, envConfig is used as default config",
-                "APP",mergedConfig.getString("SCOPE"));
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/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
index 5297de1..c6d01f4 100644
--- 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
@@ -39,6 +39,12 @@ public class ApplicationEntity extends PersistenceEntity {
     private List<StreamDesc> streams;
     private Mode mode = Mode.CLUSTER;
     private String jarPath;
+
+    @Override
+    public String toString() {
+        return String.format("Application[appId=%s,siteId=%s,UUID=%s]", appId, descriptor.getType(), this.getUuid());
+    }
+
     private Status status = Status.INITIALIZED;
 
     public ApplicationEntity() {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/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
index c207788..bedda04 100644
--- 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
@@ -16,23 +16,25 @@
  */
 package org.apache.eagle.app.example;
 
-import com.google.inject.AbstractModule;
 import org.apache.eagle.app.example.extensions.ExampleCommonService;
 import org.apache.eagle.app.example.extensions.ExampleCommonServiceImpl;
 import org.apache.eagle.app.example.extensions.ExampleEntityService;
 import org.apache.eagle.app.example.extensions.ExampleEntityServiceMemoryImpl;
+import org.apache.eagle.app.service.ApplicationListener;
 import org.apache.eagle.app.spi.AbstractApplicationProvider;
-import org.apache.eagle.common.module.GlobalScope;
-import org.apache.eagle.common.module.ModuleRegistry;
-import org.apache.eagle.metadata.service.memory.MemoryMetadataStore;
+import org.apache.eagle.metadata.model.ApplicationEntity;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import com.google.inject.Inject;
+
+import java.util.Optional;
 
 /**
  * Define application provider pragmatically
  */
 public class ExampleApplicationProvider extends AbstractApplicationProvider<ExampleStormApplication> {
-    private final static Logger LOGGER = LoggerFactory.getLogger(ExampleApplicationProvider.class);
+    private static final Logger LOG = LoggerFactory.getLogger(ExampleApplicationProvider.class);
 
     @Override
     public ExampleStormApplication getApplication() {
@@ -40,21 +42,44 @@ public class ExampleApplicationProvider extends AbstractApplicationProvider<Exam
     }
 
     @Override
-    public void register(ModuleRegistry registry) {
-        registry.register(MemoryMetadataStore.class, new AbstractModule() {
+    public Optional<ApplicationListener> getApplicationListener() {
+        return Optional.of(new ApplicationListener() {
+
+            @Inject ExampleEntityService entityService;
+
+            private ApplicationEntity application;
+
             @Override
-            protected void configure() {
-                LOGGER.info("Load memory metadata modules ...");
-                bind(ExampleEntityService.class).to(ExampleEntityServiceMemoryImpl.class);
+            public void init(ApplicationEntity applicationEntity) {
+                this.application = applicationEntity;
+                entityService.getEntities();
+            }
+
+            @Override
+            public void afterInstall() {
+                LOG.info("afterInstall {}", this.application);
             }
-        });
 
-        registry.register(new AbstractModule() {
             @Override
-            protected void configure() {
-                LOGGER.info("Load global modules ...");
-                bind(ExampleCommonService.class).to(ExampleCommonServiceImpl.class);
+            public void afterUninstall() {
+                LOG.info("afterUninstall {}", this.application);
+            }
+
+            @Override
+            public void beforeStart() {
+                LOG.info("beforeStart {}", this.application);
+            }
+
+            @Override
+            public void afterStop() {
+                LOG.info("afterStop {}", this.application);
             }
         });
     }
+
+    @Override
+    protected void onRegister() {
+        bindToMemoryMetaStore(ExampleEntityService.class,ExampleEntityServiceMemoryImpl.class);
+        bind(ExampleCommonService.class,ExampleCommonServiceImpl.class);
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java
----------------------------------------------------------------------
diff --git a/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java b/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java
index d9ae0ab..e788eb9 100644
--- a/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java
+++ b/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java
@@ -32,11 +32,6 @@ public class HBaseAuditLogAppProvider extends AbstractApplicationProvider<HBaseA
         return new HBaseAuditLogApplication();
     }
 
-    @Override
-    public void register(ModuleRegistry registry) {
-
-    }
-
     private static class MyModule extends AbstractModule {
         @Override
         protected void configure() {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fc2407cd/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.auditlog.HdfsAuditLogAppProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.auditlog.HdfsAuditLogAppProvider.xml b/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.auditlog.HdfsAuditLogAppProvider.xml
index 625a3a7..9f10fdc 100644
--- a/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.auditlog.HdfsAuditLogAppProvider.xml
+++ b/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.auditlog.HdfsAuditLogAppProvider.xml
@@ -73,13 +73,13 @@
         <property>
             <name>dataSourceConfig.zkConnection</name>
             <displayName>dataSourceConfig.zkConnection</displayName>
-            <value>server.eagle.apache.org</value>
+            <value>localhost</value>
             <description>zk connection</description>
         </property>
         <property>
             <name>dataSourceConfig.txZkServers</name>
             <displayName>dataSourceConfig.txZkServers</displayName>
-            <value>server.eagle.apache.org:2181</value>
+            <value>localhost:2181</value>
             <description>zookeeper server for offset transaction</description>
         </property>
         <property>
@@ -133,7 +133,7 @@
         <property>
             <name>dataSinkConfig.brokerList</name>
             <displayName>dataSinkConfig.brokerList</displayName>
-            <value>server.eagle.apache.org:6667</value>
+            <value>localhost:6667</value>
             <description>kafka broker list</description>
         </property>
         <property>
@@ -153,7 +153,7 @@
         <property>
             <name>fs.defaultFS</name>
             <displayName>fs.defaultFS</displayName>
-            <value>hdfs://server.eagle.apache.org:8020</value>
+            <value>hdfs://localhost:8020</value>
             <description>hdfs endpoint</description>
         </property>
     </configuration>


[24/50] incubator-eagle git commit: [EAGLE-582] add simple Basic Authentication registration to server appl…

Posted by ha...@apache.org.
[EAGLE-582] add simple Basic Authentication registration to server appl\u2026

This is one of the sub-tasks of ticket EAGLE-433, to successfully register a simple Basic Authentication authenticator to the server application.

With this check-in, when the server is up, any access to rest api method that has a Auth annotation on it's User field will require correct credentials.

Author: anyway1021 <mw...@apache.org>

Closes #468 from anyway1021/EAGLE-582.


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

Branch: refs/heads/master
Commit: 649adb1ae400e026a8e932d53bd813f03fecb2d1
Parents: 7bd5d1d
Author: anyway1021 <mw...@apache.org>
Authored: Fri Oct 14 12:13:23 2016 +0800
Committer: anyway1021 <mw...@apache.org>
Committed: Fri Oct 14 12:13:23 2016 +0800

----------------------------------------------------------------------
 .../eagle/common/authentication/User.java       |  45 ++++++
 eagle-server/pom.xml                            |  23 +++
 .../apache/eagle/server/ServerApplication.java  |  22 +--
 .../org/apache/eagle/server/ServerConfig.java   |  14 ++
 .../authentication/AuthenticationMode.java      |  51 +++++++
 .../AuthenticationModeIdentifier.java           | 105 ++++++++++++++
 .../authentication/AuthenticationRegister.java  |  41 ++++++
 .../SwitchableBasicAuthProvider.java            |  50 +++++++
 .../AbstractSwitchableAuthenticator.java        |  48 +++++++
 .../authenticator/LdapBasicAuthenticator.java   |  40 ++++++
 .../authenticator/SimpleBasicAuthenticator.java |  43 ++++++
 .../config/AuthenticationSettings.java          | 119 ++++++++++++++++
 .../authentication/config/LdapSettings.java     | 142 +++++++++++++++++++
 .../authentication/config/SimpleSettings.java   |  46 ++++++
 .../src/main/resources/application.conf         |   2 +-
 .../src/main/resources/configuration.yml        |  48 ++++++-
 .../TestBasicAuthenticationResource.java        |  39 +++++
 .../src/test/resources/configuration.yml        |  45 ++++++
 pom.xml                                         |  13 +-
 19 files changed, 924 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/authentication/User.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/authentication/User.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/authentication/User.java
new file mode 100644
index 0000000..85388cd
--- /dev/null
+++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/authentication/User.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.authentication;
+
+import java.io.Serializable;
+import java.security.Principal;
+import java.util.Set;
+
+public class User implements Principal, Serializable {
+    private String username = "Unauthenticated";
+    private Set<String> roles = null;
+
+    public User() {}
+
+    public User(String username) {
+        this.username = username;
+    }
+
+    public User(String username, Set<String> roles) {
+        this.username = username;
+        this.roles = roles;
+    }
+
+    public Set<String> getRoles() {
+        return roles;
+    }
+
+    public String getName() {
+        return username;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-server/pom.xml b/eagle-server/pom.xml
index 21bda30..7fe4397 100644
--- a/eagle-server/pom.xml
+++ b/eagle-server/pom.xml
@@ -133,6 +133,14 @@
                     <groupId>org.wso2.orbit.com.lmax</groupId>
                     <artifactId>disruptor</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-simple</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
         <dependency>
@@ -144,6 +152,12 @@
             <groupId>org.apache.eagle</groupId>
             <artifactId>eagle-security-hbase-auditlog</artifactId>
             <version>${project.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.eagle</groupId>
@@ -157,6 +171,15 @@
             <artifactId>eagle-alert-app</artifactId>
             <version>${project.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>io.dropwizard</groupId>
+            <artifactId>dropwizard-auth</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+        </dependency>
     </dependencies>
 
     <profiles>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/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
index 2dc39b1..2ae95a6 100644
--- a/eagle-server/src/main/java/org/apache/eagle/server/ServerApplication.java
+++ b/eagle-server/src/main/java/org/apache/eagle/server/ServerApplication.java
@@ -17,25 +17,26 @@
 package org.apache.eagle.server;
 import com.google.inject.Injector;
 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.lifecycle.Managed;
+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.common.authentication.User;
 import org.apache.eagle.log.base.taggedlog.EntityJsonModule;
 import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
 import org.apache.eagle.metadata.service.ApplicationStatusUpdateService;
+import org.apache.eagle.server.authentication.AuthenticationRegister;
 import org.apache.eagle.server.managedtask.ApplicationTask;
 import org.apache.eagle.server.module.GuiceBundleLoader;
 
-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 java.util.EnumSet;
 import javax.servlet.DispatcherType;
+import java.util.EnumSet;
 
 class ServerApplication extends Application<ServerConfig> {
     private GuiceBundle guiceBundle;
@@ -79,6 +80,9 @@ class ServerApplication extends Application<ServerConfig> {
         environment.servlets().addFilter(SimpleCORSFiler.class.getName(), new SimpleCORSFiler())
             .addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/*");
 
+        // add authentication filters
+        new AuthenticationRegister<>(configuration, environment, User.class).register();
+
         // context listener
         environment.servlets().addServletListeners(new CoordinatorListener());
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/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
index 58442d9..0afe63b 100644
--- a/eagle-server/src/main/java/org/apache/eagle/server/ServerConfig.java
+++ b/eagle-server/src/main/java/org/apache/eagle/server/ServerConfig.java
@@ -19,6 +19,8 @@ package org.apache.eagle.server;
 import com.typesafe.config.Config;
 import com.typesafe.config.ConfigFactory;
 import io.dropwizard.Configuration;
+import org.apache.eagle.server.authentication.config.AuthenticationSettings;
+import org.codehaus.jackson.annotate.JsonProperty;
 
 public class ServerConfig extends Configuration {
     private static final String SERVER_NAME = "Apache Eagle";
@@ -29,10 +31,22 @@ public class ServerConfig extends Configuration {
     private static final String LICENSE = "Apache License (Version 2.0)";
     private static final String LICENSE_URL = "http://www.apache.org/licenses/LICENSE-2.0";
 
+    private AuthenticationSettings auth = new AuthenticationSettings();
+
     public Config getConfig() {
         return ConfigFactory.load();
     }
 
+    @JsonProperty("auth")
+    public AuthenticationSettings getAuth() {
+        return auth;
+    }
+
+    @JsonProperty("auth")
+    public void setAuth(AuthenticationSettings auth) {
+        this.auth = auth;
+    }
+
     static String getServerName() {
         return SERVER_NAME;
     }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationMode.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationMode.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationMode.java
new file mode 100644
index 0000000..8a7208f
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationMode.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.server.authentication;
+
+import io.dropwizard.auth.Authenticator;
+import io.dropwizard.auth.CachingAuthenticator;
+import io.dropwizard.auth.basic.BasicCredentials;
+
+public abstract class AuthenticationMode<P> {
+    private static final String PREFIX_VALUE = "Basic";
+
+    protected AuthenticationModeIdentifier identifier = null;
+
+    private Authenticator<BasicCredentials, P> authenticator = null;
+
+    public AuthenticationMode(AuthenticationModeIdentifier identifier) {
+        this.identifier = identifier;
+        this.authenticator = createAuthenticator();
+    }
+
+    abstract Authenticator<BasicCredentials, P> createAuthenticator();
+
+    abstract String getRealm();
+
+    Authenticator<BasicCredentials, P> getAuthenticator() {
+        return identifier.cacheRequired() ? cache(authenticator) : authenticator;
+    }
+
+    private Authenticator<BasicCredentials, P> cache(Authenticator<BasicCredentials, P> authenticator) {
+        return new CachingAuthenticator<BasicCredentials, P>(identifier.getMetricRegistry(), authenticator, identifier.getCacheBuilderSpec());
+    }
+
+    AuthenticationModeIdentifier getIdentifier() {
+        return identifier;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationModeIdentifier.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationModeIdentifier.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationModeIdentifier.java
new file mode 100644
index 0000000..979bcbf
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationModeIdentifier.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.server.authentication;
+
+import com.codahale.metrics.MetricRegistry;
+import com.google.common.cache.CacheBuilderSpec;
+import io.dropwizard.auth.Authenticator;
+import io.dropwizard.auth.basic.BasicCredentials;
+import io.dropwizard.setup.Environment;
+import org.apache.eagle.common.authentication.User;
+import org.apache.eagle.server.authentication.authenticator.LdapBasicAuthenticator;
+import org.apache.eagle.server.authentication.authenticator.SimpleBasicAuthenticator;
+import org.apache.eagle.server.authentication.config.AuthenticationSettings;
+
+public class AuthenticationModeIdentifier {
+    private static final String SIMPLE_MODE_KEYWORD = "simple";
+    private static final String SIMPLE_MODE_REALM = "SIMPLE_AUTHENTICATION";
+    private static final String LDAP_MODE_KEYWORD = "ldap";
+    private static final String LDAP_MODE_REALM = "LDAP_AUTHENTICATION";
+
+    private AuthenticationSettings settings = null;
+    private Environment environment = null;
+
+    private AuthenticationModeIdentifier(AuthenticationSettings settings, Environment environment) {
+        this.settings = settings;
+        this.environment = environment;
+    }
+
+    static AuthenticationModeIdentifier initiate(AuthenticationSettings config, Environment environment) {
+        return new AuthenticationModeIdentifier(config, environment);
+    }
+
+    AuthenticationMode<User> identify() {
+        String modeKeyword = getModeKeyword();
+        if (SIMPLE_MODE_KEYWORD.equalsIgnoreCase(modeKeyword)) {
+            return new AuthenticationMode<User>(this) {
+                public Authenticator<BasicCredentials, User> createAuthenticator() {
+                    return new SimpleBasicAuthenticator(getIdentifier().getSettings());
+                }
+
+                public String getRealm() {
+                    return AuthenticationModeIdentifier.SIMPLE_MODE_REALM;
+                }
+            };
+        }
+        if (LDAP_MODE_KEYWORD.equalsIgnoreCase(modeKeyword)) {
+            return new AuthenticationMode<User>(this) {
+                public Authenticator<BasicCredentials, User> createAuthenticator() {
+                    return new LdapBasicAuthenticator(getIdentifier().getSettings());
+                }
+
+                public String getRealm() {
+                    return AuthenticationModeIdentifier.LDAP_MODE_REALM;
+                }
+            };
+        }
+        throw new RuntimeException(String.format("No matching mode can be found: %s", modeKeyword));
+    }
+
+    MetricRegistry getMetricRegistry() {
+        return environment.metrics();
+    }
+
+    boolean cacheRequired() {
+        return settings.needsCaching();
+    }
+
+    boolean authorizationRequired() {
+        return settings.needsAuthorization();
+    }
+
+    boolean parameterAnnotationEnabled() {
+        return settings.byAnnotated();
+    }
+
+    CacheBuilderSpec getCacheBuilderSpec() {
+        return CacheBuilderSpec.parse(settings.getCachePolicy());
+    }
+
+    AuthenticationSettings getSettings() {
+        return settings;
+    }
+
+    private Environment getEnvironment() {
+        return environment;
+    }
+
+    private String getModeKeyword() {
+        return settings.getMode();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationRegister.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationRegister.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationRegister.java
new file mode 100644
index 0000000..65d2171
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationRegister.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.server.authentication;
+
+import io.dropwizard.setup.Environment;
+import org.apache.eagle.common.authentication.User;
+import org.apache.eagle.server.ServerConfig;
+
+import java.security.Principal;
+
+public class AuthenticationRegister<P extends Principal> {
+    private ServerConfig serverConfig = null;
+    private Environment environment = null;
+    private Class<P> principalClass = null;
+
+    public AuthenticationRegister(ServerConfig serverConfig, Environment environment, Class<P> principalClass) {
+        this.serverConfig = serverConfig;
+        this.environment = environment;
+        this.principalClass = principalClass;
+    }
+
+    public void register() {
+        AuthenticationMode<User> mode = AuthenticationModeIdentifier.initiate(serverConfig.getAuth(), environment).identify();
+
+        environment.jersey().register(new SwitchableBasicAuthProvider(mode.getAuthenticator(), mode.getRealm()));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/src/main/java/org/apache/eagle/server/authentication/SwitchableBasicAuthProvider.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/SwitchableBasicAuthProvider.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/SwitchableBasicAuthProvider.java
new file mode 100644
index 0000000..74f286d
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/SwitchableBasicAuthProvider.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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.authentication;
+
+import com.sun.jersey.api.core.HttpContext;
+import com.sun.jersey.api.model.Parameter;
+import com.sun.jersey.core.spi.component.ComponentContext;
+import com.sun.jersey.server.impl.inject.AbstractHttpContextInjectable;
+import com.sun.jersey.spi.inject.Injectable;
+import io.dropwizard.auth.Auth;
+import io.dropwizard.auth.Authenticator;
+import io.dropwizard.auth.basic.BasicAuthProvider;
+import io.dropwizard.auth.basic.BasicCredentials;
+import org.apache.eagle.server.authentication.authenticator.AbstractSwitchableAuthenticator;
+
+public class SwitchableBasicAuthProvider<P> extends BasicAuthProvider<P> {
+    private AbstractSwitchableAuthenticator<BasicCredentials, P> switchableAuthenticator = null;
+
+    public SwitchableBasicAuthProvider(Authenticator<BasicCredentials, P> authenticator, String realm) {
+        super(authenticator, realm);
+        if (authenticator instanceof AbstractSwitchableAuthenticator) {
+            switchableAuthenticator = (AbstractSwitchableAuthenticator<BasicCredentials, P>) authenticator;
+        }
+    }
+
+    public Injectable<?> getInjectable(ComponentContext ic, Auth a, Parameter c) {
+        if (switchableAuthenticator != null && !switchableAuthenticator.getSettings().isEnabled()) {
+            return new AbstractHttpContextInjectable<P>() {
+                public P getValue(HttpContext c) {
+                    return switchableAuthenticator.getUnauthenticatedPrincipal();
+                }
+            };
+        }
+        return super.getInjectable(ic, a, c);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/AbstractSwitchableAuthenticator.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/AbstractSwitchableAuthenticator.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/AbstractSwitchableAuthenticator.java
new file mode 100644
index 0000000..5ca12fb
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/AbstractSwitchableAuthenticator.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.authentication.authenticator;
+
+import io.dropwizard.auth.Authenticator;
+import org.apache.eagle.server.authentication.config.AuthenticationSettings;
+
+public abstract class AbstractSwitchableAuthenticator<C, P> implements Authenticator<C, P> {
+    private AuthenticationSettings settings;
+    private Class<P> principalClass;
+    private P unauthenticatedPrincipal;
+
+    public AbstractSwitchableAuthenticator(AuthenticationSettings settings, Class<P> principalClass) {
+        this.settings = settings;
+        this.principalClass = principalClass;
+    }
+
+    public AuthenticationSettings getSettings() {
+        return settings;
+    }
+
+    public P getUnauthenticatedPrincipal() {
+        try {
+            if (unauthenticatedPrincipal == null) {
+                unauthenticatedPrincipal = principalClass.newInstance();
+            }
+            return unauthenticatedPrincipal;
+        } catch (InstantiationException e) {
+            throw new RuntimeException(String.format("Filed to instantiate %s", principalClass.getName()), e);
+        } catch (IllegalAccessException e) {
+            throw new RuntimeException(String.format("Illegal access to %s", principalClass.getName()), e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/LdapBasicAuthenticator.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/LdapBasicAuthenticator.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/LdapBasicAuthenticator.java
new file mode 100644
index 0000000..59abc52
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/LdapBasicAuthenticator.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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.authentication.authenticator;
+
+import com.google.common.base.Optional;
+import io.dropwizard.auth.AuthenticationException;
+import io.dropwizard.auth.basic.BasicCredentials;
+import org.apache.eagle.common.authentication.User;
+import org.apache.eagle.server.authentication.config.AuthenticationSettings;
+
+public class LdapBasicAuthenticator extends AbstractSwitchableAuthenticator<BasicCredentials, User> {
+    private AuthenticationSettings config = null;
+
+    public LdapBasicAuthenticator(AuthenticationSettings settings) {
+        super(settings, User.class);
+    }
+
+    public Optional<User> authenticate(BasicCredentials credentials) throws AuthenticationException {
+        // TODO need to implement ldap authentication logic
+        boolean pass = true;
+        if (pass) {
+            return Optional.of(new User("ldap.username"));
+        }
+        return Optional.absent();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/SimpleBasicAuthenticator.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/SimpleBasicAuthenticator.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/SimpleBasicAuthenticator.java
new file mode 100644
index 0000000..910bc92
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/SimpleBasicAuthenticator.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.server.authentication.authenticator;
+
+import com.google.common.base.Optional;
+import io.dropwizard.auth.AuthenticationException;
+import io.dropwizard.auth.basic.BasicCredentials;
+import org.apache.eagle.common.authentication.User;
+import org.apache.eagle.server.authentication.config.AuthenticationSettings;
+
+public class SimpleBasicAuthenticator extends AbstractSwitchableAuthenticator<BasicCredentials, User> {
+    private String acceptedUsername = null;
+    private String acceptedPassword = null;
+
+    public SimpleBasicAuthenticator(AuthenticationSettings settings) {
+        super(settings, User.class);
+        acceptedUsername = settings.getSimple().getUsername();
+        acceptedPassword = settings.getSimple().getPassword();
+    }
+
+    public Optional<User> authenticate(BasicCredentials credentials) throws AuthenticationException {
+        String username = credentials.getUsername();
+        if (acceptedUsername.equals(username) && acceptedPassword.equals(credentials.getPassword())) {
+            return Optional.of(new User(username));
+        }
+        return Optional.absent();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/src/main/java/org/apache/eagle/server/authentication/config/AuthenticationSettings.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/config/AuthenticationSettings.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/config/AuthenticationSettings.java
new file mode 100644
index 0000000..642a9c2
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/config/AuthenticationSettings.java
@@ -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.
+ */
+package org.apache.eagle.server.authentication.config;
+
+import io.dropwizard.Configuration;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class AuthenticationSettings extends Configuration {
+    private boolean enabled = false;
+    private String mode = null;
+    private boolean caching = false;
+    private String cachePolicy = null;
+    private boolean authorization = false;
+    private boolean annotated = true;
+    private SimpleSettings simple = new SimpleSettings();
+    private LdapSettings ldap = new LdapSettings();
+
+    @JsonProperty
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    @JsonProperty
+    public AuthenticationSettings setEnabled(boolean enabled) {
+        this.enabled = enabled;
+        return this;
+    }
+
+    @JsonProperty
+    public String getMode() {
+        return mode;
+    }
+
+    @JsonProperty
+    public AuthenticationSettings setMode(String mode) {
+        this.mode = mode;
+        return this;
+    }
+
+    @JsonProperty
+    public boolean needsCaching() {
+        return caching;
+    }
+
+    @JsonProperty
+    public AuthenticationSettings setCaching(boolean caching) {
+        this.caching = caching;
+        return this;
+    }
+
+    @JsonProperty
+    public String getCachePolicy() {
+        return cachePolicy;
+    }
+
+    @JsonProperty
+    public AuthenticationSettings setCachePolicy(String cachePolicy) {
+        this.cachePolicy = cachePolicy;
+        return this;
+    }
+
+    @JsonProperty
+    public boolean needsAuthorization() {
+        return authorization;
+    }
+
+    @JsonProperty
+    public AuthenticationSettings setAuthorization(boolean authorization) {
+        this.authorization = authorization;
+        return this;
+    }
+
+    @JsonProperty
+    public boolean byAnnotated() {
+        return annotated;
+    }
+
+    @JsonProperty
+    public AuthenticationSettings setAnnotated(boolean annotated) {
+        this.annotated = annotated;
+        return this;
+    }
+
+    @JsonProperty("ldap")
+    public LdapSettings getLdap() {
+        return ldap;
+    }
+
+    @JsonProperty("ldap")
+    public AuthenticationSettings setLdap(LdapSettings ldap) {
+        this.ldap = ldap;
+        return this;
+    }
+
+    @JsonProperty("simple")
+    public SimpleSettings getSimple() {
+        return simple;
+    }
+
+    @JsonProperty("simple")
+    public AuthenticationSettings setSimple(SimpleSettings simple) {
+        this.simple = simple;
+        return this;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/src/main/java/org/apache/eagle/server/authentication/config/LdapSettings.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/config/LdapSettings.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/config/LdapSettings.java
new file mode 100644
index 0000000..0d04645
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/config/LdapSettings.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.authentication.config;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class LdapSettings {
+    private String uri = null;
+    private String userFilter = null;
+    private String groupFilter = null;
+    private String userNameAttribute = null;
+    private String groupNameAttribute = null;
+    private String groupMembershipAttribute = null;
+    private String groupClassName = null;
+    private String[] restrictToGroups = null;
+    private String connectTimeout = null;
+    private String readTimeout = null;
+
+    @JsonProperty
+    public String getUri() {
+        return uri;
+    }
+
+    @JsonProperty
+    public LdapSettings setUri(String uri) {
+        this.uri = uri;
+        return this;
+    }
+
+    @JsonProperty
+    public String getUserFilter() {
+        return userFilter;
+    }
+
+    @JsonProperty
+    public LdapSettings setUserFilter(String userFilter) {
+        this.userFilter = userFilter;
+        return this;
+    }
+
+    @JsonProperty
+    public String getGroupFilter() {
+        return groupFilter;
+    }
+
+    @JsonProperty
+    public LdapSettings setGroupFilter(String groupFilter) {
+        this.groupFilter = groupFilter;
+        return this;
+    }
+
+    @JsonProperty
+    public String getUserNameAttribute() {
+        return userNameAttribute;
+    }
+
+    @JsonProperty
+    public LdapSettings setUserNameAttribute(String userNameAttribute) {
+        this.userNameAttribute = userNameAttribute;
+        return this;
+    }
+
+    @JsonProperty
+    public String getGroupNameAttribute() {
+        return groupNameAttribute;
+    }
+
+    @JsonProperty
+    public LdapSettings setGroupNameAttribute(String groupNameAttribute) {
+        this.groupNameAttribute = groupNameAttribute;
+        return this;
+    }
+
+    @JsonProperty
+    public String getGroupMembershipAttribute() {
+        return groupMembershipAttribute;
+    }
+
+    @JsonProperty
+    public LdapSettings setGroupMembershipAttribute(String groupMembershipAttribute) {
+        this.groupMembershipAttribute = groupMembershipAttribute;
+        return this;
+    }
+
+    @JsonProperty
+    public String getGroupClassName() {
+        return groupClassName;
+    }
+
+    @JsonProperty
+    public LdapSettings setGroupClassName(String groupClassName) {
+        this.groupClassName = groupClassName;
+        return this;
+    }
+
+    @JsonProperty
+    public String[] getRestrictToGroups() {
+        return restrictToGroups;
+    }
+
+    @JsonProperty
+    public LdapSettings setRestrictToGroups(String[] restrictToGroups) {
+        this.restrictToGroups = restrictToGroups;
+        return this;
+    }
+
+    @JsonProperty
+    public String getConnectTimeout() {
+        return connectTimeout;
+    }
+
+    @JsonProperty
+    public LdapSettings setConnectTimeout(String connectTimeout) {
+        this.connectTimeout = connectTimeout;
+        return this;
+    }
+
+    @JsonProperty
+    public String getReadTimeout() {
+        return readTimeout;
+    }
+
+    @JsonProperty
+    public LdapSettings setReadTimeout(String readTimeout) {
+        this.readTimeout = readTimeout;
+        return this;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/src/main/java/org/apache/eagle/server/authentication/config/SimpleSettings.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/config/SimpleSettings.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/config/SimpleSettings.java
new file mode 100644
index 0000000..ecdb094
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/config/SimpleSettings.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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.authentication.config;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class SimpleSettings {
+    private String username = null;
+    private String password = null;
+
+    @JsonProperty
+    public String getUsername() {
+        return username;
+    }
+
+    @JsonProperty
+    public SimpleSettings setUsername(String username) {
+        this.username = username;
+        return this;
+    }
+
+    @JsonProperty
+    public String getPassword() {
+        return password;
+    }
+
+    @JsonProperty
+    public SimpleSettings setPassword(String password) {
+        this.password = password;
+        return this;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/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
index f23f9f1..f2ec772 100644
--- a/eagle-server/src/main/resources/application.conf
+++ b/eagle-server/src/main/resources/application.conf
@@ -115,4 +115,4 @@ coordinator {
     initDelayMillis = 1000
     delayMillis = 30000
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/src/main/resources/configuration.yml
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/resources/configuration.yml b/eagle-server/src/main/resources/configuration.yml
index 6dc864d..6090c4f 100644
--- a/eagle-server/src/main/resources/configuration.yml
+++ b/eagle-server/src/main/resources/configuration.yml
@@ -19,4 +19,50 @@ server:
       port: 9090
   adminConnectors:
     - type: http
-      port: 9091
\ No newline at end of file
+      port: 9091
+
+
+# ---------------------------------------------
+# Eagle Authentication Configuration
+# ---------------------------------------------
+auth:
+  # indicating if authentication is enabled, true for enabled, false for disabled
+  enabled: false
+
+  # indicating authentication mode, "simple" or "ldap"
+  mode: simple
+
+  # indicating whether to use cache: cache is usually used for authentications that may
+  # not handle high throughput (an RDBMS or LDAP server, for example)
+  caching: false
+
+  # indicating the cache policy, containing maximumSize and expireAfterWrite, e.g. maximumSize=10000, expireAfterWrite=10m
+  cachePolicy: maximumSize=10000, expireAfterWrite=1m
+
+  # indicating whether authorization is needed
+  authorization: false
+
+  # indicating whether @Auth annotation on parameters is needed
+  annotated: true
+
+  # for basic authentication, effective only when auth.mode=simple
+  simple:
+    # username for basic authentication, effective only when auth.mode=simple
+    username: admin
+    # password for basic authentication, effective only when auth.mode=simple
+    password: secret
+
+  # for ldap authentication, effective only when auth.mode=ldap
+  ldap:
+    uri: ldaps://ldap.server.address:636
+    userFilter: ou=x,dc=y,dc=z
+    groupFilter: ou=x,dc=y,dc=z
+    userNameAttribute: cn
+    groupNameAttribute: cn
+    groupMembershipAttribute: memberUid
+    groupClassName: posixGroup
+    restrictToGroups:
+      - user
+      - admin
+    connectTimeout: 500ms
+    readTimeout: 500ms

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/src/test/java/org/apache/eagle/server/authentication/resource/TestBasicAuthenticationResource.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/test/java/org/apache/eagle/server/authentication/resource/TestBasicAuthenticationResource.java b/eagle-server/src/test/java/org/apache/eagle/server/authentication/resource/TestBasicAuthenticationResource.java
new file mode 100644
index 0000000..0ea6666
--- /dev/null
+++ b/eagle-server/src/test/java/org/apache/eagle/server/authentication/resource/TestBasicAuthenticationResource.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.server.authentication.resource;
+
+import io.dropwizard.auth.Auth;
+import org.apache.eagle.common.authentication.User;
+import org.apache.eagle.metadata.resource.RESTResponse;
+import org.junit.Ignore;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+@Ignore
+@Path("/test")
+public class TestBasicAuthenticationResource {
+    @GET
+    @Path("/ba/simple")
+    @Produces(MediaType.APPLICATION_JSON)
+    public RESTResponse<User> getIt(@Auth User user) {
+        return RESTResponse.<User>builder().data(user).success(true).status(Response.Status.OK).get();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/src/test/resources/configuration.yml
----------------------------------------------------------------------
diff --git a/eagle-server/src/test/resources/configuration.yml b/eagle-server/src/test/resources/configuration.yml
index c671ade..6795aac 100644
--- a/eagle-server/src/test/resources/configuration.yml
+++ b/eagle-server/src/test/resources/configuration.yml
@@ -19,3 +19,48 @@ server:
   adminConnectors:
     - type: http
       port: 9091
+
+# ---------------------------------------------
+# Eagle Authentication Configuration
+# ---------------------------------------------
+auth:
+  # indicating if authentication is enabled, true for enabled, false for disabled
+  enabled: false
+
+  # indicating authentication mode, "simple" or "ldap"
+  mode: simple
+
+  # indicating whether to use cache: cache is usually used for authentications that may
+  # not handle high throughput (an RDBMS or LDAP server, for example)
+  caching: false
+
+  # indicating the cache policy, containing maximumSize and expireAfterWrite, e.g. maximumSize=10000, expireAfterWrite=10m
+  cachePolicy: maximumSize=10000, expireAfterWrite=1m
+
+  # indicating whether authorization is needed
+  authorization: false
+
+  # indicating whether @Auth annotation on parameters is needed
+  annotated: true
+
+  # for basic authentication, effective only when auth.mode=simple
+  simple:
+    # username for basic authentication, effective only when auth.mode=simple
+    username: admin
+    # password for basic authentication, effective only when auth.mode=simple
+    password: secret
+
+  # for ldap authentication, effective only when auth.mode=ldap
+  ldap:
+    uri: ldaps://ldap.server.address:636
+    userFilter: ou=x,dc=y,dc=z
+    groupFilter: ou=x,dc=y,dc=z
+    userNameAttribute: cn
+    groupNameAttribute: cn
+    groupMembershipAttribute: memberUid
+    groupClassName: posixGroup
+    restrictToGroups:
+      - user
+      - admin
+    connectTimeout: 500ms
+    readTimeout: 500ms

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7b61650..6dc1d6c 100755
--- a/pom.xml
+++ b/pom.xml
@@ -307,7 +307,8 @@
         <metrics-elasticsearch-reporter.version>2.2.0</metrics-elasticsearch-reporter.version>
 
         <common.cli.version>1.3.1</common.cli.version>
-        <ullink.slack.version>0.6.0</ullink.slack.version>
+	      <ullink.slack.version>0.6.0</ullink.slack.version>
+        <javax-ws-rs.rs-api.version>2.0.1</javax-ws-rs.rs-api.version>
 
         <!-- dropwizard -->
         <dropwizard.version>0.7.1</dropwizard.version>
@@ -861,6 +862,16 @@
                     </exclusion>
                 </exclusions>
             </dependency>
+            <dependency>
+                <groupId>io.dropwizard</groupId>
+                <artifactId>dropwizard-auth</artifactId>
+                <version>${dropwizard.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>javax.ws.rs</groupId>
+                <artifactId>javax.ws.rs-api</artifactId>
+                <version>${javax-ws-rs.rs-api.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
     <profiles>


[44/50] incubator-eagle git commit: [EAGLE-632] clean up configuration for MR history feeder

Posted by ha...@apache.org.
[EAGLE-632] clean up configuration for MR history feeder

Author: wujinhu <wu...@126.com>

Closes #522 from wujinhu/EAGLE-632.


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

Branch: refs/heads/master
Commit: a781937e978025b708ccc70d47ddaadc18668948
Parents: 3d6a29e
Author: wujinhu <wu...@126.com>
Authored: Tue Oct 18 15:43:44 2016 +0800
Committer: wujinhu <wu...@126.com>
Committed: Tue Oct 18 15:43:44 2016 +0800

----------------------------------------------------------------------
 .../jpm/mr/history/MRHistoryJobApplication.java |  14 +-
 .../jpm/mr/history/MRHistoryJobConfig.java      |  62 +---
 .../crawler/DefaultJHFInputStreamCallback.java  |   2 +-
 .../history/crawler/JHFCrawlerDriverImpl.java   |   6 +-
 .../metrics/JobCountMetricsGenerator.java       |   2 +-
 .../mr/history/parser/JHFEventReaderBase.java   |  20 +-
 .../mr/history/parser/JHFMRVer1EventReader.java | 152 ----------
 .../jpm/mr/history/parser/JHFMRVer1Parser.java  | 283 -------------------
 .../parser/JHFMRVer1PerLineListener.java        |  39 ---
 .../mr/history/parser/JHFMRVer2EventReader.java |   1 -
 .../jpm/mr/history/parser/JHFParserFactory.java |  44 +--
 ...JobConfigurationCreationServiceListener.java |   2 +-
 .../JobEntityCreationEagleServiceListener.java  |   4 +-
 .../parser/TaskAttemptCounterListener.java      |   2 +-
 .../mr/history/parser/TaskFailureListener.java  |   2 +-
 .../jpm/mr/history/storm/JobHistorySpout.java   |  15 +-
 ....history.MRHistoryJobApplicationProvider.xml | 102 ++++---
 .../src/main/resources/application.conf         |  44 +--
 18 files changed, 131 insertions(+), 665 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java
index beec938..de35678 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java
@@ -59,16 +59,12 @@ public class MRHistoryJobApplication extends StormApplication {
         JobHistoryContentFilter filter = builder.build();
         //3. init topology
         TopologyBuilder topologyBuilder = new TopologyBuilder();
-        String spoutName = "mrHistoryJobExecutor";
-        int parallelism = jhfAppConf.getInt("envContextConfig.parallelismConfig." + spoutName);
-        int tasks = jhfAppConf.getInt("envContextConfig.tasks." + spoutName);
-        if (parallelism > tasks) {
-            parallelism = tasks;
-        }
+        String spoutName = "mrHistoryJobSpout";
+        int tasks = jhfAppConf.getInt("stormConfig.mrHistoryJobSpoutTasks");
         topologyBuilder.setSpout(
-            spoutName,
-            new JobHistorySpout(filter, config),
-            parallelism
+                spoutName,
+                new JobHistorySpout(filter, config),
+                tasks
         ).setNumTasks(tasks);
         return topologyBuilder.createTopology();
     }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java
index 37df5ad..561c3d0 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java
@@ -49,18 +49,6 @@ public class MRHistoryJobConfig implements Serializable {
 
     private JobHistoryEndpointConfig jobHistoryEndpointConfig;
 
-    public ControlConfig getControlConfig() {
-        return controlConfig;
-    }
-
-    private ControlConfig controlConfig;
-
-    public JobExtractorConfig getJobExtractorConfig() {
-        return jobExtractorConfig;
-    }
-
-    private JobExtractorConfig jobExtractorConfig;
-
     public EagleServiceConfig getEagleServiceConfig() {
         return eagleServiceConfig;
     }
@@ -79,25 +67,14 @@ public class MRHistoryJobConfig implements Serializable {
         public int zkSessionTimeoutMs;
         public int zkRetryTimes;
         public int zkRetryInterval;
-        public String zkPort;
     }
 
     public static class JobHistoryEndpointConfig implements Serializable {
         public String mrHistoryServerUrl;
         public String basePath;
         public Map<String, String> hdfs;
-    }
-
-    public static class ControlConfig implements Serializable {
-        public Class<? extends JobIdPartitioner> partitionerCls;
-        public boolean zeroBasedMonth;
         public String timeZone;
-    }
-
-    public static class JobExtractorConfig implements Serializable {
         public String site;
-        public String mrVersion;
-        public int readTimeoutSeconds;
     }
 
     public static class EagleServiceConfig implements Serializable {
@@ -105,6 +82,7 @@ public class MRHistoryJobConfig implements Serializable {
         public int eagleServicePort;
         public String username;
         public String password;
+        public int readTimeoutSeconds;
     }
 
     private static MRHistoryJobConfig manager = new MRHistoryJobConfig();
@@ -118,8 +96,6 @@ public class MRHistoryJobConfig implements Serializable {
         this.zkStateConfig = new ZKStateConfig();
         this.jobHistoryEndpointConfig = new JobHistoryEndpointConfig();
         this.jobHistoryEndpointConfig.hdfs = new HashMap<>();
-        this.controlConfig = new ControlConfig();
-        this.jobExtractorConfig = new JobExtractorConfig();
         this.eagleServiceConfig = new EagleServiceConfig();
         this.config = null;
     }
@@ -141,48 +117,34 @@ public class MRHistoryJobConfig implements Serializable {
      */
     private void init(Config config) {
         this.config = config;
-        //parse eagle job extractor
-        this.jobExtractorConfig.site = config.getString("jobExtractorConfig.site");
-        this.jobExtractorConfig.mrVersion = config.getString("jobExtractorConfig.mrVersion");
-        this.jobExtractorConfig.readTimeoutSeconds = config.getInt("jobExtractorConfig.readTimeOutSeconds");
+
         //parse eagle zk
         this.zkStateConfig.zkQuorum = config.getString("zkStateConfig.zkQuorum");
-        this.zkStateConfig.zkPort = config.getString("zkStateConfig.zkPort");
         this.zkStateConfig.zkSessionTimeoutMs = config.getInt("zkStateConfig.zkSessionTimeoutMs");
         this.zkStateConfig.zkRetryTimes = config.getInt("zkStateConfig.zkRetryTimes");
         this.zkStateConfig.zkRetryInterval = config.getInt("zkStateConfig.zkRetryInterval");
         this.zkStateConfig.zkRoot = config.getString("zkStateConfig.zkRoot");
 
         //parse job history endpoint
+        this.jobHistoryEndpointConfig.site = config.getString("siteId");
         this.jobHistoryEndpointConfig.basePath = config.getString("endpointConfig.basePath");
         this.jobHistoryEndpointConfig.mrHistoryServerUrl = config.getString("endpointConfig.mrHistoryServerUrl");
         for (Map.Entry<String, ConfigValue> entry : config.getConfig("endpointConfig.hdfs").entrySet()) {
             this.jobHistoryEndpointConfig.hdfs.put(entry.getKey(), entry.getValue().unwrapped().toString());
         }
-        //parse control config
-        try {
-            this.controlConfig.partitionerCls = (Class<? extends JobIdPartitioner>) Class.forName(config.getString("controlConfig.partitionerCls"));
-            assert this.controlConfig.partitionerCls != null;
-        } catch (Exception e) {
-            LOG.warn("can not initialize partitioner class, use org.apache.eagle.jpm.util.DefaultJobIdPartitioner", e);
-            this.controlConfig.partitionerCls = DefaultJobIdPartitioner.class;
-        } finally {
-            LOG.info("Loaded partitioner class: {}", this.controlConfig.partitionerCls);
-        }
-        this.controlConfig.zeroBasedMonth = config.getBoolean("controlConfig.zeroBasedMonth");
-        this.controlConfig.timeZone = config.getString("controlConfig.timeZone");
+        this.jobHistoryEndpointConfig.timeZone = config.getString("endpointConfig.timeZone");
 
         // parse eagle service endpoint
-        this.eagleServiceConfig.eagleServiceHost = config.getString("eagleProps.eagleService.host");
-        String port = config.getString("eagleProps.eagleService.port");
+        this.eagleServiceConfig.eagleServiceHost = config.getString("eagleService.host");
+        String port = config.getString("eagleService.port");
         this.eagleServiceConfig.eagleServicePort = (port == null ? 8080 : Integer.parseInt(port));
-        this.eagleServiceConfig.username = config.getString("eagleProps.eagleService.username");
-        this.eagleServiceConfig.password = config.getString("eagleProps.eagleService.password");
+        this.eagleServiceConfig.username = config.getString("eagleService.username");
+        this.eagleServiceConfig.password = config.getString("eagleService.password");
+        this.eagleServiceConfig.readTimeoutSeconds = config.getInt("eagleService.readTimeOutSeconds");
 
         LOG.info("Successfully initialized MRHistoryJobConfig");
-        LOG.info("zookeeper.quorum: " + this.zkStateConfig.zkQuorum);
-        LOG.info("zookeeper.property.clientPort: " + this.zkStateConfig.zkPort);
-        LOG.info("eagle.service.host: " + this.eagleServiceConfig.eagleServiceHost);
-        LOG.info("eagle.service.port: " + this.eagleServiceConfig.eagleServicePort);
+        LOG.info("zkStateConfig.zkQuorum: " + this.zkStateConfig.zkQuorum);
+        LOG.info("eagleService.host: " + this.eagleServiceConfig.eagleServiceHost);
+        LOG.info("eagleService.port: " + this.eagleServiceConfig.eagleServicePort);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/DefaultJHFInputStreamCallback.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/DefaultJHFInputStreamCallback.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/DefaultJHFInputStreamCallback.java
index 14b93af..b491857 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/DefaultJHFInputStreamCallback.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/DefaultJHFInputStreamCallback.java
@@ -43,7 +43,7 @@ public class DefaultJHFInputStreamCallback implements JHFInputStreamCallback {
         @SuppressWarnings("serial")
         Map<String, String> baseTags = new HashMap<String, String>() {
             {
-                put("site", MRHistoryJobConfig.get().getJobExtractorConfig().site);
+                put("site", MRHistoryJobConfig.get().getJobHistoryEndpointConfig().site);
             }
         };
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JHFCrawlerDriverImpl.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JHFCrawlerDriverImpl.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JHFCrawlerDriverImpl.java
index a33abeb..ef38b43 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JHFCrawlerDriverImpl.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JHFCrawlerDriverImpl.java
@@ -53,7 +53,6 @@ public class JHFCrawlerDriverImpl implements JHFCrawlerDriver {
 
     private final JobProcessDate processDate = new JobProcessDate();
     private JHFInputStreamCallback reader;
-    protected boolean zeroBasedMonth = true;
 
     private JobHistoryLCM jhfLCM;
     private JobIdFilter jobFilter;
@@ -63,12 +62,11 @@ public class JHFCrawlerDriverImpl implements JHFCrawlerDriver {
 
     public JHFCrawlerDriverImpl(JHFInputStreamCallback reader,
                                 JobHistoryLCM historyLCM, JobIdFilter jobFilter, int partitionId) throws Exception {
-        this.zeroBasedMonth = MRHistoryJobConfig.get().getControlConfig().zeroBasedMonth;
         this.reader = reader;
         jhfLCM = historyLCM;//new JobHistoryDAOImpl(jobHistoryConfig);
         this.partitionId = partitionId;
         this.jobFilter = jobFilter;
-        timeZone = TimeZone.getTimeZone(MRHistoryJobConfig.get().getControlConfig().timeZone);
+        timeZone = TimeZone.getTimeZone(MRHistoryJobConfig.get().getJobHistoryEndpointConfig().timeZone);
         jobCountMetricsGenerator = new JobCountMetricsGenerator(timeZone);
     }
 
@@ -198,7 +196,7 @@ public class JHFCrawlerDriverImpl implements JHFCrawlerDriver {
     }
 
     private int getActualMonth(int month) {
-        return zeroBasedMonth ? processDate.month : processDate.month + 1;
+        return processDate.month + 1;
     }
 
     private static class JobProcessDate {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/metrics/JobCountMetricsGenerator.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/metrics/JobCountMetricsGenerator.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/metrics/JobCountMetricsGenerator.java
index ac4a33d..f74f77a 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/metrics/JobCountMetricsGenerator.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/metrics/JobCountMetricsGenerator.java
@@ -88,7 +88,7 @@ public class JobCountMetricsGenerator {
         @SuppressWarnings("serial")
         Map<String, String> baseTags = new HashMap<String, String>() {
             {
-                put("site", MRHistoryJobConfig.get().getJobExtractorConfig().site);
+                put("site", MRHistoryJobConfig.get().getJobHistoryEndpointConfig().site);
                 put(MRJobTagName.JOB_STATUS.toString(), state);
             }
         };

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFEventReaderBase.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFEventReaderBase.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFEventReaderBase.java
index d452f59..8b35a56 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFEventReaderBase.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFEventReaderBase.java
@@ -18,12 +18,9 @@
 
 package org.apache.eagle.jpm.mr.history.parser;
 
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.apache.commons.lang3.tuple.Pair;
 import org.apache.eagle.jpm.mr.history.MRHistoryJobConfig;
 import org.apache.eagle.jpm.mr.history.crawler.JobHistoryContentFilter;
 import org.apache.eagle.jpm.mr.history.metrics.JobCounterMetricsGenerator;
-import org.apache.eagle.jpm.mr.history.parser.JHFMRVer1Parser.Keys;
 import org.apache.eagle.jpm.mr.historyentity.*;
 import org.apache.eagle.jpm.util.Constants;
 import org.apache.eagle.jpm.util.JobNameNormalization;
@@ -534,4 +531,21 @@ public abstract class JHFEventReaderBase extends JobEntityCreationPublisher impl
         }
         return false;
     }
+
+    public enum Keys {
+        JOBTRACKERID,
+        START_TIME, FINISH_TIME, JOBID, JOBNAME, USER, JOBCONF, SUBMIT_TIME,
+        LAUNCH_TIME, TOTAL_MAPS, TOTAL_REDUCES, FAILED_MAPS, FAILED_REDUCES,
+        FINISHED_MAPS, FINISHED_REDUCES, JOB_STATUS, TASKID, HOSTNAME, TASK_TYPE,
+        ERROR, TASK_ATTEMPT_ID, TASK_STATUS, COPY_PHASE, SORT_PHASE, REDUCE_PHASE,
+        SHUFFLE_FINISHED, SORT_FINISHED, COUNTERS, SPLITS, JOB_PRIORITY, HTTP_PORT,
+        TRACKER_NAME, STATE_STRING, VERSION, MAP_COUNTERS, REDUCE_COUNTERS,
+        VIEW_JOB, MODIFY_JOB, JOB_QUEUE, RACK,
+
+        UBERISED, SPLIT_LOCATIONS, FAILED_DUE_TO_ATTEMPT, MAP_FINISH_TIME, PORT, RACK_NAME,
+
+        //For Artemis
+        WORKFLOW_ID, WORKFLOW_NAME, WORKFLOW_NODE_NAME, WORKFLOW_ADJACENCIES, WORKFLOW_TAGS,
+        SHUFFLE_PORT, LOCALITY, AVATAAR, FAIL_REASON
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer1EventReader.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer1EventReader.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer1EventReader.java
deleted file mode 100644
index e20836f..0000000
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer1EventReader.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-package org.apache.eagle.jpm.mr.history.parser;
-
-import org.apache.eagle.jpm.mr.history.crawler.JobHistoryContentFilter;
-import org.apache.eagle.jpm.mr.history.parser.JHFMRVer1Parser.Keys;
-import org.apache.eagle.jpm.mr.historyentity.JobExecutionAPIEntity;
-import org.apache.eagle.jpm.util.jobcounter.JobCounters;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.mapreduce.Counter;
-import org.apache.hadoop.mapreduce.CounterGroup;
-import org.apache.hadoop.mapreduce.Counters;
-import org.apache.hadoop.mapreduce.util.CountersStrings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * Listener holds all informations related to one whole job history file, so it's stateful and does not support multithreading.
- */
-public class JHFMRVer1EventReader extends JHFEventReaderBase implements JHFMRVer1PerLineListener {
-    private static final Logger logger = LoggerFactory.getLogger(JHFMRVer1EventReader.class);
-
-    /**
-     * baseTags stores the basic tag name values which might be used for persisting various entities.
-     * baseTags includes: cluster, datacenter and jobName
-     * baseTags are used for all job/task related entities
-     *
-     * @param baseTags
-     */
-    public JHFMRVer1EventReader(Map<String, String> baseTags, Configuration configuration, JobHistoryContentFilter filter) {
-        super(baseTags, configuration, filter);
-    }
-
-    @Override
-    public void handle(RecordTypes recType, Map<Keys, String> values)
-        throws Exception {
-        switch (recType) {
-            case Job:
-                handleJob(null, values, values.get(Keys.COUNTERS));
-                break;
-            case Task:
-                handleTask(RecordTypes.Task, null, values, values.get(Keys.COUNTERS));
-                break;
-            case MapAttempt:
-                ensureRackHostnameAfterAttemptFinish(values);
-                handleTask(RecordTypes.MapAttempt, null, values, values.get(Keys.COUNTERS));
-                break;
-            case ReduceAttempt:
-                ensureRackHostnameAfterAttemptFinish(values);
-                handleTask(RecordTypes.ReduceAttempt, null, values, values.get(Keys.COUNTERS));
-                break;
-            default:
-                // skip other types
-                ;
-        }
-    }
-
-    private void ensureRackHostnameAfterAttemptFinish(Map<Keys, String> values) {
-        // only care about attempt finish
-        if (values.get(Keys.FINISH_TIME) == null) {
-            return;
-        }
-        String hostname = null;
-        String rack = null;
-        // we get rack/hostname based on task's status
-        if (values.get(Keys.TASK_STATUS).equals(EagleTaskStatus.SUCCESS.name())) {
-            // in CDH4.1.4, the hostname has the format of /default/rack128/some.server.address
-            // if not specified, the hostname has the format  of /default-rack/<hostname>
-            String decoratedHostname = values.get(Keys.HOSTNAME);
-            String[] tmp = decoratedHostname.split("/");
-            hostname = tmp[tmp.length - 1];
-            rack = tmp[tmp.length - 2];
-            host2RackMapping.put(hostname, rack);
-        } else if (values.get(Keys.TASK_STATUS).equals(EagleTaskStatus.KILLED.name()) || values.get(Keys.TASK_STATUS).equals(EagleTaskStatus.FAILED.name())) {
-            hostname = values.get(Keys.HOSTNAME);
-            // make every effort to get RACK information
-            hostname = (hostname == null) ? "" : hostname;
-            rack = host2RackMapping.get(hostname);
-        }
-
-        values.put(Keys.HOSTNAME, hostname);
-        values.put(Keys.RACK, rack);
-    }
-
-    @Override
-    protected JobCounters parseCounters(Object value) throws IOException {
-        JobCounters jc = new JobCounters();
-        Map<String, Map<String, Long>> groups = new HashMap<String, Map<String, Long>>();
-        Counters counters = new Counters();
-        try {
-            CountersStrings.parseEscapedCompactString((String) value, counters);
-        } catch (Exception ex) {
-            logger.error("can not parse job history", ex);
-            throw new IOException(ex);
-        }
-        Iterator<CounterGroup> it = counters.iterator();
-        while (it.hasNext()) {
-            CounterGroup cg = it.next();
-
-            // hardcoded to exclude business level counters
-            if (!cg.getName().equals("org.apache.hadoop.mapreduce.FileSystemCounter")
-                && !cg.getName().equals("org.apache.hadoop.mapreduce.TaskCounter")
-                && !cg.getName().equals("org.apache.hadoop.mapreduce.JobCounter")
-                && !cg.getName().equals("org.apache.hadoop.mapreduce.lib.input.FileInputFormatCounter")
-                && !cg.getName().equals("org.apache.hadoop.mapreduce.lib.output.FileOutputFormatCounter")
-                && !cg.getName().equals("FileSystemCounters")                                      // for artemis
-                && !cg.getName().equals("org.apache.hadoop.mapred.Task$Counter")                   // for artemis
-                && !cg.getName().equals("org.apache.hadoop.mapreduce.lib.input.FileInputFormat$Counter")  // for artemis
-                && !cg.getName().equals("org.apache.hadoop.mapreduce.lib.input.FileOutputFormat$Counter")
-                ) {
-                continue;
-            }
-
-            groups.put(cg.getName(), new HashMap<String, Long>());
-            Map<String, Long> counterValues = groups.get(cg.getName());
-            logger.debug("groupname:" + cg.getName() + "(" + cg.getDisplayName() + ")");
-            Iterator<Counter> iterCounter = cg.iterator();
-            while (iterCounter.hasNext()) {
-                Counter c = iterCounter.next();
-                counterValues.put(c.getName(), c.getValue());
-                logger.debug(c.getName() + "=" + c.getValue() + "(" + c.getDisplayName() + ")");
-            }
-        }
-        jc.setCounters(groups);
-        return jc;
-    }
-
-    public JobExecutionAPIEntity jobExecution() {
-        return jobExecutionEntity;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer1Parser.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer1Parser.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer1Parser.java
deleted file mode 100644
index 2f63703..0000000
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer1Parser.java
+++ /dev/null
@@ -1,283 +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.jpm.mr.history.parser;
-
-import org.apache.hadoop.util.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.text.ParseException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-
-public class JHFMRVer1Parser implements JHFParserBase {
-    private static final Logger logger = LoggerFactory.getLogger(JHFMRVer1Parser.class);
-    static final char LINE_DELIMITER_CHAR = '.';
-    static final char[] charsToEscape = new char[] {'"', '=', LINE_DELIMITER_CHAR};
-    static final String KEY = "(\\w+)";
-    // value is any character other than quote, but escaped quotes can be there
-    static final String VALUE = "[^\"\\\\]*+(?:\\\\.[^\"\\\\]*+)*+";
-    static final Pattern pattern = Pattern.compile(KEY + "=" + "\"" + VALUE + "\"");
-    static final String MAX_COUNTER_COUNT = "10000";
-
-    private JHFMRVer1EventReader reader;
-
-    public JHFMRVer1Parser(JHFMRVer1EventReader reader) {
-        this.reader = reader;
-    }
-
-    /**
-     * Parses history file and invokes Listener.handle() for
-     * each line of history. It can be used for looking through history
-     * files for specific items without having to keep whole history in memory.
-     *
-     * @throws IOException
-     */
-    @Override
-    public void parse(InputStream in) throws Exception, ParseException {
-        // set enough counter number as user may build more counters
-        System.setProperty("mapreduce.job.counters.max", MAX_COUNTER_COUNT);
-        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
-        try {
-            String line = null;
-            StringBuffer buf = new StringBuffer();
-
-            // Read the meta-info line. Note that this might be a jobinfo line for files written with older format
-            line = reader.readLine();
-
-            // Check if the file is empty
-            if (line == null) {
-                return;
-            }
-
-            // Get the information required for further processing
-            MetaInfoManager mgr = new MetaInfoManager(line);
-            boolean isEscaped = mgr.isValueEscaped();
-            String lineDelim = String.valueOf(mgr.getLineDelim());
-            String escapedLineDelim = StringUtils.escapeString(lineDelim, StringUtils.ESCAPE_CHAR, mgr.getLineDelim());
-
-            do {
-                buf.append(line);
-                if (!line.trim().endsWith(lineDelim) || line.trim().endsWith(escapedLineDelim)) {
-                    buf.append("\n");
-                    continue;
-                }
-                parseLine(buf.toString(), this.reader, isEscaped);
-                buf = new StringBuffer();
-            }
-            while ((line = reader.readLine()) != null);
-
-            // flush to tell listener that we have finished parsing
-            logger.info("finish parsing job history file and close");
-            this.reader.close();
-        } catch (Exception ex) {
-            logger.error("can not parse correctly ", ex);
-            throw ex;
-        } finally {
-            if (reader != null) {
-                reader.close();
-            }
-        }
-    }
-
-    private static void parseLine(String line, JHFMRVer1PerLineListener l, boolean isEscaped) throws Exception, ParseException {
-        // extract the record type
-        int idx = line.indexOf(' ');
-        String recType = line.substring(0, idx);
-        String data = line.substring(idx + 1, line.length());
-
-        Matcher matcher = pattern.matcher(data);
-        Map<Keys, String> parseBuffer = new HashMap<Keys, String>();
-
-        while (matcher.find()) {
-            String tuple = matcher.group(0);
-            String[] parts = StringUtils.split(tuple, StringUtils.ESCAPE_CHAR, '=');
-            String value = parts[1].substring(1, parts[1].length() - 1);
-            if (isEscaped) {
-                value = StringUtils.unEscapeString(value, StringUtils.ESCAPE_CHAR, charsToEscape);
-            }
-            parseBuffer.put(Keys.valueOf(parts[0]), value);
-        }
-
-        try {
-            l.handle(RecordTypes.valueOf(recType), parseBuffer);
-        } catch (IllegalArgumentException ex) {
-            // somehow record type does not exist, but continue to run
-            logger.warn("record type does not exist " + recType, ex);
-        }
-
-        parseBuffer.clear();
-    }
-
-    /**
-     * Manages job-history's meta information such as version etc.
-     * Helps in logging version information to the job-history and recover
-     * version information from the history.
-     */
-    static class MetaInfoManager implements JHFMRVer1PerLineListener {
-        private long version = 0L;
-        private KeyValuePair pairs = new KeyValuePair();
-
-        public void close() {
-        }
-
-        // Extract the version of the history that was used to write the history
-        public MetaInfoManager(String line) throws Exception, ParseException {
-            if (null != line) {
-                // Parse the line
-                parseLine(line, this, false);
-            }
-        }
-
-        // Get the line delimiter
-        char getLineDelim() {
-            if (version == 0) {
-                return '"';
-            } else {
-                return LINE_DELIMITER_CHAR;
-            }
-        }
-
-        // Checks if the values are escaped or not
-        boolean isValueEscaped() {
-            // Note that the values are not escaped in version 0
-            return version != 0;
-        }
-
-        public void handle(RecordTypes recType, Map<Keys, String> values) throws IOException {
-            // Check if the record is of type META
-            if (RecordTypes.Meta == recType) {
-                pairs.handle(values);
-                version = pairs.getLong(Keys.VERSION); // defaults to 0
-            }
-        }
-    }
-
-    /**
-     * Base class contais utility stuff to manage types key value pairs with enums.
-     */
-    static class KeyValuePair {
-        private Map<Keys, String> values = new HashMap<Keys, String>();
-
-        /**
-         * Get 'String' value for given key. Most of the places use Strings as
-         * values so the default get' method returns 'String'.  This method never returns
-         * null to ease on GUIs. if no value is found it returns empty string ""
-         *
-         * @param k
-         * @return if null it returns empty string - ""
-         */
-        public String get(Keys k) {
-            String s = values.get(k);
-            return s == null ? "" : s;
-        }
-
-        /**
-         * Convert value from history to int and return.
-         * if no value is found it returns 0.
-         *
-         * @param k key
-         */
-        public int getInt(Keys k) {
-            String s = values.get(k);
-            if (null != s) {
-                return Integer.parseInt(s);
-            }
-            return 0;
-        }
-
-        /**
-         * Convert value from history to int and return.
-         * if no value is found it returns 0.
-         *
-         * @param k
-         */
-        public long getLong(Keys k) {
-            String s = values.get(k);
-            if (null != s) {
-                return Long.parseLong(s);
-            }
-            return 0;
-        }
-
-        /**
-         * Set value for the key.
-         *
-         * @param k
-         * @param s
-         */
-        public void set(Keys k, String s) {
-            values.put(k, s);
-        }
-
-        /**
-         * Adds all values in the Map argument to its own values.
-         *
-         * @param m
-         */
-        public void set(Map<Keys, String> m) {
-            values.putAll(m);
-        }
-
-        /**
-         * Reads values back from the history, input is same Map as passed to Listener by parseHistory().
-         *
-         * @param values
-         */
-        public synchronized void handle(Map<Keys, String> values) {
-            set(values);
-        }
-
-        /**
-         * Returns Map containing all key-values.
-         */
-        public Map<Keys, String> getValues() {
-            return values;
-        }
-    }
-
-    /**
-     * Job history files contain key="value" pairs, where keys belong to this enum.
-     * It acts as a global namespace for all keys.
-     */
-    public static enum Keys {
-        JOBTRACKERID,
-        START_TIME, FINISH_TIME, JOBID, JOBNAME, USER, JOBCONF, SUBMIT_TIME,
-        LAUNCH_TIME, TOTAL_MAPS, TOTAL_REDUCES, FAILED_MAPS, FAILED_REDUCES,
-        FINISHED_MAPS, FINISHED_REDUCES, JOB_STATUS, TASKID, HOSTNAME, TASK_TYPE,
-        ERROR, TASK_ATTEMPT_ID, TASK_STATUS, COPY_PHASE, SORT_PHASE, REDUCE_PHASE,
-        SHUFFLE_FINISHED, SORT_FINISHED, COUNTERS, SPLITS, JOB_PRIORITY, HTTP_PORT,
-        TRACKER_NAME, STATE_STRING, VERSION, MAP_COUNTERS, REDUCE_COUNTERS,
-        VIEW_JOB, MODIFY_JOB, JOB_QUEUE, RACK,
-
-        UBERISED, SPLIT_LOCATIONS, FAILED_DUE_TO_ATTEMPT, MAP_FINISH_TIME, PORT, RACK_NAME,
-
-        //For Artemis
-        WORKFLOW_ID, WORKFLOW_NAME, WORKFLOW_NODE_NAME, WORKFLOW_ADJACENCIES, WORKFLOW_TAGS,
-        SHUFFLE_PORT, LOCALITY, AVATAAR, FAIL_REASON
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer1PerLineListener.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer1PerLineListener.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer1PerLineListener.java
deleted file mode 100644
index 5d48d5d..0000000
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer1PerLineListener.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.jpm.mr.history.parser;
-
-import org.apache.eagle.jpm.mr.history.parser.JHFMRVer1Parser.Keys;
-
-import java.io.IOException;
-import java.util.Map;
-
-/**
- * Callback interface for reading back log events from JobHistory. This interface
- * should be implemented and passed to JobHistory.parseHistory()
- */
-public interface JHFMRVer1PerLineListener {
-    /**
-     * Callback method for history parser.
-     *
-     * @param recType type of record, which is the first entry in the line.
-     * @param values  a map of key-value pairs as thry appear in history.
-     * @throws IOException
-     */
-    void handle(RecordTypes recType, Map<Keys, String> values) throws Exception;
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer2EventReader.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer2EventReader.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer2EventReader.java
index 0919aa0..5324c02 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer2EventReader.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFMRVer2EventReader.java
@@ -19,7 +19,6 @@
 package org.apache.eagle.jpm.mr.history.parser;
 
 import org.apache.eagle.jpm.mr.history.crawler.JobHistoryContentFilter;
-import org.apache.eagle.jpm.mr.history.parser.JHFMRVer1Parser.Keys;
 import org.apache.eagle.jpm.util.jobcounter.JobCounters;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFParserFactory.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFParserFactory.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFParserFactory.java
index 56fd956..fee9394 100755
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFParserFactory.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JHFParserFactory.java
@@ -18,7 +18,6 @@
 
 package org.apache.eagle.jpm.mr.history.parser;
 
-import org.apache.eagle.jpm.mr.history.MRHistoryJobConfig;
 import org.apache.eagle.jpm.mr.history.crawler.JobHistoryContentFilter;
 import org.apache.hadoop.conf.Configuration;
 import org.slf4j.Logger;
@@ -31,41 +30,14 @@ public class JHFParserFactory {
     private static final Logger LOG = LoggerFactory.getLogger(JHFParserFactory.class);
 
     public static JHFParserBase getParser(Map<String, String> baseTags, Configuration configuration, JobHistoryContentFilter filter) {
-        String format = MRHistoryJobConfig.get().getJobExtractorConfig().mrVersion;
-        JHFParserBase parser;
-        JHFFormat f;
-        try {
-            if (format == null) {
-                f = JHFFormat.MRVer1;
-            } else {
-                f = JHFFormat.valueOf(format);
-            }
-        } catch (IllegalArgumentException ex) {
-            f = JHFFormat.MRVer1; // fall back to version 1 unless it's specified as version 2
-        }
-
-        switch (f) {
-            case MRVer2:
-                JHFMRVer2EventReader reader2 = new JHFMRVer2EventReader(baseTags, configuration, filter);
-                reader2.addListener(new JobEntityCreationEagleServiceListener());
-                reader2.addListener(new TaskFailureListener());
-                reader2.addListener(new TaskAttemptCounterListener());
-                reader2.addListener(new JobConfigurationCreationServiceListener());
-
-                reader2.register(new JobEntityLifecycleAggregator());
-                parser = new JHFMRVer2Parser(reader2);
-                break;
-            case MRVer1:
-            default:
-                JHFMRVer1EventReader reader1 = new JHFMRVer1EventReader(baseTags, configuration, filter);
-                reader1.addListener(new JobEntityCreationEagleServiceListener());
-                reader1.addListener(new TaskFailureListener());
-                reader1.addListener(new TaskAttemptCounterListener());
-
-                reader1.register(new JobEntityLifecycleAggregator());
-                parser = new JHFMRVer1Parser(reader1);
-                break;
-        }
+        JHFMRVer2EventReader reader2 = new JHFMRVer2EventReader(baseTags, configuration, filter);
+        reader2.addListener(new JobEntityCreationEagleServiceListener());
+        reader2.addListener(new TaskFailureListener());
+        reader2.addListener(new TaskAttemptCounterListener());
+        reader2.addListener(new JobConfigurationCreationServiceListener());
+
+        reader2.register(new JobEntityLifecycleAggregator());
+        JHFParserBase parser = new JHFMRVer2Parser(reader2);
         return parser;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JobConfigurationCreationServiceListener.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JobConfigurationCreationServiceListener.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JobConfigurationCreationServiceListener.java
index bf93432..28020b0 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JobConfigurationCreationServiceListener.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JobConfigurationCreationServiceListener.java
@@ -59,7 +59,7 @@ public class JobConfigurationCreationServiceListener implements HistoryJobEntity
             MRHistoryJobConfig.get().getEagleServiceConfig().username,
             MRHistoryJobConfig.get().getEagleServiceConfig().password);
 
-        client.getJerseyClient().setReadTimeout(MRHistoryJobConfig.get().getJobExtractorConfig().readTimeoutSeconds * 1000);
+        client.getJerseyClient().setReadTimeout(MRHistoryJobConfig.get().getEagleServiceConfig().readTimeoutSeconds * 1000);
         List<JobConfigurationAPIEntity> list = new ArrayList<>();
         list.add(jobConfigurationEntity);
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JobEntityCreationEagleServiceListener.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JobEntityCreationEagleServiceListener.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JobEntityCreationEagleServiceListener.java
index 74368a5..67cfb71 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JobEntityCreationEagleServiceListener.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/JobEntityCreationEagleServiceListener.java
@@ -56,7 +56,7 @@ public class JobEntityCreationEagleServiceListener implements HistoryJobEntityCr
             throw new IllegalArgumentException("batchSize must be greater than 0 when it is provided");
         }
         this.batchSize = batchSize;
-        timeZone = TimeZone.getTimeZone(MRHistoryJobConfig.get().getControlConfig().timeZone);
+        timeZone = TimeZone.getTimeZone(MRHistoryJobConfig.get().getJobHistoryEndpointConfig().timeZone);
     }
 
     @Override
@@ -88,7 +88,7 @@ public class JobEntityCreationEagleServiceListener implements HistoryJobEntityCr
             MRHistoryJobConfig.get().getEagleServiceConfig().username,
             MRHistoryJobConfig.get().getEagleServiceConfig().password);
 
-        client.getJerseyClient().setReadTimeout(MRHistoryJobConfig.get().getJobExtractorConfig().readTimeoutSeconds * 1000);
+        client.getJerseyClient().setReadTimeout(MRHistoryJobConfig.get().getEagleServiceConfig().readTimeoutSeconds * 1000);
         logger.info("start flushing entities of total number " + list.size());
         List<GenericMetricEntity> metricEntities = new ArrayList<>();
         for (int i = 0; i < list.size(); i++) {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/TaskAttemptCounterListener.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/TaskAttemptCounterListener.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/TaskAttemptCounterListener.java
index ef7c8e9..e663b29 100755
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/TaskAttemptCounterListener.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/TaskAttemptCounterListener.java
@@ -116,7 +116,7 @@ public class TaskAttemptCounterListener implements HistoryJobEntityCreationListe
             MRHistoryJobConfig.get().getEagleServiceConfig().username,
             MRHistoryJobConfig.get().getEagleServiceConfig().password);
 
-        client.getJerseyClient().setReadTimeout(MRHistoryJobConfig.get().getJobExtractorConfig().readTimeoutSeconds * 1000);
+        client.getJerseyClient().setReadTimeout(MRHistoryJobConfig.get().getEagleServiceConfig().readTimeoutSeconds * 1000);
         List<TaskAttemptCounterAPIEntity> list = new ArrayList<>();
         logger.info("start flushing TaskAttemptCounter entities of total number " + counters.size());
         // create entity

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/TaskFailureListener.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/TaskFailureListener.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/TaskFailureListener.java
index 0c18133..ef62a6c 100755
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/TaskFailureListener.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/parser/TaskFailureListener.java
@@ -114,7 +114,7 @@ public class TaskFailureListener implements HistoryJobEntityCreationListener {
             MRHistoryJobConfig.get().getEagleServiceConfig().username,
             MRHistoryJobConfig.get().getEagleServiceConfig().password);
 
-        client.getJerseyClient().setReadTimeout(MRHistoryJobConfig.get().getJobExtractorConfig().readTimeoutSeconds * 1000);
+        client.getJerseyClient().setReadTimeout(MRHistoryJobConfig.get().getEagleServiceConfig().readTimeoutSeconds * 1000);
 
         int tried = 0;
         while (tried <= MAX_RETRY_TIMES) {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/storm/JobHistorySpout.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/storm/JobHistorySpout.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/storm/JobHistorySpout.java
index 8ad3284..88cd100 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/storm/JobHistorySpout.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/storm/JobHistorySpout.java
@@ -22,6 +22,7 @@ import org.apache.eagle.jpm.mr.history.MRHistoryJobConfig;
 import org.apache.eagle.jpm.mr.history.crawler.*;
 import org.apache.eagle.jpm.mr.history.zkres.JobHistoryZKStateManager;
 import org.apache.eagle.jpm.mr.historyentity.JobProcessTimeStampEntity;
+import org.apache.eagle.jpm.util.DefaultJobIdPartitioner;
 import org.apache.eagle.jpm.util.JobIdFilter;
 import org.apache.eagle.jpm.util.JobIdFilterByPartition;
 import org.apache.eagle.jpm.util.JobIdPartitioner;
@@ -134,15 +135,7 @@ public class JobHistorySpout extends BaseRichSpout {
             throw new IllegalStateException("partitionId should be less than numTotalPartitions with partitionId "
                 + partitionId + " and numTotalPartitions " + numTotalPartitions);
         }
-        Class<? extends JobIdPartitioner> partitionerCls = MRHistoryJobConfig.get().getControlConfig().partitionerCls;
-        JobIdPartitioner partitioner;
-        try {
-            partitioner = partitionerCls.newInstance();
-        } catch (Exception e) {
-            LOG.error("failing instantiating job partitioner class " + partitionerCls, e);
-            throw new IllegalStateException(e);
-        }
-        JobIdFilter jobIdFilter = new JobIdFilterByPartition(partitioner, numTotalPartitions, partitionId);
+        JobIdFilter jobIdFilter = new JobIdFilterByPartition(new DefaultJobIdPartitioner(), numTotalPartitions, partitionId);
         JobHistoryZKStateManager.instance().init(MRHistoryJobConfig.get().getZkStateConfig());
         JobHistoryZKStateManager.instance().ensureJobPartitions(numTotalPartitions);
         interceptor.setSpoutOutputCollector(collector);
@@ -232,7 +225,7 @@ public class JobHistorySpout extends BaseRichSpout {
         LOG.info("update process time stamp {}", minTimeStamp);
         Map<String, String> baseTags = new HashMap<String, String>() {
             {
-                put("site", MRHistoryJobConfig.get().getJobExtractorConfig().site);
+                put("site", MRHistoryJobConfig.get().getJobHistoryEndpointConfig().site);
             }
         };
         JobProcessTimeStampEntity entity = new JobProcessTimeStampEntity();
@@ -246,7 +239,7 @@ public class JobHistorySpout extends BaseRichSpout {
             MRHistoryJobConfig.get().getEagleServiceConfig().username,
             MRHistoryJobConfig.get().getEagleServiceConfig().password);
 
-        client.getJerseyClient().setReadTimeout(MRHistoryJobConfig.get().getJobExtractorConfig().readTimeoutSeconds * 1000);
+        client.getJerseyClient().setReadTimeout(MRHistoryJobConfig.get().getEagleServiceConfig().readTimeoutSeconds * 1000);
 
         List<JobProcessTimeStampEntity> entities = new ArrayList<>();
         entities.add(entity);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml b/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
index 66111eb..9835411 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
@@ -23,81 +23,87 @@
     <configuration>
         <!-- org.apache.eagle.jpm.mr.history.MRHistoryJobConfig -->
         <property>
-            <name>jobExtractorConfig.site</name>
-            <displayName>Site ID</displayName>
-            <value>sandbox</value>
-        </property>
-        <property>
             <name>workers</name>
-            <displayName>storm worker number</displayName>
-            <value>4</value>
-        </property>
-        <property>
-            <name>envContextConfig.parallelismConfig.mrHistoryJobExecutor</name>
+            <displayName>Worker Number</displayName>
+            <description>the number of storm workers will be used</description>
             <value>4</value>
         </property>
         <property>
-            <name>envContextConfig.tasks.mrHistoryJobExecutor</name>
+            <name>stormConfig.mrHistoryJobSpoutTasks</name>
+            <displayName>Read Task Number</displayName>
+            <description>the number tasks of the spout will be assigned</description>
             <value>4</value>
         </property>
-        <property>
-            <name>jobExtractorConfig.mrVersion</name>
-            <value>MRVer2</value>
-        </property>
-        <property>
-            <name>jobExtractorConfig.readTimeOutSeconds</name>
-            <value>60</value>
-        </property>
+
         <property>
             <name>zkStateConfig.zkQuorum</name>
+            <displayName>Zookeeper Servers</displayName>
+            <description>list of zookeeper servers to connect to</description>
             <value>sandbox.hortonworks.com:2181</value>
-        </property>
-        <property>
-            <name>zkStateConfig.zkPort</name>
-            <value>2181</value>
+            <required>true</required>
         </property>
         <property>
             <name>zkStateConfig.zkRoot</name>
+            <displayName>Zookeeper Root Path</displayName>
+            <description>zkRoot that used to save context for this application</description>
             <value>/mrjobhistory_sandbox</value>
+            <required>true</required>
         </property>
         <property>
             <name>zkStateConfig.zkSessionTimeoutMs</name>
+            <displayName>Zookeeper Session Timeout</displayName>
+            <description>session timeout</description>
             <value>15000</value>
+            <required>true</required>
         </property>
         <property>
             <name>zkStateConfig.zkRetryTimes</name>
+            <displayName>Zookeeper Retry Times</displayName>
+            <description>retry policy to use - retry times</description>
             <value>3</value>
+            <required>true</required>
         </property>
         <property>
             <name>zkStateConfig.zkRetryInterval</name>
+            <displayName>Zookeeper Retry Interval</displayName>
+            <description>retry policy to use - retry interval</description>
             <value>20000</value>
+            <required>true</required>
         </property>
+
         <property>
-            <name>controlConfig.zeroBasedMonth</name>
-            <value>false</value>
-        </property>
-        <property>
-            <name>controlConfig.partitionerCls</name>
-            <value>org.apache.eagle.jpm.util.DefaultJobIdPartitioner</value>
-        </property>
-        <property>
-            <name>controlConfig.timeZone</name>
+            <name>endpointConfig.timeZone</name>
+            <displayName>Time Zone</displayName>
+            <description>which time zone do hdfs data nodes locate in</description>
             <value>Etc/GMT+7</value>
+            <required>true</required>
         </property>
         <property>
             <name>endpointConfig.mrHistoryServerUrl</name>
+            <displayName>Map Reduce History Server</displayName>
+            <description>map reduce history server url address</description>
             <value>http://sandbox.hortonworks.com:19888</value>
+            <required>true</required>
         </property>
         <property>
             <name>endpointConfig.basePath</name>
+            <displayName>Map Reduce History Log File Path</displayName>
+            <description>which directory do map reduce history job files locate in</description>
             <value>/mr-history/done</value>
+            <required>true</required>
         </property>
         <property>
             <name>endpointConfig.hdfs.fs.defaultFS</name>
+            <displayName>HDFS Address</displayName>
+            <description>The name of the default file system.  Either the literal string "local" or a host:port for NDFS</description>
             <value>hdfs://sandbox.hortonworks.com:8020</value>
+            <required>true</required>
         </property>
+
         <property>
             <name>MRConfigureKeys.jobConfigKey</name>
+            <displayName>Map Reduce Extracted Configuration Keys</displayName>
+            <description>which configures will be extracted from map reduce job configurations</description>
             <value>mapreduce.map.output.compress,
                 mapreduce.map.output.compress.codec,
                 mapreduce.output.fileoutputformat.compress,
@@ -112,27 +118,43 @@
         </property>
         <property>
             <name>MRConfigureKeys.jobNameKey</name>
+            <displayName>Map Reduce Job Name Key</displayName>
+            <description>User use -Dkey=value to specify name of a job when submit. use this to extract job name from job configuration</description>
             <value>eagle.job.name</value>
         </property>
         <property>
-            <name>eagleProps.eagleService.host</name>
-            <description>eagleProps.eagleService.host</description>
+            <name>eagleService.host</name>
+            <displayName>Eagle Server Host</displayName>
+            <description>eagle server host</description>
             <value>sandbox.hortonworks.com</value>
+            <required>true</required>
         </property>
         <property>
-            <name>eagleProps.eagleService.port</name>
-            <description>eagleProps.eagleService.port</description>
+            <name>eagleService.port</name>
+            <displayName>Eagle Server Port</displayName>
+            <description>eagle server port</description>
             <value>9099</value>
+            <required>true</required>
         </property>
         <property>
-            <name>eagleProps.eagleService.username</name>
-            <description>eagleProps.eagleService.username</description>
+            <name>eagleService.username</name>
+            <displayName>Eagle Server UserName</displayName>
+            <description>eagle server username used to login</description>
             <value>admin</value>
+            <required>true</required>
         </property>
         <property>
-            <name>eagleProps.eagleService.password</name>
-            <description>eagleProps.eagleService.password</description>
+            <name>eagleService.password</name>
+            <displayName>Eagle Server Password</displayName>
+            <description>eagle server password used to login</description>
             <value>secret</value>
+            <required>true</required>
+        </property>
+        <property>
+            <name>eagleService.readTimeOutSeconds</name>
+            <displayName>Eagle Server Read TimeOut(seconds)</displayName>
+            <description>eagle server read time out(seconds)</description>
+            <value>60</value>
         </property>
     </configuration>
     <docs>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a781937e/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf b/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf
index fa53dfb..3f84f0a 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf
@@ -14,37 +14,26 @@
 # limitations under the License.
 
 {
-  "envContextConfig" : {
-    "parallelismConfig" : {
-      "mrHistoryJobExecutor" : 6
-    },
-    "tasks" : {
-      "mrHistoryJobExecutor" : 6
-    }
-  },
+  "appId":"mrHistoryJob",
+  "mode":"LOCAL",
+  "workers" : 3,
+  "siteId" : "sandbox",
+  application.storm.nimbusHost=localhost
 
-  "jobExtractorConfig" : {
-    "site" : "sandbox",
-    "mrVersion": "MRVer2",
-    "readTimeOutSeconds" : 10
+  "stormConfig" : {
+    "mrHistoryJobSpoutTasks" : 6,
   },
 
   "zkStateConfig" : {
     "zkQuorum" : "sandbox.hortonworks.com:2181",
-    "zkPort" : "2181",
     "zkRoot" : "/test_mrjobhistory",
     "zkSessionTimeoutMs" : 15000,
     "zkRetryTimes" : 3,
     "zkRetryInterval" : 20000
   },
 
-  "controlConfig" : {
-    "zeroBasedMonth" : false,
-    "partitionerCls" : "org.apache.eagle.jpm.util.DefaultJobIdPartitioner",
-    "timeZone" : "UTC"
-  },
-
   "endpointConfig" : {
+    "timeZone" : "UTC",
     "mrHistoryServerUrl" : "http://sandbox.hortonworks.com:19888",
     "basePath" : "/mr-history/done",
     "hdfs" : {
@@ -56,19 +45,14 @@
     }
   },
 
-  "eagleProps" : {
-    "eagleService": {
-      "host": "sandbox.hortonworks.com",
-      "port": 9099,
-      "username": "admin",
-      "password": "secret"
-    }
+  "eagleService": {
+    "host": "sandbox.hortonworks.com",
+    "port": 9099,
+    "username": "admin",
+    "password": "secret",
+    "readTimeOutSeconds" : 10,
   },
 
-  "appId":"mrHistoryJob",
-  "mode":"LOCAL",
-  "workers" : 3,
-  application.storm.nimbusHost=localhost
   "MRConfigureKeys" : {
     "jobNameKey" : "eagle.job.name",
     "jobConfigKey" : "mapreduce.map.output.compress,mapreduce.map.output.compress.codec,mapreduce.output.fileoutputformat.compress,mapreduce.output.fileoutputformat.compress.type,mapreduce.output.fileoutputformat.compress.codec,mapred.output.format.class, dataplatform.etl.info,mapreduce.map.memory.mb,mapreduce.reduce.memory.mb,mapreduce.map.java.opts,mapreduce.reduce.java.opts"


[39/50] incubator-eagle git commit: [EAGLE-615] Jsoup parse hive sql return String without line break "\n"

Posted by ha...@apache.org.
[EAGLE-615] Jsoup parse hive sql return String without line break "\n"

EAGLE-615 Jsoup parse hive sql return String without line break "\n"
- ADD "doc.outputSettings().prettyPrint(false);", get element value via getWholeText() not text()

Author: chitin <ch...@gmail.com>

Closes #499 from chitin/EAGLE615.


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

Branch: refs/heads/master
Commit: a710082d486e10b4732c00a06dd367dc556df60a
Parents: a6bc0a5
Author: chitin <ch...@gmail.com>
Authored: Mon Oct 17 11:42:27 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Mon Oct 17 11:42:27 2016 +0800

----------------------------------------------------------------------
 .../hive/jobrunning/HiveJobFetchSpout.java      | 35 +++++++++++++++-----
 1 file changed, 26 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a710082d/eagle-security/eagle-security-hive/src/main/java/org/apache/eagle/security/hive/jobrunning/HiveJobFetchSpout.java
----------------------------------------------------------------------
diff --git a/eagle-security/eagle-security-hive/src/main/java/org/apache/eagle/security/hive/jobrunning/HiveJobFetchSpout.java b/eagle-security/eagle-security-hive/src/main/java/org/apache/eagle/security/hive/jobrunning/HiveJobFetchSpout.java
index c0673b3..af4599b 100644
--- a/eagle-security/eagle-security-hive/src/main/java/org/apache/eagle/security/hive/jobrunning/HiveJobFetchSpout.java
+++ b/eagle-security/eagle-security-hive/src/main/java/org/apache/eagle/security/hive/jobrunning/HiveJobFetchSpout.java
@@ -22,6 +22,7 @@ import backtype.storm.task.TopologyContext;
 import backtype.storm.topology.OutputFieldsDeclarer;
 import backtype.storm.topology.base.BaseRichSpout;
 import backtype.storm.tuple.Fields;
+import org.apache.commons.lang.StringUtils;
 import org.apache.eagle.dataproc.impl.storm.ValuesArray;
 import org.apache.eagle.jpm.util.*;
 import org.apache.eagle.jpm.util.jobrecover.RunningJobManager;
@@ -35,12 +36,14 @@ import org.apache.eagle.security.hive.config.RunningJobCrawlConfig;
 import org.codehaus.jackson.JsonParser;
 import org.codehaus.jackson.map.ObjectMapper;
 import org.jsoup.Jsoup;
+import org.jsoup.nodes.TextNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import java.io.InputStream;
@@ -62,6 +65,7 @@ public class HiveJobFetchSpout extends BaseRichSpout {
     private Long lastFinishAppTime;
     private RunningJobManager runningJobManager;
     private int partitionId;
+
     static {
         OBJ_MAPPER.configure(JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS, true);
     }
@@ -91,22 +95,22 @@ public class HiveJobFetchSpout extends BaseRichSpout {
         // sanity verify 0<=partitionId<=numTotalPartitions-1
         if (partitionId < 0 || partitionId > crawlConfig.controlConfig.numTotalPartitions) {
             throw new IllegalStateException("partitionId should be less than numTotalPartitions with partitionId " +
-                    partitionId + " and numTotalPartitions " + crawlConfig.controlConfig.numTotalPartitions);
+                partitionId + " and numTotalPartitions " + crawlConfig.controlConfig.numTotalPartitions);
         }
         Class<? extends JobIdPartitioner> partitionerCls = crawlConfig.controlConfig.partitionerCls;
         try {
             this.jobFilter = new JobIdFilterByPartition(partitionerCls.newInstance(),
-                    crawlConfig.controlConfig.numTotalPartitions, partitionId);
+                crawlConfig.controlConfig.numTotalPartitions, partitionId);
         } catch (Exception e) {
             LOG.error("failing instantiating job partitioner class " + partitionerCls.getCanonicalName());
             throw new IllegalStateException(e);
         }
         this.collector = collector;
         this.runningJobManager = new RunningJobManager(crawlConfig.zkStateConfig.zkQuorum,
-                crawlConfig.zkStateConfig.zkSessionTimeoutMs,
-                crawlConfig.zkStateConfig.zkRetryTimes,
-                crawlConfig.zkStateConfig.zkRetryInterval,
-                crawlConfig.zkStateConfig.zkRoot);
+            crawlConfig.zkStateConfig.zkSessionTimeoutMs,
+            crawlConfig.zkStateConfig.zkRetryTimes,
+            crawlConfig.zkStateConfig.zkRetryInterval,
+            crawlConfig.zkStateConfig.zkRoot);
         this.lastFinishAppTime = this.runningJobManager.recoverLastFinishedTime(partitionId);
         if (this.lastFinishAppTime == 0l) {
             this.lastFinishAppTime = Calendar.getInstance().getTimeInMillis() - 24 * 60 * 60000l;//one day ago
@@ -119,7 +123,7 @@ public class HiveJobFetchSpout extends BaseRichSpout {
         LOG.info("start to fetch job list");
         try {
             List<AppInfo> apps = rmResourceFetcher.getResource(Constants.ResourceType.RUNNING_MR_JOB);
-            if(apps == null){
+            if (apps == null) {
                 apps = new ArrayList<>();
             }
             handleApps(apps, true);
@@ -127,7 +131,7 @@ public class HiveJobFetchSpout extends BaseRichSpout {
             long fetchTime = Calendar.getInstance().getTimeInMillis();
             if (fetchTime - this.lastFinishAppTime > 60000l) {
                 apps = rmResourceFetcher.getResource(Constants.ResourceType.COMPLETE_MR_JOB, Long.toString(this.lastFinishAppTime));
-                if(apps == null){
+                if (apps == null) {
                     apps = new ArrayList<>();
                 }
                 handleApps(apps, false);
@@ -230,6 +234,7 @@ public class HiveJobFetchSpout extends BaseRichSpout {
                 LOG.info("fetch job conf from {}", urlString);
                 is = InputStreamUtils.getInputStream(urlString, null, Constants.CompressionType.NONE);
                 final org.jsoup.nodes.Document doc = Jsoup.parse(is, "UTF-8", urlString);
+                doc.outputSettings().prettyPrint(false);
                 org.jsoup.select.Elements elements = doc.select("table[id=conf]").select("tbody").select("tr");
                 Map<String, String> hiveQueryLog = new HashMap<>();
                 Iterator<org.jsoup.nodes.Element> iter = elements.iterator();
@@ -237,7 +242,19 @@ public class HiveJobFetchSpout extends BaseRichSpout {
                     org.jsoup.nodes.Element element = iter.next();
                     org.jsoup.select.Elements tds = element.children();
                     String key = tds.get(0).text();
-                    String value = tds.get(1).text();
+                    String value = "";
+                    org.jsoup.nodes.Element valueElement = tds.get(1);
+                    if (Constants.HIVE_QUERY_STRING.equals(key)) {
+                        for (org.jsoup.nodes.Node child : valueElement.childNodes()) {
+                            if (child instanceof TextNode) {
+                                TextNode valueTextNode = (TextNode) child;
+                                value = valueTextNode.getWholeText();
+                                value = StringUtils.strip(value);
+                            }
+                        }
+                    } else {
+                        value = valueElement.text();
+                    }
                     hiveQueryLog.put(key, value);
                 }
                 if (hiveQueryLog.containsKey(Constants.HIVE_QUERY_STRING)) {


[11/50] incubator-eagle git commit: [EAGLE-605] Fix MR feeder provider.xml and remove useless configure

Posted by ha...@apache.org.
[EAGLE-605] Fix MR feeder provider.xml and remove useless configure

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

1. add missing configure from application.conf to provider.xml
2. remove useless configure like : pathContainsJobTrackerName/jobTrackerName/dryRun
3. Fix bug: add IsExecutable to ApplicationDesc so that web ui will know some applications can not be started, just static

Author: wujinhu <wu...@126.com>

Closes #490 from wujinhu/ui-test.


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

Branch: refs/heads/master
Commit: fa85dc3e20f163ff84f39ca51d16c5d54fad0482
Parents: 97978c6
Author: wujinhu <wu...@126.com>
Authored: Tue Oct 11 16:36:24 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Tue Oct 11 16:36:24 2016 +0800

----------------------------------------------------------------------
 .../service/ApplicationOperationContext.java    |  1 -
 .../impl/ApplicationManagementServiceImpl.java  | 22 ++++--
 .../impl/ApplicationProviderSPILoader.java      |  1 +
 .../eagle/metadata/model/ApplicationDesc.java   |  9 +++
 .../eagle/metadata/model/ApplicationEntity.java | 11 +--
 .../jpm/mr/history/MRHistoryJobConfig.java      |  6 --
 .../history/crawler/AbstractJobHistoryDAO.java  | 42 +----------
 .../history/crawler/JHFCrawlerDriverImpl.java   | 21 ++----
 .../mr/history/crawler/JobHistoryDAOImpl.java   |  2 +-
 ....history.MRHistoryJobApplicationProvider.xml | 76 +++++++++----------
 .../src/main/resources/application.conf         |  5 --
 ....running.MRRunningJobApplicationProvider.xml | 77 ++++++++++++--------
 .../src/main/resources/application.conf         |  2 -
 .../jpm/util/jobrecover/RunningJobManager.java  |  4 +-
 eagle-topology-assembly/pom.xml                 |  2 +-
 15 files changed, 117 insertions(+), 164 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationOperationContext.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationOperationContext.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationOperationContext.java
index 33a407c..3561374 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationOperationContext.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationOperationContext.java
@@ -90,7 +90,6 @@ public class ApplicationOperationContext implements Serializable, ApplicationLif
 
     @Override
     public void onInstall() {
-        metadata.setExecutable(application.isExecutable());
         if (metadata.getDescriptor().getStreams() != null) {
             List<StreamDesc> streamDescToInstall = metadata.getDescriptor().getStreams().stream().map((streamDefinition -> {
                 StreamDefinition copied = streamDefinition.copy();

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationManagementServiceImpl.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationManagementServiceImpl.java
index 04a7007..abd9197 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationManagementServiceImpl.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationManagementServiceImpl.java
@@ -21,6 +21,7 @@ import com.google.inject.Inject;
 import com.google.inject.Singleton;
 import com.typesafe.config.Config;
 import org.apache.eagle.alert.metadata.IMetadataDao;
+import org.apache.eagle.app.Application;
 import org.apache.eagle.app.service.ApplicationManagementService;
 import org.apache.eagle.app.service.ApplicationOperations;
 import org.apache.eagle.app.service.ApplicationOperationContext;
@@ -141,12 +142,14 @@ public class ApplicationManagementServiceImpl implements ApplicationManagementSe
     @Override
     public ApplicationEntity start(ApplicationOperations.StartOperation operation) throws ApplicationWrongStatusException {
         ApplicationEntity applicationEntity = applicationEntityService.getByUUIDOrAppId(operation.getUuid(), operation.getAppId());
+        Application application = applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType()).getApplication();
+        Preconditions.checkArgument(application.isExecutable(), "Application is not executable");
+
         ApplicationEntity.Status currentStatus = applicationEntity.getStatus();
         try {
             if (currentStatus == ApplicationEntity.Status.INITIALIZED || currentStatus == ApplicationEntity.Status.STOPPED) {
                 ApplicationOperationContext applicationOperationContext = new ApplicationOperationContext(
-                    applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType()).getApplication(),
-                    applicationEntity, config, alertMetadataService);
+                        application, applicationEntity, config, alertMetadataService);
 
                 applicationOperationContext.onStart();
                 //Only when topology submitted successfully can the state change to STARTING
@@ -172,9 +175,11 @@ public class ApplicationManagementServiceImpl implements ApplicationManagementSe
     @Override
     public ApplicationEntity stop(ApplicationOperations.StopOperation operation) throws ApplicationWrongStatusException {
         ApplicationEntity applicationEntity = applicationEntityService.getByUUIDOrAppId(operation.getUuid(), operation.getAppId());
+        Application application = applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType()).getApplication();
+        Preconditions.checkArgument(application.isExecutable(), "Application is not executable");
+
         ApplicationOperationContext applicationOperationContext = new ApplicationOperationContext(
-            applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType()).getApplication(),
-            applicationEntity, config, alertMetadataService);
+                application, applicationEntity, config, alertMetadataService);
         ApplicationEntity.Status currentStatus = applicationEntity.getStatus();
         try {
             if (currentStatus == ApplicationEntity.Status.RUNNING) {
@@ -200,12 +205,13 @@ public class ApplicationManagementServiceImpl implements ApplicationManagementSe
 
     @Override
     public ApplicationEntity.Status getStatus(ApplicationOperations.CheckStatusOperation operation)  {
-        ApplicationEntity applicationEntity = null;
         try {
-            applicationEntity = applicationEntityService.getByUUIDOrAppId(operation.getUuid(), operation.getAppId());
+            ApplicationEntity applicationEntity = applicationEntityService.getByUUIDOrAppId(operation.getUuid(), operation.getAppId());
+            Application application = applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType()).getApplication();
+            Preconditions.checkArgument(application.isExecutable(), "Application is not executable");
+
             ApplicationOperationContext applicationOperationContext = new ApplicationOperationContext(
-                applicationProviderService.getApplicationProviderByType(applicationEntity.getDescriptor().getType()).getApplication(),
-                applicationEntity, config, alertMetadataService);
+                    application, applicationEntity, config, alertMetadataService);
             ApplicationEntity.Status topologyStatus = applicationOperationContext.getStatus();
             return topologyStatus;
         } catch (IllegalArgumentException e) {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java
index bd96e28..9f52c9c 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderSPILoader.java
@@ -80,6 +80,7 @@ public class ApplicationProviderSPILoader extends ApplicationProviderLoader {
                 ApplicationProviderConfig providerConfig = new ApplicationProviderConfig();
                 providerConfig.setClassName(applicationProvider.getClass().getCanonicalName());
                 providerConfig.setJarPath(jarFileSupplier.apply(applicationProvider));
+                applicationProvider.getApplicationDesc().setExecutable(applicationProvider.getApplication().isExecutable());
                 applicationProvider.prepare(providerConfig, getConfig());
                 registerProvider(applicationProvider);
                 LOG.warn("Loaded {}:{} ({}) from {}",

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/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
index 506bdc6..8bc6ee3 100644
--- 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
@@ -36,6 +36,15 @@ public class ApplicationDesc implements Serializable {
     private Configuration configuration;
     private List<StreamDefinition> streams;
     private ApplicationDocs docs;
+    private boolean executable;
+
+    public boolean isExecutable() {
+        return executable;
+    }
+
+    public void setExecutable(boolean executable) {
+        this.executable = executable;
+    }
 
     private List<ApplicationDependency> dependencies;
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/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
index bae6ba7..5297de1 100644
--- 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
@@ -33,7 +33,6 @@ public class ApplicationEntity extends PersistenceEntity {
     private String appId;
     private SiteEntity site;
     private ApplicationDesc descriptor;
-    private boolean executable = true;
 
     private Map<String, Object> configuration = new HashMap<>();
     private Map<String, String> context = new HashMap<>();
@@ -153,15 +152,7 @@ public class ApplicationEntity extends PersistenceEntity {
         this.streams = streams;
     }
 
-    public boolean isExecutable() {
-        return executable;
-    }
-
-    public void setExecutable(boolean executable) {
-        this.executable = executable;
-    }
-
-    public static enum Status {
+    public enum Status {
         INITIALIZED("INITIALIZED"),
         STARTING("STARTING"),
         RUNNING("RUNNING"),

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java
index 839d2e4..37df5ad 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java
@@ -85,13 +85,10 @@ public class MRHistoryJobConfig implements Serializable {
     public static class JobHistoryEndpointConfig implements Serializable {
         public String mrHistoryServerUrl;
         public String basePath;
-        public boolean pathContainsJobTrackerName;
-        public String jobTrackerName;
         public Map<String, String> hdfs;
     }
 
     public static class ControlConfig implements Serializable {
-        public boolean dryRun;
         public Class<? extends JobIdPartitioner> partitionerCls;
         public boolean zeroBasedMonth;
         public String timeZone;
@@ -158,14 +155,11 @@ public class MRHistoryJobConfig implements Serializable {
 
         //parse job history endpoint
         this.jobHistoryEndpointConfig.basePath = config.getString("endpointConfig.basePath");
-        this.jobHistoryEndpointConfig.jobTrackerName = config.getString("endpointConfig.jobTrackerName");
         this.jobHistoryEndpointConfig.mrHistoryServerUrl = config.getString("endpointConfig.mrHistoryServerUrl");
-        this.jobHistoryEndpointConfig.pathContainsJobTrackerName = config.getBoolean("endpointConfig.pathContainsJobTrackerName");
         for (Map.Entry<String, ConfigValue> entry : config.getConfig("endpointConfig.hdfs").entrySet()) {
             this.jobHistoryEndpointConfig.hdfs.put(entry.getKey(), entry.getValue().unwrapped().toString());
         }
         //parse control config
-        this.controlConfig.dryRun = config.getBoolean("controlConfig.dryRun");
         try {
             this.controlConfig.partitionerCls = (Class<? extends JobIdPartitioner>) Class.forName(config.getString("controlConfig.partitionerCls"));
             assert this.controlConfig.partitionerCls != null;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/AbstractJobHistoryDAO.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/AbstractJobHistoryDAO.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/AbstractJobHistoryDAO.java
index 74489cd..9ed2ed2 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/AbstractJobHistoryDAO.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/AbstractJobHistoryDAO.java
@@ -45,35 +45,19 @@ public abstract class AbstractJobHistoryDAO implements JobHistoryLCM {
     protected static final Pattern JOBID_PATTERN = Pattern.compile("job_\\d+_\\d+");
 
     protected final String basePath;
-    protected volatile String jobTrackerName;
 
     public  static final String JOB_CONF_POSTFIX = "_conf.xml";
 
     private static final Timer timer = new Timer(true);
     private static final long JOB_TRACKER_SYNC_DURATION = 10 * 60 * 1000; // 10 minutes
 
-    private boolean pathContainsJobTrackerName;
-
-    public AbstractJobHistoryDAO(String basePath, boolean pathContainsJobTrackerName, String startingJobTrackerName) throws Exception {
+    public AbstractJobHistoryDAO(String basePath) throws Exception {
         this.basePath = basePath;
-        this.pathContainsJobTrackerName = pathContainsJobTrackerName;
-        jobTrackerName = startingJobTrackerName;
-        if (this.pathContainsJobTrackerName) {
-            if (startingJobTrackerName == null || startingJobTrackerName.isEmpty()) {
-                throw new IllegalStateException("startingJobTrackerName should not be null or empty");
-            }
-            // start background thread to check what is current job tracker
-            startThread(this.basePath);
-        }
     }
 
     protected String buildWholePathToYearMonthDay(int year, int month, int day) {
         StringBuilder sb = new StringBuilder();
         sb.append(basePath);
-        if (!pathContainsJobTrackerName && jobTrackerName != null && !jobTrackerName.isEmpty()) {
-            sb.append("/");
-            sb.append(jobTrackerName);
-        }
         sb.append(String.format(YEAR_MONTH_DAY_URL_FORMAT, year, month, day));
         return sb.toString();
     }
@@ -110,30 +94,6 @@ public abstract class AbstractJobHistoryDAO implements JobHistoryLCM {
         return null;
     }
 
-    private void startThread(final String basePath) throws Exception {
-        LOG.info("start an every-" + JOB_TRACKER_SYNC_DURATION / (60 * 1000) + "min timer task to check current jobTrackerName in background");
-        // Automatically update current job tracker name in background every 30 minutes
-        timer.scheduleAtFixedRate(new TimerTask() {
-            @Override
-            public void run() {
-                try {
-                    LOG.info("regularly checking current jobTrackerName in background");
-                    final String _jobTrackerName = calculateJobTrackerName(basePath);
-                    if (_jobTrackerName != null && !_jobTrackerName.equals(jobTrackerName)) {
-                        LOG.info("jobTrackerName changed from " + jobTrackerName + " to " + _jobTrackerName);
-                        jobTrackerName = _jobTrackerName;
-                    }
-                    LOG.info("Current jobTrackerName is: " + jobTrackerName);
-                } catch (Exception e) {
-                    LOG.error("failed to figure out current job tracker name that is not configured due to: " + e.getMessage(), e);
-                } catch (Throwable t) {
-                    LOG.error("failed to figure out current job tracker name that is not configured due to: " + t.getMessage(), t);
-                }
-            }
-        }, JOB_TRACKER_SYNC_DURATION, JOB_TRACKER_SYNC_DURATION);
-    }
-
-
     @Override
     public void readFileContent(int year, int month, int day, int serialNumber, String jobHistoryFileName, JHFInputStreamCallback reader) throws Exception {
         InputStream downloadIs;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JHFCrawlerDriverImpl.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JHFCrawlerDriverImpl.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JHFCrawlerDriverImpl.java
index ae9df37..a33abeb 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JHFCrawlerDriverImpl.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JHFCrawlerDriverImpl.java
@@ -52,7 +52,6 @@ public class JHFCrawlerDriverImpl implements JHFCrawlerDriver {
     private Set<String> processedJobFileNames = new HashSet<>();
 
     private final JobProcessDate processDate = new JobProcessDate();
-    private boolean dryRun;
     private JHFInputStreamCallback reader;
     protected boolean zeroBasedMonth = true;
 
@@ -65,10 +64,6 @@ public class JHFCrawlerDriverImpl implements JHFCrawlerDriver {
     public JHFCrawlerDriverImpl(JHFInputStreamCallback reader,
                                 JobHistoryLCM historyLCM, JobIdFilter jobFilter, int partitionId) throws Exception {
         this.zeroBasedMonth = MRHistoryJobConfig.get().getControlConfig().zeroBasedMonth;
-        this.dryRun = MRHistoryJobConfig.get().getControlConfig().dryRun;
-        if (this.dryRun)  {
-            LOG.info("this is a dry run");
-        }
         this.reader = reader;
         jhfLCM = historyLCM;//new JobHistoryDAOImpl(jobHistoryConfig);
         this.partitionId = partitionId;
@@ -169,15 +164,15 @@ public class JHFCrawlerDriverImpl implements JHFCrawlerDriver {
             LOG.warn("illegal job history file name : " + jobHistoryFile);
             return -1;
         }
-        if (!dryRun) {
-            jhfLCM.readFileContent(
-                    processDate.year,
-                    getActualMonth(processDate.month),
-                    processDate.day,
-                    Integer.valueOf(serialNumber),
-                    jobHistoryFile,
+
+        jhfLCM.readFileContent(
+                processDate.year,
+                getActualMonth(processDate.month),
+                processDate.day,
+                Integer.valueOf(serialNumber),
+                jobHistoryFile,
                 reader);
-        }
+
         JobHistoryZKStateManager.instance().addProcessedJob(String.format(FORMAT_JOB_PROCESS_DATE,
                 this.processDate.year,
                 this.processDate.month + 1,

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JobHistoryDAOImpl.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JobHistoryDAOImpl.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JobHistoryDAOImpl.java
index a035357..07ca5c3 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JobHistoryDAOImpl.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/crawler/JobHistoryDAOImpl.java
@@ -40,7 +40,7 @@ public class JobHistoryDAOImpl extends AbstractJobHistoryDAO {
     private FileSystem hdfs;
 
     public JobHistoryDAOImpl(JobHistoryEndpointConfig endpointConfig) throws Exception {
-        super(endpointConfig.basePath, endpointConfig.pathContainsJobTrackerName, endpointConfig.jobTrackerName);
+        super(endpointConfig.basePath);
         for (Map.Entry<String, String> entry : endpointConfig.hdfs.entrySet()) {
             this.conf.set(entry.getKey(), entry.getValue());
             LOG.info("conf key {}, conf value {}", entry.getKey(), entry.getValue());

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml b/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
index 02e8c05..66111eb 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
@@ -28,73 +28,73 @@
             <value>sandbox</value>
         </property>
         <property>
-            <name>jobExtractorConfig.mrVersion</name>
-            <value>MRVer2</value>
+            <name>workers</name>
+            <displayName>storm worker number</displayName>
+            <value>4</value>
         </property>
         <property>
-            <name>jobExtractorConfig.readTimeOutSeconds</name>
-            <displayName>zkPort</displayName>
-            <value>10</value>
+            <name>envContextConfig.parallelismConfig.mrHistoryJobExecutor</name>
+            <value>4</value>
         </property>
         <property>
-            <name>dataSourceConfig.zkQuorum</name>
-            <value>sandbox.hortonworks.com:2181</value>
+            <name>envContextConfig.tasks.mrHistoryJobExecutor</name>
+            <value>4</value>
         </property>
         <property>
-            <name>dataSourceConfig.zkPort</name>
-            <value>2181</value>
+            <name>jobExtractorConfig.mrVersion</name>
+            <value>MRVer2</value>
         </property>
         <property>
-            <name>dataSourceConfig.zkSessionTimeoutMs</name>
-            <value>15000</value>
+            <name>jobExtractorConfig.readTimeOutSeconds</name>
+            <value>60</value>
         </property>
         <property>
-            <name>dataSourceConfig.zkRetryTimes</name>
-            <value>3</value>
+            <name>zkStateConfig.zkQuorum</name>
+            <value>sandbox.hortonworks.com:2181</value>
         </property>
         <property>
-            <name>dataSourceConfig.zkRetryInterval</name>
-            <value>20000</value>
+            <name>zkStateConfig.zkPort</name>
+            <value>2181</value>
         </property>
         <property>
-            <name>dataSourceConfig.zkRoot</name>
-            <value>/test_mrjobhistory</value>
+            <name>zkStateConfig.zkRoot</name>
+            <value>/mrjobhistory_sandbox</value>
         </property>
         <property>
-            <name>dataSourceConfig.basePath</name>
-            <value>/mr-history/done</value>
+            <name>zkStateConfig.zkSessionTimeoutMs</name>
+            <value>15000</value>
         </property>
         <property>
-            <name>dataSourceConfig.jobTrackerName</name>
-            <value></value>
+            <name>zkStateConfig.zkRetryTimes</name>
+            <value>3</value>
         </property>
         <property>
-            <name>dataSourceConfig.nnEndpoint</name>
-            <value>hdfs://sandbox.hortonworks.com:8020</value>
+            <name>zkStateConfig.zkRetryInterval</name>
+            <value>20000</value>
         </property>
         <property>
-            <name>dataSourceConfig.pathContainsJobTrackerName</name>
+            <name>controlConfig.zeroBasedMonth</name>
             <value>false</value>
         </property>
         <property>
-            <name>dataSourceConfig.principal</name>
-            <value></value>
+            <name>controlConfig.partitionerCls</name>
+            <value>org.apache.eagle.jpm.util.DefaultJobIdPartitioner</value>
         </property>
         <property>
-            <name>dataSourceConfig.keytab</name>
-            <value></value>
+            <name>controlConfig.timeZone</name>
+            <value>Etc/GMT+7</value>
         </property>
         <property>
-            <name>dataSourceConfig.dryRun</name>
-            <value>false</value>
+            <name>endpointConfig.mrHistoryServerUrl</name>
+            <value>http://sandbox.hortonworks.com:19888</value>
         </property>
         <property>
-            <name>dataSourceConfig.partitionerCls</name>
-            <value>org.apache.eagle.jpm.util.DefaultJobIdPartitioner</value>
+            <name>endpointConfig.basePath</name>
+            <value>/mr-history/done</value>
         </property>
         <property>
-            <name>dataSourceConfig.zeroBasedMonth</name>
-            <value>false</value>
+            <name>endpointConfig.hdfs.fs.defaultFS</name>
+            <value>hdfs://sandbox.hortonworks.com:8020</value>
         </property>
         <property>
             <name>MRConfigureKeys.jobConfigKey</name>
@@ -115,14 +115,6 @@
             <value>eagle.job.name</value>
         </property>
         <property>
-            <name>envContextConfig.parallelismConfig.mrHistoryJobExecutor</name>
-            <value>6</value>
-        </property>
-        <property>
-            <name>envContextConfig.tasks.mrHistoryJobExecutor</name>
-            <value>6</value>
-        </property>
-        <property>
             <name>eagleProps.eagleService.host</name>
             <description>eagleProps.eagleService.host</description>
             <value>sandbox.hortonworks.com</value>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf b/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf
index 1440227..fa53dfb 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf
@@ -40,7 +40,6 @@
 
   "controlConfig" : {
     "zeroBasedMonth" : false,
-    "dryRun" : false,
     "partitionerCls" : "org.apache.eagle.jpm.util.DefaultJobIdPartitioner",
     "timeZone" : "UTC"
   },
@@ -48,8 +47,6 @@
   "endpointConfig" : {
     "mrHistoryServerUrl" : "http://sandbox.hortonworks.com:19888",
     "basePath" : "/mr-history/done",
-    "pathContainsJobTrackerName" : false,
-    "jobTrackerName" : "",
     "hdfs" : {
       fs.defaultFS : "hdfs://sandbox.hortonworks.com:8020",
       #if not need, then do not set
@@ -60,8 +57,6 @@
   },
 
   "eagleProps" : {
-    "mailHost" : "abc.com",
-    "mailDebug" : "true",
     "eagleService": {
       "host": "sandbox.hortonworks.com",
       "port": 9099,

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/eagle-jpm/eagle-jpm-mr-running/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.running.MRRunningJobApplicationProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-running/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.running.MRRunningJobApplicationProvider.xml b/eagle-jpm/eagle-jpm-mr-running/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.running.MRRunningJobApplicationProvider.xml
index 51e9eb8..4b95b36 100644
--- a/eagle-jpm/eagle-jpm-mr-running/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.running.MRRunningJobApplicationProvider.xml
+++ b/eagle-jpm/eagle-jpm-mr-running/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.running.MRRunningJobApplicationProvider.xml
@@ -23,10 +23,30 @@
     <configuration>
         <!-- org.apache.eagle.jpm.spark.running.SparkRunningJobAppConfig -->
         <property>
-            <name>envContextConfig.env</name>
-            <value>local</value>
-            <displayName>Environment</displayName>
-            <description>Execution environment</description>
+            <name>jobExtractorConfig.site</name>
+            <displayName>Site ID</displayName>
+            <value>sandbox</value>
+        </property>
+        <property>
+            <name>workers</name>
+            <displayName>storm worker number</displayName>
+            <value>4</value>
+        </property>
+        <property>
+            <name>envContextConfig.parallelismConfig.mrRunningJobFetchSpout</name>
+            <value>1</value>
+        </property>
+        <property>
+            <name>envContextConfig.parallelismConfig.mrRunningJobParseBolt</name>
+            <value>8</value>
+        </property>
+        <property>
+            <name>envContextConfig.tasks.mrRunningJobFetchSpout</name>
+            <value>1</value>
+        </property>
+        <property>
+            <name>envContextConfig.tasks.mrRunningJobParseBolt</name>
+            <value>8</value>
         </property>
         <property>
             <name>zookeeperConfig.zkQuorum</name>
@@ -60,7 +80,7 @@
         </property>
         <property>
             <name>zookeeperConfig.zkRoot</name>
-            <value>/apps/mr/running</value>
+            <value>/apps/mr/runningSandbox</value>
         </property>
         <property>
             <name>eagleProps.eagleService.host</name>
@@ -85,26 +105,21 @@
         <property>
             <name>eagleProps.eagleService.readTimeOutSeconds</name>
             <description>eagleProps.eagleService.readTimeOutSeconds</description>
-            <value>20</value>
+            <value>60</value>
         </property>
         <property>
             <name>eagleProps.eagleService.maxFlushNum</name>
             <description>eagleProps.eagleService.maxFlushNum</description>
-            <value>500</value>
-        </property>
-        <property>
-            <name>jobExtractorConfig.site</name>
-            <description>jobExtractorConfig.site</description>
-            <value>sandbox</value>
+            <value>1000</value>
         </property>
         <property>
             <name>jobExtractorConfig.fetchRunningJobInterval</name>
             <description>jobExtractorConfig.fetchRunningJobInterval</description>
-            <value>15</value>
+            <value>60</value>
         </property>
         <property>
-            <name>jobExtractorConfig.parseThreadPoolSize</name>
-            <description>jobExtractorConfig.parseThreadPoolSize</description>
+            <name>jobExtractorConfig.parseJobThreadPoolSize</name>
+            <description>jobExtractorConfig.parseJobThreadPoolSize</description>
             <value>5</value>
         </property>
         <property>
@@ -115,27 +130,25 @@
         <property>
             <name>dataSourceConfig.rmUrls</name>
             <description>dataSourceConfig.rmUrls</description>
-            <value>http://sandbox.hortonworks.com:50030</value>
-        </property>
-        <property>
-            <name>dataSourceConfig.nnEndpoint</name>
-            <description>dataSourceConfig.nnEndpoint</description>
-            <value>hdfs://sandbox.hortonworks.com:8020</value>
-        </property>
-        <property>
-            <name>dataSourceConfig.keytab</name>
-            <description>dataSourceConfig.keytab</description>
-            <value></value>
+            <value>http://sandbox.hortonworks.com:8088</value>
         </property>
         <property>
-            <name>dataSourceConfig.principal</name>
-            <description>dataSourceConfig.principal</description>
-            <value></value>
+            <name>MRConfigureKeys.jobConfigKey</name>
+            <value>mapreduce.map.output.compress,
+                mapreduce.map.output.compress.codec,
+                mapreduce.output.fileoutputformat.compress,
+                mapreduce.output.fileoutputformat.compress.type,
+                mapreduce.output.fileoutputformat.compress.codec,
+                mapred.output.format.class,
+                dataplatform.etl.info,
+                mapreduce.map.memory.mb,
+                mapreduce.reduce.memory.mb,
+                mapreduce.map.java.opts,
+                mapreduce.reduce.java.opts</value>
         </property>
         <property>
-            <name>dataSourceConfig.rmUrls</name>
-            <description>dataSourceConfig.rmUrls</description>
-            <value>http://sandbox.hortonworks.com:8088</value>
+            <name>MRConfigureKeys.jobNameKey</name>
+            <value>eagle.job.name</value>
         </property>
     </configuration>
     <docs>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/eagle-jpm/eagle-jpm-mr-running/src/main/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-running/src/main/resources/application.conf b/eagle-jpm/eagle-jpm-mr-running/src/main/resources/application.conf
index 830c72b..9c354c7 100644
--- a/eagle-jpm/eagle-jpm-mr-running/src/main/resources/application.conf
+++ b/eagle-jpm/eagle-jpm-mr-running/src/main/resources/application.conf
@@ -51,8 +51,6 @@
   },
 
   "eagleProps" : {
-    "mailHost" : "abc.com",
-    "mailDebug" : "true",
     "eagleService": {
       "host": "sandbox.hortonworks.com",
       "port": 9099,

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/jobrecover/RunningJobManager.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/jobrecover/RunningJobManager.java b/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/jobrecover/RunningJobManager.java
index 253c61a..a2d97bf 100644
--- a/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/jobrecover/RunningJobManager.java
+++ b/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/jobrecover/RunningJobManager.java
@@ -159,8 +159,8 @@ public class RunningJobManager implements Serializable {
         appInfo.put("startedTime", app.getStartedTime() + "");
         appInfo.put("finishedTime", app.getFinishedTime() + "");
         appInfo.put("elapsedTime", app.getElapsedTime() + "");
-        appInfo.put("amContainerLogs", app.getAmContainerLogs());
-        appInfo.put("amHostHttpAddress", app.getAmHostHttpAddress());
+        appInfo.put("amContainerLogs", app.getAmContainerLogs() == null ? "" : app.getAmContainerLogs());
+        appInfo.put("amHostHttpAddress", app.getAmHostHttpAddress() == null ? "" : app.getAmHostHttpAddress());
         appInfo.put("allocatedMB", app.getAllocatedMB() + "");
         appInfo.put("allocatedVCores", app.getAllocatedVCores() + "");
         appInfo.put("runningContainers", app.getRunningContainers() + "");

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/fa85dc3e/eagle-topology-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-topology-assembly/pom.xml b/eagle-topology-assembly/pom.xml
index 6a87a98..80ca265 100644
--- a/eagle-topology-assembly/pom.xml
+++ b/eagle-topology-assembly/pom.xml
@@ -177,4 +177,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
+</project>
\ No newline at end of file



[30/50] incubator-eagle git commit: [EAGLE-618] migration eagle-jpm-aggregation to application framework-bug fix

Posted by ha...@apache.org.
[EAGLE-618] migration eagle-jpm-aggregation to application framework-bug fix

Author: wujinhu <wu...@126.com>

Closes #509 from wujinhu/EAGLE-618.


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

Branch: refs/heads/master
Commit: 8ff8ecf1b8d9ace5c87ad6acc30235b4a43d98bf
Parents: 98d1964
Author: wujinhu <wu...@126.com>
Authored: Fri Oct 14 17:46:33 2016 +0800
Committer: wujinhu <wu...@126.com>
Committed: Fri Oct 14 17:46:33 2016 +0800

----------------------------------------------------------------------
 .../org/apache/eagle/jpm/aggregation/AggregationApplication.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8ff8ecf1/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java b/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java
index b040d3e..214c688 100644
--- a/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java
+++ b/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java
@@ -35,13 +35,13 @@ public class AggregationApplication extends StormApplication {
         List<String> metricNames = new ArrayList<>();
         String[] metricNamesArr = config.getString("aggregate.counters.metrics").split(",");
         for (int i = 0; i < metricNamesArr.length; i++) {
-            metricNames.add(metricNamesArr[i]);
+            metricNames.add(metricNamesArr[i].trim());
         }
         List<String> groupByColumns = new ArrayList<>();
 
         String[] groupByColumnsArr = config.getString("aggregate.counters.groupBys").split(";");
         for (int i = 0; i < groupByColumnsArr.length; i++) {
-            groupByColumns.add(groupByColumnsArr[i]);
+            groupByColumns.add(groupByColumnsArr[i].trim());
         }
 
         Map<String, List<List<String>>> metrics = new HashMap<>();


[47/50] incubator-eagle git commit: [MINOR] Fix windows EOL

Posted by ha...@apache.org.
[MINOR] Fix windows EOL


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

Branch: refs/heads/master
Commit: 76fc4410bbfcddc4757eeb6ebabaa8baf658036a
Parents: 2479d32
Author: Hao Chen <ha...@apache.org>
Authored: Tue Oct 18 17:59:55 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Tue Oct 18 17:59:55 2016 +0800

----------------------------------------------------------------------
 .../eagle/service/hbase/EmbeddedHbaseTest.java  |  50 ++---
 .../store/jdbc/JDBCDataSourceProviderTest.java  | 148 ++++++-------
 .../jdbc/JDBCMetadataQueryServiceTest.java      |  72 +++----
 eagle-dev/ci-log4j.properties                   |  42 ++--
 .../jpm/mr/history/MRHistoryJobApplication.java | 142 ++++++-------
 ....history.MRHistoryJobApplicationProvider.xml | 206 +++++++++----------
 .../audit/JDBCSecurityMetadataDAOTest.java      | 138 ++++++-------
 7 files changed, 399 insertions(+), 399 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/76fc4410/eagle-core/eagle-embed/eagle-embed-hbase/src/test/java/org/apache/eagle/service/hbase/EmbeddedHbaseTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-embed/eagle-embed-hbase/src/test/java/org/apache/eagle/service/hbase/EmbeddedHbaseTest.java b/eagle-core/eagle-embed/eagle-embed-hbase/src/test/java/org/apache/eagle/service/hbase/EmbeddedHbaseTest.java
index 0330eee..e65f062 100644
--- a/eagle-core/eagle-embed/eagle-embed-hbase/src/test/java/org/apache/eagle/service/hbase/EmbeddedHbaseTest.java
+++ b/eagle-core/eagle-embed/eagle-embed-hbase/src/test/java/org/apache/eagle/service/hbase/EmbeddedHbaseTest.java
@@ -1,26 +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.service.hbase;
-
-import org.junit.Test;
-
-public class EmbeddedHbaseTest extends TestHBaseBase {
-    @Test
-    public void testHBaseCreateTable() {
-        // hbase.createTable("test_hbase_table","f");
-    }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.service.hbase;
+
+import org.junit.Test;
+
+public class EmbeddedHbaseTest extends TestHBaseBase {
+    @Test
+    public void testHBaseCreateTable() {
+        // hbase.createTable("test_hbase_table","f");
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/76fc4410/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCDataSourceProviderTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCDataSourceProviderTest.java b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCDataSourceProviderTest.java
index 545ade4..1af1839 100644
--- a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCDataSourceProviderTest.java
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCDataSourceProviderTest.java
@@ -1,75 +1,75 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.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.jdbc;
-
-import com.google.inject.Inject;
-import org.junit.Assert;
-import org.junit.Test;
-
-import javax.sql.DataSource;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-public class JDBCDataSourceProviderTest extends JDBCMetadataTestBase {
-    @Inject
-    private DataSource dataSource;
-    @Inject
-    private JDBCDataSourceConfig dataSourceConfig;
-
-    @Test
-    public void testSingletonDataSource(){
-        DataSource dataSource1 = injector().getInstance(DataSource.class);
-        DataSource dataSource2 = injector().getInstance(DataSource.class);
-        Assert.assertTrue("Should get datasource in singleton pattern",dataSource == dataSource1);
-        Assert.assertTrue("Should get datasource in singleton pattern",dataSource1 == dataSource2);
-    }
-
-    @Test
-    public void testDataSourceConfig(){
-        Assert.assertEquals("jdbc:h2:mem:test;INIT=RUNSCRIPT FROM './src/test/resources/init.sql'",dataSourceConfig.getUrl());
-        Assert.assertEquals(null,dataSourceConfig.getUsername());
-        Assert.assertEquals(null,dataSourceConfig.getPassword());
-        Assert.assertEquals("encoding=UTF8;timeout=60",dataSourceConfig.getConnectionProperties());
-    }
-
-    @Test
-    public void testConnection() throws SQLException {
-        Connection connection = null;
-        Statement statement = null;
-        ResultSet resultSet = null;
-        try {
-            connection = dataSource.getConnection();
-            Assert.assertNotNull(connection);
-            statement = connection.createStatement();
-            resultSet  = statement.executeQuery("SELECT 1");
-            Assert.assertTrue(resultSet.next());
-            Assert.assertEquals(1,resultSet.getInt(1));
-        } catch (SQLException e) {
-            Assert.fail(e.getMessage());
-            throw e;
-        } finally {
-            if(resultSet!=null)
-                resultSet.close();
-            if(statement != null)
-                statement.close();
-            if(connection!=null)
-                connection.close();
-        }
-    }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.jdbc;
+
+import com.google.inject.Inject;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+public class JDBCDataSourceProviderTest extends JDBCMetadataTestBase {
+    @Inject
+    private DataSource dataSource;
+    @Inject
+    private JDBCDataSourceConfig dataSourceConfig;
+
+    @Test
+    public void testSingletonDataSource(){
+        DataSource dataSource1 = injector().getInstance(DataSource.class);
+        DataSource dataSource2 = injector().getInstance(DataSource.class);
+        Assert.assertTrue("Should get datasource in singleton pattern",dataSource == dataSource1);
+        Assert.assertTrue("Should get datasource in singleton pattern",dataSource1 == dataSource2);
+    }
+
+    @Test
+    public void testDataSourceConfig(){
+        Assert.assertEquals("jdbc:h2:mem:test;INIT=RUNSCRIPT FROM './src/test/resources/init.sql'",dataSourceConfig.getUrl());
+        Assert.assertEquals(null,dataSourceConfig.getUsername());
+        Assert.assertEquals(null,dataSourceConfig.getPassword());
+        Assert.assertEquals("encoding=UTF8;timeout=60",dataSourceConfig.getConnectionProperties());
+    }
+
+    @Test
+    public void testConnection() throws SQLException {
+        Connection connection = null;
+        Statement statement = null;
+        ResultSet resultSet = null;
+        try {
+            connection = dataSource.getConnection();
+            Assert.assertNotNull(connection);
+            statement = connection.createStatement();
+            resultSet  = statement.executeQuery("SELECT 1");
+            Assert.assertTrue(resultSet.next());
+            Assert.assertEquals(1,resultSet.getInt(1));
+        } catch (SQLException e) {
+            Assert.fail(e.getMessage());
+            throw e;
+        } finally {
+            if(resultSet!=null)
+                resultSet.close();
+            if(statement != null)
+                statement.close();
+            if(connection!=null)
+                connection.close();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/76fc4410/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataQueryServiceTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataQueryServiceTest.java b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataQueryServiceTest.java
index 97a06ab..5d608c6 100644
--- a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataQueryServiceTest.java
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataQueryServiceTest.java
@@ -1,36 +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.metadata.store.jdbc;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import javax.inject.Inject;
-import java.sql.SQLException;
-import java.util.List;
-
-public class JDBCMetadataQueryServiceTest extends JDBCMetadataTestBase {
-    @Inject
-    JDBCMetadataQueryService queryService;
-
-    @Test
-    public void testQuery() throws SQLException {
-        List<Integer> result = queryService.query("SELECT 7",(resultSet) -> resultSet.getInt(1));
-        Assert.assertEquals(1,result.size());
-        Assert.assertEquals(7,result.get(0).intValue());
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.jdbc;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.inject.Inject;
+import java.sql.SQLException;
+import java.util.List;
+
+public class JDBCMetadataQueryServiceTest extends JDBCMetadataTestBase {
+    @Inject
+    JDBCMetadataQueryService queryService;
+
+    @Test
+    public void testQuery() throws SQLException {
+        List<Integer> result = queryService.query("SELECT 7",(resultSet) -> resultSet.getInt(1));
+        Assert.assertEquals(1,result.size());
+        Assert.assertEquals(7,result.get(0).intValue());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/76fc4410/eagle-dev/ci-log4j.properties
----------------------------------------------------------------------
diff --git a/eagle-dev/ci-log4j.properties b/eagle-dev/ci-log4j.properties
index a01759a..2ee78e3 100644
--- a/eagle-dev/ci-log4j.properties
+++ b/eagle-dev/ci-log4j.properties
@@ -1,22 +1,22 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT 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.debug=false
-
-log4j.rootLogger=OFF, console
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT 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.debug=false
+
+log4j.rootLogger=OFF, console
+
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
 log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/76fc4410/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java
index de35678..e33fc02 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java
@@ -1,71 +1,71 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * <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.jpm.mr.history;
-
-import org.apache.eagle.app.StormApplication;
-import org.apache.eagle.app.environment.impl.StormEnvironment;
-import org.apache.eagle.jpm.mr.history.crawler.JobHistoryContentFilter;
-import org.apache.eagle.jpm.mr.history.crawler.JobHistoryContentFilterBuilder;
-import org.apache.eagle.jpm.mr.history.storm.JobHistorySpout;
-import org.apache.eagle.jpm.util.Constants;
-
-import backtype.storm.generated.StormTopology;
-import backtype.storm.topology.TopologyBuilder;
-import com.typesafe.config.Config;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Pattern;
-
-public class MRHistoryJobApplication extends StormApplication {
-    @Override
-    public StormTopology execute(Config config, StormEnvironment environment) {
-        //1. trigger init conf
-        MRHistoryJobConfig appConfig = MRHistoryJobConfig.getInstance(config);
-        com.typesafe.config.Config jhfAppConf = appConfig.getConfig();
-
-        //2. init JobHistoryContentFilter
-        final JobHistoryContentFilterBuilder builder = JobHistoryContentFilterBuilder.newBuilder().acceptJobFile().acceptJobConfFile();
-        String[] confKeyPatternsSplit = jhfAppConf.getString("MRConfigureKeys.jobConfigKey").split(",");
-        List<String> confKeyPatterns = new ArrayList<>(confKeyPatternsSplit.length);
-        for (String confKeyPattern : confKeyPatternsSplit) {
-            confKeyPatterns.add(confKeyPattern.trim());
-        }
-        confKeyPatterns.add(Constants.JobConfiguration.CASCADING_JOB);
-        confKeyPatterns.add(Constants.JobConfiguration.HIVE_JOB);
-        confKeyPatterns.add(Constants.JobConfiguration.PIG_JOB);
-        confKeyPatterns.add(Constants.JobConfiguration.SCOOBI_JOB);
-
-        String jobNameKey = jhfAppConf.getString("MRConfigureKeys.jobNameKey");
-        builder.setJobNameKey(jobNameKey);
-
-        for (String key : confKeyPatterns) {
-            builder.includeJobKeyPatterns(Pattern.compile(key));
-        }
-        JobHistoryContentFilter filter = builder.build();
-        //3. init topology
-        TopologyBuilder topologyBuilder = new TopologyBuilder();
-        String spoutName = "mrHistoryJobSpout";
-        int tasks = jhfAppConf.getInt("stormConfig.mrHistoryJobSpoutTasks");
-        topologyBuilder.setSpout(
-                spoutName,
-                new JobHistorySpout(filter, config),
-                tasks
-        ).setNumTasks(tasks);
-        return topologyBuilder.createTopology();
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.jpm.mr.history;
+
+import org.apache.eagle.app.StormApplication;
+import org.apache.eagle.app.environment.impl.StormEnvironment;
+import org.apache.eagle.jpm.mr.history.crawler.JobHistoryContentFilter;
+import org.apache.eagle.jpm.mr.history.crawler.JobHistoryContentFilterBuilder;
+import org.apache.eagle.jpm.mr.history.storm.JobHistorySpout;
+import org.apache.eagle.jpm.util.Constants;
+
+import backtype.storm.generated.StormTopology;
+import backtype.storm.topology.TopologyBuilder;
+import com.typesafe.config.Config;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+public class MRHistoryJobApplication extends StormApplication {
+    @Override
+    public StormTopology execute(Config config, StormEnvironment environment) {
+        //1. trigger init conf
+        MRHistoryJobConfig appConfig = MRHistoryJobConfig.getInstance(config);
+        com.typesafe.config.Config jhfAppConf = appConfig.getConfig();
+
+        //2. init JobHistoryContentFilter
+        final JobHistoryContentFilterBuilder builder = JobHistoryContentFilterBuilder.newBuilder().acceptJobFile().acceptJobConfFile();
+        String[] confKeyPatternsSplit = jhfAppConf.getString("MRConfigureKeys.jobConfigKey").split(",");
+        List<String> confKeyPatterns = new ArrayList<>(confKeyPatternsSplit.length);
+        for (String confKeyPattern : confKeyPatternsSplit) {
+            confKeyPatterns.add(confKeyPattern.trim());
+        }
+        confKeyPatterns.add(Constants.JobConfiguration.CASCADING_JOB);
+        confKeyPatterns.add(Constants.JobConfiguration.HIVE_JOB);
+        confKeyPatterns.add(Constants.JobConfiguration.PIG_JOB);
+        confKeyPatterns.add(Constants.JobConfiguration.SCOOBI_JOB);
+
+        String jobNameKey = jhfAppConf.getString("MRConfigureKeys.jobNameKey");
+        builder.setJobNameKey(jobNameKey);
+
+        for (String key : confKeyPatterns) {
+            builder.includeJobKeyPatterns(Pattern.compile(key));
+        }
+        JobHistoryContentFilter filter = builder.build();
+        //3. init topology
+        TopologyBuilder topologyBuilder = new TopologyBuilder();
+        String spoutName = "mrHistoryJobSpout";
+        int tasks = jhfAppConf.getInt("stormConfig.mrHistoryJobSpoutTasks");
+        topologyBuilder.setSpout(
+                spoutName,
+                new JobHistorySpout(filter, config),
+                tasks
+        ).setNumTasks(tasks);
+        return topologyBuilder.createTopology();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/76fc4410/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml b/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
index 42f3167..77a3709 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
@@ -1,104 +1,104 @@
-<?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>MR_HISTORY_JOB_APP</type>
-    <name>Map Reduce History Job Monitoring</name>
-    <version>0.5.0-incubating</version>
-    <configuration>
-        <!-- org.apache.eagle.jpm.mr.history.MRHistoryJobConfig -->
-        <property>
-            <name>workers</name>
-            <displayName>Worker Number</displayName>
-            <description>the number of storm workers will be used</description>
-            <value>4</value>
-        </property>
-        <property>
-            <name>stormConfig.mrHistoryJobSpoutTasks</name>
-            <displayName>Read Task Number</displayName>
-            <description>the number tasks of the spout will be assigned</description>
-            <value>4</value>
-        </property>
-
-        <property>
-            <name>zookeeper.zkRoot</name>
-            <displayName>Zookeeper Root Path</displayName>
-            <description>zkRoot that used to save context for this application</description>
-            <value>/mrjobhistory_sandbox</value>
-            <required>true</required>
-        </property>
-
-        <property>
-            <name>endpointConfig.timeZone</name>
-            <displayName>Time Zone</displayName>
-            <description>which time zone do hdfs data nodes locate in</description>
-            <value>Etc/GMT+7</value>
-            <required>true</required>
-        </property>
-        <property>
-            <name>endpointConfig.mrHistoryServerUrl</name>
-            <displayName>Map Reduce History Server</displayName>
-            <description>map reduce history server url address</description>
-            <value>http://sandbox.hortonworks.com:19888</value>
-            <required>true</required>
-        </property>
-        <property>
-            <name>endpointConfig.basePath</name>
-            <displayName>Map Reduce History Log File Path</displayName>
-            <description>which directory do map reduce history job files locate in</description>
-            <value>/mr-history/done</value>
-            <required>true</required>
-        </property>
-        <property>
-            <name>endpointConfig.hdfs.fs.defaultFS</name>
-            <displayName>HDFS Address</displayName>
-            <description>The name of the default file system.  Either the literal string "local" or a host:port for NDFS</description>
-            <value>hdfs://sandbox.hortonworks.com:8020</value>
-            <required>true</required>
-        </property>
-
-        <property>
-            <name>MRConfigureKeys.jobConfigKey</name>
-            <displayName>Map Reduce Extracted Configuration Keys</displayName>
-            <description>which configures will be extracted from map reduce job configurations</description>
-            <value>mapreduce.map.output.compress,
-                mapreduce.map.output.compress.codec,
-                mapreduce.output.fileoutputformat.compress,
-                mapreduce.output.fileoutputformat.compress.type,
-                mapreduce.output.fileoutputformat.compress.codec,
-                mapred.output.format.class,
-                dataplatform.etl.info,
-                mapreduce.map.memory.mb,
-                mapreduce.reduce.memory.mb,
-                mapreduce.map.java.opts,
-                mapreduce.reduce.java.opts</value>
-        </property>
-        <property>
-            <name>MRConfigureKeys.jobNameKey</name>
-            <displayName>Map Reduce Job Name Key</displayName>
-            <description>User use -Dkey=value to specify name of a job when submit. use this to extract job name from job configuration</description>
-            <value>eagle.job.name</value>
-        </property>
-    </configuration>
-    <docs>
-        <install>
-        </install>
-        <uninstall>
-        </uninstall>
-    </docs>
+<?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>MR_HISTORY_JOB_APP</type>
+    <name>Map Reduce History Job Monitoring</name>
+    <version>0.5.0-incubating</version>
+    <configuration>
+        <!-- org.apache.eagle.jpm.mr.history.MRHistoryJobConfig -->
+        <property>
+            <name>workers</name>
+            <displayName>Worker Number</displayName>
+            <description>the number of storm workers will be used</description>
+            <value>4</value>
+        </property>
+        <property>
+            <name>stormConfig.mrHistoryJobSpoutTasks</name>
+            <displayName>Read Task Number</displayName>
+            <description>the number tasks of the spout will be assigned</description>
+            <value>4</value>
+        </property>
+
+        <property>
+            <name>zookeeper.zkRoot</name>
+            <displayName>Zookeeper Root Path</displayName>
+            <description>zkRoot that used to save context for this application</description>
+            <value>/mrjobhistory_sandbox</value>
+            <required>true</required>
+        </property>
+
+        <property>
+            <name>endpointConfig.timeZone</name>
+            <displayName>Time Zone</displayName>
+            <description>which time zone do hdfs data nodes locate in</description>
+            <value>Etc/GMT+7</value>
+            <required>true</required>
+        </property>
+        <property>
+            <name>endpointConfig.mrHistoryServerUrl</name>
+            <displayName>Map Reduce History Server</displayName>
+            <description>map reduce history server url address</description>
+            <value>http://sandbox.hortonworks.com:19888</value>
+            <required>true</required>
+        </property>
+        <property>
+            <name>endpointConfig.basePath</name>
+            <displayName>Map Reduce History Log File Path</displayName>
+            <description>which directory do map reduce history job files locate in</description>
+            <value>/mr-history/done</value>
+            <required>true</required>
+        </property>
+        <property>
+            <name>endpointConfig.hdfs.fs.defaultFS</name>
+            <displayName>HDFS Address</displayName>
+            <description>The name of the default file system.  Either the literal string "local" or a host:port for NDFS</description>
+            <value>hdfs://sandbox.hortonworks.com:8020</value>
+            <required>true</required>
+        </property>
+
+        <property>
+            <name>MRConfigureKeys.jobConfigKey</name>
+            <displayName>Map Reduce Extracted Configuration Keys</displayName>
+            <description>which configures will be extracted from map reduce job configurations</description>
+            <value>mapreduce.map.output.compress,
+                mapreduce.map.output.compress.codec,
+                mapreduce.output.fileoutputformat.compress,
+                mapreduce.output.fileoutputformat.compress.type,
+                mapreduce.output.fileoutputformat.compress.codec,
+                mapred.output.format.class,
+                dataplatform.etl.info,
+                mapreduce.map.memory.mb,
+                mapreduce.reduce.memory.mb,
+                mapreduce.map.java.opts,
+                mapreduce.reduce.java.opts</value>
+        </property>
+        <property>
+            <name>MRConfigureKeys.jobNameKey</name>
+            <displayName>Map Reduce Job Name Key</displayName>
+            <description>User use -Dkey=value to specify name of a job when submit. use this to extract job name from job configuration</description>
+            <value>eagle.job.name</value>
+        </property>
+    </configuration>
+    <docs>
+        <install>
+        </install>
+        <uninstall>
+        </uninstall>
+    </docs>
 </application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/76fc4410/eagle-security/eagle-security-common/src/test/java/org/apache/eagle/security/crawler/audit/JDBCSecurityMetadataDAOTest.java
----------------------------------------------------------------------
diff --git a/eagle-security/eagle-security-common/src/test/java/org/apache/eagle/security/crawler/audit/JDBCSecurityMetadataDAOTest.java b/eagle-security/eagle-security-common/src/test/java/org/apache/eagle/security/crawler/audit/JDBCSecurityMetadataDAOTest.java
index 4cfe25e..03ae58c 100644
--- a/eagle-security/eagle-security-common/src/test/java/org/apache/eagle/security/crawler/audit/JDBCSecurityMetadataDAOTest.java
+++ b/eagle-security/eagle-security-common/src/test/java/org/apache/eagle/security/crawler/audit/JDBCSecurityMetadataDAOTest.java
@@ -1,69 +1,69 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.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.security.crawler.audit;
-
-import com.google.inject.Inject;
-import org.apache.eagle.app.module.ApplicationGuiceModule;
-import org.apache.eagle.common.module.CommonGuiceModule;
-import org.apache.eagle.common.module.GuiceJUnitRunner;
-import org.apache.eagle.common.module.Modules;
-import org.apache.eagle.metadata.store.jdbc.JDBCMetadataQueryService;
-import org.apache.eagle.metadata.store.jdbc.JDBCMetadataStore;
-import org.apache.eagle.security.service.HBaseSensitivityEntity;
-import org.apache.eagle.security.service.JDBCSecurityMetadataDAO;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.Collections;
-
-@RunWith(GuiceJUnitRunner.class)
-@Modules({
-    JDBCMetadataStore.class, CommonGuiceModule.class, ApplicationGuiceModule.class
-})
-public class JDBCSecurityMetadataDAOTest {
-    @Inject
-    private JDBCSecurityMetadataDAO metadataDAO;
-
-    @Inject
-    private JDBCMetadataQueryService queryService;
-
-    @Before
-    public void setUp() throws SQLException {
-        queryService.execute("create table hbase_sensitivity_entity (site varchar(20), hbase_resource varchar(100), sensitivity_type varchar(20), primary key (site, hbase_resource));");
-    }
-
-    @Test
-    public void testJDBCSecurityMetadataDAO(){
-        HBaseSensitivityEntity entity = new HBaseSensitivityEntity();
-        entity.setSite("test_site");
-        entity.setHbaseResource("test_hbaseResource");
-        metadataDAO.addHBaseSensitivity(Collections.singletonList(entity));
-        Collection<HBaseSensitivityEntity> entities = metadataDAO.listHBaseSensitivities();
-        Assert.assertEquals(1,entities.size());
-        Assert.assertEquals("test_site",entities.iterator().next().getSite());
-    }
-
-    @After
-    public void after() throws SQLException {
-        queryService.dropTable("hbase_sensitivity_entity");
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.security.crawler.audit;
+
+import com.google.inject.Inject;
+import org.apache.eagle.app.module.ApplicationGuiceModule;
+import org.apache.eagle.common.module.CommonGuiceModule;
+import org.apache.eagle.common.module.GuiceJUnitRunner;
+import org.apache.eagle.common.module.Modules;
+import org.apache.eagle.metadata.store.jdbc.JDBCMetadataQueryService;
+import org.apache.eagle.metadata.store.jdbc.JDBCMetadataStore;
+import org.apache.eagle.security.service.HBaseSensitivityEntity;
+import org.apache.eagle.security.service.JDBCSecurityMetadataDAO;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.Collections;
+
+@RunWith(GuiceJUnitRunner.class)
+@Modules({
+    JDBCMetadataStore.class, CommonGuiceModule.class, ApplicationGuiceModule.class
+})
+public class JDBCSecurityMetadataDAOTest {
+    @Inject
+    private JDBCSecurityMetadataDAO metadataDAO;
+
+    @Inject
+    private JDBCMetadataQueryService queryService;
+
+    @Before
+    public void setUp() throws SQLException {
+        queryService.execute("create table hbase_sensitivity_entity (site varchar(20), hbase_resource varchar(100), sensitivity_type varchar(20), primary key (site, hbase_resource));");
+    }
+
+    @Test
+    public void testJDBCSecurityMetadataDAO(){
+        HBaseSensitivityEntity entity = new HBaseSensitivityEntity();
+        entity.setSite("test_site");
+        entity.setHbaseResource("test_hbaseResource");
+        metadataDAO.addHBaseSensitivity(Collections.singletonList(entity));
+        Collection<HBaseSensitivityEntity> entities = metadataDAO.listHBaseSensitivities();
+        Assert.assertEquals(1,entities.size());
+        Assert.assertEquals("test_site",entities.iterator().next().getSite());
+    }
+
+    @After
+    public void after() throws SQLException {
+        queryService.dropTable("hbase_sensitivity_entity");
+    }
+}



[10/50] incubator-eagle git commit: EAGLE-610 fix grunt code

Posted by ha...@apache.org.
EAGLE-610 fix grunt code

pass grunt code into maven build

Author: zombieJ <sm...@gmail.com>

Closes #491 from zombieJ/EAGLE-610.


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

Branch: refs/heads/master
Commit: 97978c60d5feebf47ff214db310e7816f2dea52e
Parents: 6f9fb4e
Author: zombieJ <sm...@gmail.com>
Authored: Tue Oct 11 15:50:55 2016 +0800
Committer: zombieJ <sm...@gmail.com>
Committed: Tue Oct 11 15:50:55 2016 +0800

----------------------------------------------------------------------
 eagle-server/src/main/webapp/app/build/index.js             | 7 ++++---
 .../main/webapp/app/dev/public/js/components/sortTable.js   | 2 +-
 eagle-server/ui-build.sh                                    | 9 +++++++--
 3 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97978c60/eagle-server/src/main/webapp/app/build/index.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/build/index.js b/eagle-server/src/main/webapp/app/build/index.js
index bacbf53..2d274be 100644
--- a/eagle-server/src/main/webapp/app/build/index.js
+++ b/eagle-server/src/main/webapp/app/build/index.js
@@ -135,9 +135,10 @@
 
 				grunt.stdout.pipe(process.stdout);
 				grunt.stderr.pipe(process.stdout);
-				grunt.on('exit', function() {
-					process.exit()
-				})
+				grunt.on('exit', function(code) {
+					console.log("Grunt Exit Code:", code);
+					process.exit(code)
+				});
 			});
 		});
 	});

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97978c60/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js b/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js
index 599d0eb..a1e91df 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js
@@ -132,7 +132,7 @@
 				$scope.$watch($attrs.sortTable + ".___SORT_TABLE___", function () {
 					var fullList = $scope.$parent[$attrs.sortTable];
 					if(fullList && !fullList.___SORT_TABLE___) {
-						fullList.___SORT_TABLE___ = +new Date;
+						fullList.___SORT_TABLE___ = +new Date();
 						cacheFilteredList = null;
 					}
 				});

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/97978c60/eagle-server/ui-build.sh
----------------------------------------------------------------------
diff --git a/eagle-server/ui-build.sh b/eagle-server/ui-build.sh
index 928df1f..d217055 100644
--- a/eagle-server/ui-build.sh
+++ b/eagle-server/ui-build.sh
@@ -36,8 +36,13 @@ cd src/main/webapp/app
 echo "npm install..."
 npm install
 
-# grunt build
 echo "building..."
 npm run build
+STATUS=$?
 
-echo "=============== Finished ==============="
\ No newline at end of file
+if [ $STATUS -eq 0 ]; then
+	echo "=============== Finished ==============="
+else
+	echo "=============== Failed ==============="
+	exit 1
+fi
\ No newline at end of file


[09/50] incubator-eagle git commit: [EAGLE-608] UI update: metadata/policies/policy

Posted by ha...@apache.org.
[EAGLE-608] UI update: metadata/policies/policy

metadata/policies/policy updated from array to entity. UI also need change.

Author: zombieJ <sm...@gmail.com>

Closes #489 from zombieJ/EAGLE-608.


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

Branch: refs/heads/master
Commit: 6f9fb4eed47c7e4b4ff1b955861a4fdbf8cf296f
Parents: 757f510
Author: zombieJ <sm...@gmail.com>
Authored: Tue Oct 11 12:02:32 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Tue Oct 11 12:02:32 2016 +0800

----------------------------------------------------------------------
 .../app/dev/public/js/components/sortTable.js    |  7 +++++++
 .../webapp/app/dev/public/js/ctrls/alertCtrl.js  |  4 ++--
 .../app/dev/public/js/services/entitySrv.js      | 19 ++++++-------------
 .../webapp/app/dev/public/js/services/pageSrv.js |  4 ++--
 4 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6f9fb4ee/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js b/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js
index 4143491..599d0eb 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/components/sortTable.js
@@ -129,6 +129,13 @@
 				$scope.$watch($attrs.sortTable + ".length", function () {
 					cacheFilteredList = null;
 				});
+				$scope.$watch($attrs.sortTable + ".___SORT_TABLE___", function () {
+					var fullList = $scope.$parent[$attrs.sortTable];
+					if(fullList && !fullList.___SORT_TABLE___) {
+						fullList.___SORT_TABLE___ = +new Date;
+						cacheFilteredList = null;
+					}
+				});
 
 				function workMessage(event) {
 					var data = event.data;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6f9fb4ee/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
index f2f8f96..b5eba07 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
@@ -84,13 +84,13 @@
 
 		$scope.startPolicy = function (policy) {
 			Entity
-				.put("metadata/policies/" + encodeURIComponent(policy.name) + "/status/ENABLED", {})
+				.post("metadata/policies/" + encodeURIComponent(policy.name) + "/status/ENABLED", {})
 				._then(updateList);
 		};
 
 		$scope.stopPolicy = function (policy) {
 			Entity
-				.put("metadata/policies/" + encodeURIComponent(policy.name) + "/status/DISABLED", {})
+				.post("metadata/policies/" + encodeURIComponent(policy.name) + "/status/DISABLED", {})
 				._then(updateList);
 		};
 	});

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6f9fb4ee/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js b/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js
index 029b05d..9dfba86 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js
@@ -80,18 +80,6 @@
 			}));
 		};
 
-		Entity.put = function (url, entity) {
-			var list = [];
-			return wrapList(list, $http({
-				method: 'PUT',
-				url: _host + "/rest/" + url,
-				headers: {
-					"Content-Type": "application/json"
-				},
-				data: entity
-			}));
-		};
-
 		Entity.delete = function (url, uuid) {
 			var list = [];
 			return wrapList(list, $http({
@@ -133,8 +121,13 @@
 		Entity.queryMetadata = function (url) {
 			var metaList = Entity.query('metadata/' +  url);
 			metaList._then(function (res) {
+				var data = res.data;
+				if(!$.isArray(data)) {
+					data = [data];
+				}
+
 				metaList.splice(0);
-				Array.prototype.push.apply(metaList, res.data);
+				Array.prototype.push.apply(metaList, data);
 			});
 
 			return metaList;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6f9fb4ee/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js b/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
index cd0e8b4..732f820 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
@@ -43,10 +43,10 @@
 	// ============================================================
 	var defaultPortalList = [
 		{name: "Home", icon: "home", path: "#/"},
-		{name: "Insight", icon: "heartbeat", list: [
+		/*{name: "Insight", icon: "heartbeat", list: [
 			{name: "Dashboards"},
 			{name: "Metrics"}
-		]},
+		]},*/
 		{name: "Alert", icon: "bell", list: [
 			{name: "Explore Alerts", path: "#/alert/"},
 			{name: "Manage Policies", path: "#/alert/policyList"},


[50/50] incubator-eagle git commit: [EAGLE-635] Refactor policy parser and validator for richer plan details and better performance

Posted by ha...@apache.org.
[EAGLE-635] Refactor policy parser and validator for richer plan details and better performance

## Changes

* Refactor policy parser and validator for richer plan details and better performance
* Decouple PolicyExecutionPlan and PolicyValidation

## API
* Parse API
~~~
POST /metadata/policies/parse
Accept-Type: text

from HDFS_AUDIT_LOG_ENRICHED_STREAM_SANDBOX#window.timeBatch(2 min) select cmd, user, count() as total_count group by cmd,user insert into HDFS_AUDIT_LOG_ENRICHED_STREAM_SANDBOX_OUT"
~~~
* Validation API
~~~
POST /metadata/policies/validate
Accept-Type: application/json

{
   "name": "hdfsPolicy",
   "description": "hdfsPolicy",
   "inputStreams": [
      "HDFS_AUDIT_LOG_ENRICHED_STREAM_SANDBOX"
   ],
   "outputStreams": [
      "HDFS_AUDIT_LOG_ENRICHED_STREAM_SANDBOX_OUT"
   ],
   "definition": {
      "type": "siddhi",
      "value": "from HDFS_AUDIT_LOG_ENRICHED_STREAM_SANDBOX#window.timeBatch(2 min) select cmd, user, count() as total_count group by cmd,user insert into HDFS_AUDIT_LOG_ENRICHED_STREAM_SANDBOX_OUT "
   },
   "partitionSpec": [
      {
         "streamId": "hdfs_audit_log_enriched_stream",
         "type": "GROUPBY",
         "columns" : [
            "cmd"
         ]
      }
   ],
   "parallelismHint": 2
}

~~~

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

Closes #529 from haoch/RefactorPolicyValidator.


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

Branch: refs/heads/master
Commit: 6dbdb4f72ec5adf89f4f7a13bf766e01e3ff6705
Parents: adc2ba9
Author: Hao Chen <ha...@apache.org>
Authored: Wed Oct 19 10:28:09 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Wed Oct 19 10:28:09 2016 +0800

----------------------------------------------------------------------
 .../conf/sandbox-userprofile-scheduler.conf     |   2 +-
 .../eagle-alert/alert-common/pom.xml            |   8 -
 .../eagle-alert/alert-engine/pom.xml            |  10 +-
 .../evaluator/impl/SiddhiDefinitionAdapter.java |  13 +
 .../alert-metadata-service/pom.xml              |  13 -
 .../metadata/resource/MetadataResource.java     |  10 +-
 .../metadata/resource/PolicyCompiler.java       | 235 +++++++++++++++++++
 .../metadata/resource/PolicyExecutionPlan.java  | 100 ++++++++
 .../metadata/resource/PolicyParseResult.java    |  65 +++++
 .../metadata/resource/PolicyValidation.java     |  97 --------
 .../resource/PolicyValidationResult.java        |  76 ++++++
 .../metadata/resource/PolicyValidator.java      | 124 ----------
 .../metadata/resource/PolicyCompilerTest.java   | 195 +++++++++++++++
 .../metadata/resource/PolicyValidatorTest.java  | 187 ---------------
 14 files changed, 699 insertions(+), 436 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6dbdb4f7/eagle-assembly/src/main/conf/sandbox-userprofile-scheduler.conf
----------------------------------------------------------------------
diff --git a/eagle-assembly/src/main/conf/sandbox-userprofile-scheduler.conf b/eagle-assembly/src/main/conf/sandbox-userprofile-scheduler.conf
index f54162d..4593a7e 100644
--- a/eagle-assembly/src/main/conf/sandbox-userprofile-scheduler.conf
+++ b/eagle-assembly/src/main/conf/sandbox-userprofile-scheduler.conf
@@ -63,4 +63,4 @@ akka {
   # Filter of log events that is used by the LoggingAdapter before
   # publishing log events to the eventStream.
   logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6dbdb4f7/eagle-core/eagle-alert-parent/eagle-alert/alert-common/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/pom.xml b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/pom.xml
index 57a0157..fd3eccd 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/pom.xml
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/pom.xml
@@ -63,10 +63,6 @@
             <artifactId>slf4j-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.curator</groupId>
             <artifactId>curator-framework</artifactId>
         </dependency>
@@ -82,10 +78,6 @@
             <groupId>com.fasterxml.jackson.jaxrs</groupId>
             <artifactId>jackson-jaxrs-json-provider</artifactId>
         </dependency>
-        <!--<dependency>-->
-        <!--<groupId>org.codehaus.jackson</groupId>-->
-        <!--<artifactId>jackson-jaxrs</artifactId>-->
-        <!--</dependency>-->
         <dependency>
             <groupId>joda-time</groupId>
             <artifactId>joda-time</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6dbdb4f7/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/pom.xml b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/pom.xml
index 1ea6088..649125c 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/pom.xml
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/pom.xml
@@ -41,15 +41,17 @@
         <dependency>
             <groupId>org.apache.kafka</groupId>
             <artifactId>${kafka.artifact.id}</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>com.sun.jersey</groupId>
             <artifactId>jersey-client</artifactId>
         </dependency>
-        <!--<dependency>-->
-        <!--<groupId>org.codehaus.jackson</groupId>-->
-        <!--<artifactId>jackson-jaxrs</artifactId>-->
-        <!--</dependency>-->
         <dependency>
             <groupId>com.netflix.archaius</groupId>
             <artifactId>archaius-core</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6dbdb4f7/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiDefinitionAdapter.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiDefinitionAdapter.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiDefinitionAdapter.java
index 3645dcf..114c40a 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiDefinitionAdapter.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiDefinitionAdapter.java
@@ -102,6 +102,19 @@ public class SiddhiDefinitionAdapter {
         return builder.toString();
     }
 
+    public static String buildSiddhiExecutionPlan(String policyDefinition, Map<String, StreamDefinition> inputStreamDefinitions) {
+        StringBuilder builder = new StringBuilder();
+        for (Map.Entry<String,StreamDefinition> entry: inputStreamDefinitions.entrySet()) {
+            builder.append(SiddhiDefinitionAdapter.buildStreamDefinition(entry.getValue()));
+            builder.append("\n");
+        }
+        builder.append(policyDefinition);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Generated siddhi execution plan: {}", builder.toString());
+        }
+        return builder.toString();
+    }
+
     /**
      * public enum Type {
      * STRING, INT, LONG, FLOAT, DOUBLE, BOOL, OBJECT

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6dbdb4f7/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/pom.xml b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/pom.xml
index 0518a15..df2f803 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/pom.xml
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/pom.xml
@@ -63,19 +63,6 @@
             <groupId>com.sun.jersey</groupId>
             <artifactId>jersey-client</artifactId>
         </dependency>
-
-        <!--<dependency>-->
-        <!--<groupId>org.codehaus.jackson</groupId>-->
-        <!--<artifactId>jackson-mapper-asl</artifactId>-->
-        <!--</dependency>-->
-        <!--<dependency>-->
-        <!--<groupId>org.codehaus.jackson</groupId>-->
-        <!--<artifactId>jackson-jaxrs</artifactId>-->
-        <!--</dependency>-->
-        <!--<dependency>-->
-        <!--<groupId>org.codehaus.jackson</groupId>-->
-        <!--<artifactId>jackson-xc</artifactId>-->
-        <!--</dependency>-->
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6dbdb4f7/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 32a978a..eb23362 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
@@ -206,8 +206,14 @@ public class MetadataResource {
 
     @Path("/policies/validate")
     @POST
-    public PolicyValidation validatePolicy(PolicyDefinition policy) {
-        return PolicyValidator.validate(policy,dao);
+    public PolicyValidationResult validatePolicy(PolicyDefinition policy) {
+        return PolicyCompiler.validate(policy,dao);
+    }
+
+    @Path("/policies/parse")
+    @POST
+    public PolicyParseResult parsePolicy(String policyDefinition) {
+        return PolicyCompiler.parse(policyDefinition);
     }
 
     @Path("/policies/batch")

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6dbdb4f7/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyCompiler.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/PolicyCompiler.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyCompiler.java
new file mode 100644
index 0000000..6e3938d
--- /dev/null
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyCompiler.java
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.service.metadata.resource;
+
+import com.google.common.base.Preconditions;
+import org.apache.eagle.alert.engine.coordinator.*;
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.apache.eagle.alert.engine.evaluator.impl.SiddhiDefinitionAdapter;
+import org.apache.eagle.alert.metadata.IMetadataDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.wso2.siddhi.query.api.ExecutionPlan;
+import org.wso2.siddhi.query.api.execution.ExecutionElement;
+import org.wso2.siddhi.query.api.execution.query.Query;
+import org.wso2.siddhi.query.api.execution.query.input.handler.StreamHandler;
+import org.wso2.siddhi.query.api.execution.query.input.handler.Window;
+import org.wso2.siddhi.query.api.execution.query.input.stream.InputStream;
+import org.wso2.siddhi.query.api.execution.query.input.stream.JoinInputStream;
+import org.wso2.siddhi.query.api.execution.query.input.stream.SingleInputStream;
+import org.wso2.siddhi.query.api.execution.query.input.stream.StateInputStream;
+import org.wso2.siddhi.query.api.execution.query.output.stream.OutputStream;
+import org.wso2.siddhi.query.api.execution.query.selection.OutputAttribute;
+import org.wso2.siddhi.query.api.execution.query.selection.Selector;
+import org.wso2.siddhi.query.api.expression.Variable;
+import org.wso2.siddhi.query.api.expression.constant.TimeConstant;
+import org.wso2.siddhi.query.compiler.SiddhiCompiler;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class PolicyCompiler {
+    private static final Logger LOG = LoggerFactory.getLogger(PolicyCompiler.class);
+
+
+    public static PolicyParseResult parse(String executionPlanQuery) {
+        PolicyParseResult policyParseResult = new PolicyParseResult();
+        try {
+            policyParseResult.setPolicyExecutionPlan(parseExecutionPlan(executionPlanQuery));
+            policyParseResult.setSuccess(true);
+            policyParseResult.setMessage("Parsed successfully");
+        } catch (Exception exception) {
+            LOG.error("Got error to parse policy: {}", executionPlanQuery, exception);
+            policyParseResult.setSuccess(false);
+            policyParseResult.setMessage(exception.getMessage());
+            policyParseResult.setStackTrace(exception);
+        }
+        return policyParseResult;
+    }
+
+    /**
+     * Quick parseExecutionPlan policy.
+     */
+    public static PolicyExecutionPlan parseExecutionPlan(String policyDefinition, Map<String, StreamDefinition> inputStreamDefinitions) throws Exception {
+        // Validate inputStreams are valid
+        Preconditions.checkNotNull(inputStreamDefinitions, "No inputStreams to connect from");
+        return parseExecutionPlan(SiddhiDefinitionAdapter.buildSiddhiExecutionPlan(policyDefinition, inputStreamDefinitions));
+    }
+
+    public static PolicyExecutionPlan parseExecutionPlan(String executionPlanQuery) throws Exception {
+        PolicyExecutionPlan policyExecutionPlan = new PolicyExecutionPlan();
+        try {
+            ExecutionPlan executionPlan = SiddhiCompiler.parse(executionPlanQuery);
+
+            policyExecutionPlan.setExecutionPlanDesc(executionPlan.toString());
+
+            // Set current execution plan as valid
+            policyExecutionPlan.setExecutionPlanSource(executionPlanQuery);
+            policyExecutionPlan.setInternalExecutionPlan(executionPlan);
+
+            Map<String, List<StreamColumn>> actualInputStreams = new HashMap<>();
+            Map<String, List<StreamColumn>> actualOutputStreams = new HashMap<>();
+            List<StreamPartition> partitions = new ArrayList<>();
+
+            // Go through execution element
+            for (ExecutionElement executionElement : executionPlan.getExecutionElementList()) {
+                if (executionElement instanceof Query) {
+                    // -------------
+                    // Explain Query
+                    // -------------
+
+                    // Input streams
+                    InputStream inputStream = ((Query) executionElement).getInputStream();
+                    Selector selector = ((Query) executionElement).getSelector();
+
+                    for (String streamId : inputStream.getUniqueStreamIds()) {
+                        if (!actualInputStreams.containsKey(streamId)) {
+                            org.wso2.siddhi.query.api.definition.StreamDefinition streamDefinition = executionPlan.getStreamDefinitionMap().get(streamId);
+                            if (streamDefinition != null) {
+                                actualInputStreams.put(streamId, SiddhiDefinitionAdapter.convertFromSiddiDefinition(streamDefinition).getColumns());
+                            } else {
+                                actualInputStreams.put(streamId, null);
+                            }
+                        }
+                    }
+
+                    // Window Spec and Partition
+                    if (inputStream instanceof SingleInputStream) {
+                        // Window Spec
+                        List<Window> windows = new ArrayList<>();
+                        for (StreamHandler streamHandler : ((SingleInputStream) inputStream).getStreamHandlers()) {
+                            if (streamHandler instanceof Window) {
+                                windows.add((Window) streamHandler);
+                            }
+                        }
+
+                        // Group By Spec
+                        List<Variable> groupBy = selector.getGroupByList();
+
+                        if (windows.size() > 0 || groupBy.size() >= 0) {
+                            partitions.add(convertSingleStreamWindowAndGroupByToPartition(((SingleInputStream) inputStream).getStreamId(), windows, groupBy));
+                        }
+                    }
+                    //    else if(inputStream instanceof JoinInputStream) {
+                    //        // TODO: Parse multiple stream join
+                    //    } else if(inputStream instanceof StateInputStream) {
+                    //        // TODO: Parse StateInputStream
+                    //    }
+
+                    // Output streams
+                    OutputStream outputStream = ((Query) executionElement).getOutputStream();
+                    actualOutputStreams.put(outputStream.getId(), convertOutputStreamColumns(selector.getSelectionList()));
+                } else {
+                    LOG.warn("Unhandled execution element: {}", executionElement.toString());
+                }
+            }
+            // Set used input streams
+            policyExecutionPlan.setInputStreams(actualInputStreams);
+
+            // Set Partitions
+            policyExecutionPlan.setStreamPartitions(partitions);
+
+            // Validate outputStreams
+            policyExecutionPlan.setOutputStreams(actualOutputStreams);
+        } catch (Exception ex) {
+            LOG.error("Got error to parseExecutionPlan policy execution plan: \n{}", executionPlanQuery, ex);
+            throw ex;
+        }
+        return policyExecutionPlan;
+    }
+
+    private static StreamPartition convertSingleStreamWindowAndGroupByToPartition(String streamId, List<Window> windows, List<Variable> groupBy) {
+        StreamPartition partition = new StreamPartition();
+        partition.setStreamId(streamId);
+        StreamSortSpec sortSpec = null;
+
+        if (windows.size() > 0) {
+            sortSpec = new StreamSortSpec();
+            for (Window window : windows) {
+                if (window.getFunction().equals("timeBatch")) {
+                    sortSpec.setWindowPeriodMillis(((TimeConstant) window.getParameters()[0]).getValue().intValue());
+                    sortSpec.setWindowMargin(sortSpec.getWindowPeriodMillis() / 3);
+                }
+            }
+        }
+        partition.setSortSpec(sortSpec);
+        if (groupBy.size() > 0) {
+            partition.setColumns(groupBy.stream().map(Variable::getAttributeName).collect(Collectors.toList()));
+            partition.setType(StreamPartition.Type.GROUPBY);
+        } else {
+            partition.setType(StreamPartition.Type.SHUFFLE);
+        }
+        return partition;
+    }
+
+    public static PolicyValidationResult validate(PolicyDefinition policy, IMetadataDao metadataDao) {
+        Map<String, StreamDefinition> allDefinitions = new HashMap<>();
+        for (StreamDefinition definition : metadataDao.listStreams()) {
+            allDefinitions.put(definition.getStreamId(), definition);
+        }
+        return validate(policy, allDefinitions);
+    }
+
+    public static PolicyValidationResult validate(PolicyDefinition policy, Map<String, StreamDefinition> allDefinitions) {
+        Map<String, StreamDefinition> inputDefinitions = new HashMap<>();
+        PolicyValidationResult policyValidationResult = new PolicyValidationResult();
+        policyValidationResult.setPolicyDefinition(policy);
+        try {
+            if (policy.getInputStreams() != null) {
+                for (String streamId : policy.getInputStreams()) {
+                    if (allDefinitions.containsKey(streamId)) {
+                        inputDefinitions.put(streamId, allDefinitions.get(streamId));
+                    } else {
+                        throw new StreamNotDefinedException(streamId);
+                    }
+                }
+            }
+
+            PolicyExecutionPlan policyExecutionPlan = parseExecutionPlan(policy.getDefinition().getValue(), inputDefinitions);
+            // Validate output
+            if (policy.getOutputStreams() != null) {
+                for (String outputStream : policy.getOutputStreams()) {
+                    if (!policyExecutionPlan.getOutputStreams().containsKey(outputStream)) {
+                        throw new StreamNotDefinedException("Output stream " + outputStream + " not defined");
+                    }
+                }
+            }
+            policyValidationResult.setPolicyExecutionPlan(policyExecutionPlan);
+            policyValidationResult.setSuccess(true);
+            policyValidationResult.setMessage("Validated successfully");
+        } catch (Exception exception) {
+            LOG.error("Got error to validate policy definition: {}", policy, exception);
+            policyValidationResult.setSuccess(false);
+            policyValidationResult.setMessage(exception.getMessage());
+            policyValidationResult.setStackTrace(exception);
+        }
+
+        return policyValidationResult;
+    }
+
+    private static List<StreamColumn> convertOutputStreamColumns(List<OutputAttribute> outputAttributeList) {
+        return outputAttributeList.stream().map(outputAttribute -> {
+            StreamColumn streamColumn = new StreamColumn();
+            streamColumn.setName(outputAttribute.getRename());
+            streamColumn.setDescription(outputAttribute.getExpression().toString());
+            return streamColumn;
+        }).collect(Collectors.toList());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6dbdb4f7/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyExecutionPlan.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/PolicyExecutionPlan.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyExecutionPlan.java
new file mode 100644
index 0000000..f925e3d
--- /dev/null
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyExecutionPlan.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.service.metadata.resource;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.apache.eagle.alert.engine.coordinator.StreamColumn;
+import org.apache.eagle.alert.engine.coordinator.StreamPartition;
+import org.wso2.siddhi.query.api.ExecutionPlan;
+
+import java.util.List;
+import java.util.Map;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+public class PolicyExecutionPlan {
+    /**
+     * Actual input streams.
+     */
+    private Map<String, List<StreamColumn>> inputStreams;
+
+    /**
+     * Actual output streams.
+     */
+    private Map<String, List<StreamColumn>> outputStreams;
+
+    /**
+     * Execution plan source.
+     */
+    private String executionPlanSource;
+
+    /**
+     * Execution plan.
+     */
+    private ExecutionPlan internalExecutionPlan;
+
+    private String executionPlanDesc;
+
+    private List<StreamPartition> streamPartitions;
+
+    public String getExecutionPlanSource() {
+        return executionPlanSource;
+    }
+
+    public void setExecutionPlanSource(String executionPlanSource) {
+        this.executionPlanSource = executionPlanSource;
+    }
+
+    public ExecutionPlan getInternalExecutionPlan() {
+        return internalExecutionPlan;
+    }
+
+    public void setInternalExecutionPlan(ExecutionPlan internalExecutionPlan) {
+        this.internalExecutionPlan = internalExecutionPlan;
+    }
+
+    public String getExecutionPlanDesc() {
+        return executionPlanDesc;
+    }
+
+    public void setExecutionPlanDesc(String executionPlanDesc) {
+        this.executionPlanDesc = executionPlanDesc;
+    }
+
+    public List<StreamPartition> getStreamPartitions() {
+        return streamPartitions;
+    }
+
+    public void setStreamPartitions(List<StreamPartition> streamPartitions) {
+        this.streamPartitions = streamPartitions;
+    }
+
+    public Map<String, List<StreamColumn>> getInputStreams() {
+        return inputStreams;
+    }
+
+    public void setInputStreams(Map<String, List<StreamColumn>> inputStreams) {
+        this.inputStreams = inputStreams;
+    }
+
+    public Map<String, List<StreamColumn>> getOutputStreams() {
+        return outputStreams;
+    }
+
+    public void setOutputStreams(Map<String, List<StreamColumn>> outputStreams) {
+        this.outputStreams = outputStreams;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6dbdb4f7/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyParseResult.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/PolicyParseResult.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyParseResult.java
new file mode 100644
index 0000000..2522270
--- /dev/null
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyParseResult.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.service.metadata.resource;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+public class PolicyParseResult {
+    private boolean success;
+    private String message;
+    private String exception;
+
+    private PolicyExecutionPlan policyExecutionPlan;
+
+    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;
+    }
+
+    public void setStackTrace(Throwable throwable) {
+        this.setException(ExceptionUtils.getStackTrace(throwable));
+    }
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    public PolicyExecutionPlan getPolicyExecutionPlan() {
+        return policyExecutionPlan;
+    }
+
+    public void setPolicyExecutionPlan(PolicyExecutionPlan policyExecutionPlan) {
+        this.policyExecutionPlan = policyExecutionPlan;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6dbdb4f7/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidation.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/PolicyValidation.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidation.java
deleted file mode 100644
index 4b69a35..0000000
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidation.java
+++ /dev/null
@@ -1,97 +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
- * <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.service.metadata.resource;
-
-import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
-import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import org.apache.commons.lang3.exception.ExceptionUtils;
-
-import java.util.Map;
-
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class PolicyValidation {
-    private boolean success;
-    private String message;
-    private String exception;
-
-    private Map<String, StreamDefinition> validInputStreams;
-    private Map<String, StreamDefinition> validOutputStreams;
-    private PolicyDefinition policyDefinition;
-    private String validExecutionPlan;
-
-    public boolean isSuccess() {
-        return success;
-    }
-
-    public void setSuccess(boolean success) {
-        this.success = success;
-    }
-
-    public String getMessage() {
-        return message;
-    }
-
-    public void setMessage(String message) {
-        this.message = message;
-    }
-
-
-    public String getException() {
-        return exception;
-    }
-
-    public void setException(String exception) {
-        this.exception = exception;
-    }
-
-    public void setStackTrace(Throwable throwable) {
-        this.exception = ExceptionUtils.getStackTrace(throwable);
-    }
-
-    public Map<String, StreamDefinition> getValidOutputStreams() {
-        return validOutputStreams;
-    }
-
-    public void setValidOutputStreams(Map<String, StreamDefinition> validOutputStreams) {
-        this.validOutputStreams = validOutputStreams;
-    }
-
-    public Map<String, StreamDefinition> getValidInputStreams() {
-        return validInputStreams;
-    }
-
-    public void setValidInputStreams(Map<String, StreamDefinition> validInputStreams) {
-        this.validInputStreams = validInputStreams;
-    }
-
-    public PolicyDefinition getPolicyDefinition() {
-        return policyDefinition;
-    }
-
-    public void setPolicyDefinition(PolicyDefinition policyDefinition) {
-        this.policyDefinition = policyDefinition;
-    }
-
-    public String getValidExecutionPlan() {
-        return validExecutionPlan;
-    }
-
-    public void setValidExecutionPlan(String validExecutionPlan) {
-        this.validExecutionPlan = validExecutionPlan;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6dbdb4f7/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidationResult.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/PolicyValidationResult.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidationResult.java
new file mode 100644
index 0000000..b1912af
--- /dev/null
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidationResult.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.service.metadata.resource;
+
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+public class PolicyValidationResult {
+    private boolean success;
+    private String message;
+    private String exception;
+
+    private PolicyExecutionPlan policyExecutionPlan;
+    private PolicyDefinition policyDefinition;
+
+    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;
+    }
+
+    public void setStackTrace(Throwable throwable) {
+        this.setException(ExceptionUtils.getStackTrace(throwable));
+    }
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    public PolicyExecutionPlan getPolicyExecutionPlan() {
+        return policyExecutionPlan;
+    }
+
+    public void setPolicyExecutionPlan(PolicyExecutionPlan policyExecutionPlan) {
+        this.policyExecutionPlan = policyExecutionPlan;
+    }
+
+    public PolicyDefinition getPolicyDefinition() {
+        return policyDefinition;
+    }
+
+    public void setPolicyDefinition(PolicyDefinition policyDefinition) {
+        this.policyDefinition = policyDefinition;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6dbdb4f7/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidator.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/PolicyValidator.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidator.java
deleted file mode 100644
index aef6aa8..0000000
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidator.java
+++ /dev/null
@@ -1,124 +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
- * <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.service.metadata.resource;
-
-import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
-import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import org.apache.eagle.alert.engine.coordinator.StreamNotDefinedException;
-import org.apache.eagle.alert.engine.evaluator.impl.SiddhiDefinitionAdapter;
-import org.apache.eagle.alert.metadata.IMetadataDao;
-
-import com.google.common.base.Preconditions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.wso2.siddhi.core.ExecutionPlanRuntime;
-import org.wso2.siddhi.core.SiddhiManager;
-import org.wso2.siddhi.query.api.definition.AbstractDefinition;
-import org.wso2.siddhi.query.compiler.exception.SiddhiParserException;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class PolicyValidator {
-    private static final Logger LOG = LoggerFactory.getLogger(PolicyValidator.class);
-
-    public static PolicyValidation validate(PolicyDefinition policy, Map<String, StreamDefinition> allStreamDefinitions) {
-        PolicyValidation policyValidation = new PolicyValidation();
-        policyValidation.setPolicyDefinition(policy);
-
-        SiddhiManager siddhiManager = null;
-        ExecutionPlanRuntime executionRuntime = null;
-        String executionPlan = null;
-
-        try {
-            // Validate inputStreams are valid
-            Preconditions.checkNotNull(policy.getInputStreams(), "No inputStreams to connect from");
-            Map<String, StreamDefinition> currentDefinitions = new HashMap<>();
-            for (String streamId : policy.getInputStreams()) {
-                if (allStreamDefinitions.containsKey(streamId)) {
-                    currentDefinitions.put(streamId, allStreamDefinitions.get(streamId));
-                } else {
-                    throw new StreamNotDefinedException(streamId);
-                }
-            }
-
-            // Build final execution plan
-            executionPlan = SiddhiDefinitionAdapter.buildSiddhiExecutionPlan(policy, currentDefinitions);
-            siddhiManager = new SiddhiManager();
-            executionRuntime = siddhiManager.createExecutionPlanRuntime(executionPlan);
-
-            // Set current execution plan as valid
-            policyValidation.setValidExecutionPlan(executionPlan);
-
-            // Siddhi runtime active stream definitions
-            Map<String, AbstractDefinition> definitionMap = executionRuntime.getStreamDefinitionMap();
-
-            Map<String, StreamDefinition> validInputStreams = new HashMap<>();
-            Map<String, StreamDefinition> validOutputStreams = new HashMap<>();
-
-            for (Map.Entry<String, AbstractDefinition> entry : definitionMap.entrySet()) {
-                if (currentDefinitions.containsKey(entry.getKey())) {
-                    validInputStreams.put(entry.getKey(), currentDefinitions.get(entry.getKey()));
-                } else {
-                    validOutputStreams.put(entry.getKey(), SiddhiDefinitionAdapter.convertFromSiddiDefinition(entry.getValue()));
-                }
-            }
-            policyValidation.setValidInputStreams(validInputStreams);
-
-            // Validate outputStreams
-            policyValidation.setValidOutputStreams(validOutputStreams);
-            if (policy.getOutputStreams() != null) {
-                for (String outputStream : policy.getOutputStreams()) {
-                    if (!validOutputStreams.containsKey(outputStream)) {
-                        throw new StreamNotDefinedException("Output stream " + outputStream + " not defined");
-                    }
-                }
-            }
-
-            // TODO: Validate partitions
-
-            policyValidation.setSuccess(true);
-            policyValidation.setMessage("Validation success");
-        } catch (SiddhiParserException parserException) {
-            LOG.error("Got error to parse policy execution plan: \n{}", executionPlan, parserException);
-            policyValidation.setSuccess(false);
-            policyValidation.setMessage("Parser Error: " + parserException.getMessage());
-            policyValidation.setStackTrace(parserException);
-        } catch (Exception exception) {
-            LOG.error("Got Error to validate policy definition", exception);
-            policyValidation.setSuccess(false);
-            policyValidation.setMessage("Validation Error: " + exception.getMessage());
-            policyValidation.setStackTrace(exception);
-        } finally {
-            if (executionRuntime != null) {
-                executionRuntime.shutdown();
-            }
-            if (siddhiManager != null) {
-                siddhiManager.shutdown();
-            }
-        }
-        return policyValidation;
-    }
-
-    public static PolicyValidation validate(PolicyDefinition policy, IMetadataDao metadataDao) {
-        Map<String, StreamDefinition> allDefinitions = new HashMap<>();
-        for (StreamDefinition definition : metadataDao.listStreams()) {
-            allDefinitions.put(definition.getStreamId(), definition);
-        }
-        return validate(policy, allDefinitions);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6dbdb4f7/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/test/java/org/apache/eagle/service/metadata/resource/PolicyCompilerTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/test/java/org/apache/eagle/service/metadata/resource/PolicyCompilerTest.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/test/java/org/apache/eagle/service/metadata/resource/PolicyCompilerTest.java
new file mode 100644
index 0000000..682de4c
--- /dev/null
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/test/java/org/apache/eagle/service/metadata/resource/PolicyCompilerTest.java
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.service.metadata.resource;
+
+import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
+import org.apache.eagle.alert.engine.coordinator.StreamColumn;
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.*;
+
+public class PolicyCompilerTest {
+    @Test
+    public void parseFullPolicyQuery() throws Exception {
+        PolicyExecutionPlan executionPlan = PolicyCompiler.parseExecutionPlan("from HDFS_AUDIT_LOG_ENRICHED_STREAM_SANDBOX#window.timeBatch(2 min) "
+            + "select cmd, user, count() as total_count group by cmd,user insert into HDFS_AUDIT_LOG_ENRICHED_STREAM_SANDBOX_OUT");
+        Assert.assertEquals("HDFS_AUDIT_LOG_ENRICHED_STREAM_SANDBOX", executionPlan.getInputStreams().keySet().toArray()[0]);
+        Assert.assertEquals("HDFS_AUDIT_LOG_ENRICHED_STREAM_SANDBOX_OUT", executionPlan.getOutputStreams().keySet().toArray()[0]);
+    }
+
+    @Test
+    public void testValidPolicy() {
+        PolicyDefinition policyDefinition = new PolicyDefinition();
+        policyDefinition.setName("test_policy");
+        policyDefinition.setInputStreams(Collections.singletonList("INPUT_STREAM_1"));
+        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_1"));
+
+        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
+        definition.setType("siddhi");
+        definition.setValue("from INPUT_STREAM_1#window.timeBatch(2 min) select name, sum(value) as total group by name insert into OUTPUT_STREAM_1 ;");
+        definition.setInputStreams(policyDefinition.getInputStreams());
+        definition.setOutputStreams(policyDefinition.getOutputStreams());
+        policyDefinition.setDefinition(definition);
+
+        PolicyValidationResult validation = PolicyCompiler.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
+            {
+                put("INPUT_STREAM_1", createStreamDefinition("INPUT_STREAM_1"));
+                put("INPUT_STREAM_2", createStreamDefinition("INPUT_STREAM_2"));
+                put("INPUT_STREAM_3", createStreamDefinition("INPUT_STREAM_3"));
+                put("INPUT_STREAM_4", createStreamDefinition("INPUT_STREAM_4"));
+            }
+        });
+        Assert.assertTrue(validation.isSuccess());
+        Assert.assertEquals(1, validation.getPolicyExecutionPlan().getInputStreams().size());
+        Assert.assertEquals(1, validation.getPolicyExecutionPlan().getOutputStreams().size());
+    }
+
+    @Test
+    public void testValidPolicyWithTooManyInputStreams() {
+        PolicyDefinition policyDefinition = new PolicyDefinition();
+        policyDefinition.setName("test_policy");
+        policyDefinition.setInputStreams(Arrays.asList("INPUT_STREAM_1", "INPUT_STREAM_2"));
+        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_1"));
+
+        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
+        definition.setType("siddhi");
+        definition.setValue("from INPUT_STREAM_1[value > 90.0] select * group by name insert into OUTPUT_STREAM_1;");
+        definition.setInputStreams(policyDefinition.getInputStreams());
+        definition.setOutputStreams(policyDefinition.getOutputStreams());
+        policyDefinition.setDefinition(definition);
+
+        PolicyValidationResult validation = PolicyCompiler.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
+            {
+                put("INPUT_STREAM_1", createStreamDefinition("INPUT_STREAM_1"));
+                put("INPUT_STREAM_2", createStreamDefinition("INPUT_STREAM_2"));
+            }
+        });
+        Assert.assertTrue(validation.isSuccess());
+        Assert.assertEquals(1, validation.getPolicyExecutionPlan().getInputStreams().size());
+        Assert.assertEquals(1, validation.getPolicyExecutionPlan().getOutputStreams().size());
+    }
+
+    @Test
+    public void testValidPolicyWithTooFewOutputStreams() {
+        PolicyDefinition policyDefinition = new PolicyDefinition();
+        policyDefinition.setName("test_policy");
+        policyDefinition.setInputStreams(Arrays.asList("INPUT_STREAM_1", "INPUT_STREAM_2"));
+        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_1"));
+
+        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
+        definition.setType("siddhi");
+        definition.setValue(
+            "from INPUT_STREAM_1[value > 90.0] select * group by name insert into OUTPUT_STREAM_1;"
+                + "from INPUT_STREAM_1[value < 90.0] select * group by name insert into OUTPUT_STREAM_2;"
+        );
+        definition.setInputStreams(policyDefinition.getInputStreams());
+        definition.setOutputStreams(policyDefinition.getOutputStreams());
+        policyDefinition.setDefinition(definition);
+
+        PolicyValidationResult validation = PolicyCompiler.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
+            {
+                put("INPUT_STREAM_1", createStreamDefinition("INPUT_STREAM_1"));
+                put("INPUT_STREAM_2", createStreamDefinition("INPUT_STREAM_2"));
+            }
+        });
+        Assert.assertTrue(validation.isSuccess());
+        Assert.assertEquals(1, validation.getPolicyExecutionPlan().getInputStreams().size());
+        Assert.assertEquals(2, validation.getPolicyExecutionPlan().getOutputStreams().size());
+    }
+
+    @Test
+    public void testInvalidPolicyForSyntaxError() {
+        PolicyDefinition policyDefinition = new PolicyDefinition();
+        policyDefinition.setName("test_policy");
+        policyDefinition.setInputStreams(Collections.singletonList("INPUT_STREAM"));
+        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM"));
+
+        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
+        definition.setType("siddhi");
+        definition.setValue("from INPUT_STREAM (value > 90.0) select * group by name insert into OUTPUT_STREAM;");
+        definition.setInputStreams(policyDefinition.getInputStreams());
+        definition.setOutputStreams(policyDefinition.getOutputStreams());
+        policyDefinition.setDefinition(definition);
+
+        PolicyValidationResult validation = PolicyCompiler.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
+            {
+                put("INPUT_STREAM", createStreamDefinition("INPUT_STREAM"));
+            }
+        });
+        Assert.assertFalse(validation.isSuccess());
+    }
+
+    @Test
+    public void testInvalidPolicyForNotDefinedInputStream() {
+        PolicyDefinition policyDefinition = new PolicyDefinition();
+        policyDefinition.setName("test_policy");
+        policyDefinition.setInputStreams(Collections.singletonList("INPUT_STREAM_1"));
+        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_1"));
+
+        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
+        definition.setType("siddhi");
+        definition.setValue("from INPUT_STREAM_1[value > 90.0] select * group by name insert into OUTPUT_STREAM_1;");
+        definition.setInputStreams(policyDefinition.getInputStreams());
+        definition.setOutputStreams(policyDefinition.getOutputStreams());
+        policyDefinition.setDefinition(definition);
+
+        PolicyValidationResult validation = PolicyCompiler.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
+            {
+                put("INPUT_STREAM_2", createStreamDefinition("INPUT_STREAM_2"));
+            }
+        });
+        Assert.assertFalse(validation.isSuccess());
+    }
+
+    @Test
+    public void testInvalidPolicyForNotDefinedOutputStream() {
+        PolicyDefinition policyDefinition = new PolicyDefinition();
+        policyDefinition.setName("test_policy");
+        policyDefinition.setInputStreams(Collections.singletonList("INPUT_STREAM_1"));
+        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_2"));
+
+        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
+        definition.setType("siddhi");
+        definition.setValue("from INPUT_STREAM_1[value > 90.0] select * group by name insert into OUTPUT_STREAM_1;");
+        definition.setInputStreams(policyDefinition.getInputStreams());
+        definition.setOutputStreams(policyDefinition.getOutputStreams());
+        policyDefinition.setDefinition(definition);
+
+        PolicyValidationResult validation = PolicyCompiler.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
+            {
+                put("INPUT_STREAM_1", createStreamDefinition("INPUT_STREAM_1"));
+            }
+        });
+        Assert.assertFalse(validation.isSuccess());
+    }
+
+    // --------------
+    // Helper Methods
+    // --------------
+
+    private static StreamDefinition createStreamDefinition(String streamId) {
+        StreamDefinition streamDefinition = new StreamDefinition();
+        streamDefinition.setStreamId(streamId);
+        List<StreamColumn> columns = new ArrayList<>();
+        columns.add(new StreamColumn.Builder().name("name").type(StreamColumn.Type.STRING).build());
+        columns.add(new StreamColumn.Builder().name("value").type(StreamColumn.Type.DOUBLE).build());
+        streamDefinition.setColumns(columns);
+        return streamDefinition;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6dbdb4f7/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/test/java/org/apache/eagle/service/metadata/resource/PolicyValidatorTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/test/java/org/apache/eagle/service/metadata/resource/PolicyValidatorTest.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/test/java/org/apache/eagle/service/metadata/resource/PolicyValidatorTest.java
deleted file mode 100644
index b9a1b23..0000000
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/test/java/org/apache/eagle/service/metadata/resource/PolicyValidatorTest.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * <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.service.metadata.resource;
-
-import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
-import org.apache.eagle.alert.engine.coordinator.StreamColumn;
-import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.*;
-
-public class PolicyValidatorTest {
-    @Test
-    public void testValidPolicy() {
-        PolicyDefinition policyDefinition = new PolicyDefinition();
-        policyDefinition.setName("test_policy");
-        policyDefinition.setInputStreams(Collections.singletonList("INPUT_STREAM_1"));
-        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_1"));
-
-        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
-        definition.setType("siddhi");
-        definition.setValue("from INPUT_STREAM_1[value > 90.0] select * group by name insert into OUTPUT_STREAM_1;");
-        definition.setInputStreams(policyDefinition.getInputStreams());
-        definition.setOutputStreams(policyDefinition.getOutputStreams());
-        policyDefinition.setDefinition(definition);
-
-        PolicyValidation validation = PolicyValidator.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
-            {
-                put("INPUT_STREAM_1", createStreamDefinition("INPUT_STREAM_1"));
-                put("INPUT_STREAM_2", createStreamDefinition("INPUT_STREAM_2"));
-                put("INPUT_STREAM_3", createStreamDefinition("INPUT_STREAM_3"));
-                put("INPUT_STREAM_4", createStreamDefinition("INPUT_STREAM_4"));
-            }
-        });
-        Assert.assertTrue(validation.isSuccess());
-        Assert.assertEquals(1, validation.getValidInputStreams().size());
-        Assert.assertEquals(1, validation.getValidOutputStreams().size());
-    }
-
-    @Test
-    public void testValidPolicyWithTooManyInputStreams() {
-        PolicyDefinition policyDefinition = new PolicyDefinition();
-        policyDefinition.setName("test_policy");
-        policyDefinition.setInputStreams(Arrays.asList("INPUT_STREAM_1", "INPUT_STREAM_2"));
-        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_1"));
-
-        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
-        definition.setType("siddhi");
-        definition.setValue("from INPUT_STREAM_1[value > 90.0] select * group by name insert into OUTPUT_STREAM_1;");
-        definition.setInputStreams(policyDefinition.getInputStreams());
-        definition.setOutputStreams(policyDefinition.getOutputStreams());
-        policyDefinition.setDefinition(definition);
-
-        PolicyValidation validation = PolicyValidator.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
-            {
-                put("INPUT_STREAM_1", createStreamDefinition("INPUT_STREAM_1"));
-                put("INPUT_STREAM_2", createStreamDefinition("INPUT_STREAM_2"));
-            }
-        });
-        Assert.assertTrue(validation.isSuccess());
-        Assert.assertEquals(2, validation.getValidInputStreams().size());
-        Assert.assertEquals(1, validation.getValidOutputStreams().size());
-    }
-
-    @Test
-    public void testValidPolicyWithTooFewOutputStreams() {
-        PolicyDefinition policyDefinition = new PolicyDefinition();
-        policyDefinition.setName("test_policy");
-        policyDefinition.setInputStreams(Arrays.asList("INPUT_STREAM_1", "INPUT_STREAM_2"));
-        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_1"));
-
-        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
-        definition.setType("siddhi");
-        definition.setValue(
-            "from INPUT_STREAM_1[value > 90.0] select * group by name insert into OUTPUT_STREAM_1;"
-                + "from INPUT_STREAM_1[value < 90.0] select * group by name insert into OUTPUT_STREAM_2;"
-        );
-        definition.setInputStreams(policyDefinition.getInputStreams());
-        definition.setOutputStreams(policyDefinition.getOutputStreams());
-        policyDefinition.setDefinition(definition);
-
-        PolicyValidation validation = PolicyValidator.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
-            {
-                put("INPUT_STREAM_1", createStreamDefinition("INPUT_STREAM_1"));
-                put("INPUT_STREAM_2", createStreamDefinition("INPUT_STREAM_2"));
-            }
-        });
-        Assert.assertTrue(validation.isSuccess());
-        Assert.assertEquals(2, validation.getValidInputStreams().size());
-        Assert.assertEquals(2, validation.getValidOutputStreams().size());
-    }
-
-    @Test
-    public void testInvalidPolicyForSyntaxError() {
-        PolicyDefinition policyDefinition = new PolicyDefinition();
-        policyDefinition.setName("test_policy");
-        policyDefinition.setInputStreams(Collections.singletonList("INPUT_STREAM"));
-        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM"));
-
-        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
-        definition.setType("siddhi");
-        definition.setValue("from INPUT_STREAM (value > 90.0) select * group by name insert into OUTPUT_STREAM;");
-        definition.setInputStreams(policyDefinition.getInputStreams());
-        definition.setOutputStreams(policyDefinition.getOutputStreams());
-        policyDefinition.setDefinition(definition);
-
-        PolicyValidation validation = PolicyValidator.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
-            {
-                put("INPUT_STREAM", createStreamDefinition("INPUT_STREAM"));
-            }
-        });
-        Assert.assertFalse(validation.isSuccess());
-    }
-
-    @Test
-    public void testInvalidPolicyForNotDefinedInputStream() {
-        PolicyDefinition policyDefinition = new PolicyDefinition();
-        policyDefinition.setName("test_policy");
-        policyDefinition.setInputStreams(Collections.singletonList("INPUT_STREAM_1"));
-        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_1"));
-
-        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
-        definition.setType("siddhi");
-        definition.setValue("from INPUT_STREAM_1[value > 90.0] select * group by name insert into OUTPUT_STREAM_1;");
-        definition.setInputStreams(policyDefinition.getInputStreams());
-        definition.setOutputStreams(policyDefinition.getOutputStreams());
-        policyDefinition.setDefinition(definition);
-
-        PolicyValidation validation = PolicyValidator.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
-            {
-                put("INPUT_STREAM_2", createStreamDefinition("INPUT_STREAM_2"));
-            }
-        });
-        Assert.assertFalse(validation.isSuccess());
-    }
-
-    @Test
-    public void testInvalidPolicyForNotDefinedOutputStream() {
-        PolicyDefinition policyDefinition = new PolicyDefinition();
-        policyDefinition.setName("test_policy");
-        policyDefinition.setInputStreams(Collections.singletonList("INPUT_STREAM_1"));
-        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_2"));
-
-        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
-        definition.setType("siddhi");
-        definition.setValue("from INPUT_STREAM_1[value > 90.0] select * group by name insert into OUTPUT_STREAM_1;");
-        definition.setInputStreams(policyDefinition.getInputStreams());
-        definition.setOutputStreams(policyDefinition.getOutputStreams());
-        policyDefinition.setDefinition(definition);
-
-        PolicyValidation validation = PolicyValidator.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
-            {
-                put("INPUT_STREAM_1", createStreamDefinition("INPUT_STREAM_1"));
-            }
-        });
-        Assert.assertFalse(validation.isSuccess());
-    }
-
-    // --------------
-    // Helper Methods
-    // --------------
-
-    private static StreamDefinition createStreamDefinition(String streamId) {
-        StreamDefinition streamDefinition = new StreamDefinition();
-        streamDefinition.setStreamId(streamId);
-        List<StreamColumn> columns = new ArrayList<>();
-        columns.add(new StreamColumn.Builder().name("name").type(StreamColumn.Type.STRING).build());
-        columns.add(new StreamColumn.Builder().name("value").type(StreamColumn.Type.DOUBLE).build());
-        streamDefinition.setColumns(columns);
-        return streamDefinition;
-    }
-}
\ No newline at end of file


[45/50] incubator-eagle git commit: [CI] Integrate coveralls to track eagle code coverage

Posted by ha...@apache.org.
[CI] Integrate coveralls to track eagle code coverage

## CI Building Command

    mvn clean test cobertura:cobertura coveralls:report -DrepoToken=$COVERALLS_EAGLE_TOKEN

Get repoToken and check report at https://coveralls.io/github/apache/incubator-eagle

Author: Hao Chen <ha...@apache.org>
Author: Hao Chen <ha...@users.noreply.github.com>

Closes #523 from haoch/integrate_coveralls.


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

Branch: refs/heads/master
Commit: 310935d27d8be8dd12f246ceceba958c1005e2e9
Parents: a781937
Author: Hao Chen <ha...@apache.org>
Authored: Tue Oct 18 16:44:17 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Tue Oct 18 16:44:17 2016 +0800

----------------------------------------------------------------------
 .gitattributes                                  | 53 ++++++++++++++++++++
 README.md                                       |  4 +-
 .../eagle-alert/alert-coordinator/pom.xml       | 16 ------
 .../eagle/service/hbase/EmbeddedHbaseTest.java  |  2 +-
 eagle-dev/ci-build.sh                           | 31 ++++++++++++
 eagle-dev/ci-log4j.properties                   | 22 ++++++++
 pom.xml                                         | 28 +++++++++++
 7 files changed, 137 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/310935d2/.gitattributes
----------------------------------------------------------------------
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..1bb92d0
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT 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 https://github.com/alexkaratarakis/gitattributes/raw/master/Java.gitattributes
+
+# Handle line endings automatically for files detected as text
+# and leave all files detected as binary untouched.
+* text=auto
+
+#
+# The above will handle all files NOT found below
+#
+# These files are text and should be normalized (Convert crlf => lf)
+*.css           text
+*.df            text
+*.htm           text
+*.html          text
+*.java          text
+*.js            text
+*.json          text
+*.jsp           text
+*.jspf          text
+*.properties    text
+*.sh            text
+*.tld           text
+*.txt           text
+*.xml           text
+
+# These files are binary and should be left untouched
+# (binary is a macro for -text -diff)
+*.class         binary
+*.dll           binary
+*.ear           binary
+*.gif           binary
+*.ico           binary
+*.jar           binary
+*.jpg           binary
+*.jpeg          binary
+*.png           binary
+*.so            binary
+*.war           binary
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/310935d2/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 77fc93c..49be553 100755
--- a/README.md
+++ b/README.md
@@ -30,9 +30,9 @@ For more details, please visit [https://eagle.incubator.apache.org](https://eagl
 ## Status
 
 ### Branches
-| name | status | version | description |
+| name | build | coverage | description |
 | :---:| :---: | :---: | :--- |
-| **master** | [![Build Status](https://builds.apache.org/buildStatus/icon?job=incubator-eagle-main)](https://builds.apache.org/job/incubator-eagle-main/) | 0.5.0-incubating-SNAPSHOT | Branch for continuous development. |
+| [**master**](https://github.com/apache/incubator-eagle/tree/master) | [![Build Status](https://builds.apache.org/buildStatus/icon?job=incubator-eagle-main)](https://builds.apache.org/job/incubator-eagle-main/) | [![Coverage Status](https://coveralls.io/repos/github/apache/incubator-eagle/badge.svg)](https://coveralls.io/github/apache/incubator-eagle) | 0.5.0-incubating-SNAPSHOT | Branch for continuous development. |
 
 ### Latest Release
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/310935d2/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/pom.xml b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/pom.xml
index 772d602..64df39f 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/pom.xml
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/pom.xml
@@ -49,18 +49,6 @@
             <groupId>com.sun.jersey.contribs</groupId>
             <artifactId>jersey-multipart</artifactId>
         </dependency>
-        <!--<dependency>-->
-        <!--<groupId>org.codehaus.jackson</groupId>-->
-        <!--<artifactId>jackson-mapper-asl</artifactId>-->
-        <!--</dependency>-->
-        <!--<dependency>-->
-        <!--<groupId>org.codehaus.jackson</groupId>-->
-        <!--<artifactId>jackson-jaxrs</artifactId>-->
-        <!--</dependency>-->
-        <!--<dependency>-->
-        <!--<groupId>org.codehaus.jackson</groupId>-->
-        <!--<artifactId>jackson-xc</artifactId>-->
-        <!--</dependency>-->
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
@@ -81,10 +69,6 @@
             <groupId>org.wso2.siddhi</groupId>
             <artifactId>siddhi-core</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.wso2.siddhi</groupId>
-            <artifactId>siddhi-core</artifactId>
-        </dependency>
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/310935d2/eagle-core/eagle-embed/eagle-embed-hbase/src/test/java/org/apache/eagle/service/hbase/EmbeddedHbaseTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-embed/eagle-embed-hbase/src/test/java/org/apache/eagle/service/hbase/EmbeddedHbaseTest.java b/eagle-core/eagle-embed/eagle-embed-hbase/src/test/java/org/apache/eagle/service/hbase/EmbeddedHbaseTest.java
index dc7843d..0330eee 100644
--- a/eagle-core/eagle-embed/eagle-embed-hbase/src/test/java/org/apache/eagle/service/hbase/EmbeddedHbaseTest.java
+++ b/eagle-core/eagle-embed/eagle-embed-hbase/src/test/java/org/apache/eagle/service/hbase/EmbeddedHbaseTest.java
@@ -21,6 +21,6 @@ import org.junit.Test;
 public class EmbeddedHbaseTest extends TestHBaseBase {
     @Test
     public void testHBaseCreateTable() {
-        hbase.createTable("test_hbase_table","f");
+        // hbase.createTable("test_hbase_table","f");
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/310935d2/eagle-dev/ci-build.sh
----------------------------------------------------------------------
diff --git a/eagle-dev/ci-build.sh b/eagle-dev/ci-build.sh
new file mode 100755
index 0000000..64acc07
--- /dev/null
+++ b/eagle-dev/ci-build.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Continuous Integration
+# Go to eagle project root directory
+
+cd "$(dirname $0)/../"
+
+# Check whether COVERALLS_EAGLE_TOKEN is set
+if [ -z "$COVERALLS_EAGLE_TOKEN" ];then
+    echo "Error: COVERALLS_EAGLE_TOKEN is not set, get token from https://coveralls.io/github/apache/incubator-eagle" 1>&2
+    exit 1
+fi
+
+# build and report to coveralls
+mvn clean test cobertura:cobertura coveralls:report -DrepoToken=$COVERALLS_EAGLE_TOKEN -Dmaven.javadoc.skip=true -P!ui
+echo "Check report at https://coveralls.io/github/apache/incubator-eagle"

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/310935d2/eagle-dev/ci-log4j.properties
----------------------------------------------------------------------
diff --git a/eagle-dev/ci-log4j.properties b/eagle-dev/ci-log4j.properties
new file mode 100644
index 0000000..a01759a
--- /dev/null
+++ b/eagle-dev/ci-log4j.properties
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT 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.debug=false
+
+log4j.rootLogger=OFF, console
+
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/310935d2/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6dc1d6c..ae97bb3 100755
--- a/pom.xml
+++ b/pom.xml
@@ -167,6 +167,8 @@
         <maven-failsafe.version>2.6</maven-failsafe.version>
         <maven-checkstyle.version>2.17</maven-checkstyle.version>
         <checkstyle.version>7.1</checkstyle.version>
+        <cobertura-maven.version>2.7</cobertura-maven.version>
+        <coveralls-maven.version>4.3.0</coveralls-maven.version>
 
         <!-- Environment Versions-->
         <thrift.version>0.9.2</thrift.version>
@@ -1141,6 +1143,32 @@
                     <artifactId>scalatest-maven-plugin</artifactId>
                     <version>${maven-scalatest.version}</version>
                 </plugin>
+
+                <!-- CMD: mvn clean cobertura:cobertura coveralls:report -DrepoToken=$COVERALLS_EAGLE_TOKEN -->
+                <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>cobertura-maven-plugin</artifactId>
+                    <version>${cobertura-maven.version}</version>
+                    <configuration>
+                        <format>xml</format>
+                        <maxmem>256m</maxmem>
+                        <!-- aggregated reports for multi-module projects -->
+                        <aggregate>true</aggregate>
+                    </configuration>
+                    <dependencies>
+                        <!--Use asm-5.0 to support Java 8-->
+                        <dependency>
+                            <groupId>org.ow2.asm</groupId>
+                            <artifactId>asm</artifactId>
+                            <version>5.0.3</version>
+                        </dependency>
+                    </dependencies>
+                </plugin>
+                <plugin>
+                    <groupId>org.eluder.coveralls</groupId>
+                    <artifactId>coveralls-maven-plugin</artifactId>
+                    <version>${coveralls-maven.version}</version>
+                </plugin>
             </plugins>
         </pluginManagement>
         <plugins>


[36/50] incubator-eagle git commit: [EAGLE-621] set authentication disabled by default when no 'auth' is configured

Posted by ha...@apache.org.
[EAGLE-621] set authentication disabled by default when no 'auth' is configured

Authentication settings are configured in configuration.yml file, starting with "auth" syntax. Now make the system see authentication as disabled when no auth related syntax is set.

Also, do some refactoring to make the code clearer.

Author: anyway1021 <mw...@apache.org>

Closes #514 from anyway1021/EAGLE-621.


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

Branch: refs/heads/master
Commit: b103e201ebe7b1500ba3d0297bb7aa88e7aa811a
Parents: 33b9720
Author: anyway1021 <mw...@apache.org>
Authored: Mon Oct 17 10:44:36 2016 +0800
Committer: anyway1021 <mw...@apache.org>
Committed: Mon Oct 17 10:44:36 2016 +0800

----------------------------------------------------------------------
 .../apache/eagle/server/ServerApplication.java  |   8 +-
 .../authentication/AuthenticationMode.java      |  51 ---------
 .../AuthenticationModeIdentifier.java           | 105 -------------------
 .../authentication/AuthenticationRegister.java  |  41 --------
 .../BasicAuthProviderBuilder.java               |  66 ++++++++++++
 .../SwitchableBasicAuthProvider.java            |  50 ---------
 .../AbstractSwitchableAuthenticator.java        |  48 ---------
 .../authenticator/LdapBasicAuthenticator.java   |  11 +-
 .../authenticator/SimpleBasicAuthenticator.java |  12 +--
 9 files changed, 82 insertions(+), 310 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/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
index 2ae95a6..df1d7e7 100644
--- a/eagle-server/src/main/java/org/apache/eagle/server/ServerApplication.java
+++ b/eagle-server/src/main/java/org/apache/eagle/server/ServerApplication.java
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 package org.apache.eagle.server;
+
 import com.google.inject.Injector;
 import com.hubspot.dropwizard.guice.GuiceBundle;
 import com.sun.jersey.api.core.PackagesResourceConfig;
@@ -27,11 +28,10 @@ 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.common.authentication.User;
 import org.apache.eagle.log.base.taggedlog.EntityJsonModule;
 import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
 import org.apache.eagle.metadata.service.ApplicationStatusUpdateService;
-import org.apache.eagle.server.authentication.AuthenticationRegister;
+import org.apache.eagle.server.authentication.BasicAuthProviderBuilder;
 import org.apache.eagle.server.managedtask.ApplicationTask;
 import org.apache.eagle.server.module.GuiceBundleLoader;
 
@@ -80,8 +80,8 @@ class ServerApplication extends Application<ServerConfig> {
         environment.servlets().addFilter(SimpleCORSFiler.class.getName(), new SimpleCORSFiler())
             .addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/*");
 
-        // add authentication filters
-        new AuthenticationRegister<>(configuration, environment, User.class).register();
+        // register authentication provider
+        environment.jersey().register(new BasicAuthProviderBuilder(configuration.getAuth(), environment).build());
 
         // context listener
         environment.servlets().addServletListeners(new CoordinatorListener());

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationMode.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationMode.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationMode.java
deleted file mode 100644
index 8a7208f..0000000
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationMode.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.server.authentication;
-
-import io.dropwizard.auth.Authenticator;
-import io.dropwizard.auth.CachingAuthenticator;
-import io.dropwizard.auth.basic.BasicCredentials;
-
-public abstract class AuthenticationMode<P> {
-    private static final String PREFIX_VALUE = "Basic";
-
-    protected AuthenticationModeIdentifier identifier = null;
-
-    private Authenticator<BasicCredentials, P> authenticator = null;
-
-    public AuthenticationMode(AuthenticationModeIdentifier identifier) {
-        this.identifier = identifier;
-        this.authenticator = createAuthenticator();
-    }
-
-    abstract Authenticator<BasicCredentials, P> createAuthenticator();
-
-    abstract String getRealm();
-
-    Authenticator<BasicCredentials, P> getAuthenticator() {
-        return identifier.cacheRequired() ? cache(authenticator) : authenticator;
-    }
-
-    private Authenticator<BasicCredentials, P> cache(Authenticator<BasicCredentials, P> authenticator) {
-        return new CachingAuthenticator<BasicCredentials, P>(identifier.getMetricRegistry(), authenticator, identifier.getCacheBuilderSpec());
-    }
-
-    AuthenticationModeIdentifier getIdentifier() {
-        return identifier;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationModeIdentifier.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationModeIdentifier.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationModeIdentifier.java
deleted file mode 100644
index 979bcbf..0000000
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationModeIdentifier.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.server.authentication;
-
-import com.codahale.metrics.MetricRegistry;
-import com.google.common.cache.CacheBuilderSpec;
-import io.dropwizard.auth.Authenticator;
-import io.dropwizard.auth.basic.BasicCredentials;
-import io.dropwizard.setup.Environment;
-import org.apache.eagle.common.authentication.User;
-import org.apache.eagle.server.authentication.authenticator.LdapBasicAuthenticator;
-import org.apache.eagle.server.authentication.authenticator.SimpleBasicAuthenticator;
-import org.apache.eagle.server.authentication.config.AuthenticationSettings;
-
-public class AuthenticationModeIdentifier {
-    private static final String SIMPLE_MODE_KEYWORD = "simple";
-    private static final String SIMPLE_MODE_REALM = "SIMPLE_AUTHENTICATION";
-    private static final String LDAP_MODE_KEYWORD = "ldap";
-    private static final String LDAP_MODE_REALM = "LDAP_AUTHENTICATION";
-
-    private AuthenticationSettings settings = null;
-    private Environment environment = null;
-
-    private AuthenticationModeIdentifier(AuthenticationSettings settings, Environment environment) {
-        this.settings = settings;
-        this.environment = environment;
-    }
-
-    static AuthenticationModeIdentifier initiate(AuthenticationSettings config, Environment environment) {
-        return new AuthenticationModeIdentifier(config, environment);
-    }
-
-    AuthenticationMode<User> identify() {
-        String modeKeyword = getModeKeyword();
-        if (SIMPLE_MODE_KEYWORD.equalsIgnoreCase(modeKeyword)) {
-            return new AuthenticationMode<User>(this) {
-                public Authenticator<BasicCredentials, User> createAuthenticator() {
-                    return new SimpleBasicAuthenticator(getIdentifier().getSettings());
-                }
-
-                public String getRealm() {
-                    return AuthenticationModeIdentifier.SIMPLE_MODE_REALM;
-                }
-            };
-        }
-        if (LDAP_MODE_KEYWORD.equalsIgnoreCase(modeKeyword)) {
-            return new AuthenticationMode<User>(this) {
-                public Authenticator<BasicCredentials, User> createAuthenticator() {
-                    return new LdapBasicAuthenticator(getIdentifier().getSettings());
-                }
-
-                public String getRealm() {
-                    return AuthenticationModeIdentifier.LDAP_MODE_REALM;
-                }
-            };
-        }
-        throw new RuntimeException(String.format("No matching mode can be found: %s", modeKeyword));
-    }
-
-    MetricRegistry getMetricRegistry() {
-        return environment.metrics();
-    }
-
-    boolean cacheRequired() {
-        return settings.needsCaching();
-    }
-
-    boolean authorizationRequired() {
-        return settings.needsAuthorization();
-    }
-
-    boolean parameterAnnotationEnabled() {
-        return settings.byAnnotated();
-    }
-
-    CacheBuilderSpec getCacheBuilderSpec() {
-        return CacheBuilderSpec.parse(settings.getCachePolicy());
-    }
-
-    AuthenticationSettings getSettings() {
-        return settings;
-    }
-
-    private Environment getEnvironment() {
-        return environment;
-    }
-
-    private String getModeKeyword() {
-        return settings.getMode();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationRegister.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationRegister.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationRegister.java
deleted file mode 100644
index 65d2171..0000000
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationRegister.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.server.authentication;
-
-import io.dropwizard.setup.Environment;
-import org.apache.eagle.common.authentication.User;
-import org.apache.eagle.server.ServerConfig;
-
-import java.security.Principal;
-
-public class AuthenticationRegister<P extends Principal> {
-    private ServerConfig serverConfig = null;
-    private Environment environment = null;
-    private Class<P> principalClass = null;
-
-    public AuthenticationRegister(ServerConfig serverConfig, Environment environment, Class<P> principalClass) {
-        this.serverConfig = serverConfig;
-        this.environment = environment;
-        this.principalClass = principalClass;
-    }
-
-    public void register() {
-        AuthenticationMode<User> mode = AuthenticationModeIdentifier.initiate(serverConfig.getAuth(), environment).identify();
-
-        environment.jersey().register(new SwitchableBasicAuthProvider(mode.getAuthenticator(), mode.getRealm()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/BasicAuthProviderBuilder.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/BasicAuthProviderBuilder.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/BasicAuthProviderBuilder.java
new file mode 100644
index 0000000..e0bb4c1
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/BasicAuthProviderBuilder.java
@@ -0,0 +1,66 @@
+package org.apache.eagle.server.authentication;
+
+import com.google.common.cache.CacheBuilderSpec;
+import com.sun.jersey.api.core.HttpContext;
+import com.sun.jersey.api.model.Parameter;
+import com.sun.jersey.core.spi.component.ComponentContext;
+import com.sun.jersey.server.impl.inject.AbstractHttpContextInjectable;
+import com.sun.jersey.spi.inject.Injectable;
+import io.dropwizard.auth.Auth;
+import io.dropwizard.auth.Authenticator;
+import io.dropwizard.auth.CachingAuthenticator;
+import io.dropwizard.auth.basic.BasicAuthProvider;
+import io.dropwizard.auth.basic.BasicCredentials;
+import io.dropwizard.setup.Environment;
+import org.apache.eagle.common.authentication.User;
+import org.apache.eagle.server.authentication.authenticator.LdapBasicAuthenticator;
+import org.apache.eagle.server.authentication.authenticator.SimpleBasicAuthenticator;
+import org.apache.eagle.server.authentication.config.AuthenticationSettings;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class BasicAuthProviderBuilder {
+    private static final String SIMPLE_MODE_REALM = "SIMPLE_AUTHENTICATION";
+    private static final String LDAP_MODE_REALM = "LDAP_AUTHENTICATION";
+    private static final Map<String, BasicAuthProvider<User>> MAPPING = new HashMap<>();
+    private AuthenticationSettings authSettings;
+    private Environment environment;
+
+    public BasicAuthProviderBuilder(AuthenticationSettings authSettings, Environment environment) {
+        this.authSettings = authSettings;
+        this.environment = environment;
+        Authenticator<BasicCredentials, User> simpleAuthenticator = new SimpleBasicAuthenticator(authSettings.getSimple());
+        Authenticator<BasicCredentials, User> ldapAuthenticator = new LdapBasicAuthenticator(authSettings.getLdap());
+        boolean needsCaching = authSettings.needsCaching();
+        MAPPING.put("simple",
+                new BasicAuthProvider<>(needsCaching ? cache(simpleAuthenticator) : simpleAuthenticator, SIMPLE_MODE_REALM));
+        MAPPING.put("ldap",
+                new BasicAuthProvider<>(needsCaching ? cache(ldapAuthenticator) : ldapAuthenticator, LDAP_MODE_REALM));
+    }
+
+    public BasicAuthProvider build() {
+        if (authSettings.isEnabled()) {
+            String mode = authSettings.getMode();
+            if (MAPPING.containsKey(mode)) {
+                return MAPPING.get(mode);
+            } else {
+                throw new RuntimeException(String.format("No matching mode found: %s", mode));
+            }
+        } else {
+            return new BasicAuthProvider<User>(null, "") {
+                public Injectable<?> getInjectable(ComponentContext ic, Auth a, Parameter c) {
+                    return new AbstractHttpContextInjectable<User>() {
+                        public User getValue(HttpContext c) {
+                            return new User("non-auth");
+                        }
+                    };
+                }
+            };
+        }
+    }
+
+    private Authenticator<BasicCredentials, User> cache(Authenticator<BasicCredentials, User> authenticator) {
+        return new CachingAuthenticator<>(environment.metrics(), authenticator, CacheBuilderSpec.parse(authSettings.getCachePolicy()));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/SwitchableBasicAuthProvider.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/SwitchableBasicAuthProvider.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/SwitchableBasicAuthProvider.java
deleted file mode 100644
index 74f286d..0000000
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/SwitchableBasicAuthProvider.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.server.authentication;
-
-import com.sun.jersey.api.core.HttpContext;
-import com.sun.jersey.api.model.Parameter;
-import com.sun.jersey.core.spi.component.ComponentContext;
-import com.sun.jersey.server.impl.inject.AbstractHttpContextInjectable;
-import com.sun.jersey.spi.inject.Injectable;
-import io.dropwizard.auth.Auth;
-import io.dropwizard.auth.Authenticator;
-import io.dropwizard.auth.basic.BasicAuthProvider;
-import io.dropwizard.auth.basic.BasicCredentials;
-import org.apache.eagle.server.authentication.authenticator.AbstractSwitchableAuthenticator;
-
-public class SwitchableBasicAuthProvider<P> extends BasicAuthProvider<P> {
-    private AbstractSwitchableAuthenticator<BasicCredentials, P> switchableAuthenticator = null;
-
-    public SwitchableBasicAuthProvider(Authenticator<BasicCredentials, P> authenticator, String realm) {
-        super(authenticator, realm);
-        if (authenticator instanceof AbstractSwitchableAuthenticator) {
-            switchableAuthenticator = (AbstractSwitchableAuthenticator<BasicCredentials, P>) authenticator;
-        }
-    }
-
-    public Injectable<?> getInjectable(ComponentContext ic, Auth a, Parameter c) {
-        if (switchableAuthenticator != null && !switchableAuthenticator.getSettings().isEnabled()) {
-            return new AbstractHttpContextInjectable<P>() {
-                public P getValue(HttpContext c) {
-                    return switchableAuthenticator.getUnauthenticatedPrincipal();
-                }
-            };
-        }
-        return super.getInjectable(ic, a, c);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/AbstractSwitchableAuthenticator.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/AbstractSwitchableAuthenticator.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/AbstractSwitchableAuthenticator.java
deleted file mode 100644
index 5ca12fb..0000000
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/AbstractSwitchableAuthenticator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.server.authentication.authenticator;
-
-import io.dropwizard.auth.Authenticator;
-import org.apache.eagle.server.authentication.config.AuthenticationSettings;
-
-public abstract class AbstractSwitchableAuthenticator<C, P> implements Authenticator<C, P> {
-    private AuthenticationSettings settings;
-    private Class<P> principalClass;
-    private P unauthenticatedPrincipal;
-
-    public AbstractSwitchableAuthenticator(AuthenticationSettings settings, Class<P> principalClass) {
-        this.settings = settings;
-        this.principalClass = principalClass;
-    }
-
-    public AuthenticationSettings getSettings() {
-        return settings;
-    }
-
-    public P getUnauthenticatedPrincipal() {
-        try {
-            if (unauthenticatedPrincipal == null) {
-                unauthenticatedPrincipal = principalClass.newInstance();
-            }
-            return unauthenticatedPrincipal;
-        } catch (InstantiationException e) {
-            throw new RuntimeException(String.format("Filed to instantiate %s", principalClass.getName()), e);
-        } catch (IllegalAccessException e) {
-            throw new RuntimeException(String.format("Illegal access to %s", principalClass.getName()), e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/LdapBasicAuthenticator.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/LdapBasicAuthenticator.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/LdapBasicAuthenticator.java
index 59abc52..87ebb34 100644
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/LdapBasicAuthenticator.java
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/LdapBasicAuthenticator.java
@@ -18,15 +18,16 @@ package org.apache.eagle.server.authentication.authenticator;
 
 import com.google.common.base.Optional;
 import io.dropwizard.auth.AuthenticationException;
+import io.dropwizard.auth.Authenticator;
 import io.dropwizard.auth.basic.BasicCredentials;
 import org.apache.eagle.common.authentication.User;
-import org.apache.eagle.server.authentication.config.AuthenticationSettings;
+import org.apache.eagle.server.authentication.config.LdapSettings;
 
-public class LdapBasicAuthenticator extends AbstractSwitchableAuthenticator<BasicCredentials, User> {
-    private AuthenticationSettings config = null;
+public class LdapBasicAuthenticator implements Authenticator<BasicCredentials, User> {
+    private LdapSettings settings = null;
 
-    public LdapBasicAuthenticator(AuthenticationSettings settings) {
-        super(settings, User.class);
+    public LdapBasicAuthenticator(LdapSettings settings) {
+        this.settings = settings;
     }
 
     public Optional<User> authenticate(BasicCredentials credentials) throws AuthenticationException {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/SimpleBasicAuthenticator.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/SimpleBasicAuthenticator.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/SimpleBasicAuthenticator.java
index 910bc92..ede3b06 100644
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/SimpleBasicAuthenticator.java
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/SimpleBasicAuthenticator.java
@@ -18,18 +18,18 @@ package org.apache.eagle.server.authentication.authenticator;
 
 import com.google.common.base.Optional;
 import io.dropwizard.auth.AuthenticationException;
+import io.dropwizard.auth.Authenticator;
 import io.dropwizard.auth.basic.BasicCredentials;
 import org.apache.eagle.common.authentication.User;
-import org.apache.eagle.server.authentication.config.AuthenticationSettings;
+import org.apache.eagle.server.authentication.config.SimpleSettings;
 
-public class SimpleBasicAuthenticator extends AbstractSwitchableAuthenticator<BasicCredentials, User> {
+public class SimpleBasicAuthenticator implements Authenticator<BasicCredentials, User> {
     private String acceptedUsername = null;
     private String acceptedPassword = null;
 
-    public SimpleBasicAuthenticator(AuthenticationSettings settings) {
-        super(settings, User.class);
-        acceptedUsername = settings.getSimple().getUsername();
-        acceptedPassword = settings.getSimple().getPassword();
+    public SimpleBasicAuthenticator(SimpleSettings settings) {
+        acceptedUsername = settings.getUsername();
+        acceptedPassword = settings.getPassword();
     }
 
     public Optional<User> authenticate(BasicCredentials credentials) throws AuthenticationException {


[04/50] incubator-eagle git commit: [EAGLE-601] Add updating policy status API: PUT /metadata/policies/{policyId}/sta…

Posted by ha...@apache.org.
[EAGLE-601] Add updating policy status API: PUT /metadata/policies/{policyId}/sta\u2026

Add updating policy status API:

    PUT /metadata/policies/{policyId}/status/{status}

where `status` could be: `ENABLED` or `DISABLED`

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

Closes #485 from haoch/AddUpdatePolicyStatusAPI.


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

Branch: refs/heads/master
Commit: 4b53793d3c76025aa2b47ed93b730beccef8d019
Parents: 4e5641c
Author: Hao Chen <ha...@apache.org>
Authored: Mon Oct 10 17:47:03 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Mon Oct 10 17:47:03 2016 +0800

----------------------------------------------------------------------
 .../metadata/resource/MetadataResource.java     | 38 ++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4b53793d/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 d381aad..0bf31df 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
@@ -16,6 +16,7 @@
  */
 package org.apache.eagle.service.metadata.resource;
 
+import com.google.common.base.Preconditions;
 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;
@@ -26,6 +27,8 @@ import org.apache.eagle.alert.metadata.impl.MetadataDaoFactory;
 import org.apache.eagle.alert.metadata.resource.Models;
 import org.apache.eagle.alert.metadata.resource.OpResult;
 import com.google.inject.Inject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.LinkedList;
 import java.util.List;
@@ -40,6 +43,8 @@ import javax.ws.rs.*;
 @Consumes("application/json")
 public class MetadataResource {
 
+    private static final Logger LOG = LoggerFactory.getLogger(MetadataResource.class);
+
     //    private IMetadataDao dao = MetadataDaoFactory.getInstance().getMetadataDao();
     private final IMetadataDao dao;
 
@@ -222,8 +227,37 @@ public class MetadataResource {
 
     @Path("/policies/{policyId}")
     @GET
-    public List<PolicyDefinition> getPolicyByID(@PathParam("policyId") String policyId) {
-        return dao.listPolicies().stream().filter(pc -> pc.getName().equals(policyId)).collect(Collectors.toList());
+    public PolicyDefinition getPolicyByID(@PathParam("policyId") String policyId) {
+        Preconditions.checkNotNull(policyId,"policyId");
+        return dao.listPolicies().stream().filter(pc -> pc.getName().equals(policyId)).findAny().orElseGet(() -> {
+            LOG.error("Policy (policyId " + policyId + ") not found");
+            throw new IllegalArgumentException("Policy (policyId " + policyId + ") not found");
+        });
+    }
+
+    @Path("/policies/{policyId}/status/{status}")
+    @PUT
+    public OpResult updatePolicyStatusByID(@PathParam("policyId") String policyId, @PathParam("status")PolicyDefinition.PolicyStatus status) {
+        OpResult result = new OpResult();
+        try {
+            PolicyDefinition policyDefinition = getPolicyByID(policyId);
+            policyDefinition.setPolicyStatus(status);
+            OpResult updateResult  = addPolicy(policyDefinition);
+            result.code = updateResult.code;
+
+            if (result.code == OpResult.SUCCESS) {
+                result.message = "Successfully updated status of " + policyId + " as " + status;
+                LOG.info(result.message);
+            } else {
+                result.message = updateResult.message;
+                LOG.error(result.message);
+            }
+        } catch (Exception e) {
+            LOG.error("Error: " + e.getMessage(),e);
+            result.code = OpResult.FAILURE;
+            result.message = e.getMessage();
+        }
+        return result;
     }
 
     @Path("/policies")


[29/50] incubator-eagle git commit: [EAGLE-616] AlertEngine: Reduce the connection from alert-service to ZK

Posted by ha...@apache.org.
[EAGLE-616] AlertEngine: Reduce the connection from alert-service to ZK

Author: Zeng, Bryant
Reviewer: ralphsu

This closes #501


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

Branch: refs/heads/master
Commit: 98d1964ff6bd19c706952fd4b09ad40dbc5a4870
Parents: 2e715e3
Author: mizeng <mi...@ebaysf.com>
Authored: Thu Oct 13 17:28:06 2016 +0800
Committer: Ralph, Su <su...@gmail.com>
Committed: Fri Oct 14 17:38:16 2016 +0800

----------------------------------------------------------------------
 .../java/org/apache/eagle/alert/coordinator/Coordinator.java   | 1 +
 .../eagle/alert/coordinator/trigger/CoordinatorTrigger.java    | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/98d1964f/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/Coordinator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/Coordinator.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/Coordinator.java
index dc3e3d6..e0bd5c3 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/Coordinator.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/Coordinator.java
@@ -185,6 +185,7 @@ public class Coordinator {
         for (String topo : state.getPublishSpecs().keySet()) {
             producer.send(MessageFormat.format(ZK_ALERT_CONFIG_PUBLISHER, topo), value);
         }
+
     }
 
     public ScheduleState getState() {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/98d1964f/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/CoordinatorTrigger.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/CoordinatorTrigger.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/CoordinatorTrigger.java
index ce3c02b..e0e0612 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/CoordinatorTrigger.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/CoordinatorTrigger.java
@@ -65,8 +65,10 @@ public class CoordinatorTrigger implements Runnable {
 
                 ScheduleState state = scheduler.schedule(new ScheduleOption());
 
-                ConfigBusProducer producer = new ConfigBusProducer(ZKConfigBuilder.getZKConfig(config));
-                Coordinator.postSchedule(client, state, producer);
+                // use try catch to use AutoCloseable interface to close producer automatically
+                try (ConfigBusProducer producer = new ConfigBusProducer(ZKConfigBuilder.getZKConfig(config))) {
+                    Coordinator.postSchedule(client, state, producer);
+                }
 
                 watch.stop();
                 LOG.info("CoordinatorTrigger ended, used time {} sm.", watch.elapsed(TimeUnit.MILLISECONDS));


[26/50] incubator-eagle git commit: [MINOR] update AlertUnitTopologyAppProvider.xml

Posted by ha...@apache.org.
[MINOR] update AlertUnitTopologyAppProvider.xml

Author: Zhao, Qingwen <qi...@apache.org>

Closes #507 from qingwen220/quickFix.


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

Branch: refs/heads/master
Commit: e6f9d1bbd6894c31b60bec4d23f42da07e6fe713
Parents: f3204bc
Author: Zhao, Qingwen <qi...@apache.org>
Authored: Fri Oct 14 15:36:28 2016 +0800
Committer: Zhao, Qingwen <qi...@apache.org>
Committed: Fri Oct 14 15:36:28 2016 +0800

----------------------------------------------------------------------
 ...g.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e6f9d1bb/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
index bf22123..8e386be 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
+++ b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
@@ -25,10 +25,10 @@
     <configuration>
        <!-- alert topology sizing parameters -->
         <property>
-            <name>topology.numOfTotalWorkers</name>
-            <displayName>topology.numOfTotalWorkers</displayName>
-            <value>2</value>
-            <description>number of total storm workers</description>
+            <name>workers</name>
+            <displayName>workers</displayName>
+            <value>1</value>
+            <description>number of topology workers</description>
         </property>
         <property>
             <name>topology.numOfSpoutTasks</name>


[31/50] incubator-eagle git commit: [EAGLE-619] UI Home display site states

Posted by ha...@apache.org.
[EAGLE-619] UI Home display site states

UI Home display site states

Author: zombieJ <sm...@gmail.com>

Closes #511 from zombieJ/EAGLE-619.


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

Branch: refs/heads/master
Commit: 00e92d993bc7de3cb253c87622a9041cf614844f
Parents: 8ff8ecf
Author: zombieJ <sm...@gmail.com>
Authored: Fri Oct 14 18:10:03 2016 +0800
Committer: zombieJ <sm...@gmail.com>
Committed: Fri Oct 14 18:10:03 2016 +0800

----------------------------------------------------------------------
 eagle-server/src/main/webapp/app/dev/index.html |  2 +-
 .../src/main/webapp/app/dev/partials/home.html  | 48 ++++++------------
 .../app/dev/partials/integration/site.html      |  6 ++-
 .../src/main/webapp/app/dev/public/css/main.css |  4 ++
 .../src/main/webapp/app/dev/public/js/app.js    |  2 +-
 .../webapp/app/dev/public/js/ctrls/mainCtrl.js  |  7 +++
 .../app/dev/public/js/services/pageSrv.js       | 52 +++++++++++---------
 7 files changed, 61 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/00e92d99/eagle-server/src/main/webapp/app/dev/index.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/index.html b/eagle-server/src/main/webapp/app/dev/index.html
index 19ea204..d791819 100644
--- a/eagle-server/src/main/webapp/app/dev/index.html
+++ b/eagle-server/src/main/webapp/app/dev/index.html
@@ -101,7 +101,7 @@
 				<!-- side bar: style can be found in sidebar.less -->
 				<section class="sidebar">
 					<ul class="sidebar-menu">
-						<li ng-repeat="portal in Portal.list track by $index" ng-class="{treeview: portal.list}">
+						<li ng-repeat="portal in Portal.list track by $index" ng-class="{treeview: portal.list}" ng-if="portal.showFunc ? portal.showFunc() : true">
 							<a ng-href="{{portal.path}}">
 								<i class="fa fa-{{portal.icon || 'circle-o'}}"></i>
 								<span>{{portal.name}}</span>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/00e92d99/eagle-server/src/main/webapp/app/dev/partials/home.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/home.html b/eagle-server/src/main/webapp/app/dev/partials/home.html
index ab75b18..545adf0 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/home.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/home.html
@@ -16,45 +16,27 @@
   limitations under the License.
   -->
 
-<!--div class="row" ng-repeat="banner in bannerList track by $index">
-	<div class="col-sm-12" ng-if="banner.title">
-		<h3>{{banner.title}}</h3>
-	</div>
-	<div class="col-sm-6 col-md-4 col-lg-3" ng-repeat="widget in banner.list track by $index">
-		<div class="small-box {{widget.color || 'bg-aqua'}}">
+<div class="row">
+	<div class="col-sm-6 col-md-4 col-lg-3" ng-repeat="site in Site.list track by $index">
+		<div class="small-box bg-aqua">
 			<div class="inner">
-				<h3>{{widget.title || "Untitled"}}</h3>
-				<p>{{widget.description || "-"}}</p>
-				<p>{{widget.additionalTips || "&nbsp;"}}</p>
+				<h3>{{site.siteName || site.siteId}}</h3>
+
+				<p>{{site.applicationList.length}} Applications</p>
 			</div>
 			<div class="icon">
-				<i class="fa fa-question-circle"></i>
+				<i class="fa fa-certificate"></i>
 			</div>
-			<a class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
+			<a ui-sref="site({siteId: site.siteId})" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
 		</div>
 	</div>
-</div-->
-<div class="row flex">
-	<div class="col-sm-6 col-md-4 col-lg-3" ng-repeat="widget in Widget.list track by $index">
-		<div widget="widget"></div>
-	</div>
 </div>
 
-<!--div class="row flex">
-	<div class="col-md-4">
-		<div style="background: red; height: 200px;">111</div>
-	</div>
-	<div class="col-md-4">
-		<div style="background: green;">222</div>
-		<div style="background: blue;">222</div>
-	</div>
-	<div class="col-md-4">
-		<div style="background: red;">333</div>
-	</div>
-	<div class="col-md-4">
-		<div style="background: green;">444</div>
-	</div>
-	<div class="col-md-4">
-		<div style="background: red;">555</div>
+<div ng-if="Widget.list.length">
+	<h3>Widgets</h3>
+	<div class="row flex">
+		<div class="col-sm-6 col-md-4 col-lg-3" ng-repeat="widget in Widget.list track by $index">
+			<div widget="widget"></div>
+		</div>
 	</div>
-</div-->
+</div>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/00e92d99/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
index 98e7d97..6b02a70 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
@@ -210,6 +210,7 @@
 					<li><a href="[data-id='environment']" data-toggle="tab">Environment</a></li>
 					<li><a href="[data-id='configuration']" data-toggle="tab" data-id="configTab">Configuration</a></li>
 				</ul>
+
 				<div class="tab-content">
 					<div class="tab-pane" data-id="guide">
 						<label>Dependencies</label>
@@ -227,6 +228,7 @@
 						<label>Install</label>
 						<pre ng-bind-html="installHTML"></pre>
 					</div>
+
 					<div class="tab-pane" data-id="environment">
 						<div class="form-group">
 							<label>Mode</label>
@@ -240,11 +242,13 @@
 							<input type="text" class="form-control" ng-model="tmpApp.jarPath" ng-change="checkJarPath()" />
 						</div>
 					</div>
+
 					<div class="tab-pane" data-id="configuration">
-						<div class="form-group" ng-repeat="field in tmpAppConfigFields track by $index">
+						<div class="form-group" ng-class="{'has-warning': field.required && !tmpApp.configuration[field.name]}" ng-repeat="field in tmpAppConfigFields track by $index">
 							<label>
 								<a class="fa fa-times" ng-click="removeField(field)" ng-if="field._customize"></a>
 								{{field.displayName || field.name}}
+								<span class="fa fa-question-circle" ng-if="field.description" uib-tooltip="{{field.description}}"></span>
 								<small ng-if="!field.required" class="text-muted">[optional]</small>
 							</label>
 							<input type="text" class="form-control" placeholder="{{field.description}}" ng-model="tmpApp.configuration[field.name]" />

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/00e92d99/eagle-server/src/main/webapp/app/dev/public/css/main.css
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/css/main.css b/eagle-server/src/main/webapp/app/dev/public/css/main.css
index ac22f89..16136c8 100644
--- a/eagle-server/src/main/webapp/app/dev/public/css/main.css
+++ b/eagle-server/src/main/webapp/app/dev/public/css/main.css
@@ -211,6 +211,10 @@ ul.stepGuide li > .title {
 	bottom: 0;
 }
 
+.small-box.bg-gray {
+	color: #666;
+}
+
 	/* ========================================================================
      * =                                 Tab                                  =
      * ======================================================================== */

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/00e92d99/eagle-server/src/main/webapp/app/dev/public/js/app.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/app.js b/eagle-server/src/main/webapp/app/dev/public/js/app.js
index cdb705c..39c84c5 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/app.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/app.js
@@ -159,7 +159,7 @@ var app = {};
 				// ================================== Site ==================================
 				.state('site', {
 					url: "/site/:siteId",
-					templateUrl: "partials/home.html?_=" + window._TRS(),
+					templateUrl: "partials/site/home.html?_=" + window._TRS(),
 					controller: "siteCtrl",
 					resolve: routeResolve()
 				})

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/00e92d99/eagle-server/src/main/webapp/app/dev/public/js/ctrls/mainCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/mainCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/mainCtrl.js
index ddd3314..015bd4f 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/mainCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/mainCtrl.js
@@ -26,6 +26,13 @@
 	// ======================================================================================
 	eagleControllers.controller('homeCtrl', function ($scope, $wrapState, PageConfig) {
 		PageConfig.title = "Home";
+
+		$scope.colorList = [
+			"bg-aqua",
+			"bg-green",
+			"bg-yellow",
+			"bg-red"
+		];
 	});
 
 	// ======================================================================================

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/00e92d99/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js b/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
index 04e3b77..faea8ba 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
@@ -41,27 +41,31 @@
 	// ============================================================
 	// =                          Portal                          =
 	// ============================================================
-	var defaultPortalList = [
-		{name: "Home", icon: "home", path: "#/"},
-		/*{name: "Insight", icon: "heartbeat", list: [
-			{name: "Dashboards"},
-			{name: "Metrics"}
-		]},*/
-		{name: "Alert", icon: "bell", list: [
-			{name: "Explore Alerts", path: "#/alert/"},
-			{name: "Policies", path: "#/alert/policyList"},
-			{name: "Streams", path: "#/alert/streamList"},
-			{name: "Define Policy", path: "#/alert/policyCreate"}
-		]}
-	];
-	var adminPortalList = [
-		{name: "Integration", icon: "puzzle-piece", list: [
-			{name: "Sites", path: "#/integration/siteList"},
-			{name: "Applications", path: "#/integration/applicationList"}
-		]}
-	];
-
-	serviceModule.service('Portal', function($wrapState, Site) {
+	serviceModule.service('Portal', function($wrapState, Site, Application) {
+		function checkSite() {
+			return Site.list.length !== 0;
+		}
+
+		function checkApplication() {
+			return checkSite() && Application.list.length !== 0;
+		}
+
+		var defaultPortalList = [
+			{name: "Home", icon: "home", path: "#/"},
+			{name: "Alert", icon: "bell", showFunc: checkApplication, list: [
+				{name: "Explore Alerts", path: "#/alert/"},
+				{name: "Policies", path: "#/alert/policyList"},
+				{name: "Streams", path: "#/alert/streamList"},
+				{name: "Define Policy", path: "#/alert/policyCreate"}
+			]}
+		];
+		var adminPortalList = [
+			{name: "Integration", icon: "puzzle-piece", showFunc: checkSite, list: [
+				{name: "Sites", path: "#/integration/siteList"},
+				{name: "Applications", path: "#/integration/applicationList"}
+			]}
+		];
+
 		var Portal = {};
 
 		var mainPortalList = [];
@@ -69,7 +73,7 @@
 		var connectedMainPortalList = [];
 		var sitePortals = {};
 
-		var backHome = {name: "Back home", icon: "arrow-left", path: "#/"};
+		var backHome = {name: "Back", icon: "arrow-left", path: "#/"};
 
 		Portal.register = function (portal, isSite) {
 			(isSite ? sitePortalList : mainPortalList).push(portal);
@@ -100,12 +104,12 @@
 					path: "#/site/" + site.siteId
 				};
 			});
-			connectedMainPortalList.push({name: "Sites", icon: "server", list: siteList});
+			connectedMainPortalList.push({name: "Sites", icon: "server", showFunc: checkApplication, list: siteList});
 
 			// Site level
 			sitePortals = {};
 			$.each(Site.list, function (i, site) {
-				var siteHome = {name: "Home", icon: "home", path: "#/site/" + site.siteId};
+				var siteHome = {name: site.siteName || site.siteId + " Home", icon: "home", path: "#/site/" + site.siteId};
 				sitePortals[site.siteId] = [backHome, siteHome].concat($.map(sitePortalList, function (portal) {
 					var hasApp = !!common.array.find(portal.application, site.applicationList, "descriptor.type");
 					if(hasApp) {


[22/50] incubator-eagle git commit: [EAGLE-617] Scrollbar is missing when install Map Reduce History Job Monitoring

Posted by ha...@apache.org.
[EAGLE-617] Scrollbar is missing when install Map Reduce History Job Monitoring

add check logic in uiSrv. When dialog close, will check current existed dialog for body 'modal-open'

Author: zombieJ <sm...@gmail.com>

Closes #503 from zombieJ/EAGLE-617.


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

Branch: refs/heads/master
Commit: 0bca234ff8d6b747a62853ff1f3028fc9ab1e4f9
Parents: 5e57c7b
Author: zombieJ <sm...@gmail.com>
Authored: Fri Oct 14 11:28:11 2016 +0800
Committer: zombieJ <sm...@gmail.com>
Committed: Fri Oct 14 11:28:11 2016 +0800

----------------------------------------------------------------------
 .../src/main/webapp/app/dev/public/js/services/uiSrv.js      | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0bca234f/eagle-server/src/main/webapp/app/dev/public/js/services/uiSrv.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/services/uiSrv.js b/eagle-server/src/main/webapp/app/dev/public/js/services/uiSrv.js
index e0bb77d..6ce77b8 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/services/uiSrv.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/services/uiSrv.js
@@ -94,6 +94,10 @@
 					entity: _entity
 				});
 				$mdl.remove();
+
+				if ($(".modal-backdrop").length) {
+					$("body").addClass("modal-open");
+				}
 			});
 
 			// Function
@@ -225,6 +229,10 @@
 					name: name
 				});
 				$mdl.remove();
+
+				if ($(".modal-backdrop").length) {
+					$("body").addClass("modal-open");
+				}
 			});
 
 			// Function


[23/50] incubator-eagle git commit: [EAGLE-618] migration eagle-jpm-aggregation to application framework

Posted by ha...@apache.org.
[EAGLE-618] migration eagle-jpm-aggregation to application framework

Author: wujinhu <wu...@126.com>

Closes #504 from wujinhu/EAGLE-618.


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

Branch: refs/heads/master
Commit: 7bd5d1d2adb909eef7f59424f758fc0818fb683b
Parents: 0bca234
Author: wujinhu <wu...@126.com>
Authored: Fri Oct 14 11:56:03 2016 +0800
Committer: wujinhu <wu...@126.com>
Committed: Fri Oct 14 11:56:03 2016 +0800

----------------------------------------------------------------------
 .../jpm/aggregation/AggregationApplication.java |  18 ++-
 .../jpm/aggregation/AggregationConfig.java      |  10 --
 ...gregation.AggregationApplicationProvider.xml | 115 +++++++++++++++++++
 .../src/main/resources/application.conf         |  23 +---
 eagle-topology-assembly/pom.xml                 |   5 +
 ...org.apache.eagle.app.spi.ApplicationProvider |   3 +-
 6 files changed, 137 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/7bd5d1d2/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java b/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java
index 3c40f58..0577070 100644
--- a/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java
+++ b/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java
@@ -31,22 +31,30 @@ import java.util.*;
 public class AggregationApplication extends StormApplication {
     @Override
     public StormTopology execute(Config config, StormEnvironment environment) {
-        AggregationConfig aggregationConfig = AggregationConfig.getInstance(config);
-
         //TODO
-        List<String> metricNames = config.getStringList("aggregate.counters.metrics");
-        List<String> groupByColumns = config.getStringList("aggregate.counters.groupByColumns");
+        List<String> metricNames = new ArrayList<>();
+        String[] metricNamesArr = config.getString("aggregate.counters.metrics").split(",");
+        for (int i = 0; i < metricNamesArr.length; i++) {
+            metricNames.add(metricNamesArr[i]);
+        }
+        List<String> groupByColumns = new ArrayList<>();
+        String[] groupByColumnsArr = config.getString("aggregate.counters.groupBys").split(",");
+        for (int i = 0; i < groupByColumnsArr.length; i++) {
+            groupByColumns.add(groupByColumnsArr[i]);
+        }
+
         Map<String, List<List<String>>> metrics = new HashMap<>();
         for (String metric : metricNames) {
             metrics.put(metric, new ArrayList<>());
             for (String cols : groupByColumns) {
-                metrics.get(metric).add(Arrays.asList(cols.replaceAll(" ", "").split(",")));
+                metrics.get(metric).add(Arrays.asList(cols.replaceAll(" ", "").split("&")));
             }
         }
 
         TopologyBuilder topologyBuilder = new TopologyBuilder();
         String spoutName = "mrHistoryAggregationSpout";
         String boltName = "mrHistoryAggregationBolt";
+        AggregationConfig aggregationConfig = AggregationConfig.getInstance(config);
         int parallelism = aggregationConfig.getConfig().getInt("envContextConfig.parallelismConfig." + spoutName);
         int tasks = aggregationConfig.getConfig().getInt("envContextConfig.tasks." + spoutName);
         if (parallelism > tasks) {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/7bd5d1d2/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationConfig.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationConfig.java b/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationConfig.java
index c50de92..b527ddb 100644
--- a/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationConfig.java
+++ b/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationConfig.java
@@ -26,12 +26,6 @@ import java.io.Serializable;
 public class AggregationConfig implements Serializable {
     private static final Logger LOG = LoggerFactory.getLogger(AggregationConfig.class);
 
-    public String getEnv() {
-        return env;
-    }
-
-    private String env;
-
     public ZKStateConfig getZkStateConfig() {
         return zkStateConfig;
     }
@@ -67,7 +61,6 @@ public class AggregationConfig implements Serializable {
 
     public static class JobExtractorConfig implements Serializable {
         public String site;
-        public int readTimeoutSeconds;
         public long aggregationDuration;
     }
 
@@ -104,10 +97,8 @@ public class AggregationConfig implements Serializable {
      */
     private void init(Config config) {
         this.config = config;
-        this.env = config.getString("envContextConfig.env");
         //parse eagle job extractor
         this.jobExtractorConfig.site = config.getString("jobExtractorConfig.site");
-        this.jobExtractorConfig.readTimeoutSeconds = config.getInt("jobExtractorConfig.readTimeOutSeconds");
         this.jobExtractorConfig.aggregationDuration = config.getLong("jobExtractorConfig.aggregationDuration");
 
         //parse eagle zk
@@ -126,7 +117,6 @@ public class AggregationConfig implements Serializable {
         this.eagleServiceConfig.password = config.getString("eagleProps.eagleService.password");
 
         LOG.info("Successfully initialized MRHistoryJobConfig");
-        LOG.info("env: " + this.env);
         LOG.info("zookeeper.quorum: " + this.zkStateConfig.zkQuorum);
         LOG.info("zookeeper.property.clientPort: " + this.zkStateConfig.zkPort);
         LOG.info("eagle.service.host: " + this.eagleServiceConfig.eagleServiceHost);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/7bd5d1d2/eagle-jpm/eagle-jpm-aggregation/src/main/resources/META-INF/providers/org.apache.eagle.jpm.aggregation.AggregationApplicationProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-aggregation/src/main/resources/META-INF/providers/org.apache.eagle.jpm.aggregation.AggregationApplicationProvider.xml b/eagle-jpm/eagle-jpm-aggregation/src/main/resources/META-INF/providers/org.apache.eagle.jpm.aggregation.AggregationApplicationProvider.xml
new file mode 100644
index 0000000..237a437
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-aggregation/src/main/resources/META-INF/providers/org.apache.eagle.jpm.aggregation.AggregationApplicationProvider.xml
@@ -0,0 +1,115 @@
+<?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>MR_JPM_AGGREGATION_APP</type>
+    <name>Map Job Monitoring Aggregation Application</name>
+    <version>0.5.0-incubating</version>
+    <configuration>
+        <property>
+            <name>jobExtractorConfig.site</name>
+            <displayName>Site ID</displayName>
+            <value>sandbox</value>
+        </property>
+        <property>
+            <name>workers</name>
+            <displayName>storm worker number</displayName>
+            <value>4</value>
+        </property>
+        <property>
+            <name>envContextConfig.parallelismConfig.mrHistoryAggregationSpout</name>
+            <value>1</value>
+        </property>
+        <property>
+            <name>envContextConfig.tasks.mrHistoryAggregationSpout</name>
+            <value>1</value>
+        </property>
+        <property>
+            <name>envContextConfig.parallelismConfig.mrHistoryAggregationBolt</name>
+            <value>6</value>
+        </property>
+        <property>
+            <name>envContextConfig.tasks.mrHistoryAggregationBolt</name>
+            <value>6</value>
+        </property>
+        <property>
+            <name>jobExtractorConfig.aggregationDuration</name>
+            <description>seconds, each bolt process metrics from [start, start + aggregationDuration]</description>
+            <value>3600</value>
+        </property>
+        <property>
+            <name>zkStateConfig.zkQuorum</name>
+            <value>sandbox.hortonworks.com:2181</value>
+        </property>
+        <property>
+            <name>zkStateConfig.zkPort</name>
+            <value>2181</value>
+        </property>
+        <property>
+            <name>zkStateConfig.zkRoot</name>
+            <value>/aggregation/mr/sandbox</value>
+        </property>
+        <property>
+            <name>zkStateConfig.zkSessionTimeoutMs</name>
+            <value>15000</value>
+        </property>
+        <property>
+            <name>zkStateConfig.zkRetryTimes</name>
+            <value>3</value>
+        </property>
+        <property>
+            <name>zkStateConfig.zkRetryInterval</name>
+            <value>20000</value>
+        </property>
+        <property>
+            <name>eagleProps.eagleService.host</name>
+            <description>eagleProps.eagleService.host</description>
+            <value>sandbox.hortonworks.com</value>
+        </property>
+        <property>
+            <name>eagleProps.eagleService.port</name>
+            <description>eagleProps.eagleService.port</description>
+            <value>9099</value>
+        </property>
+        <property>
+            <name>eagleProps.eagleService.username</name>
+            <description>eagleProps.eagleService.username</description>
+            <value>admin</value>
+        </property>
+        <property>
+            <name>eagleProps.eagleService.password</name>
+            <description>eagleProps.eagleService.password</description>
+            <value>secret</value>
+        </property>
+        <property>
+            <name>aggregate.counters.metrics</name>
+            <value>cpu_milliseconds, file_bytes_read, file_bytes_written, hdfs_bytes_read, hdfs_bytes_written, hdfs_read_ops, hdfs_write_ops</value>
+        </property>
+        <property>
+            <name>aggregate.counters.groupBys</name>
+            <description>groupBys that each metric need to aggregate. If group by many columns, then split them by &</description>
+            <value>site&jobType, site&user, site</value>
+        </property>
+    </configuration>
+    <docs>
+        <install>
+        </install>
+        <uninstall>
+        </uninstall>
+    </docs>
+</application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/7bd5d1d2/eagle-jpm/eagle-jpm-aggregation/src/main/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-aggregation/src/main/resources/application.conf b/eagle-jpm/eagle-jpm-aggregation/src/main/resources/application.conf
index 94e06b3..98fc009 100644
--- a/eagle-jpm/eagle-jpm-aggregation/src/main/resources/application.conf
+++ b/eagle-jpm/eagle-jpm-aggregation/src/main/resources/application.conf
@@ -15,9 +15,6 @@
 
 {
   "envContextConfig" : {
-    "env" : "cluster",
-    "topologyName" : "mrHistoryAggregation",
-    "stormConfigFile" : "storm.yaml",
     "parallelismConfig" : {
       "mrHistoryAggregationSpout" : 1,
       "mrHistoryAggregationBolt" : 6
@@ -30,7 +27,6 @@
 
   "jobExtractorConfig" : {
     "site" : "sandbox",
-    "readTimeOutSeconds" : 10,
     "aggregationDuration" : 3600 #seconds, each bolt process metrics from [start, start + aggregationDuration]
   },
 
@@ -44,8 +40,6 @@
   },
 
   "eagleProps" : {
-    "mailHost" : "abc.com",
-    "mailDebug" : "true",
     "eagleService": {
       "host": "sandbox.hortonworks.com:2181",
       "port": 9099,
@@ -56,21 +50,8 @@
 
   "aggregate" : {
     "counters" : {
-      "metrics": [
-        "cpu_milliseconds",
-        "file_bytes_read",
-        "file_bytes_written",
-        "hdfs_bytes_read",
-        "hdfs_bytes_written",
-        "hdfs_read_ops",
-        "hdfs_write_ops"
-      ],
-
-      "groupByColumns": [
-        "site, jobType",
-        "site, user",
-        "site"
-      ]
+      "metrics" : "cpu_milliseconds,file_bytes_read, file_bytes_written, hdfs_bytes_read, hdfs_bytes_written, hdfs_read_ops, hdfs_write_ops",
+      "groupBys": "site&jobType, site&user, site"
     }
   },
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/7bd5d1d2/eagle-topology-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-topology-assembly/pom.xml b/eagle-topology-assembly/pom.xml
index 80ca265..7af6f96 100644
--- a/eagle-topology-assembly/pom.xml
+++ b/eagle-topology-assembly/pom.xml
@@ -62,6 +62,11 @@
             <artifactId>eagle-jpm-web</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-jpm-aggregation</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 
     <profiles>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/7bd5d1d2/eagle-topology-assembly/src/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider
----------------------------------------------------------------------
diff --git a/eagle-topology-assembly/src/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider b/eagle-topology-assembly/src/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider
index 989886f..56292d2 100644
--- a/eagle-topology-assembly/src/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider
+++ b/eagle-topology-assembly/src/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider
@@ -17,4 +17,5 @@ org.apache.eagle.security.hbase.HBaseAuditLogAppProvider
 org.apache.eagle.app.example.ExampleApplicationProvider
 org.apache.eagle.app.jpm.JPMWebApplicationProvider
 org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider
-org.apache.eagle.jpm.mr.running.MRRunningJobApplicationProvider
\ No newline at end of file
+org.apache.eagle.jpm.mr.running.MRRunningJobApplicationProvider
+org.apache.eagle.jpm.aggregation.AggregationApplicationProvider
\ No newline at end of file


[49/50] incubator-eagle git commit: [UI] Improve integeration page

Posted by ha...@apache.org.
[UI] Improve integeration page

<!--
{% comment %}
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}
-->

Be sure to do all of the following to help us incorporate your contribution
quickly and easily:

 - [x] Make sure the PR title is formatted like:
   `[EAGLE-<Jira issue #>] Description of pull request`
 - [x] Make sure tests pass via `mvn clean verify`. (Even better, enable
       Travis-CI on your fork and ensure the whole test matrix passes).
 - [x] Replace `<Jira issue #>` in the title with the actual Jira issue
       number, if there is one.
 - [x] If this contribution is large, please file an Apache
       [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.txt).

---

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

Closes #524 from haoch/ImproveIntegerationPage.


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

Branch: refs/heads/master
Commit: adc2ba900a2d29352e96489ad48addde17bedccf
Parents: c3bde01
Author: Hao Chen <ha...@apache.org>
Authored: Tue Oct 18 19:31:48 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Tue Oct 18 19:31:48 2016 +0800

----------------------------------------------------------------------
 ...e.alert.app.AlertUnitTopologyAppProvider.xml | 83 +++++++++++---------
 eagle-server/pom.xml                            | 10 +++
 .../app/dev/partials/integration/site.html      | 50 ++++++------
 .../app/dev/public/js/ctrls/integrationCtrl.js  |  8 +-
 eagle-server/ui-build.sh                        |  0
 5 files changed, 87 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/adc2ba90/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
index b3e777c..6ef96c7 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
+++ b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
@@ -20,110 +20,123 @@
     <type>AlertUnitTopologyApp</type>
     <name>Alert Unit Topology Application</name>
     <version>0.5.0-incubating</version>
-    <appClass>org.apache.eagle.alert.app.AlertUnitTopologyApp</appClass>
-    <viewPath>/apps/alert</viewPath>
     <configuration>
        <!-- alert topology sizing parameters -->
         <property>
             <name>workers</name>
-            <displayName>workers</displayName>
+            <displayName>Worker Number</displayName>
             <value>1</value>
-            <description>number of topology workers</description>
+            <description>Storm parallelism worker number</description>
+            <required>false</required>
         </property>
         <property>
             <name>topology.numOfSpoutTasks</name>
-            <displayName>topology.numOfSpoutTasks</displayName>
+            <displayName>Source Tasks Number</displayName>
             <value>1</value>
-            <description>number of spout tasks</description>
+            <description>Number of spout tasks</description>
+            <required>false</required>
         </property>
         <property>
             <name>topology.numOfRouterBolts</name>
-            <displayName>topology.numOfRouterBolts</displayName>
+            <displayName>Route Tasks Number</displayName>
             <value>4</value>
-            <description>number of router tasks</description>
+            <description>Number of router tasks</description>
+            <required>false</required>
         </property>
         <property>
             <name>topology.numOfAlertBolts</name>
-            <displayName>topology.numOfAlertBolts</displayName>
+            <displayName>Evaluator Tasks Number</displayName>
             <value>10</value>
-            <description>number of alert tasks</description>
+            <description>Number of alert tasks</description>
+            <required>false</required>
         </property>
         <property>
             <name>topology.numOfPublishTasks</name>
-            <displayName>topology.numOfPublishTasks</displayName>
+            <displayName>Publisher Tasks Number</displayName>
             <value>1</value>
-            <description>number of publish tasks</description>
+            <description>Number of publish tasks</description>
+            <required>false</required>
         </property>
         <property>
             <name>topology.messageTimeoutSecs</name>
-            <displayName>topology.messageTimeoutSecs</displayName>
+            <displayName>Message Timeout Seconds</displayName>
             <value>3600</value>
-            <description>number of tuple timeout in seconds</description>
+            <description>Number of tuple timeout in seconds</description>
+            <required>false</required>
         </property>
 
         <!-- alert spout configuration -->
         <property>
             <name>spout.kafkaBrokerZkQuorum</name>
-            <displayName>spout.kafkaBrokerZkQuorum</displayName>
+            <displayName>Kafka Zookeeper Quorum</displayName>
             <value>localhost:2181</value>
-            <description>zookeeper quorum for spout to consume data</description>
+            <description>Zookeeper quorum of kafka broker for spout to consume data</description>
+            <required>true</required>
         </property>
         <property>
             <name>spout.kafkaBrokerZkBasePath</name>
-            <displayName>spout.kafkaBrokerZkBasePath</displayName>
+            <displayName>Kafka Zookeeper Root</displayName>
             <value>/brokers</value>
-            <description>zk znode path for kafka brokers</description>
+            <description>Zookeeper znode path for kafka brokers</description>
+            <required>false</required>
         </property>
         <property>
             <name>spout.stormKafkaUseSameZkQuorumWithKafkaBroker</name>
-            <displayName>spout.stormKafkaUseSameZkQuorumWithKafkaBroker</displayName>
+            <displayName>Reuse Kafka Zookeeper</displayName>
             <value>true</value>
-            <description>same zookeeper for kafka server and kafka consumer(Storm-Kafka)</description>
+            <description>Use same zookeeper for kafka server and kafka consumer(Storm-Kafka)</description>
+            <required>false</required>
         </property>
         <property>
             <name>spout.stormKafkaTransactionZkPath</name>
-            <displayName>spout.stormKafkaTransactionZkPath</displayName>
+            <displayName>Kafka Transaction ZkPath</displayName>
             <value>/consumers</value>
-            <description>zk path for storm kafka transaction</description>
+            <description>Zookeeper path for storm kafka transaction</description>
+            <required>false</required>
         </property>
         <property>
             <name>spout.stormKafkaEagleConsumer</name>
-            <displayName>spout.stormKafkaEagleConsumer</displayName>
+            <displayName>Kafka Consumer ID</displayName>
             <value>eagle_consumer</value>
-            <description>zookeeper quorum for spout to consume data</description>
+            <description>Zookeeper quorum for spout to consume data</description>
+            <required>true</required>
         </property>
 
         <!-- zk config for alert engine -->
         <property>
             <name>zkConfig.zkQuorum</name>
-            <displayName>zkConfig.zkQuorum</displayName>
+            <displayName>Coordinator Zookeeper Quorum</displayName>
             <value>localhost:2181</value>
-            <description>zk quorum for alert engine</description>
+            <description>Zookeeper quorum for alert engine</description>
+            <required>true</required>
         </property>
         <property>
             <name>zkConfig.zkRoot</name>
-            <displayName>zkConfig.zkRoot</displayName>
+            <displayName>Coordinator Zookeeper Root</displayName>
             <value>/alert</value>
-            <description>zk znode path for alert engine</description>
+            <description>Zookeeper znode path for alert engine</description>
+            <required>false</required>
         </property>
-
         <property>
             <name>metadataService.context</name>
-            <displayName>metadataService.context</displayName>
+            <displayName>Metadata Service Context Path</displayName>
             <value>/rest</value>
-            <description>metadata service context path</description>
+            <description>Metadata service context path</description>
+            <required>false</required>
         </property>
         <property>
             <name>metadataService.host</name>
-            <displayName>metadataService.host</displayName>
+            <displayName>Metadata Service Host</displayName>
             <value>localhost</value>
-            <description>metadata service host</description>
+            <description>Metadata service host</description>
+            <required>true</required>
         </property>
         <property>
             <name>metadataService.port</name>
-            <displayName>metadataService.port</displayName>
+            <displayName>Metadata Service Port</displayName>
             <value>9090</value>
-            <description>metadata service port</description>
+            <description>Metadata service port</description>
+            <required>true</required>
         </property>
     </configuration>
     <docs>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/adc2ba90/eagle-server/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-server/pom.xml b/eagle-server/pom.xml
index 37ba4f2..07f02ec 100644
--- a/eagle-server/pom.xml
+++ b/eagle-server/pom.xml
@@ -257,6 +257,16 @@
                     <groupId>org.apache.eagle</groupId>
                     <artifactId>eagle-security-oozie-web</artifactId>
                     <version>${project.version}</version>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>org.slf4j</groupId>
+                            <artifactId>slf4j-simple</artifactId>
+                        </exclusion>
+                        <exclusion>
+                            <groupId>org.slf4j</groupId>
+                            <artifactId>slf4j-log4j12</artifactId>
+                        </exclusion>
+                    </exclusions>
                 </dependency>
 
                 <!-- App: hdfs audit log monitoring -->

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/adc2ba90/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
index ce0cddd..5844381 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
@@ -17,8 +17,6 @@
   -->
 
 <div class="box-body">
-
-
 	<div class="form-group">
 		<label>Site</label>
 		<input type="text" class="form-control" readonly ng-model="siteName">
@@ -28,7 +26,7 @@
 		<textarea class="form-control" readonly ng-model="site.description" rows="2"></textarea>
 	</div>
 
-	<label>Application</label>
+	<label>Applications</label>
 	<span class="text-danger" ng-if="site.applicationList.length === 0">
 		(<span class="fa fa-exclamation-triangle"></span> Site must install at least one application to start up.)
 	</span>
@@ -84,7 +82,7 @@
 						</button>
 					</div>
 					<div class="btn-group btn-group-xs" ng-if="!app.installed">
-						<button class="btn btn-primary btn-sm" ng-click="installApp(app)">Install Application</button>
+						<button class="btn btn-primary btn-sm" ng-click="installApp(app)">Install</button>
 					</div>
 				</td>
 			</tr>
@@ -106,7 +104,7 @@
 			</div>
 			<div class="modal-body">
 				<ul class="nav nav-tabs">
-					<li><a href="[data-id='intro']" data-toggle="tab" data-id="introTab">Introduction</a></li>
+					<li><a href="[data-id='intro']" data-toggle="tab" data-id="introTab">Summary</a></li>
 					<li><a href="[data-id='install']" data-toggle="tab">Installation</a></li>
 					<li><a href="[data-id='uninstall']" data-toggle="tab">Uninstallation</a></li>
 				</ul>
@@ -207,7 +205,7 @@
 			<div class="modal-body">
 				<ul class="nav nav-tabs">
 					<li><a href="[data-id='guide']" data-toggle="tab" data-id="guideTab">Installation</a></li>
-					<li><a href="[data-id='configuration']" data-toggle="tab" data-id="configTab">Setting</a></li>
+					<li><a href="[data-id='configuration']" data-toggle="tab" data-id="configTab">Settings</a></li>
 				</ul>
 
 				<div class="tab-content">
@@ -231,22 +229,26 @@
 
 					<div class="tab-pane" data-id="configuration">
 						<!-- Environment -->
-						<h3>
+						<h5>
 							<a class="text-primary" data-toggle="collapse" href="[data-id='appEnvironment']" ng-click="collapseCheck()">
 								<span class="fa {{isCollapsed('appEnvironment') ? 'fa-chevron-circle-right' : 'fa-chevron-circle-down'}}"></span>
 								Environment
 							</a>
-						</h3>
+						</h5>
 						<div data-id="appEnvironment" class="collapse in">
 							<div class="form-group">
-								<label>Mode</label>
+								<label>Execution Mode
+									<span class="fa fa-question-circle" uib-tooltip="Application execution mode: LOCAL/CLUSTER"></span>
+								</label>
 								<select class="form-control" ng-model="tmpApp.mode">
-									<option>CLUSTER</option>
-									<option>LOCAL</option>
+									<option value="CLUSTER">Submit as Cluster Mode</option>
+									<option VALUE="LOCAL">Submit as Local Mode</option>
 								</select>
 							</div>
 							<div class="form-group">
-								<label>jar Path</label>
+								<label>Execution File
+									<span class="fa fa-question-circle" uib-tooltip="Full path of Application Jar or Class file on eagle server host"></span>
+								</label>
 								<input type="text" class="form-control" ng-model="tmpApp.jarPath" ng-change="checkJarPath()" />
 							</div>
 						</div>
@@ -254,48 +256,48 @@
 						<hr/>
 
 						<!-- General -->
-						<a class="pull-right" ng-click="configByJSON()">Config By JSON</a>
-						<h3>
+						<a class="pull-right" ng-click="configByJSON()">Import Configs</a>
+						<h5>
 							<a class="text-primary" data-toggle="collapse" href="[data-id='appGeneral']" ng-click="collapseCheck()">
 								<span class="fa {{isCollapsed('appGeneral') ? 'fa-chevron-circle-right' : 'fa-chevron-circle-down'}}"></span>
 								General
 							</a>
-						</h3>
+						</h5>
 						<div data-id="appGeneral" class="collapse in">
 							<span class="text-muted" ng-if="generalFields.length === 0">N/A</span>
 							<div class="form-group" ng-class="{'has-warning': !tmpApp.configuration[field.name]}" ng-repeat="field in generalFields track by $index">
 								<label>
 									{{field.displayName || field.name}}
-									<span class="fa fa-question-circle" ng-if="field.description" uib-tooltip="[ {{field.name}} ] {{field.description}}"></span>
+									<span class="fa fa-question-circle" ng-if="field.description" uib-tooltip="{{field.description}} ({{field.name}})"></span>
 								</label>
 								<input type="text" class="form-control" placeholder="{{field.description}}" ng-model="tmpApp.configuration[field.name]" />
 							</div>
 						</div>
 
 						<!-- Advanced -->
-						<h3>
+						<h5>
 							<a class="text-primary" data-toggle="collapse" href="[data-id='appAdvanced']" ng-click="collapseCheck()">
 								<span class="fa {{isCollapsed('appAdvanced') ? 'fa-chevron-circle-right' : 'fa-chevron-circle-down'}}"></span>
 								Advanced
 							</a>
-						</h3>
+						</h5>
 						<div data-id="appAdvanced" class="collapse in">
 							<span class="text-muted" ng-if="advancedFields.length === 0">N/A</span>
 							<div class="form-group" ng-repeat="field in advancedFields track by $index">
 								<label>
 									{{field.displayName || field.name}}
-									<span class="fa fa-question-circle" ng-if="field.description" uib-tooltip="[ {{field.name}} ] {{field.description}}"></span>
+									<span class="fa fa-question-circle" ng-if="field.description" uib-tooltip="{{field.description}} ({{field.name}})"></span>
 								</label>
 								<input type="text" class="form-control" placeholder="{{field.description}}" ng-model="tmpApp.configuration[field.name]" />
 							</div>
 						</div>
 
-						<h3>
+						<h5>
 							<a class="text-primary" data-toggle="collapse" href="[data-id='appCustomize']" ng-click="collapseCheck()">
 								<span class="fa {{isCollapsed('appCustomize') ? 'fa-chevron-circle-right' : 'fa-chevron-circle-down'}}"></span>
-								Customize
+								Custom
 							</a>
-						</h3>
+						</h5>
 						<div data-id="appCustomize" class="collapse in">
 							<div class="form-group" ng-class="{'has-warning': !tmpApp.configuration[field.name]}" ng-repeat="field in customizeFields track by $index">
 								<label>
@@ -304,10 +306,8 @@
 								</label>
 								<input type="text" class="form-control" placeholder="{{field.description}}" ng-model="tmpApp.configuration[field.name]" />
 							</div>
-							<a ng-click="newField()">+ New Field</a>
+							<a ng-click="newField()">+ Add Property</a>
 						</div>
-
-
 					</div>
 				</div>
 			</div>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/adc2ba90/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
index a26810c..988064c 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
@@ -150,20 +150,20 @@
 		// =================== Fields ===================
 		$scope.newField = function () {
 			UI.fieldConfirm({
-				title: "New Field"
+				title: "New Property"
 			}, null, [{
 				field: "name",
-				name: "Field Name"
+				name: "Property Name"
 			}, {
 				field: "value",
-				name: "Field Value",
+				name: "Property Value",
 				optional: true
 			}])(function (entity, closeFunc, unlock) {
 				var fullList = $scope.generalFields.concat($scope.advancedFields).concat($scope.customizeFields);
 				if(common.array.find(entity.name, fullList, "field")) {
 					$.dialog({
 						title: "OPS",
-						content: "Field already exist!"
+						content: "Property already exist!"
 					});
 
 					unlock();

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/adc2ba90/eagle-server/ui-build.sh
----------------------------------------------------------------------
diff --git a/eagle-server/ui-build.sh b/eagle-server/ui-build.sh
old mode 100644
new mode 100755


[46/50] incubator-eagle git commit: [EAGLE-633] MR history feeder read some configurations from eagle server

Posted by ha...@apache.org.
[EAGLE-633] MR history feeder read some configurations from eagle server

Author: wujinhu <wu...@126.com>

Closes #525 from wujinhu/EAGLE-633.


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

Branch: refs/heads/master
Commit: 2479d32791dd1a424af7513279ba28543baf6af4
Parents: 310935d
Author: wujinhu <wu...@126.com>
Authored: Tue Oct 18 17:20:37 2016 +0800
Committer: wujinhu <wu...@126.com>
Committed: Tue Oct 18 17:20:37 2016 +0800

----------------------------------------------------------------------
 .../jpm/mr/history/MRHistoryJobConfig.java      | 20 +++---
 ....history.MRHistoryJobApplicationProvider.xml | 64 +-------------------
 .../src/main/resources/application.conf         |  4 +-
 eagle-server-assembly/src/main/conf/eagle.conf  | 10 +++
 .../src/main/resources/application.conf         | 10 +++
 5 files changed, 33 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2479d327/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java
index 561c3d0..566f7d0 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobConfig.java
@@ -119,11 +119,11 @@ public class MRHistoryJobConfig implements Serializable {
         this.config = config;
 
         //parse eagle zk
-        this.zkStateConfig.zkQuorum = config.getString("zkStateConfig.zkQuorum");
-        this.zkStateConfig.zkSessionTimeoutMs = config.getInt("zkStateConfig.zkSessionTimeoutMs");
-        this.zkStateConfig.zkRetryTimes = config.getInt("zkStateConfig.zkRetryTimes");
-        this.zkStateConfig.zkRetryInterval = config.getInt("zkStateConfig.zkRetryInterval");
-        this.zkStateConfig.zkRoot = config.getString("zkStateConfig.zkRoot");
+        this.zkStateConfig.zkQuorum = config.getString("zookeeper.zkQuorum");
+        this.zkStateConfig.zkSessionTimeoutMs = config.getInt("zookeeper.zkSessionTimeoutMs");
+        this.zkStateConfig.zkRetryTimes = config.getInt("zookeeper.zkRetryTimes");
+        this.zkStateConfig.zkRetryInterval = config.getInt("zookeeper.zkRetryInterval");
+        this.zkStateConfig.zkRoot = config.getString("zookeeper.zkRoot");
 
         //parse job history endpoint
         this.jobHistoryEndpointConfig.site = config.getString("siteId");
@@ -135,12 +135,12 @@ public class MRHistoryJobConfig implements Serializable {
         this.jobHistoryEndpointConfig.timeZone = config.getString("endpointConfig.timeZone");
 
         // parse eagle service endpoint
-        this.eagleServiceConfig.eagleServiceHost = config.getString("eagleService.host");
-        String port = config.getString("eagleService.port");
+        this.eagleServiceConfig.eagleServiceHost = config.getString("service.host");
+        String port = config.getString("service.port");
         this.eagleServiceConfig.eagleServicePort = (port == null ? 8080 : Integer.parseInt(port));
-        this.eagleServiceConfig.username = config.getString("eagleService.username");
-        this.eagleServiceConfig.password = config.getString("eagleService.password");
-        this.eagleServiceConfig.readTimeoutSeconds = config.getInt("eagleService.readTimeOutSeconds");
+        this.eagleServiceConfig.username = config.getString("service.username");
+        this.eagleServiceConfig.password = config.getString("service.password");
+        this.eagleServiceConfig.readTimeoutSeconds = config.getInt("service.readTimeOutSeconds");
 
         LOG.info("Successfully initialized MRHistoryJobConfig");
         LOG.info("zkStateConfig.zkQuorum: " + this.zkStateConfig.zkQuorum);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2479d327/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml b/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
index 9835411..42f3167 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.mr.history.MRHistoryJobApplicationProvider.xml
@@ -36,40 +36,12 @@
         </property>
 
         <property>
-            <name>zkStateConfig.zkQuorum</name>
-            <displayName>Zookeeper Servers</displayName>
-            <description>list of zookeeper servers to connect to</description>
-            <value>sandbox.hortonworks.com:2181</value>
-            <required>true</required>
-        </property>
-        <property>
-            <name>zkStateConfig.zkRoot</name>
+            <name>zookeeper.zkRoot</name>
             <displayName>Zookeeper Root Path</displayName>
             <description>zkRoot that used to save context for this application</description>
             <value>/mrjobhistory_sandbox</value>
             <required>true</required>
         </property>
-        <property>
-            <name>zkStateConfig.zkSessionTimeoutMs</name>
-            <displayName>Zookeeper Session Timeout</displayName>
-            <description>session timeout</description>
-            <value>15000</value>
-            <required>true</required>
-        </property>
-        <property>
-            <name>zkStateConfig.zkRetryTimes</name>
-            <displayName>Zookeeper Retry Times</displayName>
-            <description>retry policy to use - retry times</description>
-            <value>3</value>
-            <required>true</required>
-        </property>
-        <property>
-            <name>zkStateConfig.zkRetryInterval</name>
-            <displayName>Zookeeper Retry Interval</displayName>
-            <description>retry policy to use - retry interval</description>
-            <value>20000</value>
-            <required>true</required>
-        </property>
 
         <property>
             <name>endpointConfig.timeZone</name>
@@ -122,40 +94,6 @@
             <description>User use -Dkey=value to specify name of a job when submit. use this to extract job name from job configuration</description>
             <value>eagle.job.name</value>
         </property>
-        <property>
-            <name>eagleService.host</name>
-            <displayName>Eagle Server Host</displayName>
-            <description>eagle server host</description>
-            <value>sandbox.hortonworks.com</value>
-            <required>true</required>
-        </property>
-        <property>
-            <name>eagleService.port</name>
-            <displayName>Eagle Server Port</displayName>
-            <description>eagle server port</description>
-            <value>9099</value>
-            <required>true</required>
-        </property>
-        <property>
-            <name>eagleService.username</name>
-            <displayName>Eagle Server UserName</displayName>
-            <description>eagle server username used to login</description>
-            <value>admin</value>
-            <required>true</required>
-        </property>
-        <property>
-            <name>eagleService.password</name>
-            <displayName>Eagle Server Password</displayName>
-            <description>eagle server password used to login</description>
-            <value>secret</value>
-            <required>true</required>
-        </property>
-        <property>
-            <name>eagleService.readTimeOutSeconds</name>
-            <displayName>Eagle Server Read TimeOut(seconds)</displayName>
-            <description>eagle server read time out(seconds)</description>
-            <value>60</value>
-        </property>
     </configuration>
     <docs>
         <install>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2479d327/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf b/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf
index 3f84f0a..0eb287f 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/resources/application.conf
@@ -24,7 +24,7 @@
     "mrHistoryJobSpoutTasks" : 6,
   },
 
-  "zkStateConfig" : {
+  "zookeeper" : {
     "zkQuorum" : "sandbox.hortonworks.com:2181",
     "zkRoot" : "/test_mrjobhistory",
     "zkSessionTimeoutMs" : 15000,
@@ -45,7 +45,7 @@
     }
   },
 
-  "eagleService": {
+  "service": {
     "host": "sandbox.hortonworks.com",
     "port": 9099,
     "username": "admin",

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2479d327/eagle-server-assembly/src/main/conf/eagle.conf
----------------------------------------------------------------------
diff --git a/eagle-server-assembly/src/main/conf/eagle.conf b/eagle-server-assembly/src/main/conf/eagle.conf
index 0a3352e..9c804a6 100644
--- a/eagle-server-assembly/src/main/conf/eagle.conf
+++ b/eagle-server-assembly/src/main/conf/eagle.conf
@@ -20,10 +20,20 @@ service {
 	env = "testing"
 	host = "localhost"
 	port = 9090
+	username = "admin"
+	password = "secret"
+	readTimeOutSeconds = 60
 	context = "/rest"
 	timezone = "UTC"
 }
 
+zookeeper {
+	zkQuorum = "localhost:2181"
+	zkSessionTimeoutMs : 15000
+	zkRetryTimes : 3
+	zkRetryInterval : 20000
+}
+
 # ---------------------------------------------
 # Eagle Deep Storage Configuration
 # ---------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2479d327/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
index f2ec772..557fa00 100644
--- a/eagle-server/src/main/resources/application.conf
+++ b/eagle-server/src/main/resources/application.conf
@@ -20,10 +20,20 @@ service {
   env = "testing"
   host = "localhost"
   port = 9090
+  username = "admin"
+  password = "secret"
+  readTimeOutSeconds = 60
   context = "/rest"
   timezone = "UTC"
 }
 
+zookeeper {
+  zkQuorum = "localhost:2181"
+  zkSessionTimeoutMs : 15000
+  zkRetryTimes : 3
+  zkRetryInterval : 20000
+}
+
 # ---------------------------------------------
 # Eagle Deep Storage Configuration
 # ---------------------------------------------


[21/50] incubator-eagle git commit: [MINOR] Update unitApp configuration

Posted by ha...@apache.org.
[MINOR] Update unitApp configuration

1. remove 'topology.name' in AlertUnitTopologyAppProvider.xml
2. remove topology assembly in jpm

Author: Zhao, Qingwen <qi...@apache.org>

Closes #502 from qingwen220/unitApp.


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

Branch: refs/heads/master
Commit: 5e57c7bbc81bf2603ed56ccb5428aeb9869fa48d
Parents: 806a29c
Author: Zhao, Qingwen <qi...@apache.org>
Authored: Fri Oct 14 09:46:49 2016 +0800
Committer: Zhao, Qingwen <qi...@apache.org>
Committed: Fri Oct 14 09:46:49 2016 +0800

----------------------------------------------------------------------
 ...e.alert.app.AlertUnitTopologyAppProvider.xml |  6 --
 eagle-jpm/eagle-hadoop-queue/pom.xml            | 20 ------
 .../assembly/eagle-running-queue-assembly.xml   | 66 --------------------
 eagle-jpm/eagle-jpm-aggregation/pom.xml         | 20 ------
 .../assembly/eagle-jpm-aggregation-assembly.xml | 65 -------------------
 eagle-jpm/eagle-jpm-mr-history/pom.xml          | 20 ------
 .../assembly/eagle-jpm-mr-history-assembly.xml  | 65 -------------------
 eagle-jpm/eagle-jpm-mr-running/pom.xml          | 20 ------
 .../assembly/eagle-jpm-mr-running-assembly.xml  | 65 -------------------
 eagle-jpm/eagle-jpm-spark-history/pom.xml       | 20 ------
 .../eagle-jpm-spark-history-assembly.xml        | 65 -------------------
 eagle-jpm/eagle-jpm-spark-running/pom.xml       | 20 ------
 .../eagle-jpm-spark-running-assembly.xml        | 65 -------------------
 13 files changed, 517 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e57c7bb/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
index 0188210..bf22123 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
+++ b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
@@ -25,12 +25,6 @@
     <configuration>
        <!-- alert topology sizing parameters -->
         <property>
-            <name>topology.name</name>
-            <displayName>topology.name</displayName>
-            <value>alertUnitTopology_1</value>
-            <description>alert topology name</description>
-        </property>
-        <property>
             <name>topology.numOfTotalWorkers</name>
             <displayName>topology.numOfTotalWorkers</displayName>
             <value>2</value>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e57c7bb/eagle-jpm/eagle-hadoop-queue/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-hadoop-queue/pom.xml b/eagle-jpm/eagle-hadoop-queue/pom.xml
index f9cfed5..91568ff 100644
--- a/eagle-jpm/eagle-hadoop-queue/pom.xml
+++ b/eagle-jpm/eagle-hadoop-queue/pom.xml
@@ -65,26 +65,6 @@
                 <directory>src/main/resources</directory>
             </resource>
         </resources>
-        <plugins>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <descriptor>src/assembly/eagle-running-queue-assembly.xml</descriptor>
-                    <finalName>eagle-running-queue-${project.version}</finalName>
-                </configuration>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                        <configuration>
-                            <tarLongFileMode>posix</tarLongFileMode>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
     </build>
 
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e57c7bb/eagle-jpm/eagle-hadoop-queue/src/assembly/eagle-running-queue-assembly.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-hadoop-queue/src/assembly/eagle-running-queue-assembly.xml b/eagle-jpm/eagle-hadoop-queue/src/assembly/eagle-running-queue-assembly.xml
deleted file mode 100644
index 244c5f0..0000000
--- a/eagle-jpm/eagle-hadoop-queue/src/assembly/eagle-running-queue-assembly.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~  Unless required by applicable law or agreed to in writing, software
-  ~  distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  ~
-  -->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
-          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-    <id>assembly</id>
-    <formats>
-        <format>jar</format>
-    </formats>
-    <includeBaseDirectory>false</includeBaseDirectory>
-    <dependencySets>
-        <dependencySet>
-            <outputDirectory>/</outputDirectory>
-            <useProjectArtifact>false</useProjectArtifact>
-            <unpack>true</unpack>
-            <scope>runtime</scope>
-            <unpackOptions>
-                <excludes>
-                    <exclude>**/application.conf</exclude>
-                    <exclude>**/defaults.yaml</exclude>
-                    <exclude>**/*storm.yaml</exclude>
-                    <exclude>**/*storm.yaml.1</exclude>
-                    <exclude>**/log4j.properties</exclude>
-                </excludes>
-            </unpackOptions>
-            <excludes>
-                <exclude>org.apache.storm:storm-core</exclude>
-                <exclude>org.slf4j:slf4j-api</exclude>
-                <exclude>org.slf4j:log4j-over-slf4j</exclude>
-                <exclude>org.slf4j:slf4j-log4j12</exclude>
-                <exclude>log4j:log4j</exclude>
-                <exclude>asm:asm</exclude>
-                <exclude>org.apache.log4j.wso2:log4j</exclude>
-                <exclude>log4j:apache-log4j-extras</exclude>
-                <exclude>org.wso2.orbit.com.lmax:disruptor</exclude>
-            </excludes>
-        </dependencySet>
-    </dependencySets>
-    <fileSets>
-        <fileSet>
-            <directory>${project.build.outputDirectory}/</directory>
-            <outputDirectory>/</outputDirectory>
-            <excludes>
-                <exclude>**/application.conf</exclude>
-                <exclude>**/log4j.properties</exclude>
-                <exclude>**/*.yaml</exclude>
-            </excludes>
-        </fileSet>
-    </fileSets>
-</assembly>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e57c7bb/eagle-jpm/eagle-jpm-aggregation/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-aggregation/pom.xml b/eagle-jpm/eagle-jpm-aggregation/pom.xml
index 354447f..05f274b 100644
--- a/eagle-jpm/eagle-jpm-aggregation/pom.xml
+++ b/eagle-jpm/eagle-jpm-aggregation/pom.xml
@@ -63,25 +63,5 @@
                 <directory>src/main/resources</directory>
             </resource>
         </resources>
-        <plugins>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <descriptor>src/assembly/eagle-jpm-aggregation-assembly.xml</descriptor>
-                    <finalName>eagle-jpm-aggregation-${project.version}</finalName>
-                </configuration>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                        <configuration>
-                            <tarLongFileMode>posix</tarLongFileMode>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
     </build>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e57c7bb/eagle-jpm/eagle-jpm-aggregation/src/assembly/eagle-jpm-aggregation-assembly.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-aggregation/src/assembly/eagle-jpm-aggregation-assembly.xml b/eagle-jpm/eagle-jpm-aggregation/src/assembly/eagle-jpm-aggregation-assembly.xml
deleted file mode 100644
index 66133a0..0000000
--- a/eagle-jpm/eagle-jpm-aggregation/src/assembly/eagle-jpm-aggregation-assembly.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~    http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
-          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-    <id>assembly</id>
-    <formats>
-        <format>jar</format>
-    </formats>
-    <includeBaseDirectory>false</includeBaseDirectory>
-    <dependencySets>
-        <dependencySet>
-            <outputDirectory>/</outputDirectory>
-            <useProjectArtifact>false</useProjectArtifact>
-            <unpack>true</unpack>
-            <scope>runtime</scope>
-            <!--includes>
-                <include>org.apache.hadoop:hadoop-common</include>
-                <include>org.apache.hadoop:hadoop-hdfs</include>
-                <include>org.apache.hadoop:hadoop-client</include>
-                <include>org.apache.hadoop:hadoop-auth</include>
-                <include>org.apache.eagle:eagle-stream-process-api</include>
-                <include>org.apache.eagle:eagle-stream-process-base</include>
-                <include>org.jsoup:jsoup</include>
-            </includes-->
-            <excludes>
-                <exclude>org.wso2.orbit.com.lmax:disruptor</exclude>
-                <exclude>asm:asm</exclude>
-                <exclude>org.apache.storm:storm-core</exclude>
-            </excludes>
-        </dependencySet>
-    </dependencySets>
-    <fileSets>
-        <fileSet>
-            <directory>${project.build.outputDirectory}/</directory>
-            <outputDirectory>/</outputDirectory>
-            <!--<includes>-->
-            <!--<include>*.conf</include>-->
-            <!--<include>*.xml</include>-->
-            <!--<include>*.properties</include>-->
-            <!--<include>*.config</include>-->
-            <!--<include>classes/META-INF/*</include>-->
-            <!--</includes>-->
-
-            <excludes>
-                <exclude>*.yaml</exclude>
-            </excludes>
-        </fileSet>
-    </fileSets>
-</assembly>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e57c7bb/eagle-jpm/eagle-jpm-mr-history/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/pom.xml b/eagle-jpm/eagle-jpm-mr-history/pom.xml
index 6b04fee..f74835b 100644
--- a/eagle-jpm/eagle-jpm-mr-history/pom.xml
+++ b/eagle-jpm/eagle-jpm-mr-history/pom.xml
@@ -81,25 +81,5 @@
                 <directory>src/main/resources</directory>
             </resource>
         </resources>
-        <plugins>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <descriptor>src/assembly/eagle-jpm-mr-history-assembly.xml</descriptor>
-                    <finalName>eagle-jpm-mr-history-${project.version}</finalName>
-                </configuration>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                        <configuration>
-                            <tarLongFileMode>posix</tarLongFileMode>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
     </build>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e57c7bb/eagle-jpm/eagle-jpm-mr-history/src/assembly/eagle-jpm-mr-history-assembly.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/assembly/eagle-jpm-mr-history-assembly.xml b/eagle-jpm/eagle-jpm-mr-history/src/assembly/eagle-jpm-mr-history-assembly.xml
deleted file mode 100644
index 66133a0..0000000
--- a/eagle-jpm/eagle-jpm-mr-history/src/assembly/eagle-jpm-mr-history-assembly.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~    http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
-          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-    <id>assembly</id>
-    <formats>
-        <format>jar</format>
-    </formats>
-    <includeBaseDirectory>false</includeBaseDirectory>
-    <dependencySets>
-        <dependencySet>
-            <outputDirectory>/</outputDirectory>
-            <useProjectArtifact>false</useProjectArtifact>
-            <unpack>true</unpack>
-            <scope>runtime</scope>
-            <!--includes>
-                <include>org.apache.hadoop:hadoop-common</include>
-                <include>org.apache.hadoop:hadoop-hdfs</include>
-                <include>org.apache.hadoop:hadoop-client</include>
-                <include>org.apache.hadoop:hadoop-auth</include>
-                <include>org.apache.eagle:eagle-stream-process-api</include>
-                <include>org.apache.eagle:eagle-stream-process-base</include>
-                <include>org.jsoup:jsoup</include>
-            </includes-->
-            <excludes>
-                <exclude>org.wso2.orbit.com.lmax:disruptor</exclude>
-                <exclude>asm:asm</exclude>
-                <exclude>org.apache.storm:storm-core</exclude>
-            </excludes>
-        </dependencySet>
-    </dependencySets>
-    <fileSets>
-        <fileSet>
-            <directory>${project.build.outputDirectory}/</directory>
-            <outputDirectory>/</outputDirectory>
-            <!--<includes>-->
-            <!--<include>*.conf</include>-->
-            <!--<include>*.xml</include>-->
-            <!--<include>*.properties</include>-->
-            <!--<include>*.config</include>-->
-            <!--<include>classes/META-INF/*</include>-->
-            <!--</includes>-->
-
-            <excludes>
-                <exclude>*.yaml</exclude>
-            </excludes>
-        </fileSet>
-    </fileSets>
-</assembly>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e57c7bb/eagle-jpm/eagle-jpm-mr-running/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-running/pom.xml b/eagle-jpm/eagle-jpm-mr-running/pom.xml
index ec9f29b..aff1a90 100644
--- a/eagle-jpm/eagle-jpm-mr-running/pom.xml
+++ b/eagle-jpm/eagle-jpm-mr-running/pom.xml
@@ -91,25 +91,5 @@
                 <directory>src/main/resources</directory>
             </resource>
         </resources>
-        <plugins>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <descriptor>src/assembly/eagle-jpm-mr-running-assembly.xml</descriptor>
-                    <finalName>eagle-jpm-mr-running-${project.version}</finalName>
-                </configuration>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                        <configuration>
-                            <tarLongFileMode>posix</tarLongFileMode>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
     </build>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e57c7bb/eagle-jpm/eagle-jpm-mr-running/src/assembly/eagle-jpm-mr-running-assembly.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-running/src/assembly/eagle-jpm-mr-running-assembly.xml b/eagle-jpm/eagle-jpm-mr-running/src/assembly/eagle-jpm-mr-running-assembly.xml
deleted file mode 100644
index 66133a0..0000000
--- a/eagle-jpm/eagle-jpm-mr-running/src/assembly/eagle-jpm-mr-running-assembly.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~    http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
-          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-    <id>assembly</id>
-    <formats>
-        <format>jar</format>
-    </formats>
-    <includeBaseDirectory>false</includeBaseDirectory>
-    <dependencySets>
-        <dependencySet>
-            <outputDirectory>/</outputDirectory>
-            <useProjectArtifact>false</useProjectArtifact>
-            <unpack>true</unpack>
-            <scope>runtime</scope>
-            <!--includes>
-                <include>org.apache.hadoop:hadoop-common</include>
-                <include>org.apache.hadoop:hadoop-hdfs</include>
-                <include>org.apache.hadoop:hadoop-client</include>
-                <include>org.apache.hadoop:hadoop-auth</include>
-                <include>org.apache.eagle:eagle-stream-process-api</include>
-                <include>org.apache.eagle:eagle-stream-process-base</include>
-                <include>org.jsoup:jsoup</include>
-            </includes-->
-            <excludes>
-                <exclude>org.wso2.orbit.com.lmax:disruptor</exclude>
-                <exclude>asm:asm</exclude>
-                <exclude>org.apache.storm:storm-core</exclude>
-            </excludes>
-        </dependencySet>
-    </dependencySets>
-    <fileSets>
-        <fileSet>
-            <directory>${project.build.outputDirectory}/</directory>
-            <outputDirectory>/</outputDirectory>
-            <!--<includes>-->
-            <!--<include>*.conf</include>-->
-            <!--<include>*.xml</include>-->
-            <!--<include>*.properties</include>-->
-            <!--<include>*.config</include>-->
-            <!--<include>classes/META-INF/*</include>-->
-            <!--</includes>-->
-
-            <excludes>
-                <exclude>*.yaml</exclude>
-            </excludes>
-        </fileSet>
-    </fileSets>
-</assembly>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e57c7bb/eagle-jpm/eagle-jpm-spark-history/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-spark-history/pom.xml b/eagle-jpm/eagle-jpm-spark-history/pom.xml
index 8f9828d..c63ab1a 100644
--- a/eagle-jpm/eagle-jpm-spark-history/pom.xml
+++ b/eagle-jpm/eagle-jpm-spark-history/pom.xml
@@ -77,25 +77,5 @@
                 <directory>src/main/resources</directory>
             </resource>
         </resources>
-        <plugins>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <descriptor>src/assembly/eagle-jpm-spark-history-assembly.xml</descriptor>
-                    <finalName>eagle-jpm-spark-history-${project.version}</finalName>
-                </configuration>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                        <configuration>
-                            <tarLongFileMode>posix</tarLongFileMode>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
     </build>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e57c7bb/eagle-jpm/eagle-jpm-spark-history/src/assembly/eagle-jpm-spark-history-assembly.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-spark-history/src/assembly/eagle-jpm-spark-history-assembly.xml b/eagle-jpm/eagle-jpm-spark-history/src/assembly/eagle-jpm-spark-history-assembly.xml
deleted file mode 100644
index 66133a0..0000000
--- a/eagle-jpm/eagle-jpm-spark-history/src/assembly/eagle-jpm-spark-history-assembly.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~    http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
-          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-    <id>assembly</id>
-    <formats>
-        <format>jar</format>
-    </formats>
-    <includeBaseDirectory>false</includeBaseDirectory>
-    <dependencySets>
-        <dependencySet>
-            <outputDirectory>/</outputDirectory>
-            <useProjectArtifact>false</useProjectArtifact>
-            <unpack>true</unpack>
-            <scope>runtime</scope>
-            <!--includes>
-                <include>org.apache.hadoop:hadoop-common</include>
-                <include>org.apache.hadoop:hadoop-hdfs</include>
-                <include>org.apache.hadoop:hadoop-client</include>
-                <include>org.apache.hadoop:hadoop-auth</include>
-                <include>org.apache.eagle:eagle-stream-process-api</include>
-                <include>org.apache.eagle:eagle-stream-process-base</include>
-                <include>org.jsoup:jsoup</include>
-            </includes-->
-            <excludes>
-                <exclude>org.wso2.orbit.com.lmax:disruptor</exclude>
-                <exclude>asm:asm</exclude>
-                <exclude>org.apache.storm:storm-core</exclude>
-            </excludes>
-        </dependencySet>
-    </dependencySets>
-    <fileSets>
-        <fileSet>
-            <directory>${project.build.outputDirectory}/</directory>
-            <outputDirectory>/</outputDirectory>
-            <!--<includes>-->
-            <!--<include>*.conf</include>-->
-            <!--<include>*.xml</include>-->
-            <!--<include>*.properties</include>-->
-            <!--<include>*.config</include>-->
-            <!--<include>classes/META-INF/*</include>-->
-            <!--</includes>-->
-
-            <excludes>
-                <exclude>*.yaml</exclude>
-            </excludes>
-        </fileSet>
-    </fileSets>
-</assembly>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e57c7bb/eagle-jpm/eagle-jpm-spark-running/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-spark-running/pom.xml b/eagle-jpm/eagle-jpm-spark-running/pom.xml
index 56114f7..3ab139a 100644
--- a/eagle-jpm/eagle-jpm-spark-running/pom.xml
+++ b/eagle-jpm/eagle-jpm-spark-running/pom.xml
@@ -89,25 +89,5 @@
                 <directory>src/main/resources</directory>
             </resource>
         </resources>
-        <plugins>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <descriptor>src/assembly/eagle-jpm-spark-running-assembly.xml</descriptor>
-                    <finalName>eagle-jpm-spark-running-${project.version}</finalName>
-                </configuration>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                        <configuration>
-                            <tarLongFileMode>posix</tarLongFileMode>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
     </build>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e57c7bb/eagle-jpm/eagle-jpm-spark-running/src/assembly/eagle-jpm-spark-running-assembly.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-spark-running/src/assembly/eagle-jpm-spark-running-assembly.xml b/eagle-jpm/eagle-jpm-spark-running/src/assembly/eagle-jpm-spark-running-assembly.xml
deleted file mode 100644
index 66133a0..0000000
--- a/eagle-jpm/eagle-jpm-spark-running/src/assembly/eagle-jpm-spark-running-assembly.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~    http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
-          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-    <id>assembly</id>
-    <formats>
-        <format>jar</format>
-    </formats>
-    <includeBaseDirectory>false</includeBaseDirectory>
-    <dependencySets>
-        <dependencySet>
-            <outputDirectory>/</outputDirectory>
-            <useProjectArtifact>false</useProjectArtifact>
-            <unpack>true</unpack>
-            <scope>runtime</scope>
-            <!--includes>
-                <include>org.apache.hadoop:hadoop-common</include>
-                <include>org.apache.hadoop:hadoop-hdfs</include>
-                <include>org.apache.hadoop:hadoop-client</include>
-                <include>org.apache.hadoop:hadoop-auth</include>
-                <include>org.apache.eagle:eagle-stream-process-api</include>
-                <include>org.apache.eagle:eagle-stream-process-base</include>
-                <include>org.jsoup:jsoup</include>
-            </includes-->
-            <excludes>
-                <exclude>org.wso2.orbit.com.lmax:disruptor</exclude>
-                <exclude>asm:asm</exclude>
-                <exclude>org.apache.storm:storm-core</exclude>
-            </excludes>
-        </dependencySet>
-    </dependencySets>
-    <fileSets>
-        <fileSet>
-            <directory>${project.build.outputDirectory}/</directory>
-            <outputDirectory>/</outputDirectory>
-            <!--<includes>-->
-            <!--<include>*.conf</include>-->
-            <!--<include>*.xml</include>-->
-            <!--<include>*.properties</include>-->
-            <!--<include>*.config</include>-->
-            <!--<include>classes/META-INF/*</include>-->
-            <!--</includes>-->
-
-            <excludes>
-                <exclude>*.yaml</exclude>
-            </excludes>
-        </fileSet>
-    </fileSets>
-</assembly>


[17/50] incubator-eagle git commit: [EAGLE-614]: NPE in DynamicPolicyLoader

Posted by ha...@apache.org.
[EAGLE-614]: NPE in DynamicPolicyLoader

Author: Zeng, Bryant
Reviewer: ralphsu

This closes #498


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

Branch: refs/heads/master
Commit: 4dfb528c4bf2d8935bac78b10a82b6bc15f0be59
Parents: 74c3cbb
Author: mizeng <mi...@ebaysf.com>
Authored: Thu Oct 13 09:41:15 2016 +0800
Committer: Ralph, Su <su...@gmail.com>
Committed: Thu Oct 13 15:49:03 2016 +0800

----------------------------------------------------------------------
 .../apache/eagle/alert/engine/coordinator/PolicyDefinition.java | 5 ++++-
 .../eagle/alert/coordinator/trigger/DynamicPolicyLoader.java    | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4dfb528c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PolicyDefinition.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PolicyDefinition.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PolicyDefinition.java
index 680b21a..6df682a 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PolicyDefinition.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/engine/coordinator/PolicyDefinition.java
@@ -139,15 +139,18 @@ public class PolicyDefinition implements Serializable {
         if (that == this) {
             return true;
         }
+
         if (!(that instanceof PolicyDefinition)) {
             return false;
         }
+
         PolicyDefinition another = (PolicyDefinition) that;
+
         if (Objects.equals(another.name, this.name)
             && Objects.equals(another.description, this.description)
             && CollectionUtils.isEqualCollection(another.inputStreams, this.inputStreams)
             && CollectionUtils.isEqualCollection(another.outputStreams, this.outputStreams)
-            && another.definition.equals(this.definition)
+            && (another.definition != null && another.definition.equals(this.definition))
             && Objects.equals(this.definition, another.definition)
             && CollectionUtils.isEqualCollection(another.partitionSpec, this.partitionSpec)
             // && another.parallelismHint == this.parallelismHint

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4dfb528c/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/DynamicPolicyLoader.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/DynamicPolicyLoader.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/DynamicPolicyLoader.java
index a60c959..07ae966 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/DynamicPolicyLoader.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/DynamicPolicyLoader.java
@@ -66,7 +66,8 @@ public class DynamicPolicyLoader implements Runnable {
 
             List<String> reallyModifiedPolicies = new ArrayList<>();
             for (String updatedPolicy : potentiallyModifiedPolicies) {
-                if (!currPolicies.get(updatedPolicy).equals(cachedPolicies.get(updatedPolicy))) {
+                if (currPolicies.get(updatedPolicy) != null
+                        && !currPolicies.get(updatedPolicy).equals(cachedPolicies.get(updatedPolicy))) {
                     reallyModifiedPolicies.add(updatedPolicy);
                 }
             }


[18/50] incubator-eagle git commit: [EAGLE-604] Support view/editing application configuration after installed

Posted by ha...@apache.org.
[EAGLE-604] Support view/editing application configuration after installed

Support view/editing application configuration after installed

Author: zombieJ <sm...@gmail.com>

Closes #500 from zombieJ/EAGLE-604.


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

Branch: refs/heads/master
Commit: 1d0f9f5b03acefbfb9af97a83ca19ad3d02d638a
Parents: 4dfb528
Author: zombieJ <sm...@gmail.com>
Authored: Thu Oct 13 16:13:08 2016 +0800
Committer: zombieJ <sm...@gmail.com>
Committed: Thu Oct 13 16:13:08 2016 +0800

----------------------------------------------------------------------
 .../webapp/app/dev/partials/alert/main.html     |  63 ++++----
 .../app/dev/partials/alert/policyDetail.html    |  40 ++---
 .../app/dev/partials/alert/streamList.html      |  47 ++++++
 .../app/dev/partials/integration/main.html      |   1 -
 .../app/dev/partials/integration/site.html      | 145 +++++++++++++++++--
 .../dev/partials/integration/streamList.html    |  52 -------
 .../src/main/webapp/app/dev/public/js/app.js    |  14 +-
 .../src/main/webapp/app/dev/public/js/common.js |  18 ++-
 .../webapp/app/dev/public/js/ctrls/alertCtrl.js |  19 +++
 .../app/dev/public/js/ctrls/alertEditCtrl.js    |   5 +-
 .../app/dev/public/js/ctrls/integrationCtrl.js  | 135 ++++++++++++-----
 .../src/main/webapp/app/dev/public/js/index.js  |   9 +-
 .../dev/public/js/services/applicationSrv.js    |   4 +
 .../app/dev/public/js/services/pageSrv.js       |   6 +-
 14 files changed, 386 insertions(+), 172 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d0f9f5b/eagle-server/src/main/webapp/app/dev/partials/alert/main.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/alert/main.html b/eagle-server/src/main/webapp/app/dev/partials/alert/main.html
index 2e062a8..2e14db9 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/alert/main.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/alert/main.html
@@ -1,29 +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.
-  -->
-
-<div class="nav-tabs-custom">
-	<ul class="nav nav-tabs">
-		<li ng-class="{active: getState() === 'alert.list'}"><a href="#/alert/">Explore Triggered Alerts</a></li>
-		<li ng-class="{active: getState() === 'alert.policyList'}"><a href="#/alert/policyList">Manage Policies</a></li>
-		<li ng-class="{active: ['alert.policyCreate', 'alert.policyEdit'].indexOf(getState()) >= 0}"><a href="#/alert/policyCreate">Define Alert Policy</a></li>
-	</ul>
-	<div class="tab-content no-padding">
-		<div ui-view></div>
-	</div>
-</div>
-
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<div class="nav-tabs-custom">
+	<ul class="nav nav-tabs">
+		<li ng-class="{active: getState() === 'alert.list'}"><a href="#/alert/">Alerts</a></li>
+		<li ng-class="{active: getState() === 'alert.policyList'}"><a href="#/alert/policyList">Policies</a></li>
+		<li ng-class="{active: getState() === 'alert.streamList'}"><a href="#/alert/streamList">Streams</a></li>
+
+		<li
+			ng-class="{active: ['alert.policyCreate', 'alert.policyEdit'].indexOf(getState()) >= 0}"
+			ng-if="['alert.policyCreate', 'alert.policyEdit'].indexOf(getState()) >= 0"
+		><a href="#/alert/policyCreate">Define Alert Policy</a></li>
+	</ul>
+	<div class="tab-content no-padding">
+		<div ui-view></div>
+	</div>
+</div>
+

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d0f9f5b/eagle-server/src/main/webapp/app/dev/partials/alert/policyDetail.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/alert/policyDetail.html b/eagle-server/src/main/webapp/app/dev/partials/alert/policyDetail.html
index b04a8a8..7ec5f39 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/alert/policyDetail.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/alert/policyDetail.html
@@ -18,7 +18,8 @@
 
 <div class="nav-tabs-custom">
 	<ul class="nav nav-tabs">
-		<li class="active"><a href="#policy" data-toggle="tab">Policy</a></li>
+		<li class="active"><a href="#basic" data-toggle="tab">Basic</a></li>
+		<li><a href="#definition" data-toggle="tab">Definition</a></li>
 		<li><a href="#publisher" data-toggle="tab">Publisher</a></li>
 
 		<li class="pull-right">
@@ -30,7 +31,7 @@
 		</li>
 	</ul>
 	<div class="tab-content">
-		<div class="tab-pane active" id="policy">
+		<div class="tab-pane active" id="basic">
 			<table class="table">
 				<tbody>
 					<tr>
@@ -61,26 +62,29 @@
 							</ul>
 						</td>
 					</tr>
-					<tr>
-						<th>Definition</th>
-						<td colspan="3"><pre class="inline">{{policy.definition.value}}</pre></td>
-					</tr>
-					<tr>
-						<th>Partition</th>
-						<td colspan="3">
-							<ul class="no-margin">
-								<li ng-repeat="partition in policy.partitionSpec track by $index">
-									[<span class="text-primary">{{partition.type}}</span>]
-									{{partition.streamId}}:
-									<strong class="text-success">{{partition.columns.join(", ")}}</strong>
-								</li>
-							</ul>
-						</td>
-					</tr>
 				</tbody>
 			</table>
 		</div>
+		<div class="tab-pane" id="definition">
+			<label>Definition</label>
+			<pre>{{policy.definition.value}}</pre>
+
+			<label>Partition</label>
+			<ul class="no-margin">
+				<li ng-repeat="partition in policy.partitionSpec track by $index">
+					[<span class="text-primary">{{partition.type}}</span>]
+					{{partition.streamId}}:
+					<strong class="text-success">{{partition.columns.join(", ")}}</strong>
+				</li>
+				<li ng-if="policy.partitionSpec.length === 0" class="text-muted">
+					No partition
+				</li>
+			</ul>
+		</div>
 		<div class="tab-pane" id="publisher">
+			<p ng-if="publisherList.length === 0" class="text-muted">
+				<span class="fa fa-exclamation-triangle"></span> No publisher configured
+			</p>
 			<table class="table table-bordered" ng-repeat="publisher in publisherList track by publisher.name">
 				<tbody>
 					<tr>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d0f9f5b/eagle-server/src/main/webapp/app/dev/partials/alert/streamList.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/alert/streamList.html b/eagle-server/src/main/webapp/app/dev/partials/alert/streamList.html
new file mode 100644
index 0000000..79f15a6
--- /dev/null
+++ b/eagle-server/src/main/webapp/app/dev/partials/alert/streamList.html
@@ -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
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<div class="box-body">
+	<div sort-table="streamList">
+		<table class="table table-bordered table-hover">
+			<thead>
+				<tr>
+					<th>Stream</th>
+					<th>Provider (App)</th>
+					<th>Site</th>
+					<th>Schema</th>
+				</tr>
+			</thead>
+			<tbody>
+				<tr>
+					<td><span class="label label-primary">{{item.streamId}}</span></td>
+					<td>{{item.appType}}</td>
+					<td>{{item.siteId}}</td>
+					<td>
+						<ul class="no-margin">
+							<li ng-repeat="column in item.schema.columns track by $index">
+								<strong>{{column.name}}</strong>:
+								{{column.type}}
+							</li>
+						</ul>
+					</td>
+				</tr>
+			</tbody>
+		</table>
+	</div>
+</div>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d0f9f5b/eagle-server/src/main/webapp/app/dev/partials/integration/main.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/integration/main.html b/eagle-server/src/main/webapp/app/dev/partials/integration/main.html
index daea22e..3a063d7 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/integration/main.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/integration/main.html
@@ -20,7 +20,6 @@
 	<ul class="nav nav-tabs">
 		<li ng-class="{active: getState().indexOf('integration.site') !== -1}"><a href="#/integration/siteList">Sites</a></li>
 		<li ng-class="{active: getState() === 'integration.applicationList'}"><a href="#/integration/applicationList">Applications</a></li>
-		<li ng-class="{active: getState() === 'integration.streamList'}"><a href="#/integration/streamList">Streams</a></li>
 	</ul>
 	<div class="tab-content no-padding">
 		<div ui-view></div>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d0f9f5b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
index 4c118dc..e320c48 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
@@ -17,17 +17,33 @@
   -->
 
 <div class="box-body">
-	<p class="text-danger" ng-if="site.applicationList.length === 0">
-		<span class="fa fa-exclamation-triangle"></span> Site must install at least one application to start up.
-	</p>
-	<p class="text-warning" ng-if="site.applicationList.length !== 0 && getStartedAppCount() === 0">
-		<span class="fa fa-exclamation-triangle"></span> No application started.
-	</p>
+
+
+	<div class="form-group">
+		<label>Site</label>
+		<input type="text" class="form-control" readonly ng-model="siteName">
+	</div>
+	<div class="form-group">
+		<label>Description</label>
+		<textarea class="form-control" readonly ng-model="site.description" rows="2"></textarea>
+	</div>
+
+	<label>Application</label>
+	<span class="text-danger" ng-if="site.applicationList.length === 0">
+		(<span class="fa fa-exclamation-triangle"></span> Site must install at least one application to start up.)
+	</span>
+	<span class="text-warning" ng-if="site.applicationList.length !== 0 && getStartedAppCount() === 0">
+		(<span class="fa fa-exclamation-triangle"></span> No application started.)
+	</span>
 
 	<table class="table table-bordered table-hover">
 		<thead>
 			<tr>
-				<th>App</th>
+				<th>
+					<small class="pull-right"><a ng-click="refreshApplications()">Refresh</a></small>
+					Name
+					<span class="fa fa-refresh fa-spin no-animate" ng-show="!Application.list._done"></span>
+				</th>
 				<th width="10">Status</th>
 				<th>Version</th>
 				<th>Description</th>
@@ -48,9 +64,24 @@
 				<td class="text-center">
 					<div class="btn-group btn-group-xs" ng-if="app.installed">
 						<!--button class="btn btn-default btn-sm">Monitor</button-->
-						<button class="btn btn-default btn-sm" ng-click="startApp(app)">Start</button>
-						<button class="btn btn-default btn-sm" ng-click="stopApp(app)">Stop</button>
-						<button class="btn btn-default btn-sm" ng-click="uninstallApp(app)">Uninstall</button>
+						<button class="btn btn-default btn-sm" ng-click="startApp(app)" ng-if="app.descriptor.executable">
+							<span class="fa fa-play"></span>
+						</button>
+						<button class="btn btn-default btn-sm" ng-click="stopApp(app)" ng-if="app.descriptor.executable">
+							<span class="fa fa-stop"></span>
+						</button>
+						<button class="btn btn-default btn-sm" disabled="disabled" ng-if="!app.descriptor.executable">
+							<span class="fa fa-ban"></span>
+						</button>
+						<button class="btn btn-default btn-sm" disabled="disabled" ng-if="!app.descriptor.executable">
+							<span class="fa fa-ban"></span>
+						</button>
+						<button class="btn btn-default btn-sm" ng-click="editApp(app)">
+							<span class="fa fa-pencil"></span>
+						</button>
+						<button class="btn btn-danger btn-sm" ng-click="uninstallApp(app)">
+							<span class="fa fa-trash"></span>
+						</button>
 					</div>
 					<div class="btn-group btn-group-xs" ng-if="!app.installed">
 						<button class="btn btn-primary btn-sm" ng-click="installApp(app)">Install Application</button>
@@ -75,11 +106,80 @@
 			</div>
 			<div class="modal-body">
 				<ul class="nav nav-tabs">
-					<li class="active"><a href="[data-id='install']" data-toggle="tab">Install</a></li>
+					<li><a href="[data-id='intro']" data-toggle="tab" data-id="introTab">Application</a></li>
+					<li><a href="[data-id='install']" data-toggle="tab">Install</a></li>
 					<li><a href="[data-id='uninstall']" data-toggle="tab">Uninstall</a></li>
 				</ul>
 				<div class="tab-content">
-					<div class="tab-pane active" data-id="install">
+					<div class="tab-pane" data-id="intro">
+						<table class="table">
+							<tbody>
+								<tr>
+									<th>Application Name</th>
+									<td>{{application.name}}</td>
+									<th>Type</th>
+									<td>{{application.type}}</td>
+								</tr>
+								<tr ng-if="tmpApp.uuid">
+									<th>Application Id</th>
+									<td>{{tmpApp.appId}}</td>
+									<th>UUID</th>
+									<td>{{tmpApp.uuid}}</td>
+								</tr>
+								<tr ng-if="tmpApp.uuid">
+									<th>Mode</th>
+									<td>{{tmpApp.mode}}</td>
+									<th>Status</th>
+									<td>{{tmpApp.status}}</td>
+								</tr>
+								<tr>
+									<th>View Path</th>
+									<td>{{application.viewPath}}</td>
+									<th>Version</th>
+									<td>{{application.version}}</td>
+								</tr>
+								<tr>
+									<th>Jar Path</th>
+									<td colspan="3">{{tmpApp.jarPath || application.jarPath}}</td>
+								</tr>
+								<tr>
+									<th>Application Class</th>
+									<td colspan="3">{{application.appClass}}</td>
+								</tr>
+								<tr>
+									<th>Provider Class</th>
+									<td colspan="3">{{application.providerClass}}</td>
+								</tr>
+								<tr>
+									<th>Description</th>
+									<td colspan="3">{{application.description}}</td>
+								</tr>
+								<tr>
+									<th>Dependencies</th>
+									<td colspan="3">
+										<ul>
+											<li ng-repeat="dep in application.dependencies track by $index">
+												{{Application.findProvider(dep.type).name}}
+												({{dep.type}})
+											</li>
+										</ul>
+									</td>
+								</tr>
+								<tr ng-if="tmpApp.uuid">
+									<th>Configuration</th>
+									<td colspan="3">
+										<ul>
+											<li ng-repeat="(key, value) in tmpApp.configuration track by $index">
+												<strong>{{key}}:</strong>
+												{{value}}
+											</li>
+										</ul>
+									</td>
+								</tr>
+							</tbody>
+						</table>
+					</div>
+					<div class="tab-pane" data-id="install">
 						<pre ng-bind-html="installHTML"></pre>
 					</div>
 					<div class="tab-pane" data-id="uninstall">
@@ -106,11 +206,28 @@
 			</div>
 			<div class="modal-body">
 				<ul class="nav nav-tabs">
-					<li class="active"><a href="[data-id='environment']" data-toggle="tab">Environment</a></li>
+					<li><a href="[data-id='guide']" data-toggle="tab" data-id="guideTab">Guide</a></li>
+					<li><a href="[data-id='environment']" data-toggle="tab">Environment</a></li>
 					<li><a href="[data-id='configuration']" data-toggle="tab" data-id="configTab">Configuration</a></li>
 				</ul>
 				<div class="tab-content">
-					<div class="tab-pane active" data-id="environment">
+					<div class="tab-pane" data-id="guide">
+						<label>Dependencies</label>
+						<ul>
+							<li ng-repeat="dep in application.dependencies track by $index">
+								<strong class="text-success" ng-if="!!Application.find(dep.type, site.siteId)[0]">[ Installed ]</strong>
+								<strong class="text-danger" ng-if="!Application.find(dep.type, site.siteId)[0]">[
+									<span class="fa fa-exclamation-triangle"></span>Require
+								]</strong>
+								{{Application.findProvider(dep.type).name}}
+								({{dep.type}})
+							</li>
+						</ul>
+
+						<label>Install</label>
+						<pre ng-bind-html="installHTML"></pre>
+					</div>
+					<div class="tab-pane" data-id="environment">
 						<div class="form-group">
 							<label>Mode</label>
 							<select class="form-control" ng-model="tmpApp.mode">

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d0f9f5b/eagle-server/src/main/webapp/app/dev/partials/integration/streamList.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/integration/streamList.html b/eagle-server/src/main/webapp/app/dev/partials/integration/streamList.html
deleted file mode 100644
index beaf743..0000000
--- a/eagle-server/src/main/webapp/app/dev/partials/integration/streamList.html
+++ /dev/null
@@ -1,52 +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.
-  -->
-
-<div class="box-body">
-	<div sort-table="streamList">
-		<table class="table table-bordered table-hover">
-			<thead>
-				<tr>
-					<th>Stream</th>
-					<th>Provider (App)</th>
-					<th>Site</th>
-					<th>Schema</th>
-					<th width="10">Actions</th>
-				</tr>
-			</thead>
-			<tbody>
-				<tr>
-					<td><span class="label label-primary">{{item.streamId}}</span></td>
-					<td>{{item.appType}}</td>
-					<td>{{item.siteId}}</td>
-					<td>
-						<ul class="no-margin">
-							<li ng-repeat="column in item.schema.columns track by $index">
-								<strong>{{column.name}}</strong>:
-								{{column.type}}
-							</li>
-						</ul>
-					</td>
-					<td>
-						<!-- TODO:link with alert -->
-						<button class="btn btn-primary btn-sm">New Alert</button>
-					</td>
-				</tr>
-			</tbody>
-		</table>
-	</div>
-</div>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d0f9f5b/eagle-server/src/main/webapp/app/dev/public/js/app.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/app.js b/eagle-server/src/main/webapp/app/dev/public/js/app.js
index fb40ed4..cdb705c 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/app.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/app.js
@@ -103,6 +103,12 @@ var app = {};
 					controller: "policyListCtrl",
 					resolve: routeResolve()
 				})
+				.state('alert.streamList', {
+					url: "streamList",
+					templateUrl: "partials/alert/streamList.html?_=" + window._TRS(),
+					controller: "alertStreamListCtrl",
+					resolve: routeResolve()
+				})
 				.state('alert.policyCreate', {
 					url: "policyCreate",
 					templateUrl: "partials/alert/policyEdit.html?_=" + window._TRS(),
@@ -122,6 +128,7 @@ var app = {};
 					controller: "policyDetailCtrl",
 					resolve: routeResolve()
 				})
+
 				// =============================== Integration ==============================
 				.state('integration', {
 					abstract: true,
@@ -148,12 +155,7 @@ var app = {};
 					controller: "integrationApplicationListCtrl",
 					resolve: routeResolve({ application: false })
 				})
-				.state('integration.streamList', {
-					url: "streamList",
-					templateUrl: "partials/integration/streamList.html?_=" + window._TRS(),
-					controller: "integrationStreamListCtrl",
-					resolve: routeResolve()
-				})
+
 				// ================================== Site ==================================
 				.state('site', {
 					url: "/site/:siteId",

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d0f9f5b/eagle-server/src/main/webapp/app/dev/public/js/common.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/common.js b/eagle-server/src/main/webapp/app/dev/public/js/common.js
index 0e9cc7c..7d41371 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/common.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/common.js
@@ -97,15 +97,17 @@
 	};
 
 	common.parseJSON = function (str, defaultVal) {
-		try {
-			str = (str + "").trim();
-			if(Number(str).toString() === str) throw "Number format";
-			return JSON.parse(str);
-		} catch(err) {
-			if(defaultVal === undefined) {
-				console.warn("Can't parse JSON: " + str);
-			}
+		if(str && Number(str).toString() !== str) {
+			try {
+				str = (str + "").trim();
+				return JSON.parse(str);
+			} catch(err) {}
+		}
+
+		if(arguments.length === 1) {
+			console.warn("Can't parse JSON: " + str);
 		}
+
 		return defaultVal === undefined ? null : defaultVal;
 	};
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d0f9f5b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
index b5eba07..eeea083 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
@@ -58,6 +58,25 @@
 	});
 
 	// ======================================================================================
+	// =                                       Stream                                       =
+	// ======================================================================================
+	eagleControllers.controller('alertStreamListCtrl', function ($scope, $wrapState, PageConfig, Application) {
+		PageConfig.title = "Alert";
+		PageConfig.subTitle = "Streams";
+
+		$scope.streamList = $.map(Application.list, function (app) {
+			return (app.streams || []).map(function (stream) {
+				return {
+					streamId: stream.streamId,
+					appType: app.descriptor.type,
+					siteId: app.site.siteId,
+					schema: stream.schema
+				};
+			});
+		});
+	});
+
+	// ======================================================================================
 	// =                                       Policy                                       =
 	// ======================================================================================
 	eagleControllers.controller('policyListCtrl', function ($scope, $wrapState, PageConfig, Entity, UI) {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d0f9f5b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
index 3e9d13e..3bcd8d8 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
@@ -281,9 +281,10 @@
 			common.deferred.all(publisherPromiseList.concat(policyPromise)).then(function () {
 				$.dialog({
 					title: "Done",
-					content: "Click confirm to go to the policy detail page."
+					content: "Close dialog to go to the policy detail page."
+				}, function () {
+					$wrapState.go("policyDetail", {name: $scope.policy.name});
 				});
-				$wrapState.go("policyDetail", {name: $scope.policy.name});
 			}, function (failedList) {
 				$.dialog({
 					title: "OPS",

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d0f9f5b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
index 8674df3..ca6c92e 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
@@ -62,7 +62,7 @@
 		};
 	});
 
-	eagleControllers.controller('integrationSiteCtrl', function ($sce, $scope, $wrapState, PageConfig, Entity, UI, Site, Application) {
+	eagleControllers.controller('integrationSiteCtrl', function ($sce, $scope, $wrapState, $interval, PageConfig, Entity, UI, Site, Application) {
 		PageConfig.title = "Site";
 		PageConfig.subTitle = $wrapState.param.id;
 
@@ -77,6 +77,9 @@
 			});
 			return;
 		}
+		console.log("[Site]", $scope.site);
+
+		$scope.siteName = $scope.site.siteId + ($scope.site.siteName ? "(" + $scope.site.siteName + ")" : "");
 
 		// Map applications
 		function mapApplications() {
@@ -94,9 +97,9 @@
 		mapApplications();
 
 		// Application refresh
-		function refreshApplications() {
+		var refreshApplications = $scope.refreshApplications = function() {
 			Application.reload().getPromise().then(mapApplications);
-		}
+		};
 
 		// Application status class
 		$scope.getAppStatusClass = function (application) {
@@ -124,6 +127,9 @@
 
 		// Application detail
 		$scope.showAppDetail = function (application) {
+			$("a[data-id='introTab']").click();
+
+			$scope.tmpApp = application;
 			application = application.origin;
 			var docs = application.docs || {install: "", uninstall: ""};
 			$scope.application = application;
@@ -167,11 +173,12 @@
 
 		$scope.removeField = function (field) {
 			$scope.tmpAppConfigFields = common.array.remove(field, $scope.tmpAppConfigFields);
+			delete $scope.tmpApp.configuration[field.name];
 		};
 
 		$scope.checkFields = function () {
 			var pass = true;
-			var config = common.getValueByPath($scope, ["tmpApp", "configuration"]);
+			var config = common.getValueByPath($scope, ["tmpApp", "configuration"], {});
 			$.each($scope.tmpAppConfigFields, function (i, field) {
 				if(field.required && !config[field.name]) {
 					pass = false;
@@ -184,38 +191,86 @@
 		$scope.installAppConfirm = function () {
 			$scope.installLock = true;
 
-			Entity.create("apps/install", $scope.tmpApp)._then(function () {
-				refreshApplications();
-				$("#installMDL").modal("hide");
-			}, function (res) {
-				$.dialog({
-					title: "OPS",
-					content: res.data.message
+			var uuid = $scope.tmpApp.uuid;
+			delete $scope.tmpApp.uuid;
+
+			if(uuid) {
+				Entity.create("apps/" + uuid, $scope.tmpApp)._then(function () {
+					refreshApplications();
+					$("#installMDL").modal("hide");
+				}, function (res) {
+					$.dialog({
+						title: "OPS",
+						content: res.data.message
+					});
+					$scope.installLock = false;
 				});
-				$scope.installLock = false;
-			});
+			} else {
+				Entity.create("apps/install", $scope.tmpApp)._then(function () {
+					refreshApplications();
+					$("#installMDL").modal("hide");
+				}, function (res) {
+					$.dialog({
+						title: "OPS",
+						content: res.data.message
+					});
+					$scope.installLock = false;
+				});
+			}
 		};
 
 		// Install application
-		$scope.installApp = function (application) {
+		$scope.installApp = function (application, entity) {
+			entity = entity || {};
 			application = application.origin;
 			$scope.installLock = false;
 			$scope.application = application;
 			$scope.tmpApp = {
-				siteId: $scope.site.siteId,
-				appType: application.type,
 				mode: "CLUSTER",
 				jarPath: application.jarPath,
 				configuration: {}
 			};
 
-			$scope.tmpAppConfigFields = common.getValueByPath(application, "configuration.properties", []);
-			$.each($scope.tmpAppConfigFields, function (i, field) {
+			if(!entity.uuid) {
+				common.merge($scope.tmpApp, {
+					siteId: $scope.site.siteId,
+					appType: application.type
+				});
+			}
+
+			var fields = $scope.tmpAppConfigFields = common.getValueByPath(application, "configuration.properties", []).concat();
+
+			$.each(fields, function (i, field) {
 				$scope.tmpApp.configuration[field.name] = field.value;
 			});
 
+			// Fill miss field of entity
+			common.merge($scope.tmpApp, entity);
+			$.each(entity.configuration || {}, function (key) {
+				if(!common.array.find(key, fields, ["name"])) {
+					fields.push({
+						name: key,
+						_customize: true,
+						required: true
+					});
+				}
+			});
+
+			// Dependencies check
+			var missDep = false;
+			$.each(application.dependencies, function (i, dep) {
+				if(!Application.find(dep.type, $scope.site.siteId)[0]) {
+					missDep = true;
+					return false;
+				}
+			});
+
 			$("#installMDL").modal();
-			$("a[data-id='configTab']").click();
+			if(missDep) {
+				$("a[data-id='guideTab']").click();
+			} else {
+				$("a[data-id='configTab']").click();
+			}
 		};
 
 		// Uninstall application
@@ -229,6 +284,9 @@
 			});
 		};
 
+		// ================================================================
+		// =                          Management                          =
+		// ================================================================
 		// Start application
 		$scope.startApp = function (application) {
 			Entity.post("apps/start", { uuid: application.uuid })._then(function () {
@@ -242,6 +300,26 @@
 				refreshApplications();
 			});
 		};
+
+		$scope.editApp = function (application) {
+			var type = application.descriptor.type;
+			var provider = Application.findProvider(type);
+
+			$scope.installApp({origin: provider}, {
+				mode: application.mode,
+				jarPath: application.jarPath,
+				uuid: application.uuid,
+				configuration: $.extend({}, application.configuration)
+			});
+		};
+
+		// ================================================================
+		// =                             Sync                             =
+		// ================================================================
+		var refreshInterval = $interval(refreshApplications, 1000 * 60);
+		$scope.$on('$destroy', function() {
+			$interval.cancel(refreshInterval);
+		});
 	});
 
 	// ======================================================================================
@@ -259,23 +337,4 @@
 			$("#appMDL").modal();
 		};
 	});
-
-	// ======================================================================================
-	// =                                       Stream                                       =
-	// ======================================================================================
-	eagleControllers.controller('integrationStreamListCtrl', function ($scope, $wrapState, PageConfig, Application) {
-		PageConfig.title = "Integration";
-		PageConfig.subTitle = "Streams";
-
-		$scope.streamList = $.map(Application.list, function (app) {
-			return (app.streams || []).map(function (stream) {
-				return {
-					streamId: stream.streamId,
-					appType: app.descriptor.type,
-					siteId: app.site.siteId,
-					schema: stream.schema
-				};
-			});
-		});
-	});
 }());

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d0f9f5b/eagle-server/src/main/webapp/app/dev/public/js/index.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/index.js b/eagle-server/src/main/webapp/app/dev/public/js/index.js
index 906479f..633832e 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/index.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/index.js
@@ -26,7 +26,7 @@
 	var _app = {};
 	if(localStorage) {
 		_host = localStorage.getItem("host") || "";
-		_app = common.parseJSON(localStorage.getItem("app") || "") || {};
+		_app = common.parseJSON(localStorage.getItem("app"), {});
 	}
 
 	window._host = function (host) {
@@ -51,6 +51,13 @@
 		return _app;
 	};
 
+	window._app.clear = function () {
+		if(localStorage) {
+			_app = {};
+			localStorage.removeItem("app");
+		}
+	};
+
 	// ======================================================================================
 	// =                                      Register                                      =
 	// ======================================================================================

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d0f9f5b/eagle-server/src/main/webapp/app/dev/public/js/services/applicationSrv.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/services/applicationSrv.js b/eagle-server/src/main/webapp/app/dev/public/js/services/applicationSrv.js
index fac44f9..31c6fb6 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/services/applicationSrv.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/services/applicationSrv.js
@@ -57,6 +57,10 @@
 			});
 		});
 
+		Application.findProvider = function (type) {
+			return common.array.find(type, Application.providerList, ["type"]);
+		};
+
 		Application.getPromise = function () {
 			return Application.list._promise.then(function() {
 				return Application;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d0f9f5b/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js b/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
index 732f820..04e3b77 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
@@ -49,15 +49,15 @@
 		]},*/
 		{name: "Alert", icon: "bell", list: [
 			{name: "Explore Alerts", path: "#/alert/"},
-			{name: "Manage Policies", path: "#/alert/policyList"},
+			{name: "Policies", path: "#/alert/policyList"},
+			{name: "Streams", path: "#/alert/streamList"},
 			{name: "Define Policy", path: "#/alert/policyCreate"}
 		]}
 	];
 	var adminPortalList = [
 		{name: "Integration", icon: "puzzle-piece", list: [
 			{name: "Sites", path: "#/integration/siteList"},
-			{name: "Applications", path: "#/integration/applicationList"},
-			{name: "Streams", path: "#/integration/streamList"}
+			{name: "Applications", path: "#/integration/applicationList"}
 		]}
 	];
 


[07/50] incubator-eagle git commit: [MINOR] Update HdfsAuditLogAppProvider.xml

Posted by ha...@apache.org.
[MINOR] Update HdfsAuditLogAppProvider.xml

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

Closes #488 from qingwen220/hdfsAuditLog.


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

Branch: refs/heads/master
Commit: 9205433bccefd1b8e477dc09ef7e7ef5ae15ab41
Parents: 36df3ee
Author: Zhao, Qingwen <qi...@apache.org>
Authored: Tue Oct 11 09:55:14 2016 +0800
Committer: Zhao, Qingwen <qi...@ebay.com>
Committed: Tue Oct 11 09:55:14 2016 +0800

----------------------------------------------------------------------
 .../environment/impl/StormExecutionRuntime.java   |  2 +-
 ....security.auditlog.HdfsAuditLogAppProvider.xml | 18 +++++++++++++++---
 .../src/main/resources/application.conf           |  1 -
 3 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9205433b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
index 9821660..1994e28 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
@@ -157,7 +157,7 @@ public class StormExecutionRuntime implements ExecutionRuntime<StormEnvironment,
     @Override
     public ApplicationEntity.Status status(Application<StormEnvironment, StormTopology> executor, com.typesafe.config.Config config) {
         String appId = config.getString("appId");
-        LOG.info("Fetching status of topology {} ..." + appId);
+        LOG.info("Fetching status of topology {} ...", appId);
         List<TopologySummary> topologySummaries ;
         try {
             if (Objects.equals(config.getString("mode"), ApplicationEntity.Mode.CLUSTER.name())) {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9205433b/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.auditlog.HdfsAuditLogAppProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.auditlog.HdfsAuditLogAppProvider.xml b/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.auditlog.HdfsAuditLogAppProvider.xml
index cd564df..625a3a7 100644
--- a/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.auditlog.HdfsAuditLogAppProvider.xml
+++ b/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.auditlog.HdfsAuditLogAppProvider.xml
@@ -27,6 +27,12 @@
     <configuration>
         <!-- topology related configurations -->
         <property>
+            <name>workers</name>
+            <displayName>workers</displayName>
+            <value>1</value>
+            <description>number of topology workers</description>
+        </property>
+        <property>
             <name>topology.numOfSpoutTasks</name>
             <displayName>topology.numOfSpoutTasks</displayName>
             <value>2</value>
@@ -39,10 +45,16 @@
             <description>number of parser tasks</description>
         </property>
         <property>
-            <name>topology.numOfJoinTasks</name>
-            <displayName>topology.numOfJoinTasks</displayName>
+            <name>topology.numOfSensitivityJoinTasks</name>
+            <displayName>topology.numOfSensitivityJoinTasks</displayName>
+            <value>2</value>
+            <description>number of sensitivity join tasks</description>
+        </property>
+        <property>
+            <name>topology.numOfIPZoneJoinTasks</name>
+            <displayName>topology.numOfIPZoneJoinTasks</displayName>
             <value>2</value>
-            <description>number of external join tasks</description>
+            <description>number of ip zone join tasks</description>
         </property>
         <property>
             <name>topology.numOfSinkTasks</name>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9205433b/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/application.conf b/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/application.conf
index ed4609d..c8bbcb1 100644
--- a/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/application.conf
+++ b/eagle-security/eagle-security-hdfs-auditlog/src/main/resources/application.conf
@@ -18,7 +18,6 @@
   "mode" : "LOCAL",
   "siteId" : "testsite",
   "topology" : {
-    "numOfTotalWorkers" : 2,
     "numOfSpoutTasks" : 2,
     "numOfParserTasks" : 2,
     "numOfSensitivityJoinTasks" : 2,


[13/50] incubator-eagle git commit: EAGLE-609: Fix nullPointerException in DefaultDeduplicator

Posted by ha...@apache.org.
EAGLE-609: Fix nullPointerException in DefaultDeduplicator

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

Author: Zhao, Qingwen <qi...@apache.org>

Closes #492 from qingwen220/EAGLE-609.


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

Branch: refs/heads/master
Commit: 279bc01cd6115281d44df7f81ac3b2be9f3b748f
Parents: fc2407c
Author: Zhao, Qingwen <qi...@apache.org>
Authored: Wed Oct 12 12:16:37 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Wed Oct 12 12:16:37 2016 +0800

----------------------------------------------------------------------
 ...e.alert.app.AlertUnitTopologyAppProvider.xml |  6 ++++++
 .../publisher/impl/DefaultDeduplicator.java     | 21 +++++++++++---------
 .../auditlog/HdfsAuditLogParserBolt.java        |  8 ++++----
 3 files changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/279bc01c/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
index bf22123..0188210 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
+++ b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/resources/META-INF/providers/org.apache.eagle.alert.app.AlertUnitTopologyAppProvider.xml
@@ -25,6 +25,12 @@
     <configuration>
        <!-- alert topology sizing parameters -->
         <property>
+            <name>topology.name</name>
+            <displayName>topology.name</displayName>
+            <value>alertUnitTopology_1</value>
+            <description>alert topology name</description>
+        </property>
+        <property>
             <name>topology.numOfTotalWorkers</name>
             <displayName>topology.numOfTotalWorkers</displayName>
             <value>2</value>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/279bc01c/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/DefaultDeduplicator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/DefaultDeduplicator.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/DefaultDeduplicator.java
index a3969ab..ac99db3 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/DefaultDeduplicator.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/DefaultDeduplicator.java
@@ -116,19 +116,22 @@ public class DefaultDeduplicator implements AlertDeduplicator {
                 continue;
             }
             String colName = streamDefinition.getColumns().get(i).getName();
+            Object colValue = event.getData()[i];
 
-            if (colName.equals(dedupStateField)) {
-                stateFiledValue = event.getData()[i].toString();
+            if (colName.equals(dedupStateField) && colValue != null) {
+                stateFiledValue = colValue.toString();
             }
 
             // make all of the field as unique key if no custom dedup field provided
-            if (customDedupFields == null || customDedupFields.size() <= 0) {
-                customFieldValues.put(colName, event.getData()[i].toString());
-            } else {
-                for (String field : customDedupFields) {
-                    if (colName.equals(field)) {
-                        customFieldValues.put(field, event.getData()[i].toString());
-                        break;
+            if (colValue != null) {
+                if (customDedupFields == null || customDedupFields.size() <= 0) {
+                    customFieldValues.put(colName, colValue.toString());
+                } else {
+                    for (String field : customDedupFields) {
+                        if (colName.equals(field)) {
+                            customFieldValues.put(field, colValue.toString());
+                            break;
+                        }
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/279bc01c/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/HdfsAuditLogParserBolt.java
----------------------------------------------------------------------
diff --git a/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/HdfsAuditLogParserBolt.java b/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/HdfsAuditLogParserBolt.java
index 5ea5950..1134cb5 100644
--- a/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/HdfsAuditLogParserBolt.java
+++ b/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/HdfsAuditLogParserBolt.java
@@ -52,7 +52,7 @@ public class HdfsAuditLogParserBolt extends BaseRichBolt {
 
         HDFSAuditLogParser parser = new HDFSAuditLogParser();
         HDFSAuditLogObject entity = null;
-        try{
+        try {
             entity = parser.parse(logLine);
             Map<String, Object> map = new TreeMap<String, Object>();
             map.put("src", entity.src);
@@ -63,9 +63,9 @@ public class HdfsAuditLogParserBolt extends BaseRichBolt {
             map.put("user", entity.user);
             map.put("cmd", entity.cmd);
             collector.emit(Arrays.asList(map));
-        }catch(Exception ex){
-            LOG.error("Failing parse audit log message", ex);
-        }finally {
+        } catch (Exception ex) {
+            LOG.error("Failing parse audit log message {}", logLine, ex);
+        } finally {
             collector.ack(input);
         }
     }


[41/50] incubator-eagle git commit: [EAGLE-599] improve application config

Posted by ha...@apache.org.
[EAGLE-599] improve application config

* Support JSON import
* UI adjust - separate the general fields & merge env and config tab

Author: zombieJ <sm...@gmail.com>

Closes #519 from zombieJ/EAGLE-599.


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

Branch: refs/heads/master
Commit: ecda7d5abfe30125f9c9b7ee3ebf8e8a49ce054e
Parents: eda6e58
Author: zombieJ <sm...@gmail.com>
Authored: Mon Oct 17 15:41:24 2016 +0800
Committer: zombieJ <sm...@gmail.com>
Committed: Mon Oct 17 15:41:24 2016 +0800

----------------------------------------------------------------------
 .../app/dev/partials/integration/site.html      | 105 +++++++++++++-----
 .../app/dev/public/js/ctrls/integrationCtrl.js  | 108 +++++++++++++++----
 2 files changed, 164 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/ecda7d5a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
index db6b7c7..ce0cddd 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
@@ -21,7 +21,7 @@
 
 	<div class="form-group">
 		<label>Site</label>
-		<input type="text" class="form-control" readonly ng-model="site.siteName">
+		<input type="text" class="form-control" readonly ng-model="siteName">
 	</div>
 	<div class="form-group">
 		<label>Description</label>
@@ -48,7 +48,7 @@
 				<th>Version</th>
 				<th>Description</th>
 				<!--th>Quick Links</th-->
-				<th width="150">Actions</th>
+				<th width="110">Actions</th>
 			</tr>
 		</thead>
 		<tbody>
@@ -84,7 +84,7 @@
 						</button>
 					</div>
 					<div class="btn-group btn-group-xs" ng-if="!app.installed">
-						<button class="btn btn-primary btn-sm" ng-click="installApp(app)">Install</button>
+						<button class="btn btn-primary btn-sm" ng-click="installApp(app)">Install Application</button>
 					</div>
 				</td>
 			</tr>
@@ -207,8 +207,7 @@
 			<div class="modal-body">
 				<ul class="nav nav-tabs">
 					<li><a href="[data-id='guide']" data-toggle="tab" data-id="guideTab">Installation</a></li>
-					<li><a href="[data-id='environment']" data-toggle="tab">Environment</a></li>
-					<li><a href="[data-id='configuration']" data-toggle="tab" data-id="configTab">Configuration</a></li>
+					<li><a href="[data-id='configuration']" data-toggle="tab" data-id="configTab">Setting</a></li>
 				</ul>
 
 				<div class="tab-content">
@@ -230,31 +229,85 @@
 						</div>
 					</div>
 
-					<div class="tab-pane" data-id="environment">
-						<div class="form-group">
-							<label>Mode</label>
-							<select class="form-control" ng-model="tmpApp.mode">
-								<option>CLUSTER</option>
-								<option>LOCAL</option>
-							</select>
+					<div class="tab-pane" data-id="configuration">
+						<!-- Environment -->
+						<h3>
+							<a class="text-primary" data-toggle="collapse" href="[data-id='appEnvironment']" ng-click="collapseCheck()">
+								<span class="fa {{isCollapsed('appEnvironment') ? 'fa-chevron-circle-right' : 'fa-chevron-circle-down'}}"></span>
+								Environment
+							</a>
+						</h3>
+						<div data-id="appEnvironment" class="collapse in">
+							<div class="form-group">
+								<label>Mode</label>
+								<select class="form-control" ng-model="tmpApp.mode">
+									<option>CLUSTER</option>
+									<option>LOCAL</option>
+								</select>
+							</div>
+							<div class="form-group">
+								<label>jar Path</label>
+								<input type="text" class="form-control" ng-model="tmpApp.jarPath" ng-change="checkJarPath()" />
+							</div>
 						</div>
-						<div class="form-group">
-							<label>jar Path</label>
-							<input type="text" class="form-control" ng-model="tmpApp.jarPath" ng-change="checkJarPath()" />
+
+						<hr/>
+
+						<!-- General -->
+						<a class="pull-right" ng-click="configByJSON()">Config By JSON</a>
+						<h3>
+							<a class="text-primary" data-toggle="collapse" href="[data-id='appGeneral']" ng-click="collapseCheck()">
+								<span class="fa {{isCollapsed('appGeneral') ? 'fa-chevron-circle-right' : 'fa-chevron-circle-down'}}"></span>
+								General
+							</a>
+						</h3>
+						<div data-id="appGeneral" class="collapse in">
+							<span class="text-muted" ng-if="generalFields.length === 0">N/A</span>
+							<div class="form-group" ng-class="{'has-warning': !tmpApp.configuration[field.name]}" ng-repeat="field in generalFields track by $index">
+								<label>
+									{{field.displayName || field.name}}
+									<span class="fa fa-question-circle" ng-if="field.description" uib-tooltip="[ {{field.name}} ] {{field.description}}"></span>
+								</label>
+								<input type="text" class="form-control" placeholder="{{field.description}}" ng-model="tmpApp.configuration[field.name]" />
+							</div>
 						</div>
-					</div>
 
-					<div class="tab-pane" data-id="configuration">
-						<div class="form-group" ng-class="{'has-warning': field.required && !tmpApp.configuration[field.name]}" ng-repeat="field in tmpAppConfigFields track by $index">
-							<label>
-								<a class="fa fa-times" ng-click="removeField(field)" ng-if="field._customize"></a>
-								{{field.displayName || field.name}}
-								<span class="fa fa-question-circle" ng-if="field.description" uib-tooltip="{{field.description}}"></span>
-								<small ng-if="!field.required" class="text-muted">[optional]</small>
-							</label>
-							<input type="text" class="form-control" placeholder="{{field.description}}" ng-model="tmpApp.configuration[field.name]" />
+						<!-- Advanced -->
+						<h3>
+							<a class="text-primary" data-toggle="collapse" href="[data-id='appAdvanced']" ng-click="collapseCheck()">
+								<span class="fa {{isCollapsed('appAdvanced') ? 'fa-chevron-circle-right' : 'fa-chevron-circle-down'}}"></span>
+								Advanced
+							</a>
+						</h3>
+						<div data-id="appAdvanced" class="collapse in">
+							<span class="text-muted" ng-if="advancedFields.length === 0">N/A</span>
+							<div class="form-group" ng-repeat="field in advancedFields track by $index">
+								<label>
+									{{field.displayName || field.name}}
+									<span class="fa fa-question-circle" ng-if="field.description" uib-tooltip="[ {{field.name}} ] {{field.description}}"></span>
+								</label>
+								<input type="text" class="form-control" placeholder="{{field.description}}" ng-model="tmpApp.configuration[field.name]" />
+							</div>
 						</div>
-						<a ng-click="newField()">+ New Field</a>
+
+						<h3>
+							<a class="text-primary" data-toggle="collapse" href="[data-id='appCustomize']" ng-click="collapseCheck()">
+								<span class="fa {{isCollapsed('appCustomize') ? 'fa-chevron-circle-right' : 'fa-chevron-circle-down'}}"></span>
+								Customize
+							</a>
+						</h3>
+						<div data-id="appCustomize" class="collapse in">
+							<div class="form-group" ng-class="{'has-warning': !tmpApp.configuration[field.name]}" ng-repeat="field in customizeFields track by $index">
+								<label>
+									<a class="fa fa-times" ng-click="removeField(field)" ng-if="field._customize"></a>
+									{{field.displayName || field.name}}
+								</label>
+								<input type="text" class="form-control" placeholder="{{field.description}}" ng-model="tmpApp.configuration[field.name]" />
+							</div>
+							<a ng-click="newField()">+ New Field</a>
+						</div>
+
+
 					</div>
 				</div>
 			</div>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/ecda7d5a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
index 9b46814..a26810c 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
@@ -142,17 +142,25 @@
 		// =                         Installation                         =
 		// ================================================================
 		$scope.tmpApp = {};
-		$scope.tmpAppConfigFields = [];
+		$scope.generalFields = [];
+		$scope.advancedFields = [];
+		$scope.customizeFields = [];
 		$scope.installLock = false;
 
+		// =================== Fields ===================
 		$scope.newField = function () {
 			UI.fieldConfirm({
 				title: "New Field"
 			}, null, [{
 				field: "name",
 				name: "Field Name"
+			}, {
+				field: "value",
+				name: "Field Value",
+				optional: true
 			}])(function (entity, closeFunc, unlock) {
-				if(common.array.find(entity.name, $scope.tmpAppConfigFields, "field")) {
+				var fullList = $scope.generalFields.concat($scope.advancedFields).concat($scope.customizeFields);
+				if(common.array.find(entity.name, fullList, "field")) {
 					$.dialog({
 						title: "OPS",
 						content: "Field already exist!"
@@ -160,11 +168,12 @@
 
 					unlock();
 				} else {
-					$scope.tmpAppConfigFields.push({
+					$scope.customizeFields.push({
 						name: entity.name,
 						_customize: true,
 						required: true
 					});
+					$scope.tmpApp.configuration[entity.name] = entity.value;
 
 					closeFunc();
 				}
@@ -172,15 +181,35 @@
 		};
 
 		$scope.removeField = function (field) {
-			$scope.tmpAppConfigFields = common.array.remove(field, $scope.tmpAppConfigFields);
+			$scope.customizeFields = common.array.remove(field, $scope.customizeFields);
 			delete $scope.tmpApp.configuration[field.name];
 		};
 
+		// =================== Check ===================
+		$scope.checkJarPath = function () {
+			var jarPath = ($scope.tmpApp || {}).jarPath;
+			if(/\.jar$/.test(jarPath)) {
+				$scope.tmpApp.mode = "CLUSTER";
+			} else if(/\.class/.test(jarPath)) {
+				$scope.tmpApp.mode = "LOCAL";
+			}
+		};
+
+		$scope.collapseCheck = function () {
+			setTimeout(function() {
+				$scope.$apply();
+			}, 400);
+		};
+
+		$scope.isCollapsed = function (dataId) {
+			return !$("[data-id='" + dataId + "']").hasClass("in");
+		};
+
 		$scope.checkFields = function () {
 			var pass = true;
 			var config = common.getValueByPath($scope, ["tmpApp", "configuration"], {});
-			$.each($scope.tmpAppConfigFields, function (i, field) {
-				if(field.required && !config[field.name]) {
+			$.each($scope.generalFields, function (i, field) {
+				if (field.required && !config[field.name]) {
 					pass = false;
 					return false;
 				}
@@ -188,15 +217,40 @@
 			return pass;
 		};
 
-		$scope.checkJarPath = function () {
-			var jarPath = ($scope.tmpApp || {}).jarPath;
-			if(/\.jar$/.test(jarPath)) {
-				$scope.tmpApp.mode = "CLUSTER";
-			} else if(/\.class/.test(jarPath)) {
-				$scope.tmpApp.mode = "LOCAL";
-			}
+		// =================== Config ===================
+		$scope.getCustomFields = function (configuration) {
+			var fields = common.getValueByPath($scope.application, "configuration.properties", []).concat();
+			return $.map(configuration || {}, function (value, key) {
+				if(!common.array.find(key, fields, ["name"])) {
+					return {
+						name: key,
+						_customize: true,
+						required: true
+					};
+				}
+			});
 		};
 
+		$scope.configByJSON = function () {
+			UI.fieldConfirm({
+				title: "Configuration"
+			}, {
+				json: JSON.stringify($scope.tmpApp.configuration, null, "\t")
+			}, [{
+				field: "json",
+				name: "JSON Configuration",
+				type: "blob"
+			}], function (entity) {
+				var json = common.parseJSON(entity.json, false);
+				if(!json) return 'Require JSON format';
+			})(function (entity, closeFunc) {
+				$scope.tmpApp.configuration = common.parseJSON(entity.json, {});
+				$scope.customizeFields = $scope.getCustomFields($scope.tmpApp.configuration);
+				closeFunc();
+			});
+		};
+
+		// =================== Install ===================
 		$scope.installAppConfirm = function () {
 			$scope.installLock = true;
 
@@ -252,23 +306,31 @@
 				$scope.checkJarPath();
 			}
 
-			var fields = $scope.tmpAppConfigFields = common.getValueByPath(application, "configuration.properties", []).concat();
+			var fields = common.getValueByPath(application, "configuration.properties", []).concat();
+			$scope.generalFields = [];
+			$scope.advancedFields = [];
+			$scope.customizeFields = [];
+
+			$("[data-id='appEnvironment']").attr("class","collapse in").removeAttr("style");
+			$("[data-id='appGeneral']").attr("class","collapse in").removeAttr("style");
+			$("[data-id='appAdvanced']").attr("class","collapse").removeAttr("style");
+			$("[data-id='appCustomize']").attr("class","collapse in").removeAttr("style");
 
 			$.each(fields, function (i, field) {
+				// Fill default value
 				$scope.tmpApp.configuration[field.name] = field.value;
+
+				// Reassign the fields
+				if(field.required) {
+					$scope.generalFields.push(field);
+				} else {
+					$scope.advancedFields.push(field);
+				}
 			});
 
 			// Fill miss field of entity
 			common.merge($scope.tmpApp, entity);
-			$.each(entity.configuration || {}, function (key) {
-				if(!common.array.find(key, fields, ["name"])) {
-					fields.push({
-						name: key,
-						_customize: true,
-						required: true
-					});
-				}
-			});
+			$scope.customizeFields = $scope.getCustomFields(entity.configuration);
 
 			// Dependencies check
 			var missDep = false;


[37/50] incubator-eagle git commit: [MINOR] Add missed license header in BasicAuthProviderBuilder

Posted by ha...@apache.org.
[MINOR] Add missed license header in BasicAuthProviderBuilder


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

Branch: refs/heads/master
Commit: e8a73893d5d395fdba37167100007f728e8768ae
Parents: b103e20
Author: Hao Chen <ha...@apache.org>
Authored: Mon Oct 17 11:10:16 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Mon Oct 17 11:10:16 2016 +0800

----------------------------------------------------------------------
 .../authentication/BasicAuthProviderBuilder.java    | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e8a73893/eagle-server/src/main/java/org/apache/eagle/server/authentication/BasicAuthProviderBuilder.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/BasicAuthProviderBuilder.java b/eagle-server/src/main/java/org/apache/eagle/server/authentication/BasicAuthProviderBuilder.java
index e0bb4c1..855134b 100644
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/BasicAuthProviderBuilder.java
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/BasicAuthProviderBuilder.java
@@ -1,3 +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.
+ */
 package org.apache.eagle.server.authentication;
 
 import com.google.common.cache.CacheBuilderSpec;


[25/50] incubator-eagle git commit: [EAGLE-612] Use LOCAL when app provider is from class file and use Cluster when from jar file

Posted by ha...@apache.org.
[EAGLE-612] Use LOCAL when app provider is from class file and use Cluster when from jar file

When jarFile is jar file and use CLUSTER by default. (end with *.jar)
When jarFile is class and use LOCAL by default. (end with *.class)

Author: zombieJ <sm...@gmail.com>

Closes #506 from zombieJ/EAGLE-612.


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

Branch: refs/heads/master
Commit: f3204bcafc345edc9b600715776af77d0d1f4496
Parents: 649adb1
Author: zombieJ <sm...@gmail.com>
Authored: Fri Oct 14 13:51:10 2016 +0800
Committer: zombieJ <sm...@gmail.com>
Committed: Fri Oct 14 13:51:10 2016 +0800

----------------------------------------------------------------------
 eagle-dev/merge-eagle-pr.py                               |  2 ++
 .../main/webapp/app/dev/partials/integration/site.html    |  2 +-
 .../webapp/app/dev/public/js/ctrls/integrationCtrl.js     | 10 ++++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/f3204bca/eagle-dev/merge-eagle-pr.py
----------------------------------------------------------------------
diff --git a/eagle-dev/merge-eagle-pr.py b/eagle-dev/merge-eagle-pr.py
index 01661d5..9243265 100755
--- a/eagle-dev/merge-eagle-pr.py
+++ b/eagle-dev/merge-eagle-pr.py
@@ -105,9 +105,11 @@ def clean_up():
     print "Restoring head pointer to %s" % original_head
     run_cmd("git checkout %s" % original_head)
 
+    ansi_escape = re.compile(r'\x1b[^m]*m')
     branches = run_cmd("git branch").replace(" ", "").split("\n")
 
     for branch in filter(lambda x: x.startswith(BRANCH_PREFIX), branches):
+        branch = ansi_escape.sub('', branch)
         print "Deleting local branch %s" % branch
         run_cmd("git branch -D %s" % branch)
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/f3204bca/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
index e320c48..98e7d97 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
@@ -237,7 +237,7 @@
 						</div>
 						<div class="form-group">
 							<label>jar Path</label>
-							<input type="text" class="form-control" ng-model="tmpApp.jarPath" />
+							<input type="text" class="form-control" ng-model="tmpApp.jarPath" ng-change="checkJarPath()" />
 						</div>
 					</div>
 					<div class="tab-pane" data-id="configuration">

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/f3204bca/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
index ca6c92e..e53a11e 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
@@ -188,6 +188,15 @@
 			return pass;
 		};
 
+		$scope.checkJarPath = function () {
+			var jarPath = ($scope.tmpApp || {}).jarPath;
+			if(/\.jar$/.test(jarPath)) {
+				$scope.tmpApp.mode = "CLUSTER";
+			} else if(/\.class/.test(jarPath)) {
+				$scope.tmpApp.mode = "LOCAL";
+			}
+		};
+
 		$scope.installAppConfirm = function () {
 			$scope.installLock = true;
 
@@ -236,6 +245,7 @@
 					siteId: $scope.site.siteId,
 					appType: application.type
 				});
+				$scope.checkJarPath();
 			}
 
 			var fields = $scope.tmpAppConfigFields = common.getValueByPath(application, "configuration.properties", []).concat();


[42/50] incubator-eagle git commit: [EAGLE-628] Fix jdbc metadata bugs

Posted by ha...@apache.org.
[EAGLE-628] Fix jdbc metadata bugs

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

Author: wujinhu <wu...@126.com>

Closes #520 from wujinhu/master.


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

Branch: refs/heads/master
Commit: 473496747d42b9bfe72f32cb89c312eef1a360bf
Parents: ecda7d5
Author: wujinhu <wu...@126.com>
Authored: Mon Oct 17 19:42:23 2016 +0800
Committer: wujinhu <wu...@126.com>
Committed: Mon Oct 17 19:42:23 2016 +0800

----------------------------------------------------------------------
 .../app/module/ApplicationGuiceModule.java      |   8 +-
 .../eagle-metadata/eagle-metadata-jdbc/pom.xml  |   5 +
 .../ApplicationEntityServiceJDBCImpl.java       |  75 +++++++++++--
 .../jdbc/service/SiteEntityServiceJDBCImpl.java |  16 +--
 .../orm/ApplicationEntityToRelation.java        |   5 +
 .../orm/RelationToApplicationEntity.java        |  36 ++++--
 .../ApplicationEntityServiceJDBCImplTest.java   |  40 ++++---
 .../store/jdbc/JDBCDataSourceProviderTest.java  |   2 +-
 .../jdbc/JDBCMetadataQueryServiceTest.java      |   2 +-
 .../store/jdbc/JDBCMetadataTestBase.java        | 109 ++++++++++---------
 .../store/jdbc/TestStaticApplication.java       |  31 ++++++
 ...tore.jdbc.TestStaticApplication$Provider.xml |  31 ++++++
 ...org.apache.eagle.app.spi.ApplicationProvider |  16 +++
 .../src/test/resources/init.sql                 |   7 +-
 .../service/JDBCSecurityMetadataDAO.java        |  12 +-
 .../audit/JDBCSecurityMetadataDAOTest.java      |  11 +-
 .../src/main/bin/createTables.sql               |  40 +++++++
 17 files changed, 340 insertions(+), 106 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationGuiceModule.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationGuiceModule.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationGuiceModule.java
index 67c7eec..d796faa 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationGuiceModule.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationGuiceModule.java
@@ -16,9 +16,11 @@
  */
 package org.apache.eagle.app.module;
 
+import com.typesafe.config.ConfigFactory;
 import org.apache.eagle.app.service.ApplicationManagementService;
 import org.apache.eagle.app.service.ApplicationProviderService;
 import org.apache.eagle.app.service.impl.ApplicationManagementServiceImpl;
+import org.apache.eagle.app.service.impl.ApplicationProviderServiceImpl;
 import org.apache.eagle.app.service.impl.ApplicationStatusUpdateServiceImpl;
 import org.apache.eagle.metadata.service.ApplicationDescService;
 import com.google.inject.AbstractModule;
@@ -27,12 +29,16 @@ import com.google.inject.util.Providers;
 import org.apache.eagle.metadata.service.ApplicationStatusUpdateService;
 
 public class ApplicationGuiceModule extends AbstractModule {
-    private ApplicationProviderService appProviderInst;
+    private final ApplicationProviderService appProviderInst;
 
     public ApplicationGuiceModule(ApplicationProviderService appProviderInst) {
         this.appProviderInst = appProviderInst;
     }
 
+    public ApplicationGuiceModule() {
+        this.appProviderInst = new ApplicationProviderServiceImpl(ConfigFactory.load());
+    }
+
     @Override
     protected void configure() {
         bind(ApplicationProviderService.class).toProvider(Providers.of(appProviderInst));

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/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
index 940d697..d15f30a 100644
--- a/eagle-core/eagle-metadata/eagle-metadata-jdbc/pom.xml
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/pom.xml
@@ -46,5 +46,10 @@
             <groupId>com.h2database</groupId>
             <artifactId>h2</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-app-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/47349674/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/ApplicationEntityServiceJDBCImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/ApplicationEntityServiceJDBCImpl.java b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/ApplicationEntityServiceJDBCImpl.java
index 20932b1..1f5ba65 100644
--- a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/ApplicationEntityServiceJDBCImpl.java
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/ApplicationEntityServiceJDBCImpl.java
@@ -18,6 +18,8 @@
 package org.apache.eagle.metadata.store.jdbc.service;
 
 
+import org.apache.commons.lang.StringUtils;
+import org.apache.eagle.app.service.ApplicationProviderService;
 import org.apache.eagle.metadata.model.ApplicationEntity;
 import org.apache.eagle.metadata.service.ApplicationEntityService;
 import org.apache.eagle.metadata.store.jdbc.JDBCMetadataQueryService;
@@ -25,6 +27,7 @@ import org.apache.eagle.metadata.store.jdbc.service.orm.ApplicationEntityToRelat
 import org.apache.eagle.metadata.store.jdbc.service.orm.RelationToApplicationEntity;
 
 import com.google.inject.Singleton;
+import org.json.simple.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -40,16 +43,18 @@ public class ApplicationEntityServiceJDBCImpl implements ApplicationEntityServic
 
     private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationEntityServiceJDBCImpl.class);
 
-    private static final String insertSql = "INSERT INTO applicationentity (siteid, apptype, appmode, jarpath, appstatus, createdtime, modifiedtime, uuid, appid ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
-    private static final String selectSql = "SELECT * FROM applicationentity a INNER JOIN siteentity s on  a.siteid = s.siteid";
-    private static final String selectSqlBySiteIdAndAppType = "SELECT * FROM applicationentity  a INNER JOIN siteentity s on  a.siteid = s.siteid where a.siteid = ? and a.apptype = ?";
-    private static final String selectSqlBySiteId = "SELECT * FROM applicationentity  a INNER JOIN siteentity s on  a.siteid = s.siteid where a.siteid = ?";
-    private static final String selectSqlByUUId = "SELECT * FROM applicationentity  a INNER JOIN siteentity s on  a.siteid = s.siteid where a.uuid = ?";
-    private static final String selectSqlByAppId = "SELECT * FROM applicationentity  a INNER JOIN siteentity s on  a.siteid = s.siteid where a.appid = ?";
-    private static final String deleteSqlByUUID = "DELETE FROM applicationentity where uuid = ?";
+    private static final String insertSql = "INSERT INTO applications (siteid, apptype, appmode, jarpath, appstatus, configuration, createdtime, modifiedtime, uuid, appid ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+    private static final String selectSql = "SELECT * FROM applications a INNER JOIN sites s on  a.siteid = s.siteid";
+    private static final String selectSqlBySiteIdAndAppType = "SELECT * FROM applications  a INNER JOIN sites s on  a.siteid = s.siteid where a.siteid = ? and a.apptype = ?";
+    private static final String selectSqlBySiteId = "SELECT * FROM applications  a INNER JOIN sites s on  a.siteid = s.siteid where a.siteid = ?";
+    private static final String selectSqlByUUId = "SELECT * FROM applications  a INNER JOIN sites s on  a.siteid = s.siteid where a.uuid = ?";
+    private static final String selectSqlByAppId = "SELECT * FROM applications  a INNER JOIN sites s on  a.siteid = s.siteid where a.appid = ?";
+    private static final String deleteSqlByUUID = "DELETE FROM applications where uuid = ?";
 
     @Inject
     JDBCMetadataQueryService queryService;
+    @Inject
+    ApplicationProviderService applicationProviderService;
 
     @Override
     public Collection<ApplicationEntity> findBySiteId(String siteId) {
@@ -61,6 +66,7 @@ public class ApplicationEntityServiceJDBCImpl implements ApplicationEntityServic
             LOGGER.error("Error to getBySiteIdAndAppType ApplicationEntity: {}", e);
             return results;
         }
+        fillApplicationDesc(results);
         return results;
     }
 
@@ -80,6 +86,7 @@ public class ApplicationEntityServiceJDBCImpl implements ApplicationEntityServic
             return null;
         }
 
+        fillApplicationDesc(results);
         return results.get(0);
     }
 
@@ -101,6 +108,7 @@ public class ApplicationEntityServiceJDBCImpl implements ApplicationEntityServic
         if (results.isEmpty()) {
             throw new IllegalArgumentException("Application with appId: " + appId + " not found");
         }
+        fillApplicationDesc(results);
         return results.get(0);
     }
 
@@ -116,12 +124,49 @@ public class ApplicationEntityServiceJDBCImpl implements ApplicationEntityServic
         return entity;
     }
 
-    /**
-     * TODO: UPDATE ApplicationEntity through JDBC is not supported yet
-     */
     @Override
     public ApplicationEntity update(ApplicationEntity entity) {
-        throw new UnsupportedOperationException("UPDATE ApplicationEntity through JDBC is not supported yet");
+        String updateSql = "update applications set ";
+        if (entity.getSite() != null && StringUtils.isNotBlank(entity.getSite().getSiteId())) {
+            updateSql += "siteid = ?, ";
+        }
+        if (entity.getDescriptor() != null && StringUtils.isNotBlank(entity.getDescriptor().getType())) {
+            updateSql += "apptype = ?, ";
+        }
+        if (entity.getMode() != null && StringUtils.isNotBlank(entity.getMode().name())) {
+            updateSql += "appmode = ?, ";
+        }
+        if (StringUtils.isNotBlank(entity.getJarPath())) {
+            updateSql += "jarpath = ?, ";
+        }
+        if (entity.getStatus() != null && StringUtils.isNotBlank(entity.getStatus().name())) {
+            updateSql += "appstatus = ?, ";
+        }
+        if (entity.getConfiguration() != null && !entity.getConfiguration().isEmpty()) {
+            updateSql += "configuration = ?, ";
+        }
+        if (entity.getCreatedTime() > 0) {
+            updateSql += "createdtime = ?, ";
+        }
+        if (entity.getModifiedTime() > 0) {
+            updateSql += "modifiedtime = ?, ";
+        }
+        updateSql = updateSql.substring(0, updateSql.length() - 2);
+        if (StringUtils.isNotBlank(entity.getUuid())) {
+            updateSql += " where uuid = ?";
+        }
+        if (StringUtils.isNotBlank(entity.getAppId())) {
+            updateSql += " and appid = ?";
+        }
+
+        try {
+            if (queryService.update(updateSql, entity, new ApplicationEntityToRelation()) == 0) {
+                LOGGER.warn("failed to execute {}", updateSql);
+            }
+        } catch (SQLException e) {
+            LOGGER.warn("failed to execute {}, {}", updateSql, e);
+        }
+        return getByUUID(entity.getUuid());
     }
 
     @Override
@@ -132,9 +177,16 @@ public class ApplicationEntityServiceJDBCImpl implements ApplicationEntityServic
         } catch (SQLException e) {
             LOGGER.error("Error to findAll ApplicationEntity: {}", e);
         }
+        fillApplicationDesc(results);
         return results;
     }
 
+    private void fillApplicationDesc(List<ApplicationEntity> entities) {
+        for (ApplicationEntity entity : entities) {
+            entity.setDescriptor(applicationProviderService.getApplicationDescByType(entity.getDescriptor().getType()));
+        }
+    }
+
     @Override
     public ApplicationEntity getByUUID(String uuid) {
         ApplicationEntity applicationEntity = new ApplicationEntity(null, null, null, null, uuid, "");
@@ -147,6 +199,7 @@ public class ApplicationEntityServiceJDBCImpl implements ApplicationEntityServic
         if (results.isEmpty()) {
             throw new IllegalArgumentException("Application (UUID: " + uuid + ") is not found");
         }
+        fillApplicationDesc(results);
         return results.get(0);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/SiteEntityServiceJDBCImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/SiteEntityServiceJDBCImpl.java b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/SiteEntityServiceJDBCImpl.java
index 436f416..9946f93 100644
--- a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/SiteEntityServiceJDBCImpl.java
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/SiteEntityServiceJDBCImpl.java
@@ -39,13 +39,13 @@ import javax.inject.Inject;
 public class SiteEntityServiceJDBCImpl implements SiteEntityService {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(SiteEntityServiceJDBCImpl.class);
-    private static final String insertSql = "INSERT INTO siteentity (siteid, sitename, description, createdtime, modifiedtime, uuid) VALUES (?, ?, ?, ?, ?, ?)";
-    private static final String selectSql = "SELECT * FROM siteentity";
-    private static final String selectSqlByUUID = "SELECT * FROM siteentity where uuid = ?";
-    private static final String selectSqlBySiteId = "SELECT * FROM siteentity where siteid = ?";
-    private static final String deleteSqlByUUID = "DELETE FROM siteentity where uuid = ?";
-    private static final String deleteSqlBySiteId = "DELETE FROM siteentity where siteid = ?";
-    private static final String updateSqlByUUID = "UPDATE siteentity SET siteid = ? , sitename = ? , description = ? , createdtime = ? , modifiedtime = ?  where uuid = ?";
+    private static final String insertSql = "INSERT INTO sites (siteid, sitename, description, createdtime, modifiedtime, uuid) VALUES (?, ?, ?, ?, ?, ?)";
+    private static final String selectSql = "SELECT * FROM sites";
+    private static final String selectSqlByUUID = "SELECT * FROM sites where uuid = ?";
+    private static final String selectSqlBySiteId = "SELECT * FROM sites where siteid = ?";
+    private static final String deleteSqlByUUID = "DELETE FROM sites where uuid = ?";
+    private static final String deleteSqlBySiteId = "DELETE FROM sites where siteid = ?";
+    private static final String updateSqlByUUID = "UPDATE sites SET siteid = ? , sitename = ? , description = ? , createdtime = ? , modifiedtime = ?  where uuid = ?";
     @Inject
     JDBCMetadataQueryService queryService;
 
@@ -158,7 +158,7 @@ public class SiteEntityServiceJDBCImpl implements SiteEntityService {
             queryService.insert(insertSql, entities, new SiteEntityToRelation());
         } catch (SQLException e) {
             LOGGER.error("Error to insert SiteEntity: {}", entity, e);
-            throw new IllegalArgumentException("MayBe Duplicated siteId: " + entity.getSiteId());
+            throw new IllegalArgumentException("Error to insert SiteEntity: " + entity + e);
         }
         return entity;
     }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/orm/ApplicationEntityToRelation.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/orm/ApplicationEntityToRelation.java b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/orm/ApplicationEntityToRelation.java
index 69577e4..20144a6 100644
--- a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/orm/ApplicationEntityToRelation.java
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/orm/ApplicationEntityToRelation.java
@@ -21,6 +21,7 @@ import org.apache.eagle.common.function.ThrowableConsumer2;
 import org.apache.eagle.metadata.model.ApplicationEntity;
 
 import org.apache.commons.lang.StringUtils;
+import org.json.simple.JSONObject;
 
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
@@ -49,6 +50,10 @@ public class ApplicationEntityToRelation implements ThrowableConsumer2<PreparedS
             statement.setString(parameterIndex, entity.getStatus().name());
             parameterIndex++;
         }
+        if (entity.getConfiguration() != null && !entity.getConfiguration().isEmpty()) {
+            statement.setString(parameterIndex, JSONObject.toJSONString(entity.getConfiguration()));
+            parameterIndex++;
+        }
         if (entity.getCreatedTime() > 0) {
             statement.setLong(parameterIndex, entity.getCreatedTime());
             parameterIndex++;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/orm/RelationToApplicationEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/orm/RelationToApplicationEntity.java b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/orm/RelationToApplicationEntity.java
index 1b705a9..d8fcdad 100644
--- a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/orm/RelationToApplicationEntity.java
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/orm/RelationToApplicationEntity.java
@@ -21,12 +21,20 @@ import org.apache.eagle.common.function.ThrowableFunction;
 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.store.jdbc.service.ApplicationEntityServiceJDBCImpl;
+import org.codehaus.jettison.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.Iterator;
+import java.util.Map;
 
 
 public class RelationToApplicationEntity implements ThrowableFunction<ResultSet, ApplicationEntity, SQLException> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RelationToApplicationEntity.class);
     @Override
     public ApplicationEntity apply(ResultSet resultSet) throws SQLException {
 
@@ -35,12 +43,12 @@ public class RelationToApplicationEntity implements ThrowableFunction<ResultSet,
         applicationDesc.setType(appType);
 
         SiteEntity siteEntity = new SiteEntity();
-        siteEntity.setUuid(resultSet.getString(10));
-        siteEntity.setSiteId(resultSet.getString(11));
-        siteEntity.setSiteName(resultSet.getString(12));
-        siteEntity.setDescription(resultSet.getString(13));
-        siteEntity.setCreatedTime(resultSet.getLong(14));
-        siteEntity.setModifiedTime(resultSet.getLong(15));
+        siteEntity.setUuid(resultSet.getString(11));
+        siteEntity.setSiteId(resultSet.getString(12));
+        siteEntity.setSiteName(resultSet.getString(13));
+        siteEntity.setDescription(resultSet.getString(14));
+        siteEntity.setCreatedTime(resultSet.getLong(15));
+        siteEntity.setModifiedTime(resultSet.getLong(16));
 
 
         ApplicationEntity resultEntity = new ApplicationEntity();
@@ -51,8 +59,20 @@ public class RelationToApplicationEntity implements ThrowableFunction<ResultSet,
         resultEntity.setMode(ApplicationEntity.Mode.valueOf(resultSet.getString(5)));
         resultEntity.setJarPath(resultSet.getString(6));
         resultEntity.setStatus(ApplicationEntity.Status.valueOf(resultSet.getString(7)));
-        resultEntity.setCreatedTime(resultSet.getLong(8));
-        resultEntity.setModifiedTime(resultSet.getLong(9));
+        try {
+            JSONObject jsonObject = new JSONObject(resultSet.getString(8));
+            Map<String, Object> items = new java.util.HashMap<>();
+            Iterator<String> keyItemItr = jsonObject.keys();
+            while (keyItemItr.hasNext()) {
+                String itemKey = keyItemItr.next();
+                items.put(itemKey, jsonObject.get(itemKey));
+            }
+            resultEntity.setConfiguration(items);
+        } catch (Exception e) {
+            LOG.warn("{}", e);
+        }
+        resultEntity.setCreatedTime(resultSet.getLong(9));
+        resultEntity.setModifiedTime(resultSet.getLong(10));
 
         return resultEntity;
     }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/ApplicationEntityServiceJDBCImplTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/ApplicationEntityServiceJDBCImplTest.java b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/ApplicationEntityServiceJDBCImplTest.java
index 23db1be..017d829 100644
--- a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/ApplicationEntityServiceJDBCImplTest.java
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/ApplicationEntityServiceJDBCImplTest.java
@@ -17,6 +17,8 @@
 
 package org.apache.eagle.metadata.store.jdbc;
 
+import org.apache.commons.collections.map.HashedMap;
+import org.apache.eagle.app.service.ApplicationProviderService;
 import org.apache.eagle.metadata.exceptions.EntityNotFoundException;
 import org.apache.eagle.metadata.model.ApplicationDesc;
 import org.apache.eagle.metadata.model.ApplicationEntity;
@@ -29,12 +31,14 @@ import org.junit.Test;
 import javax.inject.Inject;
 import java.sql.SQLException;
 import java.util.Collection;
+import java.util.Map;
 
 public class ApplicationEntityServiceJDBCImplTest extends JDBCMetadataTestBase {
 
     @Inject
     ApplicationEntityService applicationEntityService;
-
+    @Inject
+    ApplicationProviderService applicationProviderService;
     @Inject
     SiteEntityService siteEntityService;
 
@@ -49,16 +53,16 @@ public class ApplicationEntityServiceJDBCImplTest extends JDBCMetadataTestBase {
         String siteuuid = siteEntity.getUuid();
         long sitecreateTime = siteEntity.getCreatedTime();
         long sitemodifiedTime = siteEntity.getModifiedTime();
-        ApplicationDesc applicationDesc = new ApplicationDesc();
-        applicationDesc.setType("testtype");
-
+        ApplicationDesc applicationDesc = applicationProviderService.getApplicationDescByType("TEST_APP");
 
         ApplicationEntity applicationEntity = new ApplicationEntity();
         applicationEntity.setSite(siteEntity);
         applicationEntity.setDescriptor(applicationDesc);
         applicationEntity.setMode(ApplicationEntity.Mode.LOCAL);
-        applicationEntity.setJarPath("c://");
-
+        applicationEntity.setJarPath(applicationDesc.getJarPath());
+        Map<String, Object> configure = new HashedMap();
+        configure.put("a", "b");
+        applicationEntity.setConfiguration(configure);
         applicationEntityService.create(applicationEntity);
         String appuuid = applicationEntity.getUuid();
         String appId = applicationEntity.getAppId();
@@ -67,7 +71,7 @@ public class ApplicationEntityServiceJDBCImplTest extends JDBCMetadataTestBase {
 
         Collection<ApplicationEntity> results = applicationEntityService.findAll();
         Assert.assertEquals(1, results.size());
-        ApplicationEntity applicationEntityFromDB = applicationEntityService.getBySiteIdAndAppType("testsiteid", "testtype");
+        ApplicationEntity applicationEntityFromDB = applicationEntityService.getBySiteIdAndAppType("testsiteid", "TEST_APP");
         Assert.assertTrue(applicationEntityFromDB != null);
         results = applicationEntityService.findBySiteId("testsiteid");
         Assert.assertEquals(1, results.size());
@@ -86,9 +90,9 @@ public class ApplicationEntityServiceJDBCImplTest extends JDBCMetadataTestBase {
 
         Assert.assertEquals(appuuid, applicationEntityFromDB.getUuid());
         Assert.assertEquals(appId, applicationEntityFromDB.getAppId());
-        Assert.assertEquals("testtype", applicationEntityFromDB.getDescriptor().getType());
+        Assert.assertEquals("TEST_APP", applicationEntityFromDB.getDescriptor().getType());
         Assert.assertEquals(ApplicationEntity.Mode.LOCAL, applicationEntityFromDB.getMode());
-        Assert.assertEquals("c://", applicationEntityFromDB.getJarPath());
+        Assert.assertEquals(applicationDesc.getJarPath(), applicationEntityFromDB.getJarPath());
         Assert.assertEquals(ApplicationEntity.Status.INITIALIZED, applicationEntityFromDB.getStatus());
         Assert.assertEquals(createTime, applicationEntityFromDB.getCreatedTime());
         Assert.assertEquals(modifiedTime, applicationEntityFromDB.getModifiedTime());
@@ -103,16 +107,16 @@ public class ApplicationEntityServiceJDBCImplTest extends JDBCMetadataTestBase {
         siteEntity.setSiteName("testsitename");
         siteEntity.setDescription("testdesc");
         siteEntityService.create(siteEntity);
-        ApplicationDesc applicationDesc = new ApplicationDesc();
-        applicationDesc.setType("testtype");
-
+        ApplicationDesc applicationDesc = applicationProviderService.getApplicationDescByType("TEST_APP");
 
         ApplicationEntity applicationEntity = new ApplicationEntity();
         applicationEntity.setSite(siteEntity);
         applicationEntity.setDescriptor(applicationDesc);
         applicationEntity.setMode(ApplicationEntity.Mode.LOCAL);
-        applicationEntity.setJarPath("c://");
-
+        applicationEntity.setJarPath(applicationDesc.getJarPath());
+        Map<String, Object> configure = new HashedMap();
+        configure.put("a", "b");
+        applicationEntity.setConfiguration(configure);
         applicationEntityService.create(applicationEntity);
         applicationEntityService.create(applicationEntity);
     }
@@ -133,15 +137,17 @@ public class ApplicationEntityServiceJDBCImplTest extends JDBCMetadataTestBase {
         siteEntity.setSiteName("testsitename");
         siteEntity.setDescription("testdesc");
         siteEntityService.create(siteEntity);
-        ApplicationDesc applicationDesc = new ApplicationDesc();
-        applicationDesc.setType("testtype");
+        ApplicationDesc applicationDesc = applicationProviderService.getApplicationDescByType("TEST_APP");
 
 
         ApplicationEntity applicationEntity = new ApplicationEntity();
         applicationEntity.setSite(siteEntity);
         applicationEntity.setDescriptor(applicationDesc);
         applicationEntity.setMode(ApplicationEntity.Mode.LOCAL);
-        applicationEntity.setJarPath("c://");
+        applicationEntity.setJarPath(applicationDesc.getJarPath());
+        Map<String, Object> configure = new HashedMap();
+        configure.put("a", "b");
+        applicationEntity.setConfiguration(configure);
         applicationEntityService.create(applicationEntity);
         Collection<ApplicationEntity> results = applicationEntityService.findAll();
         Assert.assertEquals(1, results.size());

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCDataSourceProviderTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCDataSourceProviderTest.java b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCDataSourceProviderTest.java
index 6574a1b..545ade4 100644
--- a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCDataSourceProviderTest.java
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCDataSourceProviderTest.java
@@ -26,7 +26,7 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
 
-public class JDBCDataSourceProviderTest extends JDBCMetadataTestBase{
+public class JDBCDataSourceProviderTest extends JDBCMetadataTestBase {
     @Inject
     private DataSource dataSource;
     @Inject

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataQueryServiceTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataQueryServiceTest.java b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataQueryServiceTest.java
index 0840f76..97a06ab 100644
--- a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataQueryServiceTest.java
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataQueryServiceTest.java
@@ -23,7 +23,7 @@ import javax.inject.Inject;
 import java.sql.SQLException;
 import java.util.List;
 
-public class JDBCMetadataQueryServiceTest extends JDBCMetadataTestBase{
+public class JDBCMetadataQueryServiceTest extends JDBCMetadataTestBase {
     @Inject
     JDBCMetadataQueryService queryService;
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataTestBase.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataTestBase.java b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataTestBase.java
index 3e94b8d..3315fc3 100644
--- a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataTestBase.java
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/JDBCMetadataTestBase.java
@@ -1,52 +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
- * <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.jdbc;
-
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import org.apache.commons.dbcp.BasicDataSource;
-import org.apache.eagle.common.module.CommonGuiceModule;
-import org.junit.After;
-import org.junit.Before;
-
-import javax.sql.DataSource;
-import java.sql.SQLException;
-
-public class JDBCMetadataTestBase {
-    private Injector injector;
-
-    @Inject
-    private DataSource dataSource;
-
-    @Before
-    public void setUp(){
-        injector = Guice.createInjector(new JDBCMetadataStore(),new CommonGuiceModule());
-        injector.injectMembers(this);
-    }
-
-    @After
-    public void after() throws SQLException {
-        if(dataSource!=null){
-            ((BasicDataSource) dataSource).close();
-        }
-    }
-
-    public Injector injector(){
-        return injector;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.jdbc;
+
+import com.google.inject.Guice;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+import com.typesafe.config.ConfigFactory;
+import org.apache.commons.dbcp.BasicDataSource;
+import org.apache.eagle.app.module.ApplicationGuiceModule;
+import org.apache.eagle.app.service.ApplicationProviderService;
+import org.apache.eagle.app.service.impl.ApplicationProviderServiceImpl;
+import org.apache.eagle.common.module.CommonGuiceModule;
+import org.apache.eagle.metadata.store.jdbc.JDBCMetadataStore;
+import org.junit.After;
+import org.junit.Before;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+public class JDBCMetadataTestBase {
+    private Injector injector;
+
+    @Inject
+    private DataSource dataSource;
+
+    @Before
+    public void setUp(){
+        injector = Guice.createInjector(new JDBCMetadataStore(),new ApplicationGuiceModule(),new CommonGuiceModule());
+        injector.injectMembers(this);
+    }
+
+    @After
+    public void after() throws SQLException {
+        if(dataSource!=null){
+            ((BasicDataSource) dataSource).close();
+        }
+    }
+
+    public Injector injector(){
+        return injector;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/TestStaticApplication.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/TestStaticApplication.java b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/TestStaticApplication.java
new file mode 100644
index 0000000..fd81dca
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/java/org/apache/eagle/metadata/store/jdbc/TestStaticApplication.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.metadata.store.jdbc;
+
+import org.apache.eagle.app.StaticApplicationProvider;
+import org.junit.Test;
+
+public class TestStaticApplication {
+    public static class Provider extends StaticApplicationProvider {
+
+    }
+
+    @Test
+    public void f() {
+
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/resources/META-INF/providers/org.apache.eagle.metadata.store.jdbc.TestStaticApplication$Provider.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/resources/META-INF/providers/org.apache.eagle.metadata.store.jdbc.TestStaticApplication$Provider.xml b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/resources/META-INF/providers/org.apache.eagle.metadata.store.jdbc.TestStaticApplication$Provider.xml
new file mode 100644
index 0000000..ec38d0b
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/resources/META-INF/providers/org.apache.eagle.metadata.store.jdbc.TestStaticApplication$Provider.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.
+  -->
+
+<application>
+    <type>TEST_APP</type>
+    <name>Test app</name>
+    <version>0.5.0-incubating</version>
+    <configuration>
+        <!-- org.apache.eagle.jpm.mr.history.MRHistoryJobConfig -->
+        <property>
+            <name>jobExtractorConfig.site</name>
+            <displayName>Site ID</displayName>
+            <value>sandbox</value>
+        </property>
+    </configuration>
+</application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider
new file mode 100644
index 0000000..4f0193c
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/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.metadata.store.jdbc.TestStaticApplication$Provider
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/resources/init.sql
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/resources/init.sql b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/resources/init.sql
index 32e2e1d..4f6ab96 100644
--- a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/resources/init.sql
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/test/resources/init.sql
@@ -16,19 +16,20 @@
 --  *
 --  */
 
-CREATE TABLE IF NOT EXISTS applicationentity (
+CREATE TABLE IF NOT EXISTS applications (
   uuid varchar(50) PRIMARY KEY,
   appid varchar(100) DEFAULT NULL,
   siteid varchar(100) DEFAULT NULL,
-  apptype varchar(10) DEFAULT NULL,
+  apptype varchar(30) DEFAULT NULL,
   appmode varchar(10) DEFAULT NULL,
   jarpath varchar(255) DEFAULT NULL,
   appstatus  varchar(20) DEFAULT NULL,
+  configuration mediumtext DEFAULT NULL,
   createdtime bigint(20) DEFAULT NULL,
   modifiedtime  bigint(20) DEFAULT NULL
 );
 
-CREATE TABLE IF NOT EXISTS siteentity (
+CREATE TABLE IF NOT EXISTS sites (
   uuid varchar(50) PRIMARY KEY,
   siteid varchar(100) DEFAULT NULL,
   sitename varchar(100) DEFAULT NULL,

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/service/JDBCSecurityMetadataDAO.java
----------------------------------------------------------------------
diff --git a/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/service/JDBCSecurityMetadataDAO.java b/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/service/JDBCSecurityMetadataDAO.java
index ecbcfe2..e9662e6 100644
--- a/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/service/JDBCSecurityMetadataDAO.java
+++ b/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/service/JDBCSecurityMetadataDAO.java
@@ -19,6 +19,7 @@
 
 package org.apache.eagle.security.service;
 
+import com.google.inject.Inject;
 import com.typesafe.config.Config;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -55,6 +56,7 @@ public class JDBCSecurityMetadataDAO implements ISecurityMetadataDAO  {
     private final String OOZIE_INSERT_STATEMENT = "INSERT INTO oozie_sensitivity_entity (site, filedir, sensitivity_type) VALUES (?, ?, ?)";
 
     // get connection url from config
+    @Inject
     public JDBCSecurityMetadataDAO(Config config){
         this.config = config;
     }
@@ -259,9 +261,13 @@ public class JDBCSecurityMetadataDAO implements ISecurityMetadataDAO  {
     private Connection getJdbcConnection() throws Exception {
         Connection connection;
         try {
-            connection = DriverManager.getConnection(config.getString("metadata.jdbc.url"),
-                    config.getString("metadata.jdbc.username"),
-                    config.getString("metadata.jdbc.password"));
+            if (config.hasPath("metadata.jdbc.username")) {
+                connection = DriverManager.getConnection(config.getString("metadata.jdbc.url"),
+                        config.getString("metadata.jdbc.username"),
+                        config.getString("metadata.jdbc.password"));
+            } else {
+                connection = DriverManager.getConnection(config.getString("metadata.jdbc.url"));
+            }
         } catch (Exception e) {
             LOG.error("error get connection for {}", config.getString("metadata.jdbc.url"), e);
             throw e;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-security/eagle-security-common/src/test/java/org/apache/eagle/security/crawler/audit/JDBCSecurityMetadataDAOTest.java
----------------------------------------------------------------------
diff --git a/eagle-security/eagle-security-common/src/test/java/org/apache/eagle/security/crawler/audit/JDBCSecurityMetadataDAOTest.java b/eagle-security/eagle-security-common/src/test/java/org/apache/eagle/security/crawler/audit/JDBCSecurityMetadataDAOTest.java
index b9e40ba..4cfe25e 100644
--- a/eagle-security/eagle-security-common/src/test/java/org/apache/eagle/security/crawler/audit/JDBCSecurityMetadataDAOTest.java
+++ b/eagle-security/eagle-security-common/src/test/java/org/apache/eagle/security/crawler/audit/JDBCSecurityMetadataDAOTest.java
@@ -17,6 +17,7 @@
 package org.apache.eagle.security.crawler.audit;
 
 import com.google.inject.Inject;
+import org.apache.eagle.app.module.ApplicationGuiceModule;
 import org.apache.eagle.common.module.CommonGuiceModule;
 import org.apache.eagle.common.module.GuiceJUnitRunner;
 import org.apache.eagle.common.module.Modules;
@@ -26,6 +27,7 @@ import org.apache.eagle.security.service.HBaseSensitivityEntity;
 import org.apache.eagle.security.service.JDBCSecurityMetadataDAO;
 import org.junit.After;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -34,7 +36,9 @@ import java.util.Collection;
 import java.util.Collections;
 
 @RunWith(GuiceJUnitRunner.class)
-@Modules({JDBCMetadataStore.class, CommonGuiceModule.class})
+@Modules({
+    JDBCMetadataStore.class, CommonGuiceModule.class, ApplicationGuiceModule.class
+})
 public class JDBCSecurityMetadataDAOTest {
     @Inject
     private JDBCSecurityMetadataDAO metadataDAO;
@@ -42,6 +46,11 @@ public class JDBCSecurityMetadataDAOTest {
     @Inject
     private JDBCMetadataQueryService queryService;
 
+    @Before
+    public void setUp() throws SQLException {
+        queryService.execute("create table hbase_sensitivity_entity (site varchar(20), hbase_resource varchar(100), sensitivity_type varchar(20), primary key (site, hbase_resource));");
+    }
+
     @Test
     public void testJDBCSecurityMetadataDAO(){
         HBaseSensitivityEntity entity = new HBaseSensitivityEntity();

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/47349674/eagle-server-assembly/src/main/bin/createTables.sql
----------------------------------------------------------------------
diff --git a/eagle-server-assembly/src/main/bin/createTables.sql b/eagle-server-assembly/src/main/bin/createTables.sql
new file mode 100644
index 0000000..4f6ab96
--- /dev/null
+++ b/eagle-server-assembly/src/main/bin/createTables.sql
@@ -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
+--  *
+--  *    http://www.apache.org/licenses/LICENSE-2.0
+--  *
+--  * Unless required by applicable law or agreed to in writing, software
+--  * distributed under the License is distributed on an "AS IS" BASIS,
+--  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+--  * See the License for the specific language governing permissions and
+--  * limitations under the License.
+--  *
+--  */
+
+CREATE TABLE IF NOT EXISTS applications (
+  uuid varchar(50) PRIMARY KEY,
+  appid varchar(100) DEFAULT NULL,
+  siteid varchar(100) DEFAULT NULL,
+  apptype varchar(30) DEFAULT NULL,
+  appmode varchar(10) DEFAULT NULL,
+  jarpath varchar(255) DEFAULT NULL,
+  appstatus  varchar(20) DEFAULT NULL,
+  configuration mediumtext DEFAULT NULL,
+  createdtime bigint(20) DEFAULT NULL,
+  modifiedtime  bigint(20) DEFAULT NULL
+);
+
+CREATE TABLE IF NOT EXISTS sites (
+  uuid varchar(50) PRIMARY KEY,
+  siteid varchar(100) DEFAULT NULL,
+  sitename varchar(100) DEFAULT NULL,
+  description varchar(255) DEFAULT NULL,
+  createdtime bigint(20) DEFAULT NULL,
+  modifiedtime  bigint(20) DEFAULT NULL,
+  UNIQUE (siteid)
+);
\ No newline at end of file


[32/50] incubator-eagle git commit: [EAGLE-622] : fix the datasource name to topic name caused unit test failure

Posted by ha...@apache.org.
[EAGLE-622] : fix the datasource name to topic name caused unit test failure

Author: ralphsu

This closes #512


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

Branch: refs/heads/master
Commit: 7279ee711587a4c6364e324002baa1daea089270
Parents: 00e92d9
Author: Ralph, Su <su...@gmail.com>
Authored: Fri Oct 14 20:23:39 2016 +0800
Committer: Ralph, Su <su...@gmail.com>
Committed: Fri Oct 14 20:30:51 2016 +0800

----------------------------------------------------------------------
 .../apache/alert/coordinator/SchedulerTest.java | 48 ++++++--------------
 .../engine/topology/CorrelationSpoutTest.java   |  4 +-
 2 files changed, 16 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/7279ee71/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/test/java/org/apache/alert/coordinator/SchedulerTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/test/java/org/apache/alert/coordinator/SchedulerTest.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/test/java/org/apache/alert/coordinator/SchedulerTest.java
index d0b7a09..1bfdd7b 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/test/java/org/apache/alert/coordinator/SchedulerTest.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/test/java/org/apache/alert/coordinator/SchedulerTest.java
@@ -16,27 +16,16 @@
  */
 package org.apache.alert.coordinator;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.CollectionType;
+import com.fasterxml.jackson.databind.type.SimpleType;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
 import org.apache.alert.coordinator.mock.TestTopologyMgmtService;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.tuple.Pair;
-import org.apache.eagle.alert.coordination.model.AlertBoltSpec;
-import org.apache.eagle.alert.coordination.model.Kafka2TupleMetadata;
-import org.apache.eagle.alert.coordination.model.PolicyWorkerQueue;
-import org.apache.eagle.alert.coordination.model.RouterSpec;
-import org.apache.eagle.alert.coordination.model.ScheduleState;
-import org.apache.eagle.alert.coordination.model.SpoutSpec;
-import org.apache.eagle.alert.coordination.model.StreamRepartitionMetadata;
-import org.apache.eagle.alert.coordination.model.StreamRepartitionStrategy;
-import org.apache.eagle.alert.coordination.model.StreamRouterSpec;
-import org.apache.eagle.alert.coordination.model.Tuple2StreamMetadata;
-import org.apache.eagle.alert.coordination.model.WorkSlot;
+import org.apache.eagle.alert.coordination.model.*;
 import org.apache.eagle.alert.coordination.model.internal.MonitoredStream;
 import org.apache.eagle.alert.coordination.model.internal.PolicyAssignment;
 import org.apache.eagle.alert.coordination.model.internal.StreamWorkSlotQueue;
@@ -48,26 +37,17 @@ import org.apache.eagle.alert.coordinator.model.AlertBoltUsage;
 import org.apache.eagle.alert.coordinator.model.GroupBoltUsage;
 import org.apache.eagle.alert.coordinator.model.TopologyUsage;
 import org.apache.eagle.alert.coordinator.provider.InMemScheduleConext;
-import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
+import org.apache.eagle.alert.engine.coordinator.*;
 import org.apache.eagle.alert.engine.coordinator.PolicyDefinition.Definition;
-import org.apache.eagle.alert.engine.coordinator.Publishment;
-import org.apache.eagle.alert.engine.coordinator.StreamColumn;
 import org.apache.eagle.alert.engine.coordinator.StreamColumn.Type;
-import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import org.apache.eagle.alert.engine.coordinator.StreamPartition;
-import org.apache.eagle.alert.engine.coordinator.StreamSortSpec;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.type.CollectionType;
-import com.fasterxml.jackson.databind.type.SimpleType;
-import com.typesafe.config.Config;
-import com.typesafe.config.ConfigFactory;
+import java.io.File;
+import java.util.*;
 
 /**
  * @since Apr 22, 2016
@@ -130,7 +110,7 @@ public class SchedulerTest {
 
                 StreamRepartitionMetadata streamMeta = metas.iterator().next();
                 Assert.assertEquals(STREAM1, streamMeta.getStreamId());
-                Assert.assertEquals(DS_NAME, streamMeta.getTopicName());
+                Assert.assertEquals(TEST_TOPIC, streamMeta.getTopicName());
                 Assert.assertEquals(1, streamMeta.groupingStrategies.size());
 
                 StreamRepartitionStrategy gs = streamMeta.groupingStrategies.iterator().next();
@@ -326,7 +306,7 @@ public class SchedulerTest {
 
                 StreamRepartitionMetadata streamMeta = metas.iterator().next();
                 Assert.assertEquals(STREAM1, streamMeta.getStreamId());
-                Assert.assertEquals(DS_NAME, streamMeta.getTopicName());
+                Assert.assertEquals(TEST_TOPIC, streamMeta.getTopicName());
                 Assert.assertEquals(1, streamMeta.groupingStrategies.size());
 
                 StreamRepartitionStrategy gs = streamMeta.groupingStrategies.iterator().next();
@@ -353,7 +333,7 @@ public class SchedulerTest {
 
                 StreamRepartitionMetadata streamMeta = metas.iterator().next();
                 Assert.assertEquals(STREAM2, streamMeta.getStreamId());
-                Assert.assertEquals(DS_NAME, streamMeta.getTopicName());
+                Assert.assertEquals(TEST_TOPIC, streamMeta.getTopicName());
                 Assert.assertEquals(1, streamMeta.groupingStrategies.size());
 
                 StreamRepartitionStrategy gs = streamMeta.groupingStrategies.iterator().next();
@@ -432,7 +412,7 @@ public class SchedulerTest {
 
                 StreamRepartitionMetadata streamMeta = metas.iterator().next();
                 Assert.assertEquals(STREAM1, streamMeta.getStreamId());
-                Assert.assertEquals(DS_NAME, streamMeta.getTopicName());
+                Assert.assertEquals(TEST_TOPIC, streamMeta.getTopicName());
                 Assert.assertEquals(1, streamMeta.groupingStrategies.size());
 
                 StreamRepartitionStrategy gs = streamMeta.groupingStrategies.iterator().next();

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/7279ee71/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/topology/CorrelationSpoutTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/topology/CorrelationSpoutTest.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/topology/CorrelationSpoutTest.java
index 41e49fa..9deb4b2 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/topology/CorrelationSpoutTest.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/topology/CorrelationSpoutTest.java
@@ -104,8 +104,8 @@ public class CorrelationSpoutTest {
                 Assert.assertEquals(1, streamMetadatas.getStreamRepartitionMetadataMap().size());
                 Assert.assertTrue(streamMetadatas.getStream("s1") != null);
                 Assert.assertTrue(streamMetadatas.getStream("s2") != null);
-                Assert.assertEquals(dataSourceName, streamMetadatas.getStream("s1").getTopicName());
-                Assert.assertEquals(dataSourceName, streamMetadatas.getStream("s2").getTopicName());
+                Assert.assertEquals(topicName, streamMetadatas.getStream("s1").getTopicName());
+                Assert.assertEquals(topicName, streamMetadatas.getStream("s2").getTopicName());
                 LOG.info("successfully verified new topic and streams");
                 verified.set(true);
                 return null;


[40/50] incubator-eagle git commit: [EAGLE-630] Add Publishments to Policy API

Posted by ha...@apache.org.
[EAGLE-630] Add Publishments to Policy API

Path:

    POST /metadata/policies/{policyId}/publishments/

Data: String array, like:

    [
       "publishmentName1", "publishmentName2",.., "publishmentNameN"
    ]

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

Closes #518 from haoch/EAGLE-630.


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

Branch: refs/heads/master
Commit: eda6e586bb598d443e11bbf6db6a72ca966d0b9b
Parents: a710082
Author: Hao Chen <ha...@apache.org>
Authored: Mon Oct 17 14:06:04 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Mon Oct 17 14:06:04 2016 +0800

----------------------------------------------------------------------
 .../metadata/resource/MetadataResource.java     | 43 ++++++++++++++++++++
 .../eagle/alert/metadata/IMetadataDao.java      | 19 +++++++++
 2 files changed, 62 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/eda6e586/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 d540fb5..32a978a 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
@@ -17,6 +17,7 @@
 package org.apache.eagle.service.metadata.resource;
 
 import com.google.common.base.Preconditions;
+import org.apache.commons.lang3.StringUtils;
 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;
@@ -30,8 +31,10 @@ import com.google.inject.Inject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 import javax.ws.rs.*;
 
@@ -231,6 +234,46 @@ public class MetadataResource {
         ).collect(Collectors.toList());
     }
 
+    @Path("/policies/{policyId}/publishments")
+    @POST
+    public OpResult addPublishmentsToPolicy(@PathParam("policyId") String policyId, List<String> publishmentIds) {
+        OpResult result = new OpResult();
+        try {
+            getPolicyByID(policyId);
+            Map<String,Publishment> publishmentMap = new HashMap<>();
+            listPublishment().forEach((pub) -> publishmentMap.put(pub.getName(),pub));
+            for (String publishmentId : publishmentIds) {
+                if (publishmentMap.containsKey(publishmentId)) {
+                    Publishment publishment = publishmentMap.get(publishmentId);
+                    if (publishment.getPolicyIds().contains(policyId)) {
+                        LOG.warn("Policy {} was already bound with publisher {}",policyId, publishmentId);
+                    } else {
+                        publishment.getPolicyIds().add(policyId);
+                    }
+                    OpResult opResult = addPublishment(publishment);
+                    if (opResult.code == OpResult.FAILURE) {
+                        LOG.error("Failed to add publisher {} to policy {}: {}", publishmentId, policyId, opResult.message);
+                        return opResult;
+                    } else {
+                        if (LOG.isDebugEnabled()) {
+                            LOG.debug(opResult.message);
+                        }
+                    }
+                } else {
+                    throw new IllegalArgumentException("Publishsment (name: " + publishmentId + ") not found");
+                }
+            }
+            result.code = OpResult.SUCCESS;
+            result.message = "Successfully add " + publishmentIds.size() + " publishments: [" + StringUtils.join(publishmentIds,",") + "] to policy: " + policyId;
+            LOG.info(result.message);
+        } catch (Exception ex) {
+            result.code = OpResult.FAILURE;
+            result.message = "Failed to add publishments: [" + StringUtils.join(publishmentIds,",") + "] to policy: " + policyId + ", cause: " + ex.getMessage();
+            LOG.error(result.message,ex);
+        }
+        return result;
+    }
+
     @Path("/policies/{policyId}")
     @GET
     public PolicyDefinition getPolicyByID(@PathParam("policyId") String policyId) {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/eda6e586/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/IMetadataDao.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/IMetadataDao.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/IMetadataDao.java
index d245afd..06e96c7 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/IMetadataDao.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata/src/main/java/org/apache/eagle/alert/metadata/IMetadataDao.java
@@ -16,6 +16,7 @@
  */
 package org.apache.eagle.alert.metadata;
 
+import com.google.common.base.Preconditions;
 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;
@@ -23,9 +24,13 @@ import org.apache.eagle.alert.coordination.model.internal.Topology;
 import org.apache.eagle.alert.engine.coordinator.*;
 import org.apache.eagle.alert.metadata.resource.Models;
 import org.apache.eagle.alert.metadata.resource.OpResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.Closeable;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 public interface IMetadataDao extends Closeable {
 
@@ -63,6 +68,7 @@ public interface IMetadataDao extends Closeable {
 
     OpResult addPublishment(Publishment publishment);
 
+
     OpResult removePublishment(String pubId);
 
     List<PublishmentType> listPublishmentType();
@@ -88,4 +94,17 @@ public interface IMetadataDao extends Closeable {
 
     OpResult importModels(Models models);
 
+    // -----------------------------------------------------------
+    //  Extended Metadata DAO Methods with default implementation
+    // -----------------------------------------------------------
+
+    Logger LOG = LoggerFactory.getLogger(IMetadataDao.class);
+
+    default PolicyDefinition getPolicyByID(String policyId) {
+        Preconditions.checkNotNull(policyId,"policyId");
+        return listPolicies().stream().filter(pc -> pc.getName().equals(policyId)).findAny().orElseGet(() -> {
+            LOG.error("Policy (policyId " + policyId + ") not found");
+            throw new IllegalArgumentException("Policy (policyId " + policyId + ") not found");
+        });
+    }
 }


[43/50] incubator-eagle git commit: [MINOR] Set task number of each bolt in HdfsAuditLog Application

Posted by ha...@apache.org.
[MINOR] Set task number of each bolt in HdfsAuditLog Application

If not set, the task number of all bolts are 8

Author: Zhao, Qingwen <qi...@apache.org>

Closes #521 from qingwen220/quickFix.


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

Branch: refs/heads/master
Commit: 3d6a29ec2e67a83742158a08d378cfc5cad59814
Parents: 4734967
Author: Zhao, Qingwen <qi...@apache.org>
Authored: Mon Oct 17 22:45:19 2016 +0800
Committer: Zhao, Qingwen <qi...@apache.org>
Committed: Mon Oct 17 22:45:19 2016 +0800

----------------------------------------------------------------------
 .../auditlog/AbstractHdfsAuditLogApplication.java         | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/3d6a29ec/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/AbstractHdfsAuditLogApplication.java
----------------------------------------------------------------------
diff --git a/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/AbstractHdfsAuditLogApplication.java b/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/AbstractHdfsAuditLogApplication.java
index b985daf..b9f480b 100644
--- a/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/AbstractHdfsAuditLogApplication.java
+++ b/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/AbstractHdfsAuditLogApplication.java
@@ -59,11 +59,11 @@ public abstract class AbstractHdfsAuditLogApplication extends StormApplication {
         int numOfIPZoneJoinTasks = config.getInt(IPZONE_JOIN_TASK_NUM);
         int numOfSinkTasks = config.getInt(SINK_TASK_NUM);
 
-        builder.setSpout("ingest", spout, numOfSpoutTasks);
+        builder.setSpout("ingest", spout, numOfSpoutTasks).setNumTasks(numOfSpoutTasks);
 
 
         BaseRichBolt parserBolt = getParserBolt();
-        BoltDeclarer boltDeclarer = builder.setBolt("parserBolt", parserBolt, numOfParserTasks);
+        BoltDeclarer boltDeclarer = builder.setBolt("parserBolt", parserBolt, numOfParserTasks).setNumTasks(numOfParserTasks);
 
         Boolean useDefaultPartition = !config.hasPath("eagleProps.useDefaultPartition") || config.getBoolean("eagleProps.useDefaultPartition");
         if(useDefaultPartition){
@@ -73,15 +73,15 @@ public abstract class AbstractHdfsAuditLogApplication extends StormApplication {
         }
 
         HdfsSensitivityDataEnrichBolt sensitivityDataJoinBolt = new HdfsSensitivityDataEnrichBolt(config);
-        BoltDeclarer sensitivityDataJoinBoltDeclarer = builder.setBolt("sensitivityJoin", sensitivityDataJoinBolt, numOfSensitivityJoinTasks);
+        BoltDeclarer sensitivityDataJoinBoltDeclarer = builder.setBolt("sensitivityJoin", sensitivityDataJoinBolt, numOfSensitivityJoinTasks).setNumTasks(numOfSensitivityJoinTasks);
         sensitivityDataJoinBoltDeclarer.fieldsGrouping("parserBolt", new Fields("f1"));
 
         IPZoneDataEnrichBolt ipZoneDataJoinBolt = new IPZoneDataEnrichBolt(config);
-        BoltDeclarer ipZoneDataJoinBoltDeclarer = builder.setBolt("ipZoneJoin", ipZoneDataJoinBolt, numOfIPZoneJoinTasks);
+        BoltDeclarer ipZoneDataJoinBoltDeclarer = builder.setBolt("ipZoneJoin", ipZoneDataJoinBolt, numOfIPZoneJoinTasks).setNumTasks(numOfIPZoneJoinTasks);
         ipZoneDataJoinBoltDeclarer.fieldsGrouping("sensitivityJoin", new Fields("user"));
 
         StormStreamSink sinkBolt = environment.getStreamSink("hdfs_audit_log_stream",config);
-        BoltDeclarer kafkaBoltDeclarer = builder.setBolt("kafkaSink", sinkBolt, numOfSinkTasks);
+        BoltDeclarer kafkaBoltDeclarer = builder.setBolt("kafkaSink", sinkBolt, numOfSinkTasks).setNumTasks(numOfSinkTasks);
         kafkaBoltDeclarer.fieldsGrouping("ipZoneJoin", new Fields("user"));
         return builder.createTopology();
 


[15/50] incubator-eagle git commit: [MINOR] Update eagle-env.sh to support MINGW64

Posted by ha...@apache.org.
[MINOR] Update eagle-env.sh to support MINGW64

Author: Qingwen Zhao <qi...@gmail.com>

Closes #496 from qingwen220/updateServerScript.


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

Branch: refs/heads/master
Commit: 3301c9d68acc9b780c62d032aabbfe69db3e7b5d
Parents: 6823410
Author: Qingwen Zhao <qi...@gmail.com>
Authored: Thu Oct 13 10:27:41 2016 +0800
Committer: Zhao, Qingwen <qi...@apache.org>
Committed: Thu Oct 13 10:27:41 2016 +0800

----------------------------------------------------------------------
 eagle-server-assembly/src/main/bin/eagle-env.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/3301c9d6/eagle-server-assembly/src/main/bin/eagle-env.sh
----------------------------------------------------------------------
diff --git a/eagle-server-assembly/src/main/bin/eagle-env.sh b/eagle-server-assembly/src/main/bin/eagle-env.sh
index cbe307b..892978b 100644
--- a/eagle-server-assembly/src/main/bin/eagle-env.sh
+++ b/eagle-server-assembly/src/main/bin/eagle-env.sh
@@ -26,7 +26,7 @@ export OS_TYPE="linux"
 export CLASSPATH_DELIMITER=":"
 
 case `which uname >/dev/null && uname -s` in
-    CYGWIN_NT-*)
+    CYGWIN_NT-* | MINGW64_NT-*)
         OS_TYPE="windows"
         CLASSPATH_DELIMITER=";"
         ;;


[35/50] incubator-eagle git commit: [EAGLE-625] remove site ignore

Posted by ha...@apache.org.
[EAGLE-625] remove site ignore

Root `.gitignore` prevent the site folder which ignore the web page site folder.

Author: zombieJ <sm...@gmail.com>

Closes #516 from zombieJ/EAGLE-625.


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

Branch: refs/heads/master
Commit: 33b9720656b8cd7ec5df883b79b20bccd5bddb3e
Parents: 97edbbb
Author: zombieJ <sm...@gmail.com>
Authored: Mon Oct 17 10:28:26 2016 +0800
Committer: zombieJ <sm...@gmail.com>
Committed: Mon Oct 17 10:28:26 2016 +0800

----------------------------------------------------------------------
 .gitignore                                      |  1 -
 .../main/webapp/app/dev/partials/site/home.html | 36 ++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/33b97206/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 3a925f3..cfff821 100644
--- a/.gitignore
+++ b/.gitignore
@@ -83,5 +83,4 @@ logs/
 *.orig
 **/*.pyc
 
-site/
 **/*.db
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/33b97206/eagle-server/src/main/webapp/app/dev/partials/site/home.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/site/home.html b/eagle-server/src/main/webapp/app/dev/partials/site/home.html
new file mode 100644
index 0000000..217db56
--- /dev/null
+++ b/eagle-server/src/main/webapp/app/dev/partials/site/home.html
@@ -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
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<div class="row flex">
+	<div class="col-sm-6 col-md-4 col-lg-3" ng-repeat="widget in Widget.list track by $index">
+		<div widget="widget"></div>
+	</div>
+
+	<div class="col-sm-6 col-md-4 col-lg-3" ng-if="Widget.list.length === 0">
+		<div class="small-box bg-gray">
+			<div class="inner">
+				<h3>No Widget</h3>
+
+				<p>No widget provided by Application</p>
+			</div>
+			<div class="icon">
+				<i class="fa fa-info-circle"></i>
+			</div>
+		</div>
+	</div>
+</div>


[03/50] incubator-eagle git commit: [EAGLE-577] UI policy management

Posted by ha...@apache.org.
[EAGLE-577] UI policy management

For 0.5 api, policy management api has been update. UI also need fit for that.

Author: zombieJ <sm...@gmail.com>

Closes #483 from zombieJ/EAGLE-577.


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

Branch: refs/heads/master
Commit: 4e5641c356b4e5ae4dad1d7d012bd418fc7b408d
Parents: d9b82b4
Author: zombieJ <sm...@gmail.com>
Authored: Mon Oct 10 17:26:07 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Mon Oct 10 17:26:07 2016 +0800

----------------------------------------------------------------------
 eagle-server/src/main/webapp/app/dev/index.html |   7 +-
 .../app/dev/partials/alert/policyDetail.html    | 111 +++++++
 .../app/dev/partials/alert/policyEdit.html      | 219 +++++++++++++-
 .../app/dev/partials/alert/policyList.html      | 126 ++++----
 .../src/main/webapp/app/dev/public/css/main.css |  34 +++
 .../src/main/webapp/app/dev/public/js/app.js    |  10 +-
 .../src/main/webapp/app/dev/public/js/common.js |  22 +-
 .../webapp/app/dev/public/js/ctrls/alertCtrl.js |  48 +--
 .../app/dev/public/js/ctrls/alertEditCtrl.js    | 295 +++++++++++++++++++
 .../app/dev/public/js/ctrls/integrationCtrl.js  |   6 +-
 .../app/dev/public/js/services/entitySrv.js     |   8 +-
 .../webapp/app/dev/public/js/services/uiSrv.js  |  74 +++--
 eagle-server/src/main/webapp/app/package.json   |   2 +-
 13 files changed, 833 insertions(+), 129 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4e5641c3/eagle-server/src/main/webapp/app/dev/index.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/index.html b/eagle-server/src/main/webapp/app/dev/index.html
index 56850d7..19ea204 100644
--- a/eagle-server/src/main/webapp/app/dev/index.html
+++ b/eagle-server/src/main/webapp/app/dev/index.html
@@ -134,7 +134,11 @@
 
 					<ol class="breadcrumb">
 						<li ng-repeat="navPath in PageConfig.navPath">
-							<a ng-href="#{{navPath.path}}">
+							<span ng-if="!navPath.path">
+								<span class="fa fa-home" ng-if="$first"></span>
+								{{navPath.title || navPath.path}}
+							</span>
+							<a ng-if="navPath.path" ng-href="#{{navPath.path}}">
 								<span class="fa fa-home" ng-if="$first"></span>
 								{{navPath.title || navPath.path}}
 							</a>
@@ -243,6 +247,7 @@
 		<script src="public/js/ctrls/main.js" type="text/javascript" charset="utf-8"></script>
 		<script src="public/js/ctrls/mainCtrl.js" type="text/javascript" charset="utf-8"></script>
 		<script src="public/js/ctrls/alertCtrl.js" type="text/javascript" charset="utf-8"></script>
+		<script src="public/js/ctrls/alertEditCtrl.js" type="text/javascript" charset="utf-8"></script>
 		<script src="public/js/ctrls/integrationCtrl.js" type="text/javascript" charset="utf-8"></script>
 		<script src="public/js/ctrls/siteCtrl.js" type="text/javascript" charset="utf-8"></script>
 		<!-- endref -->

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4e5641c3/eagle-server/src/main/webapp/app/dev/partials/alert/policyDetail.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/alert/policyDetail.html b/eagle-server/src/main/webapp/app/dev/partials/alert/policyDetail.html
new file mode 100644
index 0000000..b04a8a8
--- /dev/null
+++ b/eagle-server/src/main/webapp/app/dev/partials/alert/policyDetail.html
@@ -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.
+  -->
+
+<div class="nav-tabs-custom">
+	<ul class="nav nav-tabs">
+		<li class="active"><a href="#policy" data-toggle="tab">Policy</a></li>
+		<li><a href="#publisher" data-toggle="tab">Publisher</a></li>
+
+		<li class="pull-right">
+			<a>
+				<span class="label" ng-class="{'label-default': policy.policyStatus !== 'ENABLED', 'label-success': policy.policyStatus === 'ENABLED'}">
+					{{policy.policyStatus}}
+				</span>
+			</a>
+		</li>
+	</ul>
+	<div class="tab-content">
+		<div class="tab-pane active" id="policy">
+			<table class="table">
+				<tbody>
+					<tr>
+						<th>Name</th>
+						<td>{{policy.name}}</td>
+						<th>Parallelism Hint</th>
+						<td>{{policy.parallelismHint}}</td>
+					</tr>
+					<tr>
+						<th>Description</th>
+						<td colspan="3"><pre class="inline">{{policy.description}}</pre></td>
+					</tr>
+					<tr>
+						<th>Input Streams</th>
+						<td>
+							<ul class="no-margin">
+								<li ng-repeat="stream in policy.inputStreams track by $index">
+									{{stream}}
+								</li>
+							</ul>
+						</td>
+						<th>Output Streams</th>
+						<td>
+							<ul class="no-margin">
+								<li ng-repeat="stream in policy.outputStreams track by $index">
+									{{stream}}
+								</li>
+							</ul>
+						</td>
+					</tr>
+					<tr>
+						<th>Definition</th>
+						<td colspan="3"><pre class="inline">{{policy.definition.value}}</pre></td>
+					</tr>
+					<tr>
+						<th>Partition</th>
+						<td colspan="3">
+							<ul class="no-margin">
+								<li ng-repeat="partition in policy.partitionSpec track by $index">
+									[<span class="text-primary">{{partition.type}}</span>]
+									{{partition.streamId}}:
+									<strong class="text-success">{{partition.columns.join(", ")}}</strong>
+								</li>
+							</ul>
+						</td>
+					</tr>
+				</tbody>
+			</table>
+		</div>
+		<div class="tab-pane" id="publisher">
+			<table class="table table-bordered" ng-repeat="publisher in publisherList track by publisher.name">
+				<tbody>
+					<tr>
+						<th width="100" class="text-no-break">Name</th>
+						<td>{{publisher.name}}</td>
+						<th width="150" class="text-no-break">DeDup Interval Min</th>
+						<td>{{publisher.dedupIntervalMin}}</td>
+					</tr>
+					<tr>
+						<th>Type</th>
+						<td colspan="3">{{publisher.type}}</td>
+					</tr>
+					<tr>
+						<th>Properties</th>
+						<td colspan="3">
+							<ul class="no-margin">
+								<li ng-repeat="(key, value) in publisher.properties track by key">
+									<strong>{{key}}:</strong>
+									{{value}}
+								</li>
+							</ul>
+						</td>
+					</tr>
+				</tbody>
+			</table>
+		</div>
+	</div>
+</div>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4e5641c3/eagle-server/src/main/webapp/app/dev/partials/alert/policyEdit.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/alert/policyEdit.html b/eagle-server/src/main/webapp/app/dev/partials/alert/policyEdit.html
index 9a1cbe4..e7fcea9 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/alert/policyEdit.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/alert/policyEdit.html
@@ -17,13 +17,222 @@
   -->
 
 <div class="box-body">
-	<ul class="stepGuide">
-		<li>
-			<span class="icon bg-green">1</span>
-			<span class="title">This is the title!!!</span>
+	<ul class="timeline">
+		<!-- Base Info -->
+		<li class="time-label">
+			<span class="bg-blue">#1. Basic Information</span>
 		</li>
 		<li>
-			<span class="icon">2</span>
+			<span class="fa fa-file-text bg-aqua"></span>
+			<div class="timeline-item">
+				<div class="timeline-body">
+					<div class="form-group">
+						<label>Policy Name</label>
+						<input type="text" class="form-control" ng-model="policy.name" ng-readonly="!newPolicy" />
+					</div>
+					<div class="form-group">
+						<label>Description <small class="text-muted">[Optional]</small></label>
+						<textarea class="form-control" ng-model="policy.description" rows="3"></textarea>
+					</div>
+				</div>
+			</div>
+		</li>
+
+		<!-- Alert Stream -->
+		<li class="time-label" ng-class="{disabled: !checkBasicInfo()}">
+			<span class="bg-blue">#2. Alert Stream</span>
+		</li>
+		<li ng-class="{disabled: !checkBasicInfo()}">
+			<span class="fa fa-rocket bg-aqua"></span>
+			<div class="timeline-item">
+				<div class="timeline-body">
+					<label>Input Stream</label>
+					<ul class="list-unstyled with-margin">
+						<li ng-repeat="stream in policy.inputStreams track by $index">
+							[<a class="fa fa-times" ng-click="removeStream(stream)"></a>] {{stream}}
+						</li>
+						<li ng-if="policy.inputStreams.length === 0"><span class="fa fa-ban"></span> (empty list)</li>
+					</ul>
+
+					<div class="inner-block">
+						<div class="form-group">
+							<label>Application</label>
+							<select class="form-control" ng-model="selectedApplication" ng-change="refreshStreamSelect()">
+								<option ng-repeat="(app, list) in applications track by $index" value="{{app}}">
+									{{app}}
+								</option>
+							</select>
+						</div>
+						<div class="form-group">
+							<label>Stream</label>
+							<select class="form-control" ng-model="selectedStream">
+								<option ng-repeat="stream in applications[selectedApplication] track by $index" value="{{stream.streamId}}">
+									[{{stream.siteId}}]
+									{{stream.streamId}}
+									{{checkAddStream(stream.streamId) ? '' : '(Already Added)'}}
+								</option>
+							</select>
+						</div>
+						<button class="btn btn-success" ng-click="addStream()" ng-disabled="!checkAddStream(selectedStream)">
+							<span class="fa fa-plus"></span> Add Stream
+						</button>
+					</div>
+
+
+					<label>Output Stream</label>
+					<ul class="list-unstyled with-margin">
+						<li ng-repeat="stream in policy.outputStreams track by $index">
+							[<a class="fa fa-times" ng-click="removeOutputStream(stream)"></a>] {{stream}}
+						</li>
+						<li ng-if="policy.outputStreams.length === 0"><span class="fa fa-ban"></span> (empty list)</li>
+					</ul>
+					<div class="inner-block">
+						<div class="form-group">
+							<input type="text" class="form-control" ng-model="outputStream" />
+						</div>
+						<button class="btn btn-success" ng-click="addOutputStream()" ng-disabled="!checkAddOutputStream()">
+							<span class="fa fa-plus"></span> Add Stream
+						</button>
+					</div>
+				</div>
+			</div>
+		</li>
+
+		<!-- Definition -->
+		<li class="time-label" ng-class="{disabled: !checkAlertStream()}">
+			<span class="bg-blue">#3. Definition</span>
+		</li>
+		<li ng-class="{disabled: !checkAlertStream()}">
+			<span class="fa fa-pencil bg-aqua"></span>
+			<div class="timeline-item">
+				<div class="timeline-body">
+					<div class="form-group">
+						<label>Definition</label>
+						<textarea class="form-control" ng-model="policy.definition.value" rows="8"></textarea>
+					</div>
+
+					<div class="form-group" ng-class="{'has-warning': !checkNumber(policy.parallelismHint)}">
+						<label>
+							Parallelism Hint
+							<small class="text-muted" ng-if="!checkNumber(policy.parallelismHint)">- Number Only</small>
+						</label>
+						<input type="number" class="form-control" ng-model="policy.parallelismHint" />
+					</div>
+
+					<label>Partition <small class="text-muted">[Optional]</small></label>
+					<ul class="list-unstyled with-margin">
+						<li ng-repeat="partition in policy.partitionSpec track by $index">
+							[<a class="fa fa-times" ng-click="removePartition(partition)"></a>]
+							[<span class="text-primary">{{partition.type}}</span>]
+							{{partition.streamId}}:
+							<strong class="text-success">{{partition.columns.join(", ")}}</strong>
+						</li>
+						<li ng-if="policy.partitionSpec.length === 0"><span class="fa fa-ban"></span> (empty list)</li>
+					</ul>
+
+					<div class="inner-block">
+						<div class="form-group">
+							<label>Stream</label>
+							<select class="form-control" ng-model="partitionStream">
+								<option ng-repeat="stream in policy.inputStreams track by $index" value="{{stream}}">
+									{{stream}}
+								</option>
+							</select>
+						</div>
+						<div class="form-group">
+							<label>Type</label>
+							<select class="form-control" ng-model="partitionType">
+								<option>GROUPBY</option>
+								<option>GLOBAL</option>
+								<option>SHUFFLE</option>
+							</select>
+						</div>
+						<div class="form-group">
+							<label>Columns</label>
+							<div>
+								<label class="checkbox-inline" ng-repeat="column in getPartitionColumns() track by $index">
+									<input type="checkbox"
+										   ng-checked="partitionColumns[column.name]"
+										   ng-click="partitionColumns[column.name] = !partitionColumns[column.name]"
+									/>{{column.name}}
+								</label>
+							</div>
+						</div>
+
+						<button class="btn btn-success" ng-click="addPartition()" ng-disabled="!checkAddPartition()">
+							<span class="fa fa-plus"></span> Add Partition
+						</button>
+					</div>
+				</div>
+			</div>
+		</li>
+
+		<!-- Publisher Configuration -->
+		<li class="time-label" ng-class="{disabled: !checkDefinition()}">
+			<span class="bg-blue">#4. Publisher Configuration</span>
+		</li>
+		<li ng-class="{disabled: !checkDefinition()}">
+			<span class="fa fa-envelope bg-aqua"></span>
+			<div class="timeline-item">
+				<div class="timeline-body">
+					<label>Publisher</label>
+					<ul class="list-unstyled with-margin block-list">
+						<li ng-repeat="publisher in publisherList track by publisher.name">
+							<a class="pull-right fa fa-times" ng-click="removePublisher(publisher)"></a>
+							<p>
+								<strong>Name:</strong>
+								{{publisher.name}}
+							</p>
+							<p>
+								<strong>Type:</strong>
+								{{publisher.type}}
+							</p>
+							<p>
+								<strong>DeDup-Interval Min:</strong>
+								{{publisher.dedupIntervalMin}}
+							</p>
+							<p ng-repeat="field in publisherTypes[publisher.type] track by $index">
+								<strong>{{field}}:</strong>
+								{{publisher.properties[field]}}
+							</p>
+						</li>
+						<li ng-if="publisherList.length === 0" class="no-decorate"><span class="fa fa-ban"></span> (empty list)</li>
+					</ul>
+
+					<div class="inner-block">
+						<div class="form-group">
+							<label>Name</label>
+							<input type="text" class="form-control" ng-model="publisher.name" />
+						</div>
+						<div class="form-group">
+							<label>DeDup-Interval Min</label>
+							<input type="text" class="form-control" ng-model="publisher.dedupIntervalMin" />
+						</div>
+						<div class="form-group">
+							<label>Type</label>
+							<select class="form-control" ng-model="publisherType">
+								<option ng-repeat="(type, fields) in publisherTypes track by $index"
+										value="{{type}}">{{type}}</option>
+							</select>
+						</div>
+						<div class="form-group" ng-repeat="field in publisherTypes[publisherType] track by $index">
+							<label>{{field}}</label>
+							<input type="text" class="form-control" ng-model="publisherProps[field]" />
+						</div>
+						<button class="btn btn-success" ng-click="addPublisher()" ng-disabled="!checkAddPublisher()">
+							<span class="fa fa-plus"></span> Add Publisher
+						</button>
+					</div>
+				</div>
+			</div>
 		</li>
 	</ul>
+
+	<pre class="hide">{{policy | json : "\t"}}</pre>
+</div>
+
+<div class="box-footer text-right">
+	<button class="btn btn-primary" ng-disabled="!checkDefinition() || policyLock" ng-click="createPolicy()">
+		{{newPolicy ? 'New' : 'Update'}} Policy
+	</button>
 </div>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4e5641c3/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html b/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html
index 2d4703f..49d8ab8 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html
@@ -1,63 +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
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  -->
-
-<div class="box box-solid">
-	<div class="box-body">
-		<div sort-table="policyList" ng-show="policyList.length">
-			<table class="table table-bordered">
-				<thead>
-					<tr>
-						<th sortpath="name" width="20%">Name</th>
-						<th sortpath="definition.type" width="70">Type</th>
-						<th>Description</th>
-						<th width="85">Action</th>
-					</tr>
-				</thead>
-				<tbody>
-					<tr>
-						<td>
-							<a ng-href="#/alert/policyEdit/{{item.name}}">{{item.name}}</a>
-						</td>
-						<td class="text-center"><span class="label label-primary">{{item.definition.type}}</span></td>
-						<td>{{item.description}}</td>
-						<td class="text-center">
-							<div class="btn-group btn-group-xs">
-								<button class="btn btn-default"><span class="fa fa-play"></span></button>
-								<button class="btn btn-default"><span class="fa fa-pencil"></span></button>
-								<button class="btn btn-danger" ng-click="deletePolicy(item)"><span class="fa fa-trash"></span></button>
-							</div>
-						</td>
-					</tr>
-				</tbody>
-			</table>
-		</div>
-
-		<div class="callout callout-warning no-margin" ng-show="policyList._done && policyList.length === 0">
-			<h4>No Policy yet</h4>
-			<p>You have not create policy yet. Click <a href="#/alert/policyCreate">here</a> to create a new policy.</p>
-		</div>
-	</div>
-
-	<div class="overlay" ng-if="!policyList._done">
-		<i class="fa fa-refresh fa-spin"></i>
-	</div>
-
-	<div class="box-footer text-right">
-		<a href="#/alert/policyCreate" class="btn btn-primary">New Policy</a>
-	</div>
-</div>
\ No newline at end of file
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<div class="box box-solid">
+	<div class="box-body">
+		<div sort-table="policyList" ng-show="policyList.length">
+			<table class="table table-bordered">
+				<thead>
+					<tr>
+						<th sortpath="name" width="20%">Name</th>
+						<th sortpath="definition.type" width="70">Type</th>
+						<th>Description</th>
+						<th width="85">Action</th>
+					</tr>
+				</thead>
+				<tbody>
+					<tr>
+						<td>
+							<a ui-sref="policyDetail({name: item.name})" target="_blank">{{item.name}}</a>
+						</td>
+						<td class="text-center"><span class="label label-primary">{{item.definition.type}}</span></td>
+						<td>{{item.description}}</td>
+						<td class="text-center">
+							<div class="btn-group btn-group-xs">
+								<button class="btn btn-default"><span class="fa fa-play"></span></button>
+								<a ui-sref="alert.policyEdit({name: item.name})" target="_blank" class="btn btn-default"><span class="fa fa-pencil"></span></a>
+								<button class="btn btn-danger" ng-click="deletePolicy(item)"><span class="fa fa-trash"></span></button>
+							</div>
+						</td>
+					</tr>
+				</tbody>
+			</table>
+		</div>
+
+		<div class="callout callout-warning no-margin" ng-show="policyList._done && policyList.length === 0">
+			<h4>No Policy yet</h4>
+			<p>You have not create policy yet. Click <a href="#/alert/policyCreate">here</a> to create a new policy.</p>
+		</div>
+	</div>
+
+	<div class="overlay" ng-if="!policyList._done">
+		<i class="fa fa-refresh fa-spin"></i>
+	</div>
+
+	<div class="box-footer text-right">
+		<a href="#/alert/policyCreate" class="btn btn-primary">New Policy</a>
+	</div>
+</div>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4e5641c3/eagle-server/src/main/webapp/app/dev/public/css/main.css
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/css/main.css b/eagle-server/src/main/webapp/app/dev/public/css/main.css
index 83f9b14..07482e1 100644
--- a/eagle-server/src/main/webapp/app/dev/public/css/main.css
+++ b/eagle-server/src/main/webapp/app/dev/public/css/main.css
@@ -126,6 +126,8 @@ table.table pre.inline {
 	border: 0;
 	border-radius: 0;
 	background: transparent;
+	font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
+	font-size: 14px;
 }
 
 table.table.table-sm th,
@@ -270,10 +272,42 @@ ul.stepGuide li > .title {
 /* ========================================================================
  * =                               Timeline                               =
  * ======================================================================== */
+.nav-tabs-custom .timeline li.disabled {
+	opacity: .5;
+	pointer-events: none;
+}
+
 .nav-tabs-custom .timeline li .timeline-item {
 	background: #f4f4f4;
 }
 
+.nav-tabs-custom .timeline li .timeline-item ul.with-margin {
+	margin: 0 0 10px 15px;
+}
+
+.nav-tabs-custom .timeline li .timeline-item .inner-block {
+	border: 1px solid #CCC;
+	padding: 10px;
+	margin: 0 0 15px 15px;
+}
+
+.nav-tabs-custom .timeline li .timeline-item ul.block-list li {
+	margin-bottom: 10px;
+}
+.nav-tabs-custom .timeline li .timeline-item ul.block-list li:last-child {
+	margin-bottom: 0;
+}
+
+.nav-tabs-custom .timeline li .timeline-item ul.block-list li:not(.no-decorate) {
+	background: #DEDEDE;
+	padding: 10px;
+	line-height: 150%;
+}
+
+.nav-tabs-custom .timeline li .timeline-item ul.block-list li:not(.no-decorate) p {
+	margin: 0;
+}
+
 /* ========================================================================
  * =                                Widget                                =
  * ======================================================================== */

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4e5641c3/eagle-server/src/main/webapp/app/dev/public/js/app.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/app.js b/eagle-server/src/main/webapp/app/dev/public/js/app.js
index 4ec77d9..fb40ed4 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/app.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/app.js
@@ -115,6 +115,13 @@ var app = {};
 					controller: "policyEditCtrl",
 					resolve: routeResolve()
 				})
+
+				.state('policyDetail', {
+					url: "/policyDetail/{name}",
+					templateUrl: "partials/alert/policyDetail.html?_=" + window._TRS(),
+					controller: "policyDetailCtrl",
+					resolve: routeResolve()
+				})
 				// =============================== Integration ==============================
 				.state('integration', {
 					abstract: true,
@@ -229,7 +236,8 @@ var app = {};
 
 			Object.defineProperty(window, "scope", {
 				get: function () {
-					return angular.element("#content .ng-scope").scope();
+					var ele = $("#content .nav-tabs-custom.ng-scope .ng-scope[ui-view], #content .ng-scope[ui-view]").last();
+					return angular.element(ele).scope();
 				}
 			});
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4e5641c3/eagle-server/src/main/webapp/app/dev/public/js/common.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/common.js b/eagle-server/src/main/webapp/app/dev/public/js/common.js
index 9f5c4b1..0e9cc7c 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/common.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/common.js
@@ -154,6 +154,12 @@
 		return mergedObj;
 	};
 
+	common.getKeys = function (obj) {
+		return $.map(obj, function (val, key) {
+			return key;
+		});
+	};
+
 	// ============================ String ============================
 	common.string = {};
 	common.string.safeText = function (str) {
@@ -223,6 +229,12 @@
 		return list;
 	};
 
+	common.array.remove = function (val, list, path) {
+		return $.grep(list, function (obj) {
+			return common.getValueByPath(obj, path) !== val;
+		});
+	};
+
 	common.array.doSort = function (list, path, asc, sortList) {
 		var sortFunc;
 		sortList = sortList || [];
@@ -281,7 +293,6 @@
 	// =========================== Deferred ===========================
 	common.deferred = {};
 
-
 	common.deferred.all = function (deferredList) {
 		var deferred = $.Deferred();
 		var successList = [];
@@ -301,12 +312,17 @@
 
 		$.each(deferredList, function (i, deferred) {
 			if(deferred && deferred.then) {
-				deferred.then(function (data) {
+				var promise = deferred.then(function (data) {
 					successList[i] = data;
 				}, function (data) {
 					failureList[i] = data;
 					hasFailure = true;
-				}).always(doCheck);
+				});
+				if(promise.always) {
+					promise.always(doCheck);
+				} else if(promise.finally) {
+					promise.finally(doCheck);
+				}
 			} else {
 				successList[i] = deferred;
 				doCheck();

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4e5641c3/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
index 17ce775..ae5194c 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
@@ -51,14 +51,14 @@
 	});
 
 	// ======================================================================================
-	// =                                        List                                        =
+	// =                                        Alert                                       =
 	// ======================================================================================
 	eagleControllers.controller('alertListCtrl', function ($scope, $wrapState, PageConfig) {
 		PageConfig.subTitle = "Explore Alerts";
 	});
 
 	// ======================================================================================
-	// =                                     Policy List                                    =
+	// =                                       Policy                                       =
 	// ======================================================================================
 	eagleControllers.controller('policyListCtrl', function ($scope, $wrapState, PageConfig, Entity, UI) {
 		PageConfig.subTitle = "Manage Policies";
@@ -75,45 +75,29 @@
 		};
 	});
 
-	// ======================================================================================
-	// =                                    Policy Create                                   =
-	// ======================================================================================
-	function connectPolicyEditController(entity, args) {
-		var newArgs = [entity];
-		Array.prototype.push.apply(newArgs, args);
-		/* jshint validthis: true */
-		policyEditController.apply(this, newArgs);
-	}
-	function policyEditController(policy, $scope, $wrapState, PageConfig, Entity) {
-		$scope.policy = policy;
-	}
+	eagleControllers.controller('policyDetailCtrl', function ($scope, $wrapState, PageConfig, Entity, UI) {
+		PageConfig.title = $wrapState.param.name;
+		PageConfig.subTitle = "Detail";
+		PageConfig.navPath = [
+			{title: "Policy List", path: "/alert/policyList"},
+			{title: "Detail"}
+		];
 
-	eagleControllers.controller('policyCreateCtrl', function ($scope, $wrapState, PageConfig, Entity) {
-		PageConfig.subTitle = "Define Alert Policy";
-		connectPolicyEditController({}, arguments);
-	});
-	eagleControllers.controller('policyEditCtrl', function ($scope, $wrapState, PageConfig, Entity) {
-		PageConfig.subTitle = "Edit Alert Policy";
-		var args = arguments;
+		var policyList = Entity.queryMetadata("policies/" + encodeURIComponent($wrapState.param.name));
+		policyList._promise.then(function () {
+			$scope.policy = policyList[0];
+			console.log("[Policy]", $scope.policy);
 
-		// TODO: Wait for backend data update
-		$scope.policyList = Entity.queryMetadata("policies");
-		$scope.policyList._promise.then(function () {
-			var policy = $scope.policyList.find(function (entity) {
-				return entity.name === $wrapState.param.name;
-			});
-
-			if(policy) {
-				connectPolicyEditController(policy, args);
-			} else {
+			if(!$scope.policy) {
 				$.dialog({
 					title: "OPS",
 					content: "Policy '" + $wrapState.param.name + "' not found!"
 				}, function () {
 					$wrapState.go("alert.policyList");
 				});
+			} else {
+				$scope.publisherList = Entity.queryMetadata("policies/" + encodeURIComponent($scope.policy.name) + "/publishments");
 			}
 		});
-
 	});
 }());

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4e5641c3/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
new file mode 100644
index 0000000..05a47d4
--- /dev/null
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
@@ -0,0 +1,295 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function() {
+	'use strict';
+
+	var eagleControllers = angular.module('eagleControllers');
+
+	var publisherTypes = {
+		'org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher': ["subject", "template", "sender", "recipients", "mail.smtp.host", "connection", "mail.smtp.port"],
+		'org.apache.eagle.alert.engine.publisher.impl.AlertKafkaPublisher': ["topic", "kafka_broker", "rawAlertNamespaceLabel", "rawAlertNamespaceValue"],
+		'org.apache.eagle.alert.engine.publisher.impl.AlertSlackPublisher': ["token", "channels", "severitys", "urltemplate"]
+	};
+
+	// ======================================================================================
+	// =                                    Policy Create                                   =
+	// ======================================================================================
+	function connectPolicyEditController(entity, args) {
+		var newArgs = [entity];
+		Array.prototype.push.apply(newArgs, args);
+		/* jshint validthis: true */
+		policyEditController.apply(this, newArgs);
+	}
+
+	eagleControllers.controller('policyCreateCtrl', function ($scope, $wrapState, PageConfig, Entity) {
+		PageConfig.subTitle = "Define Alert Policy";
+		connectPolicyEditController({}, arguments);
+	});
+	eagleControllers.controller('policyEditCtrl', function ($scope, $wrapState, PageConfig, Entity) {
+		PageConfig.subTitle = "Edit Alert Policy";
+		var args = arguments;
+
+		// TODO: Wait for backend data update
+		$scope.policyList = Entity.queryMetadata("policies/" + encodeURIComponent($wrapState.param.name));
+
+		$scope.policyList._promise.then(function () {
+			var policy = $scope.policyList[0];
+
+			if(policy) {
+				connectPolicyEditController(policy, args);
+			} else {
+				$.dialog({
+					title: "OPS",
+					content: "Policy '" + $wrapState.param.name + "' not found!"
+				}, function () {
+					$wrapState.go("alert.policyList");
+				});
+			}
+		});
+	});
+
+	function policyEditController(policy, $scope, $wrapState, PageConfig, Entity) {
+		$scope.newPolicy = !policy.name;
+		$scope.policyLock = false;
+
+		$scope.publisherTypes = publisherTypes;
+
+		$scope.selectedApplication = null;
+		$scope.selectedStream = null;
+
+		$scope.outputStream = "";
+
+		$scope.partitionStream = null;
+		$scope.partitionType = "GROUPBY";
+		$scope.partitionColumns = {};
+
+		$scope.publisherType = "org.apache.eagle.alert.engine.publisher.impl.AlertEmailPublisher";
+		$scope.publisher = {
+			dedupIntervalMin: "PT1M"
+		};
+		$scope.publisherProps = {};
+
+		$scope.policy = common.merge({
+			name: "",
+			description: "",
+			inputStreams: [],
+			outputStreams: [],
+			definition: {
+				type: "siddhi",
+				value: ""
+			},
+			partitionSpec: [],
+			parallelismHint: 2
+		}, policy);
+
+		$scope.policy.definition = {
+			type: $scope.policy.definition.type,
+			value: $scope.policy.definition.value
+		};
+
+		console.log("[Policy]", $scope.policy);
+
+		// =========================================================
+		// =                      Check Logic                      =
+		// =========================================================
+		$scope.checkBasicInfo = function () {
+			return !!$scope.policy.name;
+		};
+
+		$scope.checkAlertStream = function () {
+			return $scope.checkBasicInfo() &&
+				$scope.policy.inputStreams.length > 0 &&
+				$scope.policy.outputStreams.length > 0;
+		};
+
+		$scope.checkNumber = function (str) {
+			str = (str + "").trim();
+			return str !== "" && common.number.isNumber(Number(str));
+		};
+
+		$scope.checkDefinition = function () {
+			return $scope.checkAlertStream() &&
+				!!$scope.policy.definition.value.trim() &&
+				$scope.policy.parallelismHint > 0;
+		};
+
+		// =========================================================
+		// =                        Stream                         =
+		// =========================================================
+		$scope.refreshStreamSelect = function() {
+			var appStreamList;
+
+			if(!$scope.selectedApplication) {
+				$scope.selectedApplication = common.getKeys($scope.applications)[0];
+			}
+
+			appStreamList = $scope.applications[$scope.selectedApplication] || [];
+			if(!common.array.find($scope.selectedStream, appStreamList)) {
+				$scope.selectedStream = appStreamList[0].streamId;
+			}
+			if(!common.array.find($scope.partitionStream, $scope.policy.inputStreams)) {
+				$scope.partitionStream = $scope.policy.inputStreams[0];
+			}
+		};
+
+		$scope.streamList = Entity.queryMetadata("streams");
+		$scope.streamList._then(function () {
+			$scope.applications = {};
+
+			$.each($scope.streamList, function (i, stream) {
+				var list = $scope.applications[stream.dataSource] = $scope.applications[stream.dataSource] || [];
+				list.push(stream);
+			});
+
+			console.log("=>", $scope.streamList);
+			$scope.refreshStreamSelect();
+		});
+
+		$scope.getStreamList = function () {
+			return common.array.minus($scope.streamList, $scope.policy.inputStreams, "streamId", "");
+		};
+
+		$scope.addStream = function () {
+			$scope.policy.inputStreams.push($scope.selectedStream);
+			$scope.refreshStreamSelect();
+		};
+
+		$scope.removeStream = function (streamId) {
+			$scope.policy.inputStreams = common.array.remove(streamId, $scope.policy.inputStreams);
+			$scope.refreshStreamSelect();
+		};
+
+		$scope.checkAddStream = function (streamId) {
+			return !common.array.find(streamId, $scope.policy.inputStreams);
+		};
+
+		$scope.addOutputStream = function () {
+			$scope.policy.outputStreams.push($scope.outputStream);
+			$scope.outputStream = "";
+		};
+
+		$scope.removeOutputStream = function (streamId) {
+			$scope.policy.outputStreams = common.array.remove(streamId, $scope.policy.outputStreams);
+		};
+
+		$scope.checkAddOutputStream = function () {
+			return $scope.outputStream !== "" && !common.array.find($scope.outputStream, $scope.policy.outputStreams);
+		};
+
+		// =========================================================
+		// =                      Definition                       =
+		// =========================================================
+		$scope.getPartitionColumns = function () {
+			var stream = common.array.find($scope.partitionStream, $scope.streamList, "streamId");
+			return (stream || {}).columns;
+		};
+
+		$scope.addPartition = function () {
+			$scope.policy.partitionSpec.push({
+				streamId: $scope.partitionStream,
+				type: $scope.partitionType,
+				columns: $.map($scope.getPartitionColumns(), function (column) {
+					return $scope.partitionColumns[column.name] ? column.name : null;
+				})
+			});
+
+			$scope.partitionColumns = {};
+		};
+
+		$scope.checkAddPartition = function () {
+			var match = false;
+
+			$.each($scope.getPartitionColumns(), function (i, column) {
+				if($scope.partitionColumns[column.name]) {
+					match = true;
+					return false;
+				}
+			});
+
+			return match;
+		};
+
+		$scope.removePartition = function (partition) {
+			$scope.policy.partitionSpec = common.array.remove(partition, $scope.policy.partitionSpec);
+		};
+
+		// =========================================================
+		// =                       Publisher                       =
+		// =========================================================
+		$scope.publisherList = [];
+
+		if(!$scope.newPolicy) {
+			$scope.publisherList = Entity.queryMetadata("policies/" + encodeURIComponent($scope.policy.name) + "/publishments");
+		}
+
+		$scope.addPublisher = function () {
+			var publisherProps = {};
+			$.each($scope.publisherTypes[$scope.publisherType], function (i, field) {
+				publisherProps[field] = $scope.publisherProps[field] || "";
+			});
+			$scope.publisherList.push({
+				name: $scope.publisher.name,
+				type: $scope.publisherType,
+				policyIds: [$scope.policy.name],
+				properties: publisherProps,
+				dedupIntervalMin: $scope.publisher.dedupIntervalMin,
+				serializer : "org.apache.eagle.alert.engine.publisher.impl.StringEventSerializer"
+			});
+			$scope.publisher = {
+				dedupIntervalMin: "PT1M"
+			};
+			$scope.publisherProps = {};
+		};
+
+		$scope.removePublisher = function (publisher) {
+			$scope.publisherList = common.array.remove(publisher, $scope.publisherList);
+		};
+
+		$scope.checkAddPublisher = function () {
+			return $scope.publisher.name &&
+				!common.array.find($scope.publisher.name, $scope.publisherList, "name");
+		};
+
+		// =========================================================
+		// =                         Policy                        =
+		// =========================================================
+		$scope.createPolicy = function () {
+			// TODO: Need check the policy or publisher exist.
+
+			$scope.policyLock = true;
+
+			var policyPromise = Entity.create("metadata/policies", $scope.policy)._promise;
+			var publisherPromiseList = $.map($scope.publisherList, function (publisher) {
+				return Entity.create("metadata/publishments", publisher)._promise;
+			});
+			common.deferred.all(publisherPromiseList.concat(policyPromise)).then(function () {
+				$.dialog({
+					title: "Create Success",
+					content: "Create Success. Click confirm to go to the policy detail page."
+				});
+			}, function (failedList) {
+				$.dialog({
+					title: "Create Failed",
+					content: $("<pre>").text(JSON.stringify(failedList, null, "\t"))
+				});
+				$scope.policyLock = false;
+			});
+		};
+	}
+})();

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4e5641c3/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
index a807520..eb463ba 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
@@ -147,7 +147,8 @@
 			});
 
 			UI.fieldConfirm({
-				title: "Install '" + application.type + "'"
+				title: "Install '" + application.type + "'",
+				addable: true
 			}, null, fields)(function (entity, closeFunc, unlock) {
 				Entity.create("apps/install", {
 					siteId: $scope.site.siteId,
@@ -196,6 +197,9 @@
 	// =                                     Application                                    =
 	// ======================================================================================
 	eagleControllers.controller('integrationApplicationListCtrl', function ($sce, $scope, $wrapState, PageConfig, Application) {
+		PageConfig.title = "Integration";
+		PageConfig.subTitle = "Applications";
+
 		$scope.showAppDetail = function(application) {
 			var docs = application.docs || {install: "", uninstall: ""};
 			$scope.application = application;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4e5641c3/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js b/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js
index 61c244d..8700f27 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js
@@ -119,7 +119,13 @@
 
 		// TODO: metadata will be removed
 		Entity.queryMetadata = function (url) {
-			return Entity.query('metadata/' +  url);
+			var metaList = Entity.query('metadata/' +  url);
+			metaList._then(function (res) {
+				metaList.splice(0);
+				Array.prototype.push.apply(metaList, res.data);
+			});
+
+			return metaList;
 		};
 
 		Entity.deleteMetadata = function (url) {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4e5641c3/eagle-server/src/main/webapp/app/dev/public/js/services/uiSrv.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/services/uiSrv.js b/eagle-server/src/main/webapp/app/dev/public/js/services/uiSrv.js
index b4a1a42..e0bb77d 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/services/uiSrv.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/services/uiSrv.js
@@ -62,7 +62,7 @@
 			$scope = $rootScope.$new(true);
 			$scope.name = name;
 			$scope.entity = _entity;
-			$scope.fieldList = fieldList;
+			$scope.fieldList = fieldList.concat();
 			$scope.checkFunc = checkFunc;
 			$scope.lock = false;
 			$scope.create = create;
@@ -112,6 +112,35 @@
 				});
 			};
 
+			$scope.newField = function () {
+				UI.fieldConfirm({
+					title: "New Field"
+				}, null, [{
+					field: "field",
+					name: "Field Name"
+				}])(function (entity, closeFunc, unlock) {
+					if(common.array.find(entity.field, $scope.fieldList, "field")) {
+						$.dialog({
+							title: "OPS",
+							content: "Field already exist!"
+						});
+
+						unlock();
+					} else {
+						$scope.fieldList.push({
+							field: entity.field,
+							_customize: true
+						});
+
+						closeFunc();
+					}
+				});
+			};
+
+			$scope.removeField = function (field) {
+				$scope.fieldList = common.array.remove(field, $scope.fieldList);
+			};
+
 			$scope.confirm = function() {
 				$scope.lock = true;
 				_deferred.notify({
@@ -155,6 +184,7 @@
 		 * @param {object} config						- Configuration object
 		 * @param {string} config.title						- Title of dialog box
 		 * @param {string=} config.size						- "large". Set dialog size
+		 * @param {boolean=} config.addable					- Set add customize field
 		 * @param {boolean=} config.confirm					- Display or not confirm button
 		 * @param {string=} config.confirmDesc				- Confirm button display description
 		 * @param {object} entity						- bind entity
@@ -225,30 +255,32 @@
 		'<div class="modal-dialog" ng-class="{\'modal-lg\': config.size === \'large\'}" role="document">' +
 		'<div class="modal-content">' +
 		'<div class="modal-header">' +
-		'<button type="button" class="close" data-dismiss="modal" aria-label="Close">' +
-		'<span aria-hidden="true">&times;</span>' +
-		'</button>' +
-		'<h4 class="modal-title">{{config.title || (create ? "New" : "Update") + " " + name}}</h4>' +
+			'<button type="button" class="close" data-dismiss="modal" aria-label="Close">' +
+				'<span aria-hidden="true">&times;</span>' +
+			'</button>' +
+			'<h4 class="modal-title">{{config.title || (create ? "New" : "Update") + " " + name}}</h4>' +
 		'</div>' +
 		'<div class="modal-body">' +
-		'<div class="form-group" ng-repeat="field in fieldList" ng-switch="field.type">' +
-		'<label for="featureName">' +
-		'<span ng-if="!field.optional">*</span> ' +
-		'{{field.name || field.field}}' +
-		'</label>' +
-		'<textarea class="form-control" placeholder="{{getFieldDescription(field)}}" ng-model="entity[field.field]" rows="{{ field.rows || 10 }}" ng-readonly="field.readonly" ng-disabled="lock" ng-switch-when="blob"></textarea>' +
-		'<select class="form-control" ng-model="entity[field.field]" ng-init="entity[field.field] = entity[field.field] || field.valueList[0]" ng-switch-when="select">' +
-		'<option ng-repeat="value in field.valueList">{{value}}</option>' +
-		'</select>' +
-		'<input type="text" class="form-control" placeholder="{{getFieldDescription(field)}}" ng-model="entity[field.field]" ng-readonly="field.readonly" ng-disabled="lock" ng-switch-default>' +
-		'</div>' +
+			'<div class="form-group" ng-repeat="field in fieldList" ng-switch="field.type">' +
+				'<label for="featureName">' +
+					'<span ng-if="!field.optional && !field._customize">*</span> ' +
+					'<a ng-if="field._customize" class="fa fa-times" ng-click="removeField(field)"></a> ' +
+					'{{field.name || field.field}}' +
+				'</label>' +
+				'<textarea class="form-control" placeholder="{{getFieldDescription(field)}}" ng-model="entity[field.field]" rows="{{ field.rows || 10 }}" ng-readonly="field.readonly" ng-disabled="lock" ng-switch-when="blob"></textarea>' +
+				'<select class="form-control" ng-model="entity[field.field]" ng-init="entity[field.field] = entity[field.field] || field.valueList[0]" ng-switch-when="select">' +
+				'<option ng-repeat="value in field.valueList">{{value}}</option>' +
+				'</select>' +
+				'<input type="text" class="form-control" placeholder="{{getFieldDescription(field)}}" ng-model="entity[field.field]" ng-readonly="field.readonly" ng-disabled="lock" ng-switch-default>' +
+			'</div>' +
+			'<a ng-if="config.addable" ng-click="newField()">+ New field</a>' +
 		'</div>' +
 		'<div class="modal-footer">' +
-		'<p class="pull-left text-danger">{{checkFunc(entity)}}</p>' +
-		'<button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="lock">Close</button>' +
-		'<button type="button" class="btn btn-primary confirmBtn" ng-click="confirm()" ng-disabled="checkFunc(entity) || emptyFieldList().length || lock" ng-if="config.confirm !== false">' +
-		'{{config.confirmDesc || (create ? "Create" : "Update")}}' +
-		'</button>' +
+			'<p class="pull-left text-danger">{{checkFunc(entity)}}</p>' +
+			'<button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="lock">Close</button>' +
+			'<button type="button" class="btn btn-primary confirmBtn" ng-click="confirm()" ng-disabled="checkFunc(entity) || emptyFieldList().length || lock" ng-if="config.confirm !== false">' +
+				'{{config.confirmDesc || (create ? "Create" : "Update")}}' +
+			'</button>' +
 		'</div>' +
 		'</div>' +
 		'</div>' +

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4e5641c3/eagle-server/src/main/webapp/app/package.json
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/package.json b/eagle-server/src/main/webapp/app/package.json
index f5b43bb..0bf2968 100644
--- a/eagle-server/src/main/webapp/app/package.json
+++ b/eagle-server/src/main/webapp/app/package.json
@@ -23,7 +23,7 @@
     "bootstrap": "3.3.6",
     "d3": "3.5.16",
     "echarts": "^3.2.3",
-    "font-awesome": "4.5.0",
+    "font-awesome": "4.6.3",
     "jquery": "2.2.4",
     "jquery-slimscroll": "1.3.6",
     "jsdom": "^9.5.0",


[33/50] incubator-eagle git commit: [EAGLE-562] added metrics associated with virtual-cores involved since hadoop 2.7.x

Posted by ha...@apache.org.
[EAGLE-562] added metrics associated with virtual-cores involved since hadoop 2.7.x

add 4 virtual-cores related metrics involved since hadoop 2.7.x to ClusterMetrics
   - totalVirtualCores, reservedVirtualCores, availableVirtualCores, allocatedVirtualCores
   - in this commit, only totalVirtualCores is included to be listened

Author: anyway1021 <mw...@apache.org>

Closes #494 from anyway1021/EAGLE-562.


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

Branch: refs/heads/master
Commit: 1a74b09b714412d023c99c4fbf6498cc16984657
Parents: 7279ee7
Author: anyway1021 <mw...@apache.org>
Authored: Sat Oct 15 13:28:52 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Sat Oct 15 13:28:52 2016 +0800

----------------------------------------------------------------------
 .../queue/common/HadoopClusterConstants.java    |  1 +
 .../crawler/ClusterMetricsParseListener.java    |  1 +
 .../queue/model/cluster/ClusterMetrics.java     | 41 ++++++++++++++++++++
 3 files changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1a74b09b/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/common/HadoopClusterConstants.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/common/HadoopClusterConstants.java b/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/common/HadoopClusterConstants.java
index 9318a35..c924455 100644
--- a/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/common/HadoopClusterConstants.java
+++ b/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/common/HadoopClusterConstants.java
@@ -44,6 +44,7 @@ public class HadoopClusterConstants {
         public static final String HADOOP_CLUSTER_TOTAL_MEMORY = "hadoop.cluster.totalmemory";
         public static final String HADOOP_CLUSTER_AVAILABLE_MEMORY = "hadoop.cluster.availablememory";
         public static final String HADOOP_CLUSTER_RESERVED_MEMORY = "hadoop.cluster.reservedmemory";
+        public static final String HADOOP_CLUSTER_TOTAL_VIRTUAL_CORES = "hadoop.cluster.totalvirtualcores";
 
         // metrics from scheduler info
         public static final String HADOOP_CLUSTER_CAPACITY = "hadoop.cluster.capacity";

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1a74b09b/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/crawler/ClusterMetricsParseListener.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/crawler/ClusterMetricsParseListener.java b/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/crawler/ClusterMetricsParseListener.java
index de93d1e..ed78465 100644
--- a/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/crawler/ClusterMetricsParseListener.java
+++ b/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/crawler/ClusterMetricsParseListener.java
@@ -83,6 +83,7 @@ public class ClusterMetricsParseListener {
         createMetric(MetricName.HADOOP_CLUSTER_TOTAL_MEMORY, currentTimestamp, metrics.getTotalMB(), AggregateFunc.MAX);
         createMetric(MetricName.HADOOP_CLUSTER_AVAILABLE_MEMORY, currentTimestamp, metrics.getAvailableMB(), AggregateFunc.AVG);
         createMetric(MetricName.HADOOP_CLUSTER_RESERVED_MEMORY, currentTimestamp, metrics.getReservedMB(), AggregateFunc.AVG);
+        createMetric(MetricName.HADOOP_CLUSTER_TOTAL_VIRTUAL_CORES, currentTimestamp, metrics.getTotalVirtualCores(), AggregateFunc.MAX);
     }
 
     public void flush() {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1a74b09b/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/model/cluster/ClusterMetrics.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/model/cluster/ClusterMetrics.java b/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/model/cluster/ClusterMetrics.java
index 8bf8917..aca67dc 100644
--- a/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/model/cluster/ClusterMetrics.java
+++ b/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/model/cluster/ClusterMetrics.java
@@ -44,6 +44,15 @@ public class ClusterMetrics {
     private int rebootedNodes;
     private int activeNodes;
 
+    // available in hadoop 2.7.x or higher
+    private long totalVirtualCores;
+    // available in hadoop 2.7.x or higher
+    private long reservedVirtualCores;
+    // available in hadoop 2.7.x or higher
+    private long availableVirtualCores;
+    // available in hadoop 2.7.x or higher
+    private long allocatedVirtualCores;
+
     public int getAppsSubmitted() {
         return appsSubmitted;
     }
@@ -195,4 +204,36 @@ public class ClusterMetrics {
     public void setActiveNodes(int activeNodes) {
         this.activeNodes = activeNodes;
     }
+
+    public long getTotalVirtualCores() {
+        return totalVirtualCores;
+    }
+
+    public void setTotalVirtualCores(long totalVirtualCores) {
+        this.totalVirtualCores = totalVirtualCores;
+    }
+
+    public long getReservedVirtualCores() {
+        return reservedVirtualCores;
+    }
+
+    public void setReservedVirtualCores(long reservedVirtualCores) {
+        this.reservedVirtualCores = reservedVirtualCores;
+    }
+
+    public long getAvailableVirtualCores() {
+        return availableVirtualCores;
+    }
+
+    public void setAvailableVirtualCores(long availableVirtualCores) {
+        this.availableVirtualCores = availableVirtualCores;
+    }
+
+    public long getAllocatedVirtualCores() {
+        return allocatedVirtualCores;
+    }
+
+    public void setAllocatedVirtualCores(long allocatedVirtualCores) {
+        this.allocatedVirtualCores = allocatedVirtualCores;
+    }
 }


[02/50] incubator-eagle git commit: [EAGLE-600] Make AlertUnitTopologyApp compatible with both appId and topology.name

Posted by ha...@apache.org.
[EAGLE-600] Make AlertUnitTopologyApp compatible with both appId and topology.name

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

Make sure AlertUnitTopologyApp compatible with both "appId" and "topology.name"

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

Closes #484 from haoch/EAGLE-600.


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

Branch: refs/heads/master
Commit: d9b82b45daa3adb678fff7138855bd07a241afb6
Parents: 0277ff7
Author: Hao Chen <ha...@apache.org>
Authored: Mon Oct 10 17:15:28 2016 +0800
Committer: Zhao, Qingwen <qi...@ebay.com>
Committed: Mon Oct 10 17:15:28 2016 +0800

----------------------------------------------------------------------
 .../eagle/alert/app/AlertUnitTopologyApp.java   |  3 +-
 .../eagle/alert/engine/UnitTopologyMain.java    | 21 +++++--
 .../environment/impl/StormExecutionRuntime.java | 11 ++--
 .../app/utils/ApplicationExecutionConfig.java   | 66 ++++++++++++++++++++
 eagle-server/pom.xml                            |  4 ++
 5 files changed, 93 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d9b82b45/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/java/org/apache/eagle/alert/app/AlertUnitTopologyApp.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/java/org/apache/eagle/alert/app/AlertUnitTopologyApp.java b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/java/org/apache/eagle/alert/app/AlertUnitTopologyApp.java
index 63e92ff..a122c08 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/java/org/apache/eagle/alert/app/AlertUnitTopologyApp.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert-app/src/main/java/org/apache/eagle/alert/app/AlertUnitTopologyApp.java
@@ -34,8 +34,7 @@ public class AlertUnitTopologyApp extends StormApplication {
     }
 
     public static void main(String[] args) {
-        Config config = ConfigFactory.load();
         AlertUnitTopologyApp app = new AlertUnitTopologyApp();
-        app.run(config);
+        app.run(args);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d9b82b45/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/UnitTopologyMain.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/UnitTopologyMain.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/UnitTopologyMain.java
index 497d908..01b16b8 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/UnitTopologyMain.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/UnitTopologyMain.java
@@ -62,14 +62,14 @@ public class UnitTopologyMain {
         Config config = ConfigFactory.load();
 
         // load config and start
-        String topologyId = config.getString("topology.name");
+        String topologyId = getTopologyName(config);
         ZKMetadataChangeNotifyService changeNotifyService = createZKNotifyService(config, topologyId);
         new UnitTopologyRunner(changeNotifyService).run(topologyId, config);
     }
 
     public static void runTopology(Config config, backtype.storm.Config stormConfig) {
         // load config and start
-        String topologyId = config.getString("topology.name");
+        String topologyId = getTopologyName(config);
         ZKMetadataChangeNotifyService changeNotifyService = createZKNotifyService(config, topologyId);
         new UnitTopologyRunner(changeNotifyService, stormConfig).run(topologyId, config);
     }
@@ -81,9 +81,22 @@ public class UnitTopologyMain {
     }
 
     public static StormTopology createTopology(Config config) {
-        String topologyId = config.getString("topology.name");
+        String topologyId = getTopologyName(config);
         ZKMetadataChangeNotifyService changeNotifyService = createZKNotifyService(config, topologyId);
 
         return new UnitTopologyRunner(changeNotifyService).buildTopology(topologyId, config);
     }
-}
+
+    /**
+     * Try to get topology name from app framework .e.g "appId" or "topology.name"
+     */
+    private static String getTopologyName(Config config) {
+        if (config.hasPath("topology.name")) {
+            return config.getString("topology.name");
+        } else if (config.hasPath("appId")) {
+            return config.getString("appId");
+        } else {
+            throw new IllegalStateException("Not topology.name or appId provided from config: " + config.toString());
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d9b82b45/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
index 5f74d01..9821660 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
@@ -16,17 +16,16 @@
  */
 package org.apache.eagle.app.environment.impl;
 
-import backtype.storm.utils.Utils;
-import org.apache.eagle.app.Application;
-import org.apache.eagle.app.environment.ExecutionRuntime;
-import org.apache.eagle.app.environment.ExecutionRuntimeProvider;
-import org.apache.eagle.app.utils.DynamicJarPathFinder;
-import org.apache.eagle.metadata.model.ApplicationEntity;
 import backtype.storm.Config;
 import backtype.storm.LocalCluster;
 import backtype.storm.generated.*;
 import backtype.storm.utils.NimbusClient;
 import com.google.common.base.Preconditions;
+import org.apache.eagle.app.Application;
+import org.apache.eagle.app.environment.ExecutionRuntime;
+import org.apache.eagle.app.environment.ExecutionRuntimeProvider;
+import org.apache.eagle.app.utils.DynamicJarPathFinder;
+import org.apache.eagle.metadata.model.ApplicationEntity;
 import org.apache.thrift7.TException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d9b82b45/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/utils/ApplicationExecutionConfig.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/utils/ApplicationExecutionConfig.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/utils/ApplicationExecutionConfig.java
new file mode 100644
index 0000000..73199fe
--- /dev/null
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/utils/ApplicationExecutionConfig.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.utils;
+
+import com.typesafe.config.Config;
+import org.apache.eagle.metadata.model.ApplicationEntity;
+
+/**
+ * Application Execution Must-have base configuration.
+ */
+public class ApplicationExecutionConfig {
+    public static final String APP_ID_KEY = "appId";
+    public static final String MODE_KEY = "mode";
+    public static final String SITE_ID_KEY = "siteId";
+    public static final String JAR_PATH_KEY = "jarPath";
+
+    private final String siteId;
+    private final String mode;
+    private final String appId;
+    private final String jarPath;
+
+    public ApplicationExecutionConfig(ApplicationEntity metadata) {
+        this.siteId = metadata.getSite().getSiteId();
+        this.mode = metadata.getMode().name();
+        this.appId = metadata.getAppId();
+        this.jarPath = metadata.getJarPath();
+    }
+
+    public ApplicationExecutionConfig(Config config) {
+        this.siteId = config.getString(SITE_ID_KEY);
+        this.mode = config.getString(MODE_KEY);
+        this.appId = config.getString(APP_ID_KEY);
+        this.jarPath = config.getString(JAR_PATH_KEY);
+    }
+
+    public String getJarPath() {
+        return jarPath;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public String getMode() {
+        return mode;
+    }
+
+    public String getSiteId() {
+        return siteId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d9b82b45/eagle-server/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-server/pom.xml b/eagle-server/pom.xml
index aa190e4..21bda30 100644
--- a/eagle-server/pom.xml
+++ b/eagle-server/pom.xml
@@ -96,6 +96,10 @@
                     <groupId>org.slf4j</groupId>
                     <artifactId>slf4j-log4j12</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.wso2.orbit.com.lmax</groupId>
+                    <artifactId>disruptor</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
         <dependency>


[14/50] incubator-eagle git commit: [EAGLE-613] Support modify ApplicationEntity through POST /rest/apps/{UUID}/

Posted by ha...@apache.org.
[EAGLE-613] Support modify ApplicationEntity through POST /rest/apps/{UUID}/

Support modify ApplicationEntity through
~~~
POST /rest/apps/{UUID}/
~~~

* REQUEST BODY* (UpdateOperation)
~~~
{
    "configuration": {
        "spout.stormKafkaUseSameZkQuorumWithKafkaBroker": "true",
        "metadataService.port": "9090",
        "spout.stormKafkaEagleConsumer": "eagle_consumer",
        "topology.numOfSpoutTasks": "1",
        "jarPath": "incubator-eagle/eagle-core/eagle-alert-parent/eagle-alert-app/target/classes/org/apache/eagle/alert/app/AlertUnitTopologyApp.class",
        "topology.numOfRouterBolts": "4",
        "topology.numOfAlertBolts": "10",
        "zkConfig.zkRoot": "/alert",
        "zkConfig.zkQuorum": "localhost:2181",
        "mode": "LOCAL",
        "metadataService.context": "/rest",
        "metadataService.host": "localhost",
        "topology.messageTimeoutSecs": "3600",
        "spout.kafkaBrokerZkQuorum": "localhost:2181",
        "appId": "ALERTUNITTOPOLOGYAPP_SANDBOX",
        "topology.numOfTotalWorkers": "2",
        "siteId": "sandbox",
        "topology.numOfPublishTasks": "1",
        "spout.stormKafkaTransactionZkPath": "/consumers",
        "spout.kafkaBrokerZkBasePath": "/brokers"
    },
    "mode": "CLUSTER",
    "jarPath": "incubator-eagle/eagle-core/eagle-alert-parent/eagle-alert-app/target/classes/org/apache/eagle/alert/app/AlertUnitTopologyApp.class"
}
~~~

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

Closes #495 from haoch/EAGLE-613.


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

Branch: refs/heads/master
Commit: 6823410fc85fe13d9295125d9093754d38e4f0ac
Parents: 279bc01
Author: Hao Chen <ha...@apache.org>
Authored: Wed Oct 12 18:01:08 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Wed Oct 12 18:01:08 2016 +0800

----------------------------------------------------------------------
 .../eagle/app/resource/ApplicationResource.java | 14 ++++++++
 .../app/service/ApplicationOperations.java      | 35 ++++++++++++++++++++
 .../eagle/metadata/model/ApplicationEntity.java | 11 ++++++
 .../service/ApplicationEntityService.java       |  1 +
 .../ApplicationEntityServiceMemoryImpl.java     |  9 +++++
 .../ApplicationEntityServiceJDBCImpl.java       |  9 ++++-
 6 files changed, 78 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6823410f/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/resource/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/resource/ApplicationResource.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/resource/ApplicationResource.java
index 717f7c0..b493b2b 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/resource/ApplicationResource.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/resource/ApplicationResource.java
@@ -91,6 +91,20 @@ public class ApplicationResource {
     }
 
     @POST
+    @Path("/{appUuid}")
+    @Produces(MediaType.APPLICATION_JSON)
+    public RESTResponse<ApplicationEntity> updateApplicationEntity(@PathParam("appUuid") String appUuid, ApplicationOperations.UpdateOperation updateOperation) {
+        return RESTResponse.async(() -> {
+            ApplicationEntity applicationEntity = new ApplicationEntity();
+            applicationEntity.setUuid(appUuid);
+            applicationEntity.setJarPath(updateOperation.getJarPath());
+            applicationEntity.setMode(updateOperation.getMode());
+            applicationEntity.setConfiguration(updateOperation.getConfiguration());
+            return entityService.update(applicationEntity);
+        }).get();
+    }
+
+    @POST
     @Path("/status")
     @Consumes(MediaType.APPLICATION_JSON)
     @Produces(MediaType.APPLICATION_JSON)

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6823410f/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationOperations.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationOperations.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationOperations.java
index 36c08b8..52e25be 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationOperations.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationOperations.java
@@ -113,6 +113,41 @@ public final class ApplicationOperations {
         }
     }
 
+    public static class UpdateOperation implements Operation {
+        private ApplicationEntity.Mode mode = ApplicationEntity.Mode.LOCAL;
+        private String jarPath;
+        private Map<String, Object> configuration;
+
+        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 String getJarPath() {
+            return jarPath;
+        }
+
+        public void setJarPath(String jarPath) {
+            this.jarPath = jarPath;
+        }
+
+        @Override
+        public String getType() {
+            return INSTALL;
+        }
+    }
+
     public static class UninstallOperation implements Operation {
         private String uuid;
         private String appId;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6823410f/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
index c6d01f4..952b5a8 100644
--- 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
@@ -180,6 +180,17 @@ public class ApplicationEntity extends PersistenceEntity {
         }
     }
 
+    /**
+     * Update mutable fields from another ApplicationEntity
+     */
+    public void updateMutable(ApplicationEntity entityToUpdate){
+        this.ensureDefault();
+
+        this.setJarPath(entityToUpdate.getJarPath());
+        this.setMode(entityToUpdate.getMode());
+        this.setConfiguration(entityToUpdate.getConfiguration());
+    }
+
     public static enum Mode {
         LOCAL("LOCAL"),
         CLUSTER("CLUSTER");

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6823410f/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
index 9e05f9b..69dc921 100644
--- 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
@@ -27,4 +27,5 @@ public interface ApplicationEntityService extends PersistenceService<Application
     ApplicationEntity getBySiteIdAndAppType(String siteId,String appType);
     ApplicationEntity getByUUIDOrAppId(String uuid,String appId);
     ApplicationEntity delete(ApplicationEntity applicationEntity);
+    ApplicationEntity update(ApplicationEntity entity);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6823410f/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
index c6c2b31..9151ba2 100644
--- 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
@@ -16,6 +16,7 @@
  */
 package org.apache.eagle.metadata.service.memory;
 
+import com.google.common.base.Preconditions;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
 import org.apache.eagle.metadata.model.ApplicationEntity;
@@ -102,4 +103,12 @@ public class ApplicationEntityServiceMemoryImpl implements ApplicationEntityServ
         ApplicationEntity entity = getByUUIDOrAppId(applicationEntity.getUuid(), applicationEntity.getAppId());
         return applicationEntityMap.remove(entity.getUuid());
     }
+
+    @Override
+    public ApplicationEntity update(ApplicationEntity entity) {
+        Preconditions.checkNotNull(entity.getUuid(),"UUID");
+        ApplicationEntity origin = getByUUID(entity.getUuid());
+        origin.updateMutable(entity);
+        return origin;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6823410f/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/ApplicationEntityServiceJDBCImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/ApplicationEntityServiceJDBCImpl.java b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/ApplicationEntityServiceJDBCImpl.java
index 8dbc446..20932b1 100644
--- a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/ApplicationEntityServiceJDBCImpl.java
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/jdbc/service/ApplicationEntityServiceJDBCImpl.java
@@ -116,6 +116,14 @@ public class ApplicationEntityServiceJDBCImpl implements ApplicationEntityServic
         return entity;
     }
 
+    /**
+     * TODO: UPDATE ApplicationEntity through JDBC is not supported yet
+     */
+    @Override
+    public ApplicationEntity update(ApplicationEntity entity) {
+        throw new UnsupportedOperationException("UPDATE ApplicationEntity through JDBC is not supported yet");
+    }
+
     @Override
     public Collection<ApplicationEntity> findAll() {
         List<ApplicationEntity> results = new ArrayList<>();
@@ -144,7 +152,6 @@ public class ApplicationEntityServiceJDBCImpl implements ApplicationEntityServic
 
     @Override
     public ApplicationEntity create(ApplicationEntity entity) {
-
         entity.ensureDefault();
         if (getBySiteIdAndAppType(entity.getSite().getSiteId(), entity.getDescriptor().getType()) != null) {
             throw new IllegalArgumentException("Duplicated appId: " + entity.getAppId());


[16/50] incubator-eagle git commit: EAGLE-602: Exception that Spec Version [xxx] of AlertBolt is newer than Stream Event Version [null]

Posted by ha...@apache.org.
EAGLE-602: Exception that Spec Version [xxx] of AlertBolt is newer than Stream Event Version [null]

Auhtor: Zeng, Bryant
Reviewer: ralphsu

This closes #486


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

Branch: refs/heads/master
Commit: 74c3cbb5b1653974870e805b717987eb75e5113d
Parents: 3301c9d
Author: mizeng <mi...@ebaysf.com>
Authored: Mon Oct 10 17:58:54 2016 +0800
Committer: Ralph, Su <su...@gmail.com>
Committed: Thu Oct 13 15:26:19 2016 +0800

----------------------------------------------------------------------
 .../org/apache/eagle/alert/engine/runner/AlertBolt.java  | 11 ++++++-----
 .../engine/serialization/impl/StreamEventSerializer.java |  6 ++++++
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/74c3cbb5/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
index f437d43..fbee580 100755
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
@@ -107,11 +107,12 @@ public class AlertBolt extends AbstractStreamBolt implements AlertBoltSpecListen
         try {
             PartitionedEvent pe = deserialize(input.getValueByField(AlertConstants.FIELD_0));
             String streamEventVersion = pe.getEvent().getMetaVersion();
-            if (streamEventVersion != null && !streamEventVersion.equals(specVersion)) {
-                if (streamEventVersion == null) {
-                    // if stream event version is null, need to initialize it
-                    pe.getEvent().setMetaVersion(specVersion);
-                } else if (specVersion != null && streamEventVersion != null
+
+            if (streamEventVersion == null) {
+                // if stream event version is null, need to initialize it
+                pe.getEvent().setMetaVersion(specVersion);
+            } else if (streamEventVersion != null && !streamEventVersion.equals(specVersion)) {
+                if (specVersion != null && streamEventVersion != null
                     && specVersion.contains("spec_version_") && streamEventVersion.contains("spec_version_")) {
                     // check if specVersion is older than stream_event_version
                     // Long timestamp_of_specVersion = Long.valueOf(specVersion.split("spec_version_")[1]);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/74c3cbb5/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/StreamEventSerializer.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/StreamEventSerializer.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/StreamEventSerializer.java
index d7119db..8ffcb83 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/StreamEventSerializer.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/impl/StreamEventSerializer.java
@@ -89,6 +89,12 @@ public class StreamEventSerializer implements Serializer<StreamEvent> {
         String metaVersionStreamId = dataInput.readUTF();
         String streamId = metaVersionStreamId.split("/")[1];
         String metaVersion = metaVersionStreamId.split("/")[0];
+        // sometimes metaVersionStreamId will be "null/id", then metaVersion will be "null" rather than null
+        // need to handle it for future use
+        if (metaVersion.equals("null")) {
+            metaVersion = null;
+        }
+
         event.setStreamId(streamId);
         event.setMetaVersion(metaVersion);
 


[38/50] incubator-eagle git commit: [EAGLE-627] Add PolicyValidator and Validation API

Posted by ha...@apache.org.
[EAGLE-627] Add PolicyValidator and Validation API

 Add Policy PolicyValidator and Validation API on `POST /metadata/policies/validate`

* Validate SiddhiQL syntax problem
* Provide Internal information like:
    * Validate syntax is ok
    * Explain details like inputStreams and outputStreams

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

Closes #515 from haoch/EAGLE-627.


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

Branch: refs/heads/master
Commit: a6bc0a52413db0dbc56060c7b6c25230422b7153
Parents: e8a7389
Author: Hao Chen <ha...@apache.org>
Authored: Mon Oct 17 11:35:49 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Mon Oct 17 11:35:49 2016 +0800

----------------------------------------------------------------------
 .../StreamDefinitionNotFoundException.java      |  38 ----
 .../coordinator/StreamNotDefinedException.java  |  38 ++++
 .../evaluator/impl/SiddhiDefinitionAdapter.java |  23 +++
 .../evaluator/impl/SiddhiPolicyHandler.java     |  24 +--
 .../impl/SiddhiPolicyStateHandler.java          |   4 +-
 .../alert/engine/runner/AbstractStreamBolt.java |   6 +-
 .../SerializationMetadataProvider.java          |   4 +-
 .../engine/mock/MockSampleMetadataFactory.java  |   4 +-
 .../engine/mock/MockStreamMetadataService.java  |   6 +-
 .../TestDistinctValuesInTimeBatchWindow.java    |   3 +-
 .../metadata/resource/MetadataResource.java     |   6 +
 .../metadata/resource/PolicyValidation.java     |  97 ++++++++++
 .../metadata/resource/PolicyValidator.java      | 124 ++++++++++++
 .../metadata/resource/PolicyValidatorTest.java  | 187 +++++++++++++++++++
 14 files changed, 492 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a6bc0a52/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamDefinitionNotFoundException.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamDefinitionNotFoundException.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamDefinitionNotFoundException.java
deleted file mode 100644
index 8c493f5..0000000
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamDefinitionNotFoundException.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
- * <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.alert.engine.coordinator;
-
-import java.io.IOException;
-
-public class StreamDefinitionNotFoundException extends IOException {
-    private static final long serialVersionUID = 6027811718016485808L;
-
-    public StreamDefinitionNotFoundException() {
-    }
-
-    public StreamDefinitionNotFoundException(String streamId) {
-        super("Stream definition not found: " + streamId);
-    }
-
-    public StreamDefinitionNotFoundException(String streamName, String specVersion) {
-        super(String.format("Stream '%s' not found! Current spec version '%s'. Possibly metadata not loaded or metadata mismatch between upstream and alert bolts yet!", streamName, specVersion));
-    }
-
-    public StreamDefinitionNotFoundException(String streamName, String streamMetaVersion, String specVersion) {
-        super(String.format("Stream '%s' has meta version '%s' which is different from current spec version '%s'.", streamName, streamMetaVersion, specVersion));
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a6bc0a52/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamNotDefinedException.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamNotDefinedException.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamNotDefinedException.java
new file mode 100644
index 0000000..e44c630
--- /dev/null
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/coordinator/StreamNotDefinedException.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.alert.engine.coordinator;
+
+import java.io.IOException;
+
+public class StreamNotDefinedException extends IOException {
+    private static final long serialVersionUID = 6027811718016485808L;
+
+    public StreamNotDefinedException() {
+    }
+
+    public StreamNotDefinedException(String streamId) {
+        super("Stream definition not found: " + streamId);
+    }
+
+    public StreamNotDefinedException(String streamName, String specVersion) {
+        super(String.format("Stream '%s' not found! Current spec version '%s'. Possibly metadata not loaded or metadata mismatch between upstream and alert bolts yet!", streamName, specVersion));
+    }
+
+    public StreamNotDefinedException(String streamName, String streamMetaVersion, String specVersion) {
+        super(String.format("Stream '%s' has meta version '%s' which is different from current spec version '%s'.", streamName, streamMetaVersion, specVersion));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a6bc0a52/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiDefinitionAdapter.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiDefinitionAdapter.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiDefinitionAdapter.java
index 9b9fcac..3645dcf 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiDefinitionAdapter.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiDefinitionAdapter.java
@@ -16,6 +16,7 @@
  */
 package org.apache.eagle.alert.engine.evaluator.impl;
 
+import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
 import org.apache.eagle.alert.engine.coordinator.StreamColumn;
 import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
 import com.google.common.base.Preconditions;
@@ -79,6 +80,28 @@ public class SiddhiDefinitionAdapter {
         throw new IllegalArgumentException("Unknown siddhi type: " + type);
     }
 
+    public static String buildSiddhiExecutionPlan(PolicyDefinition policyDefinition, Map<String, StreamDefinition> sds) {
+        StringBuilder builder = new StringBuilder();
+        PolicyDefinition.Definition coreDefinition = policyDefinition.getDefinition();
+        // init if not present
+        if (coreDefinition.getInputStreams() == null || coreDefinition.getInputStreams().isEmpty()) {
+            coreDefinition.setInputStreams(policyDefinition.getInputStreams());
+        }
+        if (coreDefinition.getOutputStreams() == null || coreDefinition.getOutputStreams().isEmpty()) {
+            coreDefinition.setOutputStreams(policyDefinition.getOutputStreams());
+        }
+
+        for (String inputStream : coreDefinition.getInputStreams()) {
+            builder.append(SiddhiDefinitionAdapter.buildStreamDefinition(sds.get(inputStream)));
+            builder.append("\n");
+        }
+        builder.append(coreDefinition.value);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Generated siddhi execution plan: {} from definition: {}", builder.toString(), coreDefinition);
+        }
+        return builder.toString();
+    }
+
     /**
      * public enum Type {
      * STRING, INT, LONG, FLOAT, DOUBLE, BOOL, OBJECT

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a6bc0a52/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiPolicyHandler.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiPolicyHandler.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiPolicyHandler.java
index e7ed56f..c668935 100755
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiPolicyHandler.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiPolicyHandler.java
@@ -19,7 +19,7 @@ package org.apache.eagle.alert.engine.evaluator.impl;
 import org.apache.eagle.alert.engine.Collector;
 import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
 import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import org.apache.eagle.alert.engine.coordinator.StreamDefinitionNotFoundException;
+import org.apache.eagle.alert.engine.coordinator.StreamNotDefinedException;
 import org.apache.eagle.alert.engine.evaluator.PolicyHandlerContext;
 import org.apache.eagle.alert.engine.evaluator.PolicyStreamHandler;
 import org.apache.eagle.alert.engine.model.AlertStreamEvent;
@@ -48,26 +48,8 @@ public class SiddhiPolicyHandler implements PolicyStreamHandler {
         this.currentIndex = index;
     }
 
-    protected String generateExecutionPlan(PolicyDefinition policyDefinition, Map<String, StreamDefinition> sds) throws StreamDefinitionNotFoundException {
-        StringBuilder builder = new StringBuilder();
-        PolicyDefinition.Definition coreDefinition = policyDefinition.getDefinition();
-        // init if not present
-        if (coreDefinition.getInputStreams() == null || coreDefinition.getInputStreams().isEmpty()) {
-            coreDefinition.setInputStreams(policyDefinition.getInputStreams());
-        }
-        if (coreDefinition.getOutputStreams() == null || coreDefinition.getOutputStreams().isEmpty()) {
-            coreDefinition.setOutputStreams(policyDefinition.getOutputStreams());
-        }
-
-        for (String inputStream : coreDefinition.getInputStreams()) {
-            builder.append(SiddhiDefinitionAdapter.buildStreamDefinition(sds.get(inputStream)));
-            builder.append("\n");
-        }
-        builder.append(coreDefinition.value);
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Generated siddhi execution plan: {} from definition: {}", builder.toString(), coreDefinition);
-        }
-        return builder.toString();
+    protected String generateExecutionPlan(PolicyDefinition policyDefinition, Map<String, StreamDefinition> sds) throws StreamNotDefinedException {
+        return SiddhiDefinitionAdapter.buildSiddhiExecutionPlan(policyDefinition,sds);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a6bc0a52/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiPolicyStateHandler.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiPolicyStateHandler.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiPolicyStateHandler.java
index 11f484d..02b8e8c 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiPolicyStateHandler.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/evaluator/impl/SiddhiPolicyStateHandler.java
@@ -18,7 +18,7 @@ package org.apache.eagle.alert.engine.evaluator.impl;
 
 import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
 import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import org.apache.eagle.alert.engine.coordinator.StreamDefinitionNotFoundException;
+import org.apache.eagle.alert.engine.coordinator.StreamNotDefinedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,7 +37,7 @@ public class SiddhiPolicyStateHandler extends SiddhiPolicyHandler {
     }
 
     @Override
-    protected String generateExecutionPlan(PolicyDefinition policyDefinition, Map<String, StreamDefinition> sds) throws StreamDefinitionNotFoundException {
+    protected String generateExecutionPlan(PolicyDefinition policyDefinition, Map<String, StreamDefinition> sds) throws StreamNotDefinedException {
         StringBuilder builder = new StringBuilder();
         PolicyDefinition.Definition stateDefiniton = policyDefinition.getStateDefinition();
         for (String inputStream : stateDefiniton.getInputStreams()) { // the state stream follow the output stream of the policy definition

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a6bc0a52/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AbstractStreamBolt.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AbstractStreamBolt.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AbstractStreamBolt.java
index c6f6906..92e9c8c 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AbstractStreamBolt.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AbstractStreamBolt.java
@@ -19,7 +19,7 @@ package org.apache.eagle.alert.engine.runner;
 import org.apache.eagle.alert.engine.StreamContext;
 import org.apache.eagle.alert.engine.coordinator.IMetadataChangeNotifyService;
 import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import org.apache.eagle.alert.engine.coordinator.StreamDefinitionNotFoundException;
+import org.apache.eagle.alert.engine.coordinator.StreamNotDefinedException;
 import org.apache.eagle.alert.engine.model.PartitionedEvent;
 import org.apache.eagle.alert.engine.serialization.PartitionedEventSerializer;
 import org.apache.eagle.alert.engine.serialization.SerializationMetadataProvider;
@@ -129,11 +129,11 @@ public abstract class AbstractStreamBolt extends BaseRichBolt implements Seriali
     }
 
     @Override
-    public StreamDefinition getStreamDefinition(String streamId) throws StreamDefinitionNotFoundException {
+    public StreamDefinition getStreamDefinition(String streamId) throws StreamNotDefinedException {
         if (sdf.containsKey(streamId)) {
             return sdf.get(streamId);
         } else {
-            throw new StreamDefinitionNotFoundException(streamId, specVersion);
+            throw new StreamNotDefinedException(streamId, specVersion);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a6bc0a52/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/SerializationMetadataProvider.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/SerializationMetadataProvider.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/SerializationMetadataProvider.java
index 42f0559..ef190b4 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/SerializationMetadataProvider.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/serialization/SerializationMetadataProvider.java
@@ -17,7 +17,7 @@
 package org.apache.eagle.alert.engine.serialization;
 
 import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import org.apache.eagle.alert.engine.coordinator.StreamDefinitionNotFoundException;
+import org.apache.eagle.alert.engine.coordinator.StreamNotDefinedException;
 
 /**
  * Integration interface to provide stream definition for serializer.
@@ -27,6 +27,6 @@ public interface SerializationMetadataProvider {
      * @param streamId
      * @return StreamDefinition or null if not exist.
      */
-    StreamDefinition getStreamDefinition(String streamId) throws StreamDefinitionNotFoundException;
+    StreamDefinition getStreamDefinition(String streamId) throws StreamNotDefinedException;
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a6bc0a52/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 9c9f1eb..21872b9 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
@@ -157,7 +157,7 @@ public class MockSampleMetadataFactory {
                     put("value", 60.0);
                     put("unknown", "unknown column value");
                 }}).build();
-        } catch (StreamDefinitionNotFoundException e) {
+        } catch (StreamNotDefinedException e) {
             e.printStackTrace();
         }
         PartitionedEvent pEvent = new PartitionedEvent();
@@ -241,7 +241,7 @@ public class MockSampleMetadataFactory {
 //                        put("value5", SAMPLE_STREAM_VALUE_OPTIONS[RANDOM.nextInt(SAMPLE_STREAM_VALUE_OPTIONS.length)]);
                     put("unknown", "unknown column value");
                 }}).build();
-        } catch (StreamDefinitionNotFoundException e) {
+        } catch (StreamNotDefinedException e) {
             throw new IllegalStateException(e.getMessage(), e);
         }
         return event;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a6bc0a52/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/mock/MockStreamMetadataService.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/mock/MockStreamMetadataService.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/mock/MockStreamMetadataService.java
index 86fb426..73c39c4 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/mock/MockStreamMetadataService.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/mock/MockStreamMetadataService.java
@@ -17,7 +17,7 @@
 package org.apache.eagle.alert.engine.mock;
 
 import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
-import org.apache.eagle.alert.engine.coordinator.StreamDefinitionNotFoundException;
+import org.apache.eagle.alert.engine.coordinator.StreamNotDefinedException;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -25,11 +25,11 @@ import java.util.Map;
 public class MockStreamMetadataService {
     private final Map<String, StreamDefinition> streamSchemaMap = new HashMap<>();
 
-    public StreamDefinition getStreamDefinition(String streamId) throws StreamDefinitionNotFoundException {
+    public StreamDefinition getStreamDefinition(String streamId) throws StreamNotDefinedException {
         if (streamSchemaMap.containsKey(streamId)) {
             return streamSchemaMap.get(streamId);
         } else {
-            throw new StreamDefinitionNotFoundException(streamId);
+            throw new StreamNotDefinedException(streamId);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a6bc0a52/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/nodata/TestDistinctValuesInTimeBatchWindow.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/nodata/TestDistinctValuesInTimeBatchWindow.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/nodata/TestDistinctValuesInTimeBatchWindow.java
index 5142b76..0446b5e 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/nodata/TestDistinctValuesInTimeBatchWindow.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/nodata/TestDistinctValuesInTimeBatchWindow.java
@@ -21,6 +21,7 @@ import org.apache.eagle.alert.engine.evaluator.nodata.NoDataPolicyTimeBatchHandl
 import org.apache.eagle.alert.engine.model.StreamEvent;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import static org.mockito.Matchers.anyObject;
@@ -41,7 +42,7 @@ public class TestDistinctValuesInTimeBatchWindow {
     public void teardown() {
     }
 
-    @Test
+    @Test @Ignore
     public void testNormal() throws Exception {
         // wisb is null since it is dynamic mode
         DistinctValuesInTimeBatchWindow window = new DistinctValuesInTimeBatchWindow(handler, 5 * 1000, null);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a6bc0a52/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 d3d41ea..d540fb5 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
@@ -201,6 +201,12 @@ public class MetadataResource {
         return dao.addPolicy(policy);
     }
 
+    @Path("/policies/validate")
+    @POST
+    public PolicyValidation validatePolicy(PolicyDefinition policy) {
+        return PolicyValidator.validate(policy,dao);
+    }
+
     @Path("/policies/batch")
     @POST
     public List<OpResult> addPolicies(List<PolicyDefinition> policies) {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a6bc0a52/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidation.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/PolicyValidation.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidation.java
new file mode 100644
index 0000000..4b69a35
--- /dev/null
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidation.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.service.metadata.resource;
+
+import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+
+import java.util.Map;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+public class PolicyValidation {
+    private boolean success;
+    private String message;
+    private String exception;
+
+    private Map<String, StreamDefinition> validInputStreams;
+    private Map<String, StreamDefinition> validOutputStreams;
+    private PolicyDefinition policyDefinition;
+    private String validExecutionPlan;
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+
+    public String getException() {
+        return exception;
+    }
+
+    public void setException(String exception) {
+        this.exception = exception;
+    }
+
+    public void setStackTrace(Throwable throwable) {
+        this.exception = ExceptionUtils.getStackTrace(throwable);
+    }
+
+    public Map<String, StreamDefinition> getValidOutputStreams() {
+        return validOutputStreams;
+    }
+
+    public void setValidOutputStreams(Map<String, StreamDefinition> validOutputStreams) {
+        this.validOutputStreams = validOutputStreams;
+    }
+
+    public Map<String, StreamDefinition> getValidInputStreams() {
+        return validInputStreams;
+    }
+
+    public void setValidInputStreams(Map<String, StreamDefinition> validInputStreams) {
+        this.validInputStreams = validInputStreams;
+    }
+
+    public PolicyDefinition getPolicyDefinition() {
+        return policyDefinition;
+    }
+
+    public void setPolicyDefinition(PolicyDefinition policyDefinition) {
+        this.policyDefinition = policyDefinition;
+    }
+
+    public String getValidExecutionPlan() {
+        return validExecutionPlan;
+    }
+
+    public void setValidExecutionPlan(String validExecutionPlan) {
+        this.validExecutionPlan = validExecutionPlan;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a6bc0a52/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidator.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/PolicyValidator.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidator.java
new file mode 100644
index 0000000..aef6aa8
--- /dev/null
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/main/java/org/apache/eagle/service/metadata/resource/PolicyValidator.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.service.metadata.resource;
+
+import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.apache.eagle.alert.engine.coordinator.StreamNotDefinedException;
+import org.apache.eagle.alert.engine.evaluator.impl.SiddhiDefinitionAdapter;
+import org.apache.eagle.alert.metadata.IMetadataDao;
+
+import com.google.common.base.Preconditions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.wso2.siddhi.core.ExecutionPlanRuntime;
+import org.wso2.siddhi.core.SiddhiManager;
+import org.wso2.siddhi.query.api.definition.AbstractDefinition;
+import org.wso2.siddhi.query.compiler.exception.SiddhiParserException;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class PolicyValidator {
+    private static final Logger LOG = LoggerFactory.getLogger(PolicyValidator.class);
+
+    public static PolicyValidation validate(PolicyDefinition policy, Map<String, StreamDefinition> allStreamDefinitions) {
+        PolicyValidation policyValidation = new PolicyValidation();
+        policyValidation.setPolicyDefinition(policy);
+
+        SiddhiManager siddhiManager = null;
+        ExecutionPlanRuntime executionRuntime = null;
+        String executionPlan = null;
+
+        try {
+            // Validate inputStreams are valid
+            Preconditions.checkNotNull(policy.getInputStreams(), "No inputStreams to connect from");
+            Map<String, StreamDefinition> currentDefinitions = new HashMap<>();
+            for (String streamId : policy.getInputStreams()) {
+                if (allStreamDefinitions.containsKey(streamId)) {
+                    currentDefinitions.put(streamId, allStreamDefinitions.get(streamId));
+                } else {
+                    throw new StreamNotDefinedException(streamId);
+                }
+            }
+
+            // Build final execution plan
+            executionPlan = SiddhiDefinitionAdapter.buildSiddhiExecutionPlan(policy, currentDefinitions);
+            siddhiManager = new SiddhiManager();
+            executionRuntime = siddhiManager.createExecutionPlanRuntime(executionPlan);
+
+            // Set current execution plan as valid
+            policyValidation.setValidExecutionPlan(executionPlan);
+
+            // Siddhi runtime active stream definitions
+            Map<String, AbstractDefinition> definitionMap = executionRuntime.getStreamDefinitionMap();
+
+            Map<String, StreamDefinition> validInputStreams = new HashMap<>();
+            Map<String, StreamDefinition> validOutputStreams = new HashMap<>();
+
+            for (Map.Entry<String, AbstractDefinition> entry : definitionMap.entrySet()) {
+                if (currentDefinitions.containsKey(entry.getKey())) {
+                    validInputStreams.put(entry.getKey(), currentDefinitions.get(entry.getKey()));
+                } else {
+                    validOutputStreams.put(entry.getKey(), SiddhiDefinitionAdapter.convertFromSiddiDefinition(entry.getValue()));
+                }
+            }
+            policyValidation.setValidInputStreams(validInputStreams);
+
+            // Validate outputStreams
+            policyValidation.setValidOutputStreams(validOutputStreams);
+            if (policy.getOutputStreams() != null) {
+                for (String outputStream : policy.getOutputStreams()) {
+                    if (!validOutputStreams.containsKey(outputStream)) {
+                        throw new StreamNotDefinedException("Output stream " + outputStream + " not defined");
+                    }
+                }
+            }
+
+            // TODO: Validate partitions
+
+            policyValidation.setSuccess(true);
+            policyValidation.setMessage("Validation success");
+        } catch (SiddhiParserException parserException) {
+            LOG.error("Got error to parse policy execution plan: \n{}", executionPlan, parserException);
+            policyValidation.setSuccess(false);
+            policyValidation.setMessage("Parser Error: " + parserException.getMessage());
+            policyValidation.setStackTrace(parserException);
+        } catch (Exception exception) {
+            LOG.error("Got Error to validate policy definition", exception);
+            policyValidation.setSuccess(false);
+            policyValidation.setMessage("Validation Error: " + exception.getMessage());
+            policyValidation.setStackTrace(exception);
+        } finally {
+            if (executionRuntime != null) {
+                executionRuntime.shutdown();
+            }
+            if (siddhiManager != null) {
+                siddhiManager.shutdown();
+            }
+        }
+        return policyValidation;
+    }
+
+    public static PolicyValidation validate(PolicyDefinition policy, IMetadataDao metadataDao) {
+        Map<String, StreamDefinition> allDefinitions = new HashMap<>();
+        for (StreamDefinition definition : metadataDao.listStreams()) {
+            allDefinitions.put(definition.getStreamId(), definition);
+        }
+        return validate(policy, allDefinitions);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a6bc0a52/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/test/java/org/apache/eagle/service/metadata/resource/PolicyValidatorTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/test/java/org/apache/eagle/service/metadata/resource/PolicyValidatorTest.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/test/java/org/apache/eagle/service/metadata/resource/PolicyValidatorTest.java
new file mode 100644
index 0000000..b9a1b23
--- /dev/null
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-metadata-parent/alert-metadata-service/src/test/java/org/apache/eagle/service/metadata/resource/PolicyValidatorTest.java
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.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.service.metadata.resource;
+
+import org.apache.eagle.alert.engine.coordinator.PolicyDefinition;
+import org.apache.eagle.alert.engine.coordinator.StreamColumn;
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.*;
+
+public class PolicyValidatorTest {
+    @Test
+    public void testValidPolicy() {
+        PolicyDefinition policyDefinition = new PolicyDefinition();
+        policyDefinition.setName("test_policy");
+        policyDefinition.setInputStreams(Collections.singletonList("INPUT_STREAM_1"));
+        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_1"));
+
+        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
+        definition.setType("siddhi");
+        definition.setValue("from INPUT_STREAM_1[value > 90.0] select * group by name insert into OUTPUT_STREAM_1;");
+        definition.setInputStreams(policyDefinition.getInputStreams());
+        definition.setOutputStreams(policyDefinition.getOutputStreams());
+        policyDefinition.setDefinition(definition);
+
+        PolicyValidation validation = PolicyValidator.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
+            {
+                put("INPUT_STREAM_1", createStreamDefinition("INPUT_STREAM_1"));
+                put("INPUT_STREAM_2", createStreamDefinition("INPUT_STREAM_2"));
+                put("INPUT_STREAM_3", createStreamDefinition("INPUT_STREAM_3"));
+                put("INPUT_STREAM_4", createStreamDefinition("INPUT_STREAM_4"));
+            }
+        });
+        Assert.assertTrue(validation.isSuccess());
+        Assert.assertEquals(1, validation.getValidInputStreams().size());
+        Assert.assertEquals(1, validation.getValidOutputStreams().size());
+    }
+
+    @Test
+    public void testValidPolicyWithTooManyInputStreams() {
+        PolicyDefinition policyDefinition = new PolicyDefinition();
+        policyDefinition.setName("test_policy");
+        policyDefinition.setInputStreams(Arrays.asList("INPUT_STREAM_1", "INPUT_STREAM_2"));
+        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_1"));
+
+        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
+        definition.setType("siddhi");
+        definition.setValue("from INPUT_STREAM_1[value > 90.0] select * group by name insert into OUTPUT_STREAM_1;");
+        definition.setInputStreams(policyDefinition.getInputStreams());
+        definition.setOutputStreams(policyDefinition.getOutputStreams());
+        policyDefinition.setDefinition(definition);
+
+        PolicyValidation validation = PolicyValidator.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
+            {
+                put("INPUT_STREAM_1", createStreamDefinition("INPUT_STREAM_1"));
+                put("INPUT_STREAM_2", createStreamDefinition("INPUT_STREAM_2"));
+            }
+        });
+        Assert.assertTrue(validation.isSuccess());
+        Assert.assertEquals(2, validation.getValidInputStreams().size());
+        Assert.assertEquals(1, validation.getValidOutputStreams().size());
+    }
+
+    @Test
+    public void testValidPolicyWithTooFewOutputStreams() {
+        PolicyDefinition policyDefinition = new PolicyDefinition();
+        policyDefinition.setName("test_policy");
+        policyDefinition.setInputStreams(Arrays.asList("INPUT_STREAM_1", "INPUT_STREAM_2"));
+        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_1"));
+
+        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
+        definition.setType("siddhi");
+        definition.setValue(
+            "from INPUT_STREAM_1[value > 90.0] select * group by name insert into OUTPUT_STREAM_1;"
+                + "from INPUT_STREAM_1[value < 90.0] select * group by name insert into OUTPUT_STREAM_2;"
+        );
+        definition.setInputStreams(policyDefinition.getInputStreams());
+        definition.setOutputStreams(policyDefinition.getOutputStreams());
+        policyDefinition.setDefinition(definition);
+
+        PolicyValidation validation = PolicyValidator.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
+            {
+                put("INPUT_STREAM_1", createStreamDefinition("INPUT_STREAM_1"));
+                put("INPUT_STREAM_2", createStreamDefinition("INPUT_STREAM_2"));
+            }
+        });
+        Assert.assertTrue(validation.isSuccess());
+        Assert.assertEquals(2, validation.getValidInputStreams().size());
+        Assert.assertEquals(2, validation.getValidOutputStreams().size());
+    }
+
+    @Test
+    public void testInvalidPolicyForSyntaxError() {
+        PolicyDefinition policyDefinition = new PolicyDefinition();
+        policyDefinition.setName("test_policy");
+        policyDefinition.setInputStreams(Collections.singletonList("INPUT_STREAM"));
+        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM"));
+
+        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
+        definition.setType("siddhi");
+        definition.setValue("from INPUT_STREAM (value > 90.0) select * group by name insert into OUTPUT_STREAM;");
+        definition.setInputStreams(policyDefinition.getInputStreams());
+        definition.setOutputStreams(policyDefinition.getOutputStreams());
+        policyDefinition.setDefinition(definition);
+
+        PolicyValidation validation = PolicyValidator.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
+            {
+                put("INPUT_STREAM", createStreamDefinition("INPUT_STREAM"));
+            }
+        });
+        Assert.assertFalse(validation.isSuccess());
+    }
+
+    @Test
+    public void testInvalidPolicyForNotDefinedInputStream() {
+        PolicyDefinition policyDefinition = new PolicyDefinition();
+        policyDefinition.setName("test_policy");
+        policyDefinition.setInputStreams(Collections.singletonList("INPUT_STREAM_1"));
+        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_1"));
+
+        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
+        definition.setType("siddhi");
+        definition.setValue("from INPUT_STREAM_1[value > 90.0] select * group by name insert into OUTPUT_STREAM_1;");
+        definition.setInputStreams(policyDefinition.getInputStreams());
+        definition.setOutputStreams(policyDefinition.getOutputStreams());
+        policyDefinition.setDefinition(definition);
+
+        PolicyValidation validation = PolicyValidator.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
+            {
+                put("INPUT_STREAM_2", createStreamDefinition("INPUT_STREAM_2"));
+            }
+        });
+        Assert.assertFalse(validation.isSuccess());
+    }
+
+    @Test
+    public void testInvalidPolicyForNotDefinedOutputStream() {
+        PolicyDefinition policyDefinition = new PolicyDefinition();
+        policyDefinition.setName("test_policy");
+        policyDefinition.setInputStreams(Collections.singletonList("INPUT_STREAM_1"));
+        policyDefinition.setOutputStreams(Collections.singletonList("OUTPUT_STREAM_2"));
+
+        PolicyDefinition.Definition definition = new PolicyDefinition.Definition();
+        definition.setType("siddhi");
+        definition.setValue("from INPUT_STREAM_1[value > 90.0] select * group by name insert into OUTPUT_STREAM_1;");
+        definition.setInputStreams(policyDefinition.getInputStreams());
+        definition.setOutputStreams(policyDefinition.getOutputStreams());
+        policyDefinition.setDefinition(definition);
+
+        PolicyValidation validation = PolicyValidator.validate(policyDefinition, new HashMap<String, StreamDefinition>() {
+            {
+                put("INPUT_STREAM_1", createStreamDefinition("INPUT_STREAM_1"));
+            }
+        });
+        Assert.assertFalse(validation.isSuccess());
+    }
+
+    // --------------
+    // Helper Methods
+    // --------------
+
+    private static StreamDefinition createStreamDefinition(String streamId) {
+        StreamDefinition streamDefinition = new StreamDefinition();
+        streamDefinition.setStreamId(streamId);
+        List<StreamColumn> columns = new ArrayList<>();
+        columns.add(new StreamColumn.Builder().name("name").type(StreamColumn.Type.STRING).build());
+        columns.add(new StreamColumn.Builder().name("value").type(StreamColumn.Type.DOUBLE).build());
+        streamDefinition.setColumns(columns);
+        return streamDefinition;
+    }
+}
\ No newline at end of file



[06/50] incubator-eagle git commit: [EAGLE-603] Enable/Disable Policy in UI

Posted by ha...@apache.org.
[EAGLE-603] Enable/Disable Policy in UI

Enable/Disable Policy in UI

Author: zombieJ <sm...@gmail.com>

Closes #487 from zombieJ/EAGLE-603.


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

Branch: refs/heads/master
Commit: 36df3ee7a556b9e430df2d54ccbf6c483344b6e2
Parents: 7d50253
Author: zombieJ <sm...@gmail.com>
Authored: Mon Oct 10 21:12:20 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Mon Oct 10 21:12:20 2016 +0800

----------------------------------------------------------------------
 .../app/dev/partials/alert/policyList.html      |  15 ++-
 .../app/dev/partials/integration/site.html      |  52 +++++++++-
 .../src/main/webapp/app/dev/public/css/main.css |   4 +
 .../webapp/app/dev/public/js/ctrls/alertCtrl.js |  22 +++-
 .../app/dev/public/js/ctrls/alertEditCtrl.js    |   7 +-
 .../app/dev/public/js/ctrls/integrationCtrl.js  | 101 ++++++++++++++-----
 .../app/dev/public/js/services/entitySrv.js     |  12 +++
 7 files changed, 180 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/36df3ee7/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html b/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html
index 49d8ab8..35d9696 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/alert/policyList.html
@@ -22,6 +22,7 @@
 			<table class="table table-bordered">
 				<thead>
 					<tr>
+						<th sortpath="policyStatus" width="10"></th>
 						<th sortpath="name" width="20%">Name</th>
 						<th sortpath="definition.type" width="70">Type</th>
 						<th>Description</th>
@@ -31,15 +32,23 @@
 				<tbody>
 					<tr>
 						<td>
+							<span class="fa fa-square" ng-class="item.policyStatus === 'ENABLED' ? 'text-green' : 'text-muted'"></span>
+						</td>
+						<td>
 							<a ui-sref="policyDetail({name: item.name})" target="_blank">{{item.name}}</a>
 						</td>
 						<td class="text-center"><span class="label label-primary">{{item.definition.type}}</span></td>
 						<td>{{item.description}}</td>
 						<td class="text-center">
 							<div class="btn-group btn-group-xs">
-								<button class="btn btn-default"><span class="fa fa-play"></span></button>
-								<a ui-sref="alert.policyEdit({name: item.name})" target="_blank" class="btn btn-default"><span class="fa fa-pencil"></span></a>
-								<button class="btn btn-danger" ng-click="deletePolicy(item)"><span class="fa fa-trash"></span></button>
+								<button class="btn btn-default opt" ng-if="item.policyStatus !== 'ENABLED'" ng-click="startPolicy(item)">
+									<span class="fa fa-play"></span>
+								</button>
+								<button class="btn btn-default opt" ng-if="item.policyStatus === 'ENABLED'" ng-click="stopPolicy(item)">
+									<span class="fa fa-stop"></span>
+								</button>
+								<a ui-sref="alert.policyEdit({name: item.name})" target="_blank" class="btn btn-default opt"><span class="fa fa-pencil"></span></a>
+								<button class="btn btn-danger opt" ng-click="deletePolicy(item)"><span class="fa fa-trash"></span></button>
 							</div>
 						</td>
 					</tr>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/36df3ee7/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
index b391b49..4c118dc 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
@@ -71,7 +71,7 @@
 				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
 					<span aria-hidden="true">�</span>
 				</button>
-				<h4 class="modal-title" id="myModalLabel">{{application.name}}</h4>
+				<h4 class="modal-title">{{application.name}}</h4>
 			</div>
 			<div class="modal-body">
 				<ul class="nav nav-tabs">
@@ -93,3 +93,53 @@
 		</div>
 	</div>
 </div>
+
+<!-- Modal: Application information -->
+<div class="modal fade" role="dialog" id="installMDL">
+	<div class="modal-dialog modal-lg">
+		<div class="modal-content">
+			<div class="modal-header">
+				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
+					<span aria-hidden="true">�</span>
+				</button>
+				<h4 class="modal-title">Install '{{application.name}}'</h4>
+			</div>
+			<div class="modal-body">
+				<ul class="nav nav-tabs">
+					<li class="active"><a href="[data-id='environment']" data-toggle="tab">Environment</a></li>
+					<li><a href="[data-id='configuration']" data-toggle="tab" data-id="configTab">Configuration</a></li>
+				</ul>
+				<div class="tab-content">
+					<div class="tab-pane active" data-id="environment">
+						<div class="form-group">
+							<label>Mode</label>
+							<select class="form-control" ng-model="tmpApp.mode">
+								<option>CLUSTER</option>
+								<option>LOCAL</option>
+							</select>
+						</div>
+						<div class="form-group">
+							<label>jar Path</label>
+							<input type="text" class="form-control" ng-model="tmpApp.jarPath" />
+						</div>
+					</div>
+					<div class="tab-pane" data-id="configuration">
+						<div class="form-group" ng-repeat="field in tmpAppConfigFields track by $index">
+							<label>
+								<a class="fa fa-times" ng-click="removeField(field)" ng-if="field._customize"></a>
+								{{field.displayName || field.name}}
+								<small ng-if="!field.required" class="text-muted">[optional]</small>
+							</label>
+							<input type="text" class="form-control" placeholder="{{field.description}}" ng-model="tmpApp.configuration[field.name]" />
+						</div>
+						<a ng-click="newField()">+ New Field</a>
+					</div>
+				</div>
+			</div>
+			<div class="modal-footer">
+				<button type="button" class="btn btn-default" ng-disabled="installLock" data-dismiss="modal">Close</button>
+				<button type="button" class="btn btn-primary" ng-disabled="installLock || !checkFields()" ng-click="installAppConfirm()">Install</button>
+			</div>
+		</div>
+	</div>
+</div>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/36df3ee7/eagle-server/src/main/webapp/app/dev/public/css/main.css
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/css/main.css b/eagle-server/src/main/webapp/app/dev/public/css/main.css
index 07482e1..ac22f89 100644
--- a/eagle-server/src/main/webapp/app/dev/public/css/main.css
+++ b/eagle-server/src/main/webapp/app/dev/public/css/main.css
@@ -130,6 +130,10 @@ table.table pre.inline {
 	font-size: 14px;
 }
 
+table.table .btn-group .btn.opt {
+	width: 22px;
+}
+
 table.table.table-sm th,
 table.table.table-sm td {
 	padding: 3px 5px;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/36df3ee7/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
index ae5194c..f2f8f96 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
@@ -63,7 +63,15 @@
 	eagleControllers.controller('policyListCtrl', function ($scope, $wrapState, PageConfig, Entity, UI) {
 		PageConfig.subTitle = "Manage Policies";
 
-		$scope.policyList = Entity.queryMetadata("policies");
+		$scope.policyList = [];
+
+		function updateList() {
+			var list = Entity.queryMetadata("policies");
+			list._then(function () {
+				$scope.policyList = list;
+			});
+		}
+		updateList();
 
 		$scope.deletePolicy = function (item) {
 			UI.deleteConfirm(item.name)(function (entity, closeFunc) {
@@ -73,6 +81,18 @@
 				});
 			});
 		};
+
+		$scope.startPolicy = function (policy) {
+			Entity
+				.put("metadata/policies/" + encodeURIComponent(policy.name) + "/status/ENABLED", {})
+				._then(updateList);
+		};
+
+		$scope.stopPolicy = function (policy) {
+			Entity
+				.put("metadata/policies/" + encodeURIComponent(policy.name) + "/status/DISABLED", {})
+				._then(updateList);
+		};
 	});
 
 	eagleControllers.controller('policyDetailCtrl', function ($scope, $wrapState, PageConfig, Entity, UI) {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/36df3ee7/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
index 05a47d4..3e9d13e 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
@@ -280,12 +280,13 @@
 			});
 			common.deferred.all(publisherPromiseList.concat(policyPromise)).then(function () {
 				$.dialog({
-					title: "Create Success",
-					content: "Create Success. Click confirm to go to the policy detail page."
+					title: "Done",
+					content: "Click confirm to go to the policy detail page."
 				});
+				$wrapState.go("policyDetail", {name: $scope.policy.name});
 			}, function (failedList) {
 				$.dialog({
-					title: "Create Failed",
+					title: "OPS",
 					content: $("<pre>").text(JSON.stringify(failedList, null, "\t"))
 				});
 				$scope.policyLock = false;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/36df3ee7/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
index eb463ba..8674df3 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/integrationCtrl.js
@@ -132,41 +132,92 @@
 			$("#appMDL").modal();
 		};
 
-		// Install application
-		$scope.installApp = function (application) {
-			application = application.origin;
-			var fields = common.getValueByPath(application, "configuration.properties", []);
-			fields = $.map(fields, function (prop) {
-				return {
-					field: prop.name,
-					name: prop.displayName,
-					description: prop.description,
-					defaultValue: prop.value,
-					optional: prop.required === false
-				};
-			});
+		// ================================================================
+		// =                         Installation                         =
+		// ================================================================
+		$scope.tmpApp = {};
+		$scope.tmpAppConfigFields = [];
+		$scope.installLock = false;
 
+		$scope.newField = function () {
 			UI.fieldConfirm({
-				title: "Install '" + application.type + "'",
-				addable: true
-			}, null, fields)(function (entity, closeFunc, unlock) {
-				Entity.create("apps/install", {
-					siteId: $scope.site.siteId,
-					appType: application.type,
-					configuration: entity
-				})._then(function (res) {
-					refreshApplications();
-					closeFunc();
-				}, function (res) {
+				title: "New Field"
+			}, null, [{
+				field: "name",
+				name: "Field Name"
+			}])(function (entity, closeFunc, unlock) {
+				if(common.array.find(entity.name, $scope.tmpAppConfigFields, "field")) {
 					$.dialog({
 						title: "OPS",
-						content: res.data.message
+						content: "Field already exist!"
 					});
+
 					unlock();
+				} else {
+					$scope.tmpAppConfigFields.push({
+						name: entity.name,
+						_customize: true,
+						required: true
+					});
+
+					closeFunc();
+				}
+			});
+		};
+
+		$scope.removeField = function (field) {
+			$scope.tmpAppConfigFields = common.array.remove(field, $scope.tmpAppConfigFields);
+		};
+
+		$scope.checkFields = function () {
+			var pass = true;
+			var config = common.getValueByPath($scope, ["tmpApp", "configuration"]);
+			$.each($scope.tmpAppConfigFields, function (i, field) {
+				if(field.required && !config[field.name]) {
+					pass = false;
+					return false;
+				}
+			});
+			return pass;
+		};
+
+		$scope.installAppConfirm = function () {
+			$scope.installLock = true;
+
+			Entity.create("apps/install", $scope.tmpApp)._then(function () {
+				refreshApplications();
+				$("#installMDL").modal("hide");
+			}, function (res) {
+				$.dialog({
+					title: "OPS",
+					content: res.data.message
 				});
+				$scope.installLock = false;
 			});
 		};
 
+		// Install application
+		$scope.installApp = function (application) {
+			application = application.origin;
+			$scope.installLock = false;
+			$scope.application = application;
+			$scope.tmpApp = {
+				siteId: $scope.site.siteId,
+				appType: application.type,
+				mode: "CLUSTER",
+				jarPath: application.jarPath,
+				configuration: {}
+			};
+
+			$scope.tmpAppConfigFields = common.getValueByPath(application, "configuration.properties", []);
+			$.each($scope.tmpAppConfigFields, function (i, field) {
+				$scope.tmpApp.configuration[field.name] = field.value;
+			});
+
+			$("#installMDL").modal();
+			$("a[data-id='configTab']").click();
+		};
+
 		// Uninstall application
 		$scope.uninstallApp = function (application) {
 			UI.deleteConfirm(application.descriptor.name + " - " + application.site.siteId)

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/36df3ee7/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js b/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js
index 8700f27..029b05d 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/services/entitySrv.js
@@ -80,6 +80,18 @@
 			}));
 		};
 
+		Entity.put = function (url, entity) {
+			var list = [];
+			return wrapList(list, $http({
+				method: 'PUT',
+				url: _host + "/rest/" + url,
+				headers: {
+					"Content-Type": "application/json"
+				},
+				data: entity
+			}));
+		};
+
 		Entity.delete = function (url, uuid) {
 			var list = [];
 			return wrapList(list, $http({


[05/50] incubator-eagle git commit: [MINOR] Support PUT in Access-Control-Allow-Methods

Posted by ha...@apache.org.
[MINOR] Support PUT in Access-Control-Allow-Methods


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

Branch: refs/heads/master
Commit: 7d5025336b647ed7afc21e6ddbbeaac2c074ea36
Parents: 4b53793
Author: Hao Chen <ha...@apache.org>
Authored: Mon Oct 10 19:19:35 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Mon Oct 10 19:19:35 2016 +0800

----------------------------------------------------------------------
 .../java/org/apache/eagle/alert/resource/SimpleCORSFiler.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/7d502533/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/resource/SimpleCORSFiler.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/resource/SimpleCORSFiler.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/resource/SimpleCORSFiler.java
index 2e1c72c..5b8141c 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/resource/SimpleCORSFiler.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/resource/SimpleCORSFiler.java
@@ -44,15 +44,15 @@ public class SimpleCORSFiler implements Filter {
         ServletException {
         HttpServletResponse response = (HttpServletResponse) res;
         response.setHeader("Access-Control-Allow-Origin", "*");
-        response.setHeader("Access-Control-Allow-Methods", "HEAD, POST, GET, OPTIONS, DELETE");
+        response.setHeader("Access-Control-Allow-Methods", "HEAD, POST, GET, PUT, OPTIONS, DELETE");
         response.setHeader("Access-Control-Max-Age", "3600");
         response.setHeader("Access-Control-Allow-Headers",
-            "Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers");
+                "Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers");
         chain.doFilter(request, response);
     }
 
     @Override
     public void destroy() {
-    }
 
+    }
 }


[20/50] incubator-eagle git commit: [MINOR] Simply reorg maven repositories

Posted by ha...@apache.org.
[MINOR] Simply reorg maven repositories

Simply reorg maven repositories

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

Closes #497 from haoch/FixRepo.


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

Branch: refs/heads/master
Commit: 806a29c15ad20fed8457ac39c52ac62f4c26641d
Parents: a3df074
Author: Hao Chen <ha...@apache.org>
Authored: Fri Oct 14 08:24:11 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Fri Oct 14 08:24:11 2016 +0800

----------------------------------------------------------------------
 .../alert/engine/router/TestAlertBolt.java      |  3 +-
 .../hbase/HBaseAuditLogAppProvider.java         |  7 ---
 pom.xml                                         | 65 ++++++++------------
 3 files changed, 27 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/806a29c1/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/router/TestAlertBolt.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/router/TestAlertBolt.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/router/TestAlertBolt.java
index c3842fa..7eec03a 100755
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/router/TestAlertBolt.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/router/TestAlertBolt.java
@@ -42,6 +42,7 @@ import org.apache.eagle.alert.engine.runner.TestStreamRouterBolt;
 import org.apache.eagle.alert.engine.serialization.impl.PartitionedEventSerializerImpl;
 import org.apache.eagle.alert.utils.DateTimeUtil;
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import java.io.IOException;
@@ -435,7 +436,7 @@ public class TestAlertBolt {
         Assert.assertTrue(recieved.get());
     }
 
-    @Test
+    @Test @Ignore
     public void testMultiStreamDefinition() throws Exception {
         final AtomicInteger alertCount = new AtomicInteger();
         final Semaphore mutex = new Semaphore(0);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/806a29c1/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java
----------------------------------------------------------------------
diff --git a/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java b/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java
index e788eb9..b573a63 100644
--- a/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java
+++ b/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java
@@ -31,11 +31,4 @@ public class HBaseAuditLogAppProvider extends AbstractApplicationProvider<HBaseA
     public HBaseAuditLogApplication getApplication() {
         return new HBaseAuditLogApplication();
     }
-
-    private static class MyModule extends AbstractModule {
-        @Override
-        protected void configure() {
-
-        }
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/806a29c1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 19a1a1d..7b61650 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1249,65 +1249,50 @@
     </build>
     <repositories>
         <repository>
-            <id>Maven Repo1 Repository</id>
+            <id>maven.repo1</id>
+            <name>Maven Repo1 Repository</name>
             <url>http://repo1.maven.org/maven2</url>
-            <releases>
-                <enabled>true</enabled>
-                <updatePolicy>never</updatePolicy>
-            </releases>
         </repository>
         <repository>
-            <id>cloudera</id>
-            <url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
-            <releases>
-                <enabled>true</enabled>
-                <updatePolicy>never</updatePolicy>
-            </releases>
+            <id>hortonworks.public</id>
+            <name>HDP Public Repository</name>
+            <url>http://repo.hortonworks.com/content/groups/public/</url>
         </repository>
         <repository>
-            <id>mapr-releases</id>
-            <url>http://repository.mapr.com/maven/</url>
-            <snapshots>
-                <enabled>false</enabled>
-            </snapshots>
-            <releases>
-                <enabled>true</enabled>
-            </releases>
+            <id>hortonworks.central</id>
+            <name>HDP Central Repository</name>
+            <url>http://repo.hortonworks.com/content/repositories/central/</url>
         </repository>
         <repository>
-            <id>siddhi cep engine</id>
-            <url>http://maven.wso2.org/nexus/content/groups/wso2-public</url>
-            <releases>
-                <enabled>true</enabled>
-                <updatePolicy>never</updatePolicy>
-            </releases>
+            <id>hortonworks.release</id>
+            <name>HDP Release Repository</name>
+            <url>http://repo.hortonworks.com/content/repositories/releases/</url>
         </repository>
         <repository>
-            <id>scala-tools.org</id>
-            <name>Scala-Tools Maven2 Repository</name>
-            <url>http://scala-tools.org/repo-releases</url>
-            <releases>
-                <enabled>true</enabled>
-                <updatePolicy>never</updatePolicy>
-            </releases>
+            <id>wso2.public</id>
+            <name>WSO2 Public</name>
+            <url>http://maven.wso2.org/nexus/content/groups/wso2-public</url>
         </repository>
         <repository>
-            <id>HDP Release Repository</id>
-            <url>http://repo.hortonworks.com/content/repositories/releases/</url>
+            <id>scale-tools.release</id>
+            <name>Scala-Tools Release Repository</name>
+            <url>http://scala-tools.org/repo-releases</url>
         </repository>
         <repository>
-            <id>HDP Central Repository</id>
-            <url>http://repo.hortonworks.com/content/repositories/central/</url>
+            <id>cloudera.repo</id>
+            <name>Cloudera Repository</name>
+            <url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
         </repository>
         <repository>
-            <id>WSO2 Public</id>
-            <url>http://maven.wso2.org/nexus/content/groups/wso2-public</url>
+            <id>mapr.repo</id>
+            <name>MapR Repository</name>
+            <url>http://repository.mapr.com/maven/</url>
         </repository>
     </repositories>
     <pluginRepositories>
         <pluginRepository>
-            <id>scala-tools-maven2-repository</id>
-            <name>Scala-Tools Maven2 Repository</name>
+            <id>scala-tools.release</id>
+            <name>Scala-Tools Release Repository</name>
             <url>http://scala-tools.org/repo-releases</url>
         </pluginRepository>
     </pluginRepositories>


[27/50] incubator-eagle git commit: [EAGLE-618] migration eagle-jpm-aggregation to application framework-bug fix

Posted by ha...@apache.org.
[EAGLE-618] migration eagle-jpm-aggregation to application framework-bug fix

Author: wujinhu <wu...@126.com>

Closes #508 from wujinhu/EAGLE-618.


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

Branch: refs/heads/master
Commit: c6ac2eb6f1b5ba6d6c8702e79e7f669e77dcb0a7
Parents: e6f9d1b
Author: wujinhu <wu...@126.com>
Authored: Fri Oct 14 15:50:39 2016 +0800
Committer: wujinhu <wu...@126.com>
Committed: Fri Oct 14 15:50:39 2016 +0800

----------------------------------------------------------------------
 .../apache/eagle/jpm/aggregation/AggregationApplication.java    | 5 +++--
 ...che.eagle.jpm.aggregation.AggregationApplicationProvider.xml | 4 ++--
 .../eagle-jpm-aggregation/src/main/resources/application.conf   | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/c6ac2eb6/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java b/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java
index 0577070..b040d3e 100644
--- a/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java
+++ b/eagle-jpm/eagle-jpm-aggregation/src/main/java/org/apache/eagle/jpm/aggregation/AggregationApplication.java
@@ -38,7 +38,8 @@ public class AggregationApplication extends StormApplication {
             metricNames.add(metricNamesArr[i]);
         }
         List<String> groupByColumns = new ArrayList<>();
-        String[] groupByColumnsArr = config.getString("aggregate.counters.groupBys").split(",");
+
+        String[] groupByColumnsArr = config.getString("aggregate.counters.groupBys").split(";");
         for (int i = 0; i < groupByColumnsArr.length; i++) {
             groupByColumns.add(groupByColumnsArr[i]);
         }
@@ -47,7 +48,7 @@ public class AggregationApplication extends StormApplication {
         for (String metric : metricNames) {
             metrics.put(metric, new ArrayList<>());
             for (String cols : groupByColumns) {
-                metrics.get(metric).add(Arrays.asList(cols.replaceAll(" ", "").split("&")));
+                metrics.get(metric).add(Arrays.asList(cols.replaceAll(" ", "").split(",")));
             }
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/c6ac2eb6/eagle-jpm/eagle-jpm-aggregation/src/main/resources/META-INF/providers/org.apache.eagle.jpm.aggregation.AggregationApplicationProvider.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-aggregation/src/main/resources/META-INF/providers/org.apache.eagle.jpm.aggregation.AggregationApplicationProvider.xml b/eagle-jpm/eagle-jpm-aggregation/src/main/resources/META-INF/providers/org.apache.eagle.jpm.aggregation.AggregationApplicationProvider.xml
index 237a437..99e3fca 100644
--- a/eagle-jpm/eagle-jpm-aggregation/src/main/resources/META-INF/providers/org.apache.eagle.jpm.aggregation.AggregationApplicationProvider.xml
+++ b/eagle-jpm/eagle-jpm-aggregation/src/main/resources/META-INF/providers/org.apache.eagle.jpm.aggregation.AggregationApplicationProvider.xml
@@ -102,8 +102,8 @@
         </property>
         <property>
             <name>aggregate.counters.groupBys</name>
-            <description>groupBys that each metric need to aggregate. If group by many columns, then split them by &</description>
-            <value>site&jobType, site&user, site</value>
+            <description>groupBys that each metric need to aggregate. If group by many columns, then split them by ,</description>
+            <value>site, jobType; site, user; site</value>
         </property>
     </configuration>
     <docs>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/c6ac2eb6/eagle-jpm/eagle-jpm-aggregation/src/main/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-aggregation/src/main/resources/application.conf b/eagle-jpm/eagle-jpm-aggregation/src/main/resources/application.conf
index 98fc009..529dd57 100644
--- a/eagle-jpm/eagle-jpm-aggregation/src/main/resources/application.conf
+++ b/eagle-jpm/eagle-jpm-aggregation/src/main/resources/application.conf
@@ -51,7 +51,7 @@
   "aggregate" : {
     "counters" : {
       "metrics" : "cpu_milliseconds,file_bytes_read, file_bytes_written, hdfs_bytes_read, hdfs_bytes_written, hdfs_read_ops, hdfs_write_ops",
-      "groupBys": "site&jobType, site&user, site"
+      "groupBys": "site, jobType; site, user; site"
     }
   },
 


[48/50] incubator-eagle git commit: [MINOR] Remove confusing .gitattributes

Posted by ha...@apache.org.
[MINOR] Remove confusing .gitattributes


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

Branch: refs/heads/master
Commit: c3bde0194f405deea438a553a4f83abb03d599d9
Parents: 76fc441
Author: Hao Chen <ha...@apache.org>
Authored: Tue Oct 18 18:51:53 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Tue Oct 18 18:51:53 2016 +0800

----------------------------------------------------------------------
 .gitattributes | 53 -----------------------------------------------------
 1 file changed, 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/c3bde019/.gitattributes
----------------------------------------------------------------------
diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 1bb92d0..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1,53 +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.
-
-# See https://github.com/alexkaratarakis/gitattributes/raw/master/Java.gitattributes
-
-# Handle line endings automatically for files detected as text
-# and leave all files detected as binary untouched.
-* text=auto
-
-#
-# The above will handle all files NOT found below
-#
-# These files are text and should be normalized (Convert crlf => lf)
-*.css           text
-*.df            text
-*.htm           text
-*.html          text
-*.java          text
-*.js            text
-*.json          text
-*.jsp           text
-*.jspf          text
-*.properties    text
-*.sh            text
-*.tld           text
-*.txt           text
-*.xml           text
-
-# These files are binary and should be left untouched
-# (binary is a macro for -text -diff)
-*.class         binary
-*.dll           binary
-*.ear           binary
-*.gif           binary
-*.ico           binary
-*.jar           binary
-*.jpg           binary
-*.jpeg          binary
-*.png           binary
-*.so            binary
-*.war           binary
\ No newline at end of file


[19/50] incubator-eagle git commit: EAGLE-594: Remove raw alert from kafka publisher

Posted by ha...@apache.org.
EAGLE-594: Remove raw alert from kafka publisher

We are leveraging configured deduplicator to dedup the duplicated alerts before
publish to kafka, email, slack, etc. However, sometimes we may still want to
keep the raw alerts in kafka. Here we have defined rawAlertNamespaceLabel and
rawAlertNamespaceValue custom fields to emit the raw alerts into kafka.
However, these configured namespace concept is ebay/sherlock specific, we
should remove it from eagle and use it ebay/sherlock extended kafka publisher.

Author: Li, Garrett
Reviewer: ralphsu

This closes #478


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

Branch: refs/heads/master
Commit: a3df074379b3952c366e1d9d876d0223ca24ffed
Parents: 1d0f9f5
Author: Xiancheng Li <xi...@ebay.com>
Authored: Sun Oct 9 10:37:06 2016 +0800
Committer: Ralph, Su <su...@gmail.com>
Committed: Thu Oct 13 16:51:23 2016 +0800

----------------------------------------------------------------------
 .../engine/publisher/PublishConstants.java      |  3 -
 .../publisher/impl/AlertKafkaPublisher.java     | 90 ++++++++++----------
 2 files changed, 44 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a3df0743/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/PublishConstants.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/PublishConstants.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/PublishConstants.java
index 7408779..0ba2313 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/PublishConstants.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/PublishConstants.java
@@ -51,7 +51,4 @@ public class PublishConstants {
     public static final String ALERT_EMAIL_POLICY = "policyId";
     public static final String ALERT_EMAIL_CREATOR = "creator";
     
-    public static final String RAW_ALERT_NAMESPACE_LABEL = "rawAlertNamespaceLabel";
-    public static final String RAW_ALERT_NAMESPACE_VALUE = "rawAlertNamespaceValue";
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a3df0743/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AlertKafkaPublisher.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AlertKafkaPublisher.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AlertKafkaPublisher.java
index 5464ded..5df34e3 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AlertKafkaPublisher.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AlertKafkaPublisher.java
@@ -18,7 +18,6 @@
 
 package org.apache.eagle.alert.engine.publisher.impl;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -45,8 +44,6 @@ public class AlertKafkaPublisher extends AbstractPublishPlugin {
     private KafkaProducer producer;
     private String brokerList;
     private String topic;
-    private String namespaceLabel;
-    private String namespaceValue;
 
     @Override
     @SuppressWarnings("rawtypes")
@@ -58,42 +55,64 @@ public class AlertKafkaPublisher extends AbstractPublishPlugin {
             brokerList = kafkaConfig.get(PublishConstants.BROKER_LIST).trim();
             producer = KafkaProducerManager.INSTANCE.getProducer(brokerList, kafkaConfig);
             topic = kafkaConfig.get(PublishConstants.TOPIC).trim();
-            namespaceLabel = kafkaConfig.getOrDefault(PublishConstants.RAW_ALERT_NAMESPACE_LABEL, "namespace");
-            namespaceValue = kafkaConfig.getOrDefault(PublishConstants.RAW_ALERT_NAMESPACE_VALUE, "network");
         }
     }
 
-    @SuppressWarnings( {"unchecked", "rawtypes"})
     @Override
     public void onAlert(AlertStreamEvent event) throws Exception {
         if (producer == null) {
             LOG.warn("KafkaProducer is null due to the incorrect configurations");
             return;
         }
-        List<AlertStreamEvent> outputEvents = new ArrayList<AlertStreamEvent>();
 
-        int namespaceColumnIndex = event.getSchema().getColumnIndex(namespaceLabel);
-        if (namespaceColumnIndex < 0 || namespaceColumnIndex >= event.getData().length) {
-            LOG.warn("Namespace column {} is not found, the found index {} is invalid",
-                namespaceLabel, namespaceColumnIndex);
-        } else {
-            // copy raw event to be duped
-            AlertStreamEvent newEvent = new AlertStreamEvent(event);
-            newEvent.getData()[namespaceColumnIndex] = namespaceValue;
-            outputEvents.add(newEvent);
+        this.emit(this.topic, this.dedup(event));
+    }
+
+    @SuppressWarnings("rawtypes")
+    @Override
+    public void update(String dedupIntervalMin, Map<String, String> pluginProperties) {
+        deduplicator.setDedupIntervalMin(dedupIntervalMin);
+        String newBrokerList = pluginProperties.get(PublishConstants.BROKER_LIST).trim();
+        String newTopic = pluginProperties.get(PublishConstants.TOPIC).trim();
+        if (!newBrokerList.equals(this.brokerList)) {
+            producer.close();
+            brokerList = newBrokerList;
+            KafkaProducer newProducer = null;
+            try {
+                newProducer = KafkaProducerManager.INSTANCE.getProducer(brokerList, pluginProperties);
+            } catch (Exception e) {
+                LOG.error("Create KafkaProducer failed with configurations: {}", pluginProperties);
+            }
+            producer = newProducer;
         }
+        topic = newTopic;
+    }
 
-        List<AlertStreamEvent> dedupResults = dedup(event);
-        if (dedupResults != null) {
-            outputEvents.addAll(dedupResults);
+    @Override
+    public void close() {
+        producer.close();
+    }
+
+    @SuppressWarnings( {"rawtypes", "unchecked"})
+    protected PublishStatus emit(String topic, List<AlertStreamEvent> outputEvents) {
+        // we need to check producer here since the producer is invisable to extended kafka publisher
+        if (producer == null) {
+            LOG.warn("KafkaProducer is null due to the incorrect configurations");
+            return null;
         }
-        PublishStatus status = new PublishStatus();
+        if (outputEvents == null) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Alert stream events list in publishment is empty");
+            }
+            return null;
+        }
+        this.status = new PublishStatus();
         try {
             for (AlertStreamEvent outputEvent : outputEvents) {
                 ProducerRecord record = createRecord(outputEvent, topic);
                 if (record == null) {
-                    LOG.error(" Alert serialize return null, ignored message! ");
-                    return;
+                    LOG.error("Alert serialize return null, ignored message! ");
+                    return null;
                 }
                 Future<?> future = producer.send(record);
                 future.get(MAX_TIMEOUT_MS, TimeUnit.MILLISECONDS);
@@ -112,32 +131,11 @@ public class AlertKafkaPublisher extends AbstractPublishPlugin {
             status.successful = false;
             status.errorMessage = ex.getMessage();
         }
-        this.status = status;
-    }
-
-    @SuppressWarnings("rawtypes")
-    @Override
-    public void update(String dedupIntervalMin, Map<String, String> pluginProperties) {
-        deduplicator.setDedupIntervalMin(dedupIntervalMin);
-        String newBrokerList = pluginProperties.get(PublishConstants.BROKER_LIST).trim();
-        String newTopic = pluginProperties.get(PublishConstants.TOPIC).trim();
-        if (!newBrokerList.equals(this.brokerList)) {
-            producer.close();
-            brokerList = newBrokerList;
-            KafkaProducer newProducer = null;
-            try {
-                newProducer = KafkaProducerManager.INSTANCE.getProducer(brokerList, pluginProperties);
-            } catch (Exception e) {
-                LOG.error("Create KafkaProducer failed with configurations: {}", pluginProperties);
-            }
-            producer = newProducer;
-        }
-        topic = newTopic;
+        return status;
     }
 
-    @Override
-    public void close() {
-        producer.close();
+    protected String getTopic() {
+        return this.topic;
     }
 
     private ProducerRecord<String, Object> createRecord(AlertStreamEvent event, String topic) throws Exception {


[08/50] incubator-eagle git commit: [EAGLE-601] Change updating policy status API as POST /metadata/policies/{policyId}/status/{status}

Posted by ha...@apache.org.
[EAGLE-601] Change updating policy status API as POST /metadata/policies/{policyId}/status/{status}


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

Branch: refs/heads/master
Commit: 757f510a14a2c79b4d20b4c156aaf079cc1683fe
Parents: 9205433
Author: Hao Chen <ha...@apache.org>
Authored: Tue Oct 11 11:57:33 2016 +0800
Committer: Hao Chen <ha...@apache.org>
Committed: Tue Oct 11 11:57:33 2016 +0800

----------------------------------------------------------------------
 .../apache/eagle/service/metadata/resource/MetadataResource.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/757f510a/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 0bf31df..d3d41ea 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
@@ -236,8 +236,8 @@ public class MetadataResource {
     }
 
     @Path("/policies/{policyId}/status/{status}")
-    @PUT
-    public OpResult updatePolicyStatusByID(@PathParam("policyId") String policyId, @PathParam("status")PolicyDefinition.PolicyStatus status) {
+    @POST
+    public OpResult updatePolicyStatusByID(@PathParam("policyId") String policyId, @PathParam("status") PolicyDefinition.PolicyStatus status) {
         OpResult result = new OpResult();
         try {
             PolicyDefinition policyDefinition = getPolicyByID(policyId);