Repository: incubator-eagle
Updated Branches:
  refs/heads/master ec80d1b8c -> 0903ed2c9


[EAGLE-547] Resolve duplicated view path

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

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

Closes #438 from haoch/EAGLE-547.


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

Branch: refs/heads/master
Commit: 0903ed2c918b13b99f5c10b334a3c82b5ebd37f2
Parents: ec80d1b
Author: Hao Chen <h...@apache.org>
Authored: Sun Sep 18 11:47:59 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Sun Sep 18 11:47:59 2016 +0800

----------------------------------------------------------------------
 .../impl/ApplicationProviderServiceImpl.java       | 17 +++++++++++++++--
 ...rg.apache.eagle.gc.GCLogApplicationProvider.xml |  1 -
 ....mr.history.MRHistoryJobApplicationProvider.xml |  1 -
 ....mr.running.MRRunningJobApplicationProvider.xml |  1 -
 ...pm.spark.history.SparkHistoryJobAppProvider.xml |  1 -
 ...pm.spark.running.SparkRunningJobAppProvider.xml |  1 -
 ...gle.security.hbase.HBaseAuditLogAppProvider.xml |  1 -
 .../security/auditlog/HdfsAuditLogApplication.java |  2 +-
 ...e.security.auditlog.HdfsAuditLogAppProvider.xml |  1 -
 9 files changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0903ed2c/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderServiceImpl.java
 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderServiceImpl.java
