List of usage examples for io.vertx.core Future failedFuture
static <T> Future<T> failedFuture(String failureMessage)
From source file:io.hijynx.ensemble.identity.PrivilegeServiceVertxEBProxy.java
License:Apache License
public PrivilegeService retrievePrivilege(String id, Handler<AsyncResult<Privilege>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/* ww w.j a va2 s . c o m*/ JsonObject _json = new JsonObject(); _json.put("id", id); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "retrievePrivilege"); _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() == null ? null : new Privilege(res.result().body()))); } }); return this; }
From source file:io.hijynx.ensemble.identity.PrivilegeServiceVertxEBProxy.java
License:Apache License
public PrivilegeService retrievePrivilegeByName(String privilegeName, Handler<AsyncResult<Privilege>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }//from w ww .j a v a2 s . c om JsonObject _json = new JsonObject(); _json.put("privilegeName", privilegeName); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "retrievePrivilegeByName"); _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() == null ? null : new Privilege(res.result().body()))); } }); return this; }
From source file:io.hijynx.ensemble.identity.PrivilegeServiceVertxEBProxy.java
License:Apache License
public PrivilegeService retrieveAllPrivileges(Handler<AsyncResult<List<Privilege>>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from w w w . j a v a2s . c o m*/ JsonObject _json = new JsonObject(); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "retrieveAllPrivileges"); _vertx.eventBus().<JsonArray>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler .handle(Future .succeededFuture( res.result().body().stream() .map(o -> o instanceof Map ? new Privilege(new JsonObject((Map) o)) : new Privilege((JsonObject) o)) .collect(Collectors.toList()))); } }); return this; }
From source file:io.hijynx.ensemble.identity.PrivilegeServiceVertxEBProxy.java
License:Apache License
public PrivilegeService updatePrivilege(Privilege privilege, Handler<AsyncResult<Privilege>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }// w w w . j a va2 s . com JsonObject _json = new JsonObject(); _json.put("privilege", privilege == null ? null : privilege.toJson()); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "updatePrivilege"); _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() == null ? null : new Privilege(res.result().body()))); } }); return this; }
From source file:io.hijynx.ensemble.identity.PrivilegeServiceVertxEBProxy.java
License:Apache License
public PrivilegeService deletePrivilege(String id, Handler<AsyncResult<Void>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from w ww . j ava 2 s.c o m*/ JsonObject _json = new JsonObject(); _json.put("id", id); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "deletePrivilege"); _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler.handle(Future.succeededFuture(res.result().body())); } }); return this; }
From source file:io.hijynx.ensemble.identity.RoleServiceVertxEBProxy.java
License:Apache License
public RoleService addRole(Role role, Handler<AsyncResult<Void>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from w w w .j av a 2 s. c om*/ JsonObject _json = new JsonObject(); _json.put("role", role == null ? null : role.toJson()); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "addRole"); _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler.handle(Future.succeededFuture(res.result().body())); } }); return this; }
From source file:io.hijynx.ensemble.identity.RoleServiceVertxEBProxy.java
License:Apache License
public RoleService retrieveRole(String id, Handler<AsyncResult<Role>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from w ww. j a v a2s . com*/ JsonObject _json = new JsonObject(); _json.put("id", id); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "retrieveRole"); _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() == null ? null : new Role(res.result().body()))); } }); return this; }
From source file:io.hijynx.ensemble.identity.RoleServiceVertxEBProxy.java
License:Apache License
public RoleService retrieveRoleByName(String rolename, Handler<AsyncResult<Role>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from ww w. j a va 2 s.c o m*/ JsonObject _json = new JsonObject(); _json.put("rolename", rolename); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "retrieveRoleByName"); _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() == null ? null : new Role(res.result().body()))); } }); return this; }
From source file:io.hijynx.ensemble.identity.RoleServiceVertxEBProxy.java
License:Apache License
public RoleService retrieveAllRoles(Handler<AsyncResult<List<Role>>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*w w w.ja v a 2 s . c o m*/ JsonObject _json = new JsonObject(); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "retrieveAllRoles"); _vertx.eventBus().<JsonArray>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler.handle(Future.succeededFuture(res.result().body().stream() .map(o -> o instanceof Map ? new Role(new JsonObject((Map) o)) : new Role((JsonObject) o)) .collect(Collectors.toList()))); } }); return this; }
From source file:io.hijynx.ensemble.identity.RoleServiceVertxEBProxy.java
License:Apache License
public RoleService updateRole(Role role, Handler<AsyncResult<Role>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }//from w w w . j a v a 2 s .c o m JsonObject _json = new JsonObject(); _json.put("role", role == null ? null : role.toJson()); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "updateRole"); _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() == null ? null : new Role(res.result().body()))); } }); return this; }