@Override public int parseArguments(Parameters params) throws CmdLineException { setter.addValue(getView(params.getParameter(0))); return 1; }
@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-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."); } } } } } }
@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 int parseArguments(Parameters parameters) throws CmdLineException { for (int i=0; i<parameters.size(); i++) setter.addValue(parameters.getParameter(i)); return parameters.size(); }
@Override public int parseArguments(Parameters params) throws CmdLineException { String full = params.getParameter(0); String[] delimitedStrs = full.split(delimiter); for (String delimitedStr : delimitedStrs) { setter.addValue(individualOptionHandler.parse(delimitedStr)); } // The number of Parameters consumed (not the number set) return 1; }
@Override public int parseArguments(Parameters params) throws CmdLineException { FieldSetter fs = setter.asFieldSetter(); Map v = (Map)fs.getValue(); if (v==null) { v = createNewCollection(fs.getType()); fs.addValue(v); } addToMap(params.getParameter(0),v); return 1; }
public static Setter create(CmdLineParser parser, AccessibleObject fieldOrMethod, Object bean) { if (fieldOrMethod instanceof Method) { return new MethodSetter(parser,bean,(Method) fieldOrMethod); } else { return create((Field)fieldOrMethod,bean); } }
@Override public int parseArguments(Parameters params) throws CmdLineException { String nodeName = params.getParameter(0); final Node node = Jenkins.get().getNode(nodeName); if (node == null) throw new IllegalArgumentException("No such node '" + nodeName + "'"); setter.addValue(node); return 1; }
@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 int parseArguments(Parameters parameters) throws CmdLineException { for (int i=0; i<parameters.size(); i++) setter.addValue(parameters.getParameter(i)); return parameters.size(); }
@Override public int parseArguments(Parameters params) throws CmdLineException { String token = params.getParameter(0); try { T value = parse(token); setter.addValue(value); } catch (NumberFormatException ex) { throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, params.getParameter(-1), token); } return 1; }
@Override public int parseArguments(Parameters params) throws CmdLineException { FieldSetter fs = setter.asFieldSetter(); Map v = (Map)fs.getValue(); if (v==null) { v = createNewCollection(fs.getType()); fs.addValue(v); } addToMap(params.getParameter(0),v); return 1; }
@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-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."); } }
public static Setter create(CmdLineParser parser, AccessibleObject fieldOrMethod, Object bean) { if (fieldOrMethod instanceof Method) { return new MethodSetter(parser,bean,(Method) fieldOrMethod); } else { return create((Field)fieldOrMethod,bean); } }
@Override public int parseArguments(Parameters params) throws CmdLineException { String param = params.getParameter(0); Result v = fromString(param.replace('-', '_')); if (v==null) throw new CmdLineException(owner,"No such status '"+param+"'. Did you mean "+ EditDistance.findNearest(param.replace('-', '_').toUpperCase(), getNames())); setter.addValue(v); return 1; }
@Override public int parseArguments(Parameters params) throws CmdLineException { final Jenkins j = Jenkins.get(); final String src = params.getParameter(0); T s = j.getItemByFullName(src, type()); if (s == null) { final Authentication who = Jenkins.getAuthentication(); try (ACLContext acl = ACL.as(ACL.SYSTEM)) { Item actual = j.getItemByFullName(src); if (actual == null) { LOGGER.log(Level.FINE, "really no item exists named {0}", src); } else { LOGGER.log(Level.WARNING, "running as {0} could not find {1} of {2}", new Object[] {who.getPrincipal(), actual, type()}); } } T nearest = Items.findNearest(type(), src, j); if (nearest != null) { throw new IllegalArgumentException("No such job '" + src + "'; perhaps you meant '" + nearest.getFullName() + "'?"); } else { throw new IllegalArgumentException("No such job '" + src + "'"); } } setter.addValue(s); return 1; }
@Override public int parseArguments(Parameters params) throws CmdLineException { setter.addValue(params.getParameter(0)); return 1; }
@Override public int parseArguments(Parameters params) throws CmdLineException { setter.addValue(params.getParameter(0)); return 1; }