@Override
  public RangerExportPolicyList readRangerPoliciesFromJsonFile(Path filePath,
                                                               HiveConf conf) throws SemanticException {
    RangerExportPolicyList rangerExportPolicyList = null;
    Gson gsonBuilder = new GsonBuilder().setDateFormat("yyyyMMdd-HH:mm:ss.SSS-Z").setPrettyPrinting().create();
    try {
      FileSystem fs = filePath.getFileSystem(conf);
      InputStream inputStream = fs.open(filePath);
      Reader reader = new InputStreamReader(inputStream, Charset.forName("UTF-8"));
      rangerExportPolicyList = gsonBuilder.fromJson(reader, RangerExportPolicyList.class);
    } catch (FileNotFoundException e) {
      //If the ranger policies are not present, json file will not be present
      return rangerExportPolicyList;
    } catch (Exception ex) {
      throw new SemanticException("Error reading file :" + filePath, ex);
    }
    return rangerExportPolicyList;
  }
RangerRestClientImpl to connect to Ranger and export policies.
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ranger/RangerRestClientImpl.java