public class ZKPaths
extends java.lang.Object
| Modifier and Type | Class | Description |
|---|---|---|
static class |
ZKPaths.PathAndNode |
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
PATH_SEPARATOR |
Zookeeper's path separator character.
|
| Modifier and Type | Method | Description |
|---|---|---|
static void |
deleteChildren(org.apache.zookeeper.ZooKeeper zookeeper,
java.lang.String path,
boolean deleteSelf) |
Recursively deletes children of a node.
|
static java.lang.String |
fixForNamespace(java.lang.String namespace,
java.lang.String path) |
Apply the namespace to the given path
|
static java.lang.String |
fixForNamespace(java.lang.String namespace,
java.lang.String path,
boolean isSequential) |
Apply the namespace to the given path
|
static org.apache.zookeeper.CreateMode |
getContainerCreateMode() |
|
static java.lang.String |
getNodeFromPath(java.lang.String path) |
Given a full path, return the node name.
|
static ZKPaths.PathAndNode |
getPathAndNode(java.lang.String path) |
Given a full path, return the node name and its path.
|
static java.util.List<java.lang.String> |
getSortedChildren(org.apache.zookeeper.ZooKeeper zookeeper,
java.lang.String path) |
Return the children of the given path sorted by sequence number
|
static boolean |
hasContainerSupport() |
Returns true if the version of ZooKeeper client in use supports containers
|
static java.lang.String |
makePath(java.lang.String parent,
java.lang.String child) |
Given a parent path and a child node, create a combined full path
|
static java.lang.String |
makePath(java.lang.String parent,
java.lang.String firstChild,
java.lang.String... restChildren) |
Given a parent path and a list of children nodes, create a combined full path
|
static void |
mkdirs(org.apache.zookeeper.ZooKeeper zookeeper,
java.lang.String path) |
Make sure all the nodes in the path are created.
|
static void |
mkdirs(org.apache.zookeeper.ZooKeeper zookeeper,
java.lang.String path,
boolean makeLastNode) |
Make sure all the nodes in the path are created.
|
static void |
mkdirs(org.apache.zookeeper.ZooKeeper zookeeper,
java.lang.String path,
boolean makeLastNode,
InternalACLProvider aclProvider) |
Make sure all the nodes in the path are created.
|
static void |
mkdirs(org.apache.zookeeper.ZooKeeper zookeeper,
java.lang.String path,
boolean makeLastNode,
InternalACLProvider aclProvider,
boolean asContainers) |
Make sure all the nodes in the path are created.
|
static java.util.List<java.lang.String> |
split(java.lang.String path) |
Given a full path, return the the individual parts, without slashes.
|
public static final java.lang.String PATH_SEPARATOR
public static org.apache.zookeeper.CreateMode getContainerCreateMode()
CreateMode.CONTAINER if the ZK JAR supports it. Otherwise CreateMode.PERSISTENTpublic static boolean hasContainerSupport()
public static java.lang.String fixForNamespace(java.lang.String namespace,
java.lang.String path)
namespace - namespace (can be null)path - pathpublic static java.lang.String fixForNamespace(java.lang.String namespace,
java.lang.String path,
boolean isSequential)
namespace - namespace (can be null)path - pathisSequential - if the path is being created with a sequential flagpublic static java.lang.String getNodeFromPath(java.lang.String path)
path - the pathpublic static ZKPaths.PathAndNode getPathAndNode(java.lang.String path)
path - the pathpublic static java.util.List<java.lang.String> split(java.lang.String path)
path - the pathpublic static void mkdirs(org.apache.zookeeper.ZooKeeper zookeeper,
java.lang.String path)
throws java.lang.InterruptedException,
org.apache.zookeeper.KeeperException
zookeeper - the clientpath - path to ensurejava.lang.InterruptedException - thread interruptionorg.apache.zookeeper.KeeperException - Zookeeper errorspublic static void mkdirs(org.apache.zookeeper.ZooKeeper zookeeper,
java.lang.String path,
boolean makeLastNode)
throws java.lang.InterruptedException,
org.apache.zookeeper.KeeperException
zookeeper - the clientpath - path to ensuremakeLastNode - if true, all nodes are created. If false, only the parent nodes are createdjava.lang.InterruptedException - thread interruptionorg.apache.zookeeper.KeeperException - Zookeeper errorspublic static void mkdirs(org.apache.zookeeper.ZooKeeper zookeeper,
java.lang.String path,
boolean makeLastNode,
InternalACLProvider aclProvider)
throws java.lang.InterruptedException,
org.apache.zookeeper.KeeperException
zookeeper - the clientpath - path to ensuremakeLastNode - if true, all nodes are created. If false, only the parent nodes are createdaclProvider - if not null, the ACL provider to use when creating parent nodesjava.lang.InterruptedException - thread interruptionorg.apache.zookeeper.KeeperException - Zookeeper errorspublic static void mkdirs(org.apache.zookeeper.ZooKeeper zookeeper,
java.lang.String path,
boolean makeLastNode,
InternalACLProvider aclProvider,
boolean asContainers)
throws java.lang.InterruptedException,
org.apache.zookeeper.KeeperException
zookeeper - the clientpath - path to ensuremakeLastNode - if true, all nodes are created. If false, only the parent nodes are createdaclProvider - if not null, the ACL provider to use when creating parent nodesasContainers - if true, nodes are created as CreateMode.CONTAINERjava.lang.InterruptedException - thread interruptionorg.apache.zookeeper.KeeperException - Zookeeper errorspublic static void deleteChildren(org.apache.zookeeper.ZooKeeper zookeeper,
java.lang.String path,
boolean deleteSelf)
throws java.lang.InterruptedException,
org.apache.zookeeper.KeeperException
zookeeper - the clientpath - path of the node to deletedeleteSelf - flag that indicates that the node should also get deletedjava.lang.InterruptedExceptionorg.apache.zookeeper.KeeperExceptionpublic static java.util.List<java.lang.String> getSortedChildren(org.apache.zookeeper.ZooKeeper zookeeper,
java.lang.String path)
throws java.lang.InterruptedException,
org.apache.zookeeper.KeeperException
zookeeper - the clientpath - the pathjava.lang.InterruptedException - thread interruptionorg.apache.zookeeper.KeeperException - zookeeper errorspublic static java.lang.String makePath(java.lang.String parent,
java.lang.String child)
parent - the parentchild - the childpublic static java.lang.String makePath(java.lang.String parent,
java.lang.String firstChild,
java.lang.String... restChildren)
parent - the parentfirstChild - the first children in the pathrestChildren - the rest of the children in the pathCopyright © 2011–2018 The Apache Software Foundation. All rights reserved.