public TreeMap<String, MetadataServiceInfo> getMetadataServiceLevelParams(Service service) throws AmbariException {
    TreeMap<String, MetadataServiceInfo> serviceLevelParams = new TreeMap<>();

    RepositoryVersionEntity repositoryVersion = service.getDesiredRepositoryVersion();

    if (null != repositoryVersion) {
      StackId serviceStackId = repositoryVersion.getStackId();

      ServiceInfo serviceInfo = ambariMetaInfo.getService(serviceStackId.getStackName(),
          serviceStackId.getStackVersion(), service.getName());
      Long statusCommandTimeout = null;
      if (serviceInfo.getCommandScript() != null) {
        statusCommandTimeout = new Long(customCommandExecutionHelper.getStatusCommandTimeout(serviceInfo));
      }

      String servicePackageFolder = serviceInfo.getServicePackageFolder();

      // Get the map of service config type to password properties for the service
      Map<String, Map<String, String>> configCredentials;
      configCredentials = configCredentialsForService.get(service.getName());
      if (configCredentials == null) {
        configCredentials = configHelper.getCredentialStoreEnabledProperties(serviceStackId, service);
        configCredentialsForService.put(service.getName(), configCredentials);
      }

      serviceLevelParams.put(serviceInfo.getName(),
          new MetadataServiceInfo(serviceInfo.getVersion(),
              service.isCredentialStoreEnabled(),
              configCredentials,
              statusCommandTimeout,
              servicePackageFolder));
    }
    return serviceLevelParams;
  }
Collects full metadata info about clusters for agent.
@return metadata info about clusters
@throws AmbariException
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java