This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit ab99b71c30fc9a3a82ae15bba267957483d8da42
Author: Gabor Boros <6317425+g-bo...@users.noreply.github.com>
AuthorDate: Fri Apr 6 13:36:52 2018 +0200

    AMBARI-23436 - Integrate ServiceConfigVersion service to Swagger
    
    Change-Id: I17e7a12c4fd24966b754b1f119199688740349c7
---
 .../api/services/ServiceConfigVersionService.java  | 49 +++++++++++-
 .../controller/ServiceConfigVersionRequest.java    | 12 +++
 .../controller/ServiceConfigVersionResponse.java   | 21 +++++-
 .../internal/ClusterResourceProvider.java          |  8 +-
 .../ServiceConfigVersionResourceProvider.java      | 88 +++++++++++-----------
 .../metrics/system/impl/AmbariMetricSinkImpl.java  | 10 +--
 6 files changed, 131 insertions(+), 57 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceConfigVersionService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceConfigVersionService.java
index c6e3201..bc859c5 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceConfigVersionService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceConfigVersionService.java
@@ -22,16 +22,32 @@ import java.util.HashMap;
 import java.util.Map;
 
 import javax.ws.rs.GET;
+import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
-import org.apache.ambari.annotations.ApiIgnore;
+import org.apache.ambari.annotations.SwaggerOverwriteNestedAPI;
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.controller.ServiceConfigVersionResponse;
 import org.apache.ambari.server.controller.spi.Resource;
 
+import org.apache.http.HttpStatus;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+
+@Api(value = "Configurations", description = "Endpoint for 
configuration-specific operations")
+@SwaggerOverwriteNestedAPI(parentApi = ConfigurationService.class, 
parentApiPath =
+  "/clusters", parentMethodPath = 
"{clusterName}/configurations/service_config_versions", pathParameters =
+  {"clusterName"})
 public class ServiceConfigVersionService extends BaseService {
   /**
    * Parent cluster name.
@@ -42,8 +58,35 @@ public class ServiceConfigVersionService extends BaseService 
{
     this.m_clusterName = m_clusterName;
   }
 
-  @GET @ApiIgnore // until documented
-  @Produces("text/plain")
+  /**
+   * Handles URL: /clusters/{clusterId}/configurations/service_config_versions
+   * Get all service configuration versions for a cluster and service.
+   *
+   * @param headers http headers
+   * @param ui      uri info
+   * @return service config version collection resource representation
+   */
+  @GET
+  @Path("") // This is needed if class level path is not present otherwise no 
Swagger docs will be generated for this method
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Get all service config versions", response = 
ServiceConfigVersionResponse.class,
+    responseContainer = RESPONSE_CONTAINER_LIST)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, 
dataType = DATA_TYPE_STRING, paramType =
+      PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION, 
dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = 
QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = 
DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, 
allowableValues = QUERY_FROM_VALUES, defaultValue = DEFAULT_FROM, dataType = 
DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, 
allowableValues = QUERY_TO_VALUES, dataType = DATA_TYPE_INT, paramType = 
PARAM_TYPE_QUERY),
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = 
MSG_CLUSTER_OR_HOST_NOT_FOUND),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = 
MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = 
MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = 
MSG_SERVER_ERROR),
+    @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = 
MSG_INVALID_ARGUMENTS),
+  })
   public Response getServiceConfigVersions(String body, @Context HttpHeaders 
headers, @Context UriInfo ui) {
     return handleRequest(headers, body, ui, Request.Type.GET, 
createServiceConfigResource(m_clusterName));
   }
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
index c47a5e0..9fed772 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
@@ -18,6 +18,10 @@
 
 package org.apache.ambari.server.controller;
 
