public StreamData getStream(UUID streamID) {
   // probably should do this over UDP.
   try {
     JSONRPC2Request jr = new JSONRPC2Request("getstream", id.getAndIncrement());
     Map<String, Object> params = new HashMap<String, Object>();
     params.put("streamid", streamID.toString());
     jr.setNamedParams(params);
     JSONRPC2Response jres = jsonSession.send(jr);
     if (jres.indicatesSuccess()) {
       Map<String, Object> jo = (Map<String, Object>) jres.getResult();
       if ((Boolean) jo.get("present")) {
         StreamData sd = new StreamData();
         sd.currentLog = UUID.fromString((String) jo.get("currentlog"));
         sd.startPos = (Long) jo.get("startpos");
         sd.epoch = (Long) jo.get("epoch");
         sd.startLog = UUID.fromString((String) jo.get("startlog"));
         return sd;
       } else {
         return null;
       }
     }
   } catch (Exception e) {
     log.error("other error", e);
     return null;
   }
   return null;
 }
 /**
  * Force the configuration master to install a new view. This method should only be called during
  * testing.
  *
  * @param v The new view to install.
  */
 @Override
 public void forceNewView(CorfuDBView v) {
   try {
     JSONRPC2Request jr = new JSONRPC2Request("newview", id.getAndIncrement());
     Map<String, Object> params = new HashMap<String, Object>();
     params.put("newview", v.getSerializedJSONView().toString());
     jr.setNamedParams(params);
     JSONRPC2Response jres = jsonSession.send(jr);
     if (jres.indicatesSuccess() && (Boolean) jres.getResult()) {}
   } catch (Exception e) {
   }
 }
 public String getLog(UUID logID) {
   try {
     JSONRPC2Request jr = new JSONRPC2Request("getlog", id.getAndIncrement());
     Map<String, Object> params = new HashMap<String, Object>();
     params.put("logid", logID.toString());
     jr.setNamedParams(params);
     JSONRPC2Response jres = jsonSession.send(jr);
     if (jres.indicatesSuccess()) {
       return (String) jres.getResult();
     }
     return null;
   } catch (Exception e) {
     return null;
   }
 }
 /**
  * Request reconfiguration due to a network exception.
  *
  * @param e The network exception that caused the reconfiguration request.
  */
 @Override
 public void requestReconfiguration(NetworkException e) {
   try {
     JSONRPC2Request jr = new JSONRPC2Request("reconfig", id.getAndIncrement());
     Map<String, Object> params = new HashMap<String, Object>();
     if (e != null) {
       params.put(
           "exception",
           java.util.Base64.getEncoder().encodeToString(Serializer.serialize_compressed(e)));
     }
     jr.setNamedParams(params);
     JSONRPC2Response jres = jsonSession.send(jr);
     if (jres.indicatesSuccess() && (Boolean) jres.getResult()) {}
   } catch (Exception ex) {
   }
 }
 public boolean addLog(UUID logID, String path) {
   try {
     JSONRPC2Request jr = new JSONRPC2Request("addlog", id.getAndIncrement());
     Map<String, Object> params = new HashMap<String, Object>();
     params.put("logid", logID.toString());
     params.put("path", path);
     jr.setNamedParams(params);
     JSONRPC2Response jres = jsonSession.send(jr);
     if (jres.indicatesSuccess() && (Boolean) jres.getResult()) {
       return true;
     }
     return false;
   } catch (Exception e) {
     return false;
   }
 }
  public boolean addStreamCM(UUID logID, UUID streamID, long pos, boolean nopass) {
    try {
      JSONRPC2Request jr = new JSONRPC2Request("addstream", id.getAndIncrement());
      Map<String, Object> params = new HashMap<String, Object>();
      params.put("logid", logID.toString());
      params.put("streamid", streamID.toString());
      params.put("startpos", pos);
      params.put("nopass", nopass);

      jr.setNamedParams(params);
      JSONRPC2Response jres = jsonSession.send(jr);
      if (jres.indicatesSuccess() && (Boolean) jres.getResult()) {
        return true;
      }
      return false;
    } catch (Exception e) {
      log.debug("Error sending addstream", e);
      return false;
    }
  }