index 1aa4618..d85b6cc 100644
--- 
a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderServiceImpl.java
+++ 
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderServiceImpl.java
@@ -29,7 +29,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -74,6 +76,8 @@ public class ApplicationProviderServiceImpl implements 
ApplicationProviderServic
     }
 
     private void validate() {
+        final Map<String, ApplicationDesc> viewPathAppDesc = new HashMap<>();
+
         for (ApplicationDesc applicationDesc : getApplicationDescs()) {
             LOG.debug("Validating {}", applicationDesc.getType());
 
@@ -81,6 +85,15 @@ public class ApplicationProviderServiceImpl implements 
ApplicationProviderServic
             Preconditions.checkNotNull(applicationDesc.getVersion(), "version 
is null in " + applicationDesc);
             Preconditions.checkNotNull(applicationDesc.getName(), "name is 
null in " + applicationDesc);
 
+            if (applicationDesc.getViewPath() != null) {
+                if 
(viewPathAppDesc.containsKey(applicationDesc.getViewPath())) {
+                    throw new IllegalStateException("Duplicated view " + 
applicationDesc.getViewPath()
+                        + " defined in " + 
viewPathAppDesc.get(applicationDesc.getViewPath()).getType() + " and " + 
applicationDesc.getType());
+                } else {
+                    viewPathAppDesc.put(applicationDesc.getViewPath(), 
applicationDesc);
+                }
+            }
+
             // Validate Dependency
             LOG.debug("Validating dependency of {}", 
applicationDesc.getType());
             List<ApplicationDependency> dependencyList = 
applicationDesc.getDependencies();
@@ -103,8 +116,8 @@ public class ApplicationProviderServiceImpl implements 
ApplicationProviderServic
                         if (!dependency.isRequired()) {
                             LOG.warn("Unable to load dependency {} -> {}", 
applicationDesc.getType(), dependency, ex);
                         } else {
-                            LOG.error("Failed to load dependency {} -> {}", 
applicationDesc.getType(), dependency,ex);
-                            throw new IllegalStateException("Failed to load 
application providers due to dependency missing",ex);
+                            LOG.error("Failed to load dependency {} -> {}", 
applicationDesc.getType(), dependency, ex);
+                            throw new IllegalStateException("Failed to load 
application providers due to dependency missing", ex);
                         }
                     }
                 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0903ed2c/eagle-gc/src/main/resources/META-INF/providers/org.apache.eagle.gc.GCLogApplicationProvider.xml
----------------------------------------------------------------------
diff --git 
a/eagle-gc/src/main/resources/META-INF/providers/org.apache.eagle.gc.GCLogApplicationProvider.xml
 
b/eagle-gc/src/main/resources/META-INF/providers/org.apache.eagle.gc.GCLogApplicationProvider.xml
index 453c489..a0477a2 100644
--- 
a/eagle-gc/src/main/resources/META-INF/providers/org.apache.eagle.gc.GCLogApplicationProvider.xml
+++ 
b/eagle-gc/src/main/resources/META-INF/providers/org.apache.eagle.gc.GCLogApplicationProvider.xml
@@ -25,7 +25,6 @@
     <name>GC Log Monitoring Application</name>
     <version>0.5.0-incubating</version>
     <appClass>org.apache.eagle.gc.GCLogApplication</appClass>
-    <viewPath>/apps/example</viewPath>
     <configuration>
         <!-- topology level configurations -->
         <property>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0903ed2c/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 1491b4b..ae318ba 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
@@ -21,7 +21,6 @@
     <name>Map Reduce History Job Monitoring</name>
     <version>0.5.0-incubating</version>
     
<appClass>org.apache.eagle.jpm.mr.history.MRHistoryJobApplication</appClass>
-    <viewPath>/apps/jpm</viewPath>
     <configuration>
         <!-- org.apache.eagle.jpm.mr.history.MRHistoryJobConfig -->
         <property>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0903ed2c/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 5f809f3..39e562c 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
@@ -21,7 +21,6 @@
     <name>MR Running Job Monitoring</name>
     <version>0.5.0-incubating</version>
     
<appClass>org.apache.eagle.jpm.mr.running.MRRunningJobApplication</appClass>
-    <viewPath>/apps/jpm</viewPath>
     <configuration>
         <!-- org.apache.eagle.jpm.spark.running.SparkRunningJobAppConfig -->
         <property>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0903ed2c/eagle-jpm/eagle-jpm-spark-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.spark.history.SparkHistoryJobAppProvider.xml
----------------------------------------------------------------------
diff --git 
a/eagle-jpm/eagle-jpm-spark-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.spark.history.SparkHistoryJobAppProvider.xml
 
b/eagle-jpm/eagle-jpm-spark-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.spark.history.SparkHistoryJobAppProvider.xml
index b94c603..4b8887a 100644
--- 
a/eagle-jpm/eagle-jpm-spark-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.spark.history.SparkHistoryJobAppProvider.xml
+++ 
b/eagle-jpm/eagle-jpm-spark-history/src/main/resources/META-INF/providers/org.apache.eagle.jpm.spark.history.SparkHistoryJobAppProvider.xml
@@ -21,7 +21,6 @@
     <name>Spark History Job Monitoring</name>
     <version>0.5.0-incubating</version>
     <appClass>org.apache.eagle.jpm.spark.history.SparkHistoryJobApp</appClass>
-    <viewPath>/apps/jpm</viewPath>
     <configuration>
         <!-- org.apache.eagle.jpm.spark.history.SparkHistoryJobAppConfig -->
         <property>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0903ed2c/eagle-jpm/eagle-jpm-spark-running/src/main/resources/META-INF/providers/org.apache.eagle.jpm.spark.running.SparkRunningJobAppProvider.xml
----------------------------------------------------------------------
diff --git 
a/eagle-jpm/eagle-jpm-spark-running/src/main/resources/META-INF/providers/org.apache.eagle.jpm.spark.running.SparkRunningJobAppProvider.xml
 
b/eagle-jpm/eagle-jpm-spark-running/src/main/resources/META-INF/providers/org.apache.eagle.jpm.spark.running.SparkRunningJobAppProvider.xml
index 24cf09e..0726972 100644
--- 
a/eagle-jpm/eagle-jpm-spark-running/src/main/resources/META-INF/providers/org.apache.eagle.jpm.spark.running.SparkRunningJobAppProvider.xml
+++ 
b/eagle-jpm/eagle-jpm-spark-running/src/main/resources/META-INF/providers/org.apache.eagle.jpm.spark.running.SparkRunningJobAppProvider.xml
@@ -21,7 +21,6 @@
     <name>Spark Running Job Monitoring</name>
     <version>0.5.0-incubating</version>
     <appClass>org.apache.eagle.jpm.spark.running.SparkRunningJobApp</appClass>
-    <viewPath>/apps/jpm</viewPath>
     <configuration>
         <!-- org.apache.eagle.jpm.spark.running.SparkRunningJobAppConfig -->
         <property>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0903ed2c/eagle-security/eagle-security-hbase-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.hbase.HBaseAuditLogAppProvider.xml
----------------------------------------------------------------------
diff --git 
a/eagle-security/eagle-security-hbase-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.hbase.HBaseAuditLogAppProvider.xml
 
b/eagle-security/eagle-security-hbase-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.hbase.HBaseAuditLogAppProvider.xml
index a085952..8f648a1 100644
--- 
a/eagle-security/eagle-security-hbase-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.hbase.HBaseAuditLogAppProvider.xml
+++ 
b/eagle-security/eagle-security-hbase-auditlog/src/main/resources/META-INF/providers/org.apache.eagle.security.hbase.HBaseAuditLogAppProvider.xml
@@ -21,7 +21,6 @@
     <name>Hbase Audit Log Monitoring Application</name>
     <version>0.5.0-incubating</version>
     
<appClass>org.apache.eagle.security.hbase.HBaseAuditLogApplication</appClass>
-    <viewPath>/apps/example</viewPath>
     <configuration>
         <property>
             <name>dataSourceConfig.topic</name>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0903ed2c/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/HdfsAuditLogApplication.java
----------------------------------------------------------------------
diff --git 
a/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/HdfsAuditLogApplication.java
 
b/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/HdfsAuditLogApplication.java
index 791572b..6d3c58c 100644
--- 
a/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/HdfsAuditLogApplication.java
+++ 
b/eagle-security/eagle-security-hdfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/HdfsAuditLogApplication.java
@@ -39,7 +39,7 @@ public class HdfsAuditLogApplication extends 
AbstractHdfsAuditLogApplication {
         return "hdfs_audit_log_stream";
     }
 
-    public static void main(String[] args){
+    public static void main(String[] args) {
         Config config = ConfigFactory.load();
         HdfsAuditLogApplication app = new HdfsAuditLogApplication();
         app.run(config);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0903ed2c/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 ded57ab..cd564df 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
@@ -24,7 +24,6 @@
     <type>HdfsAuditLogApplication</type>
     <name>Hdfs Audit Log Monitoring Application</name>
     <version>0.5.0-incubating</version>
-    <viewPath>/apps/example</viewPath>
     <configuration>
         <!-- topology related configurations -->
         <property>

Reply via email to