Package com.simplicite.util.integration
Class LineBasedAdapter
- java.lang.Object
-
- com.simplicite.util.integration.SimpleAdapter
-
- com.simplicite.util.integration.LineBasedAdapter
-
- All Implemented Interfaces:
AdapterInterface
,java.io.Serializable
- Direct Known Subclasses:
CSVLineBasedAdapter
public abstract class LineBasedAdapter extends SimpleAdapter
Abstract adapter dedicated to line based input streams.
This class (and its child classes) cannot be instanciated.
They correspond to anAdapter
configuration item.
The only method to implement is the single line levelprocessLine
method:@Override public String processLine(long lineNumber, String line) throws PlatformException, InterruptedException { // return the line 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 LineBasedAdapter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
postProcess()
Post process.void
process()
Iterates input stream as individual lines.abstract java.lang.String
processLine(long lineNumber, java.lang.String line)
Line processing to implement.java.lang.String
readLine()
Default read line to the next line feed ('\n') or carriage return ('\r').-
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
-
readLine
public java.lang.String readLine() throws java.io.IOException
Default read line to the next line feed ('\n') or carriage return ('\r'). Method has to be overrided if the line is delimited by something else.- Returns:
- Input line
- Throws:
java.io.IOException
- in case of I/O error
-
process
public void process() throws java.lang.InterruptedException
Iterates input stream as individual lines.
Each line is passed to theprocessLine
method for processing.- Throws:
java.lang.InterruptedException
- if 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
-
processLine
public abstract java.lang.String processLine(long lineNumber, java.lang.String line) throws PlatformException, java.lang.InterruptedException
Line processing to implement.- Parameters:
lineNumber
- Input line number (1
is the first line)line
- Input line- Returns:
- Processed line as XML statements or null
- Throws:
PlatformException
- in case of processing errorjava.lang.InterruptedException
- if interrupted
-
-