Package org.apache.storm.zookeeper
Class ClientZookeeper
- java.lang.Object
-
- org.apache.storm.zookeeper.ClientZookeeper
-
public class ClientZookeeper extends Object
-
-
Constructor Summary
Constructors Constructor Description ClientZookeeper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addListener(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, org.apache.storm.shade.org.apache.curator.framework.state.ConnectionStateListener listener)
static String
createNode(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, byte[] data, List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)
static String
createNode(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, byte[] data, org.apache.storm.shade.org.apache.zookeeper.CreateMode mode, List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)
static void
deleteNode(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path)
static void
deleteNodeBlobstore(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String parentPath, String hostPortInfo)
static boolean
exists(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
static boolean
existsNode(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
static List<String>
getChildren(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
static byte[]
getData(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
static VersionedData<byte[]>
getDataWithVersion(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
Get the data along with a version.static Integer
getVersion(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
static org.apache.storm.shade.org.apache.curator.framework.CuratorFramework
mkClient(Map<String,Object> conf, List<String> servers, Object port, String root, WatcherCallBack watcher, Map<String,Object> authConf, DaemonType type)
org.apache.storm.shade.org.apache.curator.framework.CuratorFramework
mkClientImpl(Map<String,Object> conf, List<String> servers, Object port, String root, WatcherCallBack watcher, Map<String,Object> authConf, DaemonType type)
static void
mkdirs(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)
void
mkdirsImpl(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)
static String
normalizePath(String path)
static String
parentPath(String path)
static void
resetInstance()
Resets the singleton instance to the default.static org.apache.storm.shade.org.apache.zookeeper.data.Stat
setData(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, byte[] data)
static void
setInstance(ClientZookeeper u)
Provide an instance of this class for delegates to use.static void
syncPath(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path)
static List<String>
tokenizePath(String path)
static String
toksToPath(List<String> toks)
-
-
-
Method Detail
-
setInstance
public static void setInstance(ClientZookeeper u)
Provide an instance of this class for delegates to use. To mock out delegated methods, provide an instance of a subclass that overrides the implementation of the delegated method.- Parameters:
u
- a ClientZookeeper instance
-
resetInstance
public static void resetInstance()
Resets the singleton instance to the default. This is helpful to reset the class to its original functionality when mocking is no longer desired.
-
mkdirs
public static void mkdirs(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)
-
mkClient
public static org.apache.storm.shade.org.apache.curator.framework.CuratorFramework mkClient(Map<String,Object> conf, List<String> servers, Object port, String root, WatcherCallBack watcher, Map<String,Object> authConf, DaemonType type)
-
deleteNodeBlobstore
public static void deleteNodeBlobstore(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String parentPath, String hostPortInfo)
-
createNode
public static String createNode(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, byte[] data, org.apache.storm.shade.org.apache.zookeeper.CreateMode mode, List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)
-
createNode
public static String createNode(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, byte[] data, List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)
-
existsNode
public static boolean existsNode(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
-
deleteNode
public static void deleteNode(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path)
-
exists
public static boolean exists(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
-
setData
public static org.apache.storm.shade.org.apache.zookeeper.data.Stat setData(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, byte[] data)
-
getVersion
public static Integer getVersion(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, boolean watch) throws Exception
- Throws:
Exception
-
getChildren
public static List<String> getChildren(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
-
getData
public static byte[] getData(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
-
getDataWithVersion
public static VersionedData<byte[]> getDataWithVersion(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, boolean watch)
Get the data along with a version.- Parameters:
zk
- the zk instance to usepath
- the path to get it fromwatch
- should a watch be enabled- Returns:
- null if no data is found, else the data with the version.
-
addListener
public static void addListener(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, org.apache.storm.shade.org.apache.curator.framework.state.ConnectionStateListener listener)
-
syncPath
public static void syncPath(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path)
-
mkdirsImpl
public void mkdirsImpl(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework zk, String path, List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> acls)
-
-