List of usage examples for java.text DateFormat format
public final String format(Date date)
From source file:Main.java
public static void main(String[] args) { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:00Z"); Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, 2015); cal.set(Calendar.MONTH, Calendar.SEPTEMBER); cal.set(Calendar.DATE, 1);//from ww w. j ava 2 s.com cal.set(Calendar.HOUR_OF_DAY, 12); cal.set(Calendar.MINUTE, 15); Date date = cal.getTime(); System.out.println(date); TimeZone tz = TimeZone.getTimeZone("IST"); dateFormat.setTimeZone(tz); String actual = dateFormat.format(date); System.out.println(actual); }
From source file:MainClass.java
public static void main(String[] args) { Date today = new Date(); Locale[] locales = { Locale.US, Locale.UK, Locale.GERMANY, Locale.FRANCE }; int[] styles = { DateFormat.FULL, DateFormat.LONG, DateFormat.MEDIUM, DateFormat.SHORT }; DateFormat fmt; String[] styleText = { "FULL", "LONG", "MEDIUM", "SHORT" }; // Output the date for each local in four styles for (int i = 0; i < locales.length; i++) { System.out.println("\nThe Date for " + locales[i].getDisplayCountry() + ":"); for (int j = 0; j < styles.length; j++) { fmt = DateFormat.getDateInstance(styles[j], locales[i]); System.out.println("\tIn " + styleText[j] + " is " + fmt.format(today)); }// w w w . j av a 2 s . co m } }
From source file:at.asitplus.regkassen.demo.RKSVCashboxSimulator.java
public static void main(String[] args) { try {// w ww . j a va2 s . com //IMPORTANT HINT REGARDING STRING ENCODING //in Java all Strings have UTF-8 as default encoding //therefore: there are only a few references to UTF-8 encoding in this demo code //however, if values are retrieved from a database or another program language is used, then one needs to //make sure that the UTF-8 encoding is correctly implemented //this demo cashbox does not implement error handling //it should only demonstrate the core elements of the RKSV and any boilerplate code is avoided as much as possible //if an error occurs, only the stacktraces are logged //obviously this needs to be adapted in a productive cashbox //---------------------------------------------------------------------------------------------------- //basic inits //add bouncycastle provider Security.addProvider(new BouncyCastleProvider()); //---------------------------------------------------------------------------------------------------- //check if unlimited strength policy files are installed, they are required for strong crypto algorithms ==> AES 256 if (!CryptoUtil.isUnlimitedStrengthPolicyAvailable()) { System.out.println( "Your JVM does not provide the unlimited strength policy. However, this policy is required to enable strong cryptography (e.g. AES with 256 bits). Please install the required policy files."); System.exit(0); } //---------------------------------------------------------------------------------------------------- //parse cmd line options Options options = new Options(); // add CMD line options options.addOption("o", "output-dir", true, "specify base output directory, if none is specified, a new directory will be created in the current working directory"); //options.addOption("i", "simulation-file-or-directory", true, "cashbox simulation (file) or multiple cashbox simulation files (directory), if none is specified the internal test suites will be executed (can also be considered as demo mode)"); options.addOption("v", "verbose", false, "dump demo receipts to cmd line"); options.addOption("c", "closed system", false, "simulate closed system"); ///parse CMD line options CommandLineParser parser = new DefaultParser(); CommandLine cmd = parser.parse(options, args); //setup inputs from cmd line //verbose VERBOSE = cmd.hasOption("v"); CLOSED_SYSTEM = cmd.hasOption("c"); //output directory String outputParentDirectoryString = cmd.getOptionValue("o"); if (outputParentDirectoryString == null) { DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH-mm-ss"); outputParentDirectoryString = "./CashBoxDemoOutput" + df.format(new Date()); } File OUTPUT_PARENT_DIRECTORY = new File(outputParentDirectoryString); OUTPUT_PARENT_DIRECTORY.mkdirs(); //---------------------------------------------------------------------------------------------------- //external simulation runs... not implemented yet, currently only the internal test suites can be executed //String simulationFileOrDirectoryPath = cmd.getOptionValue("i"); //handling of arbitrary input simulation files will be possible in 0.7 //if (simulationFileOrDirectoryPath == null) { //} else { // File simulationFileOrDirectory = new File(simulationFileOrDirectoryPath); // cashBoxSimulationList = readCashBoxSimulationFromFile(simulationFileOrDirectory); //} List<CashBoxSimulation> cashBoxSimulationList = TestSuiteGenerator.getSimulationRuns(); //setup simulation and execute int index = 1; for (CashBoxSimulation cashboxSimulation : cashBoxSimulationList) { System.out.println("Executing simulation run " + index + "/" + cashBoxSimulationList.size()); System.out.println("Simulation run: " + cashboxSimulation.getSimulationRunLabel()); index++; File testSetDirectory = new File(OUTPUT_PARENT_DIRECTORY, cashboxSimulation.getSimulationRunLabel()); testSetDirectory.mkdirs(); CashBoxParameters cashBoxParameters = new CashBoxParameters(); cashBoxParameters.setCashBoxId(cashboxSimulation.getCashBoxId()); cashBoxParameters.setTurnOverCounterAESKey( CryptoUtil.convertBase64KeyToSecretKey(cashboxSimulation.getBase64AesKey())); cashBoxParameters.setDepModul(new SimpleMemoryDEPModule()); cashBoxParameters.setPrinterModule(new SimplePDFPrinterModule()); cashBoxParameters.setCompanyID(cashboxSimulation.getCompanyID()); //create pre-defined number of signature devices for (int i = 0; i < cashboxSimulation.getNumberOfSignatureDevices(); i++) { JWSModule jwsModule = new ManualJWSModule(); SignatureModule signatureModule; if (!CLOSED_SYSTEM) { signatureModule = new NEVER_USE_IN_A_REAL_SYSTEM_SoftwareCertificateOpenSystemSignatureModule( RKSuite.R1_AT100, null); } else { signatureModule = new NEVER_USE_IN_A_REAL_SYSTEM_SoftwareKeySignatureModule( cashboxSimulation.getCompanyID() + "-" + "K" + i); } jwsModule.setOpenSystemSignatureModule(signatureModule); cashBoxParameters.getJwsSignatureModules().add(jwsModule); } //init cashbox DemoCashBox demoCashBox = new DemoCashBox(cashBoxParameters); //exceute simulation run demoCashBox.executeSimulation(cashboxSimulation.getCashBoxInstructionList()); //---------------------------------------------------------------------------------------------------- //export DEP DEPExportFormat depExportFormat = demoCashBox.exportDEP(); //get JSON rep and dump export format to file/std output File depExportFile = new File(testSetDirectory, "dep-export.json"); dumpJSONRepOfObject(depExportFormat, depExportFile, true, "------------DEP-EXPORT-FORMAT------------"); //---------------------------------------------------------------------------------------------------- //store signature certificates and AES key (so that they can be used for verification purposes) CryptographicMaterialContainer cryptographicMaterialContainer = new CryptographicMaterialContainer(); HashMap<String, CertificateOrPublicKeyContainer> certificateContainerMap = new HashMap<>(); cryptographicMaterialContainer.setCertificateOrPublicKeyMap(certificateContainerMap); //store AES key as BASE64 String //ATTENTION, this is only for demonstration purposes, the AES key must be stored in a secure location cryptographicMaterialContainer.setBase64AESKey(cashboxSimulation.getBase64AesKey()); List<JWSModule> jwsSignatureModules = demoCashBox.getCashBoxParameters().getJwsSignatureModules(); for (JWSModule jwsSignatureModule : jwsSignatureModules) { CertificateOrPublicKeyContainer certificateOrPublicKeyContainer = new CertificateOrPublicKeyContainer(); certificateOrPublicKeyContainer.setId(jwsSignatureModule.getSerialNumberOfKeyID()); certificateContainerMap.put(jwsSignatureModule.getSerialNumberOfKeyID(), certificateOrPublicKeyContainer); X509Certificate certificate = (X509Certificate) jwsSignatureModule.getSignatureModule() .getSigningCertificate(); if (certificate == null) { //must be public key based... (closed system) PublicKey publicKey = jwsSignatureModule.getSignatureModule().getSigningPublicKey(); certificateOrPublicKeyContainer.setSignatureCertificateOrPublicKey( CashBoxUtils.base64Encode(publicKey.getEncoded(), false)); certificateOrPublicKeyContainer.setSignatureDeviceType(SignatureDeviceType.PUBLIC_KEY); } else { certificateOrPublicKeyContainer.setSignatureCertificateOrPublicKey( CashBoxUtils.base64Encode(certificate.getEncoded(), false)); certificateOrPublicKeyContainer.setSignatureDeviceType(SignatureDeviceType.CERTIFICATE); } } File cryptographicMaterialContainerFile = new File(testSetDirectory, "cryptographicMaterialContainer.json"); dumpJSONRepOfObject(cryptographicMaterialContainer, cryptographicMaterialContainerFile, true, "------------CRYPTOGRAPHIC MATERIAL------------"); //---------------------------------------------------------------------------------------------------- //export QR codes to file //dump machine readable code of receipts (this "code" is used for the QR-codes) //REF TO SPECIFICATION: Detailspezifikation/Abs 12 //dump to File File qrCoreRepExportFile = new File(testSetDirectory, "qr-code-rep.json"); List<ReceiptPackage> receiptPackages = demoCashBox.getStoredReceipts(); List<String> qrCodeRepList = new ArrayList<>(); for (ReceiptPackage receiptPackage : receiptPackages) { qrCodeRepList.add(CashBoxUtils.getQRCodeRepresentationFromJWSCompactRepresentation( receiptPackage.getJwsCompactRepresentation())); } dumpJSONRepOfObject(qrCodeRepList, qrCoreRepExportFile, true, "------------QR-CODE-REP------------"); //---------------------------------------------------------------------------------------------------- //export OCR codes to file //dump machine readable code of receipts (this "code" is used for the OCR-codes) //REF TO SPECIFICATION: Detailspezifikation/Abs 14 //dump to File File ocrCoreRepExportFile = new File(testSetDirectory, "ocr-code-rep.json"); List<String> ocrCodeRepList = new ArrayList<>(); for (ReceiptPackage receiptPackage : receiptPackages) { ocrCodeRepList.add(CashBoxUtils.getOCRCodeRepresentationFromJWSCompactRepresentation( receiptPackage.getJwsCompactRepresentation())); } dumpJSONRepOfObject(ocrCodeRepList, ocrCoreRepExportFile, true, "------------OCR-CODE-REP------------"); //---------------------------------------------------------------------------------------------------- //create PDF receipts and print to directory //REF TO SPECIFICATION: Detailspezifikation/Abs 12 File qrCodeDumpDirectory = new File(testSetDirectory, "qr-code-dir-pdf"); qrCodeDumpDirectory.mkdirs(); List<byte[]> printedQRCodeReceipts = demoCashBox.printReceipt(receiptPackages, ReceiptPrintType.QR_CODE); CashBoxUtils.writeReceiptsToFiles(printedQRCodeReceipts, "QR-", qrCodeDumpDirectory); //---------------------------------------------------------------------------------------------------- //export receipts as PDF (OCR) //REF TO SPECIFICATION: Detailspezifikation/Abs 14 File ocrCodeDumpDirectory = new File(testSetDirectory, "ocr-code-dir-pdf"); ocrCodeDumpDirectory.mkdirs(); List<byte[]> printedOCRCodeReceipts = demoCashBox.printReceipt(receiptPackages, ReceiptPrintType.OCR); CashBoxUtils.writeReceiptsToFiles(printedOCRCodeReceipts, "OCR-", ocrCodeDumpDirectory); //---------------------------------------------------------------------------------------------------- //dump executed testsuite File testSuiteDumpFile = new File(testSetDirectory, cashboxSimulation.getSimulationRunLabel() + ".json"); dumpJSONRepOfObject(cashboxSimulation, testSuiteDumpFile, true, "------------CASHBOX Simulation------------"); } } catch (CertificateEncodingException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } }
From source file:it.isislab.dmason.util.SystemManagement.Worker.thrower.DMasonWorkerWithGui.java
public static void main(String[] args) { RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean(); //// www.j a v a 2 s.c om // Get name representing the running Java virtual machine. // It returns something like 6460@AURORA. Where the value // before the @ symbol is the PID. // String jvmName = bean.getName(); //Used for log4j properties System.setProperty("logfile.name", "worker" + jvmName); //Used for log4j properties System.setProperty("steplog.name", "workerStep" + jvmName); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH_mm_ss_SS"); Date date = new Date(); dateFormat.format(date); System.setProperty("timestamp", date.toLocaleString()); System.setProperty("paramsfile.name", "params"); try { File logPath = new File("Logs/workers"); if (logPath.exists()) FileUtils.cleanDirectory(logPath); } catch (IOException e) { //not a problem } logger = Logger.getLogger(DMasonWorker.class.getCanonicalName()); logger.debug("StartWorker " + VERSION); autoStart = false; String ip = null; String port = null; String topic = ""; updated = false; isBatch = false; topicPrefix = ""; // ip, post, autoconnect if (args.length == 3) { ip = args[0]; port = args[1]; if (args[2].equals("autoconnect")) { autoStart = true; } } // ip, post, topic, event if (args.length == 4) { autoStart = true; if (args[3].equals("update")) { updated = true; } if (args[3].equals("reset")) { updated = false; isBatch = false; } if (args[3].contains("Batch")) { updated = false; isBatch = true; topicPrefix = args[3]; } ip = args[0]; port = args[1]; topic = args[2]; } /*if(args.length == 2 && args[0].equals("auto")) { autoStart = true; updated = true; topic = args[1]; } if(args.length == 1 && args[0].equals("auto")) { autoStart = true; }*/ new DMasonWorkerWithGui(autoStart, updated, isBatch, topic, ip, port); }
From source file:com.radvision.icm.service.vcm.ICMService.java
public static void main(String[] args) { long currTime = System.currentTimeMillis(); // long tmpTime = currTime - 24 * 60 * 60 * 1000; Date dt = new Date(currTime); // Calendar cal = Calendar.getInstance(); // cal.setTime(dt); // System.out.println(cal); DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); String s = df.format(dt); System.out.println(s);//from w w w . j a v a 2s. co m try { Date dtNew = df.parse(s); long newTime = dtNew.getTime(); long minutes = (currTime - newTime) / (1000 * 60); System.out.println(minutes / 60 + ":" + minutes % 60); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:com.zuora.api.UsageAdjInvoiceRegenerator.java
public static void main(String[] args) { String exportIdPRPC, exportIdII, exportFileIdII, exportFileIdPRPC, queryII, queryPRPC; boolean hasArgs = false; if (args != null && args.length >= 1) { UsageAdjInvoiceRegenerator.PROPERTY_FILE_NAME = args[0]; hasArgs = true;/*from www. j a va 2 s . co m*/ } AppParamManager.initParameters(hasArgs); if (!AppParamManager.TASK_ID.equals("")) { try { zApiClient = new ApiClient(AppParamManager.API_URL, AppParamManager.USER_NAME, AppParamManager.USER_PASSWORD, AppParamManager.USER_SESSION); zApiClient.login(); } catch (Exception ex) { Logger.print(ex); Logger.print("RefreshSession - There's exception in the API call."); } queryPRPC = AppParamManager.PRPCexportQuery; queryII = AppParamManager.IIexportQuery; exportIdPRPC = zApiClient.createExport(queryPRPC); exportIdII = zApiClient.createExport(queryII); // ERROR createExport fails if (exportIdII == null || exportIdII.equals("")) { Logger.print("Error. Failed to create Invoice Item Export"); //return false; } // ERROR createExport fails if (exportIdPRPC == null || exportIdPRPC.equals("")) { Logger.print("Error. Failed to create PRPC export"); //return false; } exportFileIdII = zApiClient.getExportFileId(exportIdII); if (exportFileIdII == null) { Logger.print("Error. Failed to get Invoice Item Export file Id"); //log.closeLogFile(); //return false; } exportFileIdPRPC = zApiClient.getExportFileId(exportIdPRPC); if (exportFileIdPRPC == null) { Logger.print("Error. Failed to get PRPC Export file Id"); //log.closeLogFile(); //return false; } // get the export file from zuora //zApiClient.getFile(exportFileIdII, exportFileIdTI); /* Logger.print("II export ID: "+exportFileIdII); Logger.print("TI export ID: "+exportFileIdTI); */ Logger.print("Opening Export file"); //Base64 bs64 = new BASE64Encoder(); /* String login = AppParamManager.USER_NAME+":"+AppParamManager.USER_PASSWORD; String authorization ="Basic "+ Base64.encodeBase64String(login.getBytes()); String zendpoint = ""; */ String authorization = ""; //Base64 bs64 = new BASE64Encoder(); if (AppParamManager.USER_SESSION.isEmpty()) { String login = AppParamManager.USER_NAME + ":" + AppParamManager.USER_PASSWORD; authorization = "Basic " + Base64.encodeBase64String(login.getBytes()); } else { authorization = "ZSession " + AppParamManager.USER_SESSION; } String zendpoint = ""; try { /* if( AppParamManager.API_URL.contains("api") ){ //look in api sandbox zendpoint = "https://apisandbox.zuora.com/apps/api/file/"; } else { //look in production zendpoint = "https://www.zuora.com/apps/api/file/"; } */ int index = AppParamManager.API_URL.indexOf("apps"); index = index + 5; zendpoint = AppParamManager.API_URL.substring(0, index) + "api/file/"; Logger.print(zendpoint); //zendpoint = AppParamManager.FILE_URL; //Start reading Invoice Items String zendpointII = zendpoint + exportFileIdII + "/"; URL url = new URL(zendpointII); URLConnection uc = url.openConnection(); //Logger.print("Opening invoice item file: "+exportFileIdII+" authorization: "+authorization); uc.setRequestProperty("Authorization", authorization); InputStream content = (InputStream) uc.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(content)); CSVReader cvsReader = new CSVReader(in); List<String[]> batchOfRawDataList = null; while ((batchOfRawDataList = cvsReader.parseEntity()) != null) { UsageAdjInvoiceRegenerator.readInvoices(batchOfRawDataList, cvsReader.getBatchStartLineNumber(), "InvoiceItem"); } in.close(); String zenpointPRPC = zendpoint + exportFileIdPRPC + "/"; url = new URL(zenpointPRPC); uc = url.openConnection(); uc.setRequestProperty("Authorization", authorization); content = (InputStream) uc.getInputStream(); in = new BufferedReader(new InputStreamReader(content)); cvsReader = new CSVReader(in); while ((batchOfRawDataList = cvsReader.parseEntity()) != null) { UsageAdjInvoiceRegenerator.readInvoices(batchOfRawDataList, cvsReader.getBatchStartLineNumber(), "PRPCItem"); } in.close(); Logger.print("start processing values"); UsageAdjInvoiceRegenerator chargeAdjustment = new UsageAdjInvoiceRegenerator(); int[] results; int totalErrors = 0; String emailmsg = ""; Logger.print("----------------------------------------"); Logger.print("start creating usages"); results = zApiClient.createUsageItems(newUsageCollection); if (results[1] != 0) { emailmsg = (results[0] - results[1]) + "/" + results[0] + " usage creation "; } totalErrors = totalErrors + results[1]; Logger.print("start cancelling invoices"); results = zApiClient.alterInvoices(newUsageCollection, "cancel"); if (results[1] != 0) { emailmsg = (results[0] - results[1]) + "/" + results[0] + " invoice cancellation "; } totalErrors = totalErrors + results[1]; Logger.print("start deleting usages"); results = zApiClient.deleteUsageItems(deleteList); if (results[1] != 0) { emailmsg = (results[0] - results[1]) + "/" + results[0] + " usage deletion "; } totalErrors = totalErrors + results[1]; Logger.print("start regenerating invoices"); results = zApiClient.alterInvoices(newUsageCollection, "generate"); if (results[1] != 0) { emailmsg = (results[0] - results[1]) + "/" + results[0] + " invoice generation "; } totalErrors = totalErrors + results[1]; Logger.print("start deleting old invoices"); results = zApiClient.alterInvoices(newUsageCollection, "delete"); if (results[1] != 0) { emailmsg = (results[0] - results[1]) + "/" + results[0] + " invoice deletion "; } totalErrors = totalErrors + results[1]; // Create the attachment EmailAttachment attachment = new EmailAttachment(); if (totalErrors > 0) { String logFileName = AppParamManager.OUTPUT_FOLDER_LOCATION + File.separator + "runtime_log_" + AppParamManager.OUTPUT_FILE_POSTFIX + ".txt"; attachment.setPath(logFileName); attachment.setDisposition(EmailAttachment.ATTACHMENT); attachment.setDescription("System Log"); attachment.setName("System Log"); } MultiPartEmail email = new MultiPartEmail(); email.setSmtpPort(587); email.setAuthenticator( new DefaultAuthenticator(AppParamManager.EMAIL_ADDRESS, AppParamManager.EMAIL_PASSWORD)); email.setDebug(false); email.setHostName("smtp.gmail.com"); email.setFrom("zuora@gmail.com"); if (totalErrors > 0) { email.setSubject("Base Calc Processor Finished with Errors"); email.setMsg("The base calc processing has finished " + emailmsg + "records successfully."); } else { email.setSubject("Base Calc Processor Finished Successfully"); emailmsg = (results[0] - results[1]) + "/" + results[0] + " invoice "; email.setMsg("The base calc processing has finished " + emailmsg + "records successfully."); } email.setTLS(true); email.addTo(AppParamManager.RECIPIENT_ADDRESS); if (totalErrors > 0) { email.attach(attachment); } email.send(); System.out.println("Mail sent!"); if (hasArgs) { Connection conn = AppParamManager.getConnection(); Statement stmt = conn.createStatement(); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); java.util.Date date = new Date(); stmt.executeUpdate("UPDATE TASK SET STATUS = 'completed', END_TIME = '" + dateFormat.format(date) + "' WHERE ID = " + AppParamManager.TASK_ID); Utility.saveLogToDB(conn); conn.close(); } } catch (Exception e) { Logger.print("Failure, gettingFile."); Logger.print("Error getting the export file: " + e.getMessage()); //System.out.println("Error getting the export file: "+e.getMessage()); try { Connection conn = AppParamManager.getConnection(); Statement stmt = conn.createStatement(); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); java.util.Date date = new Date(); stmt.executeUpdate("UPDATE TASK SET STATUS = 'failed', END_TIME = '" + dateFormat.format(date) + "' WHERE ID = " + AppParamManager.TASK_ID); Utility.saveLogToDB(conn); conn.close(); } catch (Exception e2) { // TODO Auto-generated catch block e2.printStackTrace(); } } } else { Logger.print("No tasks in wait status"); } }
From source file:accinapdf.ACCinaPDF.java
/** * @param args the command line arguments *//* www. j a va 2 s .c o m*/ public static void main(String[] args) { controller.Logger.create(); controller.Bundle.getBundle(); if (GraphicsEnvironment.isHeadless()) { // Headless // Erro String fich; if (args.length != 1) { System.err.println(Bundle.getBundle().getString("invalidArgs")); return; } else { fich = args[0]; } try { System.out.println(Bundle.getBundle().getString("validating") + " " + fich); ArrayList<SignatureValidation> alSv = CCInstance.getInstance().validatePDF(fich, null); if (alSv.isEmpty()) { System.out.println(Bundle.getBundle().getString("notSigned")); } else { String newLine = System.getProperty("line.separator"); String toWrite = "("; int numSigs = alSv.size(); if (numSigs == 1) { toWrite += "1 " + Bundle.getBundle().getString("signature"); } else { toWrite += numSigs + " " + Bundle.getBundle().getString("signatures"); } toWrite += ")" + newLine; for (SignatureValidation sv : alSv) { toWrite += "\t" + sv.getName() + " - "; toWrite += (sv.isCertification() ? WordUtils.capitalize(Bundle.getBundle().getString("certificate")) : WordUtils.capitalize(Bundle.getBundle().getString("signed"))) + " " + Bundle.getBundle().getString("by") + " " + sv.getSignerName(); toWrite += newLine + "\t\t"; if (sv.isChanged()) { toWrite += Bundle.getBundle().getString("certifiedChangedOrCorrupted"); } else { if (sv.isCertification()) { if (sv.isValid()) { if (sv.isChanged() || !sv.isCoversEntireDocument()) { toWrite += Bundle.getBundle().getString("certifiedButChanged"); } else { toWrite += Bundle.getBundle().getString("certifiedOk"); } } else { toWrite += Bundle.getBundle().getString("changedAfterCertified"); } } else { if (sv.isValid()) { if (sv.isChanged()) { toWrite += Bundle.getBundle().getString("signedButChanged"); } else { toWrite += Bundle.getBundle().getString("signedOk"); } } else { toWrite += Bundle.getBundle().getString("signedChangedOrCorrupted"); } } } toWrite += newLine + "\t\t"; if (sv.getOcspCertificateStatus().equals(CertificateStatus.OK) || sv.getCrlCertificateStatus().equals(CertificateStatus.OK)) { toWrite += Bundle.getBundle().getString("certOK"); } else if (sv.getOcspCertificateStatus().equals(CertificateStatus.REVOKED) || sv.getCrlCertificateStatus().equals(CertificateStatus.REVOKED)) { toWrite += Bundle.getBundle().getString("certRevoked"); } else if (sv.getOcspCertificateStatus().equals(CertificateStatus.UNCHECKED) && sv.getCrlCertificateStatus().equals(CertificateStatus.UNCHECKED)) { toWrite += Bundle.getBundle().getString("certNotVerified"); } else if (sv.getOcspCertificateStatus().equals(CertificateStatus.UNCHAINED)) { toWrite += Bundle.getBundle().getString("certNotChained"); } else if (sv.getOcspCertificateStatus().equals(CertificateStatus.EXPIRED)) { toWrite += Bundle.getBundle().getString("certExpired"); } else if (sv.getOcspCertificateStatus().equals(CertificateStatus.CHAINED_LOCALLY)) { toWrite += Bundle.getBundle().getString("certChainedLocally"); } toWrite += newLine + "\t\t"; if (sv.isValidTimeStamp()) { toWrite += Bundle.getBundle().getString("validTimestamp"); } else { toWrite += Bundle.getBundle().getString("signerDateTime"); } toWrite += newLine + "\t\t"; toWrite += WordUtils.capitalize(Bundle.getBundle().getString("revision")) + ": " + sv.getRevision() + " " + Bundle.getBundle().getString("of") + " " + sv.getNumRevisions(); toWrite += newLine + "\t\t"; final DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); final SimpleDateFormat sdf = new SimpleDateFormat("Z"); if (sv.getSignature().getTimeStampToken() == null) { Calendar cal = sv.getSignature().getSignDate(); String date = sdf.format(cal.getTime().toLocaleString()); toWrite += date + " " + sdf.format(cal.getTime()) + " (" + Bundle.getBundle().getString("signerDateTimeSmall") + ")"; } else { Calendar ts = sv.getSignature().getTimeStampDate(); String date = df.format(ts.getTime()); toWrite += Bundle.getBundle().getString("date") + " " + date + " " + sdf.format(ts.getTime()); } toWrite += newLine + "\t\t"; boolean ltv = (sv.getOcspCertificateStatus() == CertificateStatus.OK || sv.getCrlCertificateStatus() == CertificateStatus.OK); toWrite += Bundle.getBundle().getString("isLtv") + ": " + (ltv ? Bundle.getBundle().getString("yes") : Bundle.getBundle().getString("no")); String reason = sv.getSignature().getReason(); toWrite += newLine + "\t\t"; toWrite += Bundle.getBundle().getString("reason") + ": "; if (reason == null) { toWrite += Bundle.getBundle().getString("notDefined"); } else if (reason.isEmpty()) { toWrite += Bundle.getBundle().getString("notDefined"); } else { toWrite += reason; } String location = sv.getSignature().getLocation(); toWrite += newLine + "\t\t"; toWrite += Bundle.getBundle().getString("location") + ": "; if (location == null) { toWrite += Bundle.getBundle().getString("notDefined"); } else if (location.isEmpty()) { toWrite += Bundle.getBundle().getString("notDefined"); } else { toWrite += location; } toWrite += newLine + "\t\t"; toWrite += Bundle.getBundle().getString("allowsChanges") + ": "; try { int certLevel = CCInstance.getInstance().getCertificationLevel(sv.getFilename()); if (certLevel == PdfSignatureAppearance.CERTIFIED_FORM_FILLING) { toWrite += Bundle.getBundle().getString("onlyAnnotations"); } else if (certLevel == PdfSignatureAppearance.CERTIFIED_FORM_FILLING_AND_ANNOTATIONS) { toWrite += Bundle.getBundle().getString("annotationsFormFilling"); } else if (certLevel == PdfSignatureAppearance.CERTIFIED_NO_CHANGES_ALLOWED) { toWrite += Bundle.getBundle().getString("no"); } else { toWrite += Bundle.getBundle().getString("yes"); } } catch (IOException ex) { controller.Logger.getLogger().addEntry(ex); } toWrite += newLine + "\t\t"; if (sv.getOcspCertificateStatus() == CertificateStatus.OK || sv.getCrlCertificateStatus() == CertificateStatus.OK) { toWrite += (Bundle.getBundle().getString("validationCheck1") + " " + (sv.getOcspCertificateStatus() == CertificateStatus.OK ? Bundle.getBundle().getString("validationCheck2") + ": " + CCInstance.getInstance().getCertificateProperty( sv.getSignature().getOcsp().getCerts()[0].getSubject(), "CN") + " " + Bundle.getBundle().getString("at") + " " + df.format(sv.getSignature().getOcsp().getProducedAt()) : (sv.getCrlCertificateStatus() == CertificateStatus.OK ? "CRL" : "")) + (sv.getSignature().getTimeStampToken() != null ? Bundle.getBundle().getString("validationCheck3") + ": " + CCInstance.getInstance() .getCertificateProperty(sv.getSignature() .getTimeStampToken().getSID().getIssuer(), "O") : "")); } else if (sv.getSignature().getTimeStampToken() != null) { toWrite += (Bundle.getBundle().getString("validationCheck3") + ": " + CCInstance.getInstance().getCertificateProperty( sv.getSignature().getTimeStampToken().getSID().getIssuer(), "O")); } toWrite += newLine; } System.out.println(toWrite); System.out.println(Bundle.getBundle().getString("validationFinished")); } } catch (IOException | DocumentException | GeneralSecurityException ex) { System.err.println(Bundle.getBundle().getString("validationError")); Logger.getLogger(ACCinaPDF.class.getName()).log(Level.SEVERE, null, ex); } } else { // GUI CCSignatureSettings defaultSettings = new CCSignatureSettings(false); if (SystemUtils.IS_OS_WINDOWS) { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Windows".equals(info.getName())) { try { UIManager.setLookAndFeel(info.getClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { Logger.getLogger(ACCinaPDF.class.getName()).log(Level.SEVERE, null, ex); } break; } } } else if (SystemUtils.IS_OS_LINUX) { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { try { UIManager.setLookAndFeel(info.getClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { Logger.getLogger(ACCinaPDF.class.getName()).log(Level.SEVERE, null, ex); } break; } } } else if (SystemUtils.IS_OS_MAC_OSX) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.mac.MacLookAndFeel"); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { Logger.getLogger(ACCinaPDF.class.getName()).log(Level.SEVERE, null, ex); } } new SplashScreen().setVisible(true); } }
From source file:eu.smartfp7.foursquare.AttendanceCrawler.java
/** * The main takes an undefined number of cities as arguments, then initializes * the specific crawling of all the trending venues of these cities. * The trending venues must have been previously identified using the `DownloadPages` * program.//from w ww.ja v a 2s . com * * Current valid cities are: london, amsterdam, goldcoast, sanfrancisco. * */ public static void main(String[] args) throws Exception { Settings settings = Settings.getInstance(); String folder = settings.getFolder(); // We keep info and error logs, so that we know what happened in case // of incoherence in the time series. Map<String, FileWriter> info_logs = new HashMap<String, FileWriter>(); Map<String, FileWriter> error_logs = new HashMap<String, FileWriter>(); // For each city we monitor, we store the venue IDs that we got from // a previous crawl. Map<String, Collection<String>> city_venues = new HashMap<String, Collection<String>>(); // Contains the epoch time when the last API call has been made for each // venue. Ensures that we get data only once each hour. Map<String, Long> venue_last_call = new HashMap<String, Long>(); // Contains the epoch time when we last checked if time series were broken // for each city. // We do these checks once every day before the batch forecasting begins. Map<String, Long> sanity_checks = new HashMap<String, Long>(); // We also keep in memory the number of checkins for the last hour for // each venue. Map<String, Integer> venue_last_checkin = new HashMap<String, Integer>(); Map<Long, Integer> APICallsCount = new HashMap<Long, Integer>(); DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); int total_venues = 0; long total_calls = 0; long time_spent_on_API = 0; for (String c : args) { settings.checkFileHierarchy(c); city_venues.put(c, loadVenues(c)); total_venues += city_venues.get(c).size(); info_logs.put(c, new FileWriter(folder + c + File.separator + "log" + File.separator + "info.log", true)); error_logs.put(c, new FileWriter(folder + c + File.separator + "log" + File.separator + "error.log", true)); Calendar cal = Calendar.getInstance(); info_logs.get(c).write("[" + df.format(cal.getTime()) + "] Crawler initialization for " + c + ". " + city_venues.get(c).size() + " venues loaded.\n"); info_logs.get(c).flush(); // If we interrupted the program for some reason, we can get back // the in-memory data. // Important: the program must not be interrupted for more than one // hour, or we will lose time series data. for (String venue_id : city_venues.get(c)) { String ts_file = folder + c + File.separator + "attendances_crawl" + File.separator + venue_id + ".ts"; if (new File(ts_file).exists()) { BufferedReader buffer = new BufferedReader(new FileReader(ts_file)); String mem = null, line = null; for (; (line = buffer.readLine()) != null; mem = line) ; buffer.close(); if (mem == null) continue; String[] tmp = mem.split(","); venue_last_call.put(venue_id, df.parse(tmp[0]).getTime()); venue_last_checkin.put(venue_id, Integer.parseInt(tmp[3])); VenueUtil.fixBrokenTimeSeriesVenue(new File(ts_file)); } // if } // for sanity_checks.put(c, cal.getTimeInMillis()); } // for if (total_venues > 5000) { System.out.println( "Too much venues for a single API account (max 5000).\nPlease create a new Foursquare API account and use these credentials.\nExiting now."); return; } while (true) { for (String c : args) { // We create a FIFO queue and pop venue IDs one at a time. LinkedList<String> city_venues_buffer = new LinkedList<String>(city_venues.get(c)); String venue_id = null; // Artificial wait to avoid processors looping at 100% of their capacity // when there is no more venues to crawl for the current hour. Thread.sleep(3000); while ((venue_id = city_venues_buffer.pollFirst()) != null) { // We get the current time according to the city's time zone Calendar cal = Calendar.getInstance(); cal.add(Calendar.MILLISECOND, TimeZone.getTimeZone(settings.getCityTimezone(c)).getOffset(cal.getTime().getTime()) - Calendar.getInstance().getTimeZone().getOffset(cal.getTime().getTime())); //TimeZone.getTimeZone("Europe/London").getOffset(cal.getTime().getTime())); long current_time = DateUtils.truncate(cal.getTime(), Calendar.HOUR).getTime(); // We query Foursquare only once per hour per venue. if (venue_last_call.get(venue_id) != null && current_time < venue_last_call.get(venue_id) + 3600000) continue; intelligentWait(total_venues, cal.getTime().getTime(), (total_calls == 0 ? 0 : Math.round(time_spent_on_API / total_calls))); Venue venue = null; try { long beforeCall = System.currentTimeMillis(); venue = new Venue(getFoursquareVenueById(venue_id, c)); // If there is no last call, this is the beginning of the time series // for this venue. We get the number of people "here now" to initialize // the series. if (venue_last_call.get(venue_id) == null) { /** TODO: by doing this, we keep a representation of the venue dating from the beginning * of the specific crawl. we might want to change this and update this file once * in a while. */ FileWriter info = new FileWriter(folder + c + File.separator + "foursquare_venues" + File.separator + venue_id + ".info"); info.write(venue.getFoursquareJson()); info.close(); FileWriter out = new FileWriter(folder + c + File.separator + "attendances_crawl" + File.separator + venue_id + ".ts"); out.write("Date,here_now,hour_checkins,total_checkins\n"); out.write(df.format(current_time) + "," + venue.getHereNow() + "," + venue.getHereNow() + "," + venue.getCheckincount() + "\n"); out.close(); } else { FileWriter out = new FileWriter(folder + c + File.separator + "attendances_crawl" + File.separator + venue_id + ".ts", true); int checks = venue.getCheckincount() - venue_last_checkin.get(venue_id); out.write(df.format(current_time) + "," + venue.getHereNow() + "," + Integer.toString(checks) + "," + venue.getCheckincount() + "\n"); out.close(); } if (APICallsCount.get(current_time) == null) APICallsCount.put(current_time, 1); else APICallsCount.put(current_time, APICallsCount.get(current_time) + 1); total_calls++; venue_last_call.put(venue_id, current_time); venue_last_checkin.put(venue_id, venue.getCheckincount()); time_spent_on_API += System.currentTimeMillis() - beforeCall; } catch (Exception e) { // If something bad happens (crawler not available, IO error, ...), we put the // venue_id in the FIFO queue so that it gets reevaluated later. //e.printStackTrace(); error_logs.get(c) .write("[" + df.format(cal.getTime().getTime()) + "] Error with venue " + venue_id + " (" + e.getMessage() + "). " + APICallsCount.get(current_time) + " API calls so far this hour, " + city_venues_buffer.size() + " venues remaining in the buffer.\n"); error_logs.get(c).flush(); System.out.println("[" + df.format(cal.getTime().getTime()) + "] " + c + " -- " + APICallsCount.get(current_time) + " API calls // " + city_venues_buffer.size() + " venues remaining " + " (" + e.getMessage() + ")"); if (e instanceof FoursquareAPIException) if (((FoursquareAPIException) e).getHttp_code().equals("400") && ((FoursquareAPIException) e).getError_detail() .equals("Venue " + venue_id + " has been deleted")) { city_venues.get(c).remove(venue_id); removeVenue(venue_id, c); } else city_venues_buffer.add(venue_id); continue; } } // while // Every day between 0am and 2am, we repair all the broken time series (if there // is something to repair). Calendar cal = Calendar.getInstance(); if (city_venues_buffer.peekFirst() == null && (cal.getTimeInMillis() - sanity_checks.get(c)) >= 86400000 && cal.get(Calendar.HOUR_OF_DAY) < 2) { VenueUtil.fixBrokenTimeSeriesCity(c, folder); sanity_checks.put(c, cal.getTimeInMillis()); info_logs.get(c).write("[" + df.format(cal.getTime()) + "] Sanity check OK.\n"); info_logs.get(c).flush(); } } // for } // while }
From source file:de.uniwue.dmir.heatmap.EntryPointIncremental.java
@SuppressWarnings({ "rawtypes", "unchecked" }) public static void main(String[] args) throws IOException, ParseException { DateFormat df = new SimpleDateFormat(DATE_FORMAT); SimpleDateFormat backupDf = new SimpleDateFormat(BACKUP_DATE_FORMAT); String workDir = System.getProperty("workDir", "."); LOGGER.debug("Work dir: {}", workDir); String configDir = System.getProperty("configDir", "."); LOGGER.debug("Config dir: {}", configDir); File seedDir = new File(workDir, SEED_DIR); LOGGER.debug("Seed dir: {}", seedDir); File currentDir = new File(workDir, CURRENT_DIR); LOGGER.debug("Current dir: {}", currentDir); File backupDir = new File(workDir, BACKUP_DIR); LOGGER.debug("Backup dir: {}", backupDir); String initialMinTimeString = System.getProperty("minTime"); LOGGER.debug("Initial minimal time parameter: {}", initialMinTimeString); Date initialMinTime = initialMinTimeString == null ? new Date(0) : df.parse(initialMinTimeString); LOGGER.debug("Initial minimal time: {}", df.format(initialMinTime)); String absoluteMaxTimeString = System.getProperty("maxTime"); LOGGER.debug("Absolute maximal time parameter: {}", absoluteMaxTimeString); Date absoluteMaxTime = absoluteMaxTimeString == null ? new Date() : new SimpleDateFormat(DATE_FORMAT).parse(absoluteMaxTimeString); LOGGER.debug("Absolute maximal time: {}", df.format(absoluteMaxTime)); String incrementalFile = new File("file:" + configDir, INCREMENTAL_FILE).getPath(); String settingsFile = new File("file:" + configDir, HEATMAP_PROCESSOR__FILE).getPath(); LOGGER.debug("Initializing incremental control file: {}", incrementalFile); FileSystemXmlApplicationContext incrementalContext = new FileSystemXmlApplicationContext(incrementalFile); // get point limit int pointLimit = Integer .parseInt(incrementalContext.getBeanFactory().resolveEmbeddedValue("${point.limit}")); LOGGER.debug("Print limit: {}", pointLimit); // get backups to keep int backupsToKeep = Integer .parseInt(incrementalContext.getBeanFactory().resolveEmbeddedValue("${backups.to.keep}")); LOGGER.debug("Backups to keep: {}", pointLimit); LOGGER.debug("Initializing process components (manager and limiter)."); IProcessManager processManager = incrementalContext.getBean(IProcessManager.class); IProcessLimiter processLimiter = incrementalContext.getBean(IProcessLimiter.class); LOGGER.debug("Starting incremental loop."); while (true) { // break as soon as no new points are available // cleanup --- just in case LOGGER.debug("Deleting \"current\" dir."); FileUtils.deleteDirectory(currentDir); // copy from seed to current LOGGER.debug("Copying seed."); seedDir.mkdirs();/*from w ww . j ava 2s . c o m*/ FileUtils.copyDirectory(seedDir, currentDir); // get min time LOGGER.debug("Getting minimal time ..."); Date minTime = initialMinTime; ProcessManagerEntry entry = processManager.getEntry(); if (entry != null && entry.getMaxTime() != null) { minTime = entry.getMaxTime(); } LOGGER.debug("Minimal time: {}", new SimpleDateFormat(DATE_FORMAT).format(minTime)); // break if we processed all available points (minTime is greater than or equal to absoluteMaxTime) if (minTime.getTime() >= absoluteMaxTime.getTime()) { LOGGER.debug("Processed all points."); break; } // get the maximal time LOGGER.debug("Get maximal time."); // get the time from the newest point in our point range (pointMaxTime) ... Date pointMaxTime = processLimiter.getMaxTime(minTime, pointLimit); // ... and possibly break the loop if no new points are available if (pointMaxTime == null) break; // set the max time and make sure we are not taking to many points // (set max time to the minimum of pointMaxTime and absoluteMaxTime) Date maxTime = pointMaxTime.getTime() > absoluteMaxTime.getTime() ? absoluteMaxTime : pointMaxTime; LOGGER.debug("Maximal time: {}", new SimpleDateFormat(DATE_FORMAT).format(maxTime)); // start process processManager.start(minTime); System.setProperty("minTimestamp", new SimpleDateFormat(DATE_FORMAT).format(minTime)); System.setProperty("maxTimestamp", new SimpleDateFormat(DATE_FORMAT).format(maxTime)); FileSystemXmlApplicationContext heatmapContext = new FileSystemXmlApplicationContext(settingsFile); IHeatmap heatmap = heatmapContext.getBean(HEATMAP_BEAN, IHeatmap.class); ITileProcessor tileProcessor = heatmapContext.getBean(WRITER_BEAN, ITileProcessor.class); heatmap.processTiles(tileProcessor); tileProcessor.close(); heatmapContext.close(); // finish process processManager.finish(maxTime); // move old seed if (backupsToKeep > 0) { FileUtils.moveDirectory(seedDir, new File(backupDir, backupDf.format(minTime))); // minTime is the maxTime of the seed // cleanup backups String[] backups = backupDir.list(DirectoryFileFilter.DIRECTORY); File oldestBackup = null; if (backups.length > backupsToKeep) { for (String bs : backups) { File b = new File(backupDir, bs); if (oldestBackup == null || oldestBackup.lastModified() > b.lastModified()) { oldestBackup = b; } } FileUtils.deleteDirectory(oldestBackup); } } else { FileUtils.deleteDirectory(seedDir); } // move new seed FileUtils.moveDirectory(currentDir, seedDir); } incrementalContext.close(); }
From source file:com.maxl.java.aips2xml.Aips2Xml.java
public static void main(String[] args) { Options options = new Options(); addOption(options, "help", "print this message", false, false); addOption(options, "version", "print the version information and exit", false, false); addOption(options, "quiet", "be extra quiet", false, false); addOption(options, "verbose", "be extra verbose", false, false); addOption(options, "zip", "generate zip file", false, false); addOption(options, "lang", "use given language", true, false); addOption(options, "alpha", "only include titles which start with option value", true, false); addOption(options, "nodown", "no download, parse only", false, false); commandLineParse(options, args);/*w w w .jav a2s . co m*/ // Download all files and save them in appropriate directories if (DOWNLOAD_ALL) { System.out.println(""); allDown(); } DateFormat df = new SimpleDateFormat("ddMMyy"); String date_str = df.format(new Date()); System.out.println(""); if (!DB_LANGUAGE.isEmpty()) { extractPackageInfo(); List<MedicalInformations.MedicalInformation> med_list = readAipsFile(); if (SHOW_LOGS) { System.out.println(""); System.out.println("- Generating xml and html files ... "); } long startTime = System.currentTimeMillis(); int counter = 0; String fi_complete_xml = ""; for (MedicalInformations.MedicalInformation m : med_list) { if (m.getLang().equals(DB_LANGUAGE) && m.getType().equals("fi")) { if (m.getTitle().startsWith(MED_TITLE)) { if (SHOW_LOGS) System.out.println(++counter + ": " + m.getTitle()); String[] html_str = extractHtmlSection(m); // html_str[0] -> registration numbers // html_str[1] -> content string String xml_str = convertHtmlToXml(m.getTitle(), html_str[1], html_str[0]); if (DB_LANGUAGE.equals("de")) { if (!html_str[0].isEmpty()) { String name = m.getTitle(); // Replace all "Sonderzeichen" name = name.replaceAll("[/%:]", "_"); writeToFile(html_str[1], "./fis/fi_de_html/", name + "_fi_de.html"); writeToFile(xml_str, "./fis/fi_de_xml/", name + "_fi_de.xml"); fi_complete_xml += (xml_str + "\n"); } } else if (DB_LANGUAGE.equals("fr")) { if (!html_str[0].isEmpty()) { String name = m.getTitle(); // Replace all "Sonderzeichen" name = name.replaceAll("[/%:]", "_"); writeToFile(html_str[1], "./fis/fi_fr_html/", name + "_fi_fr.html"); writeToFile(xml_str, "./fis/fi_fr_xml/", name + "_fi_fr.xml"); fi_complete_xml += (xml_str + "\n"); } } } } } // Add header to huge xml fi_complete_xml = addHeaderToXml(fi_complete_xml); // Dump to file if (DB_LANGUAGE.equals("de")) { writeToFile(fi_complete_xml, "./fis/", "fi_de.xml"); if (ZIP_XML) zipToFile("./fis/", "fi_de.xml"); } else if (DB_LANGUAGE.equals("fr")) { writeToFile(fi_complete_xml, "./fis/", "fi_fr.xml"); if (ZIP_XML) zipToFile("./fis/", "fi_fr.xml"); } // Move stylesheet file to ./fis/ folders try { File src = new File("./css/amiko_stylesheet.css"); File dst_de = new File("./fis/fi_de_html/"); File dst_fr = new File("./fis/fi_fr_html/"); if (src.exists()) { if (dst_de.exists()) FileUtils.copyFileToDirectory(src, dst_de); if (dst_fr.exists()) FileUtils.copyFileToDirectory(src, dst_fr); } } catch (IOException e) { // Unhandled! } if (SHOW_LOGS) { long stopTime = System.currentTimeMillis(); System.out.println("- Generated " + counter + " xml and html files in " + (stopTime - startTime) / 1000.0f + " sec"); } } System.exit(0); }