/** * Returns the value (a string) for an argument with a value - * returns null for no argument and no value. * @param argName * @return String */ public String getValue(String argName) { Arg arg = getArg(argName) ; if ( arg == null ) return null ; return arg.getValue() ; }
/** * Returns the value (a string) for an argument with a value - * returns null for no argument and no value. * @param argName * @return String */ public String getValue(String argName) { Arg arg = getArg(argName) ; if ( arg == null ) return null ; return arg.getValue() ; }
@Override protected void processModulesAndArgs() { if ( contains(argDeclRepeat) ) repeatCount = Integer.parseInt(getArg(argDeclRepeat).getValue()) ; }
/** * Returns the value (a string) for an argument with a value - * returns null for no argument and no value. * @param argDecl * @return String */ public String getValue(ArgDecl argDecl) { Arg arg = getArg(argDecl) ; if ( arg == null ) return null ; if ( arg.hasValue() ) return arg.getValue() ; return null ; }
/** * Returns the value (a string) for an argument with a value - * returns null for no argument and no value. * @param argDecl * @return String */ public String getValue(ArgDecl argDecl) { Arg arg = getArg(argDecl) ; if ( arg == null ) return null ; if ( arg.hasValue() ) return arg.getValue() ; return null ; }
/** Choose a port number or return null */ private static Integer chooseServerPort(CmdLineArgs cla) { // The port chosen from this ordered list: // Command line // Environment variable // Default. int port = -1; String portStr = null; if ( cla.contains(argPort) ) portStr = cla.getArg(argPort).getValue(); else // Compatibility portStr = getenv(DeltaConst.ENV_PORT); if ( portStr == null ) return DeltaConst.PORT; //cmdLineError("No server port given: use --%s", argPort.getKeyName()); try { port = Integer.parseInt(portStr); if ( port <= 0 ) throw new NumberFormatException(); return port; } catch (NumberFormatException ex) { cmdLineError("Failed to parse the port number: %s", portStr); return null; } }
String f = cmdLine.getArg(argDeclSDBdesc).getValue() ; try { storeDesc = StoreDesc.read(f) ; storeDesc.connDesc.setHost(cmdLine.getArg(argDeclDbHost).getValue()); storeDesc.connDesc.setName(cmdLine.getArg(argDeclDbName).getValue()) ; storeDesc.connDesc.setType(cmdLine.getArg(argDeclDbType).getValue()) ; storeDesc.connDesc.setUser(cmdLine.getArg(argDeclDbUser).getValue()) ; storeDesc.connDesc.setPassword(cmdLine.getArg(argDeclDbPassword).getValue()) ; storeDesc.engineType = MySQLEngineType.convert(cmdLine.getArg(argDeclMySQLEngine).getValue()); storeDesc.storageType = SAPStorageType.convert(cmdLine.getArg(argDeclSAPStorage).getValue()); String layoutName = cmdLine.getArg(argDeclLayout).getValue() ; storeDesc.setLayout(LayoutType.fetch(layoutName)) ; String driverName = cmdLine.getArg(argDeclJdbcDriver).getValue(); storeDesc.connDesc.setDriver(driverName) ;
@Override protected void execCmd(List<String> args) { // This is a streamable syntax. String syntax = "N-QUADS"; if ( contains(argDeclSyntax) ) syntax = getArg(argDeclSyntax).getValue(); Lang lang = RDFLanguages.nameToLang(syntax); try { if ( modGraph.getGraphName() == null ) { if ( ! RDFLanguages.isQuads(lang) ) cmdError("Not a 'quads' language (try 'N-Quads' or 'TriG')", true) ; Dataset dataset = getModStore().getDataset(); RDFDataMgr.write(System.out, dataset, lang); } else { Model model = modGraph.getModel(getStore()); RDFDataMgr.write(System.out, model, lang); } } catch (CmdException ex) { throw ex ; } catch (Exception ex) { System.err.println("Exception: " + ex + " :: " + ex.getMessage()); ex.printStackTrace(System.err); } } }
@Test public void test_Arg2() { String args[] = new String[]{ "-arg=ARG", "filename"} ; CmdLineArgs cl = new CmdLineArgs(args) ; ArgDecl argA = new ArgDecl(true, "arg") ; cl.add(argA) ; cl.process() ; assertTrue("No -arg= argument found" , cl.contains(argA) ) ; assertEquals("", cl.getValue(argA) , "ARG") ; assertEquals("", cl.getArg("arg").getValue() , "ARG") ; }
@Test public void test_Arg2() { String args[] = new String[]{ "-arg=ARG", "filename"} ; CmdLineArgs cl = new CmdLineArgs(args) ; ArgDecl argA = new ArgDecl(true, "arg") ; cl.add(argA) ; cl.process() ; assertTrue("No -arg= argument found" , cl.contains(argA) ) ; assertEquals("", cl.getValue(argA) , "ARG") ; assertEquals("", cl.getArg("arg").getValue() , "ARG") ; }
rdfsVocabFilename = cmdLine.getArg(argRDFS).getValue() ; rdfsVocab = FileManager.get().loadModel(rdfsVocabFilename) ; } catch (RiotException ex) {
rdfsVocabFilename = cmdLine.getArg(argRDFS).getValue() ; rdfsVocab = FileManager.get().loadModel(rdfsVocabFilename) ; } catch (RiotException ex) {