/** * 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); }
/** * Create a new {@link GrepFilter}. * * @param pattern the pattern to look for */ public GrepFilter(final String pattern) { Utils.checkNotNull(pattern, "pattern"); this.pattern = pattern; }
/** * Create a new {@link StringWriter}. * * @param stringWriter to write strings to */ public StringRecordWriter(final StringWriter stringWriter) { checkNotNull(stringWriter, "string writer"); this.stringWriter = stringWriter; }
/** * 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; }
public AbstractMultiFileRecordReader(List<File> files, Charset charset) { checkNotNull(files, "files"); checkNotNull(charset, "charset"); this.files = files; this.charset = charset; }
/** * 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; }
/** * Create a new {@link XstreamRecordMarshaller}. * * @param xStream a pre-configured xstream instance */ public XstreamRecordMarshaller(final XStream xStream) { checkNotNull(xStream, "xStream"); this.xStream = xStream; }
/** * Create a new {@link JmsMessageTransformer}. * * @param queueSession to create text messages */ public JmsMessageTransformer(final QueueSession queueSession) { checkNotNull(queueSession, "queue session"); this.queueSession = queueSession; }
/** * Create a new {@link CollectionRecordWriter}. * * @param collection the collection to write records to */ public CollectionRecordWriter(final Collection collection) { checkNotNull(collection, "collection"); this.collection = collection; }
/** * Create a job executor. * * @param executorService to use to execute jobs */ public JobExecutor(ExecutorService executorService) { Utils.checkNotNull(executorService, "executor service"); this.executorService = executorService; }
/** * Create a new {@link XstreamRecordMapper}. * * @param xStream the {@link XStream} mapper. */ public XstreamRecordMapper(final XStream xStream) { checkNotNull(xStream, "xStream"); this.xStream = xStream; }
/** * Create a new {@link JmsQueueRecordWriter}. * * @param queueConnectionFactory to use to create connections. * @param queue the target queue to write records to * @throws JMSException if an exception occurs while sending the Jms message */ public JmsQueueRecordWriter(final QueueConnectionFactory queueConnectionFactory, final Queue queue) throws JMSException { checkNotNull(queueConnectionFactory, "queue connection factory"); checkNotNull(queue, "queue"); this.queueConnectionFactory = queueConnectionFactory; this.queue = queue; }
/** * Create a new {@link XstreamRecordMarshaller}. * * @param elementName the alias of the object in the corresponding xml tag * @param type the type of the object to marshal */ public XstreamRecordMarshaller(final String elementName, final Class type) { this(); checkNotNull(elementName, "element name"); checkNotNull(type, "target type"); xStream.alias(elementName, type); }
/** * Create a new {@link FileRecordReader}. * * @param path to read files from * @param recursive if the reader should be recursive or not */ public FileRecordReader(final Path path, final boolean recursive) { checkNotNull(path, "path"); this.directory = path.toFile(); this.recursive = recursive; }
/** * Register a record marshaller. * * @param recordMarshaller the record marshaller to register * @return the job builder */ public JobBuilder marshaller(final RecordMarshaller recordMarshaller) { checkNotNull(recordMarshaller, "record marshaller"); job.addRecordProcessor(recordMarshaller); return this; }
/** * Set the job name. * * @param name the job name * @return the job builder */ public JobBuilder named(final String name) { checkNotNull(name, "job name"); job.setName(name); return this; }
/** * Register a record reader. * * @param recordReader the record reader to register * @return the job builder */ public JobBuilder reader(final RecordReader recordReader) { checkNotNull(recordReader, "record reader"); job.setRecordReader(recordReader); return this; }
/** * Register a pipeline listener. * See {@link PipelineListener} for available callback methods. * * @param pipelineListener The pipeline listener to add. * @return the job builder */ public JobBuilder pipelineListener(final PipelineListener pipelineListener) { checkNotNull(pipelineListener, "pipeline listener"); job.addPipelineListener(pipelineListener); return this; }
/** * Register a batch listener. * See {@link BatchListener} for available callback methods. * * @param batchListener The batch listener to add. * @return the job builder */ public JobBuilder batchListener(final BatchListener batchListener) { checkNotNull(batchListener, "batch listener"); job.addBatchListener(batchListener); return this; }