private void readConfigure() throws FileNotFoundException { ConfigureManager configureManager = new ConfigureManager(); AccountManager accountManager = new AccountManager(); ProblemManager problemManager = new ProblemManager(); SubmissionManager submissionManager = new SubmissionManager(); QAManager qaManager = new QAManager(); ClarificationManager clarificationManager = new ClarificationManager(); Map<String, String> config = new HashMap<String, String>(); configureManager.createTable(); accountManager.createTable(); problemManager.createTable(); submissionManager.createTable(); qaManager.createTable(); clarificationManager.createTable(); this.port = 8888; this.scoreBoardPort = 8889; // default port File file = new File("config.txt"); try (BufferedReader br = new BufferedReader(new FileReader(file))) { String line; while ((line = br.readLine()) != null) { String[] sp = line.split(":"); if (sp[0].equals("port")) this.port = Integer.valueOf(sp[1]); else if (sp[0].equals("scoreboardport")) this.scoreBoardPort = Integer.valueOf(sp[1]); else if (sp[0].equals("team")) { readTeamAccount(sp[1]); } else if (sp[0].equals("judge")) { readJudgeAccount(sp[1]); } else if (sp[0].equals("problem")) { readProblemInfo(sp[1]); } } } catch (IOException e) { e.printStackTrace(); System.exit(1); } config.put("ip", this.ip.getHostAddress()); config.put("port", Integer.toString(this.port)); config.put("scoreboard_port", Integer.toString(this.scoreBoardPort)); config.put("start_time", "0"); config.put("duration", "300"); config.put("time_stamp", "0"); configureManager.addEntry(config); }
public void rejudgeProblem(String problemID) { SubmissionManager submissionManager = new SubmissionManager(); for (Map<String, String> ent : submissionManager.rejudge(problemID)) { try { ProblemManager problemManager = new ProblemManager(); Map<String, String> pb = problemManager.getProblemById(problemID); JSONObject msg = new JSONObject(); msg.put("msg_type", "submit"); msg.put("submission_id", ent.get("submission_id")); msg.put("problem_id", ent.get("problem_id")); msg.put("language", ent.get("language")); msg.put("source_code", ent.get("source_code")); msg.put("time_stamp", ent.get("submission_time_stamp")); msg.put("testdata_time_stamp", pb.get("time_stamp")); Core.getInstance().getScheduler().add(msg); } catch (JSONException e) { e.printStackTrace(); } } }