public class ZKPaths
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ZKPaths.PathAndNode |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
fixForNamespace(java.lang.String namespace,
java.lang.String path)
Apply the namespace to the given path
|
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 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 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.
|
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 getNodeFromPath(java.lang.String path)
path
- the pathpublic static ZKPaths.PathAndNode getPathAndNode(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 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 child