ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject git commit: AMBARI-4976. YARN metrics missing from service summary section (Dmytro Sen via dlysnichenko)
Date Thu, 06 Mar 2014 20:12:58 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 2c61e863d -> 374afc385


AMBARI-4976. YARN metrics missing from service summary section (Dmytro Sen via dlysnichenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/374afc38
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/374afc38
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/374afc38

Branch: refs/heads/trunk
Commit: 374afc385791e02dede8c1b37ba9621049119ffa
Parents: 2c61e86
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Thu Mar 6 22:11:14 2014 +0200
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Thu Mar 6 22:11:14 2014 +0200

----------------------------------------------------------------------
 .../api/query/render/MinimalRenderer.java       | 29 +++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/374afc38/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/MinimalRenderer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/MinimalRenderer.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/MinimalRenderer.java
index 2fe4fce..2e51061 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/MinimalRenderer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/MinimalRenderer.java
@@ -91,8 +91,8 @@ public class MinimalRenderer extends BaseRenderer implements Renderer {
       addSubResources(queryTree, resultTree);
       addKeysToEmptyResource = false;
     }
-    ensureRequiredProperties(resultTree, addKeysToEmptyResource);
     processRequestedProperties(queryTree);
+    ensureRequiredProperties(resultTree, addKeysToEmptyResource);
 
     return resultTree;
   }
@@ -109,14 +109,6 @@ public class MinimalRenderer extends BaseRenderer implements Renderer
{
     return new MinimalPostProcessor(request);
   }
 
-  // ----- BaseRenderer ------------------------------------------------------
-
-  @Override
-  protected void addKeys(Resource.Type resourceType, Set<String> properties) {
-    // override to only add pk instead of pk and all fk's
-    addPrimaryKey(resourceType, properties);
-  }
-
   // ----- private instance methods ------------------------------------------
 
   /**
@@ -167,7 +159,7 @@ public class MinimalRenderer extends BaseRenderer implements Renderer
{
           String absPropertyName = PropertyHelper.getPropertyId(categoryName, propName);
           if ((requestedProperties == null ||
               (! requestedProperties.contains(absPropertyName) &&
-                  ! requestedProperties.contains(categoryName))) &&
+              ! isSubCategory(requestedProperties, categoryName))) &&
               ! getPrimaryKeys(type).contains(absPropertyName)) {
             valueIter.remove();
           }
@@ -183,6 +175,23 @@ public class MinimalRenderer extends BaseRenderer implements Renderer
{
   }
 
   /**
+   * Checks if properties contains a category for the subCategoryName
+   * Example: metrics/yarn/Queue/root/ActiveApplications and metrics/yarn/Queue
+   *
+   * @param properties categories
+   * @param subCategoryName subcategory
+   * @return
+   */
+  private boolean isSubCategory(Set<String> properties, String subCategoryName) {
+    for (String property : properties) {
+      if (subCategoryName.startsWith(property)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
    * Obtain the primary keys for the specified type.
    * This method is necessary because some resource types, specifically
    * the configuration type, don't have a proper pk even though one is


Mime
View raw message