public String getRangerExportUrl(String sourceRangerEndpoint, String rangerHiveServiceName,
                            String dbName) throws URISyntaxException {
    URIBuilder uriBuilder = new URIBuilder(sourceRangerEndpoint);
    uriBuilder.setPath(RANGER_REST_URL_EXPORTJSONFILE);
    uriBuilder.addParameter("serviceName", rangerHiveServiceName);
    uriBuilder.addParameter("polResource", dbName);
    uriBuilder.addParameter("resource:database", dbName);
    uriBuilder.addParameter("serviceType", "hive");
    uriBuilder.addParameter("resourceMatchScope", "self_or_ancestor");
    uriBuilder.addParameter("resourceMatch", "full");
    return uriBuilder.build().toString();
  }
RangerRestClientImpl to connect to Ranger and export policies.
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ranger/RangerRestClientImpl.java