You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ae...@apache.org on 2018/09/11 23:47:46 UTC
hadoop git commit: HDDS-424. Consolidate ozone oz parameters to use
GNU convention. Contributed by Elek, Marton.
Repository: hadoop
Updated Branches:
refs/heads/trunk 1d567c25d -> a406f6f60
HDDS-424. Consolidate ozone oz parameters to use GNU convention.
Contributed by Elek, Marton.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a406f6f6
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a406f6f6
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a406f6f6
Branch: refs/heads/trunk
Commit: a406f6f60ee0caf8229d13bda595d621a9779aa8
Parents: 1d567c2
Author: Anu Engineer <ae...@apache.org>
Authored: Tue Sep 11 16:42:12 2018 -0700
Committer: Anu Engineer <ae...@apache.org>
Committed: Tue Sep 11 16:47:33 2018 -0700
----------------------------------------------------------------------
.../org/apache/hadoop/hdds/cli/GenericCli.java | 14 +-
.../hadoop/hdds/cli/GenericParentCommand.java | 25 +++
.../hdds/cli/MissingSubcommandException.java | 29 ++++
.../src/test/acceptance/basic/ozone-shell.robot | 36 ++---
.../src/test/acceptance/ozonefs/ozonefs.robot | 6 +-
.../hadoop/ozone/ozShell/TestOzoneShell.java | 162 ++++++++++---------
.../hadoop/ozone/web/ozShell/Handler.java | 36 ++---
.../apache/hadoop/ozone/web/ozShell/Shell.java | 39 +----
.../web/ozShell/bucket/BucketCommands.java | 59 +++++++
.../web/ozShell/bucket/CreateBucketHandler.java | 2 +-
.../web/ozShell/bucket/DeleteBucketHandler.java | 2 +-
.../web/ozShell/bucket/InfoBucketHandler.java | 2 +-
.../web/ozShell/bucket/ListBucketHandler.java | 9 +-
.../web/ozShell/bucket/UpdateBucketHandler.java | 6 +-
.../web/ozShell/keys/DeleteKeyHandler.java | 2 +-
.../ozone/web/ozShell/keys/GetKeyHandler.java | 11 +-
.../ozone/web/ozShell/keys/InfoKeyHandler.java | 2 +-
.../ozone/web/ozShell/keys/KeyCommands.java | 59 +++++++
.../ozone/web/ozShell/keys/ListKeyHandler.java | 9 +-
.../ozone/web/ozShell/keys/PutKeyHandler.java | 11 +-
.../web/ozShell/volume/CreateVolumeHandler.java | 18 +--
.../web/ozShell/volume/DeleteVolumeHandler.java | 2 +-
.../web/ozShell/volume/InfoVolumeHandler.java | 2 +-
.../web/ozShell/volume/ListVolumeHandler.java | 11 +-
.../web/ozShell/volume/UpdateVolumeHandler.java | 6 +-
.../web/ozShell/volume/VolumeCommands.java | 60 +++++++
26 files changed, 410 insertions(+), 210 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/GenericCli.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/GenericCli.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/GenericCli.java
index f829d82..9a0be44 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/GenericCli.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/GenericCli.java
@@ -27,13 +27,12 @@ import com.google.common.annotations.VisibleForTesting;
import picocli.CommandLine;
import picocli.CommandLine.ExecutionException;
import picocli.CommandLine.Option;
-import picocli.CommandLine.ParameterException;
import picocli.CommandLine.RunLast;
/**
* This is a generic parent class for all the ozone related cli tools.
*/
-public class GenericCli implements Callable<Void> {
+public class GenericCli implements Callable<Void>, GenericParentCommand {
@Option(names = {"--verbose"},
description = "More verbose output. Show the stack trace of the errors.")
@@ -72,7 +71,7 @@ public class GenericCli implements Callable<Void> {
@Override
public Void call() throws Exception {
- throw new ParameterException(cmd, "Please choose a subcommand");
+ throw new MissingSubcommandException();
}
public OzoneConfiguration createOzoneConfiguration() {
@@ -86,12 +85,13 @@ public class GenericCli implements Callable<Void> {
return ozoneConf;
}
- public boolean isVerbose() {
- return verbose;
- }
-
@VisibleForTesting
public picocli.CommandLine getCmd() {
return cmd;
}
+
+ @Override
+ public boolean isVerbose() {
+ return verbose;
+ }
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/GenericParentCommand.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/GenericParentCommand.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/GenericParentCommand.java
new file mode 100644
index 0000000..a1d2171
--- /dev/null
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/GenericParentCommand.java
@@ -0,0 +1,25 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.hadoop.hdds.cli;
+
+/**
+ * Interface to access the higher level parameters.
+ */
+public interface GenericParentCommand {
+
+ boolean isVerbose();
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/MissingSubcommandException.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/MissingSubcommandException.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/MissingSubcommandException.java
new file mode 100644
index 0000000..bf3818f
--- /dev/null
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/MissingSubcommandException.java
@@ -0,0 +1,29 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.hadoop.hdds.cli;
+
+/**
+ * Exception to throw if subcommand is not selected but required.
+ */
+public class MissingSubcommandException extends RuntimeException {
+
+ public MissingSubcommandException() {
+ super("Please select a subcommand");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/acceptance-test/src/test/acceptance/basic/ozone-shell.robot
----------------------------------------------------------------------
diff --git a/hadoop-ozone/acceptance-test/src/test/acceptance/basic/ozone-shell.robot b/hadoop-ozone/acceptance-test/src/test/acceptance/basic/ozone-shell.robot
index ac538b2..cc88a8a 100644
--- a/hadoop-ozone/acceptance-test/src/test/acceptance/basic/ozone-shell.robot
+++ b/hadoop-ozone/acceptance-test/src/test/acceptance/basic/ozone-shell.robot
@@ -48,39 +48,39 @@ RpcClient without scheme
*** Keywords ***
Test ozone shell
[arguments] ${protocol} ${server} ${volume}
- ${result} = Execute on datanode ozone oz -createVolume ${protocol}${server}/${volume} -user bilbo -quota 100TB -root
+ ${result} = Execute on datanode ozone oz volume create ${protocol}${server}/${volume} --user bilbo --quota 100TB --root
Should not contain ${result} Failed
Should contain ${result} Creating Volume: ${volume}
- ${result} = Execute on datanode ozone oz -listVolume ${protocol}${server}/ -user bilbo | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.volumeName=="${volume}")'
+ ${result} = Execute on datanode ozone oz volume list ${protocol}${server}/ --user bilbo | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.volumeName=="${volume}")'
Should contain ${result} createdOn
- ${result} = Execute on datanode ozone oz -listVolume -user bilbo | grep -Ev 'Removed|DEBUG|ERROR|INFO|TRACE|WARN' | jq -r '.[] | select(.volumeName=="${volume}")'
+ ${result} = Execute on datanode ozone oz volume list --user bilbo | grep -Ev 'Removed|DEBUG|ERROR|INFO|TRACE|WARN' | jq -r '.[] | select(.volumeName=="${volume}")'
Should contain ${result} createdOn
- Execute on datanode ozone oz -updateVolume ${protocol}${server}/${volume} -user bill -quota 10TB
- ${result} = Execute on datanode ozone oz -infoVolume ${protocol}${server}/${volume} | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.volumeName=="${volume}") | .owner | .name'
+ Execute on datanode ozone oz volume update ${protocol}${server}/${volume} --user bill --quota 10TB
+ ${result} = Execute on datanode ozone oz volume info ${protocol}${server}/${volume} | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.volumeName=="${volume}") | .owner | .name'
Should Be Equal ${result} bill
- ${result} = Execute on datanode ozone oz -infoVolume ${protocol}${server}/${volume} | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.volumeName=="${volume}") | .quota | .size'
+ ${result} = Execute on datanode ozone oz volume info ${protocol}${server}/${volume} | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.volumeName=="${volume}") | .quota | .size'
Should Be Equal ${result} 10
- Execute on datanode ozone oz -createBucket ${protocol}${server}/${volume}/bb1
- ${result} = Execute on datanode ozone oz -infoBucket ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.bucketName=="bb1") | .storageType'
+ Execute on datanode ozone oz bucket create ${protocol}${server}/${volume}/bb1
+ ${result} = Execute on datanode ozone oz bucket info ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.bucketName=="bb1") | .storageType'
Should Be Equal ${result} DISK
- ${result} = Execute on datanode ozone oz -updateBucket ${protocol}${server}/${volume}/bb1 -addAcl user:frodo:rw,group:samwise:r | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.bucketName=="bb1") | .acls | .[] | select(.name=="samwise") | .type'
+ ${result} = Execute on datanode ozone oz bucket update ${protocol}${server}/${volume}/bb1 --addAcl user:frodo:rw,group:samwise:r | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.bucketName=="bb1") | .acls | .[] | select(.name=="samwise") | .type'
Should Be Equal ${result} GROUP
- ${result} = Execute on datanode ozone oz -updateBucket ${protocol}${server}/${volume}/bb1 -removeAcl group:samwise:r | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.bucketName=="bb1") | .acls | .[] | select(.name=="frodo") | .type'
+ ${result} = Execute on datanode ozone oz bucket update ${protocol}${server}/${volume}/bb1 --removeAcl group:samwise:r | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.bucketName=="bb1") | .acls | .[] | select(.name=="frodo") | .type'
Should Be Equal ${result} USER
- ${result} = Execute on datanode ozone oz -listBucket ${protocol}${server}/${volume}/ | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.bucketName=="bb1") | .volumeName'
+ ${result} = Execute on datanode ozone oz bucket list ${protocol}${server}/${volume}/ | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.bucketName=="bb1") | .volumeName'
Should Be Equal ${result} ${volume}
Run Keyword Test key handling ${protocol} ${server} ${volume}
- Execute on datanode ozone oz -deleteBucket ${protocol}${server}/${volume}/bb1
- Execute on datanode ozone oz -deleteVolume ${protocol}${server}/${volume} -user bilbo
+ Execute on datanode ozone oz bucket delete ${protocol}${server}/${volume}/bb1
+ Execute on datanode ozone oz volume delete ${protocol}${server}/${volume} --user bilbo
Test key handling
[arguments] ${protocol} ${server} ${volume}
- Execute on datanode ozone oz -putKey ${protocol}${server}/${volume}/bb1/key1 -file NOTICE.txt
+ Execute on datanode ozone oz key put ${protocol}${server}/${volume}/bb1/key1 NOTICE.txt
Execute on datanode rm -f NOTICE.txt.1
- Execute on datanode ozone oz -getKey ${protocol}${server}/${volume}/bb1/key1 -file NOTICE.txt.1
+ Execute on datanode ozone oz key get ${protocol}${server}/${volume}/bb1/key1 NOTICE.txt.1
Execute on datanode ls -l NOTICE.txt.1
- ${result} = Execute on datanode ozone oz -infoKey ${protocol}${server}/${volume}/bb1/key1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.keyName=="key1")'
+ ${result} = Execute on datanode ozone oz key info ${protocol}${server}/${volume}/bb1/key1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.keyName=="key1")'
Should contain ${result} createdOn
- ${result} = Execute on datanode ozone oz -listKey ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.keyName=="key1") | .keyName'
+ ${result} = Execute on datanode ozone oz key list ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.keyName=="key1") | .keyName'
Should Be Equal ${result} key1
- Execute on datanode ozone oz -deleteKey ${protocol}${server}/${volume}/bb1/key1 -v
+ Execute on datanode ozone oz key delete ${protocol}${server}/${volume}/bb1/key1
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/acceptance-test/src/test/acceptance/ozonefs/ozonefs.robot
----------------------------------------------------------------------
diff --git a/hadoop-ozone/acceptance-test/src/test/acceptance/ozonefs/ozonefs.robot b/hadoop-ozone/acceptance-test/src/test/acceptance/ozonefs/ozonefs.robot
index 1d3aa4b..6329247 100644
--- a/hadoop-ozone/acceptance-test/src/test/acceptance/ozonefs/ozonefs.robot
+++ b/hadoop-ozone/acceptance-test/src/test/acceptance/ozonefs/ozonefs.robot
@@ -27,13 +27,13 @@ ${PROJECTDIR} ${CURDIR}/../../../../../..
*** Test Cases ***
Create volume and bucket
- Execute on datanode ozone oz -createVolume http://ozoneManager/fstest -user bilbo -quota 100TB -root
- Execute on datanode ozone oz -createBucket http://ozoneManager/fstest/bucket1
+ Execute on datanode ozone oz volume create http://ozoneManager/fstest --user bilbo --quota 100TB --root
+ Execute on datanode ozone oz bucket create http://ozoneManager/fstest/bucket1
Check volume from ozonefs
${result} = Execute on datanode ozone fs -ls o3://bucket1.fstest/
Create directory from ozonefs
Execute on datanode ozone fs -mkdir -p o3://bucket1.fstest/testdir/deep
- ${result} = Execute on ozoneManager ozone oz -listKey o3://ozoneManager/fstest/bucket1 | grep -v WARN | jq -r '.[].keyName'
+ ${result} = Execute on ozoneManager ozone oz key list o3://ozoneManager/fstest/bucket1 | grep -v WARN | jq -r '.[].keyName'
Should contain ${result} testdir/deep
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java
index f50de4b..f872865 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java
@@ -218,8 +218,8 @@ public class TestOzoneShell {
throws Exception {
err.reset();
String userName = "bilbo";
- String[] args = new String[] {"-createVolume", url + "/" + volumeName,
- "-user", userName, "-root"};
+ String[] args = new String[] {"volume", "create", url + "/" + volumeName,
+ "--user", userName, "--root"};
if (Strings.isNullOrEmpty(errorMsg)) {
execute(shell, args);
@@ -271,7 +271,7 @@ public class TestOzoneShell {
OzoneVolume volume = client.getVolumeDetails(volumeName);
assertNotNull(volume);
- String[] args = new String[] {"-deleteVolume", url + "/" + volumeName};
+ String[] args = new String[] {"volume", "delete", url + "/" + volumeName};
execute(shell, args);
String output = out.toString();
assertTrue(output.contains("Volume " + volumeName + " is deleted"));
@@ -296,7 +296,7 @@ public class TestOzoneShell {
.build();
client.createVolume(volumeName, volumeArgs);
- String[] args = new String[] {"-infoVolume", url + "/" + volumeName};
+ String[] args = new String[] {"volume", "info", url + "/" + volumeName};
execute(shell, args);
String output = out.toString();
@@ -305,7 +305,7 @@ public class TestOzoneShell {
&& output.contains(OzoneConsts.OZONE_TIME_ZONE));
// get info for non-exist volume
- args = new String[] {"-infoVolume", url + "/invalid-volume"};
+ args = new String[] {"volume", "info", url + "/invalid-volume"};
executeWithError(shell, args, "VOLUME_NOT_FOUND");
}
@@ -323,28 +323,28 @@ public class TestOzoneShell {
assertEquals(userName, vol.getOwner());
assertEquals(OzoneQuota.parseQuota("100TB").sizeInBytes(), vol.getQuota());
- String[] args = new String[] {"-updateVolume", url + "/" + volumeName,
- "-quota", "500MB"};
+ String[] args = new String[] {"volume", "update", url + "/" + volumeName,
+ "--quota", "500MB"};
execute(shell, args);
vol = client.getVolumeDetails(volumeName);
assertEquals(userName, vol.getOwner());
assertEquals(OzoneQuota.parseQuota("500MB").sizeInBytes(), vol.getQuota());
String newUser = "new-user";
- args = new String[] {"-updateVolume", url + "/" + volumeName,
- "-user", newUser};
+ args = new String[] {"volume", "update", url + "/" + volumeName,
+ "--user", newUser};
execute(shell, args);
vol = client.getVolumeDetails(volumeName);
assertEquals(newUser, vol.getOwner());
// test error conditions
- args = new String[] {"-updateVolume", url + "/invalid-volume",
- "-user", newUser};
+ args = new String[] {"volume", "update", url + "/invalid-volume",
+ "--user", newUser};
executeWithError(shell, args, "Info Volume failed, error:VOLUME_NOT_FOUND");
err.reset();
- args = new String[] {"-updateVolume", url + "/invalid-volume",
- "-quota", "500MB"};
+ args = new String[] {"volume", "update", url + "/invalid-volume",
+ "--quota", "500MB"};
executeWithError(shell, args, "Info Volume failed, error:VOLUME_NOT_FOUND");
}
@@ -411,14 +411,14 @@ public class TestOzoneShell {
assertNotNull(vol);
}
- String[] args = new String[] {"-listVolume", url + "/abcde", "-user",
- user1, "-length", "100"};
+ String[] args = new String[] {"volume", "list", url + "/abcde", "--user",
+ user1, "--length", "100"};
executeWithError(shell, args, "Invalid URI");
err.reset();
// test -length option
- args = new String[] {"-listVolume", url + "/", "-user",
- user1, "-length", "100"};
+ args = new String[] {"volume", "list", url + "/", "--user",
+ user1, "--length", "100"};
execute(shell, args);
commandOutput = out.toString();
volumes = (List<VolumeInfo>) JsonUtils
@@ -431,8 +431,8 @@ public class TestOzoneShell {
}
out.reset();
- args = new String[] {"-listVolume", url + "/", "-user",
- user1, "-length", "2"};
+ args = new String[] {"volume", "list", url + "/", "--user",
+ user1, "--length", "2"};
execute(shell, args);
commandOutput = out.toString();
volumes = (List<VolumeInfo>) JsonUtils
@@ -440,10 +440,11 @@ public class TestOzoneShell {
assertEquals(2, volumes.size());
- // test -prefix option
+ // test --prefix option
out.reset();
- args = new String[] {"-listVolume", url + "/", "-user", user1, "-length",
- "100", "-prefix", "test-vol-" + protocol + "1" };
+ args =
+ new String[] {"volume", "list", url + "/", "--user", user1, "--length",
+ "100", "--prefix", "test-vol-" + protocol + "1"};
execute(shell, args);
commandOutput = out.toString();
volumes = (List<VolumeInfo>) JsonUtils
@@ -459,8 +460,9 @@ public class TestOzoneShell {
// test -start option
out.reset();
- args = new String[] {"-listVolume", url + "/", "-user", user2, "-length",
- "100", "-start", "test-vol-" + protocol + "15" };
+ args =
+ new String[] {"volume", "list", url + "/", "--user", user2, "--length",
+ "100", "--start", "test-vol-" + protocol + "15"};
execute(shell, args);
commandOutput = out.toString();
volumes = (List<VolumeInfo>) JsonUtils
@@ -475,13 +477,13 @@ public class TestOzoneShell {
// test error conditions
err.reset();
- args = new String[] {"-listVolume", url + "/", "-user",
- user2, "-length", "-1"};
+ args = new String[] {"volume", "list", url + "/", "--user",
+ user2, "--length", "-1"};
executeWithError(shell, args, "the length should be a positive number");
err.reset();
- args = new String[] {"-listVolume", url + "/", "-user",
- user2, "-length", "invalid-length"};
+ args = new String[] {"volume", "list", url + "/", "--user",
+ user2, "--length", "invalid-length"};
executeWithError(shell, args, "For input string: \"invalid-length\"");
}
@@ -490,7 +492,7 @@ public class TestOzoneShell {
LOG.info("Running testCreateBucket");
OzoneVolume vol = creatVolume();
String bucketName = "bucket" + RandomStringUtils.randomNumeric(5);
- String[] args = new String[] {"-createBucket",
+ String[] args = new String[] {"bucket", "create",
url + "/" + vol.getName() + "/" + bucketName};
execute(shell, args);
@@ -500,7 +502,7 @@ public class TestOzoneShell {
assertEquals(bucketName, bucketInfo.getName());
// test create a bucket in a non-exist volume
- args = new String[] {"-createBucket",
+ args = new String[] {"bucket", "create",
url + "/invalid-volume/" + bucketName};
executeWithError(shell, args, "Info Volume failed, error:VOLUME_NOT_FOUND");
@@ -515,7 +517,7 @@ public class TestOzoneShell {
OzoneBucket bucketInfo = vol.getBucket(bucketName);
assertNotNull(bucketInfo);
- String[] args = new String[] {"-deleteBucket",
+ String[] args = new String[] {"bucket", "delete",
url + "/" + vol.getName() + "/" + bucketName};
execute(shell, args);
@@ -529,13 +531,13 @@ public class TestOzoneShell {
}
// test delete bucket in a non-exist volume
- args = new String[] {"-deleteBucket",
+ args = new String[] {"bucket", "delete",
url + "/invalid-volume" + "/" + bucketName};
executeWithError(shell, args, "Info Volume failed, error:VOLUME_NOT_FOUND");
err.reset();
// test delete non-exist bucket
- args = new String[] {"-deleteBucket",
+ args = new String[] {"bucket", "delete",
url + "/" + vol.getName() + "/invalid-bucket"};
executeWithError(shell, args,
"Delete Bucket failed, error:BUCKET_NOT_FOUND");
@@ -548,7 +550,7 @@ public class TestOzoneShell {
String bucketName = "bucket" + RandomStringUtils.randomNumeric(5);
vol.createBucket(bucketName);
- String[] args = new String[] {"-infoBucket",
+ String[] args = new String[] {"bucket", "info",
url + "/" + vol.getName() + "/" + bucketName};
execute(shell, args);
@@ -558,7 +560,7 @@ public class TestOzoneShell {
&& output.contains(OzoneConsts.OZONE_TIME_ZONE));
// test get info from a non-exist bucket
- args = new String[] {"-infoBucket",
+ args = new String[] {"bucket", "info",
url + "/" + vol.getName() + "/invalid-bucket" + bucketName};
executeWithError(shell, args,
"Info Bucket failed, error: BUCKET_NOT_FOUND");
@@ -573,8 +575,8 @@ public class TestOzoneShell {
OzoneBucket bucket = vol.getBucket(bucketName);
int aclSize = bucket.getAcls().size();
- String[] args = new String[] {"-updateBucket",
- url + "/" + vol.getName() + "/" + bucketName, "-addAcl",
+ String[] args = new String[] {"bucket", "update",
+ url + "/" + vol.getName() + "/" + bucketName, "--addAcl",
"user:frodo:rw,group:samwise:r"};
execute(shell, args);
String output = out.toString();
@@ -589,8 +591,8 @@ public class TestOzoneShell {
&& acl.getType() == OzoneACLType.USER
&& acl.getRights()== OzoneACLRights.READ_WRITE);
- args = new String[] {"-updateBucket",
- url + "/" + vol.getName() + "/" + bucketName, "-removeAcl",
+ args = new String[] {"bucket", "update",
+ url + "/" + vol.getName() + "/" + bucketName, "--removeAcl",
"user:frodo:rw"};
execute(shell, args);
@@ -602,8 +604,8 @@ public class TestOzoneShell {
&& acl.getRights()== OzoneACLRights.READ);
// test update bucket for a non-exist bucket
- args = new String[] {"-updateBucket",
- url + "/" + vol.getName() + "/invalid-bucket", "-addAcl",
+ args = new String[] {"bucket", "update",
+ url + "/" + vol.getName() + "/invalid-bucket", "--addAcl",
"user:frodo:rw"};
executeWithError(shell, args,
"Info Bucket failed, error: BUCKET_NOT_FOUND");
@@ -628,8 +630,8 @@ public class TestOzoneShell {
}
// test -length option
- String[] args = new String[] {"-listBucket",
- url + "/" + vol.getName(), "-length", "100"};
+ String[] args = new String[] {"bucket", "list",
+ url + "/" + vol.getName(), "--length", "100"};
execute(shell, args);
commandOutput = out.toString();
buckets = (List<BucketInfo>) JsonUtils.toJsonList(commandOutput,
@@ -648,8 +650,8 @@ public class TestOzoneShell {
}
out.reset();
- args = new String[] {"-listBucket", url + "/" + vol.getName(),
- "-length", "3"};
+ args = new String[] {"bucket", "list", url + "/" + vol.getName(),
+ "--length", "3"};
execute(shell, args);
commandOutput = out.toString();
buckets = (List<BucketInfo>) JsonUtils.toJsonList(commandOutput,
@@ -662,10 +664,10 @@ public class TestOzoneShell {
assertEquals(buckets.get(1).getBucketName(), "test-bucket1");
assertEquals(buckets.get(2).getBucketName(), "test-bucket10");
- // test -prefix option
+ // test --prefix option
out.reset();
- args = new String[] {"-listBucket", url + "/" + vol.getName(),
- "-length", "100", "-prefix", "test-bucket1"};
+ args = new String[] {"bucket", "list", url + "/" + vol.getName(),
+ "--length", "100", "--prefix", "test-bucket1"};
execute(shell, args);
commandOutput = out.toString();
buckets = (List<BucketInfo>) JsonUtils.toJsonList(commandOutput,
@@ -678,8 +680,8 @@ public class TestOzoneShell {
// test -start option
out.reset();
- args = new String[] {"-listBucket", url + "/" + vol.getName(),
- "-length", "100", "-start", "test-bucket7"};
+ args = new String[] {"bucket", "list", url + "/" + vol.getName(),
+ "--length", "100", "--start", "test-bucket7"};
execute(shell, args);
commandOutput = out.toString();
buckets = (List<BucketInfo>) JsonUtils.toJsonList(commandOutput,
@@ -691,8 +693,8 @@ public class TestOzoneShell {
// test error conditions
err.reset();
- args = new String[] {"-listBucket", url + "/" + vol.getName(),
- "-length", "-1"};
+ args = new String[] {"bucket", "list", url + "/" + vol.getName(),
+ "--length", "-1"};
executeWithError(shell, args, "the length should be a positive number");
}
@@ -704,8 +706,8 @@ public class TestOzoneShell {
String bucketName = bucket.getName();
String keyName = "key" + RandomStringUtils.randomNumeric(5);
- String[] args = new String[] {"-putKey",
- url + "/" + volumeName + "/" + bucketName + "/" + keyName, "-file",
+ String[] args = new String[] {"key", "put",
+ url + "/" + volumeName + "/" + bucketName + "/" + keyName,
createTmpFile()};
execute(shell, args);
@@ -713,8 +715,8 @@ public class TestOzoneShell {
assertEquals(keyName, keyInfo.getName());
// test put key in a non-exist bucket
- args = new String[] {"-putKey",
- url + "/" + volumeName + "/invalid-bucket/" + keyName, "-file",
+ args = new String[] {"key", "put",
+ url + "/" + volumeName + "/invalid-bucket/" + keyName,
createTmpFile()};
executeWithError(shell, args,
"Info Bucket failed, error: BUCKET_NOT_FOUND");
@@ -736,8 +738,8 @@ public class TestOzoneShell {
String tmpPath = baseDir.getAbsolutePath() + "/testfile-"
+ UUID.randomUUID().toString();
- String[] args = new String[] {"-getKey",
- url + "/" + volumeName + "/" + bucketName + "/" + keyName, "-file",
+ String[] args = new String[] {"key", "get",
+ url + "/" + volumeName + "/" + bucketName + "/" + keyName,
tmpPath};
execute(shell, args);
@@ -748,8 +750,8 @@ public class TestOzoneShell {
assertEquals(dataStr, DFSUtil.bytes2String(dataBytes));
tmpPath = baseDir.getAbsolutePath() + File.separatorChar + keyName;
- args = new String[] {"-getKey",
- url + "/" + volumeName + "/" + bucketName + "/" + keyName, "-file",
+ args = new String[] {"key", "get",
+ url + "/" + volumeName + "/" + bucketName + "/" + keyName,
baseDir.getAbsolutePath()};
execute(shell, args);
@@ -776,7 +778,7 @@ public class TestOzoneShell {
OzoneKey keyInfo = bucket.getKey(keyName);
assertEquals(keyName, keyInfo.getName());
- String[] args = new String[] {"-deleteKey",
+ String[] args = new String[] {"key", "delete",
url + "/" + volumeName + "/" + bucketName + "/" + keyName};
execute(shell, args);
@@ -790,14 +792,14 @@ public class TestOzoneShell {
}
// test delete key in a non-exist bucket
- args = new String[] {"-deleteKey",
+ args = new String[] {"key", "delete",
url + "/" + volumeName + "/invalid-bucket/" + keyName};
executeWithError(shell, args,
"Info Bucket failed, error: BUCKET_NOT_FOUND");
err.reset();
// test delete a non-exist key in bucket
- args = new String[] {"-deleteKey",
+ args = new String[] {"key", "delete",
url + "/" + volumeName + "/" + bucketName + "/invalid-key"};
executeWithError(shell, args, "Delete key failed, error:KEY_NOT_FOUND");
}
@@ -815,7 +817,7 @@ public class TestOzoneShell {
keyOutputStream.write(dataStr.getBytes());
keyOutputStream.close();
- String[] args = new String[] {"-infoKey",
+ String[] args = new String[] {"key", "info",
url + "/" + volumeName + "/" + bucketName + "/" + keyName};
// verify the response output
@@ -834,7 +836,7 @@ public class TestOzoneShell {
err.reset();
// get the info of a non-exist key
- args = new String[] {"-infoKey",
+ args = new String[] {"key", "info",
url + "/" + volumeName + "/" + bucketName + "/invalid-key"};
// verify the response output
@@ -855,7 +857,7 @@ public class TestOzoneShell {
bucket.createKey(dirKeyName, dataStr.length());
keyOutputStream.write(dataStr.getBytes());
keyOutputStream.close();
- String[] args = new String[] {"-infoKey",
+ String[] args = new String[] {"key", "info",
url + "/" + volumeName + "/" + bucketName + "/" + dirKeyName};
// verify the response output
execute(shell, args);
@@ -864,7 +866,7 @@ public class TestOzoneShell {
assertTrue(output.contains("createdOn") &&
output.contains("modifiedOn") &&
output.contains(OzoneConsts.OZONE_TIME_ZONE));
- args = new String[] {"-infoKey",
+ args = new String[] {"key", "info",
url + "/" + volumeName + "/" + bucketName + "/" + keyNameOnly};
executeWithError(shell, args, "Lookup key failed, error:KEY_NOT_FOUND");
out.reset();
@@ -894,8 +896,8 @@ public class TestOzoneShell {
}
// test -length option
- String[] args = new String[] {"-listKey",
- url + "/" + volumeName + "/" + bucketName, "-length", "100"};
+ String[] args = new String[] {"key", "list",
+ url + "/" + volumeName + "/" + bucketName, "--length", "100"};
execute(shell, args);
commandOutput = out.toString();
keys = (List<KeyInfo>) JsonUtils.toJsonList(commandOutput,
@@ -916,8 +918,9 @@ public class TestOzoneShell {
}
out.reset();
- args = new String[] {"-listKey", url + "/" + volumeName + "/" + bucketName,
- "-length", "3"};
+ args =
+ new String[] {"key", "list", url + "/" + volumeName + "/" + bucketName,
+ "--length", "3"};
execute(shell, args);
commandOutput = out.toString();
keys = (List<KeyInfo>) JsonUtils.toJsonList(commandOutput,
@@ -929,10 +932,11 @@ public class TestOzoneShell {
assertEquals(keys.get(1).getKeyName(), "test-key1");
assertEquals(keys.get(2).getKeyName(), "test-key10");
- // test -prefix option
+ // test --prefix option
out.reset();
- args = new String[] {"-listKey", url + "/" + volumeName + "/" + bucketName,
- "-length", "100", "-prefix", "test-key1"};
+ args =
+ new String[] {"key", "list", url + "/" + volumeName + "/" + bucketName,
+ "--length", "100", "--prefix", "test-key1"};
execute(shell, args);
commandOutput = out.toString();
keys = (List<KeyInfo>) JsonUtils.toJsonList(commandOutput,
@@ -945,8 +949,9 @@ public class TestOzoneShell {
// test -start option
out.reset();
- args = new String[] {"-listKey", url + "/" + volumeName + "/" + bucketName,
- "-length", "100", "-start", "test-key7"};
+ args =
+ new String[] {"key", "list", url + "/" + volumeName + "/" + bucketName,
+ "--length", "100", "--start", "test-key7"};
execute(shell, args);
commandOutput = out.toString();
keys = (List<KeyInfo>) JsonUtils.toJsonList(commandOutput,
@@ -957,8 +962,9 @@ public class TestOzoneShell {
// test error conditions
err.reset();
- args = new String[] {"-listKey", url + "/" + volumeName + "/" + bucketName,
- "-length", "-1"};
+ args =
+ new String[] {"key", "list", url + "/" + volumeName + "/" + bucketName,
+ "--length", "-1"};
executeWithError(shell, args, "the length should be a positive number");
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/Handler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/Handler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/Handler.java
index 45413f8..a9550c2 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/Handler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/Handler.java
@@ -18,25 +18,25 @@
package org.apache.hadoop.ozone.web.ozShell;
-import org.apache.commons.cli.CommandLine;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.concurrent.Callable;
+
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hdds.cli.GenericParentCommand;
import org.apache.hadoop.hdds.cli.HddsVersionProvider;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.ozone.client.OzoneClient;
-import org.apache.hadoop.ozone.client.OzoneClientFactory;
import org.apache.hadoop.ozone.client.OzoneClientException;
+import org.apache.hadoop.ozone.client.OzoneClientFactory;
import org.apache.hadoop.ozone.client.rest.OzoneException;
-import org.apache.http.client.utils.URIBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.concurrent.Callable;
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_HTTP_SCHEME;
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_SCHEME;
+import org.apache.http.client.utils.URIBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import picocli.CommandLine.Command;
import picocli.CommandLine.ParentCommand;
@@ -52,20 +52,7 @@ public abstract class Handler implements Callable<Void> {
protected OzoneClient client;
@ParentCommand
- private Shell parent;
-
- /**
- * Executes the Client command.
- *
- * @param cmd - CommandLine
- * @throws IOException
- * @throws OzoneException
- * @throws URISyntaxException
- */
- protected void execute(CommandLine cmd)
- throws IOException, OzoneException, URISyntaxException {
- throw new UnsupportedOperationException();
- }
+ private GenericParentCommand parent;
@Override
public Void call() throws Exception {
@@ -169,4 +156,5 @@ public abstract class Handler implements Callable<Void> {
public boolean isVerbose() {
return parent.isVerbose();
}
+
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/Shell.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/Shell.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/Shell.java
index 27cf732..5f206f0 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/Shell.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/Shell.java
@@ -20,21 +20,9 @@ package org.apache.hadoop.ozone.web.ozShell;
import org.apache.hadoop.hdds.cli.GenericCli;
import org.apache.hadoop.hdds.cli.HddsVersionProvider;
-import org.apache.hadoop.ozone.web.ozShell.bucket.CreateBucketHandler;
-import org.apache.hadoop.ozone.web.ozShell.bucket.DeleteBucketHandler;
-import org.apache.hadoop.ozone.web.ozShell.bucket.InfoBucketHandler;
-import org.apache.hadoop.ozone.web.ozShell.bucket.ListBucketHandler;
-import org.apache.hadoop.ozone.web.ozShell.bucket.UpdateBucketHandler;
-import org.apache.hadoop.ozone.web.ozShell.keys.DeleteKeyHandler;
-import org.apache.hadoop.ozone.web.ozShell.keys.GetKeyHandler;
-import org.apache.hadoop.ozone.web.ozShell.keys.InfoKeyHandler;
-import org.apache.hadoop.ozone.web.ozShell.keys.ListKeyHandler;
-import org.apache.hadoop.ozone.web.ozShell.keys.PutKeyHandler;
-import org.apache.hadoop.ozone.web.ozShell.volume.CreateVolumeHandler;
-import org.apache.hadoop.ozone.web.ozShell.volume.DeleteVolumeHandler;
-import org.apache.hadoop.ozone.web.ozShell.volume.InfoVolumeHandler;
-import org.apache.hadoop.ozone.web.ozShell.volume.ListVolumeHandler;
-import org.apache.hadoop.ozone.web.ozShell.volume.UpdateVolumeHandler;
+import org.apache.hadoop.ozone.web.ozShell.bucket.BucketCommands;
+import org.apache.hadoop.ozone.web.ozShell.keys.KeyCommands;
+import org.apache.hadoop.ozone.web.ozShell.volume.VolumeCommands;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,21 +37,9 @@ import picocli.CommandLine.Command;
@Command(name = "ozone oz",
description = "Client for the Ozone object store",
subcommands = {
- InfoVolumeHandler.class,
- ListVolumeHandler.class,
- CreateVolumeHandler.class,
- UpdateVolumeHandler.class,
- DeleteVolumeHandler.class,
- InfoBucketHandler.class,
- ListBucketHandler.class,
- CreateBucketHandler.class,
- UpdateBucketHandler.class,
- DeleteBucketHandler.class,
- InfoKeyHandler.class,
- ListKeyHandler.class,
- PutKeyHandler.class,
- GetKeyHandler.class,
- DeleteKeyHandler.class
+ VolumeCommands.class,
+ BucketCommands.class,
+ KeyCommands.class
},
versionProvider = HddsVersionProvider.class,
mixinStandardHelpOptions = true)
@@ -100,8 +76,5 @@ public class Shell extends GenericCli {
public static void main(String[] argv) throws Exception {
new Shell().run(argv);
}
-
-
-
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/BucketCommands.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/BucketCommands.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/BucketCommands.java
new file mode 100644
index 0000000..b2b8966
--- /dev/null
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/BucketCommands.java
@@ -0,0 +1,59 @@
+/*
+ * 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.hadoop.ozone.web.ozShell.bucket;
+
+import java.util.concurrent.Callable;
+
+import org.apache.hadoop.hdds.cli.GenericParentCommand;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.cli.MissingSubcommandException;
+import org.apache.hadoop.ozone.web.ozShell.Shell;
+
+import picocli.CommandLine.Command;
+import picocli.CommandLine.ParentCommand;
+
+/**
+ * Subcommands for the bucket related operations.
+ */
+@Command(name = "bucket",
+ description = "Bucket specific operations",
+ subcommands = {
+ InfoBucketHandler.class,
+ ListBucketHandler.class,
+ CreateBucketHandler.class,
+ UpdateBucketHandler.class,
+ DeleteBucketHandler.class
+ },
+ mixinStandardHelpOptions = true,
+ versionProvider = HddsVersionProvider.class)
+public class BucketCommands implements GenericParentCommand, Callable<Void> {
+
+ @ParentCommand
+ private Shell shell;
+
+ @Override
+ public Void call() throws Exception {
+ throw new MissingSubcommandException();
+ }
+
+ @Override
+ public boolean isVerbose() {
+ return shell.isVerbose();
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/CreateBucketHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/CreateBucketHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/CreateBucketHandler.java
index 5fe5c7b..bd8db60 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/CreateBucketHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/CreateBucketHandler.java
@@ -35,7 +35,7 @@ import picocli.CommandLine.Parameters;
/**
* create bucket handler.
*/
-@Command(name = "-createBucket",
+@Command(name = "create",
description = "creates a bucket in a given volume")
public class CreateBucketHandler extends Handler {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/DeleteBucketHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/DeleteBucketHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/DeleteBucketHandler.java
index 5a9b5c5..79a0c8e 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/DeleteBucketHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/DeleteBucketHandler.java
@@ -33,7 +33,7 @@ import picocli.CommandLine.Parameters;
/**
* Delete bucket Handler.
*/
-@Command(name = "-deleteBucket",
+@Command(name = "delete",
description = "deletes an empty bucket")
public class DeleteBucketHandler extends Handler {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/InfoBucketHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/InfoBucketHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/InfoBucketHandler.java
index aa1ce87..4122b72 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/InfoBucketHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/InfoBucketHandler.java
@@ -35,7 +35,7 @@ import picocli.CommandLine.Parameters;
/**
* Executes Info bucket.
*/
-@Command(name = "-infoBucket",
+@Command(name = "info",
description = "returns information about a bucket")
public class InfoBucketHandler extends Handler {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/ListBucketHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/ListBucketHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/ListBucketHandler.java
index 3d429cf..1d97bf5 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/ListBucketHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/ListBucketHandler.java
@@ -42,24 +42,25 @@ import picocli.CommandLine.Parameters;
/**
* Executes List Bucket.
*/
-@Command(name = "-listBucket",
+@Command(name = "list",
+ aliases = "ls",
description = "lists the buckets in a volume.")
public class ListBucketHandler extends Handler {
@Parameters(arity = "1..1", description = Shell.OZONE_VOLUME_URI_DESCRIPTION)
private String uri;
- @Option(names = {"--length", "-length", "-l"},
+ @Option(names = {"--length", "-l"},
description = "Limit of the max results",
defaultValue = "100",
showDefaultValue = Visibility.ALWAYS)
private int maxBuckets;
- @Option(names = {"--start", "-start", "-s"},
+ @Option(names = {"--start", "-s"},
description = "The first bucket to start the listing")
private String startBucket;
- @Option(names = {"--prefix", "-prefix", "-p"},
+ @Option(names = {"--prefix", "-p"},
description = "Prefix to filter the buckets")
private String prefix;
/**
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/UpdateBucketHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/UpdateBucketHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/UpdateBucketHandler.java
index 3728740..3562dc0 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/UpdateBucketHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/UpdateBucketHandler.java
@@ -40,19 +40,19 @@ import picocli.CommandLine.Parameters;
/**
* Allows users to add and remove acls and from a bucket.
*/
-@Command(name = "-updateBucket",
+@Command(name = "update",
description = "allows changing bucket attributes")
public class UpdateBucketHandler extends Handler {
@Parameters(arity = "1..1", description = Shell.OZONE_BUCKET_URI_DESCRIPTION)
private String uri;
- @Option(names = {"--addAcl", "-addAcl"},
+ @Option(names = {"--addAcl"},
description = "Comma separated list of acl rules to add (eg. " +
"user:bilbo:rw)")
private String addAcl;
- @Option(names = {"--removeAcl", "-removeAcl"},
+ @Option(names = {"--removeAcl"},
description = "Comma separated list of acl rules to remove (eg. "
+ "user:bilbo:rw)")
private String removeAcl;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/DeleteKeyHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/DeleteKeyHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/DeleteKeyHandler.java
index 8c9aab7..dff6e67 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/DeleteKeyHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/DeleteKeyHandler.java
@@ -34,7 +34,7 @@ import picocli.CommandLine.Parameters;
/**
* Executes Delete Key.
*/
-@Command(name = "-deleteKey",
+@Command(name = "delete",
description = "deletes an existing key")
public class DeleteKeyHandler extends Handler {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/GetKeyHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/GetKeyHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/GetKeyHandler.java
index 9843fd8..583d22b 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/GetKeyHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/GetKeyHandler.java
@@ -38,22 +38,21 @@ import org.apache.commons.codec.digest.DigestUtils;
import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_CHUNK_SIZE_DEFAULT;
import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_CHUNK_SIZE_KEY;
import picocli.CommandLine.Command;
-import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;
/**
* Gets an existing key.
*/
-@Command(name = "-getKey",
+@Command(name = "get",
description = "Gets a specific key from ozone server")
public class GetKeyHandler extends Handler {
- @Parameters(arity = "1..1", description = Shell.OZONE_KEY_URI_DESCRIPTION)
+ @Parameters(index = "0", arity = "1..1", description =
+ Shell.OZONE_KEY_URI_DESCRIPTION)
private String uri;
- @Option(names = {"-f", "--file", "-file"},
- description = "File path to download the key to",
- required = true)
+ @Parameters(index = "1", arity = "1..1",
+ description = "File path to download the key to")
private String fileName;
/**
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/InfoKeyHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/InfoKeyHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/InfoKeyHandler.java
index 18c7591..6ae9b6f 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/InfoKeyHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/InfoKeyHandler.java
@@ -38,7 +38,7 @@ import picocli.CommandLine.Parameters;
/**
* Executes Info Object.
*/
-@Command(name = "-infoKey",
+@Command(name = "info",
description = "returns information about an existing key")
public class InfoKeyHandler extends Handler {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/KeyCommands.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/KeyCommands.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/KeyCommands.java
new file mode 100644
index 0000000..e917597
--- /dev/null
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/KeyCommands.java
@@ -0,0 +1,59 @@
+/*
+ * 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.hadoop.ozone.web.ozShell.keys;
+
+import java.util.concurrent.Callable;
+
+import org.apache.hadoop.hdds.cli.GenericParentCommand;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.cli.MissingSubcommandException;
+import org.apache.hadoop.ozone.web.ozShell.Shell;
+
+import picocli.CommandLine.Command;
+import picocli.CommandLine.ParentCommand;
+
+/**
+ * Subcommand to group key related operations.
+ */
+@Command(name = "key",
+ description = "Key specific operations",
+ subcommands = {
+ InfoKeyHandler.class,
+ ListKeyHandler.class,
+ GetKeyHandler.class,
+ PutKeyHandler.class,
+ DeleteKeyHandler.class
+ },
+ mixinStandardHelpOptions = true,
+ versionProvider = HddsVersionProvider.class)
+public class KeyCommands implements GenericParentCommand, Callable<Void> {
+
+ @ParentCommand
+ private Shell shell;
+
+ @Override
+ public Void call() throws Exception {
+ throw new MissingSubcommandException();
+ }
+
+ @Override
+ public boolean isVerbose() {
+ return shell.isVerbose();
+ }
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/ListKeyHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/ListKeyHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/ListKeyHandler.java
index f69693d..0a710ac 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/ListKeyHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/ListKeyHandler.java
@@ -42,23 +42,24 @@ import picocli.CommandLine.Parameters;
/**
* Executes List Keys.
*/
-@Command(name = "-listKey",
+@Command(name = "list",
+ aliases = "ls",
description = "list all keys in a given bucket")
public class ListKeyHandler extends Handler {
@Parameters(arity = "1..1", description = Shell.OZONE_BUCKET_URI_DESCRIPTION)
private String uri;
- @Option(names = {"--length", "-length", "-l"},
+ @Option(names = {"--length", "-l"},
description = "Limit of the max results",
defaultValue = "100")
private int maxKeys;
- @Option(names = {"--start", "-start", "-s"},
+ @Option(names = {"--start", "-s"},
description = "The first key to start the listing")
private String startKey;
- @Option(names = {"--prefix", "-prefix", "-p"},
+ @Option(names = {"--prefix", "-p"},
description = "Prefix to filter the key")
private String prefix;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/PutKeyHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/PutKeyHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/PutKeyHandler.java
index bea68f2..bbd3235 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/PutKeyHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/PutKeyHandler.java
@@ -50,19 +50,18 @@ import picocli.CommandLine.Parameters;
/**
* Puts a file into an ozone bucket.
*/
-@Command(name = "-putKey",
+@Command(name = "put",
description = "creates or overwrites an existing key")
public class PutKeyHandler extends Handler {
- @Parameters(arity = "1..1", description = Shell.OZONE_KEY_URI_DESCRIPTION)
+ @Parameters(index = "0", arity = "1..1", description =
+ Shell.OZONE_KEY_URI_DESCRIPTION)
private String uri;
- @Option(names = {"-f", "--file", "-file"},
- description = "File to upload",
- required = true)
+ @Parameters(index = "1", arity = "1..1", description = "File to upload")
private String fileName;
- @Option(names = {"-r", "--replication", "-replicationFactor"},
+ @Option(names = {"-r", "--replication"},
description = "Replication factor of the new key. (use ONE or THREE) "
+ "Default is specified in the cluster-wide config.")
private ReplicationFactor replicationFactor;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/CreateVolumeHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/CreateVolumeHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/CreateVolumeHandler.java
index 25e207a..2697639 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/CreateVolumeHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/CreateVolumeHandler.java
@@ -18,41 +18,41 @@
package org.apache.hadoop.ozone.web.ozShell.volume;
-import picocli.CommandLine.Command;
-import picocli.CommandLine.Option;
-import picocli.CommandLine.Parameters;
+import java.net.URI;
+import org.apache.hadoop.ozone.client.OzoneClientException;
import org.apache.hadoop.ozone.client.OzoneClientUtils;
import org.apache.hadoop.ozone.client.OzoneVolume;
import org.apache.hadoop.ozone.client.VolumeArgs;
-import org.apache.hadoop.ozone.client.OzoneClientException;
import org.apache.hadoop.ozone.web.ozShell.Handler;
import org.apache.hadoop.ozone.web.ozShell.Shell;
import org.apache.hadoop.ozone.web.utils.JsonUtils;
-import java.net.URI;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Option;
+import picocli.CommandLine.Parameters;
/**
* Executes the create volume call for the shell.
*/
-@Command(name = "-createVolume",
+@Command(name = "create",
description = "Creates a volume for the specified user")
public class CreateVolumeHandler extends Handler {
@Parameters(arity = "1..1", description = Shell.OZONE_VOLUME_URI_DESCRIPTION)
private String uri;
- @Option(names = {"--user", "-user"},
+ @Option(names = {"--user", "-u"},
description = "Owner of of the volume", required =
true)
private String userName;
- @Option(names = {"--quota", "-quota"},
+ @Option(names = {"--quota", "-q"},
description =
"Quota of the newly created volume (eg. 1G)")
private String quota;
- @Option(names = {"--root", "-root"},
+ @Option(names = {"--root"},
description = "Development flag to execute the "
+ "command as the admin (hdfs) user.")
private boolean root;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/DeleteVolumeHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/DeleteVolumeHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/DeleteVolumeHandler.java
index e6444e7..d1e96fc 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/DeleteVolumeHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/DeleteVolumeHandler.java
@@ -30,7 +30,7 @@ import picocli.CommandLine.Parameters;
/**
* Executes deleteVolume call for the shell.
*/
-@Command(name = "-deleteVolume",
+@Command(name = "delete",
description = "deletes a volume if it is empty")
public class DeleteVolumeHandler extends Handler {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/InfoVolumeHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/InfoVolumeHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/InfoVolumeHandler.java
index 9ee3dce..60a8c6d 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/InfoVolumeHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/InfoVolumeHandler.java
@@ -33,7 +33,7 @@ import picocli.CommandLine.Parameters;
/**
* Executes volume Info calls.
*/
-@Command(name = "-infoVolume",
+@Command(name = "info",
description = "returns information about a specific volume")
public class InfoVolumeHandler extends Handler{
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/ListVolumeHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/ListVolumeHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/ListVolumeHandler.java
index 058ef2e..a54393c 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/ListVolumeHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/ListVolumeHandler.java
@@ -39,7 +39,8 @@ import java.util.List;
/**
* Executes List Volume call.
*/
-@Command(name = "-listVolume",
+@Command(name = "list",
+ aliases = "ls",
description = "List the volumes of a given user")
public class ListVolumeHandler extends Handler {
@@ -48,20 +49,20 @@ public class ListVolumeHandler extends Handler {
defaultValue = "/")
private String uri;
- @Option(names = {"--length", "-length", "-l"},
+ @Option(names = {"--length", "-l"},
description = "Limit of the max results",
defaultValue = "100")
private int maxVolumes;
- @Option(names = {"--start", "-start", "-s"},
+ @Option(names = {"--start", "-s"},
description = "The first volume to start the listing")
private String startVolume;
- @Option(names = {"--prefix", "-prefix", "-p"},
+ @Option(names = {"--prefix", "-p"},
description = "Prefix to filter the volumes")
private String prefix;
- @Option(names = {"--user", "-user", "-u"},
+ @Option(names = {"--user", "-u"},
description = "Owner of the volumes to list.")
private String userName;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/UpdateVolumeHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/UpdateVolumeHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/UpdateVolumeHandler.java
index aa692bd..0336fc2 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/UpdateVolumeHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/UpdateVolumeHandler.java
@@ -35,18 +35,18 @@ import java.net.URI;
/**
* Executes update volume calls.
*/
-@Command(name = "-updateVolume",
+@Command(name = "update",
description = "Updates parameter of the volumes")
public class UpdateVolumeHandler extends Handler {
@Parameters(arity = "1..1", description = Shell.OZONE_VOLUME_URI_DESCRIPTION)
private String uri;
- @Option(names = {"--user", "-user"},
+ @Option(names = {"--user"},
description = "Owner of the volume to set")
private String ownerName;
- @Option(names = {"--quota", "-quota"},
+ @Option(names = {"--quota"},
description = "Quota of the volume to set"
+ "(eg. 1G)")
private String quota;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a406f6f6/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/VolumeCommands.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/VolumeCommands.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/VolumeCommands.java
new file mode 100644
index 0000000..111eb78
--- /dev/null
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/VolumeCommands.java
@@ -0,0 +1,60 @@
+/*
+ * 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.hadoop.ozone.web.ozShell.volume;
+
+import java.util.concurrent.Callable;
+
+import org.apache.hadoop.hdds.cli.GenericParentCommand;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.cli.MissingSubcommandException;
+import org.apache.hadoop.ozone.web.ozShell.Shell;
+
+import picocli.CommandLine.Command;
+import picocli.CommandLine.ParentCommand;
+
+/**
+ * Subcommand to group volume related operations.
+ */
+@Command(name = "volume",
+ aliases = "vol",
+ description = "Volume specific operations",
+ subcommands = {
+ InfoVolumeHandler.class,
+ ListVolumeHandler.class,
+ CreateVolumeHandler.class,
+ UpdateVolumeHandler.class,
+ DeleteVolumeHandler.class
+ },
+ mixinStandardHelpOptions = true,
+ versionProvider = HddsVersionProvider.class)
+public class VolumeCommands implements GenericParentCommand, Callable<Void> {
+
+ @ParentCommand
+ private Shell shell;
+
+ @Override
+ public Void call() throws Exception {
+ throw new MissingSubcommandException();
+ }
+
+ @Override
+ public boolean isVerbose() {
+ return shell.isVerbose();
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org