public abstract class LogConverter
extends java.lang.Object
It is possible:
Note that the format of the XML is not customizable i.e. the selected columns and their order will be ignored while converting.
| Modifier and Type | Field and Description |
|---|---|
static char |
ADDITIONAL_DATA_ID
Additional data is not a field of the log so its
value is specified here as a constant char
|
protected java.lang.String |
colIndex
The string representing the columns and their order.
|
| Constructor and Description |
|---|
LogConverter()
Default constructor: the converted string will contain
all the fields.
|
LogConverter(java.util.Collection<LogField> fields,
boolean additionlData)
Constructor
|
LogConverter(java.lang.String cols)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
abstract java.lang.String |
convert(ILogEntry log)
Convert the log to a string of the given format
|
abstract java.lang.String |
getHeader()
Generate the header for the given converter.
|
void |
setCols(java.util.Collection<LogField> columns,
boolean additionlData)
Set the columns to write in the converted string
|
void |
setCols(java.lang.String columns)
Set the columns to write in the converted string.
|
public static final char ADDITIONAL_DATA_ID
protected java.lang.String colIndex
colIndex is composed of chars identifying the column and their position. Each char is is a LogField.id or ADDITIONAL_DATA_ID.
For example if colIndex=="0f1j" then the converted string
contains entries with like that:
timestamp, message, log type, addData 1, addData2...addDataN
because
LogField.TIMESTAMP.id=0,
LogFiled.LOGMESSAGE=f,
LogField.ENTRYTYPE.id=1 and
ADDITIONAL_DATA_ID=j.
Note that this is ignored while converting to XML!
LogField},
LogConverter.colIndexVectorpublic LogConverter()
public LogConverter(java.lang.String cols)
cols - A string describing the columns and their position
in the converted Stringpublic LogConverter(java.util.Collection<LogField> fields, boolean additionlData)
This constructor only allows to have additional data appened at the end of the other fields.
fields - A collection describing the columns and their position
in the converted StringadditionlData - true if the additional data must be
appended in the last position of the converted stringpublic void setCols(java.lang.String columns)
columns - A string of columns; if null
or empty then colIndexs contain all
the fields plus the additional datacolIndexpublic void setCols(java.util.Collection<LogField> columns, boolean additionlData)
columns - A vector of LogField representing the field to
write in the converted stringadditionlData - true if the additional data must be
appended in the last position of the converted stringcolIndexVectorpublic abstract java.lang.String convert(ILogEntry log)
log - The log to convert to a Stringpublic abstract java.lang.String getHeader()
If no header is needed, the heder return an empty string.