diff --git a/zookeeper-docs/src/main/resources/markdown/zookeeperCLI.md b/zookeeper-docs/src/main/resources/markdown/zookeeperCLI.md index 717c4f13190..3ca676e504d 100644 --- a/zookeeper-docs/src/main/resources/markdown/zookeeperCLI.md +++ b/zookeeper-docs/src/main/resources/markdown/zookeeperCLI.md @@ -48,13 +48,11 @@ ZooKeeper -server host:port cmd args history listquota path ls [-s] [-w] [-R] path - ls2 path [watch] printwatches on|off quit reconfig [-s] [-v version] [[-file path] | [-members serverID=host:port1:port2;port3[,...]*]] | [-add serverId=host:port1:port2;port3[,...]]* [-remove serverId[,...]*] redo cmdno removewatches path [-c|-d|-a] [-l] - rmr path set [-s] [-v version] path data setAcl [-s] [-v version] [-R] path acl setquota -n|-b val path @@ -324,15 +322,6 @@ Listing the child nodes of one path WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/brokers ``` -## ls2 - -'ls2' has been deprecated. Please use 'ls [-s] path' instead. - -```bash -[zkshell: 7] ls2 / - 'ls2' has been deprecated. Please use 'ls [-s] path' instead. -``` - ## printwatches A switch to turn on/off whether printing watches or not. @@ -422,14 +411,6 @@ Remove the watches under a node. ``` -## rmr -The command 'rmr' has been deprecated. Please use 'deleteall' instead. - -```bash -[zkshell: 4] rmr /zk-latencies4 - The command 'rmr' has been deprecated. Please use 'deleteall' instead -``` - ## set Set/update the data on a path. diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeperMain.java b/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeperMain.java index 734cf7ec0ee..dad878cf87c 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeperMain.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeperMain.java @@ -53,7 +53,6 @@ import org.apache.zookeeper.cli.GetConfigCommand; import org.apache.zookeeper.cli.GetEphemeralsCommand; import org.apache.zookeeper.cli.ListQuotaCommand; -import org.apache.zookeeper.cli.Ls2Command; import org.apache.zookeeper.cli.LsCommand; import org.apache.zookeeper.cli.MalformedCommandException; import org.apache.zookeeper.cli.ReconfigCommand; @@ -105,12 +104,9 @@ public boolean getPrintWatches() { new CreateCommand().addToMap(commandMapCli); new DeleteCommand().addToMap(commandMapCli); new DeleteAllCommand().addToMap(commandMapCli); - // Depricated: rmr - new DeleteAllCommand("rmr").addToMap(commandMapCli); new SetCommand().addToMap(commandMapCli); new GetCommand().addToMap(commandMapCli); new LsCommand().addToMap(commandMapCli); - new Ls2Command().addToMap(commandMapCli); new GetAclCommand().addToMap(commandMapCli); new SetAclCommand().addToMap(commandMapCli); new StatCommand().addToMap(commandMapCli); diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/cli/DeleteAllCommand.java b/zookeeper-server/src/main/java/org/apache/zookeeper/cli/DeleteAllCommand.java index 507693f298a..cbeceb0e08e 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/cli/DeleteAllCommand.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/cli/DeleteAllCommand.java @@ -66,7 +66,6 @@ public CliCommand parse(String[] cmdArgs) throws CliParseException { @Override public boolean exec() throws CliException { - printDeprecatedWarning(); int batchSize; try { batchSize = cl.hasOption("b") ? Integer.parseInt(cl.getOptionValue("b")) : 1000; @@ -88,10 +87,4 @@ public boolean exec() throws CliException { return false; } - private void printDeprecatedWarning() { - if ("rmr".equals(args[0])) { - err.println("The command 'rmr' has been deprecated. " + "Please use 'deleteall' instead."); - } - } - } diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/cli/Ls2Command.java b/zookeeper-server/src/main/java/org/apache/zookeeper/cli/Ls2Command.java deleted file mode 100644 index 0bdaff6dcda..00000000000 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/cli/Ls2Command.java +++ /dev/null @@ -1,77 +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.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.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 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; - } - -} diff --git a/zookeeper-server/src/test/java/org/apache/zookeeper/ZooKeeperTest.java b/zookeeper-server/src/test/java/org/apache/zookeeper/ZooKeeperTest.java index d19f627e069..4467a1ac471 100644 --- a/zookeeper-server/src/test/java/org/apache/zookeeper/ZooKeeperTest.java +++ b/zookeeper-server/src/test/java/org/apache/zookeeper/ZooKeeperTest.java @@ -154,13 +154,7 @@ public void testDeleteRecursiveCli() throws IOException, InterruptedException, C assertTrue(children.contains("c")); ZooKeeperMain zkMain = new ZooKeeperMain(zk); - // 'rmr' is deprecated, so the test here is just for backwards - // compatibility. - String cmdstring0 = "rmr /a/b/v"; String cmdstring1 = "deleteall /a"; - zkMain.cl.parseCommand(cmdstring0); - assertFalse(zkMain.processZKCmd(zkMain.cl)); - assertEquals(null, zk.exists("/a/b/v", null)); zkMain.cl.parseCommand(cmdstring1); assertFalse(zkMain.processZKCmd(zkMain.cl)); assertNull(zk.exists("/a", null));