List of usage examples for java.text DateFormat setTimeZone
public void setTimeZone(TimeZone zone)
From source file:org.freedesktop.geoclueshare.LocationService.java
private String getGgaFromLocation(Location location) { String gga;/*w w w. j a va2 s . c om*/ Boolean hasAltitude = location.hasAltitude(); Date date = new Date(location.getTime()); DateFormat format = new SimpleDateFormat("HHmmss"); format.setTimeZone(TimeZone.getTimeZone("UTC")); String time = format.format(date); if (hasAltitude) { gga = "$GPGGA,%s,%s,%s,1,,%.1f,%.1f,M,,M,,"; gga = String.format(gga, time, getLatitudeString(location.getLatitude()), getLongitudeString(location.getLongitude()), getHdopFromAccuracy(location.getAccuracy()), location.getAltitude()); } else { gga = "$GPGGA,%s,%s,%s,1,,%.1f,,M,,M,,"; gga = String.format(gga, time, getLatitudeString(location.getLatitude()), getLongitudeString(location.getLongitude()), getHdopFromAccuracy(location.getAccuracy())); } gga = addChecksumToGga(gga); return gga; }
From source file:org.nuxeo.ecm.core.storage.sql.TestStringGenerator.java
/** * Returns a fixed date//from w ww .j a v a2s . c o m * * @return */ public Date getFixedDate() { String dateString = "01 Sep 2011 16:58:34"; DateFormat df = new SimpleDateFormat(datePattern); df.setTimeZone(TimeZone.getTimeZone("GMT")); Date fixedDate; try { fixedDate = df.parse(dateString); } catch (ParseException e) { throw new RuntimeException(e); } return fixedDate; }
From source file:ch.icclab.cyclops.services.iaas.openstack.persistence.TSDBResource.java
/** * Receives the usage data array and the gauge meter name. The usage data is transformed * to a json data and saved into the the InfluxDB * <p>//w ww . j a va 2 s . c om * Pseudo Code * 1. Iterate through the data array to save the data into an ArraList of objects * 2. Save the data into the TSDB POJO class * 3. Convert the POJO class to a JSON obj * 4. Invoke the InfluxDb client to save the data * * @param dataArr An array list consisting of usage data * @param meterName Name of the Gauge Meter * @return result A boolean output as a result of saving the meter data into the db */ public boolean saveGaugeMeterData(ArrayList<GaugeMeterData> dataArr, String meterName) { GaugeMeterData gMeterData; boolean result = true; dbname = settings.getInfluxDBDatabaseName(); try { DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); format.setTimeZone(TimeZone.getTimeZone("UTC")); logger.debug("Data Array length before writing points: " + dataArr.size()); for (int i = 0; i < dataArr.size(); i++) { gMeterData = dataArr.get(i); Date date = format.parse(gMeterData.getPeriod_end()); long timeMillisec = date.getTime(); logger.debug("Attempting to build a Point for: " + meterName); Point point = Point.measurement(meterName).time(timeMillisec, TimeUnit.MILLISECONDS) .tag("userid", gMeterData.getGroupby().getUser_id()) .tag("resourceid", gMeterData.getGroupby().getResource_id()) .tag("projectid", gMeterData.getGroupby().getProject_id()).tag("type", "gauge") .field("min", gMeterData.getMin()).field("max", gMeterData.getMax()) .field("sum", gMeterData.getSum()).field("avg", gMeterData.getAvg()) .tag("unit", gMeterData.getUnit()).field("count", gMeterData.getCount()).build(); logger.debug("Attempting to write the Point (" + meterName + ")"); influxDB.write(dbname, "default", point); logger.debug("Point successfully written."); } } catch (Exception e) { logger.error("Error while trying to save Gauge meter data into the DB: " + e.getMessage()); return false; } return result; }
From source file:org.n52.io.measurement.img.ChartIoHandler.java
private void configureTimeAxis(XYPlot xyPlot) { DateAxis timeAxis = (DateAxis) xyPlot.getDomainAxis(); timeAxis.setRange(getStartTime(getTimespan()), getEndTime(getTimespan())); String timeformat = "yyyy-MM-dd, HH:mm"; if (getChartStyleDefinitions().containsParameter("timeformat")) { timeformat = getChartStyleDefinitions().getAsString("timeformat"); }/* w w w . j a v a 2 s. c om*/ DateFormat requestTimeFormat = new SimpleDateFormat(timeformat, i18n.getLocale()); requestTimeFormat.setTimeZone(getTimezone().toTimeZone()); timeAxis.setDateFormatOverride(requestTimeFormat); timeAxis.setTimeZone(getTimezone().toTimeZone()); }
From source file:ch.icclab.cyclops.services.iaas.openstack.persistence.TSDBResource.java
/** * Receives the usage data array and the gauge meter name. The usage data is transformed * to a json data and saved into the the InfluxDB * <p>/* w w w.j a v a 2 s.c o m*/ * Pseudo Code * 1. Iterate through the data array to save the data into an ArraList of objects * 2. Save the data into the TSDB POJO class * 3. Convert the POJO class to a JSON obj * 4. Invoke the InfluxDb client to save the data * * @param dataArr An array list consisting of usage data * @param meterName Name of the Gauge Meter * @return result A boolean output as a result of saving the meter data into the db */ public boolean saveCumulativeMeterData(ArrayList<CumulativeMeterData> dataArr, String meterName) { CumulativeMeterData cMeterData; boolean result = true; dbname = settings.getInfluxDBDatabaseName(); try { DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); format.setTimeZone(TimeZone.getTimeZone("UTC")); logger.debug("Data Array length before writing points: " + dataArr.size()); for (int i = 0; i < dataArr.size(); i++) { cMeterData = dataArr.get(i); Date date = format.parse(cMeterData.getRecorded_at()); long timeMillisec = date.getTime(); logger.debug("Attempting to build a Point for: " + meterName); Point point = Point.measurement(meterName).time(timeMillisec, TimeUnit.MILLISECONDS) .tag("userid", cMeterData.getUser_id()).tag("resourceid", cMeterData.getResource_id()) .field("volume", cMeterData.getVolume()).field("usage", cMeterData.getUsage()) .tag("source", cMeterData.getSource()).tag("project_id", cMeterData.getProject_id()) .tag("type", cMeterData.getType()).tag("id", cMeterData.getId()) .field("unit", cMeterData.getUnit()) .tag("instance_id", cMeterData.getMetadata().getInstance_id()) .tag("instance_type", cMeterData.getMetadata().getInstance_type()) .tag("mac", cMeterData.getMetadata().getMac()) .tag("fref", cMeterData.getMetadata().getFref()) .tag("name", cMeterData.getMetadata().getName()).build(); logger.debug("Attempting to write the Point (" + meterName + ")"); influxDB.write(dbname, "default", point); logger.debug("Point successfully written."); } } catch (Exception e) { logger.error("Error while trying to save Cumulative meter data into the DB: " + e.getMessage()); return false; } return result; }
From source file:org.wso2.carbon.connector.integration.test.amazonsdb.AmazonSimpleDBAuthConnector.java
/** * Connect method which is generating authentication of the connector for * each request.// ww w. j av a2s . c o m * * @param messageContext ESB messageContext. */ public final String getXFormUrl(final JSONObject signatureRequestObject) { final StringBuilder signatureBuilder = new StringBuilder(); final StringBuilder xFormUrlBuilder = new StringBuilder(); // Generate time-stamp which will be sent to API and used in Signature final TimeZone timeZone = TimeZone.getTimeZone(AmazonSimpleDBConstants.GMT); final DateFormat dateFormat = new SimpleDateFormat(AmazonSimpleDBConstants.DATE_FORMAT); dateFormat.setTimeZone(timeZone); final String timestamp = dateFormat.format(new Date()); try { // Adding the timestamp to the jsonobject signatureRequestObject.put(AmazonSimpleDBConstants.TIMESTAMP, timestamp); final Map<String, String> parameterNamesMap = getParameterNamesMap(); final Map<String, String> parametersMap = getSortedParametersMap(signatureRequestObject, parameterNamesMap); signatureBuilder.append(AmazonSimpleDBConstants.HTTP_METHOD); signatureBuilder.append(AmazonSimpleDBConstants.NEW_LINE); signatureBuilder.append(AmazonSimpleDBConstants.HOST); signatureBuilder.append(AmazonSimpleDBConstants.NEW_LINE); signatureBuilder.append(AmazonSimpleDBConstants.HTTP_REQUEST_URI); signatureBuilder.append(AmazonSimpleDBConstants.NEW_LINE); signatureBuilder.append(AmazonSimpleDBConstants.AWS_ACCESS_KEY_ID); signatureBuilder.append(AmazonSimpleDBConstants.EQUAL); signatureBuilder.append(signatureRequestObject.get(AmazonSimpleDBConstants.ACCESS_KEY_ID)); final String charSet = Charset.defaultCharset().toString(); xFormUrlBuilder.append(AmazonSimpleDBConstants.AWS_ACCESS_KEY_ID + AmazonSimpleDBConstants.EQUAL); xFormUrlBuilder.append(signatureRequestObject.get(AmazonSimpleDBConstants.ACCESS_KEY_ID)); final Set<String> keySet = parametersMap.keySet(); for (String key : keySet) { final String param = AmazonSimpleDBConstants.AMPERSAND + URLEncoder.encode(key, charSet) + AmazonSimpleDBConstants.EQUAL + URLEncoder.encode(parametersMap.get(key), charSet); signatureBuilder.append(param); xFormUrlBuilder.append(AmazonSimpleDBConstants.AMPERSAND); xFormUrlBuilder.append(URLEncoder.encode(key, charSet)); xFormUrlBuilder.append(AmazonSimpleDBConstants.EQUAL); xFormUrlBuilder.append(URLEncoder.encode(parametersMap.get(key), charSet)); } // Sign the created string. final AmazonSimpleDBAuthentication amazonSDBAuth = new AmazonSimpleDBAuthentication( (String) signatureRequestObject.get(AmazonSimpleDBConstants.SECRET_ACCESS_KEY)); // '-' , '_' , '.' and '~' shouldn't be encoded as per the API // document and '*' should be encoded explicitly since java doesn't // encode final String authSignValue = amazonSDBAuth.getAuthorizationSignature(signatureBuilder.toString() .replace(AmazonSimpleDBConstants.PLUS, AmazonSimpleDBConstants.URL_ENCODED_PLUS) .replace(AmazonSimpleDBConstants.URL_ENCODED_TILT, AmazonSimpleDBConstants.TILT) .replace(AmazonSimpleDBConstants.ASTERISK, AmazonSimpleDBConstants.URL_ENCODED_ASTERISK)); // Set signature in messageContext to be used in template xFormUrlBuilder.append(AmazonSimpleDBConstants.AMPERSAND); xFormUrlBuilder.append(URLEncoder.encode(AmazonSimpleDBConstants.API_SIGNATURE, charSet) + AmazonSimpleDBConstants.EQUAL); xFormUrlBuilder.append(URLEncoder.encode(authSignValue, charSet)); // Set x-www-form url in messageContext to be used in PayloadFactory } catch (InvalidKeyException ike) { LOGGER.error("Invalid key", ike); } catch (NoSuchAlgorithmException iae) { LOGGER.error("Invalid Algorithm", iae); } catch (UnsupportedEncodingException uee) { LOGGER.error("Encoding Not Supported", uee); } catch (Exception exc) { LOGGER.error("Error occured in connector", exc); } return xFormUrlBuilder.toString() .replace(AmazonSimpleDBConstants.PLUS, AmazonSimpleDBConstants.URL_ENCODED_PLUS) .replace(AmazonSimpleDBConstants.URL_ENCODED_TILT, AmazonSimpleDBConstants.TILT) .replace(AmazonSimpleDBConstants.ASTERISK, AmazonSimpleDBConstants.URL_ENCODED_ASTERISK); }
From source file:eu.vital.vitalcep.collector.Collector.java
private String getXSDDateTime(Date date) { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); return dateFormat.format(date); }
From source file:org.kalypso.ogc.sensor.diagview.jfreechart.ObservationPlot.java
/** * Special tick units for kalypso//from w w w.java 2s .c om */ public static TickUnitSource createStandardDateTickUnits(final TimeZone zone) { if (zone == null) { throw new IllegalArgumentException("Null 'zone' argument."); //$NON-NLS-1$ } final TickUnits units = new TickUnits(); // date formatters // DateFormat f1 = new SimpleDateFormat("HH:mm:ss.SSS"); // DateFormat f2 = new SimpleDateFormat("HH:mm:ss"); // DateFormat f3 = new SimpleDateFormat("HH:mm"); // DateFormat f4 = new SimpleDateFormat("d-MMM, HH:mm"); // DateFormat f5 = new SimpleDateFormat("d-MMM"); // DateFormat f6 = new SimpleDateFormat("MMM-yyyy"); // DateFormat f7 = new SimpleDateFormat("yyyy"); final DateFormat f1 = new SimpleDateFormat("dd.MM HH:mm:ss.SSS"); //$NON-NLS-1$ final DateFormat f2 = new SimpleDateFormat("dd.MM HH:mm:ss"); //$NON-NLS-1$ final DateFormat f3 = new SimpleDateFormat("dd.MM HH:mm"); //$NON-NLS-1$ final DateFormat f4 = new SimpleDateFormat("dd.MM HH:mm"); //$NON-NLS-1$ final DateFormat f5 = new SimpleDateFormat("dd.MM"); //$NON-NLS-1$ final DateFormat f6 = new SimpleDateFormat("dd.MM.yy"); //$NON-NLS-1$ final DateFormat f7 = new SimpleDateFormat("yyyy"); //$NON-NLS-1$ f1.setTimeZone(zone); f2.setTimeZone(zone); f3.setTimeZone(zone); f4.setTimeZone(zone); f5.setTimeZone(zone); f6.setTimeZone(zone); f7.setTimeZone(zone); // milliseconds units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 1, f1)); units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 5, DateTickUnit.MILLISECOND, 1, f1)); units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 10, DateTickUnit.MILLISECOND, 1, f1)); units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 25, DateTickUnit.MILLISECOND, 5, f1)); units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 50, DateTickUnit.MILLISECOND, 10, f1)); units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 100, DateTickUnit.MILLISECOND, 10, f1)); units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 250, DateTickUnit.MILLISECOND, 10, f1)); units.add(new DateTickUnit(DateTickUnit.MILLISECOND, 500, DateTickUnit.MILLISECOND, 50, f1)); // seconds units.add(new DateTickUnit(DateTickUnit.SECOND, 1, DateTickUnit.MILLISECOND, 50, f2)); units.add(new DateTickUnit(DateTickUnit.SECOND, 5, DateTickUnit.SECOND, 1, f2)); units.add(new DateTickUnit(DateTickUnit.SECOND, 10, DateTickUnit.SECOND, 1, f2)); units.add(new DateTickUnit(DateTickUnit.SECOND, 30, DateTickUnit.SECOND, 5, f2)); // minutes units.add(new DateTickUnit(DateTickUnit.MINUTE, 1, DateTickUnit.SECOND, 5, f3)); units.add(new DateTickUnit(DateTickUnit.MINUTE, 2, DateTickUnit.SECOND, 10, f3)); units.add(new DateTickUnit(DateTickUnit.MINUTE, 5, DateTickUnit.MINUTE, 1, f3)); units.add(new DateTickUnit(DateTickUnit.MINUTE, 10, DateTickUnit.MINUTE, 1, f3)); units.add(new DateTickUnit(DateTickUnit.MINUTE, 15, DateTickUnit.MINUTE, 5, f3)); units.add(new DateTickUnit(DateTickUnit.MINUTE, 20, DateTickUnit.MINUTE, 5, f3)); units.add(new DateTickUnit(DateTickUnit.MINUTE, 30, DateTickUnit.MINUTE, 5, f3)); // hours units.add(new DateTickUnit(DateTickUnit.HOUR, 1, DateTickUnit.MINUTE, 5, f3)); units.add(new DateTickUnit(DateTickUnit.HOUR, 2, DateTickUnit.MINUTE, 10, f3)); units.add(new DateTickUnit(DateTickUnit.HOUR, 4, DateTickUnit.MINUTE, 30, f3)); units.add(new DateTickUnit(DateTickUnit.HOUR, 6, DateTickUnit.HOUR, 1, f3)); units.add(new DateTickUnit(DateTickUnit.HOUR, 12, DateTickUnit.HOUR, 1, f4)); // days units.add(new DateTickUnit(DateTickUnit.DAY, 1, DateTickUnit.HOUR, 1, f5)); units.add(new DateTickUnit(DateTickUnit.DAY, 2, DateTickUnit.HOUR, 1, f5)); units.add(new DateTickUnit(DateTickUnit.DAY, 3, DateTickUnit.HOUR, 1, f5)); units.add(new DateTickUnit(DateTickUnit.DAY, 4, DateTickUnit.HOUR, 1, f5)); units.add(new DateTickUnit(DateTickUnit.DAY, 5, DateTickUnit.HOUR, 1, f5)); units.add(new DateTickUnit(DateTickUnit.DAY, 6, DateTickUnit.HOUR, 1, f5)); units.add(new DateTickUnit(DateTickUnit.DAY, 7, DateTickUnit.DAY, 1, f5)); units.add(new DateTickUnit(DateTickUnit.DAY, 10, DateTickUnit.DAY, 1, f5)); units.add(new DateTickUnit(DateTickUnit.DAY, 15, DateTickUnit.DAY, 1, f5)); // months units.add(new DateTickUnit(DateTickUnit.MONTH, 1, DateTickUnit.DAY, 1, f6)); units.add(new DateTickUnit(DateTickUnit.MONTH, 2, DateTickUnit.DAY, 1, f6)); units.add(new DateTickUnit(DateTickUnit.MONTH, 3, DateTickUnit.MONTH, 1, f6)); units.add(new DateTickUnit(DateTickUnit.MONTH, 4, DateTickUnit.MONTH, 1, f6)); units.add(new DateTickUnit(DateTickUnit.MONTH, 6, DateTickUnit.MONTH, 1, f6)); // years units.add(new DateTickUnit(DateTickUnit.YEAR, 1, DateTickUnit.MONTH, 1, f7)); units.add(new DateTickUnit(DateTickUnit.YEAR, 2, DateTickUnit.MONTH, 3, f7)); units.add(new DateTickUnit(DateTickUnit.YEAR, 5, DateTickUnit.YEAR, 1, f7)); units.add(new DateTickUnit(DateTickUnit.YEAR, 10, DateTickUnit.YEAR, 1, f7)); units.add(new DateTickUnit(DateTickUnit.YEAR, 25, DateTickUnit.YEAR, 5, f7)); units.add(new DateTickUnit(DateTickUnit.YEAR, 50, DateTickUnit.YEAR, 10, f7)); units.add(new DateTickUnit(DateTickUnit.YEAR, 100, DateTickUnit.YEAR, 20, f7)); return units; }
From source file:org.jmonkey.external.bintray.BintrayApiClient.java
public boolean createPackageVersion(Asset asset, AssetVersion assetVersion) throws IOException { try (CloseableHttpClient httpClient = this.createAuthenticatedClient()) { // @link https://bintray.com/docs/api/#_create_version TimeZone tz = TimeZone.getTimeZone("UTC"); DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ"); df.setTimeZone(tz); String nowAsISO = df.format(new Date()); Map<String, Object> jsonData = new HashMap<>(); jsonData.put("name", assetVersion.getVersion()); jsonData.put("released", nowAsISO); jsonData.put("desc", ""); jsonData.put("github_release_notes_file", ""); jsonData.put("github_use_tag_release_notes", "false"); jsonData.put("vcs_tag", "version"); String json = JmeResourceWebsite.getObjectMapper().writeValueAsString(jsonData); StringEntity requestEntity = new StringEntity(json, ContentType.APPLICATION_JSON); HttpUriRequest request = RequestBuilder .post().setUri("https://api.bintray.com/packages/" + config.getSubject() + "/" + config.getRepo() + "/" + asset.getPackageName() + "/versions") .setEntity(requestEntity).build(); try (CloseableHttpResponse httpResponse = httpClient.execute(request)) { if (httpResponse.getStatusLine().getStatusCode() >= 400) { return false; }// w w w . j av a2 s . com return true; } } }
From source file:kieker.tools.logReplayer.FilesystemLogReplayerStarter.java
@Override protected boolean readPropertiesFromCommandLine(final CommandLine commandLine) { boolean retVal = true; // 0.) monitoring properties this.monitoringConfigurationFile = commandLine.getOptionValue(CMD_OPT_NAME_MONITORING_CONFIGURATION); // 1.) init inputDirs this.inputDirs = commandLine.getOptionValues(CMD_OPT_NAME_INPUTDIRS); if (this.inputDirs == null) { LOG.error("No input directory configured"); retVal = false;//from ww w .j av a 2 s. co m } // 2.) init keepOriginalLoggingTimestamps final String keepOriginalLoggingTimestampsOptValStr = commandLine .getOptionValue(CMD_OPT_NAME_KEEPORIGINALLOGGINGTIMESTAMPS, "true"); if (!("true".equals(keepOriginalLoggingTimestampsOptValStr) || "false".equals(keepOriginalLoggingTimestampsOptValStr))) { LOG.error("Invalid value for option " + CMD_OPT_NAME_KEEPORIGINALLOGGINGTIMESTAMPS + ": '" + keepOriginalLoggingTimestampsOptValStr + "'"); retVal = false; } this.keepOriginalLoggingTimestamps = "true".equals(keepOriginalLoggingTimestampsOptValStr); if (LOG.isDebugEnabled()) { LOG.debug("Keeping original logging timestamps: " + (this.keepOriginalLoggingTimestamps ? "true" : "false")); // NOCS } // 3.) init realtimeMode final String realtimeOptValStr = commandLine.getOptionValue(CMD_OPT_NAME_REALTIME, "false"); if (!("true".equals(realtimeOptValStr) || "false".equals(realtimeOptValStr))) { LOG.error("Invalid value for option " + CMD_OPT_NAME_REALTIME + ": '" + realtimeOptValStr + "'"); retVal = false; } this.realtimeMode = "true".equals(realtimeOptValStr); // 4.) init numRealtimeWorkerThreads final String numRealtimeWorkerThreadsStr = commandLine.getOptionValue(CMD_OPT_NAME_NUM_REALTIME_WORKERS, "1"); try { this.numRealtimeWorkerThreads = Integer.parseInt(numRealtimeWorkerThreadsStr); } catch (final NumberFormatException ex) { LOG.error("Invalid value for option " + CMD_OPT_NAME_NUM_REALTIME_WORKERS + ": '" + numRealtimeWorkerThreadsStr + "'"); LOG.error("NumberFormatException: ", ex); retVal = false; } if (this.numRealtimeWorkerThreads < 1) { LOG.error("Option value for " + CMD_OPT_NAME_NUM_REALTIME_WORKERS + " must be >= 1; found " + this.numRealtimeWorkerThreads); LOG.error("Invalid specification of " + CMD_OPT_NAME_NUM_REALTIME_WORKERS + ":" + this.numRealtimeWorkerThreads); retVal = false; } // 5.) init realtimeAccelerationFactor final String realtimeAccelerationFactorStr = commandLine .getOptionValue(CMD_OPT_NAME_REALTIME_ACCELERATION_FACTOR, "1"); try { this.realtimeAccelerationFactor = Double.parseDouble(realtimeAccelerationFactorStr); } catch (final NumberFormatException ex) { LOG.error("Invalid value for option " + CMD_OPT_NAME_REALTIME_ACCELERATION_FACTOR + ": '" + numRealtimeWorkerThreadsStr + "'"); LOG.error("NumberFormatException: ", ex); retVal = false; } if (this.numRealtimeWorkerThreads <= 0) { LOG.error("Option value for " + CMD_OPT_NAME_REALTIME_ACCELERATION_FACTOR + " must be > 0; found " + this.realtimeAccelerationFactor); LOG.error("Invalid specification of " + CMD_OPT_NAME_REALTIME_ACCELERATION_FACTOR + ":" + this.realtimeAccelerationFactor); retVal = false; } // 6.) init ignoreRecordsBefore/After final DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_PATTERN, Locale.US); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); try { final String ignoreRecordsBeforeTimestampString = commandLine .getOptionValue(CMD_OPT_NAME_IGNORERECORDSBEFOREDATE, null); final String ignoreRecordsAfterTimestampString = commandLine .getOptionValue(CMD_OPT_NAME_IGNORERECORDSAFTERDATE, null); if (ignoreRecordsBeforeTimestampString != null) { final Date ignoreBeforeDate = dateFormat.parse(ignoreRecordsBeforeTimestampString); this.ignoreRecordsBeforeTimestamp = ignoreBeforeDate.getTime() * (1000 * 1000); if (LOG.isDebugEnabled()) { LOG.debug("Ignoring records before " + dateFormat.format(ignoreBeforeDate) + " (" + this.ignoreRecordsBeforeTimestamp + ")"); } } if (ignoreRecordsAfterTimestampString != null) { final Date ignoreAfterDate = dateFormat.parse(ignoreRecordsAfterTimestampString); this.ignoreRecordsAfterTimestamp = ignoreAfterDate.getTime() * (1000 * 1000); if (LOG.isDebugEnabled()) { LOG.debug("Ignoring records after " + dateFormat.format(ignoreAfterDate) + " (" + this.ignoreRecordsAfterTimestamp + ")"); } } } catch (final java.text.ParseException ex) { final String erorMsg = "Error parsing date/time string. Please use the following pattern: " + DATE_FORMAT_PATTERN_CMD_USAGE_HELP; LOG.error(erorMsg, ex); return false; } // log configuration if (retVal && LOG.isDebugEnabled()) { LOG.debug("inputDirs: " + FilesystemLogReplayerStarter.fromStringArrayToDeliminedString(this.inputDirs, ';')); LOG.debug("Replaying in " + (this.realtimeMode ? "" : "non-") + "realtime mode"); // NOCS if (this.realtimeMode) { LOG.debug("Using " + this.numRealtimeWorkerThreads + " realtime worker thread" + (this.numRealtimeWorkerThreads > 1 ? "s" : "")); // NOCS } } return retVal; }