Skip to content

Commit

Permalink
HDDS-11830. Subcommands should not extend GenericCli .(apache#7537)
Browse files Browse the repository at this point in the history
  • Loading branch information
adoroszlai authored Dec 7, 2024
1 parent 959a39d commit 51c6ed6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.hadoop.ozone.admin.nssummary;

import org.apache.hadoop.fs.ozone.OzoneClientUtils;
import org.apache.hadoop.hdds.cli.GenericCli;
import org.apache.hadoop.hdds.cli.HddsVersionProvider;
import org.apache.hadoop.hdds.cli.OzoneAdmin;
import org.apache.hadoop.hdds.cli.AdminSubcommand;
Expand Down Expand Up @@ -63,23 +62,14 @@
FileSizeDistSubCommand.class
})
@MetaInfServices(AdminSubcommand.class)
public class NSSummaryAdmin extends GenericCli implements AdminSubcommand {
public class NSSummaryAdmin implements AdminSubcommand {
@CommandLine.ParentCommand
private OzoneAdmin parent;

@CommandLine.Spec
private CommandLine.Model.CommandSpec spec;

public OzoneAdmin getParent() {
return parent;
}

@Override
public Void call() throws Exception {
GenericCli.missingSubcommand(spec);
return null;
}

private boolean isObjectStoreBucket(OzoneBucket bucket, ObjectStore objectStore) {
boolean enableFileSystemPaths = getOzoneConfig()
.getBoolean(OMConfigKeys.OZONE_OM_ENABLE_FILESYSTEM_PATHS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
package org.apache.hadoop.ozone.admin.om;

import org.apache.hadoop.hdds.cli.GenericCli;
import org.apache.hadoop.hdds.cli.HddsVersionProvider;
import org.apache.hadoop.hdds.cli.OzoneAdmin;
import org.apache.hadoop.hdds.cli.AdminSubcommand;
Expand All @@ -38,8 +37,6 @@
import org.apache.ratis.protocol.ClientId;
import org.kohsuke.MetaInfServices;
import picocli.CommandLine;
import picocli.CommandLine.Model.CommandSpec;
import picocli.CommandLine.Spec;

import java.util.Collection;

Expand All @@ -64,24 +61,15 @@
FetchKeySubCommand.class
})
@MetaInfServices(AdminSubcommand.class)
public class OMAdmin extends GenericCli implements AdminSubcommand {
public class OMAdmin implements AdminSubcommand {

@CommandLine.ParentCommand
private OzoneAdmin parent;

@Spec
private CommandSpec spec;

public OzoneAdmin getParent() {
return parent;
}

@Override
public Void call() throws Exception {
GenericCli.missingSubcommand(spec);
return null;
}

public ClientProtocol createClient(String omServiceId) throws Exception {
OzoneConfiguration conf = parent.getOzoneConf();
if (OmUtils.isOmHAServiceId(conf, omServiceId)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@
*/
package org.apache.hadoop.ozone.admin.scm;

import org.apache.hadoop.hdds.cli.GenericCli;
import org.apache.hadoop.hdds.cli.HddsVersionProvider;
import org.apache.hadoop.hdds.cli.OzoneAdmin;
import org.apache.hadoop.hdds.cli.AdminSubcommand;
import org.kohsuke.MetaInfServices;
import picocli.CommandLine;
import picocli.CommandLine.Model.CommandSpec;
import picocli.CommandLine.Spec;

/**
* Subcommand for admin operations related to SCM.
Expand All @@ -44,21 +41,12 @@
RotateKeySubCommand.class
})
@MetaInfServices(AdminSubcommand.class)
public class ScmAdmin extends GenericCli implements AdminSubcommand {
public class ScmAdmin implements AdminSubcommand {

@CommandLine.ParentCommand
private OzoneAdmin parent;

@Spec
private CommandSpec spec;

public OzoneAdmin getParent() {
return parent;
}

@Override
public Void call() throws Exception {
GenericCli.missingSubcommand(spec);
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
package org.apache.hadoop.ozone.debug.segmentparser;

import org.apache.hadoop.hdds.cli.GenericCli;
import org.apache.hadoop.hdds.cli.HddsVersionProvider;
import org.apache.hadoop.hdds.cli.DebugSubcommand;

Expand All @@ -39,9 +38,5 @@
versionProvider = HddsVersionProvider.class,
mixinStandardHelpOptions = true)
@MetaInfServices(DebugSubcommand.class)
public class RatisLogParser extends GenericCli implements DebugSubcommand {

public static void main(String[] args) {
new RatisLogParser().run(args);
}
public class RatisLogParser implements DebugSubcommand {
}

0 comments on commit 51c6ed6

Please sign in to comment.