List of usage examples for org.apache.commons.cli Options addOption
public Options addOption(String opt, String longOpt, boolean hasArg, String description)
From source file:edu.msu.cme.rdp.alignment.pairwise.PairwiseKNN.java
public static void main(String[] args) throws Exception { File queryFile;//from ww w . j a v a2 s .co m File refFile; AlignmentMode mode = AlignmentMode.glocal; int k = 1; int wordSize = 0; int prefilter = 10; // The top p closest protein targets PrintStream out = new PrintStream(System.out); Options options = new Options(); options.addOption("m", "mode", true, "Alignment mode {global, glocal, local, overlap, overlap_trimmed} (default= glocal)"); options.addOption("k", true, "K-nearest neighbors to return. (default = 1)"); options.addOption("o", "out", true, "Redirect output to file instead of stdout"); options.addOption("p", "prefilter", true, "The top p closest targets from kmer prefilter step. Set p=0 to disable the prefilter step. (default = 10) "); options.addOption("w", "word-size", true, "The word size used to find closest targets during prefilter. (default " + ProteinWordGenerator.WORDSIZE + " for protein, " + GoodWordIterator.DEFAULT_WORDSIZE + " for nucleotide)"); try { CommandLine line = new PosixParser().parse(options, args); if (line.hasOption("mode")) { mode = AlignmentMode.valueOf(line.getOptionValue("mode")); } if (line.hasOption('k')) { k = Integer.valueOf(line.getOptionValue('k')); if (k < 1) { throw new Exception("k must be at least 1"); } } if (line.hasOption("word-size")) { wordSize = Integer.parseInt(line.getOptionValue("word-size")); if (wordSize < 3) { throw new Exception("Word size must be at least 3"); } } if (line.hasOption("prefilter")) { prefilter = Integer.parseInt(line.getOptionValue("prefilter")); // prefilter == 0 means no prefilter if (prefilter > 0 && prefilter < k) { throw new Exception("prefilter must be at least as big as k " + k); } } if (line.hasOption("out")) { out = new PrintStream(line.getOptionValue("out")); } args = line.getArgs(); if (args.length != 2) { throw new Exception("Unexpected number of command line arguments"); } queryFile = new File(args[0]); refFile = new File(args[1]); } catch (Exception e) { new HelpFormatter().printHelp("PairwiseKNN <options> <queryFile> <dbFile>", options); System.err.println("ERROR: " + e.getMessage()); return; } PairwiseKNN theObj = new PairwiseKNN(queryFile, refFile, out, mode, k, wordSize, prefilter); theObj.match(); }
From source file:com.ingby.socbox.bischeck.cli.CacheCli.java
public static void main(String[] args) throws ConfigurationException, CacheException, IOException, ParseException { CommandLineParser cmdParser = new GnuParser(); CommandLine line = null;/*w ww .j a v a2 s . co m*/ // create the Options Options options = new Options(); options.addOption("u", "usage", false, "show usage"); options.addOption("p", "pipemode", false, "read from stdin"); options.addOption("T", "notime", false, "do not show execution time"); options.addOption("P", "noparse", false, "do not show parsed expression"); try { line = cmdParser.parse(options, args); } catch (org.apache.commons.cli.ParseException e) { System.out.println("Command parse error:" + e.getMessage()); Util.ShellExit(1); } if (line.hasOption("usage")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(PROGRAMNAME, options); Util.ShellExit(0); } try { ConfigurationManager.getInstance(); } catch (java.lang.IllegalStateException e) { ConfigurationManager.init(); ConfigurationManager.getInstance(); } Boolean supportNull = false; if ("true".equalsIgnoreCase( ConfigurationManager.getInstance().getProperties().getProperty("notFullListParse", "false"))) { supportNull = true; } CacheFactory.init(); if (line.hasOption("notime")) { showtime = false; } if (line.hasOption("noparse")) { showparse = false; } if (line.hasOption("pipemode")) { pipe(); } else { cli(supportNull); } }
From source file:ca.ualberta.exemplar.core.Exemplar.java
public static void main(String[] rawArgs) throws FileNotFoundException, UnsupportedEncodingException { CommandLineParser cli = new BasicParser(); Options options = new Options(); options.addOption("h", "help", false, "shows this message"); options.addOption("b", "benchmark", true, "expects input to be a benchmark file (type = binary | nary)"); options.addOption("p", "parser", true, "defines which parser to use (parser = stanford | malt)"); CommandLine line = null;/* w w w . jav a 2s.c o m*/ try { line = cli.parse(options, rawArgs); } catch (ParseException exp) { System.err.println(exp.getMessage()); System.exit(1); } String[] args = line.getArgs(); String parserName = line.getOptionValue("parser", "malt"); if (line.hasOption("help")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("sh ./exemplar", options); System.exit(0); } if (args.length != 2) { System.out.println("error: exemplar requires an input file and output file."); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("sh ./exemplar <input> <output>", options); System.exit(0); } File input = new File(args[0]); File output = new File(args[1]); String benchmarkType = line.getOptionValue("benchmark", ""); if (!benchmarkType.isEmpty()) { if (benchmarkType.equals("binary")) { BenchmarkBinary evaluation = new BenchmarkBinary(input, output, parserName); evaluation.runAndTime(); System.exit(0); } else { if (benchmarkType.equals("nary")) { BenchmarkNary evaluation = new BenchmarkNary(input, output, parserName); evaluation.runAndTime(); System.exit(0); } else { System.out.println("error: benchmark option has to be either 'binary' or 'nary'."); System.exit(0); } } } Parser parser = null; if (parserName.equals("stanford")) { parser = new ParserStanford(); } else { if (parserName.equals("malt")) { parser = new ParserMalt(); } else { System.out.println(parserName + " is not a valid parser."); System.exit(0); } } System.out.println("Starting EXEMPLAR..."); RelationExtraction exemplar = null; try { exemplar = new RelationExtraction(parser); } catch (FileNotFoundException e) { e.printStackTrace(); } BlockingQueue<String> inputQueue = new ArrayBlockingQueue<String>(QUEUE_SIZE); PlainTextReader reader = null; reader = new PlainTextReader(inputQueue, input); Thread readerThread = new Thread(reader); readerThread.start(); PrintStream statementsOut = null; try { statementsOut = new PrintStream(output, "UTF-8"); } catch (FileNotFoundException e1) { e1.printStackTrace(); System.exit(0); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); System.exit(0); } statementsOut.println("Subjects\tRelation\tObjects\tNormalized Relation\tSentence"); while (true) { String doc = null; try { doc = inputQueue.take(); } catch (InterruptedException e) { e.printStackTrace(); } if (doc.isEmpty()) { break; } List<RelationInstance> instances = exemplar.extractRelations(doc); for (RelationInstance instance : instances) { // Output SUBJ arguments in a separate field, for clarity boolean first = true; for (Argument arg : instance.getArguments()) { if (arg.argumentType.equals("SUBJ")) { if (first) { first = false; } else { statementsOut.print(",,"); } statementsOut.print(arg.argumentType + ":" + arg.entityId); } } // Output the original relation statementsOut.print("\t" + instance.getOriginalRelation() + "\t"); // Output the DOBJ arguments, followed by POBJ first = true; for (Argument arg : instance.getArguments()) { if (arg.argumentType.equals("DOBJ")) { if (first) { first = false; } else { statementsOut.print(",,"); } statementsOut.print(arg.argumentType + ":" + arg.entityId); } } for (Argument arg : instance.getArguments()) { if (arg.argumentType.startsWith("POBJ")) { if (first) { first = false; } else { statementsOut.print(",,"); } statementsOut.print(arg.argumentType + ":" + arg.entityId); } } statementsOut.print("\t" + instance.getNormalizedRelation()); statementsOut.print("\t" + instance.getSentence()); statementsOut.println(); } } System.out.println("Done!"); statementsOut.close(); }
From source file:com.github.houbin217jz.thumbnail.Thumbnail.java
public static void main(String[] args) { Options options = new Options(); options.addOption("s", "src", true, "????????????"); options.addOption("d", "dst", true, ""); options.addOption("r", "ratio", true, "/??, 30%???0.3????????"); options.addOption("w", "width", true, "(px)"); options.addOption("h", "height", true, "?(px)"); options.addOption("R", "recursive", false, "???????"); HelpFormatter formatter = new HelpFormatter(); String formatstr = "java -jar thumbnail.jar " + "[-s/--src <path>] " + "[-d/--dst <path>] " + "[-r/--ratio double] " + "[-w/--width integer] " + "[-h/--height integer] " + "[-R/--recursive] "; CommandLineParser parser = new PosixParser(); CommandLine cmd = null;// w w w .j av a 2 s. co m try { cmd = parser.parse(options, args); } catch (ParseException e1) { formatter.printHelp(formatstr, options); return; } final Path srcDir, dstDir; final Integer width, height; final Double ratio; // if (cmd.hasOption("s")) { srcDir = Paths.get(cmd.getOptionValue("s")).toAbsolutePath(); } else { srcDir = Paths.get("").toAbsolutePath(); //?? } // if (cmd.hasOption("d")) { dstDir = Paths.get(cmd.getOptionValue("d")).toAbsolutePath(); } else { formatter.printHelp(formatstr, options); return; } if (!Files.exists(srcDir, LinkOption.NOFOLLOW_LINKS) || !Files.isDirectory(srcDir, LinkOption.NOFOLLOW_LINKS)) { System.out.println("[" + srcDir.toAbsolutePath() + "]??????"); return; } if (Files.exists(dstDir, LinkOption.NOFOLLOW_LINKS)) { if (!Files.isDirectory(dstDir, LinkOption.NOFOLLOW_LINKS)) { //???????? System.out.println("????????"); return; } } else { //???????? try { Files.createDirectories(dstDir); } catch (IOException e) { e.printStackTrace(); return; } } //?? if (cmd.hasOption("w") && cmd.hasOption("h")) { try { width = Integer.valueOf(cmd.getOptionValue("width")); height = Integer.valueOf(cmd.getOptionValue("height")); } catch (NumberFormatException e) { System.out.println("??????"); return; } } else { width = null; height = null; } //? if (cmd.hasOption("r")) { try { ratio = Double.valueOf(cmd.getOptionValue("r")); } catch (NumberFormatException e) { System.out.println("?????"); return; } } else { ratio = null; } if (width != null && ratio != null) { System.out.println("??????????????"); return; } if (width == null && ratio == null) { System.out.println("????????????"); return; } // int maxDepth = 1; if (cmd.hasOption("R")) { maxDepth = Integer.MAX_VALUE; } try { //Java 7 ??@see http://docs.oracle.com/javase/jp/7/api/java/nio/file/Files.html Files.walkFileTree(srcDir, EnumSet.of(FileVisitOption.FOLLOW_LINKS), maxDepth, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path path, BasicFileAttributes basicFileAttributes) throws IOException { //???&??? String filename = path.getFileName().toString().toLowerCase(); if (filename.endsWith(".jpg") || filename.endsWith(".jpeg")) { //Jpeg?? /* * relative??: * rootPath: /a/b/c/d * filePath: /a/b/c/d/e/f.jpg * rootPath.relativize(filePath) = e/f.jpg */ /* * resolve?? * rootPath: /a/b/c/output * relativePath: e/f.jpg * rootPath.resolve(relativePath) = /a/b/c/output/e/f.jpg */ Path dst = dstDir.resolve(srcDir.relativize(path)); if (!Files.exists(dst.getParent(), LinkOption.NOFOLLOW_LINKS)) { Files.createDirectories(dst.getParent()); } doResize(path.toFile(), dst.toFile(), width, height, ratio); } return FileVisitResult.CONTINUE; } }); } catch (IOException e) { e.printStackTrace(); } }
From source file:net.mybox.mybox.ServerAdmin.java
/** * Handle command line args//w w w . j a v a 2s . co m * @param args */ public static void main(String[] args) { Options options = new Options(); options.addOption("c", "config", true, "configuration file"); // options.addOption("d", "database", true, "accounts database file"); options.addOption("a", "apphome", true, "application home directory"); options.addOption("h", "help", false, "show help screen"); options.addOption("V", "version", false, "print the Mybox version"); CommandLineParser line = new GnuParser(); CommandLine cmd = null; try { cmd = line.parse(options, args); } catch (ParseException exp) { System.err.println(exp.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(ServerAdmin.class.getName(), options); return; } if (cmd.hasOption("h")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(Client.class.getName(), options); return; } if (cmd.hasOption("V")) { Client.printMessage("version " + Common.appVersion); return; } if (cmd.hasOption("a")) { String appHomeDir = cmd.getOptionValue("a"); try { Common.updatePaths(appHomeDir); } catch (FileNotFoundException e) { Client.printErrorExit(e.getMessage()); } Server.updatePaths(); } String configFile = Server.defaultConfigFile; // String accountsDBfile = Server.defaultAccountsDbFile; if (cmd.hasOption("c")) { configFile = cmd.getOptionValue("c"); } File fileCheck = new File(configFile); if (!fileCheck.isFile()) Server.printErrorExit("Config not found: " + configFile + "\nPlease run ServerSetup"); // if (cmd.hasOption("d")){ // accountsDBfile = cmd.getOptionValue("d"); // } // // fileCheck = new File(accountsDBfile); // if (!fileCheck.isFile()) // Server.printErrorExit("Error account database not found: " + accountsDBfile); ServerAdmin server = new ServerAdmin(configFile); }
From source file:javadepchecker.Main.java
/** * @param args the command line arguments *//*www. j a v a 2 s.c o m*/ public static void main(String[] args) throws IOException { int exit = 0; try { CommandLineParser parser = new PosixParser(); Options options = new Options(); options.addOption("h", "help", false, "print help"); options.addOption("i", "image", true, "image directory"); options.addOption("v", "verbose", false, "print verbose output"); CommandLine line = parser.parse(options, args); String[] files = line.getArgs(); if (line.hasOption("h") || files.length == 0) { HelpFormatter h = new HelpFormatter(); h.printHelp("java-dep-check [-i <image>] <package.env>+", options); } else { image = line.getOptionValue("i", ""); for (String arg : files) { if (line.hasOption('v')) { System.out.println("Checking " + arg); } if (!checkPkg(new File(arg))) { exit = 1; } } } } catch (ParseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } System.exit(exit); }
From source file:ed.net.lb.LB.java
public static void main(String args[]) throws Exception { int verbose = 0; for (int i = 0; i < args.length; i++) { if (args[i].matches("\\-v+")) { verbose = args[i].length() - 1; args[i] = ""; }/* w w w. ja v a 2s. co m*/ } Options o = new Options(); o.addOption("p", "port", true, "Port to Listen On"); o.addOption("v", "verbose", false, "Verbose"); o.addOption("mapfile", "m", true, "file from which to load mappings"); CommandLine cl = (new BasicParser()).parse(o, args); final int port = Integer.parseInt(cl.getOptionValue("p", "8080")); MappingFactory mf = null; if (cl.hasOption("m")) mf = new TextMapping.Factory(cl.getOptionValue("m", null)); else mf = new GridMapping.Factory(); System.out.println("10gen load balancer"); System.out.println("\t port \t " + port); System.out.println("\t verbose \t " + verbose); int retriesLeft = 2; HttpMonitor.setApplicationType("Load Balancer"); LB lb = null; while (retriesLeft-- > 0) { try { lb = new LB(port, mf, verbose); break; } catch (BindException be) { be.printStackTrace(); System.out.println("can't bind to port. going to try to kill old one"); HttpDownload.downloadToJS(new URL("http://127.0.0.1:" + port + "/~kill")); Thread.sleep(100); } } if (lb == null) { System.err.println("couldn't ever bind"); System.exit(-1); return; } lb.start(); lb.join(); System.exit(0); }
From source file:com.betfair.cougar.test.socket.app.SocketCompatibilityTestingApp.java
public static void main(String[] args) throws Exception { Parser parser = new PosixParser(); Options options = new Options(); options.addOption("r", "repo", true, "Repository type to search: local|central"); options.addOption("c", "client-concurrency", true, "Max threads to allow each client tester to run tests, defaults to 10"); options.addOption("t", "test-concurrency", true, "Max client testers to run concurrently, defaults to 5"); options.addOption("m", "max-time", true, "Max time (in minutes) to allow tests to complete, defaults to 10"); options.addOption("v", "version", false, "Print version and exit"); options.addOption("h", "help", false, "This help text"); CommandLine commandLine = parser.parse(options, args); if (commandLine.hasOption("h")) { System.out.println(options); System.exit(0);/*from w w w . j a va 2 s.c om*/ } if (commandLine.hasOption("v")) { System.out.println("How the hell should I know?"); System.exit(0); } // 1. Find all testers in given repos List<RepoSearcher> repoSearchers = new ArrayList<>(); for (String repo : commandLine.getOptionValues("r")) { if ("local".equals(repo.toLowerCase())) { repoSearchers.add(new LocalRepoSearcher()); } else if ("central".equals(repo.toLowerCase())) { repoSearchers.add(new CentralRepoSearcher()); } else { System.err.println("Unrecognized repo: " + repo); System.err.println(options); System.exit(1); } } int clientConcurrency = 10; if (commandLine.hasOption("c")) { try { clientConcurrency = Integer.parseInt(commandLine.getOptionValue("c")); } catch (NumberFormatException nfe) { System.err.println( "client-concurrency is not a valid integer: '" + commandLine.getOptionValue("c") + "'"); System.exit(1); } } int testConcurrency = 5; if (commandLine.hasOption("t")) { try { testConcurrency = Integer.parseInt(commandLine.getOptionValue("t")); } catch (NumberFormatException nfe) { System.err.println( "test-concurrency is not a valid integer: '" + commandLine.getOptionValue("t") + "'"); System.exit(1); } } int maxMinutes = 10; if (commandLine.hasOption("m")) { try { maxMinutes = Integer.parseInt(commandLine.getOptionValue("m")); } catch (NumberFormatException nfe) { System.err.println("max-time is not a valid integer: '" + commandLine.getOptionValue("m") + "'"); System.exit(1); } } Properties clientProps = new Properties(); clientProps.setProperty("client.concurrency", String.valueOf(clientConcurrency)); File baseRunDir = new File(System.getProperty("user.dir") + "/run"); baseRunDir.mkdirs(); File tmpDir = new File(baseRunDir, "jars"); tmpDir.mkdirs(); List<ServerRunner> serverRunners = new ArrayList<>(); List<ClientRunner> clientRunners = new ArrayList<>(); for (RepoSearcher searcher : repoSearchers) { List<File> jars = searcher.findAndCache(tmpDir); for (File f : jars) { ServerRunner serverRunner = new ServerRunner(f, baseRunDir); System.out.println("Found tester: " + serverRunner.getVersion()); serverRunners.add(serverRunner); clientRunners.add(new ClientRunner(f, baseRunDir, clientProps)); } } // 2. Start servers and collect ports System.out.println(); System.out.println("Starting " + serverRunners.size() + " servers..."); for (ServerRunner server : serverRunners) { server.startServer(); } System.out.println(); List<TestCombo> tests = new ArrayList<>(serverRunners.size() * clientRunners.size()); for (ServerRunner server : serverRunners) { for (ClientRunner client : clientRunners) { tests.add(new TestCombo(server, client)); } } System.out.println("Enqueued " + tests.size() + " test combos to run..."); long startTime = System.currentTimeMillis(); // 3. Run every client against every server, collecting results BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue(serverRunners.size() * clientRunners.size()); ThreadPoolExecutor service = new ThreadPoolExecutor(testConcurrency, testConcurrency, 5000, TimeUnit.MILLISECONDS, workQueue); service.prestartAllCoreThreads(); workQueue.addAll(tests); while (!workQueue.isEmpty()) { Thread.sleep(1000); } service.shutdown(); service.awaitTermination(maxMinutes, TimeUnit.MINUTES); long endTime = System.currentTimeMillis(); long totalTimeSecs = Math.round((endTime - startTime) / 1000.0); for (ServerRunner server : serverRunners) { server.shutdownServer(); } System.out.println(); System.out.println("======="); System.out.println("Results"); System.out.println("-------"); // print a summary int totalTests = 0; int totalSuccess = 0; for (TestCombo combo : tests) { String clientVer = combo.getClientVersion(); String serverVer = combo.getServerVersion(); String results = combo.getClientResults(); ObjectMapper mapper = new ObjectMapper(new JsonFactory()); JsonNode node = mapper.reader().readTree(results); JsonNode resultsArray = node.get("results"); int numTests = resultsArray.size(); int numSuccess = 0; for (int i = 0; i < numTests; i++) { if ("success".equals(resultsArray.get(i).get("result").asText())) { numSuccess++; } } totalSuccess += numSuccess; totalTests += numTests; System.out.println(clientVer + "/" + serverVer + ": " + numSuccess + "/" + numTests + " succeeded - took " + String.format("%2f", combo.getRunningTime()) + " seconds"); } System.out.println("-------"); System.out.println( "Overall: " + totalSuccess + "/" + totalTests + " succeeded - took " + totalTimeSecs + " seconds"); FileWriter out = new FileWriter("results.json"); PrintWriter pw = new PrintWriter(out); // 4. Output full results pw.println("{\n \"results\": ["); for (TestCombo combo : tests) { combo.emitResults(pw, " "); } pw.println(" ],"); pw.println(" \"servers\": ["); for (ServerRunner server : serverRunners) { server.emitInfo(pw, " "); } pw.println(" ],"); pw.close(); }
From source file:com.ingby.socbox.bischeck.configuration.DocManager.java
/** * @param args/*from w ww . j a va 2 s . c o m*/ */ public static void main(String[] args) { CommandLineParser parser = new GnuParser(); CommandLine line = null; // create the Options Options options = new Options(); options.addOption("u", "usage", false, "show usage."); options.addOption("d", "directory", true, "output directory"); options.addOption("t", "type", true, "type of out put - html or csv"); try { // parse the command line arguments line = parser.parse(options, args); } catch (org.apache.commons.cli.ParseException e) { System.out.println("Command parse error:" + e.getMessage()); Util.ShellExit(FAILED); } if (line.hasOption("usage")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("DocManager", options); Util.ShellExit(OKAY); } DocManager dmgmt = null; if (line.hasOption("directory")) { String dirname = line.getOptionValue("directory"); try { dmgmt = new DocManager(dirname); } catch (IOException ioe) { System.out.println(ioe.getMessage()); Util.ShellExit(FAILED); } } else { try { dmgmt = new DocManager(); } catch (IOException ioe) { System.out.println(ioe.getMessage()); Util.ShellExit(FAILED); } } try { if (line.hasOption("type")) { String type = line.getOptionValue("type"); if ("html".equalsIgnoreCase(type)) { dmgmt.genHtml(); } else if ("text".equalsIgnoreCase(type)) { dmgmt.genText(); } } else { dmgmt.genHtml(); } } catch (Exception e) { System.out.println(e.getMessage()); Util.ShellExit(FAILED); } }
From source file:com.evolveum.midpoint.testing.model.client.sample.Upload.java
public static void main(String[] args) { try {/*from w w w . ja va2s. c o m*/ Options options = new Options(); options.addOption(OPT_HELP, "help", false, "Print this help information"); options.addOption(OPT_FILE_TO_UPLOAD, "file", true, "File to be uploaded (XML for the moment)"); options.addOption(OPT_DIR_TO_UPLOAD, "dir", true, "Whole directory to be uploaded (XML files only for the moment)"); options.addOption(OPT_URL, true, "Endpoint URL (default: " + DEFAULT_ENDPOINT_URL + ")"); options.addOption(OPT_USER, "user", true, "User name (default: " + ADM_USERNAME + ")"); options.addOption(OPT_PASSWORD, "password", true, "Password"); options.addOption(OPT_FILE_FOR_RESULT, "file-for-result", true, "Name of the file to write operation result into"); options.addOption(OPT_HIDE_RESULT, "hide-result", false, "Don't display detailed operation result (default: showing if not SUCCESS)"); options.addOption(OPT_SHOW_RESULT, "show-result", false, "Always show detailed operation result (default: showing if not SUCCESS)"); CommandLineParser parser = new GnuParser(); CommandLine cmdline = parser.parse(options, args); if (cmdline.hasOption(OPT_HELP) || (!cmdline.hasOption(OPT_FILE_TO_UPLOAD) && !cmdline.hasOption(OPT_DIR_TO_UPLOAD))) { HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.printHelp("upload", options); System.out.println( "\nNote that currently it is possible to upload only one object per file (i.e. no <objects> tag), and the " + "file must be written using fully specified XML namespaces (i.e. namespace-guessing algorithm allowing to write data " + "without namespaces is not available)."); System.exit(-1); } System.out.println("================================================================="); ModelPortType modelPort = createModelPort(cmdline); if (cmdline.hasOption(OPT_FILE_TO_UPLOAD)) { uploadFile(new File(cmdline.getOptionValue(OPT_FILE_TO_UPLOAD)), cmdline, modelPort); } if (cmdline.hasOption(OPT_DIR_TO_UPLOAD)) { uploadDir(cmdline.getOptionValue(OPT_DIR_TO_UPLOAD), cmdline, modelPort); } } catch (Exception e) { e.printStackTrace(); System.exit(-1); } if (error) { System.exit(-1); } }