+import 
org.apache.ambari.server.controller.internal.ServiceConfigVersionResourceProvider;
+
+import io.swagger.annotations.ApiModelProperty;
+
 public class ServiceConfigVersionRequest {
   private String clusterName;
   private String serviceName;
@@ -41,6 +45,7 @@ public class ServiceConfigVersionRequest {
     this.isCurrent = isCurrent;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.SERVICE_NAME_PROPERTY_ID)
   public String getServiceName() {
     return serviceName;
   }
@@ -49,6 +54,7 @@ public class ServiceConfigVersionRequest {
     this.serviceName = serviceName;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_PROPERTY_ID)
   public Long getVersion() {
     return version;
   }
@@ -57,6 +63,7 @@ public class ServiceConfigVersionRequest {
     this.version = version;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.CREATE_TIME_PROPERTY_ID)
   public Long getCreateTime() {
     return createTime;
   }
@@ -65,6 +72,7 @@ public class ServiceConfigVersionRequest {
     this.createTime = createTime;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.APPLIED_TIME_PROPERTY_ID)
   public Long getApplyTime() {
     return applyTime;
   }
@@ -73,6 +81,7 @@ public class ServiceConfigVersionRequest {
     this.applyTime = applyTime;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.USER_PROPERTY_ID)
   public String getUserName() {
     return userName;
   }
@@ -81,6 +90,7 @@ public class ServiceConfigVersionRequest {
     this.userName = userName;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.CLUSTER_NAME_PROPERTY_ID)
   public String getClusterName() {
     return clusterName;
   }
@@ -89,6 +99,7 @@ public class ServiceConfigVersionRequest {
     this.clusterName = clusterName;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID)
   public String getNote() {
     return note;
   }
@@ -97,6 +108,7 @@ public class ServiceConfigVersionRequest {
     this.note = note;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.IS_CURRENT_PROPERTY_ID)
   public Boolean getIsCurrent() {
     return isCurrent;
   }
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
index 275d703..d0534e2 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
@@ -18,22 +18,27 @@
 
 package org.apache.ambari.server.controller;
 
-
 import java.util.List;
 
 import org.apache.ambari.server.StaticallyInject;
+import 
org.apache.ambari.server.controller.internal.ServiceConfigVersionResourceProvider;
 import org.apache.ambari.server.orm.dao.HostDAO;
 import org.apache.ambari.server.orm.entities.ClusterEntity;
 import org.apache.ambari.server.orm.entities.ServiceConfigEntity;
 import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.state.StackId;
+
 import org.apache.commons.lang.builder.EqualsBuilder;
 import org.apache.commons.lang.builder.HashCodeBuilder;
+
 import org.codehaus.jackson.annotate.JsonProperty;
 import org.codehaus.jackson.map.annotate.JsonSerialize;
 
 import com.google.inject.Inject;
 
+import io.swagger.annotations.ApiModelProperty;
+
+
 @StaticallyInject
 public class ServiceConfigVersionResponse {
   /**
@@ -121,25 +126,32 @@ public class ServiceConfigVersionResponse {
     stackId = new StackId(serviceConfigStackEntity).getStackId();
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.SERVICE_NAME_PROPERTY_ID)
   public String getServiceName() {
     return serviceName;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_PROPERTY_ID)
   public Long getVersion() {
     return version;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.CREATE_TIME_PROPERTY_ID)
   public Long getCreateTime() {
     return createTime;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.USER_PROPERTY_ID)
   public String getUserName() {
     return userName;
   }
+
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.CLUSTER_NAME_PROPERTY_ID)
   public String getClusterName() {
     return clusterName;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.CONFIGURATIONS_PROPERTY_ID)
   public List<ConfigurationResponse> getConfigurations() {
     return configurations;
   }
@@ -148,18 +160,22 @@ public class ServiceConfigVersionResponse {
     this.configurations = configurations;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID)
   public String getNote() {
     return note;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.HOSTS_PROPERTY_ID)
   public List<String> getHosts() {
     return hosts;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.GROUP_NAME_PROPERTY_ID)
   public String getGroupName() {
     return groupName;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.GROUP_ID_PROPERTY_ID)
   public Long getGroupId() {
     return groupId;
   }
@@ -169,10 +185,12 @@ public class ServiceConfigVersionResponse {
    *
    * @return
    */
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.STACK_ID_PROPERTY_ID)
   public String getStackId() {
     return stackId;
   }
 
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.IS_CURRENT_PROPERTY_ID)
   public Boolean getIsCurrent() {
     return isCurrent;
   }
