Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-11822. Register subcommands in OzoneShell #7513

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -55,9 +52,7 @@
},
mixinStandardHelpOptions = true,
versionProvider = HddsVersionProvider.class)
@MetaInfServices(SubcommandWithParent.class)
public class BucketCommands implements GenericParentCommand, Callable<Void>,
SubcommandWithParent {
public class BucketCommands implements GenericParentCommand, Callable<Void> {

@ParentCommand
private Shell shell;
Expand All @@ -77,9 +72,4 @@ public boolean isVerbose() {
public OzoneConfiguration createOzoneConfiguration() {
return shell.createOzoneConfiguration();
}

@Override
public Class<?> getParentType() {
return OzoneShell.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -55,9 +52,8 @@
},
mixinStandardHelpOptions = true,
versionProvider = HddsVersionProvider.class)
@MetaInfServices(SubcommandWithParent.class)
public class KeyCommands
implements GenericParentCommand, Callable<Void>, SubcommandWithParent {
implements GenericParentCommand, Callable<Void> {

@ParentCommand
private Shell shell;
Expand All @@ -77,9 +73,4 @@ public boolean isVerbose() {
public OzoneConfiguration createOzoneConfiguration() {
return shell.createOzoneConfiguration();
}

@Override
public Class<?> getParentType() {
return OzoneShell.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -45,9 +42,7 @@
},
mixinStandardHelpOptions = true,
versionProvider = HddsVersionProvider.class)
@MetaInfServices(SubcommandWithParent.class)
public class PrefixCommands implements GenericParentCommand, Callable<Void>,
SubcommandWithParent {
public class PrefixCommands implements GenericParentCommand, Callable<Void> {

@ParentCommand
private Shell shell;
Expand All @@ -67,9 +62,4 @@ public boolean isVerbose() {
public OzoneConfiguration createOzoneConfiguration() {
return shell.createOzoneConfiguration();
}

@Override
public Class<?> getParentType() {
return OzoneShell.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -48,9 +45,7 @@
},
mixinStandardHelpOptions = true,
versionProvider = HddsVersionProvider.class)
@MetaInfServices(SubcommandWithParent.class)
public class SnapshotCommands implements GenericParentCommand, Callable<Void>,
SubcommandWithParent {
public class SnapshotCommands implements GenericParentCommand, Callable<Void> {

@ParentCommand
private Shell shell;
Expand All @@ -70,9 +65,4 @@ public boolean isVerbose() {
public OzoneConfiguration createOzoneConfiguration() {
return shell.createOzoneConfiguration();
}

@Override
public Class<?> getParentType() {
return OzoneShell.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -46,9 +43,8 @@
},
mixinStandardHelpOptions = true,
versionProvider = HddsVersionProvider.class)
@MetaInfServices(SubcommandWithParent.class)
public class TenantUserCommands implements
GenericParentCommand, Callable<Void>, SubcommandWithParent {
GenericParentCommand, Callable<Void> {

@CommandLine.ParentCommand
private Shell shell;
Expand All @@ -68,9 +64,4 @@ public boolean isVerbose() {
public OzoneConfiguration createOzoneConfiguration() {
return shell.createOzoneConfiguration();
}

@Override
public Class<?> getParentType() {
return OzoneShell.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -45,9 +42,8 @@
},
mixinStandardHelpOptions = true,
versionProvider = HddsVersionProvider.class)
@MetaInfServices(SubcommandWithParent.class)
public class TokenCommands
implements GenericParentCommand, Callable<Void>, SubcommandWithParent {
implements GenericParentCommand, Callable<Void> {

@ParentCommand
private Shell shell;
Expand All @@ -67,9 +63,4 @@ public boolean isVerbose() {
public OzoneConfiguration createOzoneConfiguration() {
return shell.createOzoneConfiguration();
}

@Override
public Class<?> getParentType() {
return OzoneShell.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -53,9 +50,7 @@
},
mixinStandardHelpOptions = true,
versionProvider = HddsVersionProvider.class)
@MetaInfServices(SubcommandWithParent.class)
public class VolumeCommands implements GenericParentCommand, Callable<Void>,
SubcommandWithParent {
public class VolumeCommands implements GenericParentCommand, Callable<Void> {

@ParentCommand
private Shell shell;
Expand All @@ -75,9 +70,4 @@ public boolean isVerbose() {
public OzoneConfiguration createOzoneConfiguration() {
return shell.createOzoneConfiguration();
}

@Override
public Class<?> getParentType() {
return OzoneShell.class;
}
}