/** * Converts a {@link Future} to a {@link Promise} * * @param future * @param <T> * @return */ default <T> Promise<T> toPromise(Future<T> future) { return toPromise(future::setHandler); }
/** * Deploy a verticle programmatically * * @param name The verticle identifier * @return A promise for the deployment id */ @Override public Promise<String> deployVerticle(String name) { return adapter.toPromise(handler -> vertx.deployVerticle(name, handler)); }
/** * Deploy a verticle programmatically * * @param verticle The verticle instance to deploy * @param options The deployment options * @return A promise for the deployment id */ @Override public Promise<String> deployVerticle(Verticle verticle, DeploymentOptions options) { return adapter.toPromise(handler -> vertx.deployVerticle(verticle, options, handler)); }
/** * Deploy a verticle programmatically * * @param name The verticle identifier * @return A promise for the deployment id */ @Override public Promise<String> deployVerticle(String name) { return adapter.toPromise(handler -> vertx.deployVerticle(name, handler)); }
/** * Deploy a verticle programmatically * * @param name The verticle identifier * @param options The deployment options * @return A promise for the deployment id */ @Override public Promise<String> deployVerticle(String name, DeploymentOptions options) { return adapter.toPromise(handler -> vertx.deployVerticle(name, options, handler)); }
/** * Send a message * * @param address The address to send it to * @param message The message, may be {@code null} * @param options * @return A promise for a reply */ @Override public <T> Promise<Message<T>> send(String address, Object message, DeliveryOptions options) { return adapter.toPromise(handler -> eventBus.send(address, message, options, handler)); }
/** * Undeploy a verticle * * @param deploymentID The deployment ID * @return A promise for undeployment completion */ @Override public Promise<Void> undeploy(String deploymentID) { return adapter.toPromise(handler -> vertx.undeploy(deploymentID, handler)); }
/** * Unlinks the link on the file system represented by the path {@code link}, asynchronously. * * @param link the link * @return a promise for completion */ @Override public Promise<Void> unlink(String link) { return adapter.toPromise(handler -> vertx.fileSystem().unlink(link, handler)); }
/** * Returns the path representing the file that the symbolic link specified by {@code link} points to, asynchronously. * * @param link the link * @return a promise for the path */ @Override public Promise<String> readSymlink(String link) { return adapter.toPromise(handler -> vertx.fileSystem().readSymlink(link, handler)); }
/** * Read the contents of the directory specified by {@code path}, asynchronously. * <p> * The result is an array of String representing the paths of the files inside the directory. * * @param path path to the file * @return a promise for the contents */ @Override public Promise<List<String>> readDir(String path) { return adapter.toPromise(handler -> vertx.fileSystem().readDir(path, handler)); }
/** * Creates an empty file with the specified {@code path} and permissions {@code perms}, asynchronously. * * @param path path to the file * @param perms the permissions string * @return a promise for completion */ @Override public Promise<Void> createFile(String path, String perms) { return adapter.toPromise(handler -> vertx.fileSystem().createFile(path, perms, handler)); }
/** * Returns the path representing the file that the symbolic link specified by {@code link} points to, asynchronously. * * @param link the link * @return a promise for the path */ @Override public Promise<String> readSymlink(String link) { return adapter.toPromise(handler -> vertx.fileSystem().readSymlink(link, handler)); }
/** * Creates the file, and writes the specified {@code Buffer data} to the file represented by the path {@code path}, * asynchronously. * * @param path path to the file * @param data * @return a promise for completion */ @Override public Promise<Void> writeFile(String path, Buffer data) { return adapter.toPromise(handler -> vertx.fileSystem().writeFile(path, data, handler)); }
/** * Determines whether the file as specified by the path {@code path} exists, asynchronously. * * @param path path to the file * @return a promise for existence */ @Override public Promise<Boolean> exists(String path) { return adapter.toPromise(handler -> vertx.fileSystem().exists(path, handler)); }
/** * Create a hard link on the file system from {@code link} to {@code existing}, asynchronously. * * @param link the link * @param existing the link destination * @return a promise for completion */ @Override public Promise<Void> link(String link, String existing) { return adapter.toPromise(handler -> vertx.fileSystem().link(link, existing, handler)); }
/** * Creates an empty file with the specified {@code path} and permissions {@code perms}, asynchronously. * * @param path path to the file * @param perms the permissions string * @return a promise for completion */ @Override public Promise<Void> createFile(String path, String perms) { return adapter.toPromise(handler -> vertx.fileSystem().createFile(path, perms, handler)); }
/** * Move a file from the path {@code from} to path {@code to}, asynchronously. * <p> * The move will fail if the destination already exists. * * @param from the path to copy from * @param to the path to copy to * @return a promise for completion */ @Override public Promise<Void> move(String from, String to) { return adapter.toPromise(handler -> vertx.fileSystem().move(from, to, handler)); }
/** * Open the file represented by {@code path}, asynchronously. * <p> * The file is opened for both reading and writing. If the file does not already exist it will be created. * * @param path path to the file * @param options options describing how the file should be opened * @return a promise for the async file */ @Override public Promise<AsyncFile> open(String path, OpenOptions options) { return adapter.toPromise(handler -> vertx.fileSystem().open(path, options, handler)); }
/** * Create a hard link on the file system from {@code link} to {@code existing}, asynchronously. * * @param link the link * @param existing the link destination * @return a promise for completion */ @Override public Promise<Void> link(String link, String existing) { return adapter.toPromise(handler -> vertx.fileSystem().link(link, existing, handler)); }
/** * Create a symbolic link on the file system from {@code link} to {@code existing}, asynchronously. * * @param link the link * @param existing the link destination * @return a promise for completion */ @Override public Promise<Void> symlink(String link, String existing) { return adapter.toPromise(handler -> vertx.fileSystem().symlink(link, existing, handler)); }