CmdlineOptions options = new CmdlineOptions("Canonicalizer", argv); OptionsListener ohandler = new OptionsListener(); options.addLong(ohandler, "readall", 'a', false); options.parse(); } catch (CmdlineOptions.OptionsException e) { System.err.println("Error: " + e.getMessage()); String[] args = options.getArguments();
public static void main(String[] argv) throws Exception { // Initialize logging CmdlineUtils.initializeLogging(); // Register logging options CmdlineOptions options = new CmdlineOptions("TranslateSourceLocators", argv); CmdlineUtils.registerLoggingOptions(options); // Parse command line options try { options.parse(); } catch (CmdlineOptions.OptionsException e) { System.err.println("Error: " + e.getMessage()); System.exit(1); } // Get command line arguments String[] args = options.getArguments(); if (args.length < 3 || args.length > 3) { usage(); System.exit(3); } translate(args[0], args[1], args[2]); }
private void setupRDBMS(String[] argv) throws CmdlineOptions.OptionsException { options = new CmdlineOptions("RDBMSImport", argv); listener = new Listener(); CmdlineUtils.registerLoggingOptions(options); options.addLong(listener, "tmid", 't', true); }
public void testWithOption() throws CmdlineOptions.OptionsException { String[] argv = {"--tmid=140", "propfile", "tmfile.xtm"}; setupRDBMS(argv); options.parse(); String args[] = options.getArguments(); assertTrue("Wrong number of arguments", args.length == 2); assertTrue("First argument is wrong", args[0].equals("propfile")); assertTrue("Second argument is wrong", args[1].equals("tmfile.xtm")); assertTrue("tmid options incorrectly set", listener.getOption('t').equals("140")); }
public void testWithMistypedOption2() throws CmdlineOptions.OptionsException { String[] argv = {"-tmid", "propfile", "tmfile.xtm"}; setupRDBMS(argv); try { options.parse(); fail("Incorrect options allowed"); } catch (CmdlineOptions.OptionsException e) { assertTrue("Wrong problem reported" + e.getArgument(), e.getArgument().equals("-tmid")); } }
public static void main(String[] args) throws Exception { // initialize logging CmdlineUtils.initializeLogging(); // register logging options CmdlineOptions options = new CmdlineOptions("ClusterClientTest", args); CmdlineUtils.registerLoggingOptions(options); String clusterId = "cluster-test"; // args[0]; String clusterProps = null; // (args.length >= 2 ? args[1] : null); ClusterClientTest tester = new ClusterClientTest(clusterId, clusterProps); try { tester.setUp(); tester.run(); } finally { tester.tearDown(); } System.out.println("Tests: " + tester.testsRun + " failed: " + tester.testsFailed); }
public static void registerLoggingOptions(CmdlineOptions options) { // Configure option listeners LoggingOptionsListener listener = new LoggingOptionsListener(); options.addLong(listener, "logargs", '9', true); options.addLong(listener, "loglevel", '8', true); //options.addLong(listener, "logfile", '7', true); }
CmdlineOptions options = new CmdlineOptions("SanityChecker", argv); options.parse(); String[] args = options.getArguments();
public void testSimple() throws CmdlineOptions.OptionsException { String[] argv = {"propfile", "tmfile.xtm"}; setupRDBMS(argv); options.parse(); String args[] = options.getArguments(); assertTrue("Wrong number of arguments", args.length == 2); assertTrue("First argument is wrong", args[0].equals("propfile")); assertTrue("Second argument is wrong", args[1].equals("tmfile.xtm")); assertTrue("tmid options incorrectly set", listener.getOption('t') == null); }
public void testWithMistypedOption() throws CmdlineOptions.OptionsException { String[] argv = {"-tmid=140", "propfile", "tmfile.xtm"}; setupRDBMS(argv); try { options.parse(); fail("Incorrect options allowed"); } catch (CmdlineOptions.OptionsException e) { assertTrue("Wrong problem reported" + e.getArgument(), e.getArgument().equals("-tmid=140")); } }
public static void main(String[] args) throws Exception { // initialize logging CmdlineUtils.initializeLogging(); // register logging options CmdlineOptions options = new CmdlineOptions("ClusterMasterTest", args); CmdlineUtils.registerLoggingOptions(options); String clusterId = "cluster-test"; // args[0]; String clusterProps = null; // (args.length >= 2 ? args[1] : null); ClusterMasterTest tester = new ClusterMasterTest(clusterId, clusterProps); try { tester.setUp(); tester.run(); } finally { tester.tearDown(); } }
CmdlineOptions options = new CmdlineOptions("TologQuery", argv); OptionsListener ohandler = new OptionsListener(); options.addLong(ohandler, "trace", 't'); options.addLong(ohandler, "debug", 'd'); options.addLong(ohandler, "timeit", 'i'); options.parse(); } catch (CmdlineOptions.OptionsException e) { System.err.println("Error: " + e.getMessage()); String[] args = options.getArguments();
/** * Check a given database for topic map consistency.. * In particular, checks for referential integrity and uniqueness. */ public static void main(String [] argv) throws Exception { // Initialize logging CmdlineUtils.initializeLogging(); // Initialize command line option parser and listeners CmdlineOptions options = new CmdlineOptions("RDBMSConsistencyChecker", argv); // Register logging options CmdlineUtils.registerLoggingOptions(options); // Parse command line options try { options.parse(); } catch (CmdlineOptions.OptionsException e) { System.err.println("Error: " + e.getMessage()); System.exit(1); } // Get command line arguments String[] args = options.getArguments(); String dbProperties = null; if (args.length != 1) { System.err.println("Error: Illegal number of arguments."); usage(); System.exit(1); } dbProperties = args[0]; checkConsistency(dbProperties, new OutputStreamWriter(System.out)); }
CmdlineOptions options = new CmdlineOptions("Chew", argv); CmdlineUtils.registerLoggingOptions(options); OptionsListener ohandler = new OptionsListener(); options.addLong(ohandler, "terms", 't', true); options.parse(); } catch (CmdlineOptions.OptionsException e) { System.err.println("Error: " + e.getMessage()); String[] args = options.getArguments(); if (args.length == 0 || args.length > 2) { usage();
CmdlineOptions options = new CmdlineOptions("XTMValidator", argv); options.parse(); } catch (CmdlineOptions.OptionsException e) { System.err.println("Error: " + e.getMessage()); String[] args = options.getArguments(); if (args.length == 0) { System.err.println("Error: Please specify one or more XTM files.");
CmdlineOptions options = new CmdlineOptions("Consistify", argv); OptionsListener ohandler = new OptionsListener(); options.addLong(ohandler, "normalize", 'n'); options.addLong(ohandler, "encoding", 'e'); options.addLong(ohandler, "xtm", 'x'); options.parse(); } catch (CmdlineOptions.OptionsException e) { System.err.println("Error: " + e.getMessage()); String[] args = options.getArguments(); if (args.length < 2) { System.err.println("Error: need at least two files as arguments.");
CmdlineOptions options = new CmdlineOptions("SQLExecuter", argv); options.parse(); } catch (CmdlineOptions.OptionsException e) { System.err.println("Error: " + e.getMessage()); String[] args = options.getArguments(); if (args.length < 2) { System.err.println("Error: wrong number of arguments.");
CmdlineOptions options = new CmdlineOptions("TopicMapConverter", argv); OptionsListener ohandler = new OptionsListener(); options.addLong(ohandler, "xtm", 'x'); options.addLong(ohandler, "enc", 'e', true); options.addLong(ohandler, "rdf", 'r', true); options.addLong(ohandler, "wellformed", 'w'); options.parse(); } catch (CmdlineOptions.OptionsException e) { System.err.println("Error: " + e.getMessage()); String[] args = options.getArguments();
public static void main(String[] argv) throws Exception { // Initialize logging CmdlineUtils.initializeLogging(); // Register logging options CmdlineOptions options = new CmdlineOptions("RDBMSDelete", argv); CmdlineUtils.registerLoggingOptions(options); // Parse command line options try { options.parse(); } catch (CmdlineOptions.OptionsException e) { System.err.println("Error: " + e.getMessage()); System.exit(1); } // Get command line arguments String[] args = options.getArguments(); if (args.length < 2) { usage(); System.exit(3); } String propfile = args[0]; long topicMapId = ImportExportUtils.getTopicMapId(args[1]); RDBMSTopicMapStore store = new RDBMSTopicMapStore(propfile, topicMapId); System.out.println("Deleting topic map with id " + topicMapId); store.delete(true); }
CmdlineOptions options = new CmdlineOptions("VizDesktop", argv); OptionsListener ohandler = new OptionsListener(); options.addLong(ohandler, "lang", 'l', true); options.parse(); } catch (CmdlineOptions.OptionsException e) { System.err.println("Error: " + e.getMessage()); final String[] args = options.getArguments(); if (args.length > 1) { System.err.println(Messages.getString("Viz.InvalidParamNum"));