diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneShell.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneShell.java index 04b2c706f7e..925e3bc13ec 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneShell.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneShell.java @@ -19,6 +19,13 @@ import org.apache.hadoop.hdds.cli.HddsVersionProvider; import org.apache.hadoop.hdds.tracing.TracingUtil; +import org.apache.hadoop.ozone.shell.bucket.BucketCommands; +import org.apache.hadoop.ozone.shell.keys.KeyCommands; +import org.apache.hadoop.ozone.shell.prefix.PrefixCommands; +import org.apache.hadoop.ozone.shell.snapshot.SnapshotCommands; +import org.apache.hadoop.ozone.shell.tenant.TenantUserCommands; +import org.apache.hadoop.ozone.shell.token.TokenCommands; +import org.apache.hadoop.ozone.shell.volume.VolumeCommands; import picocli.CommandLine.Command; @@ -27,14 +34,19 @@ */ @Command(name = "ozone sh", description = "Shell for Ozone object store", + subcommands = { + BucketCommands.class, + KeyCommands.class, + PrefixCommands.class, + SnapshotCommands.class, + TenantUserCommands.class, + TokenCommands.class, + VolumeCommands.class, + }, versionProvider = HddsVersionProvider.class, mixinStandardHelpOptions = true) public class OzoneShell extends Shell { - public OzoneShell() { - super(OzoneShell.class); - } - /** * Main for the ozShell Command handling. * diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/BucketCommands.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/BucketCommands.java index 80e26e04451..8a92de696a7 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/BucketCommands.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/BucketCommands.java @@ -23,12 +23,9 @@ 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.hdds.cli.SubcommandWithParent; import org.apache.hadoop.hdds.conf.OzoneConfiguration; -import org.apache.hadoop.ozone.shell.OzoneShell; import org.apache.hadoop.ozone.shell.Shell; -import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.ParentCommand; @@ -55,9 +52,7 @@ }, mixinStandardHelpOptions = true, versionProvider = HddsVersionProvider.class) -@MetaInfServices(SubcommandWithParent.class) -public class BucketCommands implements GenericParentCommand, Callable, - SubcommandWithParent { +public class BucketCommands implements GenericParentCommand, Callable { @ParentCommand private Shell shell; @@ -77,9 +72,4 @@ public boolean isVerbose() { public OzoneConfiguration createOzoneConfiguration() { return shell.createOzoneConfiguration(); } - - @Override - public Class getParentType() { - return OzoneShell.class; - } } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/KeyCommands.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/KeyCommands.java index bbef5841439..f4ac9e1fe8f 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/KeyCommands.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/KeyCommands.java @@ -23,12 +23,9 @@ 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.hdds.cli.SubcommandWithParent; import org.apache.hadoop.hdds.conf.OzoneConfiguration; -import org.apache.hadoop.ozone.shell.OzoneShell; import org.apache.hadoop.ozone.shell.Shell; -import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.ParentCommand; @@ -55,9 +52,8 @@ }, mixinStandardHelpOptions = true, versionProvider = HddsVersionProvider.class) -@MetaInfServices(SubcommandWithParent.class) public class KeyCommands - implements GenericParentCommand, Callable, SubcommandWithParent { + implements GenericParentCommand, Callable { @ParentCommand private Shell shell; @@ -77,9 +73,4 @@ public boolean isVerbose() { public OzoneConfiguration createOzoneConfiguration() { return shell.createOzoneConfiguration(); } - - @Override - public Class getParentType() { - return OzoneShell.class; - } } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixCommands.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixCommands.java index e2d703bbf21..f058c4214d2 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixCommands.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixCommands.java @@ -23,12 +23,9 @@ 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.hdds.cli.SubcommandWithParent; import org.apache.hadoop.hdds.conf.OzoneConfiguration; -import org.apache.hadoop.ozone.shell.OzoneShell; import org.apache.hadoop.ozone.shell.Shell; -import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.ParentCommand; @@ -45,9 +42,7 @@ }, mixinStandardHelpOptions = true, versionProvider = HddsVersionProvider.class) -@MetaInfServices(SubcommandWithParent.class) -public class PrefixCommands implements GenericParentCommand, Callable, - SubcommandWithParent { +public class PrefixCommands implements GenericParentCommand, Callable { @ParentCommand private Shell shell; @@ -67,9 +62,4 @@ public boolean isVerbose() { public OzoneConfiguration createOzoneConfiguration() { return shell.createOzoneConfiguration(); } - - @Override - public Class getParentType() { - return OzoneShell.class; - } } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/snapshot/SnapshotCommands.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/snapshot/SnapshotCommands.java index 25a3c1c66fe..e4ae7f5ad7a 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/snapshot/SnapshotCommands.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/snapshot/SnapshotCommands.java @@ -23,12 +23,9 @@ 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.hdds.cli.SubcommandWithParent; import org.apache.hadoop.hdds.conf.OzoneConfiguration; -import org.apache.hadoop.ozone.shell.OzoneShell; import org.apache.hadoop.ozone.shell.Shell; -import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.ParentCommand; @@ -48,9 +45,7 @@ }, mixinStandardHelpOptions = true, versionProvider = HddsVersionProvider.class) -@MetaInfServices(SubcommandWithParent.class) -public class SnapshotCommands implements GenericParentCommand, Callable, - SubcommandWithParent { +public class SnapshotCommands implements GenericParentCommand, Callable { @ParentCommand private Shell shell; @@ -70,9 +65,4 @@ public boolean isVerbose() { public OzoneConfiguration createOzoneConfiguration() { return shell.createOzoneConfiguration(); } - - @Override - public Class getParentType() { - return OzoneShell.class; - } } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/tenant/TenantUserCommands.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/tenant/TenantUserCommands.java index 86a051fb76e..baff85d0bf2 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/tenant/TenantUserCommands.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/tenant/TenantUserCommands.java @@ -20,11 +20,8 @@ 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.hdds.cli.SubcommandWithParent; import org.apache.hadoop.hdds.conf.OzoneConfiguration; -import org.apache.hadoop.ozone.shell.OzoneShell; import org.apache.hadoop.ozone.shell.Shell; -import org.kohsuke.MetaInfServices; import picocli.CommandLine; import java.util.concurrent.Callable; @@ -46,9 +43,8 @@ }, mixinStandardHelpOptions = true, versionProvider = HddsVersionProvider.class) -@MetaInfServices(SubcommandWithParent.class) public class TenantUserCommands implements - GenericParentCommand, Callable, SubcommandWithParent { + GenericParentCommand, Callable { @CommandLine.ParentCommand private Shell shell; @@ -68,9 +64,4 @@ public boolean isVerbose() { public OzoneConfiguration createOzoneConfiguration() { return shell.createOzoneConfiguration(); } - - @Override - public Class getParentType() { - return OzoneShell.class; - } } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/TokenCommands.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/TokenCommands.java index 5b449c6cc54..3223b5b49ed 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/TokenCommands.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/TokenCommands.java @@ -23,12 +23,9 @@ 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.hdds.cli.SubcommandWithParent; import org.apache.hadoop.hdds.conf.OzoneConfiguration; -import org.apache.hadoop.ozone.shell.OzoneShell; import org.apache.hadoop.ozone.shell.Shell; -import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.ParentCommand; @@ -45,9 +42,8 @@ }, mixinStandardHelpOptions = true, versionProvider = HddsVersionProvider.class) -@MetaInfServices(SubcommandWithParent.class) public class TokenCommands - implements GenericParentCommand, Callable, SubcommandWithParent { + implements GenericParentCommand, Callable { @ParentCommand private Shell shell; @@ -67,9 +63,4 @@ public boolean isVerbose() { public OzoneConfiguration createOzoneConfiguration() { return shell.createOzoneConfiguration(); } - - @Override - public Class getParentType() { - return OzoneShell.class; - } } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/VolumeCommands.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/VolumeCommands.java index 8c52f0ada95..1cf88552030 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/VolumeCommands.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/VolumeCommands.java @@ -23,12 +23,9 @@ 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.hdds.cli.SubcommandWithParent; import org.apache.hadoop.hdds.conf.OzoneConfiguration; -import org.apache.hadoop.ozone.shell.OzoneShell; import org.apache.hadoop.ozone.shell.Shell; -import org.kohsuke.MetaInfServices; import picocli.CommandLine.Command; import picocli.CommandLine.ParentCommand; @@ -53,9 +50,7 @@ }, mixinStandardHelpOptions = true, versionProvider = HddsVersionProvider.class) -@MetaInfServices(SubcommandWithParent.class) -public class VolumeCommands implements GenericParentCommand, Callable, - SubcommandWithParent { +public class VolumeCommands implements GenericParentCommand, Callable { @ParentCommand private Shell shell; @@ -75,9 +70,4 @@ public boolean isVerbose() { public OzoneConfiguration createOzoneConfiguration() { return shell.createOzoneConfiguration(); } - - @Override - public Class getParentType() { - return OzoneShell.class; - } }