org.apache.zookeeper
Class ZooKeeperMain

java.lang.Object
  extended by org.apache.zookeeper.ZooKeeperMain

public class ZooKeeperMain
extends Object

The command line client to ZooKeeper.


Field Summary
protected  org.apache.zookeeper.ZooKeeperMain.MyCommandOptions cl
           
protected  int commandCount
           
protected static Map<String,String> commandMap
           
protected  HashMap<Integer,String> history
           
protected  String host
           
protected  boolean printWatches
           
protected  ZooKeeper zk
           
 
Constructor Summary
ZooKeeperMain(String[] args)
           
ZooKeeperMain(ZooKeeper zk)
           
 
Method Summary
protected  void addToHistory(int i, String cmd)
          Makes a list of possible completions, either for commands or for zk nodes if the token to complete begins with /
protected  void connectToZK(String newHost)
           
static boolean createQuota(ZooKeeper zk, String path, long bytes, int numNodes)
          this method creates a quota node for the path
static boolean delQuota(ZooKeeper zk, String path, boolean bytes, boolean numNodes)
          this method deletes quota for a node.
 void executeLine(String line)
           
static List<String> getCommands()
           
 boolean getPrintWatches()
           
protected  String getPrompt()
           
static void main(String[] args)
           
static void printMessage(String msg)
           
protected  boolean processCmd(org.apache.zookeeper.ZooKeeperMain.MyCommandOptions co)
           
protected  boolean processZKCmd(org.apache.zookeeper.ZooKeeperMain.MyCommandOptions co)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commandMap

protected static final Map<String,String> commandMap

cl

protected org.apache.zookeeper.ZooKeeperMain.MyCommandOptions cl

history

protected HashMap<Integer,String> history

commandCount

protected int commandCount

printWatches

protected boolean printWatches

zk

protected ZooKeeper zk

host

protected String host
Constructor Detail

ZooKeeperMain

public ZooKeeperMain(String[] args)
              throws IOException,
                     InterruptedException
Throws:
IOException
InterruptedException

ZooKeeperMain

public ZooKeeperMain(ZooKeeper zk)
Method Detail

getPrintWatches

public boolean getPrintWatches()

addToHistory

protected void addToHistory(int i,
                            String cmd)
Makes a list of possible completions, either for commands or for zk nodes if the token to complete begins with /


getCommands

public static List<String> getCommands()

getPrompt

protected String getPrompt()

printMessage

public static void printMessage(String msg)

connectToZK

protected void connectToZK(String newHost)
                    throws InterruptedException,
                           IOException
Throws:
InterruptedException
IOException

main

public static void main(String[] args)
                 throws KeeperException,
                        IOException,
                        InterruptedException
Throws:
KeeperException
IOException
InterruptedException

executeLine

public void executeLine(String line)
                 throws InterruptedException,
                        IOException,
                        KeeperException
Throws:
InterruptedException
IOException
KeeperException

delQuota

public static boolean delQuota(ZooKeeper zk,
                               String path,
                               boolean bytes,
                               boolean numNodes)
                        throws KeeperException,
                               IOException,
                               InterruptedException
this method deletes quota for a node.

Parameters:
zk - the zookeeper client
path - the path to delete quota for
bytes - true if number of bytes needs to be unset
numNodes - true if number of nodes needs to be unset
Returns:
true if quota deletion is successful
Throws:
KeeperException
IOException
InterruptedException

createQuota

public static boolean createQuota(ZooKeeper zk,
                                  String path,
                                  long bytes,
                                  int numNodes)
                           throws KeeperException,
                                  IOException,
                                  InterruptedException
this method creates a quota node for the path

Parameters:
zk - the ZooKeeper client
path - the path for which quota needs to be created
bytes - the limit of bytes on this path
numNodes - the limit of number of nodes on this path
Returns:
true if its successful and false if not.
Throws:
KeeperException
IOException
InterruptedException

processCmd

protected boolean processCmd(org.apache.zookeeper.ZooKeeperMain.MyCommandOptions co)
                      throws KeeperException,
                             IOException,
                             InterruptedException
Throws:
KeeperException
IOException
InterruptedException

processZKCmd

protected boolean processZKCmd(org.apache.zookeeper.ZooKeeperMain.MyCommandOptions co)
                        throws KeeperException,
                               IOException,
                               InterruptedException
Throws:
KeeperException
IOException
InterruptedException


Copyright © 2011 The Apache Software Foundation