List of usage examples for org.apache.commons.lang.time DateUtils MILLIS_PER_MINUTE
long MILLIS_PER_MINUTE
To view the source code for org.apache.commons.lang.time DateUtils MILLIS_PER_MINUTE.
Click Source Link
From source file:mitm.application.djigzo.impl.DjigzoFactoryPropertiesImpl.java
@Override public long getCRLDownloadParametersReadTimeout() throws HierarchicalPropertiesException { return HierarchicalPropertiesUtils.getLong(sourceProperties, getPropertyName("cRLDownloadParameters.readTimeout"), 2 * DateUtils.MILLIS_PER_MINUTE, false); }
From source file:mitm.application.djigzo.impl.DjigzoFactoryPropertiesImpl.java
@Override public long getTrustAnchorBuilderUpdateCheckInterval() throws HierarchicalPropertiesException { return HierarchicalPropertiesUtils.getLong(sourceProperties, getPropertyName("trustAnchorBuilder.updateCheckInterval"), 30 * DateUtils.MILLIS_PER_MINUTE, false); }
From source file:mitm.application.djigzo.impl.DjigzoFactoryPropertiesImpl.java
@Override public long getSleepTime() throws HierarchicalPropertiesException { return HierarchicalPropertiesUtils.getLong(sourceProperties, getPropertyName("sms.gateway.sleepTime"), 5 * DateUtils.MILLIS_PER_MINUTE, true); }
From source file:mitm.application.djigzo.impl.DjigzoFactoryPropertiesImpl.java
@Override public long getUpdateInterval() throws HierarchicalPropertiesException { return HierarchicalPropertiesUtils.getLong(sourceProperties, getPropertyName("sms.gateway.updateInterval"), 5 * DateUtils.MILLIS_PER_MINUTE, false); }
From source file:mitm.common.security.crl.CRLStoreUpdaterImplTest.java
@Test public void testUpdateCRLStoreIllegalCRLDistPoint() throws Exception { addCertificates(new File(testBase, "certificates/windows-xp-all-roots.p7b"), rootStore); addCertificates(new File(testBase, "certificates/certeurope_root_ca_illegal_crl_dist_point.crt"), rootStore);//from www .j a v a 2 s . co m KeyAndCertStore keyAndCertStore = new KeyAndCertStoreImpl(certStore, null, null); PKISecurityServices pKISecurityServices = TestUtils.createDefaultPKISecurityServices(keyAndCertStore, rootStore, crlStore); CRLDownloadParameters downloadParameters = new CRLDownloadParameters( 1 * DateUtils.MILLIS_PER_MINUTE, /* total timeout */ 30 * DateUtils.MILLIS_PER_SECOND, /* connect timeout */ 30 * DateUtils.MILLIS_PER_SECOND, /* read timeout */ 25 * 1024 * 1024); /* max bytes */ CRLDownloader crlDownloader = new CRLDownloaderImpl(downloadParameters); CRLStoreMaintainer crlStoreMaintainer = new CRLStoreMaintainerImpl(pKISecurityServices.getCRLStore(), pKISecurityServices.getCRLPathBuilderFactory(), false); DefaultCRLStoreUpdaterParametersBuilder paramsBuilder = new DefaultCRLStoreUpdaterParametersBuilder( pKISecurityServices, crlDownloader, crlStoreMaintainer); CRLStoreUpdaterParameters updaterParams = paramsBuilder.createCRLStoreUpdaterParameters(); CRLStoreUpdater crlUpdater = new CRLStoreUpdaterImpl(updaterParams); // this should not result in an exception crlUpdater.update(); // should normally not fail if a valid internet connection is available assertTrue("This might fail if non of the downloaded CRLs are accessible.", crlStore.size() > 0); }
From source file:mitm.djigzo.web.services.AppModule.java
public static void contributeFactoryDefaults(MappedConfiguration<String, String> configuration) { /*/* ww w . ja v a2 s. c om*/ * djigzo home defaults to current user directory */ configuration.add(DJIGZO_HOME_PARAMETER, System.getProperty("user.dir")); configuration.add("djigzo.https.all", "true"); configuration.add("djigzo.ws.server.host", "127.0.0.1"); configuration.add("djigzo.ws.server.port", "9000"); configuration.add("djigzo.ws.server.protocol", "http"); configuration.add("djigzo.restart.delay", "45"); configuration.add("protected.system.password", "djigzo"); configuration.add("soap.username", "admin"); configuration.add("soap.password", "password"); configuration.add("soap.authentication-failed-page", "accessdenied"); configuration.add("access-denied-page", "accessdenied"); configuration.add("csrf.length", "6"); configuration.add("csrf.redirectTo", "accessdenied"); configuration.add("hmac.algorithm", "HmacSHA1"); configuration.add("hmac.redirectTo", "accessdenied"); /* * When an email is viewed it will not be larger than email.max-size size (prevent DOS) */ configuration.add("email.max-size", "65535"); configuration.add("email.attachment.max-size", Integer.toString(5 * SizeUtils.MB)); /* * Maximum time an uploaded attachment (by external user) may live */ configuration.add("upload.max-stale-time", Long.toString(DateUtils.MILLIS_PER_MINUTE * 30)); configuration.add("upload.max-attachments", "3"); /* * the maximum number of concurrent sessions for one 'user' (message key etc.) */ configuration.add("web.max-reply-rate", "5"); /* * Time a reply lives in the rate counter */ configuration.add("web.reply-rate-lifetime", Long.toString(DateUtils.MILLIS_PER_MINUTE * 5)); /* * The character encoding to use when replying to the PDF */ configuration.add("web.pdf.reply.charset", CharacterEncoding.UTF_8); /* * parameters for the SSL management page */ configuration.add("ssl.password", "djigzo"); configuration.add("ssl.file", "./ssl/sslCertificate.p12"); /* * If true the admin can edit My Destination */ configuration.add("mta.enableMyDestination", "false"); /* * If true the Fetchmail pages are enabled */ configuration.add("fetchmail.enabled", "false"); configuration.add("fetchmail.hidePasswords", "true"); configuration.add("saslPasswords.hidePasswords", "true"); configuration.add("caBulkRequest.maxLines", "10000"); configuration.add("caBulkRequest.maxValueLength", "256"); /* * Check whether a certificate is in use (if in use the delete option is disabled). * This is a relatively slow process. Disable if more speed is required. */ configuration.add("certificates.checkInUse", "true"); /* * maxBatchSize settings */ configuration.add("certificateRequestsPreview.maxBatchSize", "10"); configuration.add("certificateImport.maxBatchSize", "10"); configuration.add("certificateImportKey.maxBatchSize", "10"); /* * rowsPerPage settings */ configuration.add("users.rowsPerPage", "25"); configuration.add("certificates.rowsPerPage", "25"); configuration.add("crls.rowsPerPage", "25"); configuration.add("jamesLog.rowsPerPage", "25"); configuration.add("postfixLog.rowsPerPage", "25"); configuration.add("postfixSpool.rowsPerPage", "25"); configuration.add("sendCertificate.rowsPerPage", "25"); configuration.add("certificateUsage.rowsPerPage", "25"); configuration.add("ctls.rowsPerPage", "25"); configuration.add("fetchmail.rowsPerPage", "25"); configuration.add("saslPasswords.rowsPerPage", "25"); configuration.add("certificateRequests.rowsPerPage", "25"); configuration.add("certificateRequestsPreview.rowsPerPage", "25"); configuration.add("dlp.patterns.rowsPerPage", "25"); configuration.add("quarantineManager.rowsPerPage", "25"); configuration.add("quarantineView.rowsPerPage", "10"); configuration.add("patternsUsage.rowsPerPage", "25"); /* * portal settings */ configuration.add("portal.selectpassword.validity", Long.toString(DateUtils.MILLIS_PER_DAY * 30)); /* * Brute force filter settings. */ configuration.add("bff.lifetime", "60000" /* failure is 1 min in cache */); configuration.add("bff.maxFailures", "5" /* 5 failures in cache => ban */); configuration.add("bff.enabled", "true"); }
From source file:mitm.common.security.crl.CRLStoreUpdaterImplTest.java
@Test public void testUpdateCRLStore() throws Exception { addCertificates(new File(testBase, "certificates/windows-xp-all-roots.p7b"), rootStore); addCertificates(new File(testBase, "certificates/windows-xp-all-intermediates.p7b"), certStore); addCertificates(new File(testBase, "certificates/some-public.p7b"), certStore); KeyAndCertStore keyAndCertStore = new KeyAndCertStoreImpl(certStore, null, null); PKISecurityServices pKISecurityServices = TestUtils.createDefaultPKISecurityServices(keyAndCertStore, rootStore, crlStore);//w ww .j a v a 2s . co m CRLDownloadParameters downloadParameters = new CRLDownloadParameters( 1 * DateUtils.MILLIS_PER_MINUTE, /* total timeout */ 30 * DateUtils.MILLIS_PER_SECOND, /* connect timeout */ 30 * DateUtils.MILLIS_PER_SECOND, /* read timeout */ 25 * 1024 * 1024); /* max bytes */ CRLDownloader crlDownloader = new CRLDownloaderImpl(downloadParameters); CRLStoreMaintainer crlStoreMaintainer = new CRLStoreMaintainerImpl(pKISecurityServices.getCRLStore(), pKISecurityServices.getCRLPathBuilderFactory(), false); DefaultCRLStoreUpdaterParametersBuilder paramsBuilder = new DefaultCRLStoreUpdaterParametersBuilder( pKISecurityServices, crlDownloader, crlStoreMaintainer); CRLStoreUpdaterParameters updaterParams = paramsBuilder.createCRLStoreUpdaterParameters(); CRLStoreUpdater crlUpdater = new CRLStoreUpdaterImpl(updaterParams); crlUpdater.update(); }
From source file:com.muzima.view.forms.HTMLFormWebViewActivity.java
private void startAutoSaveProcess() { Runnable runnable = new Runnable() { @Override// w ww. j a v a 2s. c o m public void run() { try { webView.loadUrl("javascript:document.autoSaveForm()"); } catch (Exception e) { Log.e(TAG, "Error while auto saving the form data", e); } finally { handler.postDelayed(this, Integer.parseInt(autoSaveIntervalPreference) * DateUtils.MILLIS_PER_MINUTE); } } }; handler.postDelayed(runnable, Integer.parseInt(autoSaveIntervalPreference) * DateUtils.MILLIS_PER_MINUTE); }
From source file:eagle.jobrunning.crawler.RMResourceFetcher.java
private List<Object> doFetchCompleteJobInfo(String appId) throws Exception { InputStream is = null;/* www . jav a 2s .c om*/ InputStream is2 = null; try { checkUrl(); String jobID = JobUtils.getJobIDByAppID(appId); String urlString = jobCompleteDetailServiceURLBuilder.build(selector.getSelectedUrl(), jobID); LOG.info("Going to fetch job completed information for " + jobID + " , url: " + urlString); is = InputStreamUtils.getInputStream(urlString, CompressionType.GZIP); final JobCompleteWrapper jobWrapper = OBJ_MAPPER.readValue(is, JobCompleteWrapper.class); String urlString2 = jobCompleteCounterServiceURLBuilder.build(historyBaseUrl, jobID); LOG.info("Going to fetch job completed counters for " + jobID + " , url: " + urlString2); is2 = InputStreamUtils.getInputStream(urlString2, CompressionType.NONE, (int) (2 * DateUtils.MILLIS_PER_MINUTE)); final Document doc = Jsoup.parse(is2, StandardCharsets.UTF_8.name(), urlString2); JobCountersParser parser = new JobCountersParserImpl(); Map<String, Long> counters = parser.parse(doc); return Arrays.asList(jobWrapper, counters); } finally { if (is != null) { try { is.close(); } catch (Exception e) { } } if (is2 != null) { try { is2.close(); } catch (Exception e) { } } } }
From source file:de.tor.tribes.ui.algo.TimeFrameVisualizer.java
private void renderRange(LongRange pRange, LongRange pStartRange, LongRange pArriveRange, boolean pIsStartRange, boolean pIsArriveRange, Graphics2D pG2D, TimeSpan pSpanForRange, HashMap<String, Object> pPopupInfo) { int rangeStart = 0; int rangeWidth = 0; if (pRange.overlapsRange(pStartRange)) { //start range rendering long startDelta = pStartRange.getMinimumLong(); rangeStart = Math.round((pRange.getMinimumLong() - startDelta) / DateUtils.MILLIS_PER_MINUTE); // int rangeEnd = Math.round((pRange.getMaximumLong() - startDelta) / DateUtils.MILLIS_PER_MINUTE); rangeWidth = Math//from w ww . ja va 2 s .c o m .round((pRange.getMaximumLong() - pRange.getMinimumLong()) / DateUtils.MILLIS_PER_MINUTE); } else if (pRange.overlapsRange(pArriveRange)) { //end range rendering long startDelta = pStartRange.getMinimumLong(); rangeStart = Math.round((pRange.getMinimumLong() - startDelta) / DateUtils.MILLIS_PER_MINUTE); // int rangeEnd = Math.round((pRange.getMaximumLong() - arriveDelta) / DateUtils.MILLIS_PER_MINUTE); rangeWidth = Math .round((pRange.getMaximumLong() - pRange.getMinimumLong()) / DateUtils.MILLIS_PER_MINUTE); } //correct small widths if (rangeWidth == 0) { rangeWidth = 5; } long max = Math.round( (pArriveRange.getMaximumLong() - pStartRange.getMinimumLong()) / DateUtils.MILLIS_PER_MINUTE); if (rangeStart > max) { return; } SimpleDateFormat f = new SimpleDateFormat("dd.MM.yy HH:mm:ss"); String labelString = ""; if (pSpanForRange != null) { labelString = pSpanForRange.toString(); } else { labelString = f.format(new Date(pRange.getMinimumLong())) + " bis " + f.format(new Date(pRange.getMaximumLong())); } Rectangle2D labelBounds = pG2D.getFontMetrics().getStringBounds(labelString, pG2D); if (pIsStartRange) { pG2D.setColor(Color.RED); pG2D.fillRect(rangeStart, 20, rangeWidth, 20); pG2D.setColor(Color.BLACK); pG2D.drawRect(rangeStart, 20, rangeWidth, 20); pG2D.setColor(Color.RED); pG2D.setFont(pG2D.getFont().deriveFont(Font.BOLD, 14.0f)); pG2D.drawString(labelString, rangeStart, (int) labelBounds.getHeight()); } else if (pIsArriveRange) { pG2D.setColor(Color.GREEN.darker()); pG2D.fillRect(rangeStart, 20, rangeWidth, 20); pG2D.setColor(Color.BLACK); pG2D.drawRect(rangeStart, 20, rangeWidth, 20); pG2D.setColor(Color.GREEN.darker()); pG2D.setFont(pG2D.getFont().deriveFont(Font.BOLD, 14.0f)); pG2D.drawString(labelString, rangeStart, (int) labelBounds.getHeight() + 40); } else { pG2D.fillRect(rangeStart, 20, rangeWidth, 20); pG2D.setColor(Color.BLACK); pG2D.drawRect(rangeStart, 20, rangeWidth, 20); Point loc = getMousePosition(); if (loc != null && new Rectangle(rangeStart, 20, rangeWidth, 20).contains(loc)) { pPopupInfo.put("popup.location", loc); pPopupInfo.put("popup.label", labelString); pPopupInfo.put("active.range", pRange); pPopupInfo.put("span.for.range", pSpanForRange); } } }