/** * returns the string representation of json format of this config. * * @return * @throws ParseJsonException */ public String asJson() throws ParseJsonException { return JsonUtil.toJson(toMap()); }
HashMap<String, String> configMap = JsonUtil.fromJson(requestBody, HashMap.class); if (configMap != null && configMap.containsKey("bookie_src")) { try {
requestJsonBody = JsonUtil.fromJson(requestBody, RecoveryRequestJsonBody.class); LOG.debug("bookie_src: [" + requestJsonBody.bookieSrc.get(0) + "], delete_cookie: [" + requestJsonBody.deleteCookie + "]");
/** * returns the string representation of json format of this config. * * @return * @throws ParseJsonException */ public String asJson() { try { return JsonUtil.toJson(toMap()); } catch (ParseJsonException e) { throw new RuntimeException("Failed to serialize the configuration as json", e); } }
HashMap<String, Object> configMap = JsonUtil.fromJson(requestBody, HashMap.class); for (Map.Entry<String, Object> entry: configMap.entrySet()) { conf.setProperty(entry.getKey(), entry.getValue());
String jsonResponse = JsonUtil.toJson(output); LOG.debug("output body:" + jsonResponse); response.setBody(jsonResponse);
HashMap<String, Integer> configMap = JsonUtil.fromJson(requestBody, HashMap.class); if (configMap != null && configMap.containsKey("delay_seconds")) { int delaySeconds = configMap.get("delay_seconds");
String jsonResponse = JsonUtil.toJson(output); LOG.debug("output body:" + jsonResponse); response.setBody(jsonResponse);
LOG.debug("bookie: " + b.toString() + " hostname:" + b.getHostName()); String jsonResponse = JsonUtil.toJson(output);
@Override public HttpServiceResponse handle(HttpServiceRequest request) throws Exception { HttpServiceResponse response = new HttpServiceResponse(); Map<String, String> params = request.getParams(); if (HttpServer.Method.GET == request.getMethod() && (params != null) && params.containsKey("ledger_id")) { Long ledgerId = Long.parseLong(params.get("ledger_id")); LedgerManagerFactory mFactory = bookieServer.getBookie().getLedgerManagerFactory(); LedgerManager manager = mFactory.newLedgerManager(); // output <ledgerId: ledgerMetadata> Map<String, Object> output = Maps.newHashMap(); LedgerMetadata md = manager.readLedgerMetadata(ledgerId).get().getValue(); output.put(ledgerId.toString(), md); manager.close(); String jsonResponse = JsonUtil.toJson(output); LOG.debug("output body:" + jsonResponse); response.setBody(jsonResponse); response.setCode(HttpServer.StatusCode.OK); return response; } else { response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Not found method. Should be GET method"); return response; } } }
response.setCode(HttpServer.StatusCode.OK); String jsonResponse = JsonUtil .toJson(printMissingReplica ? outputLedgersWithMissingReplica : outputLedgers); LOG.debug("output body: " + jsonResponse); response.setBody(jsonResponse);
String jsonResponse = JsonUtil.toJson(output); LOG.debug("output body:" + jsonResponse); response.setBody(jsonResponse);
String jsonResponse = JsonUtil.toJson(output); if (LOG.isDebugEnabled()) { LOG.debug("output body:" + jsonResponse); Boolean isInForceGC = bookieServer.getBookie().getLedgerStorage().isInForceGC(); Pair<String, String> output = Pair.of("is_in_force_gc", isInForceGC.toString()); String jsonResponse = JsonUtil.toJson(output); if (LOG.isDebugEnabled()) { LOG.debug("output body:" + jsonResponse);
@Override public HttpServiceResponse handle(HttpServiceRequest request) throws Exception { HttpServiceResponse response = new HttpServiceResponse(); if (HttpServer.Method.GET == request.getMethod()) { List<GarbageCollectionStatus> details = bookieServer.getBookie() .getLedgerStorage().getGarbageCollectionStatus(); String jsonResponse = JsonUtil.toJson(details); if (LOG.isDebugEnabled()) { LOG.debug("output body:" + jsonResponse); } response.setBody(jsonResponse); response.setCode(HttpServer.StatusCode.OK); return response; } else { response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Only support GET method to retrieve GC details." + " If you want to trigger gc, send a POST to gc endpoint."); return response; } } }
String jsonResponse = JsonUtil.toJson(output); LOG.debug("output body:" + jsonResponse); response.setBody(jsonResponse);
String jsonResponse = JsonUtil.toJson(output); LOG.debug("output body:" + jsonResponse); response.setBody(jsonResponse);
String jsonResponse = JsonUtil.toJson(output); LOG.debug("output body:" + jsonResponse); response.setBody(jsonResponse);