Package com.simplicite.util.integration
Class ApacheCommonsCSVAdapter
- java.lang.Object
-
- com.simplicite.util.integration.SimpleAdapter
-
- com.simplicite.util.integration.ApacheCommonsCSVAdapter
-
- All Implemented Interfaces:
AdapterInterface
,java.io.Serializable
public abstract class ApacheCommonsCSVAdapter extends SimpleAdapter
Abstract adapter for CSV input streams using Apache Commons CSV.
This class (and its child classes) cannot be instanciated.
They correspond to anAdapter
configuration item.
The only method to implement is the single line levelprocessRecords
method:@Override public String processRecord(long recordNumber, CSVRecord record) throws PlatformException, InterruptedException { // return the record transformed into a Simplicité XML block or null to ignore (e.g. if the line has been processed within this method) return null; }
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ApacheCommonsCSVAdapter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description org.apache.commons.csv.CSVFormat
getFormat()
Get format.char
getSeparator()
Get separator.void
postProcess()
Post process.void
process()
Iterates input stream as individual record.abstract java.lang.String
processRecord(org.apache.commons.csv.CSVRecord record)
CSV record processing to implement.void
setFormat(org.apache.commons.csv.CSVFormat format)
Set format.void
setSeparator(char sep)
Set separator.-
Methods inherited from class com.simplicite.util.integration.SimpleAdapter
append, appendError, appendError, appendLog, appendLog, close, directProcess, getBooleanParameter, getBooleanParameter, getConsole, getErrorStream, getErrorWriter, getGrant, getInputReader, getInputStream, getIntParameter, getIntParameter, getLogStream, getLogWriter, getLongParameter, getLongParameter, getName, getOrigin, getOutputStream, getOutputWriter, getParameter, getParameter, getParameters, getProcessCount, getStatus, getTrackingId, init, preProcess, setConsole, setErrorStream, setInputData, setInputStream, setLogStream, setOutputStream, setParameter, setParameter, setParameter, setParameter, setProcessCount, setStatus
-
-
-
-
Method Detail
-
getSeparator
public char getSeparator()
Get separator.- Returns:
- Separator
-
setSeparator
public void setSeparator(char sep)
Set separator.- Parameters:
sep
- Separator
-
getFormat
public org.apache.commons.csv.CSVFormat getFormat()
Get format.- Returns:
- Format
-
setFormat
public void setFormat(org.apache.commons.csv.CSVFormat format)
Set format.- Parameters:
format
- Format
-
process
public void process() throws java.lang.InterruptedException
Iterates input stream as individual record.
Each record is passed to theprocessRecord
method for processing.- Throws:
java.lang.InterruptedException
- When interrupted
-
postProcess
public void postProcess()
Description copied from class:SimpleAdapter
Post process.
Called after processing lines, by default it sends the XML footer to output.- Specified by:
postProcess
in interfaceAdapterInterface
- Overrides:
postProcess
in classSimpleAdapter
-
processRecord
public abstract java.lang.String processRecord(org.apache.commons.csv.CSVRecord record) throws PlatformException, java.lang.InterruptedException
CSV record processing to implement.- Parameters:
record
- Record- Returns:
- Processed line as XML statements or null
- Throws:
PlatformException
java.lang.InterruptedException
-
-