List of usage examples for java.util.logging Level SEVERE
Level SEVERE
To view the source code for java.util.logging Level SEVERE.
Click Source Link
From source file:com.wormsim.LaunchFromCodeMain.java
public static void main(String[] args) throws IOException { // TODO: Move this from utils into SimulationCommands itself. SimulationCommands cmds = Utils.readCommandLine(args); SimulationOptions ops = new SimulationOptions(cmds); // Change options here. ops.checkpoint_no.set(CHECKPOINT_NUMBER); ops.thread_no.set(3);//from w w w .j a v a 2 s . com ops.assay_iteration_no.set(100); ops.burn_in_no.set(20000); ops.record_no.set(40000); ops.detailed_data.set(Boolean.TRUE); ops.walker_no.set(32); ops.pheromone_no.set(1); ops.forced_run.set(Boolean.TRUE); ops.initial_conditions.set(makeCustomInitialConditions()); ops.animal_zoo.set(makeCustomAnimalZoo(ops)); // TODO: Add in the options for additional tracked values. if (ops.isMissingParameters()) { String msg = "Missing Parameters: " + ops.getMissingParametersList(); LOG.log(Level.SEVERE, msg); System.exit(-1); } else { new Simulation(ops, new TrackedCalculation("Fitness", ops) { @Override protected double added(SimulationThread.SamplingInterface p_iface, AnimalGroup p_group, double p_prev_value) { return p_prev_value + (p_group.getAnimalStage().toString().contains("Dauer") ? p_group.getCount() : 0.0); } @Override protected double end(SimulationThread.SamplingInterface p_iface, double p_prev_value) { return Math.pow(p_prev_value, 2); } @Override protected double ended(SimulationThread.SamplingInterface p_iface, AnimalGroup p_group, double p_prev_value) { return p_prev_value; } @Override protected double initialise(RandomGenerator p_rng) { return 0.0; } @Override protected double removed(SimulationThread.SamplingInterface p_iface, AnimalGroup p_group, double p_prev_value) { return p_prev_value; } }, new TrackedCalculation[] { new TrackedCalculation("Dauers", ops) { @Override protected double added(SimulationThread.SamplingInterface p_iface, AnimalGroup p_group, double p_prev_value) { return p_prev_value + (p_group.getAnimalStage().toString().contains("Dauer") ? p_group.getCount() : 0.0); } @Override protected double end(SimulationThread.SamplingInterface p_iface, double p_prev_value) { return p_prev_value; } @Override protected double ended(SimulationThread.SamplingInterface p_iface, AnimalGroup p_group, double p_prev_value) { return p_prev_value; } @Override protected double initialise(RandomGenerator p_rng) { return 0.0; } @Override protected double removed(SimulationThread.SamplingInterface p_iface, AnimalGroup p_group, double p_prev_value) { return p_prev_value; } } }).run(); } }
From source file:jparser.JParser.java
/** * @param args the command line arguments *///from w w w . j a v a2 s.c om public static void main(String[] args) { Options options = new Options(); CommandLineParser parser = new DefaultParser(); options.addOption( Option.builder().longOpt("to").desc("Indica el tipo de archivo al que debera convertir: JSON / XML") .hasArg().argName("tipo").build()); options.addOption(Option.builder().longOpt("path") .desc("Indica la ruta donde se encuentra el archivo origen").hasArg().argName("origen").build()); options.addOption( Option.builder().longOpt("target").desc("Indica la ruta donde se guardara el archivo resultante") .hasArg().argName("destino").build()); options.addOption("h", "help", false, "Muestra la guia de como usar la aplicacion"); try { CommandLine command = parser.parse(options, args); Path source = null; Path target = null; FactoryFileParse.TypeParce type = FactoryFileParse.TypeParce.NULL; Optional<Customer> customer = Optional.empty(); if (command.hasOption("h")) { HelpFormatter helper = new HelpFormatter(); helper.printHelp("JParser", options); System.exit(0); } if (command.hasOption("to")) type = FactoryFileParse.TypeParce.fromValue(command.getOptionValue("to", "")); if (command.hasOption("path")) source = Paths.get(command.getOptionValue("path", "")); if (command.hasOption("target")) target = Paths.get(command.getOptionValue("target", "")); switch (type) { case JSON: customer = FactoryFileParse.createNewInstance(FactoryFileParse.TypeParce.XML).read(source); break; case XML: customer = FactoryFileParse.createNewInstance(FactoryFileParse.TypeParce.JSON).read(source); break; } if (customer.isPresent()) { Customer c = customer.get(); boolean success = FactoryFileParse.createNewInstance(type).write(c, target); System.out.println(String.format("Operatation was: %s", success ? "success" : "fails")); } } catch (ParseException ex) { Logger.getLogger(JParser.class.getSimpleName()).log(Level.SEVERE, ex.getMessage(), ex); System.exit(-1); } }
From source file:com.mmone.gpdati.config.GpDatiDbRoomMap.java
public static void main(String[] args) { Database db = new Database("D:/tmp_desktop/scrigno-gpdati/data/gpdati.db"); GpDatiDbRoomMap m = new GpDatiDbRoomMap(db); //MapUtils.debugPrint(System.out, "Rooms map", m); try {//from www. j a v a 2 s . co m m.insert("zzzs1e", "zezzs1"); } catch (SQLException ex) { Logger.getLogger(GpDatiDbRoomMap.class.getName()).log(Level.SEVERE, ex.getMessage()); //Logger.getLogger(GpDatiDbRoomMap.class.getName()).log(Level.SEVERE, null, ex); } try { db.shutDown(); } catch (SQLException ex) { Logger.getLogger(GpDatiDbRoomMap.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.mycompany.cassandrajavaclient.XmlParser.java
public static void main(String[] args) { try {//from ww w. jav a 2 s. c o m Handler handler = new FileHandler(); Logger.getLogger("Eric").addHandler(handler); try { String filename = "/home/eric/NetBeansProjects/nickel/echantillon/Arkea/Arkea Sepa fichiers entrants/SCTSE_20160304T054638.XML"; XmlParser parser = new XmlParser(); SCTHandler sctHandler = new SCTHandler(); parser.connect(sctHandler); parser.read(filename); } catch (IOException ex) { Logger.getLogger(XmlParser.class.getName()).log(Level.SEVERE, null, ex); } } catch (IOException | SecurityException ex) { Logger.getLogger(XmlParser.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:chanupdater.ChanUpdater.java
/** * @param args the command line arguments *//*from ww w . java2 s.com*/ public static void main(String[] args) { try { ChanUpdater me = new ChanUpdater(); me.doit(args); } catch (Exception ex) { Logger.getLogger(ChanUpdater.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:di.uniba.it.tee2.search.Search.java
/** * language maindir query temp_query/* w ww . j av a 2 s .co m*/ * * @param args the command line arguments */ public static void main(String[] args) { try { CommandLine cmd = cmdParser.parse(options, args); if (cmd.hasOption("l") && cmd.hasOption("d") && cmd.hasOption("q")) { try { TemporalExtractor te = new TemporalExtractor(cmd.getOptionValue("l")); te.init(); TemporalEventSearch search = new TemporalEventSearch(cmd.getOptionValue("d"), te); search.init(); List<SearchResult> res = search.search(cmd.getOptionValue("q"), cmd.getOptionValue("t", ""), 100); for (SearchResult r : res) { System.out.println(r); } search.close(); te.close(); } catch (Exception ex) { Logger.getLogger(Search.class.getName()).log(Level.SEVERE, null, ex); } } else { HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.printHelp("Run searching", options, true); } } catch (ParseException ex) { Logger.getLogger(Search.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.openx.oauthdemo.Demo.java
/** * Main class. OX3 with OAuth demo/*from w ww . j av a2 s . c om*/ * @param args */ public static void main(String[] args) { String apiKey, apiSecret, loginUrl, username, password, domain, path, requestTokenUrl, accessTokenUrl, realm, authorizeUrl; String propertiesFile = "default.properties"; // load params from the properties file Properties defaultProps = new Properties(); InputStream in = null; try { ClassLoader cl = ClassLoader.getSystemClassLoader(); in = cl.getResourceAsStream(propertiesFile); if (in != null) { defaultProps.load(in); } } catch (IOException ex) { System.out.println("The properties file was not found!"); return; } finally { if (in != null) { try { in.close(); } catch (IOException ex) { System.out.println("IO Error closing the properties file"); return; } } } if (defaultProps.isEmpty()) { System.out.println("The properties file was not loaded!"); return; } apiKey = defaultProps.getProperty("apiKey"); apiSecret = defaultProps.getProperty("apiSecret"); loginUrl = defaultProps.getProperty("loginUrl"); username = defaultProps.getProperty("username"); password = defaultProps.getProperty("password"); domain = defaultProps.getProperty("domain"); path = defaultProps.getProperty("path"); requestTokenUrl = defaultProps.getProperty("requestTokenUrl"); accessTokenUrl = defaultProps.getProperty("accessTokenUrl"); realm = defaultProps.getProperty("realm"); authorizeUrl = defaultProps.getProperty("authorizeUrl"); // log in to the server Client cl = new Client(apiKey, apiSecret, loginUrl, username, password, domain, path, requestTokenUrl, accessTokenUrl, realm, authorizeUrl); try { // connect to the server cl.OX3OAuth(); } catch (UnsupportedEncodingException ex) { Logger.getLogger(Demo.class.getName()).log(Level.SEVERE, "UTF-8 support needed for OAuth", ex); } catch (IOException ex) { Logger.getLogger(Demo.class.getName()).log(Level.SEVERE, "IO file reading error", ex); } catch (Exception ex) { Logger.getLogger(Demo.class.getName()).log(Level.SEVERE, "API issue", ex); } // now lets make a call to the api to check String json; try { json = cl.getHelper().callOX3Api(domain, path, "account"); } catch (IOException ex) { System.out.println("There was an error calling the API"); return; } System.out.println("JSON response: " + json); Gson gson = new Gson(); int[] accounts = gson.fromJson(json, int[].class); if (accounts.length > 0) { // let's get a single account try { json = cl.getHelper().callOX3Api(domain, path, "account", accounts[0]); } catch (IOException ex) { System.out.println("There was an error calling the API"); return; } System.out.println("JSON response: " + json); OX3Account account = gson.fromJson(json, OX3Account.class); System.out.println("Account id: " + account.getId() + " name: " + account.getName()); } }
From source file:cz.muni.fi.mir.mathmlcanonicalization.MathMLCanonicalizerCommandLineTool.java
/** * @param args the command line arguments *//*from ww w. j a v a2s. com*/ public static void main(String[] args) throws FileNotFoundException, XMLStreamException { final Options options = new Options(); options.addOption("c", true, "load configuration file"); options.addOption("dtd", false, "enforce injection of XHTML + MathML 1.1 DTD reference into input documents"); options.addOption("w", false, "overwrite input files by canonical outputs"); options.addOption("h", false, "print help"); final CommandLineParser parser = new PosixParser(); CommandLine line = null; try { line = parser.parse(options, args); } catch (ParseException ex) { printHelp(options); System.exit(1); } File config = null; boolean overwrite = false; boolean dtdInjectionMode = false; if (line != null) { if (line.hasOption('c')) { config = new File(args[1]); } if (line.hasOption("dtd")) { dtdInjectionMode = true; } if (line.hasOption('w')) { overwrite = true; } if (line.hasOption('h')) { printHelp(options); System.exit(0); } final List<String> arguments = Arrays.asList(line.getArgs()); if (arguments.size() > 0) { for (String arg : arguments) { try { List<File> files = getFiles(new File(arg)); for (File file : files) { canonicalize(file, config, dtdInjectionMode, overwrite); } } catch (IOException ex) { Logger.getLogger(MathMLCanonicalizerCommandLineTool.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); } catch (ConfigException ex) { Logger.getLogger(MathMLCanonicalizerCommandLineTool.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); } catch (JDOMException ex) { Logger.getLogger(MathMLCanonicalizerCommandLineTool.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); } catch (ModuleException ex) { Logger.getLogger(MathMLCanonicalizerCommandLineTool.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); } } } else { printHelp(options); System.exit(0); } } }
From source file:com.quix.aia.cn.imo.mapper.UrlForUserData.java
public static void main(String[] args) { // TODO Auto-generated method stub UserAuthResponds userAuth = new UserAuthResponds(); try {/*from ww w. j av a 2s. c o m*/ GsonBuilder builder = new GsonBuilder(); DefaultHttpClient httpClient = new DefaultHttpClient(); String username = "", psw = "", co = ""; username = "NSNP306"; psw = "A111111A"; co = "0986"; HttpGet getRequest = new HttpGet("http://211.144.219.243/isp/rest/index.do?isAjax=true&account=" + username + "&co=" + co + "&password=" + psw + ""); getRequest.addHeader("accept", "application/json"); HttpResponse response = httpClient.execute(getRequest); if (response.getStatusLine().getStatusCode() != 200) { throw new RuntimeException( "Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); } BufferedReader br = new BufferedReader(new InputStreamReader((response.getEntity().getContent()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { System.out.println(output); Gson googleJson = new Gson(); userAuth = googleJson.fromJson(output, UserAuthResponds.class); System.out.println("Success " + userAuth.getSuccess()); if (userAuth.getSuccess().equals("1")) { System.out.println("Login successfully Done"); } else { System.out.println("Login Failed "); } } httpClient.getConnectionManager().shutdown(); // googleJson = builder.create(); // Type listType = new TypeToken<List<UserAuthResponds>>() {}.getType(); } catch (ClientProtocolException e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); } catch (IOException e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); } }
From source file:isc_415_practica_1.ISC_415_Practica_1.java
/** * @param args the command line arguments */// www . j a v a 2 s . c o m public static void main(String[] args) { String urlString; Scanner input = new Scanner(System.in); Document doc; try { urlString = input.next(); if (urlString.equals("servlet")) { urlString = "http://localhost:8084/ISC_415_Practica1_Servlet/client"; } urlString = urlString.contains("http://") || urlString.contains("https://") ? urlString : "http://" + urlString; doc = Jsoup.connect(urlString).get(); } catch (Exception ex) { System.out.println("El URL ingresado no es valido."); return; } ArrayList<NameValuePair> formInputParams; formInputParams = new ArrayList<>(); String[] plainTextDoc = new TextNode(doc.html(), "").getWholeText().split("\n"); System.out.println(String.format("Nmero de lineas del documento: %d", plainTextDoc.length)); System.out.println(String.format("Nmero de p tags: %d", doc.select("p").size())); System.out.println(String.format("Nmero de img tags: %d", doc.select("img").size())); System.out.println(String.format("Nmero de form tags: %d", doc.select("form").size())); Integer index = 1; ArrayList<NameValuePair> urlParameters = new ArrayList<>(); for (Element e : doc.select("form")) { System.out.println(String.format("Form %d: Nmero de Input tags %d", index, e.select("input").size())); System.out.println(e.select("input")); for (Element formInput : e.select("input")) { if (formInput.attr("id") != null && formInput.attr("id") != "") { urlParameters.add(new BasicNameValuePair(formInput.attr("id"), "PRACTICA1")); } else if (formInput.attr("name") != null && formInput.attr("name") != "") { urlParameters.add(new BasicNameValuePair(formInput.attr("name"), "PRACTICA1")); } } index++; } if (!urlParameters.isEmpty()) { try { CloseableHttpClient httpclient = HttpClients.createDefault(); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(urlParameters, Consts.UTF_8); HttpPost httpPost = new HttpPost(urlString); httpPost.setHeader("User-Agent", USER_AGENT); httpPost.setEntity(entity); HttpResponse response = httpclient.execute(httpPost); System.out.println(response.getStatusLine()); } catch (IOException ex) { Logger.getLogger(ISC_415_Practica_1.class.getName()).log(Level.SEVERE, null, ex); } } }