slider-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject [5/6] git commit: SLIDER-272. Application should specify the config types to publish
Date Wed, 06 Aug 2014 03:12:49 GMT
SLIDER-272. Application should specify the config types to publish


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

Branch: refs/heads/develop
Commit: 640233dd355f8ac3fe917a307ca3251caf6593e7
Parents: 50dc76c
Author: Sumit Mohanty <smohanty@hortonworks.com>
Authored: Sun Aug 3 21:48:32 2014 -0700
Committer: Sumit Mohanty <smohanty@hortonworks.com>
Committed: Tue Aug 5 18:51:58 2014 -0700

----------------------------------------------------------------------
 app-packages/memcached-win/metainfo.xml          |  1 +
 app-packages/memcached/metainfo.xml              |  1 +
 .../providers/agent/AgentProviderService.java    | 19 +++++++++++++++++--
 .../agent/application/metadata/Application.java  |  9 +++++++++
 .../application/metadata/MetainfoParser.java     |  1 +
 .../agent/TestAgentProviderService.java          |  2 ++
 6 files changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/640233dd/app-packages/memcached-win/metainfo.xml
----------------------------------------------------------------------
diff --git a/app-packages/memcached-win/metainfo.xml b/app-packages/memcached-win/metainfo.xml
index a0de8c2..dc2d67b 100644
--- a/app-packages/memcached-win/metainfo.xml
+++ b/app-packages/memcached-win/metainfo.xml
@@ -22,6 +22,7 @@
     <name>MEMCACHED</name>
     <comment>Memcache is a network accessible key/value storage system, often used
as a distributed cache.</comment>
     <version>1.0.0</version>
+    <exportedConfigs>None</exportedConfigs>
 
     <components>
       <component>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/640233dd/app-packages/memcached/metainfo.xml
----------------------------------------------------------------------
diff --git a/app-packages/memcached/metainfo.xml b/app-packages/memcached/metainfo.xml
index 0550b7d..08a504e 100644
--- a/app-packages/memcached/metainfo.xml
+++ b/app-packages/memcached/metainfo.xml
@@ -22,6 +22,7 @@
     <name>MEMCACHED</name>
     <comment>Memcache is a network accessible key/value storage system, often used
as a distributed cache.</comment>
     <version>1.0.0</version>
+    <exportedConfigs>None</exportedConfigs>
 
     <components>
       <component>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/640233dd/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
index 28c874b..682efba 100644
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
+++ b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
@@ -88,6 +88,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Set;
 import java.util.TreeMap;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -637,12 +638,26 @@ public class AgentProviderService extends AbstractProviderService implements
       Application application = getMetainfo().getApplication();
       List<ExportGroup> exportGroups = application.getExportGroups();
       boolean hasExportGroups = exportGroups != null && !exportGroups.isEmpty();
+      Set<String> exportedConfigs = new HashSet();
+      String exportedConfigsStr = application.getExportedConfigs();
+      boolean exportedConfigSpecified = exportedConfigsStr != null;
+      if (application.getExportedConfigs() != null && application.getExportedConfigs().length()
> 0) {
+        for (String exportedConfig : application.getExportedConfigs().split(",")) {
+          if (exportedConfig.trim().length() > 0) {
+            exportedConfigs.add(exportedConfig.trim());
+          }
+        }
+      }
+
       for (ComponentStatus status : statuses) {
         log.info("Status report: " + status.toString());
         if (status.getConfigs() != null) {
           for (String key : status.getConfigs().keySet()) {
-            Map<String, String> configs = status.getConfigs().get(key);
-            publishApplicationInstanceData(key, key, configs.entrySet());
+            if ((exportedConfigSpecified && exportedConfigs.contains(key)) ||
+                !exportedConfigSpecified) {
+              Map<String, String> configs = status.getConfigs().get(key);
+              publishApplicationInstanceData(key, key, configs.entrySet());
+            }
           }
 
           if (hasExportGroups) {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/640233dd/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Application.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Application.java
b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Application.java
index b007313..016b4d4 100644
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Application.java
+++ b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Application.java
@@ -26,6 +26,7 @@ public class Application {
   String name;
   String comment;
   String version;
+  String exportedConfigs;
   List<Component> components;
   List<ExportGroup> exportGroups;
   List<OSSpecific> osSpecifics;
@@ -63,6 +64,14 @@ public class Application {
     this.version = version;
   }
 
+  public String getExportedConfigs() {
+    return exportedConfigs;
+  }
+
+  public void setExportedConfigs(String exportedConfigs) {
+    this.exportedConfigs = exportedConfigs;
+  }
+
   public ConfigurationDependencies getConfigDependencies() {
     return configDependencies;
   }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/640233dd/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/MetainfoParser.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/MetainfoParser.java
b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/MetainfoParser.java
index d2801d4..deb7a6a 100644
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/MetainfoParser.java
+++ b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/MetainfoParser.java
@@ -38,6 +38,7 @@ public class MetainfoParser {
     digester.addBeanPropertySetter("*/application/name");
     digester.addBeanPropertySetter("*/application/comment");
     digester.addBeanPropertySetter("*/application/version");
+    digester.addBeanPropertySetter("*/application/exportedConfigs");
 
     digester.addObjectCreate("*/commandOrder", CommandOrder.class);
     digester.addBeanPropertySetter("*/commandOrder/command");

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/640233dd/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java
b/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java
index 10b1eb7..4b2e253 100644
--- a/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java
+++ b/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentProviderService.java
@@ -106,6 +106,7 @@ public class TestAgentProviderService {
                                                + "      <version>0.96.0.2.1.1</version>\n"
                                                + "      <type>YARN-APP</type>\n"
                                                + "      <minHadoopVersion>2.1.0</minHadoopVersion>\n"
+                                               + "      <exportedConfigs>hbase-site,global</exportedConfigs>\n"
                                                + "      <exportGroups>\n"
                                                + "        <exportGroup>\n"
                                                + "          <name>QuickLinks</name>\n"
@@ -454,6 +455,7 @@ public class TestAgentProviderService {
     Application application = metainfo.getApplication();
     log.info("Service: " + application.toString());
     Assert.assertEquals(application.getName(), "HBASE");
+    Assert.assertEquals(application.getExportedConfigs(), "hbase-site,global");
     Assert.assertEquals(application.getComponents().size(), 2);
     List<Component> components = application.getComponents();
     int found = 0;


Mime
View raw message