private boolean populateResource(Resource resource, Request request, Predicate predicate, Statement statement) throws SystemException {

    Set<String> ids = getRequestPropertyIds(request, predicate);
    if (ids.isEmpty()) {
      // no properties requested ... nothing to do.
      return true;
    }

    String componentName = (String) resource.getPropertyValue(componentNamePropertyId);
    String serviceName = (String) resource.getPropertyValue(serviceNamePropertyId);

    if (getComponentMetrics().get(componentName) == null) {
      // no metrics defined for the given component ... nothing to do.
      return true;
    }

    String clusterName = (String) resource.getPropertyValue(clusterNamePropertyId);
    String hostName = getHost(resource, clusterName, componentName);

    if (hostName == null) {
      throw new SystemException(
        "Unable to get metrics.  No host name for " + componentName, null);
    }

    Set<MetricDefinition> metricsDefinitionSet = new HashSet<MetricDefinition>();
    for (String id : ids) {
      Map<String, PropertyInfo> propertyInfoMap = getPropertyInfoMap(componentName, id);

      for (Map.Entry<String, PropertyInfo> entry : propertyInfoMap.entrySet()) {
        String propertyKey = entry.getKey();
        PropertyInfo propertyInfo = entry.getValue();
        if (containsArguments(propertyKey)) {
          propertyInfo = updatePropertyInfo(propertyKey, id, propertyInfo);
        }

        String propertyId = propertyInfo.getPropertyId();
        TemporalInfo temporalInfo = request.getTemporalInfo(id);

        if ((propertyInfo.isPointInTime() && temporalInfo == null) ||
          (propertyInfo.isTemporal() && temporalInfo != null)) {

          long startTime;
          long endTime;

          if (temporalInfo != null) {
            Long endTimeSeconds = temporalInfo.getEndTime();

            endTime = endTimeSeconds != -1 ? endTimeSeconds * 1000 : Long.MAX_VALUE;
            startTime = temporalInfo.getStartTime() * 1000;
          } else {
            startTime = 0L;
            endTime = Long.MAX_VALUE;
          }

          String category = "";
          String recordTypeContext = "";
          String recordTypeName = "";
          String metricName = "";
          String tagPairsPattern = "";
          int dotIndex = propertyId.lastIndexOf('.');
          if (dotIndex != -1) {
            category = propertyId.substring(0, dotIndex);
            metricName = propertyId.substring(dotIndex + 1);
          }
          String[] parts = category.split("\\.");
          if (parts.length >= 2) {
            recordTypeContext = parts[0];
            recordTypeName = parts[1];
            if (containsArguments(propertyKey) && parts.length > 2) {
              tagPairsPattern = StringUtils.join(Arrays.copyOfRange(parts, 2, parts.length), ".");
            }
            metricsDefinitionSet.add(
              new MetricDefinition(
                startTime,
                endTime,
                recordTypeContext,
                recordTypeName,
                tagPairsPattern,
                metricName,
                serviceName != null && serviceName.toLowerCase().equals("hbase") ? serviceName.toLowerCase() : componentName.toLowerCase(),
                hostName,
                propertyKey,
                id,
                temporalInfo)
            );
          } else {
            if (LOG.isWarnEnabled()) {
              LOG.warn("Can't get metrics for " + id + " : " + propertyId);
            }
          }
        }
      }
    }

    Map<MetricDefinition, List<DataPoint>> results = getMetric(metricsDefinitionSet, statement);

    for (MetricDefinition metricDefinition : metricsDefinitionSet) {
      List<DataPoint> dataPoints = results.containsKey(metricDefinition) ? results.get(metricDefinition) : new ArrayList<DataPoint>();
      TemporalInfo temporalInfo = metricDefinition.getTemporalInfo();
      String propertyKey = metricDefinition.getPropertyKey();
      String requestedPropertyKey = metricDefinition.getRequestedPropertyKey();
      if (dataPoints != null) {
        if (temporalInfo == null) {
          // return the value of the last data point
          int length = dataPoints.size();
          Serializable value = length > 0 ? dataPoints.get(length - 1).getValue() : 0;
          resource.setProperty(propertyKey, value);
        } else {
          Number[][] dp = new Number[dataPoints.size()][2];
          for (int i = 0; i < dp.length; i++) {
            dp[i][0] = dataPoints.get(i).getValue();
            dp[i][1] = dataPoints.get(i).getTimestamp() / 1000;
          }
          if (containsArguments(propertyKey)) {
            resource.setProperty(requestedPropertyKey, dp);
          } else {
            resource.setProperty(propertyKey, dp);
          }
        }
      }
    }

    return true;
  }
SQL based property/metrics provider required for ambari-scom.
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/SQLPropertyProvider.java