/** * rest api : convert volume name to id by calling mapr's rest api * @param vName volume name * @param site site Name * */ @Path(MAPRFSResourceConstants.MAPRFS_VNAME_RESOLVER) @GET // The Java method will produce content identified by the MIME Media type "text/plain" @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) public String getVid(@QueryParam("vName") String vName, @QueryParam("site") String site) { String ans= "VOLUME ID NOT FOUDN"; try{ // call mapr rest api to get corresponding id; Map<String, Object> config = getAppConfig(site, MAPRFS_APPLICATION); String username; String password; username = (String) config.get(MAPRFSResourceConstants.MAPRFS_USERNAME); password = (String) config.get(MAPRFSResourceConstants.MAPRFS_PASSWORD); // call String restUrl = (String) config.get(MAPRFSResourceConstants.MAPRFS_WEBUI_HTTPS) + MAPRFSResourceConstants.MAPRFS_VOLUME_INFO + "?name=" + vName; JSONObject response = HttpRequest.executeGet(restUrl,username,password); ans = extractVolumeId(response); }catch (Exception e){ LOG.info("maprfs: can not convert volume name" + vName + " to id", e); } return ans; }
JSONObject response = HttpRequest.executeGet(restUrl,username,password); volumelist = extractVolumeList(response); List<String> res = new ArrayList<>();