@Override public void handle(IAsyncResult<List<SearchResultEntry>> results) { if (results.isSuccess()) { List<ILdapSearchEntry> searchResults = toSearchEntry(results.getResult()); resultHandler.handle(AsyncResultImpl.create(searchResults)); } else { resultHandler.handle(AsyncResultImpl.<List<ILdapSearchEntry>>create(results.getError())); } } });
@Override public void run() { timerHandler.handle(timerId); } };
/** * Convenience method for creating an async result. * @param result the result * @return result of type T */ public static final <T> AsyncResultImpl<T> create(T result, Class<T> type) { return new AsyncResultImpl<>(result); }
@Override public void completed() { succeeded = true; fireHandler(); }
@Override public void handle(IAsyncResult<List<SearchResultEntry>> results) { if (results.isSuccess()) { List<ILdapSearchEntry> searchResults = toSearchEntry(results.getResult()); resultHandler.handle(AsyncResultImpl.create(searchResults)); } else { resultHandler.handle(AsyncResultImpl.<List<ILdapSearchEntry>>create(results.getError())); } } });
/** * Convenience method for creating an async result. * @param result the result * @return result of type T */ public static final <T> AsyncResultImpl<T> create(T result) { return new AsyncResultImpl<>(result); }
@Override public void completed(T result) { this.result = result; succeeded = true; fireHandler(); }
@Override public void connect(LdapConfigBean config, final IAsyncResultHandler<ILdapClientConnection> handler) { final LdapClientConnectionImpl connection = new LdapClientConnectionImpl(vertx, config, DEFAULT_SOCKET_FACTORY); connection.connect(result -> { if (result.isSuccess()) { handler.handle(AsyncResultImpl.create(connection)); } else { handler.handle(AsyncResultImpl.create(result.getError())); } }); }
/** * Called to handle a body chunk. * @param chunk */ protected void handleBody(IApimanBuffer chunk) { if (bodyHandler != null) { bodyHandler.handle(chunk); } }
/** * @see io.apiman.gateway.engine.io.IWriteStream#end() */ @Override public void end() { if (endHandler != null) { endHandler.handle((Void) null); } finished = true; }
/** * Signals the end of the stream. */ protected void handleEnd() { if (endHandler != null) { endHandler.handle((Void) null); } finished = true; } }