public class ZKPaths extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ZKPaths.PathAndNode |
Modifier and Type | Method and Description |
---|---|
static void |
deleteChildren(org.apache.zookeeper.ZooKeeper zookeeper,
String path,
boolean deleteSelf)
Recursively deletes children of a node.
|
static String |
fixForNamespace(String namespace,
String path)
Apply the namespace to the given path
|
static String |
getNodeFromPath(String path)
Given a full path, return the node name.
|
static ZKPaths.PathAndNode |
getPathAndNode(String path)
Given a full path, return the node name and its path.
|
static List<String> |
getSortedChildren(org.apache.zookeeper.ZooKeeper zookeeper,
String path)
Return the children of the given path sorted by sequence number
|
static String |
makePath(String parent,
String child)
Given a parent path and a child node, create a combined full path
|
static void |
mkdirs(org.apache.zookeeper.ZooKeeper zookeeper,
String path)
Make sure all the nodes in the path are created.
|
static void |
mkdirs(org.apache.zookeeper.ZooKeeper zookeeper,
String path,
boolean makeLastNode)
Make sure all the nodes in the path are created.
|
public static String fixForNamespace(String namespace, String path)
namespace
- namespace (can be null)path
- pathpublic static String getNodeFromPath(String path)
path
- the pathpublic static ZKPaths.PathAndNode getPathAndNode(String path)
path
- the pathpublic static void mkdirs(org.apache.zookeeper.ZooKeeper zookeeper, String path) throws InterruptedException, org.apache.zookeeper.KeeperException
zookeeper
- the clientpath
- path to ensureInterruptedException
- thread interruptionorg.apache.zookeeper.KeeperException
- Zookeeper errorspublic static void mkdirs(org.apache.zookeeper.ZooKeeper zookeeper, String path, boolean makeLastNode) throws InterruptedException, org.apache.zookeeper.KeeperException
zookeeper
- the clientpath
- path to ensuremakeLastNode
- if true, all nodes are created. If false, only the parent nodes are createdInterruptedException
- thread interruptionorg.apache.zookeeper.KeeperException
- Zookeeper errorspublic static void deleteChildren(org.apache.zookeeper.ZooKeeper zookeeper, String path, boolean deleteSelf) throws InterruptedException, org.apache.zookeeper.KeeperException
zookeeper
- the clientpath
- path of the node to deletedeleteSelf
- flag that indicates that the node should also get deletedInterruptedException
org.apache.zookeeper.KeeperException
public static List<String> getSortedChildren(org.apache.zookeeper.ZooKeeper zookeeper, String path) throws InterruptedException, org.apache.zookeeper.KeeperException
zookeeper
- the clientpath
- the pathInterruptedException
- thread interruptionorg.apache.zookeeper.KeeperException
- zookeeper errorsCopyright © 2011-2013 The Apache Software Foundation. All Rights Reserved.