if (Boolean.TRUE.equals(parser.getOptionValue(help))) { usage(System.out); System.exit(0); String filenameValue = (String) parser.getOptionValue(filename); if (filenameValue == null) { usage(System.err, "Torrent file must be provided!"); Integer pieceLengthVal = (Integer) parser.getOptionValue(pieceLength); if (pieceLengthVal == null) { pieceLengthVal = TorrentCreator.DEFAULT_PIECE_LENGTH; Boolean createFlag = (Boolean) parser.getOptionValue(create);
if (Boolean.TRUE.equals((Boolean) parser.getOptionValue(help))) { usage(System.out); System.exit(0); String outputValue = (String) parser.getOptionValue(output, DEFAULT_OUTPUT_DIRECTORY); String ifaceValue = (String) parser.getOptionValue(iface); int seedTimeValue = (Integer) parser.getOptionValue(seedTime, -1);
if (Boolean.TRUE.equals((Boolean)parser.getOptionValue(help))) { usage(System.out); System.exit(0); Integer portValue = (Integer)parser.getOptionValue(port, Integer.valueOf(Tracker.DEFAULT_TRACKER_PORT));
/** * Equivalent to {@link #getOptionValue(Option, Object) getOptionValue(o, * null)}. */ public final Object getOptionValue( Option o ) { return getOptionValue(o, null); }
/** * Equivalent to {@link #getOptionValue(Option, Object) getOptionValue(o, * null)}. */ public final Object getOptionValue( Option o ) { return getOptionValue(o, null); }
/** * Equivalent to {@link #getOptionValue(Option, Object) getOptionValue(o, * null)}. */ public final Object getOptionValue( Option o ) { return getOptionValue(o, null); }
/** * Equivalent to {@link #getOptionValue(Option, Object) getOptionValue(o, * null)}. */ public final Object getOptionValue( Option o ) { return getOptionValue(o, null); }
/** * Equivalent to {@link #getOptionValue(Option, Object) getOptionValue(o, null)}. * * @param o * the o * @return the option value */ public final Object getOptionValue(Option o) { return getOptionValue(o, null); }
/** * Returns the option <b>value </b> of a parsed command line option. */ protected final Object getParsedCmdLineOption(String key) throws IllegalArgumentException { Object ret = this.cmdLineOptions.get(key); if (key == null) { throw new IllegalArgumentException("Option with key: \"" + String.valueOf(key) + "\" has not been set in constructor."); } return this.cmdLineParser.getOptionValue((CmdLineParser.Option)ret); }
/** * @return A Vector giving the parsed values of all the occurrences of the * given Option, or an empty Vector if the option was not set. */ public final Vector getOptionValues( Option option ) { Vector result = new Vector(); while (true) { Object o = getOptionValue(option, null); if (o == null) { return result; } else { result.addElement(o); } } }
/** * @return A Vector giving the parsed values of all the occurrences of the * given Option, or an empty Vector if the option was not set. */ public final Vector<String> getOptionValues( Option option ) { Vector<String> result = new Vector<String>(); while (true) { Object o = getOptionValue(option, null); if (o == null) { return result; } else { result.addElement((String)o); } } }
/** * @return A Vector giving the parsed values of all the occurrences of the * given Option, or an empty Vector if the option was not set. */ public final Vector getOptionValues( Option option ) { Vector result = new Vector(); while (true) { Object o = getOptionValue(option, null); if (o == null) { return result; } else { result.addElement(o); } } }
/** * @return A Vector giving the parsed values of all the occurrences of the * given Option, or an empty Vector if the option was not set. */ public final Vector getOptionValues( Option option ) { Vector result = new Vector(); while (true) { Object o = getOptionValue(option, null); if (o == null) { return result; } else { result.addElement(o); } } }
/** * Gets the option values. * * @param option * the option * @return A Vector giving the parsed values of all the occurrences of the given Option, or an empty Vector if the * option was not set. */ public final List<String> getOptionValues(Option option) { List<String> result = new ArrayList<>(); while (true) { Object o = getOptionValue(option, null); if (o == null) { return result; } else { result.add((String) o); } } }
/** * Runs this application. Help message prints if no arguments are given or if the "help" argument is given. * * @param args command line arguments * * @throws Exception thrown if there is a problem during program execution */ public static void main(String[] args) throws Exception { CmdLineParser parser = parseCommandArguments(args); ApplicationContext appCtx = loadConfigurations( (String) parser.getOptionValue(CLIParserBuilder.CONFIG_DIR_ARG), (String) parser.getOptionValue(CLIParserBuilder.SPRING_EXTS_ARG) ); saml1AA = (SAML1AttributeAuthority) appCtx.getBean("shibboleth.SAML1AttributeAuthority"); saml2AA = (SAML2AttributeAuthority) appCtx.getBean("shibboleth.SAML2AttributeAuthority"); SAMLObject attributeStatement; Boolean saml1 = (Boolean) parser.getOptionValue(CLIParserBuilder.SAML1_ARG, Boolean.FALSE); if (saml1.booleanValue()) { protocol = SAMLConstants.SAML11P_NS; attributeStatement = performSAML1AttributeResolution(parser, appCtx); } else { protocol = SAMLConstants.SAML20P_NS; attributeStatement = performSAML2AttributeResolution(parser, appCtx); } printAttributeStatement(attributeStatement); }
myOptions.getOptionValue(allOptions[j]));
public static void main( String[] args ) { CmdLineParser parser = new CmdLineParser(); CmdLineParser.Option date = parser.addOption(new ShortDateOption('d', "date")); try { parser.parse(args); } catch ( CmdLineParser.OptionException e ) { System.err.println(e.getMessage()); printUsage(); System.exit(2); } // Extract the values entered for the various options -- if the // options were not specified, the corresponding values will be // null. Date dateValue = (Date)parser.getOptionValue(date); // For testing purposes, we just print out the option values System.out.println("date: " + dateValue); // Extract the trailing command-line arguments ('a_number') in the // usage string above. String[] otherArgs = parser.getRemainingArgs(); System.out.println("remaining args: "); for ( int i = 0; i < otherArgs.length; ++i ) { System.out.println(otherArgs[i]); } // In a real program, one would pass the option values and other // arguments to a function that does something more useful. System.exit(0); }
if ( Boolean.TRUE.equals(parser.getOptionValue(help))) { parser.printUsage(); System.exit(0); Boolean verboseValue = (Boolean)parser.getOptionValue(verbose); Integer sizeValue = (Integer)parser.getOptionValue(size); String nameValue = (String)parser.getOptionValue(name); Double fractionValue = (Double)parser.getOptionValue(fraction);
/** * Parses the command line arguments * * @param args command line arguments * * @return parsed command line arguments * * @throws Exception thrown if the underlying libraries could not be initialized */ private static CmdLineParser parseCommandArguments(String[] args) throws Exception { if (args.length < 2) { printHelp(System.out); System.out.flush(); System.exit(0); } CmdLineParser parser = CLIParserBuilder.buildParser(); try { parser.parse(args); } catch (CmdLineParser.OptionException e) { errorAndExit(e.getMessage(), e); } Boolean helpEnabled = (Boolean) parser.getOptionValue(CLIParserBuilder.HELP_ARG); if (helpEnabled != null) { printHelp(System.out); System.out.flush(); System.exit(0); } return parser; }
String requester = (String) parser.getOptionValue(CLIParserBuilder.REQUESTER_ARG); if (requester != null) { requestContext.setRelyingPartyConfiguration(rpConfigManager.getRelyingPartyConfiguration(requester)); String principal = (String) parser.getOptionValue(CLIParserBuilder.PRINCIPAL_ARG); requestContext.setPrincipalName(principal); String authnMethod = (String) parser.getOptionValue(CLIParserBuilder.AUTHN_METHOD_ARG); requestContext.setPrincipalAuthenticationMethod(authnMethod);