@@ -187,6 +205,7 @@ public class ServiceConfigVersionResponse {
    *
    * @return {@code true} if compatible, {@code false} otherwise.
    */
+  @ApiModelProperty(name = 
ServiceConfigVersionResourceProvider.IS_COMPATIBLE_PROPERTY_ID)
   public Boolean isCompatibleWithCurrentStack() {
     return isCompatibleWithCurrentStack;
   }
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
index 16f04e4..96823c2 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
@@ -327,19 +327,19 @@ public class ClusterResourceProvider extends 
AbstractControllerResourceProvider
           for (Collection<ServiceConfigVersionResponse> scvCollection : 
serviceConfigVersions.values()) {
             for (ServiceConfigVersionResponse serviceConfigVersionResponse : 
scvCollection) {
               Resource resource = new 
ResourceImpl(Resource.Type.ServiceConfigVersion);
-              
resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID,
+              
resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_NAME_PROPERTY_ID,
                 serviceConfigVersionResponse.getServiceName());
               
resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_PROPERTY_ID,
                 serviceConfigVersionResponse.getVersion());
               
resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID,
                 serviceConfigVersionResponse.getNote());
-              
resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_GROUP_ID_PROPERTY_ID,
+              
resource.setProperty(ServiceConfigVersionResourceProvider.GROUP_ID_PROPERTY_ID,
                   serviceConfigVersionResponse.getGroupId());
