zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an...@apache.org
Subject [43/51] [partial] zookeeper git commit: ZOOKEEPER-3032: MAVEN MIGRATION - zookeeper-server
Date Fri, 19 Oct 2018 12:40:41 GMT
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/GetConfigCommand.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/GetConfigCommand.java b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/GetConfigCommand.java
deleted file mode 100644
index dda6281..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/GetConfigCommand.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.cli;
-
-import org.apache.commons.cli.*;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.data.Stat;
-import org.apache.zookeeper.server.util.ConfigUtils;
-
-/**
- * get command for cli
- */
-public class GetConfigCommand extends CliCommand {
-
-    private static Options options = new Options();
-    private String args[];
-    private CommandLine cl;
-
-    {
-        options.addOption("s", false, "stats");
-        options.addOption("w", false, "watch");
-        options.addOption("c", false, "client connection string");
-    }
-
-    public GetConfigCommand() {
-        super("config", "[-c] [-w] [-s]");
-    }
-
-    @Override
-    public CliCommand parse(String[] cmdArgs) throws CliParseException {
-
-        Parser parser = new PosixParser();
-        try {
-            cl = parser.parse(options, cmdArgs);
-        } catch (ParseException ex) {
-            throw new CliParseException(ex);
-        }
-        args = cl.getArgs();
-        if (args.length < 1) {
-            throw new CliParseException(getUsageStr());
-        }
-
-        return this;
-    }
-
-    @Override
-    public boolean exec() throws CliException {
-        boolean watch = cl.hasOption("w");        
-        Stat stat = new Stat();
-        byte data[];
-        try {
-            data = zk.getConfig(watch, stat);
-        } catch (KeeperException|InterruptedException ex) {
-            throw new CliWrapperException(ex);
-        }
-        data = (data == null) ? "null".getBytes() : data;
-        if (cl.hasOption("c")) {
-            out.println(ConfigUtils.getClientConfigStr(new String(data)));
-        } else {
-            out.println(new String(data));
-        }
-        
-        if (cl.hasOption("s")) {
-            new StatPrinter(out).print(stat);
-        }                
-        
-        return watch;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/ListQuotaCommand.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/ListQuotaCommand.java b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/ListQuotaCommand.java
deleted file mode 100644
index 8c51c26..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/ListQuotaCommand.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.cli;
-
-import org.apache.commons.cli.*;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.Quotas;
-import org.apache.zookeeper.StatsTrack;
-import org.apache.zookeeper.data.Stat;
-
-/**
- * listQuta command for cli
- */
-public class ListQuotaCommand extends CliCommand {
-
-    private static Options options = new Options();
-    private String[] args;
-    
-    public ListQuotaCommand() {
-        super("listquota", "path");
-    }
-
-    @Override
-    public CliCommand parse(String[] cmdArgs) throws CliParseException {
-        Parser parser = new PosixParser();
-        CommandLine cl;
-        try {
-            cl = parser.parse(options, cmdArgs);
-        } catch (ParseException ex) {
-            throw new CliParseException(ex);
-        }
-        args = cl.getArgs();
-        if(args.length < 2) {
-            throw new CliParseException(getUsageStr());
-        }
-        
-        return this;
-    }
-    
-    @Override
-    public boolean exec() throws CliException {
-        String path = args[1];
-        String absolutePath = Quotas.quotaZookeeper + path + "/"
-                + Quotas.limitNode;
-        try {
-            err.println("absolute path is " + absolutePath);
-            Stat stat = new Stat();
-            byte[] data = zk.getData(absolutePath, false, stat);
-            StatsTrack st = new StatsTrack(new String(data));
-            out.println("Output quota for " + path + " "
-                    + st.toString());
-
-            data = zk.getData(Quotas.quotaZookeeper + path + "/"
-                    + Quotas.statNode, false, stat);
-            out.println("Output stat for " + path + " "
-                    + new StatsTrack(new String(data)).toString());
-        } catch (IllegalArgumentException ex) {
-            throw new MalformedPathException(ex.getMessage());
-        } catch (KeeperException.NoNodeException ne) {
-            err.println("quota for " + path + " does not exist.");
-        } catch (KeeperException|InterruptedException ex) {
-            throw new CliWrapperException(ex);
-        }
-        
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/Ls2Command.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/Ls2Command.java b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/Ls2Command.java
deleted file mode 100644
index aed1b0e..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/Ls2Command.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.zookeeper.cli;
-
-import java.util.List;
-import org.apache.commons.cli.*;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.data.Stat;
-
-/**
- * ls2 command for cli
- */
-public class Ls2Command extends CliCommand {
-
-    private static Options options = new Options();
-    private String args[];
-    
-    public Ls2Command() {
-        super("ls2", "path [watch]");
-    }
-    
-    @Override
-    public CliCommand parse(String[] cmdArgs) throws CliParseException {
-        Parser parser = new PosixParser();
-        CommandLine cl;
-        try {
-            cl = parser.parse(options, cmdArgs);
-        } catch (ParseException ex) {
-            throw new CliParseException(ex);
-        }
-        args = cl.getArgs();
-        if (args.length < 2) {
-            throw new CliParseException(getUsageStr());
-        }
-        
-        return this;
-    }
-
-    @Override
-    public boolean exec() throws CliException {
-        err.println("'ls2' has been deprecated. "
-                  + "Please use 'ls [-s] path' instead.");
-        String path = args[1];
-        boolean watch = args.length > 2;
-        Stat stat = new Stat();
-        List<String> children;
-        try {
-            children = zk.getChildren(path, watch, stat);
-        } catch (IllegalArgumentException ex) {
-            throw new MalformedPathException(ex.getMessage());
-        } catch (KeeperException|InterruptedException ex) {
-            throw new CliWrapperException(ex);
-        }
-        out.println(children);
-        new StatPrinter(out).print(stat);
-        return watch;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/LsCommand.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/LsCommand.java b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/LsCommand.java
deleted file mode 100644
index 9e53d5d..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/LsCommand.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.zookeeper.cli;
-
-import java.util.Collections;
-import java.util.List;
-import org.apache.commons.cli.*;
-import org.apache.zookeeper.AsyncCallback.StringCallback;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.ZKUtil;
-import org.apache.zookeeper.data.Stat;
-
-/**
- * ls command for cli
- */
-public class LsCommand extends CliCommand {
-
-    private static Options options = new Options();
-    private String args[];
-    private CommandLine cl;
-
-    {
-        options.addOption("?", false, "help");
-        options.addOption("s", false, "stat");
-        options.addOption("w", false, "watch");
-        options.addOption("R", false, "recurse");
-    }
-
-    public LsCommand() {
-        super("ls", "[-s] [-w] [-R] path");
-    }
-
-    private void printHelp() {
-        HelpFormatter formatter = new HelpFormatter();
-        formatter.printHelp("ls [options] path", options);
-    }
-
-    @Override
-    public CliCommand parse(String[] cmdArgs) throws CliParseException {
-        Parser parser = new PosixParser();
-        try {
-            cl = parser.parse(options, cmdArgs);
-        } catch (ParseException ex) {
-            throw new CliParseException(ex);
-        }
-
-        args = cl.getArgs();
-        if (cl.hasOption("?")) {
-            printHelp();
-        }
-
-        retainCompatibility(cmdArgs);
-
-        return this;
-    }
-
-    private void retainCompatibility(String[] cmdArgs) throws CliParseException {
-        // get path [watch]
-        if (args.length > 2) {
-            // rewrite to option
-            cmdArgs[2] = "-w";
-            err.println("'ls path [watch]' has been deprecated. "
-                    + "Please use 'ls [-w] path' instead.");
-            Parser parser = new PosixParser();
-            try {
-                cl = parser.parse(options, cmdArgs);
-            } catch (ParseException ex) {
-                throw new CliParseException(ex);
-            }
-            args = cl.getArgs();
-        }
-    }
-
-    @Override
-    public boolean exec() throws CliException {
-        if (args.length < 2) {
-            throw new MalformedCommandException(getUsageStr());
-        }
-
-        String path = args[1];
-        boolean watch = cl.hasOption("w");
-        boolean withStat = cl.hasOption("s");
-        boolean recursive = cl.hasOption("R");
-        try {
-            if (recursive) {
-                ZKUtil.visitSubTreeDFS(zk, path, watch, new StringCallback() {
-                    @Override
-                    public void processResult(int rc, String path, Object ctx, String name) {
-                        out.println(path);
-                    }
-                });
-            } else {
-                Stat stat = withStat ? new Stat() : null;
-                List<String> children = zk.getChildren(path, watch, stat);
-                printChildren(children, stat);
-            }
-        } catch (IllegalArgumentException ex) {
-            throw new MalformedPathException(ex.getMessage());
-        } catch (KeeperException|InterruptedException ex) {
-            throw new CliWrapperException(ex);
-        }
-        return watch;
-    }
-
-    private void printChildren(List<String> children, Stat stat) {
-        Collections.sort(children);
-        out.append("[");
-        boolean first = true;
-        for (String child : children) {
-            if (!first) {
-                out.append(", ");
-            } else {
-                first = false;
-            }
-            out.append(child);
-        }
-        out.append("]");
-        if (stat != null) {
-            new StatPrinter(out).print(stat);
-        }
-        out.append("\n");
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/MalformedCommandException.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/MalformedCommandException.java b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/MalformedCommandException.java
deleted file mode 100644
index 72b19ef..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/MalformedCommandException.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.cli;
-
-@SuppressWarnings("serial")
-public class MalformedCommandException extends CliException {
-    public MalformedCommandException(String message) {
-        super(message);
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/MalformedPathException.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/MalformedPathException.java b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/MalformedPathException.java
deleted file mode 100644
index e65765b..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/MalformedPathException.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.cli;
-
-@SuppressWarnings("serial")
-public class MalformedPathException extends CliException {
-    public MalformedPathException(String message) {
-        super(message);
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/ReconfigCommand.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/ReconfigCommand.java b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/ReconfigCommand.java
deleted file mode 100644
index 342f5d2..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/ReconfigCommand.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.cli;
-
-import java.io.FileInputStream;
-import java.util.Properties;
-
-import org.apache.commons.cli.*;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.admin.ZooKeeperAdmin;
-import org.apache.zookeeper.data.Stat;
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
-
-/**
- * reconfig command for cli
- */
-public class ReconfigCommand extends CliCommand {
-
-    private static Options options = new Options();
-
-    /* joining - comma separated list of server config strings for servers to be added to the ensemble.
-     * Each entry is identical in syntax as it would appear in a configuration file. Only used for 
-     * incremental reconfigurations.
-     */
-    private String joining;
-
-    /* leaving - comma separated list of server IDs to be removed from the ensemble. Only used for
-     * incremental reconfigurations.
-     */
-    private String leaving;
-
-    /* members - comma separated list of new membership information (e.g., contents of a membership
-     * configuration file) - for use only with a non-incremental reconfiguration. This may be specified
-     * manually via the -members flag or it will automatically be filled in by reading the contents
-     * of an actual configuration file using the -file flag.
-     */
-    private String members;
-
-    /* version - version of config from which we want to reconfigure - if current config is different
-     * reconfiguration will fail. Should be ommitted from the CLI to disable this option.
-     */
-    long version = -1;
-    private CommandLine cl;
-
-    {
-        options.addOption("s", false, "stats");
-        options.addOption("v", true, "required current config version");
-        options.addOption("file", true, "path of config file to parse for membership");
-        options.addOption("members", true, "comma-separated list of config strings for " +
-        		"non-incremental reconfig");
-        options.addOption("add", true, "comma-separated list of config strings for " +
-        		"new servers");
-        options.addOption("remove", true, "comma-separated list of server IDs to remove");
-    }
-
-    public ReconfigCommand() {
-        super("reconfig", "[-s] " +
-        		"[-v version] " +
-        		"[[-file path] | " +
-        		"[-members serverID=host:port1:port2;port3[,...]*]] | " +
-        		"[-add serverId=host:port1:port2;port3[,...]]* " +
-        		"[-remove serverId[,...]*]");
-    }
-
-    @Override
-    public CliCommand parse(String[] cmdArgs) throws CliParseException {
-        joining = null;
-        leaving = null;
-        members = null;
-        Parser parser = new PosixParser();
-        try {
-            cl = parser.parse(options, cmdArgs);
-        } catch (ParseException ex) {
-            throw new CliParseException(ex);
-        }
-        if (!(cl.hasOption("file") || cl.hasOption("members")) && !cl.hasOption("add") && !cl.hasOption("remove")) {
-            throw new CliParseException(getUsageStr());
-        }
-        if (cl.hasOption("v")) {
-            try{ 
-                version = Long.parseLong(cl.getOptionValue("v"), 16);
-            } catch (NumberFormatException e){
-                throw new CliParseException("-v must be followed by a long (configuration version)");
-            }
-        } else {
-            version = -1;
-        }
-
-        // Simple error checking for conflicting modes
-        if ((cl.hasOption("file") || cl.hasOption("members")) && (cl.hasOption("add") || cl.hasOption("remove"))) {
-            throw new CliParseException("Can't use -file or -members together with -add or -remove (mixing incremental" +
-            		" and non-incremental modes is not allowed)");
-        }
-        if (cl.hasOption("file") && cl.hasOption("members"))
-        {
-            throw new CliParseException("Can't use -file and -members together (conflicting non-incremental modes)");
-        }
-
-        // Set the joining/leaving/members values based on the mode we're in
-        if (cl.hasOption("add")) {
-           joining = cl.getOptionValue("add").toLowerCase();
-        }
-        if (cl.hasOption("remove")) {
-           leaving = cl.getOptionValue("remove").toLowerCase();
-        }
-        if (cl.hasOption("members")) {
-           members = cl.getOptionValue("members").toLowerCase();
-        }
-        if (cl.hasOption("file")) {
-            try {           
-                FileInputStream inConfig = new FileInputStream(cl.getOptionValue("file"));
-                Properties dynamicCfg = new Properties();
-                try {
-                    dynamicCfg.load(inConfig);
-                } finally {
-                    inConfig.close();
-                }
-                //check that membership makes sense; leader will make these checks again
-                //don't check for leader election ports since 
-                //client doesn't know what leader election alg is used
-                members = QuorumPeerConfig.parseDynamicConfig(dynamicCfg, 0, true, false).toString();
-            } catch (Exception e) {
-                throw new CliParseException("Error processing " + cl.getOptionValue("file") + e.getMessage());
-            } 
-        }
-        return this;
-    }
-
-    @Override
-    public boolean exec() throws CliException {
-        try {
-            Stat stat = new Stat();
-            if (!(zk instanceof ZooKeeperAdmin)) {
-                // This should never happen when executing reconfig command line,
-                // because it is guaranteed that we have a ZooKeeperAdmin instance ready
-                // to use in CliCommand stack.
-                // The only exception would be in test code where clients can directly set
-                // ZooKeeper object to ZooKeeperMain.
-                return false;
-            }
-
-            byte[] curConfig = ((ZooKeeperAdmin)zk).reconfigure(joining,
-                    leaving, members, version, stat);
-            out.println("Committed new configuration:\n" + new String(curConfig));
-            
-            if (cl.hasOption("s")) {
-                new StatPrinter(out).print(stat);
-            }
-        } catch (KeeperException|InterruptedException ex) {
-            throw new CliWrapperException(ex);
-        }
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/RemoveWatchesCommand.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/RemoveWatchesCommand.java b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/RemoveWatchesCommand.java
deleted file mode 100644
index 2863443..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/RemoveWatchesCommand.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.cli;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.apache.commons.cli.Parser;
-import org.apache.commons.cli.PosixParser;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.Watcher.WatcherType;
-
-/**
- * Remove watches command for cli
- */
-public class RemoveWatchesCommand extends CliCommand {
-
-    private static Options options = new Options();
-    private String[] args;
-    private CommandLine cl;
-
-    {
-        options.addOption("c", false, "child watcher type");
-        options.addOption("d", false, "data watcher type");
-        options.addOption("a", false, "any watcher type");
-        options.addOption("l", false,
-                "remove locally when there is no server connection");
-    }
-
-    public RemoveWatchesCommand() {
-        super("removewatches", "path [-c|-d|-a] [-l]");
-    }
-
-    @Override
-    public CliCommand parse(String[] cmdArgs) throws CliParseException {
-        Parser parser = new PosixParser();
-        try {
-            cl = parser.parse(options, cmdArgs);
-        } catch (ParseException ex) {
-            throw new CliParseException(ex);
-        }
-        args = cl.getArgs();
-        if (args.length < 2) {
-            throw new CliParseException(getUsageStr());
-        }
-        return this;
-    }
-
-    @Override
-    public boolean exec() throws CliWrapperException, MalformedPathException {
-        String path = args[1];
-        WatcherType wtype = WatcherType.Any;
-        // if no matching option -c or -d or -a is specified, we remove
-        // the watches of the given node by choosing WatcherType.Any
-        if (cl.hasOption("c")) {
-            wtype = WatcherType.Children;
-        } else if (cl.hasOption("d")) {
-            wtype = WatcherType.Data;
-        } else if (cl.hasOption("a")) {
-            wtype = WatcherType.Any;
-        }
-        // whether to remove the watches locally
-        boolean local = cl.hasOption("l");
-
-        try {
-            zk.removeAllWatches(path, wtype, local);
-        } catch (IllegalArgumentException ex) {
-            throw new MalformedPathException(ex.getMessage());
-        } catch (KeeperException|InterruptedException ex) {
-            throw new CliWrapperException(ex);
-        }
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SetAclCommand.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SetAclCommand.java b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SetAclCommand.java
deleted file mode 100644
index 9d1b460..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SetAclCommand.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.cli;
-
-import java.util.List;
-import org.apache.commons.cli.*;
-import org.apache.zookeeper.AsyncCallback.StringCallback;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.ZKUtil;
-import org.apache.zookeeper.data.ACL;
-import org.apache.zookeeper.data.Stat;
-
-/**
- * setAcl command for cli.
- * Available options are s for printing znode's stats, v for set version of znode(s), R for
- * recursive setting. User can combine v and R options together, but not s and R considering the
- * number of znodes could be large.
- */
-public class SetAclCommand extends CliCommand {
-
-    private static Options options = new Options();
-    private String[] args;
-    private CommandLine cl;
-
-    {
-        options.addOption("s", false, "stats");
-        options.addOption("v", true, "version");
-        options.addOption("R", false, "recursive");
-    }
-
-    public SetAclCommand() {
-        super("setAcl", "[-s] [-v version] [-R] path acl");
-    }
-
-    @Override
-    public CliCommand parse(String[] cmdArgs) throws CliParseException {
-        Parser parser = new PosixParser();
-        try {
-            cl = parser.parse(options, cmdArgs);
-        } catch (ParseException ex) {
-            throw new CliParseException(ex);
-        }
-        args = cl.getArgs();
-        if (args.length < 3) {
-            throw new CliParseException(getUsageStr());
-        }
-
-        return this;
-    }
-
-    @Override
-    public boolean exec() throws CliException {
-        String path = args[1];
-        String aclStr = args[2];
-        List<ACL> acl = AclParser.parse(aclStr);
-        int version;
-        if (cl.hasOption("v")) {
-            version = Integer.parseInt(cl.getOptionValue("v"));
-        } else {
-            version = -1;
-        }
-        try {
-            if (cl.hasOption("R")) {
-                ZKUtil.visitSubTreeDFS(zk, path, false, new StringCallback() {
-                    @Override
-                    public void processResult(int rc, String p, Object ctx, String name) {
-                        try {
-                            zk.setACL(p, acl, version);
-                        } catch (KeeperException | InterruptedException e) {
-                            out.print(e.getMessage());
-                        }
-                    }
-                });
-            } else {
-                Stat stat = zk.setACL(path, acl, version);
-                if (cl.hasOption("s")) {
-                    new StatPrinter(out).print(stat);
-                }
-            }
-        } catch (IllegalArgumentException ex) {
-            throw new MalformedPathException(ex.getMessage());
-        } catch (KeeperException|InterruptedException ex) {
-            throw new CliWrapperException(ex);
-        }
-
-        return false;
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SetCommand.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SetCommand.java b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SetCommand.java
deleted file mode 100644
index 43ca2e1..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SetCommand.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.cli;
-
-import org.apache.commons.cli.*;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.data.Stat;
-
-/**
- * set command for cli
- */
-public class SetCommand extends CliCommand {
-
-    private static Options options = new Options();
-    private String[] args;
-    private CommandLine cl;
-
-    {
-        options.addOption("s", false, "stats");
-        options.addOption("v", true, "version");
-    }
-
-    public SetCommand() {
-        super("set", "[-s] [-v version] path data");
-    }
-
-    @Override
-    public CliCommand parse(String[] cmdArgs) throws CliParseException {
-        Parser parser = new PosixParser();
-        try {
-            cl = parser.parse(options, cmdArgs);
-        } catch (ParseException ex) {
-            throw new CliParseException(ex);
-        }
-        args = cl.getArgs();
-        if (args.length < 3) {
-            throw new CliParseException(getUsageStr());
-        }
-
-        return this;
-    }
-
-    @Override
-    public boolean exec() throws CliException {
-        String path = args[1];
-        byte[] data = args[2].getBytes();
-        int version;
-        if (cl.hasOption("v")) {
-            version = Integer.parseInt(cl.getOptionValue("v"));
-        } else {
-            version = -1;
-        }
-
-        try {
-            Stat stat = zk.setData(path, data, version);
-            if (cl.hasOption("s")) {
-                new StatPrinter(out).print(stat);
-            }
-        } catch (IllegalArgumentException ex) {
-            throw new MalformedPathException(ex.getMessage());
-        } catch (KeeperException|InterruptedException ex) {
-            throw new CliWrapperException(ex);
-        }
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SetQuotaCommand.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SetQuotaCommand.java b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SetQuotaCommand.java
deleted file mode 100644
index 7df5667..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SetQuotaCommand.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.cli;
-
-import java.io.IOException;
-import java.util.List;
-import org.apache.commons.cli.*;
-import org.apache.zookeeper.*;
-import org.apache.zookeeper.data.Stat;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * setQuota command for cli
- */
-public class SetQuotaCommand extends CliCommand {
-
-    private static final Logger LOG = LoggerFactory.getLogger(SetQuotaCommand.class);
-    private Options options = new Options();
-    private String[] args;
-    private CommandLine cl;
-
-    public SetQuotaCommand() {
-        super("setquota", "-n|-b val path");
-        
-        OptionGroup og1 = new OptionGroup();
-        og1.addOption(new Option("b", true, "bytes quota"));
-        og1.addOption(new Option("n", true, "num quota"));
-        og1.setRequired(true);
-        options.addOptionGroup(og1);
-   }
-
-    @Override
-    public CliCommand parse(String[] cmdArgs) throws CliParseException {
-        Parser parser = new PosixParser();
-        try {
-            cl = parser.parse(options, cmdArgs);
-        } catch (ParseException ex) {
-            throw new CliParseException(ex);
-        }
-        args = cl.getArgs();
-        if (args.length < 2) {
-            throw new CliParseException(getUsageStr());
-        }
-
-        return this;
-    }
-
-    @Override
-    public boolean exec() throws CliException {
-        // get the args
-        String path = args[1];
-
-        if (cl.hasOption("b")) {
-            // we are setting the bytes quota
-            long bytes = Long.parseLong(cl.getOptionValue("b"));
-            try {
-                createQuota(zk, path, bytes, -1);
-            } catch (KeeperException|IOException|InterruptedException ex) {
-                throw new CliWrapperException(ex);
-            }
-        } else if (cl.hasOption("n")) {
-            // we are setting the num quota
-            int numNodes = Integer.parseInt(cl.getOptionValue("n"));
-            try {
-                createQuota(zk, path, -1L, numNodes);
-            } catch (KeeperException|IOException|InterruptedException ex) {
-                throw new CliWrapperException(ex);
-            }
-        } else {
-            throw new MalformedCommandException(getUsageStr());
-        }
-
-        return false;
-    }
-
-    public static boolean createQuota(ZooKeeper zk, String path,
-            long bytes, int numNodes)
-            throws KeeperException, IOException, InterruptedException, MalformedPathException {
-        // check if the path exists. We cannot create
-        // quota for a path that already exists in zookeeper
-        // for now.
-        Stat initStat;
-        try {
-            initStat = zk.exists(path, false);
-        } catch (IllegalArgumentException ex) {
-            throw new MalformedPathException(ex.getMessage());
-        }
-        if (initStat == null) {
-            throw new IllegalArgumentException(path + " does not exist.");
-        }
-        // now check if their is already existing
-        // parent or child that has quota
-
-        String quotaPath = Quotas.quotaZookeeper;
-        // check for more than 2 children --
-        // if zookeeper_stats and zookeeper_qutoas
-        // are not the children then this path
-        // is an ancestor of some path that
-        // already has quota
-        String realPath = Quotas.quotaZookeeper + path;
-        try {
-            List<String> children = zk.getChildren(realPath, false);
-            for (String child : children) {
-                if (!child.startsWith("zookeeper_")) {
-                    throw new IllegalArgumentException(path + " has child "
-                            + child + " which has a quota");
-                }
-            }
-        } catch (KeeperException.NoNodeException ne) {
-            // this is fine
-        }
-
-        //check for any parent that has been quota
-        checkIfParentQuota(zk, path);
-
-        // this is valid node for quota
-        // start creating all the parents
-        if (zk.exists(quotaPath, false) == null) {
-            try {
-                zk.create(Quotas.procZookeeper, null, ZooDefs.Ids.OPEN_ACL_UNSAFE,
-                        CreateMode.PERSISTENT);
-                zk.create(Quotas.quotaZookeeper, null, ZooDefs.Ids.OPEN_ACL_UNSAFE,
-                        CreateMode.PERSISTENT);
-            } catch (KeeperException.NodeExistsException ne) {
-                // do nothing
-            }
-        }
-
-        // now create the direct children
-        // and the stat and quota nodes
-        String[] splits = path.split("/");
-        StringBuilder sb = new StringBuilder();
-        sb.append(quotaPath);
-        for (int i = 1; i < splits.length; i++) {
-            sb.append("/" + splits[i]);
-            quotaPath = sb.toString();
-            try {
-                zk.create(quotaPath, null, ZooDefs.Ids.OPEN_ACL_UNSAFE,
-                        CreateMode.PERSISTENT);
-            } catch (KeeperException.NodeExistsException ne) {
-                //do nothing
-            }
-        }
-        String statPath = quotaPath + "/" + Quotas.statNode;
-        quotaPath = quotaPath + "/" + Quotas.limitNode;
-        StatsTrack strack = new StatsTrack(null);
-        strack.setBytes(bytes);
-        strack.setCount(numNodes);
-        try {
-            zk.create(quotaPath, strack.toString().getBytes(),
-                    ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-            StatsTrack stats = new StatsTrack(null);
-            stats.setBytes(0L);
-            stats.setCount(0);
-            zk.create(statPath, stats.toString().getBytes(),
-                    ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-        } catch (KeeperException.NodeExistsException ne) {
-            byte[] data = zk.getData(quotaPath, false, new Stat());
-            StatsTrack strackC = new StatsTrack(new String(data));
-            if (bytes != -1L) {
-                strackC.setBytes(bytes);
-            }
-            if (numNodes != -1) {
-                strackC.setCount(numNodes);
-            }
-            zk.setData(quotaPath, strackC.toString().getBytes(), -1);
-        }
-        return true;
-    }
-
-    private static void checkIfParentQuota(ZooKeeper zk, String path)
-            throws InterruptedException, KeeperException {
-        final String[] splits = path.split("/");
-        String quotaPath = Quotas.quotaZookeeper;
-        for (String str : splits) {
-            if (str.length() == 0) {
-                // this should only be for the beginning of the path
-                // i.e. "/..." - split(path)[0] is empty string before first '/'
-                continue;
-            }
-            quotaPath += "/" + str;
-            List<String> children = null;
-            try {
-                children = zk.getChildren(quotaPath, false);
-            } catch (KeeperException.NoNodeException ne) {
-                LOG.debug("child removed during quota check", ne);
-                return;
-            }
-            if (children.size() == 0) {
-                return;
-            }
-            for (String child : children) {
-                if (Quotas.limitNode.equals(child)) {
-                    throw new IllegalArgumentException(path + " has a parent "
-                            + quotaPath + " which has a quota");
-                }
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/StatCommand.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/StatCommand.java b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/StatCommand.java
deleted file mode 100644
index 33d8e87..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/StatCommand.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.cli;
-
-import org.apache.commons.cli.*;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.data.Stat;
-
-/**
- * stat command for cli
- */
-public class StatCommand extends CliCommand {
-
-    private static final Options options = new Options();
-    private String[] args;
-    private CommandLine cl;
-
-    static {
-        options.addOption("w", false, "watch");
-    }
-    
-    public StatCommand() {
-        super("stat", "[-w] path");
-    }
-
-    
-    @Override
-    public CliCommand parse(String[] cmdArgs) throws CliParseException {
-        Parser parser = new PosixParser();
-        try {
-            cl = parser.parse(options, cmdArgs);
-        } catch (ParseException ex) {
-            throw new CliParseException(ex);
-        }
-        args = cl.getArgs();
-        if(args.length < 2) {
-            throw new CliParseException(getUsageStr());
-        }    
-        
-        retainCompatibility(cmdArgs);
-
-        return this;
-    }
-
-    private void retainCompatibility(String[] cmdArgs) throws CliParseException {
-        // stat path [watch]
-        if (args.length > 2) {
-            // rewrite to option
-            cmdArgs[2] = "-w";
-            err.println("'stat path [watch]' has been deprecated. "
-                    + "Please use 'stat [-w] path' instead.");
-            Parser parser = new PosixParser();
-            try {
-                cl = parser.parse(options, cmdArgs);
-            } catch (ParseException ex) {
-                throw new CliParseException(ex);
-            }
-            args = cl.getArgs();
-        }
-    }
-    
-    @Override
-    public boolean exec() throws CliException {
-        String path = args[1];
-        boolean watch = cl.hasOption("w");
-        Stat stat;
-        try {
-            stat = zk.exists(path, watch);
-        } catch (IllegalArgumentException ex) {
-            throw new MalformedPathException(ex.getMessage());
-        } catch (KeeperException|InterruptedException ex) {
-            throw new CliWrapperException(ex);
-        }
-        if (stat == null) {
-            throw new CliWrapperException(new KeeperException.NoNodeException(path));
-        }
-        new StatPrinter(out).print(stat);
-        return watch;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/StatPrinter.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/StatPrinter.java b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/StatPrinter.java
deleted file mode 100644
index c803b20..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/StatPrinter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.cli;
-
-import java.io.PrintStream;
-import java.util.Date;
-import org.apache.zookeeper.data.Stat;
-
-/**
- * utility for printing stat values s
- */
-public class StatPrinter {
-
-    protected PrintStream out;
-
-    public StatPrinter(PrintStream out) {
-        this.out = out;
-    }
-
-    public void print(Stat stat) {
-        out.println("cZxid = 0x" + Long.toHexString(stat.getCzxid()));
-        out.println("ctime = " + new Date(stat.getCtime()).toString());
-        out.println("mZxid = 0x" + Long.toHexString(stat.getMzxid()));
-        out.println("mtime = " + new Date(stat.getMtime()).toString());
-        out.println("pZxid = 0x" + Long.toHexString(stat.getPzxid()));
-        out.println("cversion = " + stat.getCversion());
-        out.println("dataVersion = " + stat.getVersion());
-        out.println("aclVersion = " + stat.getAversion());
-        out.println("ephemeralOwner = 0x"
-                + Long.toHexString(stat.getEphemeralOwner()));
-        out.println("dataLength = " + stat.getDataLength());
-        out.println("numChildren = " + stat.getNumChildren());
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SyncCommand.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SyncCommand.java b/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SyncCommand.java
deleted file mode 100644
index 74affd2..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/cli/SyncCommand.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.zookeeper.cli;
-
-import java.io.IOException;
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.apache.commons.cli.Parser;
-import org.apache.commons.cli.PosixParser;
-import org.apache.zookeeper.AsyncCallback;
-import org.apache.zookeeper.KeeperException;
-
-/**
- * sync command for cli
- */
-public class SyncCommand extends CliCommand {
-
-    private static Options options = new Options();
-    private String[] args;
-
-    public SyncCommand() {
-        super("sync", "path");
-    }
-
-    @Override
-    public CliCommand parse(String[] cmdArgs) throws CliParseException {
-        Parser parser = new PosixParser();
-        CommandLine cl;
-        try {
-            cl = parser.parse(options, cmdArgs);
-        } catch (ParseException ex) {
-            throw new CliParseException(ex);
-        }
-        args = cl.getArgs();
-        if (args.length < 2) {
-            throw new CliParseException(getUsageStr());
-        }
-
-        return this;
-    }
-
-    @Override
-    public boolean exec() throws CliException {
-        String path = args[1];
-        try {
-            zk.sync(path, new AsyncCallback.VoidCallback() {
-
-                public void processResult(int rc, String path, Object ctx) {
-                    out.println("Sync returned " + rc);
-                }
-            }, null);
-        } catch (IllegalArgumentException ex) {
-            throw new MalformedPathException(ex.getMessage());
-        }
-
-
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/common/AtomicFileOutputStream.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/common/AtomicFileOutputStream.java b/zookeeper-common/src/main/java/org/apache/zookeeper/common/AtomicFileOutputStream.java
deleted file mode 100644
index 740ae8f..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/common/AtomicFileOutputStream.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.common;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FilterOutputStream;
-import java.io.IOException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/*
- * This code is originally from HDFS, see the similarly named files there
- * in case of bug fixing, history, etc...
- */
-
-/**
- * A FileOutputStream that has the property that it will only show up at its
- * destination once it has been entirely written and flushed to disk. While
- * being written, it will use a .tmp suffix.
- *
- * When the output stream is closed, it is flushed, fsynced, and will be moved
- * into place, overwriting any file that already exists at that location.
- *
- * <b>NOTE</b>: on Windows platforms, it will not atomically replace the target
- * file - instead the target file is deleted before this one is moved into
- * place.
- */
-public class AtomicFileOutputStream extends FilterOutputStream {
-    private static final String TMP_EXTENSION = ".tmp";
-
-    private final static Logger LOG = LoggerFactory
-            .getLogger(AtomicFileOutputStream.class);
-
-    private final File origFile;
-    private final File tmpFile;
-
-    public AtomicFileOutputStream(File f) throws FileNotFoundException {
-        // Code unfortunately must be duplicated below since we can't assign
-        // anything
-        // before calling super
-        super(new FileOutputStream(new File(f.getParentFile(), f.getName()
-                + TMP_EXTENSION)));
-        origFile = f.getAbsoluteFile();
-        tmpFile = new File(f.getParentFile(), f.getName() + TMP_EXTENSION)
-                .getAbsoluteFile();
-    }
-
-    /**
-     * The default write method in FilterOutputStream does not call the write
-     * method of its underlying input stream with the same arguments. Instead
-     * it writes the data byte by byte, override it here to make it more
-     * efficient.
-     */
-    @Override
-    public void write(byte b[], int off, int len) throws IOException {
-        out.write(b, off, len);
-    }
-
-    @Override
-    public void close() throws IOException {
-        boolean triedToClose = false, success = false;
-        try {
-            flush();
-            ((FileOutputStream) out).getFD().sync();
-
-            triedToClose = true;
-            super.close();
-            success = true;
-        } finally {
-            if (success) {
-                boolean renamed = tmpFile.renameTo(origFile);
-                if (!renamed) {
-                    // On windows, renameTo does not replace.
-                    if (!origFile.delete() || !tmpFile.renameTo(origFile)) {
-                        throw new IOException(
-                                "Could not rename temporary file " + tmpFile
-                                        + " to " + origFile);
-                    }
-                }
-            } else {
-                if (!triedToClose) {
-                    // If we failed when flushing, try to close it to not leak
-                    // an FD
-                    IOUtils.closeStream(out);
-                }
-                // close wasn't successful, try to delete the tmp file
-                if (!tmpFile.delete()) {
-                    LOG.warn("Unable to delete tmp file " + tmpFile);
-                }
-            }
-        }
-    }
-
-    /**
-     * Close the atomic file, but do not "commit" the temporary file on top of
-     * the destination. This should be used if there is a failure in writing.
-     */
-    public void abort() {
-        try {
-            super.close();
-        } catch (IOException ioe) {
-            LOG.warn("Unable to abort file " + tmpFile, ioe);
-        }
-        if (!tmpFile.delete()) {
-            LOG.warn("Unable to delete tmp file during abort " + tmpFile);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/common/AtomicFileWritingIdiom.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/common/AtomicFileWritingIdiom.java b/zookeeper-common/src/main/java/org/apache/zookeeper/common/AtomicFileWritingIdiom.java
deleted file mode 100644
index 441ea65..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/common/AtomicFileWritingIdiom.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.common;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-
-/*
- *  Used to perform an atomic write into a file.
- *  If there is a failure in the middle of the writing operation, 
- *  the original file (if it exists) is left intact.
- *  Based on the org.apache.zookeeper.server.quorum.QuorumPeer.writeLongToFile(...) idiom
- *  using the HDFS AtomicFileOutputStream class.
- */
-public class AtomicFileWritingIdiom {
-
-    public static interface OutputStreamStatement {
-
-        public void write(OutputStream os) throws IOException;
-
-    }
-
-    public static interface WriterStatement {
-
-        public void write(Writer os) throws IOException;
-
-    }
-
-    public AtomicFileWritingIdiom(File targetFile, OutputStreamStatement osStmt)  throws IOException {
-        this(targetFile, osStmt, null);
-    }
-
-    public AtomicFileWritingIdiom(File targetFile, WriterStatement wStmt)  throws IOException {
-        this(targetFile, null, wStmt);
-    }
-
-    private AtomicFileWritingIdiom(File targetFile, OutputStreamStatement osStmt, WriterStatement wStmt)  throws IOException {
-        AtomicFileOutputStream out = null;
-        boolean error = true;
-        try {
-            out = new AtomicFileOutputStream(targetFile);
-            if (wStmt == null) {
-                // execute output stream operation
-                osStmt.write(out);
-            } else {
-                BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out));
-                // execute writer operation and flush
-                wStmt.write(bw);
-                bw.flush();
-            }
-            out.flush();
-            // everything went ok
-            error = false;
-        } finally {
-            // nothing interesting to do if out == null
-            if (out != null) {
-                if (error) {
-                    // worst case here the tmp file/resources(fd) are not cleaned up
-                    // and the caller will be notified (IOException)
-                    out.abort();
-                } else {
-                    // if the close operation (rename) fails we'll get notified.
-                    // worst case the tmp file may still exist
-                    IOUtils.closeStream(out);
-                }
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/common/ClientX509Util.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/common/ClientX509Util.java b/zookeeper-common/src/main/java/org/apache/zookeeper/common/ClientX509Util.java
deleted file mode 100644
index 63dd17a..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/common/ClientX509Util.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.zookeeper.common;
-
-public class ClientX509Util extends X509Util {
-
-    private final String sslAuthProviderProperty = getConfigPrefix() + "authProvider";
-
-    @Override
-    protected String getConfigPrefix() {
-        return "zookeeper.ssl.";
-    }
-
-    @Override
-    protected boolean shouldVerifyClientHostname() {
-        return false;
-    }
-
-    public String getSslAuthProviderProperty() {
-        return sslAuthProviderProperty;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/common/IOUtils.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/common/IOUtils.java b/zookeeper-common/src/main/java/org/apache/zookeeper/common/IOUtils.java
deleted file mode 100644
index 16aea4e..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/common/IOUtils.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.common;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
-
-import org.slf4j.Logger;
-
-/*
- * This code is originally from HDFS, see the similarly named files there
- * in case of bug fixing, history, etc...
- */
-
-public class IOUtils {
-    /**
-     * Closes the stream ignoring {@link IOException}. Must only be called in
-     * cleaning up from exception handlers.
-     * 
-     * @param stream
-     *            the Stream to close
-     */
-    public static void closeStream(Closeable stream) {
-        cleanup(null, stream);
-    }
-
-    /**
-     * Close the Closeable objects and <b>ignore</b> any {@link IOException} or
-     * null pointers. Must only be used for cleanup in exception handlers.
-     * 
-     * @param log
-     *            the log to record problems to at debug level. Can be null.
-     * @param closeables
-     *            the objects to close
-     */
-    public static void cleanup(Logger log, Closeable... closeables) {
-        for (Closeable c : closeables) {
-            if (c != null) {
-                try {
-                    c.close();
-                } catch (IOException e) {
-                    if (log != null) {
-                        log.warn("Exception in closing " + c, e);
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * Copies from one stream to another.
-     * 
-     * @param in
-     *            InputStrem to read from
-     * @param out
-     *            OutputStream to write to
-     * @param buffSize
-     *            the size of the buffer
-     * @param close
-     *            whether or not close the InputStream and OutputStream at the
-     *            end. The streams are closed in the finally clause.
-     */
-    public static void copyBytes(InputStream in, OutputStream out,
-            int buffSize, boolean close) throws IOException {
-        try {
-            copyBytes(in, out, buffSize);
-            if (close) {
-                out.close();
-                out = null;
-                in.close();
-                in = null;
-            }
-        } finally {
-            if (close) {
-                closeStream(out);
-                closeStream(in);
-            }
-        }
-    }
-
-    /**
-     * Copies from one stream to another.
-     * 
-     * @param in
-     *            InputStrem to read from
-     * @param out
-     *            OutputStream to write to
-     * @param buffSize
-     *            the size of the buffer
-     */
-    public static void copyBytes(InputStream in, OutputStream out, int buffSize)
-            throws IOException {
-        PrintStream ps = out instanceof PrintStream ? (PrintStream) out : null;
-        byte buf[] = new byte[buffSize];
-        int bytesRead = in.read(buf);
-        while (bytesRead >= 0) {
-            out.write(buf, 0, bytesRead);
-            if ((ps != null) && ps.checkError()) {
-                throw new IOException("Unable to write to output stream.");
-            }
-            bytesRead = in.read(buf);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/common/NetUtils.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/common/NetUtils.java b/zookeeper-common/src/main/java/org/apache/zookeeper/common/NetUtils.java
deleted file mode 100644
index 4779003..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/common/NetUtils.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.zookeeper.common;
-
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-
-/**
- * This class contains common utilities for netstuff. Like printing IPv6 literals correctly
- */
-public class NetUtils {
-
-    public static String formatInetAddr(InetSocketAddress addr) {
-        InetAddress ia = addr.getAddress();
-
-        if (ia == null) {
-            return String.format("%s:%s", addr.getHostString(), addr.getPort());
-        }
-
-        if (ia instanceof Inet6Address) {
-            return String.format("[%s]:%s", ia.getHostAddress(), addr.getPort());
-        } else {
-            return String.format("%s:%s", ia.getHostAddress(), addr.getPort());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/common/PathTrie.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/common/PathTrie.java b/zookeeper-common/src/main/java/org/apache/zookeeper/common/PathTrie.java
deleted file mode 100644
index 5555b28..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/common/PathTrie.java
+++ /dev/null
@@ -1,294 +0,0 @@
- /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.zookeeper.common;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * a class that implements prefix matching for 
- * components of a filesystem path. the trie
- * looks like a tree with edges mapping to 
- * the component of a path.
- * example /ab/bc/cf would map to a trie
- *           /
- *        ab/
- *        (ab)
- *      bc/
- *       / 
- *      (bc)
- *   cf/
- *   (cf)
- */    
-public class PathTrie {
-    /**
-     * the logger for this class
-     */
-    private static final Logger LOG = LoggerFactory.getLogger(PathTrie.class);
-    
-    /**
-     * the root node of PathTrie
-     */
-    private final TrieNode rootNode ;
-    
-    static class TrieNode {
-        boolean property = false;
-        final Map<String, TrieNode> children;
-        TrieNode parent = null;
-        /**
-         * create a trienode with parent
-         * as parameter
-         * @param parent the parent of this trienode
-         */
-        private TrieNode(TrieNode parent) {
-            children = new HashMap<String, TrieNode>();
-            this.parent = parent;
-        }
-        
-        /**
-         * get the parent of this node
-         * @return the parent node
-         */
-        TrieNode getParent() {
-            return this.parent;
-        }
-        
-        /**
-         * set the parent of this node
-         * @param parent the parent to set to
-         */
-        void setParent(TrieNode parent) {
-            this.parent = parent;
-        }
-        
-        /**
-         * a property that is set 
-         * for a node - making it 
-         * special.
-         */
-        void setProperty(boolean prop) {
-            this.property = prop;
-        }
-        
-        /** the property of this
-         * node 
-         * @return the property for this
-         * node
-         */
-        boolean getProperty() {
-            return this.property;
-        }
-        /**
-         * add a child to the existing node
-         * @param childName the string name of the child
-         * @param node the node that is the child
-         */
-        void addChild(String childName, TrieNode node) {
-            synchronized(children) {
-                if (children.containsKey(childName)) {
-                    return;
-                }
-                children.put(childName, node);
-            }
-        }
-     
-        /**
-         * delete child from this node
-         * @param childName the string name of the child to 
-         * be deleted
-         */
-        void deleteChild(String childName) {
-            synchronized(children) {
-                if (!children.containsKey(childName)) {
-                    return;
-                }
-                TrieNode childNode = children.get(childName);
-                // this is the only child node.
-                if (childNode.getChildren().length == 1) { 
-                    childNode.setParent(null);
-                    children.remove(childName);
-                }
-                else {
-                    // their are more child nodes
-                    // so just reset property.
-                    childNode.setProperty(false);
-                }
-            }
-        }
-        
-        /**
-         * return the child of a node mapping
-         * to the input childname
-         * @param childName the name of the child
-         * @return the child of a node
-         */
-        TrieNode getChild(String childName) {
-            synchronized(children) {
-               if (!children.containsKey(childName)) {
-                   return null;
-               }
-               else {
-                   return children.get(childName);
-               }
-            }
-        }
-
-        /**
-         * get the list of children of this 
-         * trienode.
-         * @param node to get its children
-         * @return the string list of its children
-         */
-        String[] getChildren() {
-           synchronized(children) {
-               return children.keySet().toArray(new String[0]);
-           }
-        }
-        
-        /**
-         * get the string representation
-         * for this node
-         */
-        public String toString() {
-            StringBuilder sb = new StringBuilder();
-            sb.append("Children of trienode: ");
-            synchronized(children) {
-                for (String str: children.keySet()) {
-                    sb.append(" " + str);
-                }
-            }
-            return sb.toString();
-        }
-    }
-    
-    /**
-     * construct a new PathTrie with
-     * a root node of /
-     */
-    public PathTrie() {
-        this.rootNode = new TrieNode(null);
-    }
-    
-    /**
-     * add a path to the path trie 
-     * @param path
-     */
-    public void addPath(String path) {
-        if (path == null) {
-            return;
-        }
-        String[] pathComponents = path.split("/");
-        TrieNode parent = rootNode;
-        String part = null;
-        if (pathComponents.length <= 1) {
-            throw new IllegalArgumentException("Invalid path " + path);
-        }
-        for (int i=1; i<pathComponents.length; i++) {
-            part = pathComponents[i];
-            if (parent.getChild(part) == null) {
-                parent.addChild(part, new TrieNode(parent));
-            }
-            parent = parent.getChild(part);
-        }
-        parent.setProperty(true);
-    }
-    
-    /**
-     * delete a path from the trie
-     * @param path the path to be deleted
-     */
-    public void deletePath(String path) {
-        if (path == null) {
-            return;
-        }
-        String[] pathComponents = path.split("/");
-        TrieNode parent = rootNode;
-        String part = null;
-        if (pathComponents.length <= 1) { 
-            throw new IllegalArgumentException("Invalid path " + path);
-        }
-        for (int i=1; i<pathComponents.length; i++) {
-            part = pathComponents[i];
-            if (parent.getChild(part) == null) {
-                //the path does not exist 
-                return;
-            }
-            parent = parent.getChild(part);
-            LOG.info("{}",parent);
-        }
-        TrieNode realParent  = parent.getParent();
-        realParent.deleteChild(part);
-    }
-    
-    /**
-     * return the largest prefix for the input path.
-     * @param path the input path
-     * @return the largest prefix for the input path.
-     */
-    public String findMaxPrefix(String path) {
-        if (path == null) {
-            return null;
-        }
-        if ("/".equals(path)) {
-            return path;
-        }
-        String[] pathComponents = path.split("/");
-        TrieNode parent = rootNode;
-        List<String> components = new ArrayList<String>();
-        if (pathComponents.length <= 1) {
-            throw new IllegalArgumentException("Invalid path " + path);
-        }
-        int i = 1;
-        String part = null;
-        StringBuilder sb = new StringBuilder();
-        int lastindex = -1;
-        while((i < pathComponents.length)) {
-            if (parent.getChild(pathComponents[i]) != null) {
-                part = pathComponents[i];
-                parent = parent.getChild(part);
-                components.add(part);
-                if (parent.getProperty()) {
-                    lastindex = i-1;
-                }
-            }
-            else {
-                break;
-            }
-            i++;
-        }
-        for (int j=0; j< (lastindex+1); j++) {
-            sb.append("/" + components.get(j));
-        }
-        return sb.toString();
-    }
-
-    /**
-     * clear all nodes
-     */
-    public void clear() {
-        for(String child : rootNode.getChildren()) {
-            rootNode.deleteChild(child);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/common/PathUtils.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/common/PathUtils.java b/zookeeper-common/src/main/java/org/apache/zookeeper/common/PathUtils.java
deleted file mode 100644
index d80feab..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/common/PathUtils.java
+++ /dev/null
@@ -1,120 +0,0 @@
- /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.zookeeper.common;
-
-
-/**
- * Path related utilities
- */    
-public class PathUtils {
-	
-	/** validate the provided znode path string
-	 * @param path znode path string
-	 * @param isSequential if the path is being created
-	 * with a sequential flag
-	 * @throws IllegalArgumentException if the path is invalid
-	 */
-	public static void validatePath(String path, boolean isSequential) 
-		throws IllegalArgumentException {
-		validatePath(isSequential? path + "1": path);
-	}
-	
-    /**
-     * Validate the provided znode path string
-     * @param path znode path string
-     * @throws IllegalArgumentException if the path is invalid
-     */
-    public static void validatePath(String path) throws IllegalArgumentException {
-        if (path == null) {
-            throw new IllegalArgumentException("Path cannot be null");
-        }
-        if (path.length() == 0) {
-            throw new IllegalArgumentException("Path length must be > 0");
-        }
-        if (path.charAt(0) != '/') {
-            throw new IllegalArgumentException(
-                         "Path must start with / character");
-        }
-        if (path.length() == 1) { // done checking - it's the root
-            return;
-        }
-        if (path.charAt(path.length() - 1) == '/') {
-            throw new IllegalArgumentException(
-                         "Path must not end with / character");
-        }
-
-        String reason = null;
-        char lastc = '/';
-        char chars[] = path.toCharArray();
-        char c;
-        for (int i = 1; i < chars.length; lastc = chars[i], i++) {
-            c = chars[i];
-
-            if (c == 0) {
-                reason = "null character not allowed @" + i;
-                break;
-            } else if (c == '/' && lastc == '/') {
-                reason = "empty node name specified @" + i;
-                break;
-            } else if (c == '.' && lastc == '.') {
-                if (chars[i-2] == '/' &&
-                        ((i + 1 == chars.length)
-                                || chars[i+1] == '/')) {
-                    reason = "relative paths not allowed @" + i;
-                    break;
-                }
-            } else if (c == '.') {
-                if (chars[i-1] == '/' &&
-                        ((i + 1 == chars.length)
-                                || chars[i+1] == '/')) {
-                    reason = "relative paths not allowed @" + i;
-                    break;
-                }
-            } else if (c > '\u0000' && c <= '\u001f'
-                    || c >= '\u007f' && c <= '\u009F'
-                    || c >= '\ud800' && c <= '\uf8ff'
-                    || c >= '\ufff0' && c <= '\uffff') {
-                reason = "invalid character @" + i;
-                break;
-            }
-        }
-
-        if (reason != null) {
-            throw new IllegalArgumentException(
-                    "Invalid path string \"" + path + "\" caused by " + reason);
-        }
-    }
-
-    /**
-     * Convert Windows path to Unix
-     *
-     * @param path
-     *            file path
-     * @return converted file path
-     */
-    public static String normalizeFileSystemPath(String path) {
-        if (path != null) {
-            String osname = java.lang.System.getProperty("os.name");
-            if (osname.toLowerCase().contains("windows")) {
-                return path.replace('\\', '/');
-            }
-        }
-        return path;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/cb9f303b/zookeeper-common/src/main/java/org/apache/zookeeper/common/QuorumX509Util.java
----------------------------------------------------------------------
diff --git a/zookeeper-common/src/main/java/org/apache/zookeeper/common/QuorumX509Util.java b/zookeeper-common/src/main/java/org/apache/zookeeper/common/QuorumX509Util.java
deleted file mode 100644
index abe90a5..0000000
--- a/zookeeper-common/src/main/java/org/apache/zookeeper/common/QuorumX509Util.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.zookeeper.common;
-
-public class QuorumX509Util extends X509Util {
-
-    @Override
-    protected String getConfigPrefix() {
-        return "zookeeper.ssl.quorum.";
-    }
-
-    @Override
-    protected boolean shouldVerifyClientHostname() {
-        return true;
-    }
-}


Mime
View raw message