public String getLookupSnapshotCacheState(String lookupTableName, String snapshotID) throws IOException { String url = baseUrl + "/tables/" + lookupTableName + "/" + snapshotID + "/snapshotLocalCache/state"; HttpGet get = new HttpGet(url); HttpResponse response = client.execute(get); String content = getContent(response); if (response.getStatusLine().getStatusCode() != 200) { throw new IOException(INVALID_RESPONSE + response.getStatusLine().getStatusCode() + WITH_URL + url + "\n"); } return content; }
public void buildLookupSnapshotCache(String project, String lookupTableName, String snapshotID) throws IOException { String url = baseUrl + "/tables/" + project + "/" + lookupTableName + "/" + snapshotID + "/snapshotLocalCache"; HttpPut put = new HttpPut(url); HttpResponse response = client.execute(put); getContent(response); if (response.getStatusLine().getStatusCode() != 200) { throw new IOException(INVALID_RESPONSE + response.getStatusLine().getStatusCode() + WITH_URL + url + "\n"); } }
private HashMap dealResponse(HttpResponse response) throws IOException { if (response.getStatusLine().getStatusCode() != 200) { throw new IOException(INVALID_RESPONSE + response.getStatusLine().getStatusCode()); } String result = getContent(response); HashMap resultMap = new ObjectMapper().readValue(result, HashMap.class); return resultMap; }
private boolean changeCubeStatus(String url) throws Exception { HttpPut put = newPut(url); HttpResponse response = null; try { HashMap<String, String> paraMap = new HashMap<String, String>(); String jsonMsg = new ObjectMapper().writeValueAsString(paraMap); put.setEntity(new StringEntity(jsonMsg, UTF_8)); response = client.execute(put); getContent(response); if (response.getStatusLine().getStatusCode() != 200) { throw new IOException( INVALID_RESPONSE + response.getStatusLine().getStatusCode() + WITH_URL + url + "\n" + jsonMsg); } else { return true; } } finally { cleanup(put, response); } }
public boolean buildCube(String cubeName, long startTime, long endTime, String buildType) throws Exception { String url = baseUrl + CUBES + cubeName + "/build"; HttpPut put = newPut(url); HttpResponse response = null; try { HashMap<String, String> paraMap = new HashMap<String, String>(); paraMap.put("startTime", startTime + ""); paraMap.put("endTime", endTime + ""); paraMap.put("buildType", buildType); String jsonMsg = new ObjectMapper().writeValueAsString(paraMap); put.setEntity(new StringEntity(jsonMsg, UTF_8)); response = client.execute(put); getContent(response); if (response.getStatusLine().getStatusCode() != 200) { throw new IOException(INVALID_RESPONSE + response.getStatusLine().getStatusCode() + " with build cube url " + url + "\n" + jsonMsg); } else { return true; } } finally { cleanup(put, response); } }
public String getLookupSnapshotCacheState(String lookupTableName, String snapshotID) throws IOException { String url = baseUrl + "/tables/" + lookupTableName + "/" + snapshotID + "/snapshotLocalCache/state"; HttpGet get = new HttpGet(url); HttpResponse response = client.execute(get); String content = getContent(response); if (response.getStatusLine().getStatusCode() != 200) { throw new IOException(INVALID_RESPONSE + response.getStatusLine().getStatusCode() + WITH_URL + url + "\n"); } return content; }
public void buildLookupSnapshotCache(String project, String lookupTableName, String snapshotID) throws IOException { String url = baseUrl + "/tables/" + project + "/" + lookupTableName + "/" + snapshotID + "/snapshotLocalCache"; HttpPut put = new HttpPut(url); HttpResponse response = client.execute(put); getContent(response); if (response.getStatusLine().getStatusCode() != 200) { throw new IOException(INVALID_RESPONSE + response.getStatusLine().getStatusCode() + WITH_URL + url + "\n"); } }
private HashMap dealResponse(HttpResponse response) throws IOException { if (response.getStatusLine().getStatusCode() != 200) { throw new IOException(INVALID_RESPONSE + response.getStatusLine().getStatusCode()); } String result = getContent(response); HashMap resultMap = new ObjectMapper().readValue(result, HashMap.class); return resultMap; }
private boolean changeCubeStatus(String url) throws Exception { HttpPut put = newPut(url); HttpResponse response = null; try { HashMap<String, String> paraMap = new HashMap<String, String>(); String jsonMsg = new ObjectMapper().writeValueAsString(paraMap); put.setEntity(new StringEntity(jsonMsg, UTF_8)); response = client.execute(put); getContent(response); if (response.getStatusLine().getStatusCode() != 200) { throw new IOException( INVALID_RESPONSE + response.getStatusLine().getStatusCode() + WITH_URL + url + "\n" + jsonMsg); } else { return true; } } finally { cleanup(put, response); } }
public boolean buildCube(String cubeName, long startTime, long endTime, String buildType) throws Exception { String url = baseUrl + CUBES + cubeName + "/build"; HttpPut put = newPut(url); HttpResponse response = null; try { HashMap<String, String> paraMap = new HashMap<String, String>(); paraMap.put("startTime", startTime + ""); paraMap.put("endTime", endTime + ""); paraMap.put("buildType", buildType); String jsonMsg = new ObjectMapper().writeValueAsString(paraMap); put.setEntity(new StringEntity(jsonMsg, UTF_8)); response = client.execute(put); getContent(response); if (response.getStatusLine().getStatusCode() != 200) { throw new IOException(INVALID_RESPONSE + response.getStatusLine().getStatusCode() + " with build cube url " + url + "\n" + jsonMsg); } else { return true; } } finally { cleanup(put, response); } }