Java 类org.apache.curator.framework.api.ProtectACLCreateModePathAndBytesable 实例源码

项目:Mastering-Mesos    文件:CuratorManager.java   
private void privateCreate(String path, Optional<byte[]> data) throws Exception {
  final long start = System.currentTimeMillis();

  try {
    ProtectACLCreateModePathAndBytesable<String> createBuilder = curator.create().creatingParentsIfNeeded();


    if (data.isPresent()) {
      createBuilder.forPath(path, data.get());
    } else {
      createBuilder.forPath(path);
    }
  } finally {
    log(OperationType.WRITE, Optional.<Integer> absent(), Optional.<Integer> of(data.or(EMPTY_BYTES).length), start, path);
  }
}
项目:jstrom    文件:TransactionalState.java   
protected static void createNode(CuratorFramework curator, String path,
        byte[] data, List<ACL> acls, CreateMode mode) throws Exception {
    ProtectACLCreateModePathAndBytesable<String> builder =
        curator.create().creatingParentsIfNeeded();

    if (acls == null) {
        if (mode == null ) {
            TransactionalState.forPath(builder, path, data);
        } else {
            TransactionalState.forPath(builder.withMode(mode), path, data);
        }
        return;
    }

    TransactionalState.forPath(builder.withACL(acls), path, data);
}
项目:Singularity    文件:CuratorManager.java   
private void privateCreate(String path, Optional<byte[]> data) throws Exception {
  final long start = System.currentTimeMillis();

  try {
    ProtectACLCreateModePathAndBytesable<String> createBuilder = curator.create().creatingParentsIfNeeded();


    if (data.isPresent()) {
      createBuilder.forPath(path, data.get());
    } else {
      createBuilder.forPath(path);
    }
  } finally {
    log(OperationType.WRITE, Optional.absent(), Optional.of(data.or(EMPTY_BYTES).length), start, path);
  }
}
项目:jstorm    文件:TransactionalStateZkStorage.java   
protected void createNode(CuratorFramework curator, String path,
                          byte[] data, List<ACL> acls, CreateMode mode) throws Exception {
    ProtectACLCreateModePathAndBytesable<String> builder =
            curator.create().creatingParentsIfNeeded();

    if (acls == null) {
        if (mode == null) {
            forPath(builder, path, data);
        } else {
            forPath(builder.withMode(mode), path, data);
        }
        return;
    }

    forPath(builder.withACL(acls), path, data);
}
项目:jstorm-0.9.6.3-    文件:ZkState.java   
public void writeBytes(String path, byte[] bytes) {
    try {
        if (_curator.checkExists().forPath(path) == null) {
            CreateBuilder builder = _curator.create();
            ProtectACLCreateModePathAndBytesable<String> createAble = (ProtectACLCreateModePathAndBytesable<String>) builder
                    .creatingParentsIfNeeded();
            createAble.withMode(CreateMode.PERSISTENT).forPath(path, bytes);
        } else {
            _curator.setData().forPath(path, bytes);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
项目:learn_jstorm    文件:ZkState.java   
public void writeBytes(String path, byte[] bytes) {
    try {
        if (_curator.checkExists().forPath(path) == null) {
            CreateBuilder builder = _curator.create();
            ProtectACLCreateModePathAndBytesable<String> createAble = (ProtectACLCreateModePathAndBytesable<String>) builder
                    .creatingParentsIfNeeded();
            createAble.withMode(CreateMode.PERSISTENT).forPath(path, bytes);
        } else {
            _curator.setData().forPath(path, bytes);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
项目:jstrom    文件:ZkState.java   
public void writeBytes(String path, byte[] bytes) {
    try {
        if (_curator.checkExists().forPath(path) == null) {
            CreateBuilder builder = _curator.create();
            ProtectACLCreateModePathAndBytesable<String> createAble = (ProtectACLCreateModePathAndBytesable<String>) builder
                    .creatingParentsIfNeeded();
            createAble.withMode(CreateMode.PERSISTENT).forPath(path, bytes);
        } else {
            _curator.setData().forPath(path, bytes);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
项目:jstrom    文件:TransactionalState.java   
protected static void createNode(CuratorFramework curator, String path, byte[] data, List<ACL> acls, CreateMode mode) throws Exception {
    ProtectACLCreateModePathAndBytesable<String> builder = curator.create().creatingParentsIfNeeded();

    if (acls == null) {
        if (mode == null) {
            TransactionalState.forPath(builder, path, data);
        } else {
            TransactionalState.forPath(builder.withMode(mode), path, data);
        }
        return;
    }

    TransactionalState.forPath(builder.withACL(acls), path, data);
}
项目:jstorm    文件:ZkState.java   
public void writeBytes(String path, byte[] bytes) {
    try {
        if (_curator.checkExists().forPath(path) == null) {
            CreateBuilder builder = _curator.create();
            ProtectACLCreateModePathAndBytesable<String> createAble = (ProtectACLCreateModePathAndBytesable<String>) builder
                    .creatingParentsIfNeeded();
            createAble.withMode(CreateMode.PERSISTENT).forPath(path, bytes);
        } else {
            _curator.setData().forPath(path, bytes);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
项目:jstorm    文件:TransactionalState.java   
protected static void createNode(CuratorFramework curator, String path,
                                 byte[] data, List<ACL> acls, CreateMode mode) throws Exception {
    ProtectACLCreateModePathAndBytesable<String> builder = curator.create().creatingParentsIfNeeded();
    if (acls == null) {
        if (mode == null) {
            TransactionalState.forPath(builder, path, data);
        } else {
            TransactionalState.forPath(builder.withMode(mode), path, data);
        }
        return;
    }
    TransactionalState.forPath(builder.withACL(acls), path, data);
}
项目:vespa    文件:MockCurator.java   
@Override
public ProtectACLCreateModePathAndBytesable<String> creatingParentsIfNeeded() {
    createParents = true;
    return this;
}
项目:vespa    文件:MockCurator.java   
@Override
public ProtectACLCreateModePathAndBytesable<String> creatingParentContainersIfNeeded() {
    // TODO: Add proper support for container nodes, see https://issues.apache.org/jira/browse/ZOOKEEPER-2163.
    return creatingParentsIfNeeded();
}