-              
resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_GROUP_NAME_PROPERTY_ID,
+              
resource.setProperty(ServiceConfigVersionResourceProvider.GROUP_NAME_PROPERTY_ID,
                   serviceConfigVersionResponse.getGroupName());
               if (serviceConfigVersionResponse.getConfigurations() != null) {
                 resource.setProperty(
-                  
ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID,
+                  
ServiceConfigVersionResourceProvider.CONFIGURATIONS_PROPERTY_ID,
                   serviceConfigVersionResponse.getConfigurations());
               }
               associatedResources.add(resource);
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
index 1019e57..24febe8 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
@@ -44,25 +44,25 @@ import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
 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 org.apache.ambari.server.security.authorization.RoleAuthorization;
 
 public class ServiceConfigVersionResourceProvider extends
     AbstractControllerResourceProvider {
 
-  public static final String SERVICE_CONFIG_VERSION_CLUSTER_NAME_PROPERTY_ID = 
PropertyHelper.getPropertyId(null, "cluster_name");
-  public static final String SERVICE_CONFIG_VERSION_PROPERTY_ID = 
PropertyHelper.getPropertyId(null, "service_config_version");
-  public static final String SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID = 
PropertyHelper.getPropertyId(null, "service_name");
-  public static final String SERVICE_CONFIG_VERSION_CREATE_TIME_PROPERTY_ID = 
PropertyHelper.getPropertyId(null, "createtime");
-  public static final String SERVICE_CONFIG_VERSION_USER_PROPERTY_ID = 
PropertyHelper.getPropertyId(null, "user");
-  public static final String SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID = 
PropertyHelper.getPropertyId(null, "service_config_version_note");
-  public static final String SERVICE_CONFIG_VERSION_GROUP_ID_PROPERTY_ID = 
PropertyHelper.getPropertyId(null, "group_id");
-  public static final String SERVICE_CONFIG_VERSION_GROUP_NAME_PROPERTY_ID = 
PropertyHelper.getPropertyId(null, "group_name");
-  public static final String SERVICE_CONFIG_VERSION_STACK_ID_PROPERTY_ID = 
PropertyHelper.getPropertyId(null, "stack_id");
-  public static final String SERVICE_CONFIG_VERSION_IS_CURRENT_PROPERTY_ID = 
PropertyHelper.getPropertyId(null, "is_current");
-  public static final String SERVICE_CONFIG_VERSION_IS_COMPATIBLE_PROPERTY_ID 
= PropertyHelper.getPropertyId(null, "is_cluster_compatible");
-  public static final String SERVICE_CONFIG_VERSION_HOSTS_PROPERTY_ID = 
PropertyHelper.getPropertyId(null, "hosts");
-  public static final String SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID 
= PropertyHelper.getPropertyId(null, "configurations");
+  public static final String CLUSTER_NAME_PROPERTY_ID = "cluster_name";
+  public static final String SERVICE_CONFIG_VERSION_PROPERTY_ID = 
"service_config_version";
+  public static final String SERVICE_NAME_PROPERTY_ID = "service_name";
+  public static final String CREATE_TIME_PROPERTY_ID = "createtime";
+  public static final String USER_PROPERTY_ID = "user";
+  public static final String SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID = 
"service_config_version_note";
+  public static final String GROUP_ID_PROPERTY_ID = "group_id";
+  public static final String GROUP_NAME_PROPERTY_ID = "group_name";
+  public static final String STACK_ID_PROPERTY_ID = "stack_id";
+  public static final String IS_CURRENT_PROPERTY_ID = "is_current";
+  public static final String IS_COMPATIBLE_PROPERTY_ID = 
"is_cluster_compatible";
+  public static final String HOSTS_PROPERTY_ID = "hosts";
+  public static final String CONFIGURATIONS_PROPERTY_ID = "configurations";
+  public static final String APPLIED_TIME_PROPERTY_ID = "appliedtime";
 
   /**
    * The property ids for a service configuration resource.
@@ -76,23 +76,23 @@ public class ServiceConfigVersionResourceProvider extends
 
   static {
     // properties
-    PROPERTY_IDS.add(SERVICE_CONFIG_VERSION_CLUSTER_NAME_PROPERTY_ID);
+    PROPERTY_IDS.add(CLUSTER_NAME_PROPERTY_ID);
     PROPERTY_IDS.add(SERVICE_CONFIG_VERSION_PROPERTY_ID);
-    PROPERTY_IDS.add(SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID);
-    PROPERTY_IDS.add(SERVICE_CONFIG_VERSION_CREATE_TIME_PROPERTY_ID);
-    PROPERTY_IDS.add(SERVICE_CONFIG_VERSION_USER_PROPERTY_ID);
+    PROPERTY_IDS.add(SERVICE_NAME_PROPERTY_ID);
+    PROPERTY_IDS.add(CREATE_TIME_PROPERTY_ID);
+    PROPERTY_IDS.add(USER_PROPERTY_ID);
     PROPERTY_IDS.add(SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID);
-    PROPERTY_IDS.add(SERVICE_CONFIG_VERSION_GROUP_ID_PROPERTY_ID);
-    PROPERTY_IDS.add(SERVICE_CONFIG_VERSION_GROUP_NAME_PROPERTY_ID);
-    PROPERTY_IDS.add(SERVICE_CONFIG_VERSION_STACK_ID_PROPERTY_ID);
-    PROPERTY_IDS.add(SERVICE_CONFIG_VERSION_IS_CURRENT_PROPERTY_ID);
-    PROPERTY_IDS.add(SERVICE_CONFIG_VERSION_HOSTS_PROPERTY_ID);
-    PROPERTY_IDS.add(SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID);
-    PROPERTY_IDS.add(SERVICE_CONFIG_VERSION_IS_COMPATIBLE_PROPERTY_ID);
+    PROPERTY_IDS.add(GROUP_ID_PROPERTY_ID);
+    PROPERTY_IDS.add(GROUP_NAME_PROPERTY_ID);
+    PROPERTY_IDS.add(STACK_ID_PROPERTY_ID);
+    PROPERTY_IDS.add(IS_CURRENT_PROPERTY_ID);
+    PROPERTY_IDS.add(HOSTS_PROPERTY_ID);
+    PROPERTY_IDS.add(CONFIGURATIONS_PROPERTY_ID);
+    PROPERTY_IDS.add(IS_COMPATIBLE_PROPERTY_ID);
 
     // keys
-    
KEY_PROPERTY_IDS.put(Resource.Type.Service,SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID);
-    
KEY_PROPERTY_IDS.put(Resource.Type.Cluster,SERVICE_CONFIG_VERSION_CLUSTER_NAME_PROPERTY_ID);
+    KEY_PROPERTY_IDS.put(Resource.Type.Service, SERVICE_NAME_PROPERTY_ID);
+    KEY_PROPERTY_IDS.put(Resource.Type.Cluster, CLUSTER_NAME_PROPERTY_ID);
     
KEY_PROPERTY_IDS.put(Resource.Type.ServiceConfigVersion,SERVICE_CONFIG_VERSION_PROPERTY_ID);
   }
 
@@ -102,8 +102,8 @@ public class ServiceConfigVersionResourceProvider extends
    */
   private static Set<String> pkPropertyIds =
     new HashSet<>(Arrays.asList(new String[]{
-      SERVICE_CONFIG_VERSION_CLUSTER_NAME_PROPERTY_ID,
-      SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID}));
+            CLUSTER_NAME_PROPERTY_ID,
+            SERVICE_NAME_PROPERTY_ID}));
 
 
   // ----- Constructors ------------------------------------------------------
