From commits-return-8095-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Thu Jan 9 21:57:00 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id A0DAC18063F for ; Thu, 9 Jan 2020 22:56:59 +0100 (CET) Received: (qmail 12576 invoked by uid 500); 9 Jan 2020 21:56:59 -0000 Mailing-List: contact commits-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list commits@zookeeper.apache.org Received: (qmail 12563 invoked by uid 99); 9 Jan 2020 21:56:58 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jan 2020 21:56:58 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id CF96181F08; Thu, 9 Jan 2020 21:56:58 +0000 (UTC) Date: Thu, 09 Jan 2020 21:56:58 +0000 To: "commits@zookeeper.apache.org" Subject: [zookeeper] branch branch-3.6 updated: ZOOKEEPER-3411: Remove deprecated ls2 and rmr command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <157860701870.25486.6511364728022065371@gitbox.apache.org> From: andor@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: zookeeper X-Git-Refname: refs/heads/branch-3.6 X-Git-Reftype: branch X-Git-Oldrev: 901d82c7fa2fe2ff9cc6a408ab0b8a490667def7 X-Git-Newrev: dc673cb39d89162289f2ebfc7997d4e20efb7f17 X-Git-Rev: dc673cb39d89162289f2ebfc7997d4e20efb7f17 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. andor pushed a commit to branch branch-3.6 in repository https://gitbox.apache.org/repos/asf/zookeeper.git The following commit(s) were added to refs/heads/branch-3.6 by this push: new dc673cb ZOOKEEPER-3411: Remove deprecated ls2 and rmr command dc673cb is described below commit dc673cb39d89162289f2ebfc7997d4e20efb7f17 Author: ravowlga123 AuthorDate: Thu Jan 9 22:56:39 2020 +0100 ZOOKEEPER-3411: Remove deprecated ls2 and rmr command Removed Ls2Command.java, DeleteAllCommand.printdeprecatedwarning(), statements creating new objects for ls2 and rmr in ZookeeperMain.java. Updated zookeeperCLI.md and ZookeeperTest.java. Please do let me know if any additional changes are needed Author: ravowlga123 Reviewers: andor@apache.org Closes #1175 from ravowlga123/ZOOKEEPER-3411 (cherry picked from commit 27b92caefd57a60309af06ebce29e56954ca9aac) Signed-off-by: Andor Molnar --- .../src/main/resources/markdown/zookeeperCLI.md | 19 ------ .../java/org/apache/zookeeper/ZooKeeperMain.java | 4 -- .../org/apache/zookeeper/cli/DeleteAllCommand.java | 7 -- .../java/org/apache/zookeeper/cli/Ls2Command.java | 77 ---------------------- .../java/org/apache/zookeeper/ZooKeeperTest.java | 6 -- 5 files changed, 113 deletions(-) diff --git a/zookeeper-docs/src/main/resources/markdown/zookeeperCLI.md b/zookeeper-docs/src/main/resources/markdown/zookeeperCLI.md index 717c4f1..3ca676e 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 734cf7e..dad878c 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.GetCommand; 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 class ZooKeeperMain { 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 507693f..cbeceb0 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 class DeleteAllCommand extends CliCommand { @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 class DeleteAllCommand extends CliCommand { 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 0bdaff6..0000000 --- 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 d19f627..4467a1a 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 class ZooKeeperTest extends ClientBase { 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));