@Override
  public List<RangerPolicy> changeDataSet(List<RangerPolicy> rangerPolicies, String sourceDbName,
                                          String targetDbName) {
    if (StringUtils.isEmpty(sourceDbName) || StringUtils.isEmpty(targetDbName) || targetDbName.equals(sourceDbName)) {
      return rangerPolicies;
    }
    if (CollectionUtils.isNotEmpty(rangerPolicies)) {
      Map<String, RangerPolicy.RangerPolicyResource> rangerPolicyResourceMap = null;
      RangerPolicy.RangerPolicyResource rangerPolicyResource = null;
      List<String> resourceNameList = null;
      for (RangerPolicy rangerPolicy : rangerPolicies) {
        if (rangerPolicy != null) {
          rangerPolicyResourceMap = rangerPolicy.getResources();
          if (rangerPolicyResourceMap != null) {
            rangerPolicyResource = rangerPolicyResourceMap.get("database");
            if (rangerPolicyResource != null) {
              resourceNameList = rangerPolicyResource.getValues();
              if (CollectionUtils.isNotEmpty(resourceNameList)) {
                for (int i = 0; i < resourceNameList.size(); i++) {
                  String resourceName = resourceNameList.get(i);
                  if (resourceName.equals(sourceDbName)) {
                    resourceNameList.set(i, targetDbName);
                  }
                }
              }
            }
          }
        }
      }
    }
    return rangerPolicies;
  }
RangerRestClientImpl to connect to Ranger and export policies.
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ranger/RangerRestClientImpl.java