List of usage examples for io.vertx.core.json JsonObject put
public JsonObject put(String key, Object value)
From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java
License:Apache License
public TaskService suspend(Long taskId, String userId, Handler<AsyncResult<Void>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }//from ww w .j a va 2 s . c om JsonObject _json = new JsonObject(); _json.put("taskId", taskId); _json.put("userId", userId); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "suspend"); _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); return this; }
From source file:com.edgar.vertx.serviceproxy.provider.ProcessorServiceVertxEBProxy.java
License:Apache License
public void process(JsonObject document, Handler<AsyncResult<JsonObject>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;//w w w. ja va2 s . co m } JsonObject _json = new JsonObject(); _json.put("document", document); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "process"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.emikra.vertx.oak.OakServiceVertxEBProxy.java
License:Apache License
public void createNode(CreateNodeOptions options, Handler<AsyncResult<JsonObject>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;//from www . ja v a2 s . c om } JsonObject _json = new JsonObject(); _json.put("options", options == null ? null : options.toJson()); DeliveryOptions _deliveryOptions = new DeliveryOptions(); _deliveryOptions.addHeader("action", "createNode"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.emikra.vertx.orientdb.OrientDBServiceVertxEBProxy.java
License:Apache License
public void createDatabase(CreateDatabaseParams options, Handler<AsyncResult<JsonObject>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;/* ww w. jav a 2 s. c om*/ } JsonObject _json = new JsonObject(); _json.put("options", options == null ? null : options.toJson()); DeliveryOptions _deliveryOptions = new DeliveryOptions(); _deliveryOptions.addHeader("action", "createDatabase"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.emikra.vertx.orientdb.OrientDBServiceVertxEBProxy.java
License:Apache License
public void createDocument(JsonObject document, Handler<AsyncResult<JsonObject>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;//from ww w. j a v a 2 s . c o m } JsonObject _json = new JsonObject(); _json.put("document", document); DeliveryOptions _deliveryOptions = new DeliveryOptions(); _deliveryOptions.addHeader("action", "createDocument"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.emikra.vertx.orientdb.OrientDBServiceVertxEBProxy.java
License:Apache License
public void createVertex(JsonObject vertexDoc, Handler<AsyncResult<JsonObject>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;/*from www . j av a 2 s . c om*/ } JsonObject _json = new JsonObject(); _json.put("vertexDoc", vertexDoc); DeliveryOptions _deliveryOptions = new DeliveryOptions(); _deliveryOptions.addHeader("action", "createVertex"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.emikra.vertx.orientdb.OrientDBServiceVertxEBProxy.java
License:Apache License
public void createEdge(JsonObject edgeDoc, Handler<AsyncResult<JsonObject>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;/*from w w w . ja va 2 s . c om*/ } JsonObject _json = new JsonObject(); _json.put("edgeDoc", edgeDoc); DeliveryOptions _deliveryOptions = new DeliveryOptions(); _deliveryOptions.addHeader("action", "createEdge"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.emikra.vertx.orientdb.OrientDBServiceVertxEBProxy.java
License:Apache License
public void createClass(CreateClassParams params, Handler<AsyncResult<JsonObject>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;/* w w w .j av a 2 s . c om*/ } JsonObject _json = new JsonObject(); _json.put("params", params == null ? null : params.toJson()); DeliveryOptions _deliveryOptions = new DeliveryOptions(); _deliveryOptions.addHeader("action", "createClass"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.emikra.vertx.orientdb.OrientDBServiceVertxEBProxy.java
License:Apache License
public void getDocument(JsonObject docQuery, Handler<AsyncResult<JsonObject>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;//from ww w .j av a 2 s. c om } JsonObject _json = new JsonObject(); _json.put("docQuery", docQuery); DeliveryOptions _deliveryOptions = new DeliveryOptions(); _deliveryOptions.addHeader("action", "getDocument"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.emikra.vertx.orientdb.OrientDBServiceVertxEBProxy.java
License:Apache License
public void getVertex(JsonObject vertexQuery, Handler<AsyncResult<JsonObject>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;/*from w ww .ja v a 2 s. c om*/ } JsonObject _json = new JsonObject(); _json.put("vertexQuery", vertexQuery); DeliveryOptions _deliveryOptions = new DeliveryOptions(); _deliveryOptions.addHeader("action", "getVertex"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); }