From: Stefan G. <sg...@10...> - 2008-04-27 03:28:42
|
Thanks, I just wrote my own 10 liner, very helpful for development.. .. for the mail archive.. public void showFolders(PrintStream out) throws IOException { int level =1 ; StringBuffer buffer = new StringBuffer(); String startPath = ""; addChildren(level, buffer, startPath); out.write(buffer.toString().getBytes()); } private void addChildren(int level, StringBuffer buffer, String startPath) { ArrayList<String> children = _zk.getChildren(startPath, false); for (String node : children) { buffer.append(getSpaces(level-1)+"'-" + "+" + node+"\n"); addChildren(level + 1, buffer, startPath + "/" + node); } } private String getSpaces(int level) { String s = ""; for (int i = 0; i < level; i++) { s += " "; } return s; } Results looks like this: '-+katta '-+indexes '-+indexA '-+master '-+shard-to-salve '-+1140076677 '-+920135671 '-+948764822 '-+977393973 '-+slave-to-shard '-+slave1 '-+1140076677 '-+920135671 '-+slave2 '-+948764822 '-+977393973 '-+slaves '-+slave1 '-+slave2 On Apr 26, 2008, at 9:20 AM, Flavio Junqueira wrote: > I'm not sure this is exactly what you are asking for, but there is > the cli_st tool, which is part of the C client. Among other > commands, you have "ls". To use, just pass "<server_name>:<port>" as > a parameter. > > Cheers, > -Flavio > > ----- Original Message ---- > From: Stefan Groschupf <sg...@10...> > To: zoo...@li... > Sent: Saturday, April 26, 2008 1:21:21 AM > Subject: [Zookeeper-user] visualize structure > > Hi, > did someone by any chance already wrote some code that visualize a > zookeeper node structure e.g. to System out. > A nice ascii art like below would be nice.. :-) > --+ folder > '--+ subfolderA > '--+ subfolderB > I might just did not find it in the zookeeper code, but it would be > very helpful for testing and development. > > Cheers, > Stefan > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 101tec Inc. > Menlo Park, California, USA > http://www.101tec.com > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save > $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > Zookeeper-user mailing list > Zoo...@li... > https://lists.sourceforge.net/lists/listinfo/zookeeper-user > > > Be a better friend, newshound, and know-it-all with Yahoo! Mobile. > Try it now. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 101tec Inc. Menlo Park, California, USA http://www.101tec.com |