public QueryStatus queryPost(String tablespace, String key, String query, String partition) throws IOException { Map<String, Object> params = new HashMap<String, Object>(); params.put("sql", query); params.put("key", new String[]{key}); params.put("partition", partition); try { HttpContent content = new StringHttpContent(JSONSerDe.ser(params)); HttpRequest request = requestFactory.buildPostRequest(new GenericUrl( qNodes[(int) (Math.random() * qNodes.length)] + "/api/query/" + tablespace), content); HttpResponse resp = request.execute(); return JSONSerDe.deSer(asString(resp.getContent()), QueryStatus.class); } catch (JSONSerDeException e) { throw new IOException(e); } }
public QueryStatus queryPost(String tablespace, String key, String query, String partition) throws IOException { Map<String, Object> params = new HashMap<String, Object>(); params.put("sql", query); params.put("key", new String[] { key }); params.put("partition", partition); try { HttpContent content = new StringHttpContent(JSONSerDe.ser(params)); HttpRequest request = requestFactory.buildPostRequest(new GenericUrl( qNodes[(int) (Math.random() * qNodes.length)] + "/api/query/" + tablespace), content); HttpResponse resp = request.execute(); return JSONSerDe.deSer(asString(resp.getContent()), QueryStatus.class); } catch(JSONSerDeException e) { throw new IOException(e); } } }
public DeployInfo deploy(final DeployRequest... requests) throws IOException { try { String strCont = JSONSerDe.ser(new ArrayList<DeployRequest>(Arrays.asList(requests))); HttpContent content = new StringHttpContent(strCont); HttpRequest request = requestFactory.buildPostRequest(new GenericUrl( qNodes[(int) (Math.random() * qNodes.length)] + "/api/deploy"), content); HttpResponse resp = request.execute(); return JSONSerDe.deSer(asString(resp.getContent()), DeployInfo.class); } catch(JSONSerDeException e) { throw new IOException(e); } }
public DeployInfo deploy(final DeployRequest... requests) throws IOException { try { String strCont = JSONSerDe.ser(new ArrayList<DeployRequest>(Arrays.asList(requests))); HttpContent content = new StringHttpContent(strCont); HttpRequest request = requestFactory.buildPostRequest(new GenericUrl( qNodes[(int) (Math.random() * qNodes.length)] + "/api/deploy"), content); HttpResponse resp = request.execute(); return JSONSerDe.deSer(asString(resp.getContent()), DeployInfo.class); } catch (JSONSerDeException e) { throw new IOException(e); } }