(CommandLine cli)
| 68 | } |
| 69 | |
| 70 | @Override |
| 71 | public void runImpl(CommandLine cli) throws Exception { |
| 72 | String zkHost = CLIUtils.getZkHost(cli); |
| 73 | |
| 74 | try (SolrZkClient zkClient = CLIUtils.getSolrZkClient(cli, zkHost)) { |
| 75 | echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ..."); |
| 76 | String src = cli.getArgs()[0]; |
| 77 | String dst = cli.getArgs()[1]; |
| 78 | |
| 79 | if (src.toLowerCase(Locale.ROOT).startsWith("file:") |
| 80 | || dst.toLowerCase(Locale.ROOT).startsWith("file:")) { |
| 81 | throw new SolrServerException( |
| 82 | "mv command operates on znodes and 'file:' has been specified."); |
| 83 | } |
| 84 | String source = src; |
| 85 | if (src.toLowerCase(Locale.ROOT).startsWith("zk")) { |
| 86 | source = src.substring(3); |
| 87 | } |
| 88 | |
| 89 | String dest = dst; |
| 90 | if (dst.toLowerCase(Locale.ROOT).startsWith("zk")) { |
| 91 | dest = dst.substring(3); |
| 92 | } |
| 93 | |
| 94 | echo("Moving Znode " + source + " to " + dest + " on ZooKeeper at " + zkHost); |
| 95 | zkClient.moveZnode(source, dest); |
| 96 | } catch (Exception e) { |
| 97 | log.error("Could not complete mv operation for reason: ", e); |
| 98 | throw (e); |
| 99 | } |
| 100 | } |
| 101 | } |
nothing calls this directly
no test coverage detected