Class ZooKeeperMain


  • @Public
    public class ZooKeeperMain
    extends java.lang.Object
    The command line client to ZooKeeper.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apache.zookeeper.ZooKeeperMain.MyCommandOptions cl  
      protected int commandCount  
      protected int exitCode  
      protected java.util.HashMap<java.lang.Integer,​java.lang.String> history  
      protected java.lang.String host  
      protected boolean printWatches  
      protected ZooKeeper zk  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addToHistory​(int i, java.lang.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​(java.lang.String newHost)  
      void executeLine​(java.lang.String line)  
      static java.util.List<java.lang.String> getCommands()  
      boolean getPrintWatches()  
      protected java.lang.String getPrompt()  
      static void main​(java.lang.String[] args)  
      static void printMessage​(java.lang.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

      • cl

        protected org.apache.zookeeper.ZooKeeperMain.MyCommandOptions cl
      • history

        protected java.util.HashMap<java.lang.Integer,​java.lang.String> history
      • commandCount

        protected int commandCount
      • printWatches

        protected boolean printWatches
      • exitCode

        protected int exitCode
      • host

        protected java.lang.String host
    • Constructor Detail

      • ZooKeeperMain

        public ZooKeeperMain​(java.lang.String[] args)
                      throws java.io.IOException,
                             java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • ZooKeeperMain

        public ZooKeeperMain​(ZooKeeper zk)
    • Method Detail

      • getPrintWatches

        public boolean getPrintWatches()
      • addToHistory

        protected void addToHistory​(int i,
                                    java.lang.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 java.util.List<java.lang.String> getCommands()
      • getPrompt

        protected java.lang.String getPrompt()
      • printMessage

        public static void printMessage​(java.lang.String msg)
      • connectToZK

        protected void connectToZK​(java.lang.String newHost)
                            throws java.lang.InterruptedException,
                                   java.io.IOException
        Throws:
        java.lang.InterruptedException
        java.io.IOException
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException,
                                java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • executeLine

        public void executeLine​(java.lang.String line)
                         throws java.lang.InterruptedException,
                                java.io.IOException
        Throws:
        java.lang.InterruptedException
        java.io.IOException
      • processCmd

        protected boolean processCmd​(org.apache.zookeeper.ZooKeeperMain.MyCommandOptions co)
                              throws java.io.IOException,
                                     java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • processZKCmd

        protected boolean processZKCmd​(org.apache.zookeeper.ZooKeeperMain.MyCommandOptions co)
                                throws CliException,
                                       java.io.IOException,
                                       java.lang.InterruptedException
        Throws:
        CliException
        java.io.IOException
        java.lang.InterruptedException