/** * Throws a {@link MissingOptionException} if all of the required options * are not present. * * @throws MissingOptionException if any of the required Options * are not present. */ private void checkRequiredOptions() throws MissingOptionException { // if there are required options that have not been processed if (!expectedOpts.isEmpty()) { throw new MissingOptionException(expectedOpts); } }
protected Integer getIntArg(final Properties properties, final CommandOption option) throws MissingOptionException { final String argValue = properties.getProperty(option.getLongName()); if (StringUtils.isBlank(argValue)) { return null; } try { return Integer.valueOf(argValue); } catch (Exception e) { throw new MissingOptionException("Version must be numeric: " + argValue); } }
protected Integer getRequiredIntArg(final Properties properties, final CommandOption option) throws MissingOptionException { final String argValue = properties.getProperty(option.getLongName()); if (StringUtils.isBlank(argValue)) { throw new MissingOptionException("Missing required option --" + option.getLongName()); } try { return Integer.valueOf(argValue); } catch (Exception e) { throw new MissingOptionException("Version must be numeric: " + argValue); } }
protected String getRequiredArg(final Properties properties, final CommandOption option) throws MissingOptionException { final String argValue = properties.getProperty(option.getLongName()); if (StringUtils.isBlank(argValue)) { throw new MissingOptionException("Missing required option --" + option.getLongName()); } return argValue; }
/** * Throws a {@link MissingOptionException} if all of the required options * are not present. * * @throws MissingOptionException if any of the required Options are not present. */ protected void checkRequiredOptions() throws MissingOptionException { // if there are required options that have not been processed if (!getRequiredOptions().isEmpty()) { throw new MissingOptionException(getRequiredOptions()); } }
final String url = properties.getProperty(CommandOption.URL.getLongName()); if (StringUtils.isBlank(url)) { throw new MissingOptionException("Missing required option '" + CommandOption.URL.getLongName() + "'"); || StringUtils.isBlank(truststorePasswd)) ) { throw new MissingOptionException(CommandOption.TRUSTSTORE.getLongName() + ", " + CommandOption.TRUSTSTORE_TYPE.getLongName() + ", and " + CommandOption.TRUSTSTORE_PASSWORD.getLongName() + " are required when using an https url");
final String url = properties.getProperty(CommandOption.URL.getLongName()); if (StringUtils.isBlank(url)) { throw new MissingOptionException("Missing required option '" + CommandOption.URL.getLongName() + "'"); || StringUtils.isBlank(truststorePasswd)) ) { throw new MissingOptionException(CommandOption.TRUSTSTORE.getLongName() + ", " + CommandOption.TRUSTSTORE_TYPE.getLongName() + ", and " + CommandOption.TRUSTSTORE_PASSWORD.getLongName() + " are required when using an https url");
throw new MissingOptionException("Missing required option --" + CommandOption.INPUT_SOURCE.getLongName());
registryId = entities.stream().findFirst().get().getId(); } else { throw new MissingOptionException(CommandOption.REGISTRY_CLIENT_ID.getLongName() + " must be provided when there is more than one available");
public static String outputFileOf(CommandLine cl) throws MissingOptionException { if (!cl.hasOption("o")) throw new MissingOptionException(rb.getString("missing-o-file")); return cl.getOptionValue("o"); }
private static String documentTitleOf(CommandLine cl) throws MissingOptionException { if (!cl.hasOption("title")) throw new MissingOptionException(rb.getString("missing-title")); return cl.getOptionValue("title"); }
private static String documentTitleOf(CommandLine cl) throws MissingOptionException { if (!cl.hasOption("kos-title")) throw new MissingOptionException(rb.getString("missing-title")); return cl.getOptionValue("kos-title"); }
private static String documentTitleOf(CommandLine cl) throws MissingOptionException { if (!cl.hasOption("title")) throw new MissingOptionException(rb.getString("missing-title")); return cl.getOptionValue("title"); }
private static void checkOptions(CommandLine cl) throws ParseException { if (!cl.hasOption("b")) throw new MissingOptionException( CLIUtils.rb.getString("missing-bind-opt")); if (!cl.hasOption("c")) throw new MissingOptionException( CLIUtils.rb.getString("missing-connect-opt")); if (cl.hasOption("mpps") && cl.hasOption("mpps-late")) throw new ParseException(rb.getString("mpps-error")); }
private static void configureBindServer(Connection conn, CommandLine cl) throws ParseException { if (!cl.hasOption("b")) throw new MissingOptionException( CLIUtils.rb.getString("missing-bind-opt")); String aeAtHostPort = cl.getOptionValue("b"); String[] hostAndPort = StringUtils.split(aeAtHostPort, ':'); int portIndex = hostAndPort.length - 1; conn.setPort(Integer.parseInt(hostAndPort[portIndex])); if (portIndex > 0) conn.setHostname(hostAndPort[0]); }
private static void configureBindServer(Connection conn, CommandLine cl) throws ParseException { if (!cl.hasOption("b")) throw new MissingOptionException( CLIUtils.rb.getString("missing-bind-opt")); String aeAtHostPort = cl.getOptionValue("b"); String[] hostAndPort = StringUtils.split(aeAtHostPort, ':'); int portIndex = hostAndPort.length - 1; conn.setPort(Integer.parseInt(hostAndPort[portIndex])); if (portIndex > 0) conn.setHostname(hostAndPort[0]); }
private static void configureDicomFileSet(DcmQRSCP main, CommandLine cl) throws Exception { if (!cl.hasOption("dicomdir")) throw new MissingOptionException(rb.getString("missing-dicomdir")); main.setDicomDirectory(new File(cl.getOptionValue("dicomdir"))); main.setFilePathFormat(cl.getOptionValue("filepath", "DICOM/{0020000D,hash}/{0020000E,hash}/{00080018,hash}")); RecordFactory recFact = new RecordFactory(); if (cl.hasOption("record-config")) recFact.loadConfiguration(cl.getOptionValue("record-config")); main.setRecordFactory(recFact); }
private static void configureConnect(Connection conn, CommandLine cl) throws MissingOptionException, ParseException { if (!cl.hasOption("c")) throw new MissingOptionException( CLIUtils.rb.getString("missing-connect-opt")); String[] hostPort = StringUtils.split(cl.getOptionValue("c"), ':'); if (hostPort.length != 2) throw new ParseException(CLIUtils.rb.getString("invalid-connect-opt")); conn.setHostname(hostPort[0]); conn.setPort(Integer.parseInt(hostPort[1])); conn.setHttpProxy(cl.getOptionValue("proxy")); }
private static void configureConnect(Connection conn, CommandLine cl) throws MissingOptionException, ParseException { if (!cl.hasOption("c")) throw new MissingOptionException( CLIUtils.rb.getString("missing-connect-opt")); String[] hostPort = StringUtils.split(cl.getOptionValue("c"), ':'); if (hostPort.length != 2) throw new ParseException(CLIUtils.rb.getString("invalid-connect-opt")); conn.setHostname(hostPort[0]); conn.setPort(Integer.parseInt(hostPort[1])); conn.setHttpProxy(cl.getOptionValue("proxy")); }
public static void configureBindServer(Connection conn, ApplicationEntity ae, CommandLine cl) throws ParseException { if (!cl.hasOption("b")) throw new MissingOptionException(rb.getString("missing-bind-opt")); String aeAtHostPort = cl.getOptionValue("b"); String[] aeAtHostAndPort = split(aeAtHostPort, ':', 1); conn.setPort(Integer.parseInt(aeAtHostAndPort[1])); if (aeAtHostAndPort[0] != null) { String[] aeHost = split(aeAtHostAndPort[0], '@', 0); ae.setAETitle(aeHost[0]); if (aeHost[1] != null) conn.setHostname(aeHost[1]); } }