private Map<String, Set<String>> getReadOnlyProperties(StackId stackId, String serviceName)
      throws AmbariException {
    Map<String, Set<String>> readOnlyProperties = new HashMap<>();

    Set<PropertyInfo> properties = new HashSet<>();

    Set<PropertyInfo> stackProperties = m_ambariMetaInfoProvider.get().getStackProperties(
        stackId.getStackName(), stackId.getStackVersion());

    Set<PropertyInfo> serviceProperties = m_ambariMetaInfoProvider.get().getServiceProperties(
        stackId.getStackName(), stackId.getStackVersion(), serviceName);

    if (CollectionUtils.isNotEmpty(stackProperties)) {
      properties.addAll(stackProperties);
    }

    if (CollectionUtils.isNotEmpty(serviceProperties)) {
      properties.addAll(serviceProperties);
    }

    for (PropertyInfo property : properties) {
      ValueAttributesInfo valueAttributes = property.getPropertyValueAttributes();
      if (null != valueAttributes && valueAttributes.getReadOnly() == Boolean.TRUE) {
        String type = ConfigHelper.fileNameToConfigType(property.getFilename());

        // get the set of properties for this type, initializing it if needed
        Set<String> readOnlyPropertiesForType = readOnlyProperties.get(type);
        if (null == readOnlyPropertiesForType) {
          readOnlyPropertiesForType = new HashSet<>();
          readOnlyProperties.put(type, readOnlyPropertiesForType);
        }

        readOnlyPropertiesForType.add(property.getName());
      }
    }

    return readOnlyProperties;
  }
Gets all of the read-only properties for the given service. This will also
include any stack properties as well which are read-only.

@param stackId
         the stack to get read-only properties for (not {@code null}).
@param serviceName
         the namee of the service (not {@code null}).
@return a map of configuration type to set of property names which are
        read-only
@throws AmbariException
ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/orchestrate/UpgradeHelper.java