public abstract class SimpleAdapter extends java.lang.Object implements AdapterInterface, java.io.Serializable
Abstract class for generic adapter based on textual data
Modifier and Type | Field and Description |
---|---|
java.io.PrintWriter |
err |
java.io.PrintWriter |
log |
java.io.PrintWriter |
out |
Constructor and Description |
---|
SimpleAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
append(java.lang.String data)
Append data as a new line
|
void |
appendError(java.lang.String data)
Append one error in a new line (if the Error writer exists)
|
void |
appendLog(char level,
long lineNumber,
java.lang.String data)
Append one log in a new line (if the Log writer exists)
|
void |
appendLog(java.lang.String data)
Append one log in a new line (if the Log writer exists)
|
void |
close()
Close the adapter streams
|
void |
directProcess()
Called each N lines in direct mode,
by default is flushes output
|
java.io.ByteArrayOutputStream |
getErrorStream()
Optional error stream, to send errors or any specific/rejected data for any future retry.
|
java.io.PrintWriter |
getErrorWriter()
Optional error writer, to send errors or any specific/rejected data for any future retry.
|
Grant |
getGrant()
Adapter grant
|
java.io.BufferedReader |
getInput()
Deprecated.
Use getInputReader
|
java.io.BufferedReader |
getInputReader()
Input data reader
|
java.io.ByteArrayInputStream |
getInputStream()
Get input data stream
|
java.io.ByteArrayOutputStream |
getLogStream()
Optional log stream, to send any end-user trace, logs, errors...
|
java.io.PrintWriter |
getLogWriter()
Optional log writer, to send any end-user trace, logs, errors...
|
java.lang.String |
getName()
Adapter name
|
java.io.PrintWriter |
getOutput()
Deprecated.
Use getOutputWriter
|
java.io.ByteArrayOutputStream |
getOutputStream()
Get output data stream
|
java.io.PrintWriter |
getOutputWriter()
Output data writer
|
java.lang.Object |
getParameter(java.lang.String param)
Get adapter parameter
|
java.util.Hashtable<java.lang.String,java.lang.Object> |
getParameters()
Get adapter parameters
|
int |
getProcessCount() |
char |
getStatus()
Adapter status
|
void |
init(java.lang.String name,
Grant grant,
java.io.ByteArrayInputStream inStream,
java.io.ByteArrayOutputStream outStream,
java.io.ByteArrayOutputStream errStream,
java.io.ByteArrayOutputStream logStream,
java.util.Hashtable<java.lang.String,java.lang.Object> params)
Adapter initialization
|
void |
postProcess()
Call after processing lines
by default it sends the XML footer to output
|
java.lang.String |
preProcess()
Called before processing lines,
by default it sends the XML header to output
|
void |
setInputStream(java.io.ByteArrayInputStream is)
Set input data stream
|
void |
setOutputStream(java.io.ByteArrayOutputStream os)
Set output data stream
|
void |
setParameter(java.lang.String param,
java.lang.Object object)
Put adapter parameter
|
void |
setProcessCount(int processCount) |
void |
setStatus(char status)
Get processing status
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
process
public transient java.io.PrintWriter out
public java.io.PrintWriter err
public java.io.PrintWriter log
public java.lang.String getName()
Adapter name
public Grant getGrant()
Adapter grant
@Deprecated public java.io.BufferedReader getInput()
public java.io.BufferedReader getInputReader()
Input data reader
public java.io.ByteArrayInputStream getInputStream()
Get input data stream
getInputStream
in interface AdapterInterface
public void setInputStream(java.io.ByteArrayInputStream is)
Set input data stream
is
- Input stream@Deprecated public java.io.PrintWriter getOutput()
public java.io.PrintWriter getOutputWriter()
Output data writer
public java.io.ByteArrayOutputStream getOutputStream()
Get output data stream
getOutputStream
in interface AdapterInterface
public void setOutputStream(java.io.ByteArrayOutputStream os)
Set output data stream
os
- Output streampublic void setProcessCount(int processCount)
public int getProcessCount()
public void append(java.lang.String data)
Append data as a new line
public char getStatus()
Adapter status
getStatus
in interface AdapterInterface
public void setStatus(char status)
AdapterInterface
Get processing status
setStatus
in interface AdapterInterface
public java.util.Hashtable<java.lang.String,java.lang.Object> getParameters()
Get adapter parameters
public java.lang.Object getParameter(java.lang.String param)
Get adapter parameter
public void setParameter(java.lang.String param, java.lang.Object object)
Put adapter parameter
public java.io.PrintWriter getErrorWriter()
Optional error writer, to send errors or any specific/rejected data for any future retry.
public java.io.ByteArrayOutputStream getErrorStream()
Optional error stream, to send errors or any specific/rejected data for any future retry.
getErrorStream
in interface AdapterInterface
public void appendError(java.lang.String data)
Append one error in a new line (if the Error writer exists)
public java.io.PrintWriter getLogWriter()
Optional log writer, to send any end-user trace, logs, errors...
public java.io.ByteArrayOutputStream getLogStream()
Optional log stream, to send any end-user trace, logs, errors...
getLogStream
in interface AdapterInterface
public void appendLog(char level, long lineNumber, java.lang.String data)
Append one log in a new line (if the Log writer exists)
public void appendLog(java.lang.String data)
Append one log in a new line (if the Log writer exists)
public void init(java.lang.String name, Grant grant, java.io.ByteArrayInputStream inStream, java.io.ByteArrayOutputStream outStream, java.io.ByteArrayOutputStream errStream, java.io.ByteArrayOutputStream logStream, java.util.Hashtable<java.lang.String,java.lang.Object> params)
Adapter initialization
init
in interface AdapterInterface
name
- Adapter namegrant
- User rightsinStream
- Input streamoutStream
- Output streamerrStream
- Error stream for rejected rows (can be null)logStream
- Stream to log info, errors... (can be null)params
- Adapter parameterspublic java.lang.String preProcess()
Called before processing lines, by default it sends the XML header to output
preProcess
in interface AdapterInterface
public void directProcess() throws java.lang.Exception
Called each N lines in direct mode, by default is flushes output
java.lang.Exception
public void postProcess()
Call after processing lines by default it sends the XML footer to output
postProcess
in interface AdapterInterface
public void close()
Close the adapter streams
close
in interface AdapterInterface
Copyright (c)2006-2014 Simplicite Software. All Rights Reserved.