@@ -154,19 +154,19 @@ public class ServiceConfigVersionResourceProvider extends
       List<Map<String,Object>> configVersionConfigurations = 
convertToSubResources(clusterName, configurationResponses);
 
       Resource resource = new ResourceImpl(Resource.Type.ServiceConfigVersion);
-      resource.setProperty(SERVICE_CONFIG_VERSION_CLUSTER_NAME_PROPERTY_ID, 
clusterName);
-      resource.setProperty(SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID, 
response.getServiceName());
-      resource.setProperty(SERVICE_CONFIG_VERSION_USER_PROPERTY_ID, 
response.getUserName());
+      resource.setProperty(CLUSTER_NAME_PROPERTY_ID, clusterName);
+      resource.setProperty(SERVICE_NAME_PROPERTY_ID, 
response.getServiceName());
+      resource.setProperty(USER_PROPERTY_ID, response.getUserName());
       resource.setProperty(SERVICE_CONFIG_VERSION_PROPERTY_ID, 
response.getVersion());
-      resource.setProperty(SERVICE_CONFIG_VERSION_CREATE_TIME_PROPERTY_ID, 
response.getCreateTime());
-      resource.setProperty(SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID, 
configVersionConfigurations);
+      resource.setProperty(CREATE_TIME_PROPERTY_ID, response.getCreateTime());
+      resource.setProperty(CONFIGURATIONS_PROPERTY_ID, 
configVersionConfigurations);
       resource.setProperty(SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID, 
response.getNote());
-      resource.setProperty(SERVICE_CONFIG_VERSION_GROUP_ID_PROPERTY_ID, 
response.getGroupId());
-      resource.setProperty(SERVICE_CONFIG_VERSION_GROUP_NAME_PROPERTY_ID, 
response.getGroupName());
-      resource.setProperty(SERVICE_CONFIG_VERSION_HOSTS_PROPERTY_ID, 
response.getHosts());
-      resource.setProperty(SERVICE_CONFIG_VERSION_STACK_ID_PROPERTY_ID, 
response.getStackId());
-      resource.setProperty(SERVICE_CONFIG_VERSION_IS_CURRENT_PROPERTY_ID, 
response.getIsCurrent());
-      resource.setProperty(SERVICE_CONFIG_VERSION_IS_COMPATIBLE_PROPERTY_ID, 
response.isCompatibleWithCurrentStack());
+      resource.setProperty(GROUP_ID_PROPERTY_ID, response.getGroupId());
+      resource.setProperty(GROUP_NAME_PROPERTY_ID, response.getGroupName());
+      resource.setProperty(HOSTS_PROPERTY_ID, response.getHosts());
+      resource.setProperty(STACK_ID_PROPERTY_ID, response.getStackId());
+      resource.setProperty(IS_CURRENT_PROPERTY_ID, response.getIsCurrent());
+      resource.setProperty(IS_COMPATIBLE_PROPERTY_ID, 
response.isCompatibleWithCurrentStack());
 
       resources.add(resource);
     }
