All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.englishtown.vertx.zookeeper.builders.impl.DefaultGetACLBuilder Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
package com.englishtown.vertx.zookeeper.builders.impl;

import com.englishtown.vertx.zookeeper.ZooKeeperOperation;
import com.englishtown.vertx.zookeeper.builders.GetACLBuilder;
import io.vertx.core.Future;
import org.apache.zookeeper.common.PathUtils;

/**
 * Default implementation of {@link com.englishtown.vertx.zookeeper.builders.GetACLBuilder}
 */
public class DefaultGetACLBuilder implements GetACLBuilder {

    private String path;

    @Override
    public GetACLBuilder forPath(String path) {
        this.path = path;
        return this;
    }

    @Override
    public ZooKeeperOperation build() {

        String path = this.path;

        PathUtils.validatePath(path);

        return (client, handler) -> {
            client.getCuratorFramework()
                    .getACL()
                    .inBackground((curatorFramework, event) -> handler.handle(Future.succeededFuture(event)))
                    .forPath(path);
        };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy