/** * Create a new {@link OutputStreamRecordWriter}. * * @param outputStreamWriter the output stream to write records to. * @param lineSeparator the line separator. */ public OutputStreamRecordWriter(final OutputStreamWriter outputStreamWriter, final String lineSeparator) { checkNotNull(outputStreamWriter, "output stream writer"); checkNotNull(lineSeparator, "line separator"); this.outputStreamWriter = outputStreamWriter; this.lineSeparator = lineSeparator; }
/** * {@inheritDoc} */ @Override public Character convert(final String value) { checkArgument(value != null, "Value to convert must not be null"); checkArgument(!value.isEmpty(), "Value to convert must not be empty"); return value.charAt(0); }
jobReport.getStatus(), parameters.getBatchSize(), formatErrorThreshold(parameters.getErrorThreshold()), parameters.isJmxMonitoring(), formatTime(metrics.getStartTime()), formatTime(metrics.getEndTime()), formatDuration(metrics.getDuration()), metrics.getReadCount(), metrics.getWriteCount(),
/** * {@inheritDoc} */ @Override public String getStartTime() { return formatTime(jobReport.getMetrics().getStartTime()); }
private void start() { setStatus(STARTING); jobListener.beforeJobStart(parameters); recordTracker = new RecordTracker(); metrics.setStartTime(System.currentTimeMillis()); LOGGER.log(Level.INFO, "Batch size: {0}", parameters.getBatchSize()); LOGGER.log(Level.INFO, "Error threshold: {0}", formatErrorThreshold(parameters.getErrorThreshold())); LOGGER.log(Level.INFO, "Jmx monitoring: {0}", parameters.isJmxMonitoring()); registerJobMonitor(); }
/** * Create a new {@link BeanFieldExtractor}. * * @param type of the bean * @param fields to extract * @throws IntrospectionException if the bean cannot be introspected */ public BeanFieldExtractor(final Class<P> type, final String... fields) throws IntrospectionException { this.getters = Utils.getGetters(type); if (fields.length == 0) { this.fields = this.getters.keySet().toArray(new String[this.getters.size()]); } else { this.fields = fields; } }
context.put("errorThreshold", formatErrorThreshold(parameters.getErrorThreshold())); context.put("jmx",parameters.isJmxMonitoring()); context.put("startTime",formatTime(metrics.getStartTime())); context.put("endTime",formatTime(metrics.getEndTime())); context.put("duration",formatDuration(metrics.getDuration())); context.put("readCount",metrics.getReadCount()); context.put("writeCount",metrics.getWriteCount());
/** * {@inheritDoc} */ @Override public String getEndTime() { return (jobReport.getMetrics().getEndTime() == 0) ? "" : formatTime(jobReport.getMetrics().getEndTime()); }
/** * Create a new {@link GrepFilter}. * * @param pattern the pattern to look for */ public GrepFilter(final String pattern) { Utils.checkNotNull(pattern, "pattern"); this.pattern = pattern; }
/** * {@inheritDoc} */ @Override public BigDecimal convert(final String value) { checkArgument(value != null, "Value to convert must not be null"); checkArgument(!value.isEmpty(), "Value to convert must not be empty"); return new BigDecimal(value); }
/** * Create a new {@link StringWriter}. * * @param stringWriter to write strings to */ public StringRecordWriter(final StringWriter stringWriter) { checkNotNull(stringWriter, "string writer"); this.stringWriter = stringWriter; }
/** * {@inheritDoc} */ @Override public Double convert(final String value) { checkArgument(value != null, "Value to convert must not be null"); checkArgument(!value.isEmpty(), "Value to convert must not be empty"); return Double.valueOf(value); }
/** * Create a new {@link FileRecordReader}. * * @param directory to read files from * @param recursive if the reader should be recursive or not */ public FileRecordReader(final File directory, final boolean recursive) { checkNotNull(directory, "directory"); this.directory = directory; this.recursive = recursive; }
/** * {@inheritDoc} */ @Override public BigInteger convert(final String value) { checkArgument(value != null, "Value to convert must not be null"); checkArgument(!value.isEmpty(), "Value to convert must not be empty"); return new BigInteger(value); }
public AbstractMultiFileRecordReader(List<File> files, Charset charset) { checkNotNull(files, "files"); checkNotNull(charset, "charset"); this.files = files; this.charset = charset; }
/** * {@inheritDoc} */ @Override public Float convert(final String value) { checkArgument(value != null, "Value to convert must not be null"); checkArgument(!value.isEmpty(), "Value to convert must not be empty"); return Double.valueOf(value).floatValue(); }
/** * Create a new {@link JmsQueueRecordReader}. * * @param queueConnectionFactory to use to create connections * @param queue to read records from */ public JmsQueueRecordReader(final QueueConnectionFactory queueConnectionFactory, final Queue queue) { checkNotNull(queueConnectionFactory, "queue connection factory"); checkNotNull(queue, "queue"); this.queueConnectionFactory = queueConnectionFactory; this.queue = queue; }
/** * {@inheritDoc} */ @Override public AtomicLong convert(final String value) { checkArgument(value != null, "Value to convert must not be null"); checkArgument(!value.isEmpty(), "Value to convert must not be empty"); return new AtomicLong(Long.parseLong(value)); }
/** * Create a new {@link XstreamRecordMarshaller}. * * @param xStream a pre-configured xstream instance */ public XstreamRecordMarshaller(final XStream xStream) { checkNotNull(xStream, "xStream"); this.xStream = xStream; }
/** * {@inheritDoc} */ @Override public Long convert(final String value) { checkArgument(value != null, "Value to convert must not be null"); checkArgument(!value.isEmpty(), "Value to convert must not be empty"); return Double.valueOf(value).longValue(); }