@SubCommands({@SubCommand(name = "UpdateSegmentState", impl = UpdateSegmentState.class), @SubCommand(name = "AutoAddInvertedIndex", impl = AutoAddInvertedIndexTool.class), @SubCommand(name = "ValidateTableRetention", impl = ValidateTableRetention.class), @SubCommand(name = "PerfBenchmarkRunner", impl = PerfBenchmarkRunner.class), @SubCommand(name = "QueryRunner", impl = QueryRunner.class)}) Command _subCommand;
public void printUsage() { LOGGER.info("Usage: pinot-tools.sh <subCommand>"); LOGGER.info("Valid subCommands are:"); Class<PinotToolLauncher> obj = PinotToolLauncher.class; for (Field f : obj.getDeclaredFields()) { if (f.isAnnotationPresent(SubCommands.class)) { SubCommands subCommands = f.getAnnotation(SubCommands.class); for (SubCommand subCommand : subCommands.value()) { Class<?> subCommandClass = subCommand.impl(); Command command = null; try { command = (Command) subCommandClass.newInstance(); LOGGER.info("\t" + subCommand.name() + "\t<" + command.description() + ">"); } catch (Exception e) { LOGGER.info("Internal Error: Error instantiating class."); } } } } } }
@SubCommands({@SubCommand(name = "GenerateData", impl = GenerateDataCommand.class), @SubCommand(name = "CreateSegment", impl = CreateSegmentCommand.class), @SubCommand(name = "StartZookeeper", impl = StartZookeeperCommand.class), @SubCommand(name = "StartKafka", impl = StartKafkaCommand.class), @SubCommand(name = "StreamAvroIntoKafka", impl = StreamAvroIntoKafkaCommand.class), @SubCommand(name = "StartController", impl = StartControllerCommand.class), @SubCommand(name = "StartBroker", impl = StartBrokerCommand.class), @SubCommand(name = "StartServer", impl = StartServerCommand.class), @SubCommand(name = "AddTable", impl = AddTableCommand.class), @SubCommand(name = "ChangeTableState", impl = ChangeTableState.class), @SubCommand(name = "AddTenant", impl = AddTenantCommand.class), @SubCommand(name = "AddSchema", impl = AddSchemaCommand.class), @SubCommand(name = "UploadSegment", impl = UploadSegmentCommand.class), @SubCommand(name = "PostQuery", impl = PostQueryCommand.class), @SubCommand(name = "StopProcess", impl = StopProcessCommand.class), @SubCommand(name = "DeleteCluster", impl = DeleteClusterCommand.class), @SubCommand(name = "ShowClusterInfo", impl = ShowClusterInfoCommand.class), @SubCommand(name = "AvroSchemaToPinotSchema", impl = AvroSchemaToPinotSchema.class), @SubCommand(name = "RebalanceTable", impl = RebalanceTableCommand.class), @SubCommand(name = "ChangeNumReplicas", impl = ChangeNumReplicasCommand.class), @SubCommand(name = "ValidateConfig", impl = ValidateConfigCommand.class), @SubCommand(name = "VerifySegmentState", impl = VerifySegmentState.class), @SubCommand(name = "ConvertPinotSegment", impl = PinotSegmentConvertCommand.class), @SubCommand(name = "MoveReplicaGroup", impl = MoveReplicaGroup.class), @SubCommand(name = "BackfillSegmentColumn", impl = BackfillDateTimeColumnCommand.class), @SubCommand(name = "VerifyClusterState", impl = VerifyClusterStateCommand.class), @SubCommand(name = "ApplyTableConfig", impl = ApplyTableConfigCommand.class), @SubCommand(name = "RealtimeProvisioningHelper", impl = RealtimeProvisioningHelperCommand.class), @SubCommand(name = "MergeSegments", impl = SegmentMergeCommand.class)}) Command _subCommand;
public void printUsage() { LOGGER.info("Usage: pinot-admin.sh <subCommand>"); LOGGER.info("Valid subCommands are:"); Class<PinotAdministrator> obj = PinotAdministrator.class; for (Field f : obj.getDeclaredFields()) { if (f.isAnnotationPresent(SubCommands.class)) { SubCommands subCommands = f.getAnnotation(SubCommands.class); for (SubCommand subCommand : subCommands.value()) { Class<?> subCommandClass = subCommand.impl(); Command command = null; try { command = (Command) subCommandClass.newInstance(); LOGGER.info("\t" + subCommand.name() + "\t<" + command.description() + ">"); } catch (Exception e) { LOGGER.info("Internal Error: Error instantiating class."); } } } } LOGGER.info("For other crud operations, please refer to ${ControllerAddress}/help."); } }
@SubCommands({ @SubCommand(name = "encrypt", impl = EncryptCommand.class), @SubCommand(name = "decrypt", impl = DecryptCommand.class)
@Override public String getDefaultMetaVariable() { StringBuffer rv = new StringBuffer(); rv.append("["); for (SubCommand sc : commands.value()) { rv.append(sc.name()).append(" | "); } rv.delete(rv.length()-3, rv.length()); rv.append("]"); return rv.toString(); }
public class ShowCommand extends ShellCommand { @Argument(handler = SubCommandHandler.class) @SubCommands({ @SubCommand(name = "activity", impl = ShowActivityCommand.class) }) private ShellCommand command; @Override public void execute(HarmonyClient harmonyClient) { command.execute(harmonyClient); } }
@Override public String getDefaultMetaVariable() { StringBuffer rv = new StringBuffer(); rv.append("["); for (SubCommand sc : commands.value()) { rv.append(sc.name()).append(" | "); } rv.delete(rv.length()-3, rv.length()); rv.append("]"); return rv.toString(); }
@SubCommands({ @SubCommand(name = "createKeyRing", impl = CreateKeyRingCommand.class), @SubCommand(name = "createCryptoKey", impl = CreateCryptoKeyCommand.class),
@Override public int parseArguments(Parameters params) throws CmdLineException { String subCmd = params.getParameter(0); for (SubCommand c : commands.value()) { if (c.name().equals(subCmd)) { setter.addValue(subCommand(c,params)); return params.size(); // consume all the remaining tokens } } return fallback(subCmd); }
public class ListCommand extends ShellCommand { @Argument(handler = SubCommandHandler.class) @SubCommands({ @SubCommand(name = "devices", impl = ListDevicesCommand.class), @SubCommand(name = "activities", impl = ListActivitiesCommand.class)}) private ShellCommand command; @Override public void execute(HarmonyClient harmonyClient) { command.execute(harmonyClient); } }
@Override public int parseArguments(Parameters params) throws CmdLineException { String subCmd = params.getParameter(0); for (SubCommand c : commands.value()) { if (c.name().equals(subCmd)) { setter.addValue(subCommand(c,params)); return params.size(); // consume all the remaining tokens } } return fallback(subCmd); }
@SubCommands({ @SubCommand(name="train",impl=Train.class) })
@Override public String getDefaultMetaVariable() { StringBuffer rv = new StringBuffer(); rv.append("["); for (SubCommand sc : commands.value()) { rv.append(sc.name()).append(" | "); } rv.delete(rv.length()-3, rv.length()); rv.append("]"); return rv.toString(); }
public class Newts { @SubCommands({ @SubCommand(name="init", impl=Init.class), })
@SuppressWarnings("unchecked") public static Map<String, Command> all() { if (ALL == null) { try { ALL = new HashMap<String, Command>(); Field cmdField = Gaffer.class.getDeclaredField("cmd"); SubCommands subCommands = cmdField.getAnnotation(SubCommands.class); for (SubCommand sub : subCommands.value()) { if (Command.class.isAssignableFrom(sub.impl())) { Class<Command> clazz = (Class<Command>) sub.impl(); ALL.put(sub.name(), clazz.newInstance()); } } } catch (Exception e) { throw new RuntimeException(e); } } return ALL; }
public class Newts { @SubCommands({ @SubCommand(name="init", impl=Init.class), })
@Override public int parseArguments(Parameters params) throws CmdLineException { String subCmd = params.getParameter(0); for (SubCommand c : commands.value()) { if (c.name().equals(subCmd)) { setter.addValue(subCommand(c,params)); return params.size(); // consume all the remaining tokens } } return fallback(subCmd); }
metaVar = "action", handler = SubCommandHandler.class) @SubCommands({@SubCommand(name = "list", impl = ListCommand.class), @SubCommand(name = "show", impl = ShowCommand.class), @SubCommand(name = "delete", impl = DeleteCommand.class)})
metaVar = "ACTION", handler = SubCommandHandler.class) @SubCommands({@SubCommand(name = "list", impl = ListCommand.class), @SubCommand(name = "set", impl = SetCommand.class), @SubCommand(name = "get", impl = GetCommand.class)})