ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [22/50] [abbrv] ambari git commit: AMBARI-22353. Remove properties.json And Switch To Adding Properties to ResourceProviders Dynamically (dlysnichenko)
Date Thu, 07 Dec 2017 16:40:13 GMT
http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackResourceProvider.java
index ead4f6d..59b42f1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackResourceProvider.java
@@ -18,7 +18,6 @@
 
 package org.apache.ambari.server.controller.internal;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Map;
@@ -40,18 +39,29 @@ import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+
 public class StackResourceProvider extends ReadOnlyResourceProvider {
 
   public static final String STACK_NAME_PROPERTY_ID = PropertyHelper
       .getPropertyId("Stacks", "stack_name");
 
-  private static Set<String> pkPropertyIds = new HashSet<>(
-    Arrays.asList(new String[]{STACK_NAME_PROPERTY_ID}));
-
-  protected StackResourceProvider(Set<String> propertyIds,
-      Map<Type, String> keyPropertyIds,
-      AmbariManagementController managementController) {
-    super(propertyIds, keyPropertyIds, managementController);
+  /**
+   * The key property ids for a Stack resource.
+   */
+  protected static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Type.Stack, STACK_NAME_PROPERTY_ID)
+      .build();
+
+  /**
+   * The property ids for a Stack resource.
+   */
+  protected static Set<String> propertyIds = Sets.newHashSet(
+      STACK_NAME_PROPERTY_ID);
+
+  protected StackResourceProvider(AmbariManagementController managementController) {
+    super(Type.Stack, propertyIds, keyPropertyIds, managementController);
   }
 
 
@@ -120,6 +130,6 @@ public class StackResourceProvider extends ReadOnlyResourceProvider {
 
   @Override
   protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds;
+    return new HashSet<>(keyPropertyIds.values());
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceComponentResourceProvider.java
index b9661bb..a221248 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceComponentResourceProvider.java
@@ -18,7 +18,6 @@
 
 package org.apache.ambari.server.controller.internal;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Map;
@@ -39,6 +38,9 @@ import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.state.AutoDeployInfo;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+
 public class StackServiceComponentResourceProvider extends
     ReadOnlyResourceProvider {
   
@@ -102,15 +104,43 @@ public class StackServiceComponentResourceProvider extends
   private static final String AUTO_DEPLOY_LOCATION_ID = PropertyHelper.getPropertyId(
       "auto_deploy", "location");
 
-  private static Set<String> pkPropertyIds = new HashSet<>(
-    Arrays.asList(new String[]{STACK_NAME_PROPERTY_ID,
-      STACK_VERSION_PROPERTY_ID, SERVICE_NAME_PROPERTY_ID,
-      COMPONENT_NAME_PROPERTY_ID}));
-
-  protected StackServiceComponentResourceProvider(Set<String> propertyIds,
-      Map<Type, String> keyPropertyIds,
-      AmbariManagementController managementController) {
-    super(propertyIds, keyPropertyIds, managementController);
+  /**
+   * The key property ids for a StackServiceComponent resource.
+   */
+  private static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Type.Stack, STACK_NAME_PROPERTY_ID)
+      .put(Type.StackVersion, STACK_VERSION_PROPERTY_ID)
+      .put(Type.StackService, SERVICE_NAME_PROPERTY_ID)
+      .put(Type.StackServiceComponent, COMPONENT_NAME_PROPERTY_ID)
+      .build();
+
+  /**
+   * The property ids for a StackServiceComponent resource.
+   */
+  private static Set<String> propertyIds = Sets.newHashSet(
+      STACK_NAME_PROPERTY_ID,
+      STACK_VERSION_PROPERTY_ID,
+      SERVICE_NAME_PROPERTY_ID,
+      COMPONENT_NAME_PROPERTY_ID,
+      COMPONENT_DISPLAY_NAME_PROPERTY_ID,
+      COMPONENT_CATEGORY_PROPERTY_ID,
+      IS_CLIENT_PROPERTY_ID,
+      IS_MASTER_PROPERTY_ID,
+      CARDINALITY_ID,
+      ADVERTISE_VERSION_ID,
+      DECOMISSION_ALLOWED_ID,
+      REASSIGN_ALLOWED_ID,
+      CUSTOM_COMMANDS_PROPERTY_ID,
+      HAS_BULK_COMMANDS_PROPERTY_ID,
+      BULK_COMMANDS_DISPLAY_NAME_PROPERTY_ID,
+      BULK_COMMANDS_MASTER_COMPONENT_NAME_PROPERTY_ID,
+      RECOVERY_ENABLED,
+      ROLLING_RESTART_SUPPORTED,
+      AUTO_DEPLOY_ENABLED_ID,
+      AUTO_DEPLOY_LOCATION_ID);
+
+  protected StackServiceComponentResourceProvider(AmbariManagementController managementController) {
+    super(Type.StackServiceComponent, propertyIds, keyPropertyIds, managementController);
   }
 
 
@@ -222,7 +252,7 @@ public class StackServiceComponentResourceProvider extends
 
   @Override
   protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds;
+    return new HashSet<>(keyPropertyIds.values());
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
index 8727741..a4bf32b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
@@ -19,7 +19,6 @@
 
 package org.apache.ambari.server.controller.internal;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Map;
@@ -41,6 +40,8 @@ import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.state.kerberos.KerberosServiceDescriptorFactory;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
 import com.google.inject.Inject;
 
 
@@ -101,9 +102,37 @@ public class StackServiceResourceProvider extends ReadOnlyResourceProvider {
   private static final String SUPPORT_DELETE_VIA_UI = PropertyHelper.getPropertyId(
       "StackServices", "support_delete_via_ui");
 
-  private static Set<String> pkPropertyIds = new HashSet<>(
-    Arrays.asList(new String[]{STACK_NAME_PROPERTY_ID,
-      STACK_VERSION_PROPERTY_ID, SERVICE_NAME_PROPERTY_ID}));
+  /**
+   * The key property ids for a StackVersion resource.
+   */
+  private static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Type.Stack, STACK_NAME_PROPERTY_ID)
+      .put(Type.StackVersion, STACK_VERSION_PROPERTY_ID)
+      .put(Type.StackService, SERVICE_NAME_PROPERTY_ID)
+      .build();
+
+  /**
+   * The property ids for a StackVersion resource.
+   */
+  private static Set<String> propertyIds = Sets.newHashSet(
+      SERVICE_NAME_PROPERTY_ID,
+      SERVICE_TYPE_PROPERTY_ID,
+      STACK_NAME_PROPERTY_ID,
+      STACK_VERSION_PROPERTY_ID,
+      SERVICE_DISPLAY_NAME_PROPERTY_ID,
+      USER_NAME_PROPERTY_ID,
+      COMMENTS_PROPERTY_ID,
+      SELECTION_PROPERTY_ID,
+      VERSION_PROPERTY_ID,
+      CONFIG_TYPES,
+      REQUIRED_SERVICES_ID,
+      SERVICE_CHECK_SUPPORTED_PROPERTY_ID,
+      CUSTOM_COMMANDS_PROPERTY_ID,
+      SERVICE_PROPERTIES_PROPERTY_ID,
+      CREDENTIAL_STORE_SUPPORTED,
+      CREDENTIAL_STORE_REQUIRED,
+      CREDENTIAL_STORE_ENABLED,
+      SUPPORT_DELETE_VIA_UI);
 
   /**
    * KerberosServiceDescriptorFactory used to create KerberosServiceDescriptor instances
@@ -111,10 +140,8 @@ public class StackServiceResourceProvider extends ReadOnlyResourceProvider {
   @Inject
   private static KerberosServiceDescriptorFactory kerberosServiceDescriptorFactory;
 
-  protected StackServiceResourceProvider(Set<String> propertyIds,
-      Map<Type, String> keyPropertyIds,
-      AmbariManagementController managementController) {
-    super(propertyIds, keyPropertyIds, managementController);
+  protected StackServiceResourceProvider(AmbariManagementController managementController) {
+    super(Type.StackService, propertyIds, keyPropertyIds, managementController);
   }
 
   @Override
@@ -226,7 +253,7 @@ public class StackServiceResourceProvider extends ReadOnlyResourceProvider {
 
   @Override
   protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds;
+    return new HashSet<>(keyPropertyIds.values());
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackVersionResourceProvider.java
index 094c75b..f2e6d1a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackVersionResourceProvider.java
@@ -19,7 +19,6 @@
 
 package org.apache.ambari.server.controller.internal;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Map;
@@ -40,6 +39,9 @@ import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+
 @StaticallyInject
 public class StackVersionResourceProvider extends ReadOnlyResourceProvider {
 
@@ -55,13 +57,32 @@ public class StackVersionResourceProvider extends ReadOnlyResourceProvider {
   public static final String STACK_MIN_JDK     = PropertyHelper.getPropertyId("Versions", "min_jdk");
   public static final String STACK_MAX_JDK     = PropertyHelper.getPropertyId("Versions", "max_jdk");
 
-  private static Set<String> pkPropertyIds = new HashSet<>(
-    Arrays.asList(new String[]{STACK_NAME_PROPERTY_ID, STACK_VERSION_PROPERTY_ID}));
-
-  protected StackVersionResourceProvider(Set<String> propertyIds,
-      Map<Type, String> keyPropertyIds,
-      AmbariManagementController managementController) {
-    super(propertyIds, keyPropertyIds, managementController);
+  /**
+   * The key property ids for a StackVersion resource.
+   */
+  protected static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Type.Stack, STACK_NAME_PROPERTY_ID)
+      .put(Type.StackVersion, STACK_VERSION_PROPERTY_ID)
+      .build();
+
+  /**
+   * The property ids for a StackVersion resource.
+   */
+  protected static Set<String> propertyIds = Sets.newHashSet(
+      STACK_VERSION_PROPERTY_ID,
+      STACK_NAME_PROPERTY_ID,
+      STACK_MIN_VERSION_PROPERTY_ID,
+      STACK_ACTIVE_PROPERTY_ID,
+      STACK_VALID_PROPERTY_ID,
+      STACK_ERROR_SET,
+      STACK_CONFIG_TYPES,
+      STACK_PARENT_PROPERTY_ID,
+      UPGRADE_PACKS_PROPERTY_ID,
+      STACK_MIN_JDK,
+      STACK_MAX_JDK);
+
+  protected StackVersionResourceProvider(AmbariManagementController managementController) {
+    super(Type.StackVersion, propertyIds, keyPropertyIds, managementController);
   }
 
   @Override
@@ -140,7 +161,7 @@ public class StackVersionResourceProvider extends ReadOnlyResourceProvider {
 
   @Override
   protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds;
+    return new HashSet<>(keyPropertyIds.values());
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
index c4251c1..0b9cd79 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
@@ -150,7 +150,7 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im
    * @param managementController  the Ambari management controller
    */
   StageResourceProvider(AmbariManagementController managementController) {
-    super(PROPERTY_IDS, KEY_PROPERTY_IDS, managementController);
+    super(Resource.Type.Stage, PROPERTY_IDS, KEY_PROPERTY_IDS, managementController);
   }
 
   // ----- AbstractResourceProvider ------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProvider.java
index d0c37f5..be28b54 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProvider.java
@@ -18,7 +18,6 @@
 
 package org.apache.ambari.server.controller.internal;
 
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -39,6 +38,9 @@ import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+
 /**
  * DR target cluster resource provider.
  */
@@ -52,20 +54,29 @@ public class TargetClusterResourceProvider extends AbstractDRResourceProvider {
   protected static final String CLUSTER_LOCATIONS_PROPERTY_ID  = PropertyHelper.getPropertyId("Cluster", "locations");
   protected static final String CLUSTER_PROPERTIES_PROPERTY_ID = PropertyHelper.getPropertyId("Cluster", "properties");
 
-  private static Set<String> pkPropertyIds =
-    new HashSet<>(Arrays.asList(new String[]{
-      CLUSTER_NAME_PROPERTY_ID}));
+  /**
+   * The key property ids for a TargetCluster resource.
+   */
+  private static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Resource.Type.Cluster, CLUSTER_NAME_PROPERTY_ID)
+      .build();
+
+  /**
+   * The property ids for a TargetCluster resource.
+   */
+  private static Set<String> propertyIds = Sets.newHashSet(
+      CLUSTER_NAME_PROPERTY_ID,
+      CLUSTER_COLO_PROPERTY_ID,
+      CLUSTER_INTERFACES_PROPERTY_ID,
+      CLUSTER_LOCATIONS_PROPERTY_ID,
+      CLUSTER_PROPERTIES_PROPERTY_ID);
 
   /**
    * Construct a provider.
    *
    * @param ivoryService    the ivory service
-   * @param propertyIds     the properties associated with this provider
-   * @param keyPropertyIds  the key property ids
    */
-  public TargetClusterResourceProvider(IvoryService ivoryService,
-                                       Set<String> propertyIds,
-                                       Map<Resource.Type, String> keyPropertyIds) {
+  public TargetClusterResourceProvider(IvoryService ivoryService) {
     super(propertyIds, keyPropertyIds, ivoryService);
   }
 
@@ -151,7 +162,7 @@ public class TargetClusterResourceProvider extends AbstractDRResourceProvider {
 
   @Override
   protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds;
+    return new HashSet<>(keyPropertyIds.values());
   }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskAttemptResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskAttemptResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskAttemptResourceProvider.java
index 3af7bb1..a6df9be 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskAttemptResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskAttemptResourceProvider.java
@@ -22,7 +22,6 @@ import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -45,6 +44,9 @@ import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+
 /**
  * Resource provider for task attempt resources.
  */
@@ -81,23 +83,41 @@ public class TaskAttemptResourceProvider extends
   protected static final String TASK_ATTEMPT_LOCALITY_PROPERTY_ID = PropertyHelper
       .getPropertyId("TaskAttempt", "locality");
 
-  private static final Set<String> pkPropertyIds = new HashSet<>(
-    Arrays.asList(new String[]{TASK_ATTEMPT_CLUSTER_NAME_PROPERTY_ID,
-      TASK_ATTEMPT_WORKFLOW_ID_PROPERTY_ID,
-      TASK_ATTEMPT_JOB_ID_PROPERTY_ID, TASK_ATTEMPT_ID_PROPERTY_ID}));
-
   protected TaskAttemptFetcher taskAttemptFetcher;
 
   /**
+   * The key property ids for a TaskAttempt resource.
+   */
+  protected static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Type.Cluster, TASK_ATTEMPT_CLUSTER_NAME_PROPERTY_ID)
+      .put(Type.Workflow, TASK_ATTEMPT_WORKFLOW_ID_PROPERTY_ID)
+      .put(Type.Job, TASK_ATTEMPT_JOB_ID_PROPERTY_ID)
+      .put(Type.TaskAttempt, TASK_ATTEMPT_ID_PROPERTY_ID)
+      .build();
+
+  /**
+   * The property ids for a TaskAttempt resource.
+   */
+  protected static Set<String> propertyIds = Sets.newHashSet(
+      TASK_ATTEMPT_CLUSTER_NAME_PROPERTY_ID,
+      TASK_ATTEMPT_WORKFLOW_ID_PROPERTY_ID,
+      TASK_ATTEMPT_JOB_ID_PROPERTY_ID,
+      TASK_ATTEMPT_ID_PROPERTY_ID,
+      TASK_ATTEMPT_TYPE_PROPERTY_ID,
+      TASK_ATTEMPT_START_TIME_PROPERTY_ID,
+      TASK_ATTEMPT_FINISH_TIME_PROPERTY_ID,
+      TASK_ATTEMPT_MAP_FINISH_TIME_PROPERTY_ID,
+      TASK_ATTEMPT_SHUFFLE_FINISH_TIME_PROPERTY_ID,
+      TASK_ATTEMPT_SORT_FINISH_TIME_PROPERTY_ID,
+      TASK_ATTEMPT_INPUT_BYTES_PROPERTY_ID,
+      TASK_ATTEMPT_OUTPUT_BYTES_PROPERTY_ID,
+      TASK_ATTEMPT_STATUS_PROPERTY_ID,
+      TASK_ATTEMPT_LOCALITY_PROPERTY_ID);
+
+  /**
    * Create a new task attempt resource provider.
-   * 
-   * @param propertyIds
-   *          the property ids
-   * @param keyPropertyIds
-   *          the key property ids
    */
-  protected TaskAttemptResourceProvider(Set<String> propertyIds,
-      Map<Type,String> keyPropertyIds) {
+  protected TaskAttemptResourceProvider() {
     super(propertyIds, keyPropertyIds);
     taskAttemptFetcher = new PostgresTaskAttemptFetcher(
         new JobHistoryPostgresConnectionFactory());
@@ -166,16 +186,11 @@ public class TaskAttemptResourceProvider extends
 
   @Override
   protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds;
+    return new HashSet<>(keyPropertyIds.values());
   }
 
   @Override
   public Map<Type,String> getKeyPropertyIds() {
-    Map<Type,String> keyPropertyIds = new HashMap<>();
-    keyPropertyIds.put(Type.Cluster, TASK_ATTEMPT_CLUSTER_NAME_PROPERTY_ID);
-    keyPropertyIds.put(Type.Workflow, TASK_ATTEMPT_WORKFLOW_ID_PROPERTY_ID);
-    keyPropertyIds.put(Type.Job, TASK_ATTEMPT_JOB_ID_PROPERTY_ID);
-    keyPropertyIds.put(Type.TaskAttempt, TASK_ATTEMPT_ID_PROPERTY_ID);
     return keyPropertyIds;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
index 39419ec..c81742f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
@@ -18,7 +18,6 @@
 package org.apache.ambari.server.controller.internal;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
@@ -47,6 +46,7 @@ import org.codehaus.jackson.map.ObjectMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.ImmutableMap;
 import com.google.inject.Inject;
 
 /**
@@ -81,9 +81,6 @@ public class TaskResourceProvider extends AbstractControllerResourceProvider {
   public static final String TASK_CUST_CMD_NAME_PROPERTY_ID  = PropertyHelper.getPropertyId("Tasks", "custom_command_name");
   public static final String TASK_COMMAND_OPS_DISPLAY_NAME  = PropertyHelper.getPropertyId("Tasks", "ops_display_name");
 
-  private static Set<String> pkPropertyIds =
-    new HashSet<>(Arrays.asList(new String[]{
-      TASK_ID_PROPERTY_ID}));
 
   /**
    * The property ids for a task resource.
@@ -116,6 +113,18 @@ public class TaskResourceProvider extends AbstractControllerResourceProvider {
   }
 
   /**
+   * The key property ids for a task resource.
+   */
+  private static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Resource.Type.Cluster, TASK_CLUSTER_NAME_PROPERTY_ID)
+      .put(Resource.Type.Request, TASK_REQUEST_ID_PROPERTY_ID)
+      .put(Resource.Type.Upgrade, TASK_REQUEST_ID_PROPERTY_ID)
+      .put(Resource.Type.Stage, TASK_STAGE_ID_PROPERTY_ID)
+      .put(Resource.Type.UpgradeItem, TASK_STAGE_ID_PROPERTY_ID)
+      .put(Resource.Type.Task, TASK_ID_PROPERTY_ID)
+      .build();
+
+  /**
    * Used for querying tasks.
    */
   @Inject
@@ -140,14 +149,10 @@ public class TaskResourceProvider extends AbstractControllerResourceProvider {
   /**
    * Create a  new resource provider for the given management controller.
    *
-   * @param propertyIds           the property ids
-   * @param keyPropertyIds        the key property ids
    * @param managementController  the management controller
    */
-  TaskResourceProvider(Set<String> propertyIds,
-                       Map<Resource.Type, String> keyPropertyIds,
-                       AmbariManagementController managementController) {
-    super(propertyIds, keyPropertyIds, managementController);
+  TaskResourceProvider(AmbariManagementController managementController) {
+    super(Resource.Type.Task, PROPERTY_IDS, keyPropertyIds, managementController);
   }
 
   // ----- ResourceProvider ------------------------------------------------
@@ -284,7 +289,7 @@ public class TaskResourceProvider extends AbstractControllerResourceProvider {
 
   @Override
   protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds;
+    return new HashSet<>(keyPropertyIds.values());
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ThemeArtifactResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ThemeArtifactResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ThemeArtifactResourceProvider.java
index affd969..46dd914 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ThemeArtifactResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ThemeArtifactResourceProvider.java
@@ -93,7 +93,7 @@ public class ThemeArtifactResourceProvider extends AbstractControllerResourcePro
    * @param managementController the management controller
    */
   protected ThemeArtifactResourceProvider(AmbariManagementController managementController) {
-    super(propertyIds, keyPropertyIds, managementController);
+    super(Resource.Type.Theme, propertyIds, keyPropertyIds, managementController);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeGroupResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeGroupResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeGroupResourceProvider.java
index e6aafc1..913375a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeGroupResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeGroupResourceProvider.java
@@ -102,7 +102,7 @@ public class UpgradeGroupResourceProvider extends AbstractControllerResourceProv
    * @param controller the controller
    */
   UpgradeGroupResourceProvider(AmbariManagementController controller) {
-    super(PROPERTY_IDS, KEY_PROPERTY_IDS, controller);
+    super(Resource.Type.UpgradeGroup, PROPERTY_IDS, KEY_PROPERTY_IDS, controller);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
index 93b3e46..02c9a99 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
@@ -119,7 +119,7 @@ public class UpgradeItemResourceProvider extends ReadOnlyResourceProvider {
    * @param controller  the controller
    */
   UpgradeItemResourceProvider(AmbariManagementController controller) {
-    super(PROPERTY_IDS, KEY_PROPERTY_IDS, controller);
+    super(Resource.Type.UpgradeItem, PROPERTY_IDS, KEY_PROPERTY_IDS, controller);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index bab5369..1fbf130 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -298,7 +298,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
    */
   @Inject
   public UpgradeResourceProvider(@Assisted AmbariManagementController controller) {
-    super(PROPERTY_IDS, KEY_PROPERTY_IDS, controller);
+    super(Resource.Type.Upgrade, PROPERTY_IDS, KEY_PROPERTY_IDS, controller);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProvider.java
index 94b2b4a..db9ad2a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProvider.java
@@ -102,7 +102,7 @@ public class UpgradeSummaryResourceProvider extends AbstractControllerResourcePr
    * @param controller the controller
    */
   public UpgradeSummaryResourceProvider(AmbariManagementController controller) {
-    super(PROPERTY_IDS, KEY_PROPERTY_IDS, controller);
+    super(Resource.Type.UpgradeSummary, PROPERTY_IDS, KEY_PROPERTY_IDS, controller);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserAuthorizationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserAuthorizationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserAuthorizationResourceProvider.java
index 95550f0..c818846 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserAuthorizationResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserAuthorizationResourceProvider.java
@@ -128,7 +128,7 @@ public class UserAuthorizationResourceProvider extends ReadOnlyResourceProvider
    * Create a new resource provider.
    */
   public UserAuthorizationResourceProvider(AmbariManagementController managementController) {
-    super(PROPERTY_IDS, KEY_PROPERTY_IDS, managementController);
+    super(Type.UserAuthorization, PROPERTY_IDS, KEY_PROPERTY_IDS, managementController);
 
     clusterController = ClusterControllerHelper.getClusterController();
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProvider.java
index 614f7ab..1f43383 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProvider.java
@@ -19,7 +19,6 @@ package org.apache.ambari.server.controller.internal;
 
 import java.util.Collection;
 import java.util.EnumSet;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
@@ -57,6 +56,8 @@ import org.apache.ambari.server.security.authorization.Users;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
 
 /**
  * Resource provider for user privilege resources.
@@ -103,20 +104,18 @@ public class UserPrivilegeResourceProvider extends ReadOnlyResourceProvider {
   /**
    * The property ids for a privilege resource.
    */
-  private static Set<String> propertyIds = new HashSet<>();
-  static {
-    propertyIds.add(PRIVILEGE_PRIVILEGE_ID_PROPERTY_ID);
-    propertyIds.add(PRIVILEGE_PERMISSION_NAME_PROPERTY_ID);
-    propertyIds.add(PRIVILEGE_PERMISSION_LABEL_PROPERTY_ID);
-    propertyIds.add(PRIVILEGE_PRINCIPAL_NAME_PROPERTY_ID);
-    propertyIds.add(PRIVILEGE_PRINCIPAL_TYPE_PROPERTY_ID);
-    propertyIds.add(PRIVILEGE_VIEW_NAME_PROPERTY_ID);
-    propertyIds.add(PRIVILEGE_VIEW_VERSION_PROPERTY_ID);
-    propertyIds.add(PRIVILEGE_INSTANCE_NAME_PROPERTY_ID);
-    propertyIds.add(PRIVILEGE_CLUSTER_NAME_PROPERTY_ID);
-    propertyIds.add(PRIVILEGE_TYPE_PROPERTY_ID);
-    propertyIds.add(PRIVILEGE_USER_NAME_PROPERTY_ID);
-  }
+  private static Set<String> propertyIds = Sets.newHashSet(
+      PRIVILEGE_PRIVILEGE_ID_PROPERTY_ID,
+      PRIVILEGE_PERMISSION_NAME_PROPERTY_ID,
+      PRIVILEGE_PERMISSION_LABEL_PROPERTY_ID,
+      PRIVILEGE_PRINCIPAL_NAME_PROPERTY_ID,
+      PRIVILEGE_PRINCIPAL_TYPE_PROPERTY_ID,
+      PRIVILEGE_VIEW_NAME_PROPERTY_ID,
+      PRIVILEGE_VIEW_VERSION_PROPERTY_ID,
+      PRIVILEGE_INSTANCE_NAME_PROPERTY_ID,
+      PRIVILEGE_CLUSTER_NAME_PROPERTY_ID,
+      PRIVILEGE_TYPE_PROPERTY_ID,
+      PRIVILEGE_USER_NAME_PROPERTY_ID);
 
   /**
    * Static initialization.
@@ -145,11 +144,10 @@ public class UserPrivilegeResourceProvider extends ReadOnlyResourceProvider {
   /**
    * The key property ids for a privilege resource.
    */
-  private static Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
-  static {
-    keyPropertyIds.put(Resource.Type.User, PRIVILEGE_USER_NAME_PROPERTY_ID);
-    keyPropertyIds.put(Resource.Type.UserPrivilege, PRIVILEGE_PRIVILEGE_ID_PROPERTY_ID);
-  }
+  private static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Resource.Type.User, PRIVILEGE_USER_NAME_PROPERTY_ID)
+      .put(Resource.Type.UserPrivilege, PRIVILEGE_PRIVILEGE_ID_PROPERTY_ID)
+      .build();
 
   private ThreadLocal<LoadingCache<Long, ClusterEntity>> clusterCache =
       new ThreadLocal<LoadingCache<Long, ClusterEntity>>(){
@@ -237,7 +235,7 @@ public class UserPrivilegeResourceProvider extends ReadOnlyResourceProvider {
    * Constructor.
    */
   public UserPrivilegeResourceProvider() {
-    super(propertyIds, keyPropertyIds, null);
+    super(Resource.Type.UserPrivilege, propertyIds, keyPropertyIds, null);
 
     EnumSet<RoleAuthorization> requiredAuthorizations = EnumSet.of(RoleAuthorization.AMBARI_ASSIGN_ROLES);
     setRequiredCreateAuthorizations(requiredAuthorizations);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
index 698f419..f0709aa 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
@@ -17,7 +17,6 @@
  */
 package org.apache.ambari.server.controller.internal;
 
-import java.util.Arrays;
 import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Map;
@@ -44,6 +43,9 @@ import org.apache.ambari.server.security.authorization.RoleAuthorization;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+
 /**
  * Resource provider for user resources.
  */
@@ -63,17 +65,30 @@ public class UserResourceProvider extends AbstractControllerResourceProvider imp
   public static final String USER_GROUPS_PROPERTY_ID       = PropertyHelper.getPropertyId("Users", "groups");
   public static final String USER_ADMIN_PROPERTY_ID        = PropertyHelper.getPropertyId("Users", "admin");
 
-  private static Set<String> pkPropertyIds =
-    new HashSet<>(Arrays.asList(new String[]{
-      USER_USERNAME_PROPERTY_ID}));
+  /**
+   * The key property ids for a User resource.
+   */
+  private static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Resource.Type.User, USER_USERNAME_PROPERTY_ID)
+      .build();
 
   /**
+   * The property ids for a User resource.
+   */
+  private static Set<String> propertyIds = Sets.newHashSet(
+      USER_USERNAME_PROPERTY_ID,
+      USER_PASSWORD_PROPERTY_ID,
+      USER_OLD_PASSWORD_PROPERTY_ID,
+      USER_LDAP_USER_PROPERTY_ID,
+      USER_TYPE_PROPERTY_ID,
+      USER_ACTIVE_PROPERTY_ID,
+      USER_GROUPS_PROPERTY_ID,
+      USER_ADMIN_PROPERTY_ID);
+  /**
    * Create a new resource provider for the given management controller.
    */
-  UserResourceProvider(Set<String> propertyIds,
-                       Map<Resource.Type, String> keyPropertyIds,
-                       AmbariManagementController managementController) {
-    super(propertyIds, keyPropertyIds, managementController);
+  UserResourceProvider(AmbariManagementController managementController) {
+    super(Resource.Type.User, propertyIds, keyPropertyIds, managementController);
 
     setRequiredCreateAuthorizations(EnumSet.of(RoleAuthorization.AMBARI_MANAGE_USERS));
     setRequiredDeleteAuthorizations(EnumSet.of(RoleAuthorization.AMBARI_MANAGE_USERS));
@@ -224,7 +239,7 @@ public class UserResourceProvider extends AbstractControllerResourceProvider imp
 
   @Override
   protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds;
+    return new HashSet<>(keyPropertyIds.values());
   }
 
   private UserRequest getRequest(Map<String, Object> properties) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ValidationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ValidationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ValidationResourceProvider.java
index 5448784..7252212 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ValidationResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ValidationResourceProvider.java
@@ -45,6 +45,9 @@ import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+
 public class ValidationResourceProvider extends StackAdvisorResourceProvider {
 
   private static final Logger LOG = LoggerFactory.getLogger(ValidationResourceProvider.class);
@@ -54,20 +57,59 @@ public class ValidationResourceProvider extends StackAdvisorResourceProvider {
   protected static final String VALIDATE_PROPERTY_ID = "validate";
 
   protected static final String ITEMS_PROPERTY_ID = "items";
-  protected static final String ITEMS_TYPE_PROPERTY_ID = "type";
-  protected static final String ITEMS_LEVE_PROPERTY_ID = "level";
-  protected static final String ITEMS_MESSAGE_PROPERTY_ID = "message";
-  protected static final String ITEMS_COMPONENT_NAME_PROPERTY_ID = "component-name";
-  protected static final String ITEMS_HOST_PROPERTY_ID = "host";
-  protected static final String ITEMS_CONFIG_TYPE_PROPERTY_ID = "config-type";
-  protected static final String ITEMS_CONFIG_NAME_PROPERTY_ID = "config-name";
-
-  private static Set<String> pkPropertyIds = new HashSet<>(
-    Arrays.asList(new String[]{VALIDATION_ID_PROPERTY_ID}));
-
-  protected ValidationResourceProvider(Set<String> propertyIds, Map<Type, String> keyPropertyIds,
-      AmbariManagementController managementController) {
-    super(propertyIds, keyPropertyIds, managementController);
+  protected static final String TYPE_PROPERTY_ID = "type";
+  protected static final String LEVE_PROPERTY_ID = "level";
+  protected static final String MESSAGE_PROPERTY_ID = "message";
+  protected static final String COMPONENT_NAME_PROPERTY_ID = "component-name";
+  protected static final String HOST_PROPERTY_ID = "host";
+  protected static final String CONFIG_TYPE_PROPERTY_ID = "config-type";
+  protected static final String CONFIG_NAME_PROPERTY_ID = "config-name";
+  protected static final String HOST_GROUP_PROPERTY_ID = "host-group";
+  protected static final String HOSTS_PROPERTY_ID = "hosts";
+  protected static final String SERVICES_PROPERTY_ID = "services";
+  protected static final String RECOMMENDATIONS_PROPERTY_ID = "recommendations";
+
+  protected static final String ITEMS_TYPE_PROPERTY_ID = PropertyHelper.getPropertyId(ITEMS_PROPERTY_ID, TYPE_PROPERTY_ID);
+  protected static final String ITEMS_LEVE_PROPERTY_ID =  PropertyHelper.getPropertyId(ITEMS_PROPERTY_ID, LEVE_PROPERTY_ID);
+  protected static final String ITEMS_MESSAGE_PROPERTY_ID =  PropertyHelper.getPropertyId(ITEMS_PROPERTY_ID, MESSAGE_PROPERTY_ID);
+  protected static final String ITEMS_COMPONENT_NAME_PROPERTY_ID =  PropertyHelper.getPropertyId(ITEMS_PROPERTY_ID, COMPONENT_NAME_PROPERTY_ID);
+  protected static final String ITEMS_HOST_PROPERTY_ID =  PropertyHelper.getPropertyId(ITEMS_PROPERTY_ID, HOST_PROPERTY_ID);
+  protected static final String ITEMS_CONFIG_TYPE_PROPERTY_ID =  PropertyHelper.getPropertyId(ITEMS_PROPERTY_ID, CONFIG_TYPE_PROPERTY_ID);
+  protected static final String ITEMS_CONFIG_NAME_PROPERTY_ID =  PropertyHelper.getPropertyId(ITEMS_PROPERTY_ID, CONFIG_NAME_PROPERTY_ID);
+  protected static final String ITEMS_HOST_GROUP_PROPERTY_ID = PropertyHelper.getPropertyId(ITEMS_PROPERTY_ID, HOST_GROUP_PROPERTY_ID);
+
+  /**
+   * The key property ids for a Validation resource.
+   */
+  private static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Type.Validation, VALIDATION_ID_PROPERTY_ID)
+      .put(Type.Stack, STACK_NAME_PROPERTY_ID)
+      .put(Type.StackVersion, STACK_VERSION_PROPERTY_ID)
+      .build();
+
+  /**
+   * The property ids for a Validation resource.
+   */
+  private static Set<String> propertyIds = Sets.newHashSet(
+      VALIDATION_ID_PROPERTY_ID,
+      VALIDATE_PROPERTY_ID,
+      ITEMS_PROPERTY_ID,
+      STACK_NAME_PROPERTY_ID,
+      STACK_VERSION_PROPERTY_ID,
+      ITEMS_TYPE_PROPERTY_ID,
+      ITEMS_LEVE_PROPERTY_ID,
+      ITEMS_MESSAGE_PROPERTY_ID,
+      ITEMS_COMPONENT_NAME_PROPERTY_ID,
+      ITEMS_HOST_PROPERTY_ID,
+      ITEMS_CONFIG_TYPE_PROPERTY_ID,
+      ITEMS_CONFIG_NAME_PROPERTY_ID,
+      ITEMS_HOST_GROUP_PROPERTY_ID,
+      HOSTS_PROPERTY_ID,
+      SERVICES_PROPERTY_ID,
+      RECOMMENDATIONS_PROPERTY_ID);
+
+  protected ValidationResourceProvider(AmbariManagementController managementController) {
+    super(Type.Validation, propertyIds, keyPropertyIds, managementController);
   }
 
   @Override
@@ -105,19 +147,19 @@ public class ValidationResourceProvider extends StackAdvisorResourceProvider {
         Set<ValidationItem> items = response.getItems();
         for (ValidationItem item : items) {
           Map<String, Object> mapItemProps = new HashMap<>();
-          mapItemProps.put(ITEMS_TYPE_PROPERTY_ID, item.getType());
-          mapItemProps.put(ITEMS_LEVE_PROPERTY_ID, item.getLevel());
-          mapItemProps.put(ITEMS_MESSAGE_PROPERTY_ID, item.getMessage());
+          mapItemProps.put(TYPE_PROPERTY_ID, item.getType());
+          mapItemProps.put(LEVE_PROPERTY_ID, item.getLevel());
+          mapItemProps.put(MESSAGE_PROPERTY_ID, item.getMessage());
 
           if (item.getComponentName() != null) {
-            mapItemProps.put(ITEMS_COMPONENT_NAME_PROPERTY_ID, item.getComponentName());
+            mapItemProps.put(COMPONENT_NAME_PROPERTY_ID, item.getComponentName());
           }
           if (item.getHost() != null) {
-            mapItemProps.put(ITEMS_HOST_PROPERTY_ID, item.getHost());
+            mapItemProps.put(HOST_PROPERTY_ID, item.getHost());
           }
           if (item.getConfigType() != null) {
-            mapItemProps.put(ITEMS_CONFIG_TYPE_PROPERTY_ID, item.getConfigType());
-            mapItemProps.put(ITEMS_CONFIG_NAME_PROPERTY_ID, item.getConfigName());
+            mapItemProps.put(CONFIG_TYPE_PROPERTY_ID, item.getConfigType());
+            mapItemProps.put(CONFIG_NAME_PROPERTY_ID, item.getConfigName());
           }
           listItemProps.add(mapItemProps);
         }
@@ -134,7 +176,7 @@ public class ValidationResourceProvider extends StackAdvisorResourceProvider {
 
   @Override
   protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds;
+    return new HashSet<>(keyPropertyIds.values());
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java
index c34c94d..d7d5e30 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java
@@ -184,7 +184,7 @@ public class VersionDefinitionResourceProvider extends AbstractAuthorizedResourc
    * Constructor.
    */
   VersionDefinitionResourceProvider() {
-    super(PROPERTY_IDS, KEY_PROPERTY_IDS);
+    super(Resource.Type.VersionDefinition, PROPERTY_IDS, KEY_PROPERTY_IDS);
 
     setRequiredCreateAuthorizations(EnumSet.of(RoleAuthorization.AMBARI_MANAGE_STACK_VERSIONS));
     setRequiredGetAuthorizations(EnumSet.of(RoleAuthorization.AMBARI_MANAGE_STACK_VERSIONS));

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java
index 9562782..f191255 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java
@@ -50,6 +50,8 @@ import org.apache.ambari.server.view.validation.ValidationResultImpl;
 import org.apache.ambari.view.ClusterType;
 import org.apache.ambari.view.validation.Validator;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
 import com.google.inject.Inject;
 import com.google.inject.persist.Transactional;
 
@@ -91,37 +93,34 @@ public class ViewInstanceResourceProvider extends AbstractAuthorizedResourceProv
   /**
    * The key property ids for a view instance resource.
    */
-  private static Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
-  static {
-    keyPropertyIds.put(Resource.Type.View, VIEW_NAME_PROPERTY_ID);
-    keyPropertyIds.put(Resource.Type.ViewVersion, VIEW_VERSION_PROPERTY_ID);
-    keyPropertyIds.put(Resource.Type.ViewInstance, INSTANCE_NAME_PROPERTY_ID);
-  }
+  private static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Resource.Type.View, VIEW_NAME_PROPERTY_ID)
+      .put(Resource.Type.ViewVersion, VIEW_VERSION_PROPERTY_ID)
+      .put(Resource.Type.ViewInstance, INSTANCE_NAME_PROPERTY_ID)
+      .build();
 
   /**
    * The property ids for a view instance resource.
    */
-  private static Set<String> propertyIds = new HashSet<>();
-  static {
-    propertyIds.add(VIEW_NAME_PROPERTY_ID);
-    propertyIds.add(VIEW_VERSION_PROPERTY_ID);
-    propertyIds.add(INSTANCE_NAME_PROPERTY_ID);
-    propertyIds.add(LABEL_PROPERTY_ID);
-    propertyIds.add(DESCRIPTION_PROPERTY_ID);
-    propertyIds.add(VISIBLE_PROPERTY_ID);
-    propertyIds.add(ICON_PATH_ID);
-    propertyIds.add(ICON64_PATH_ID);
-    propertyIds.add(PROPERTIES_PROPERTY_ID);
-    propertyIds.add(DATA_PROPERTY_ID);
-    propertyIds.add(CONTEXT_PATH_PROPERTY_ID);
-    propertyIds.add(STATIC_PROPERTY_ID);
-    propertyIds.add(CLUSTER_HANDLE_PROPERTY_ID);
-    propertyIds.add(CLUSTER_TYPE_PROPERTY_ID);
-    propertyIds.add(SHORT_URL_PROPERTY_ID);
-    propertyIds.add(SHORT_URL_NAME_PROPERTY_ID);
-    propertyIds.add(VALIDATION_RESULT_PROPERTY_ID);
-    propertyIds.add(PROPERTY_VALIDATION_RESULTS_PROPERTY_ID);
-  }
+  private static Set<String> propertyIds = Sets.newHashSet(
+      VIEW_NAME_PROPERTY_ID,
+      VIEW_VERSION_PROPERTY_ID,
+      INSTANCE_NAME_PROPERTY_ID,
+      LABEL_PROPERTY_ID,
+      DESCRIPTION_PROPERTY_ID,
+      VISIBLE_PROPERTY_ID,
+      ICON_PATH_ID,
+      ICON64_PATH_ID,
+      PROPERTIES_PROPERTY_ID,
+      DATA_PROPERTY_ID,
+      CONTEXT_PATH_PROPERTY_ID,
+      STATIC_PROPERTY_ID,
+      CLUSTER_HANDLE_PROPERTY_ID,
+      CLUSTER_TYPE_PROPERTY_ID,
+      SHORT_URL_PROPERTY_ID,
+      SHORT_URL_NAME_PROPERTY_ID,
+      VALIDATION_RESULT_PROPERTY_ID,
+      PROPERTY_VALIDATION_RESULTS_PROPERTY_ID);
 
   // ----- Constructors ------------------------------------------------------
 
@@ -130,7 +129,7 @@ public class ViewInstanceResourceProvider extends AbstractAuthorizedResourceProv
    */
   @Inject
   public ViewInstanceResourceProvider() {
-    super(propertyIds, keyPropertyIds);
+    super(Resource.Type.ViewInstance, propertyIds, keyPropertyIds);
 
     EnumSet<RoleAuthorization> requiredAuthorizations = EnumSet.of(RoleAuthorization.AMBARI_MANAGE_VIEWS);
     setRequiredCreateAuthorizations(requiredAuthorizations);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewPermissionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewPermissionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewPermissionResourceProvider.java
index c1846bb..5b354c4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewPermissionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewPermissionResourceProvider.java
@@ -18,7 +18,6 @@
 
 package org.apache.ambari.server.controller.internal;
 
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
@@ -39,6 +38,9 @@ import org.apache.ambari.server.orm.entities.ResourceTypeEntity;
 import org.apache.ambari.server.orm.entities.ViewEntity;
 import org.apache.ambari.server.view.ViewRegistry;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+
 /**
  * Resource provider for custom view permissions.
  */
@@ -62,24 +64,21 @@ public class ViewPermissionResourceProvider extends AbstractResourceProvider {
   /**
    * The key property ids for a permission resource.
    */
-  private static Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
-  static {
-    keyPropertyIds.put(Resource.Type.View, VIEW_NAME_PROPERTY_ID);
-    keyPropertyIds.put(Resource.Type.ViewVersion, VIEW_VERSION_PROPERTY_ID);
-    keyPropertyIds.put(Resource.Type.ViewPermission, PERMISSION_ID_PROPERTY_ID);
-  }
+  private static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Resource.Type.View, VIEW_NAME_PROPERTY_ID)
+      .put(Resource.Type.ViewVersion, VIEW_VERSION_PROPERTY_ID)
+      .put(Resource.Type.ViewPermission, PERMISSION_ID_PROPERTY_ID)
+      .build();
 
   /**
    * The property ids for a permission resource.
    */
-  private static Set<String> propertyIds = new HashSet<>();
-  static {
-    propertyIds.add(VIEW_NAME_PROPERTY_ID);
-    propertyIds.add(VIEW_VERSION_PROPERTY_ID);
-    propertyIds.add(PERMISSION_ID_PROPERTY_ID);
-    propertyIds.add(PERMISSION_NAME_PROPERTY_ID);
-    propertyIds.add(RESOURCE_NAME_PROPERTY_ID);
-  }
+  private static Set<String> propertyIds = Sets.newHashSet(
+      VIEW_NAME_PROPERTY_ID,
+      VIEW_VERSION_PROPERTY_ID,
+      PERMISSION_ID_PROPERTY_ID,
+      PERMISSION_NAME_PROPERTY_ID,
+      RESOURCE_NAME_PROPERTY_ID);
 
 
   // ----- Constructors ------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewPrivilegeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewPrivilegeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewPrivilegeResourceProvider.java
index eb57759..2d6f119 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewPrivilegeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewPrivilegeResourceProvider.java
@@ -38,6 +38,9 @@ import org.apache.ambari.server.security.authorization.ResourceType;
 import org.apache.ambari.server.security.authorization.RoleAuthorization;
 import org.apache.ambari.server.view.ViewRegistry;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+
 /**
  * Resource provider for view privilege resources.
  */
@@ -53,28 +56,25 @@ public class ViewPrivilegeResourceProvider extends PrivilegeResourceProvider<Vie
   /**
    * The property ids for a privilege resource.
    */
-  private static Set<String> propertyIds = new HashSet<>();
-  static {
-    propertyIds.add(PRIVILEGE_VIEW_NAME_PROPERTY_ID);
-    propertyIds.add(PRIVILEGE_VIEW_VERSION_PROPERTY_ID);
-    propertyIds.add(PRIVILEGE_INSTANCE_NAME_PROPERTY_ID);
-    propertyIds.add(PRIVILEGE_ID_PROPERTY_ID);
-    propertyIds.add(PERMISSION_NAME_PROPERTY_ID);
-    propertyIds.add(PERMISSION_LABEL_PROPERTY_ID);
-    propertyIds.add(PRINCIPAL_NAME_PROPERTY_ID);
-    propertyIds.add(PRINCIPAL_TYPE_PROPERTY_ID);
-  }
+  private static Set<String> propertyIds = Sets.newHashSet(
+      PRIVILEGE_VIEW_NAME_PROPERTY_ID,
+      PRIVILEGE_VIEW_VERSION_PROPERTY_ID,
+      PRIVILEGE_INSTANCE_NAME_PROPERTY_ID,
+      PRIVILEGE_ID_PROPERTY_ID,
+      PERMISSION_NAME_PROPERTY_ID,
+      PERMISSION_LABEL_PROPERTY_ID,
+      PRINCIPAL_NAME_PROPERTY_ID,
+      PRINCIPAL_TYPE_PROPERTY_ID);
 
   /**
    * The key property ids for a privilege resource.
    */
-  private static Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
-  static {
-    keyPropertyIds.put(Resource.Type.View, PRIVILEGE_VIEW_NAME_PROPERTY_ID);
-    keyPropertyIds.put(Resource.Type.ViewVersion, PRIVILEGE_VIEW_VERSION_PROPERTY_ID);
-    keyPropertyIds.put(Resource.Type.ViewInstance, PRIVILEGE_INSTANCE_NAME_PROPERTY_ID);
-    keyPropertyIds.put(Resource.Type.ViewPrivilege, PRIVILEGE_ID_PROPERTY_ID);
-  }
+  private static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Resource.Type.View, PRIVILEGE_VIEW_NAME_PROPERTY_ID)
+      .put(Resource.Type.ViewVersion, PRIVILEGE_VIEW_VERSION_PROPERTY_ID)
+      .put(Resource.Type.ViewInstance, PRIVILEGE_INSTANCE_NAME_PROPERTY_ID)
+      .put(Resource.Type.ViewPrivilege, PRIVILEGE_ID_PROPERTY_ID)
+      .build();
 
   /**
    * The built-in VIEW.USER permission.

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewResourceProvider.java
index 7179b33..c8044c3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewResourceProvider.java
@@ -20,7 +20,6 @@ package org.apache.ambari.server.controller.internal;
 
 import java.util.Collections;
 import java.util.EnumSet;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
@@ -38,6 +37,9 @@ import org.apache.ambari.server.orm.entities.ViewEntity;
 import org.apache.ambari.server.security.authorization.RoleAuthorization;
 import org.apache.ambari.server.view.ViewRegistry;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+
 /**
  * Resource provider for view instances.
  */
@@ -52,18 +54,15 @@ public class ViewResourceProvider extends AbstractAuthorizedResourceProvider {
   /**
    * The key property ids for a view resource.
    */
-  private static Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
-  static {
-    keyPropertyIds.put(Resource.Type.View, VIEW_NAME_PROPERTY_ID);
-  }
+  private static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Resource.Type.View, VIEW_NAME_PROPERTY_ID)
+      .build();
 
   /**
    * The property ids for a view resource.
    */
-  private static Set<String> propertyIds = new HashSet<>();
-  static {
-    propertyIds.add(VIEW_NAME_PROPERTY_ID);
-  }
+  private static Set<String> propertyIds = Sets.newHashSet(
+      VIEW_NAME_PROPERTY_ID);
 
 
   // ----- Constructors ------------------------------------------------------
@@ -72,7 +71,7 @@ public class ViewResourceProvider extends AbstractAuthorizedResourceProvider {
    * Construct a view resource provider.
    */
   public ViewResourceProvider() {
-    super(propertyIds, keyPropertyIds);
+    super(Resource.Type.View, propertyIds, keyPropertyIds);
 
     EnumSet<RoleAuthorization> requiredAuthorizations = EnumSet.of(RoleAuthorization.AMBARI_MANAGE_VIEWS);
     setRequiredCreateAuthorizations(requiredAuthorizations);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewURLResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewURLResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewURLResourceProvider.java
index cb506be..ca9aadf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewURLResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewURLResourceProvider.java
@@ -19,7 +19,6 @@
 package org.apache.ambari.server.controller.internal;
 
 import java.util.EnumSet;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -48,6 +47,7 @@ import org.apache.ambari.server.view.validation.ValidationException;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Sets;
 import com.google.inject.Inject;
 
@@ -70,22 +70,19 @@ public class ViewURLResourceProvider extends AbstractAuthorizedResourceProvider
   /**
    * The key property ids for a view URL resource.
    */
-  private static Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
-  static {
-    keyPropertyIds.put(Resource.Type.ViewURL, URL_NAME_PROPERTY_ID);
-  }
+  private static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Resource.Type.ViewURL, URL_NAME_PROPERTY_ID)
+      .build();
 
   /**
    * The property ids for a view URL resource.
    */
-  private static Set<String> propertyIds = new HashSet<>();
-  static {
-    propertyIds.add(URL_NAME_PROPERTY_ID);
-    propertyIds.add(URL_SUFFIX_PROPERTY_ID);
-    propertyIds.add(VIEW_INSTANCE_VERSION_PROPERTY_ID);
-    propertyIds.add(VIEW_INSTANCE_NAME_PROPERTY_ID);
-    propertyIds.add(VIEW_INSTANCE_COMMON_NAME_PROPERTY_ID);
-  }
+  private static Set<String> propertyIds = Sets.newHashSet(
+      URL_NAME_PROPERTY_ID,
+      URL_SUFFIX_PROPERTY_ID,
+      VIEW_INSTANCE_VERSION_PROPERTY_ID,
+      VIEW_INSTANCE_NAME_PROPERTY_ID,
+      VIEW_INSTANCE_COMMON_NAME_PROPERTY_ID);
 
   @Inject
   private static ViewURLDAO viewURLDAO;
@@ -97,7 +94,7 @@ public class ViewURLResourceProvider extends AbstractAuthorizedResourceProvider
    */
 
   public ViewURLResourceProvider() {
-    super(propertyIds, keyPropertyIds);
+    super(Resource.Type.ViewURL, propertyIds, keyPropertyIds);
 
     EnumSet<RoleAuthorization> requiredAuthorizations = EnumSet.of(RoleAuthorization.AMBARI_MANAGE_VIEWS);
     setRequiredCreateAuthorizations(requiredAuthorizations);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewVersionResourceProvider.java
index e0812fa..58d4cf4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewVersionResourceProvider.java
@@ -19,7 +19,6 @@
 package org.apache.ambari.server.controller.internal;
 
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -40,6 +39,9 @@ import org.apache.ambari.server.view.ViewRegistry;
 import org.apache.ambari.server.view.configuration.ParameterConfig;
 import org.apache.ambari.view.ViewDefinition;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+
 /**
  * Resource provider for view versions.
  */
@@ -66,32 +68,29 @@ public class ViewVersionResourceProvider extends AbstractResourceProvider {
   /**
    * The key property ids for a view resource.
    */
-  private static Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
-  static {
-    keyPropertyIds.put(Resource.Type.View, VIEW_NAME_PROPERTY_ID);
-    keyPropertyIds.put(Resource.Type.ViewVersion, VIEW_VERSION_PROPERTY_ID);
-  }
+  private static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Resource.Type.View, VIEW_NAME_PROPERTY_ID)
+      .put(Resource.Type.ViewVersion, VIEW_VERSION_PROPERTY_ID)
+      .build();
 
   /**
    * The property ids for a view resource.
    */
-  private static Set<String> propertyIds = new HashSet<>();
-  static {
-    propertyIds.add(VIEW_NAME_PROPERTY_ID);
-    propertyIds.add(VIEW_VERSION_PROPERTY_ID);
-    propertyIds.add(VIEW_BUILD_PROPERTY_ID);
-    propertyIds.add(LABEL_PROPERTY_ID);
-    propertyIds.add(DESCRIPTION_PROPERTY_ID);
-    propertyIds.add(MIN_AMBARI_VERSION_PROPERTY_ID);
-    propertyIds.add(MAX_AMBARI_VERSION_PROPERTY_ID);
-    propertyIds.add(PARAMETERS_PROPERTY_ID);
-    propertyIds.add(ARCHIVE_PROPERTY_ID);
-    propertyIds.add(MASKER_CLASS_PROPERTY_ID);
-    propertyIds.add(VIEW_STATUS_PROPERTY_ID);
-    propertyIds.add(VIEW_STATUS_DETAIL_PROPERTY_ID);
-    propertyIds.add(CLUSTER_CONFIG_PROPERTY_ID);
-    propertyIds.add(SYSTEM_PROPERTY_ID);
-  }
+  private static Set<String> propertyIds = Sets.newHashSet(
+      VIEW_NAME_PROPERTY_ID,
+      VIEW_VERSION_PROPERTY_ID,
+      VIEW_BUILD_PROPERTY_ID,
+      LABEL_PROPERTY_ID,
+      DESCRIPTION_PROPERTY_ID,
+      MIN_AMBARI_VERSION_PROPERTY_ID,
+      MAX_AMBARI_VERSION_PROPERTY_ID,
+      PARAMETERS_PROPERTY_ID,
+      ARCHIVE_PROPERTY_ID,
+      MASKER_CLASS_PROPERTY_ID,
+      VIEW_STATUS_PROPERTY_ID,
+      VIEW_STATUS_DETAIL_PROPERTY_ID,
+      CLUSTER_CONFIG_PROPERTY_ID,
+      SYSTEM_PROPERTY_ID);
 
 
   // ----- Constructors ------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProvider.java
index 8c39fc4..5af2acc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProvider.java
@@ -119,7 +119,7 @@ public class WidgetLayoutResourceProvider extends AbstractControllerResourceProv
    *
    */
   public WidgetLayoutResourceProvider(AmbariManagementController managementController) {
-    super(propertyIds, keyPropertyIds, managementController);
+    super(Type.WidgetLayout, propertyIds, keyPropertyIds, managementController);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
index 03fd5d2..89a5aa4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
@@ -123,7 +123,7 @@ public class WidgetResourceProvider extends AbstractControllerResourceProvider {
    *
    */
   public WidgetResourceProvider(AmbariManagementController managementController) {
-    super(propertyIds, keyPropertyIds, managementController);
+    super(Type.Widget, propertyIds, keyPropertyIds, managementController);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WorkflowResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WorkflowResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WorkflowResourceProvider.java
index 13cb8a4..af1085f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WorkflowResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WorkflowResourceProvider.java
@@ -22,7 +22,6 @@ import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -45,6 +44,9 @@ import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+
 /**
  * Resource provider for workflow resources.
  */
@@ -79,22 +81,38 @@ public class WorkflowResourceProvider extends
   protected static final String WORKFLOW_CONTEXT_PROPERTY_ID = PropertyHelper
       .getPropertyId("Workflow", "context");
 
-  private static final Set<String> pkPropertyIds = new HashSet<>(
-    Arrays.asList(new String[]{WORKFLOW_CLUSTER_NAME_PROPERTY_ID,
-      WORKFLOW_ID_PROPERTY_ID}));
-
   protected WorkflowFetcher workflowFetcher;
 
   /**
+   * The key property ids for a Workflow resource.
+   */
+  private static Map<Resource.Type, String> keyPropertyIds = ImmutableMap.<Resource.Type, String>builder()
+      .put(Type.Cluster, WORKFLOW_CLUSTER_NAME_PROPERTY_ID)
+      .put(Type.Workflow, WORKFLOW_ID_PROPERTY_ID)
+      .build();
+
+  /**
+   * The property ids for a Workflow resource.
+   */
+  private static Set<String> propertyIds = Sets.newHashSet(
+      WORKFLOW_CLUSTER_NAME_PROPERTY_ID,
+      WORKFLOW_ID_PROPERTY_ID,
+      WORKFLOW_NAME_PROPERTY_ID,
+      WORKFLOW_USER_NAME_PROPERTY_ID,
+      WORKFLOW_START_TIME_PROPERTY_ID,
+      WORKFLOW_LAST_UPDATE_TIME_PROPERTY_ID,
+      WORKFLOW_ELAPSED_TIME_PROPERTY_ID,
+      WORKFLOW_INPUT_BYTES_PROPERTY_ID,
+      WORKFLOW_OUTPUT_BYTES_PROPERTY_ID,
+      WORKFLOW_NUM_JOBS_TOTAL_PROPERTY_ID,
+      WORKFLOW_NUM_JOBS_COMPLETED_PROPERTY_ID,
+      WORKFLOW_PARENT_ID_PROPERTY_ID,
+      WORKFLOW_CONTEXT_PROPERTY_ID);
+
+  /**
    * Create a new workflow resource provider.
-   * 
-   * @param propertyIds
-   *          the property ids
-   * @param keyPropertyIds
-   *          the key property ids
    */
-  protected WorkflowResourceProvider(Set<String> propertyIds,
-      Map<Type,String> keyPropertyIds) {
+  protected WorkflowResourceProvider() {
     super(propertyIds, keyPropertyIds);
     this.workflowFetcher = new PostgresWorkflowFetcher(
         new JobHistoryPostgresConnectionFactory());
@@ -103,15 +121,10 @@ public class WorkflowResourceProvider extends
   /**
    * Create a new workflow resource provider.
    * 
-   * @param propertyIds
-   *          the property ids
-   * @param keyPropertyIds
-   *          the key property ids
    * @param workflowFetcher
    *          workflow fetcher
    */
-  protected WorkflowResourceProvider(Set<String> propertyIds,
-      Map<Type,String> keyPropertyIds, WorkflowFetcher workflowFetcher) {
+  protected WorkflowResourceProvider(WorkflowFetcher workflowFetcher) {
     super(propertyIds, keyPropertyIds);
     this.workflowFetcher = workflowFetcher;
   }
@@ -159,14 +172,11 @@ public class WorkflowResourceProvider extends
 
   @Override
   protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds;
+    return new HashSet<>(keyPropertyIds.values());
   }
 
   @Override
   public Map<Type,String> getKeyPropertyIds() {
-    Map<Type,String> keyPropertyIds = new HashMap<>();
-    keyPropertyIds.put(Type.Cluster, WORKFLOW_CLUSTER_NAME_PROPERTY_ID);
-    keyPropertyIds.put(Type.Workflow, WORKFLOW_ID_PROPERTY_ID);
     return keyPropertyIds;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
index 8939780..a63983c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
@@ -44,11 +44,9 @@ import org.codehaus.jackson.type.TypeReference;
  */
 public class PropertyHelper {
 
-  private static final String PROPERTIES_FILE = "properties.json";
   private static final String GANGLIA_PROPERTIES_FILE = "ganglia_properties.json";
   private static final String SQLSERVER_PROPERTIES_FILE = "sqlserver_properties.json";
   private static final String JMX_PROPERTIES_FILE = "jmx_properties.json";
-  private static final String KEY_PROPERTIES_FILE = "key_properties.json";
   public static final char EXTERNAL_PATH_SEP = '/';
 
   /**
@@ -60,11 +58,11 @@ public class PropertyHelper {
   private static final List<Resource.InternalType> REPORT_METRIC_RESOURCES =
     Arrays.asList(Resource.InternalType.Cluster, Resource.InternalType.Host);
 
-  private static final Map<Resource.InternalType, Set<String>> PROPERTY_IDS = readPropertyIds(PROPERTIES_FILE);
+  private static final Map<Resource.InternalType, Set<String>> PROPERTY_IDS = new HashMap<>();
   private static final Map<Resource.InternalType, Map<String, Map<String, PropertyInfo>>> JMX_PROPERTY_IDS = readPropertyProviderIds(JMX_PROPERTIES_FILE);
   private static final Map<Resource.InternalType, Map<String, Map<String, PropertyInfo>>> GANGLIA_PROPERTY_IDS = readPropertyProviderIds(GANGLIA_PROPERTIES_FILE);
   private static final Map<Resource.InternalType, Map<String, Map<String, PropertyInfo>>> SQLSERVER_PROPERTY_IDS = readPropertyProviderIds(SQLSERVER_PROPERTIES_FILE);
-  private static final Map<Resource.InternalType, Map<Resource.Type, String>> KEY_PROPERTY_IDS = readKeyPropertyIds(KEY_PROPERTIES_FILE);
+  private static final Map<Resource.InternalType, Map<Resource.Type, String>> KEY_PROPERTY_IDS = new HashMap<>();
 
   // Suffixes to add for Namenode rpc metrics prefixes
   private static final Map<String, List<String>> RPC_METRIC_SUFFIXES = new HashMap<>();

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/java/org/apache/ambari/server/metrics/system/impl/AmbariMetricSinkImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/metrics/system/impl/AmbariMetricSinkImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/metrics/system/impl/AmbariMetricSinkImpl.java
index 5c5801d..6cd7059 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/metrics/system/impl/AmbariMetricSinkImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/metrics/system/impl/AmbariMetricSinkImpl.java
@@ -139,8 +139,6 @@ public class AmbariMetricSinkImpl extends AbstractTimelineMetricsSink implements
 
       ResourceProvider provider = AbstractControllerResourceProvider.getResourceProvider(
         type,
-        PropertyHelper.getPropertyIds(type),
-        PropertyHelper.getKeyPropertyIds(type),
         ambariManagementController);
 
       try {

http://git-wip-us.apache.org/repos/asf/ambari/blob/e77a31ab/ambari-server/src/main/resources/key_properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/key_properties.json b/ambari-server/src/main/resources/key_properties.json
deleted file mode 100644
index 5d76062..0000000
--- a/ambari-server/src/main/resources/key_properties.json
+++ /dev/null
@@ -1,161 +0,0 @@
-{
-  "Cluster": {
-    "Cluster": "Clusters/cluster_name"
-  },
-  "Host": {
-    "Cluster": "Hosts/cluster_name",
-    "Host": "Hosts/host_name"
-  },
-  "HostComponent": {
-    "Cluster": "HostRoles/cluster_name",
-    "Host": "HostRoles/host_name",
-    "HostComponent": "HostRoles/component_name",
-    "Component": "HostRoles/component_name"
-  },
-  "Action": {
-    "Action": "Actions/action_name"
-  },
-  "Request": {
-    "Cluster": "Requests/cluster_name",
-    "Request": "Requests/id"
-  },
-  "Task": {
-    "Cluster": "Tasks/cluster_name",
-    "Request": "Tasks/request_id",
-    "Upgrade": "Tasks/request_id",
-    "Stage": "Tasks/stage_id",
-    "UpgradeItem": "Tasks/stage_id",
-    "Task": "Tasks/id"
-  },
-  "User": {
-    "User": "Users/user_name"
-  },
-  "Group": {
-    "Group": "Groups/group_name"
-  },
-  "Member": {
-    "Group": "MemberInfo/group_name",
-    "Member": "MemberInfo/user_name"
-  },
-  "Stack": {
-    "Stack": "Stacks/stack_name"
-  },
-  "StackVersion": {
-    "Stack": "Versions/stack_name",
-    "StackVersion": "Versions/stack_version"
-  },
-  "StackService": {
-    "Stack": "StackServices/stack_name",
-    "StackVersion": "StackServices/stack_version",
-    "StackService": "StackServices/service_name"
-  },
-  "StackConfiguration": {
-    "Stack": "StackConfigurations/stack_name",
-    "StackVersion": "StackConfigurations/stack_version",
-    "StackService": "StackConfigurations/service_name",
-    "StackConfiguration": "StackConfigurations/property_name"
-  },
-  "StackConfigurationDependency": {
-    "Stack": "StackConfigurationDependency/stack_name",
-    "StackVersion": "StackConfigurationDependency/stack_version",
-    "StackService": "StackConfigurationDependency/service_name",
-    "StackConfiguration": "StackConfigurationDependency/property_name",
-    "StackLevelConfiguration": "StackConfigurationDependency/property_name",
-    "StackConfigurationDependency": "StackConfigurationDependency/dependency_name"
-  },
-  "StackServiceComponent": {
-    "Stack": "StackServiceComponents/stack_name",
-    "StackVersion": "StackServiceComponents/stack_version",
-    "StackService": "StackServiceComponents/service_name",
-    "StackServiceComponent": "StackServiceComponents/component_name"
-  },
-  "StackServiceComponentDependency": {
-    "Stack": "Dependencies/stack_name",
-    "StackVersion": "Dependencies/stack_version",
-    "StackService": "Dependencies/dependent_service_name",
-    "StackServiceComponent": "Dependencies/dependent_component_name",
-    "StackServiceComponentDependency": "Dependencies/component_name"
-  },
-  "ExtensionLink": {
-    "ExtensionLink": "ExtensionLink/link_id",
-    "Stack": "ExtensionLink/stack_name",
-    "StackVersion": "ExtensionLink/stack_version",
-    "Extension": "ExtensionLink/extension_name",
-    "ExtensionVersion": "ExtensionLink/extension_version"
-  },
-  "Extension": {
-    "Extension": "Extensions/extension_name"
-  },
-  "ExtensionVersion": {
-    "Extension": "Versions/extension_name",
-    "ExtensionVersion": "Versions/extension_version"
-  },
-  "DRFeed": {
-    "DRFeed": "Feed/name"
-  },
-  "DRTargetCluster": {
-    "DRTargetCluster": "Cluster/name"
-  },
-  "DRInstance": {
-    "DRFeed": "Instance/feedName",
-    "DRInstance": "Instance/id"
-  },
-  "RootService": {
-    "RootService": "RootService/service_name"
-  },
-  "RootServiceComponent": {
-    "RootService": "RootServiceComponents/service_name",
-    "RootServiceComponent": "RootServiceComponents/component_name"
-  },
-  "RootServiceHostComponent": {
-    "RootService": "RootServiceHostComponents/service_name",
-    "Host": "RootServiceHostComponents/host_name",
-    "RootServiceComponent": "RootServiceHostComponents/component_name",
-    "RootServiceHostComponent": "RootServiceHostComponents/component_name"
-  },
-  "ConfigGroup": {
-    "Cluster": "ConfigGroup/cluster_name",
-    "ConfigGroup": "ConfigGroup/id"
-  },
-  "RequestSchedule" : {
-    "Cluster": "RequestSchedule/cluster_name",
-    "RequestSchedule": "RequestSchedule/id"
-  },
-  "Blueprint": {
-    "Blueprint": "Blueprints/blueprint_name"
-  },
-  "Recommendation": {
-    "Recommendation": "Recommendation/id",
-    "Stack": "Versions/stack_name",
-    "StackVersion": "Versions/stack_version"
-  },
-  "Validation": {
-    "Validation": "Validation/id",
-    "Stack": "Versions/stack_name",
-    "StackVersion": "Versions/stack_version"
-  },
-  "HostComponentProcess": {
-    "Cluster": "HostComponentProcess/cluster_name",
-    "Host": "HostComponentProcess/host_name",
-    "Component": "HostComponentProcess/component_name",
-    "HostComponent": "HostComponentProcess/component_name",
-    "HostComponentProcess": "HostComponentProcess/name"
-  },
-  "ClientConfig": {
-    "Cluster": "ServiceComponentInfo/cluster_name",
-    "Service": "ServiceComponentInfo/service_name",
-    "Component": "ServiceComponentInfo/component_name",
-    "Host": "HostRoles/host_name"
-  },
-  "StackLevelConfiguration": {
-    "Stack": "StackLevelConfigurations/stack_name",
-    "StackVersion": "StackLevelConfigurations/stack_version",
-    "StackLevelConfiguration": "StackLevelConfigurations/property_name"  
-  },
-  "KerberosDescriptor": {
-    "KerberosDescriptor": "KerberosDescriptors/kerberos_descriptor_name"
-  },
-  "LoggingQuery": {
-      "Cluster" : "logging/cluster_name"
-  }
-}


Mime
View raw message