You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by an...@apache.org on 2020/01/09 21:56:58 UTC

[zookeeper] branch branch-3.6 updated: ZOOKEEPER-3411: Remove deprecated ls2 and rmr command

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 <ra...@gmail.com>
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 <ra...@gmail.com>
    
    Reviewers: andor@apache.org
    
    Closes #1175 from ravowlga123/ZOOKEEPER-3411
    
    (cherry picked from commit 27b92caefd57a60309af06ebce29e56954ca9aac)
    Signed-off-by: Andor Molnar <an...@apache.org>
---
 .../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<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;
-    }
-
-}
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));