@@ -213,10 +213,10 @@ public class ServiceConfigVersionResourceProvider extends
 
 
   private ServiceConfigVersionRequest createRequest(Map<String, Object> 
properties) {
-    String clusterName = (String) 
properties.get(SERVICE_CONFIG_VERSION_CLUSTER_NAME_PROPERTY_ID);
-    String serviceName = (String) 
properties.get(SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID);
-    String user = (String) 
properties.get(SERVICE_CONFIG_VERSION_USER_PROPERTY_ID);
-    Boolean isCurrent = Boolean.valueOf((String) 
properties.get(SERVICE_CONFIG_VERSION_IS_CURRENT_PROPERTY_ID));
+    String clusterName = (String) properties.get(CLUSTER_NAME_PROPERTY_ID);
+    String serviceName = (String) properties.get(SERVICE_NAME_PROPERTY_ID);
+    String user = (String) properties.get(USER_PROPERTY_ID);
+    Boolean isCurrent = Boolean.valueOf((String) 
properties.get(IS_CURRENT_PROPERTY_ID));
     Object versionObject = properties.get(SERVICE_CONFIG_VERSION_PROPERTY_ID);
     Long version = versionObject == null ? null : 
Long.valueOf(versionObject.toString());
 
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 a0346f6..2a5b69e 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
@@ -128,12 +128,12 @@ public class AmbariMetricSinkImpl extends 
AbstractTimelineMetricsSink implements
       }
 
       Set<String> propertyIds = new HashSet<>();
-      
propertyIds.add(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID);
+      
propertyIds.add(ServiceConfigVersionResourceProvider.CONFIGURATIONS_PROPERTY_ID);
 
       Predicate predicate = new PredicateBuilder().property(
-        
ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_CLUSTER_NAME_PROPERTY_ID).equals(clusterName).and().property(
-        
ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID).equals(ambariMetricsServiceName).and().property(
-        
ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_IS_CURRENT_PROPERTY_ID).equals("true").toPredicate();
+        
ServiceConfigVersionResourceProvider.CLUSTER_NAME_PROPERTY_ID).equals(clusterName).and().property(
+        
ServiceConfigVersionResourceProvider.SERVICE_NAME_PROPERTY_ID).equals(ambariMetricsServiceName).and().property(
+        
ServiceConfigVersionResourceProvider.IS_CURRENT_PROPERTY_ID).equals("true").toPredicate();
 
       Request request = PropertyHelper.getReadRequest(propertyIds);
 
@@ -163,7 +163,7 @@ public class AmbariMetricSinkImpl extends 
AbstractTimelineMetricsSink implements
         for (Resource resource : resources) {
           if (resource != null) {
             ArrayList<LinkedHashMap<Object, Object>> configs = 
(ArrayList<LinkedHashMap<Object, Object>>)
-              
resource.getPropertyValue(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID);
+              
resource.getPropertyValue(ServiceConfigVersionResourceProvider.CONFIGURATIONS_PROPERTY_ID);
             for (LinkedHashMap<Object, Object> config : configs) {
               if (config != null && config.get("type").equals("ams-site")) {
                 TreeMap<Object, Object> properties = (TreeMap<Object, Object>) 
config.get("properties");

-- 
To stop receiving notification emails like this one, please contact
adorosz...@apache.org.

Reply via email to