Package com.redwood.agent.api.rtx
Interface RTXConsumer
-
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
RTXWriter
public interface RTXConsumer extends Closeable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addColumn(RTXColumn column)
Add a new column with the name and type of an existing column, the column will be added to the end of this metadata (i.e.void
addColumn(String columnName, RTXType columnType)
Add a new column with the specified name and type, the column will be added to the end of this metadata.void
addColumn(String columnName, String columnType)
Add a new column with the specified name and type, the column will be added to the end of this metadata.void
addColumns(Collection<RTXColumn> newColumns)
Add new columns based on the input columns, the columns will be added in the order that they occur in the list, to the end of this metadata (i.e.void
addRow(RTXRow row)
Adds arow
default void
addRow(Object[] data)
Adds arow
with the supplied data, where the row will not have a key.default void
addRow(Object[] data, String key)
Adds arow
with the supplied data and key.void
addSource(RTXSource source)
Add a source to theRTXMetadata
, which is set previously withsetMetadata(RTXMetadata)
default void
addSources(Collection<RTXSource> sources)
Add multiple sources to theRTXMetadata
, which is set previously withsetMetadata(RTXMetadata)
void
addSources(Collection<RTXSource> sources, String prefix)
Convenience method to add multiple sources, with a prefix, to theRTXMetadata
, which is set previously withsetMetadata(RTXMetadata)
default void
addSources(Map<?,RTXSource> sources)
Convenience method to add multiple sources to theRTXMetadata
, which is set previously withsetMetadata(RTXMetadata)
default void
addSources(Map<?,RTXSource> sources, String prefix)
Convenience method to add multiple sources, with a prefix, to theRTXMetadata
, which is set previously withsetMetadata(RTXMetadata)
void
close()
default void
copyColumns(RTXMetadata templateMetadata)
Add all columns that are defined in the metadata passed in to the output writer.void
flush()
Write any cached data to the underlying output mechanism.RTXMetadata
getMetadata()
int
getRowNumber()
default RTXRow
newRow()
Create an empty row (you will need to add it later).void
setLogger(Logger log)
Replace the default logger with anotherLogger
.void
setMetadata(RTXMetadata newMetadata)
Sets theRTXMetadata
.
-
-
-
Method Detail
-
addColumn
void addColumn(RTXColumn column)
Add a new column with the name and type of an existing column, the column will be added to the end of this metadata (i.e. the index of the input column is ignored).- Parameters:
column
- the column to get the name and type from.- Throws:
RTXMetadataRuntimeException
- if an error occurs.RTXInRowDataRuntimeException
- when already data have been added. It is not allowed to add a newcolumn
to theRTXMetadata
, when alreadyRTXRows
have been added.RTXMetadataReadOnlyRuntimeException
- if the metadata is read-only.
-
addColumn
void addColumn(String columnName, RTXType columnType)
Add a new column with the specified name and type, the column will be added to the end of this metadata.- Parameters:
columnName
- the column name.columnType
- the column type.- Throws:
RTXMetadataRuntimeException
- if an error occurs.RTXInRowDataRuntimeException
- when already data have been added. It is not allowed to add a newcolumn
to theRTXMetadata
, when alreadyRTXRows
have been added.RTXMetadataReadOnlyRuntimeException
- if the metadata is read-only.
-
addColumn
void addColumn(String columnName, String columnType)
Add a new column with the specified name and type, the column will be added to the end of this metadata.- Parameters:
columnName
- the column name.columnType
- the column type.- Throws:
RTXMetadataRuntimeException
- if an error occurs.RTXInRowDataRuntimeException
- when already data have been added. It is not allowed to add a newcolumn
to theRTXMetadata
, when alreadyRTXRows
have been added.RTXMetadataReadOnlyRuntimeException
- if the metadata is read-only.
-
addColumns
void addColumns(Collection<RTXColumn> newColumns)
Add new columns based on the input columns, the columns will be added in the order that they occur in the list, to the end of this metadata (i.e. the index of on each input column is ignored).- Parameters:
newColumns
- the columns to get the name and type from.- Throws:
RTXMetadataRuntimeException
- if an error occurs.RTXInRowDataRuntimeException
- when already data have been added. It is not allowed to add a newcolumn
to theRTXMetadata
, when alreadyRTXRows
have been added.RTXMetadataReadOnlyRuntimeException
- if the metadata is read-only.
-
addRow
default void addRow(Object[] data) throws RTXWriterException
Adds arow
with the supplied data, where the row will not have a key.- Parameters:
data
- the values for the different cells in the new row. When the row has more columns than supplied indata
, then the rest of the cells will be empty.- Throws:
RTXWriterException
RTXColumnRuntimeException
-
addRow
default void addRow(Object[] data, String key) throws RTXWriterException
Adds arow
with the supplied data and key.- Parameters:
data
- the values for the different cells in the new row. When the row has more columns than supplied indata
, then the rest of the cells will be empty.key
- the optional key of this row, which is only a label and can be used as reference to other data structures. No uniqueness is provided and keys cannot be used to access rows directly.- Throws:
RTXWriterException
RTXColumnRuntimeException
-
addRow
void addRow(RTXRow row) throws RTXWriterException
Adds arow
- Parameters:
row
-- Throws:
RTXWriterException
RTXColumnRuntimeException
-
addSource
void addSource(RTXSource source)
Add a source to theRTXMetadata
, which is set previously withsetMetadata(RTXMetadata)
- Parameters:
source
-- Throws:
RTXMetadataRuntimeException
- if an error occurs.RTXInRowDataRuntimeException
- when already data have been added. It is not allowed to add a newsource
to theRTXMetadata
, when alreadyRTXRows
have been added.RTXMetadataReadOnlyRuntimeException
- if the metadata is read-only.- See Also:
setMetadata(RTXMetadata)
-
addSources
default void addSources(Collection<RTXSource> sources)
Add multiple sources to theRTXMetadata
, which is set previously withsetMetadata(RTXMetadata)
- Parameters:
sources
-- Throws:
RTXMetadataRuntimeException
- if an error occurs.RTXInRowDataRuntimeException
- when already data have been added. It is not allowed to add a newsource
to theRTXMetadata
, when alreadyRTXRows
have been added.RTXMetadataReadOnlyRuntimeException
- if the metadata is read-only.- See Also:
addSource(RTXSource)
,setMetadata(RTXMetadata)
-
addSources
void addSources(Collection<RTXSource> sources, String prefix)
Convenience method to add multiple sources, with a prefix, to theRTXMetadata
, which is set previously withsetMetadata(RTXMetadata)
- Parameters:
sources
-prefix
-- Throws:
RTXMetadataRuntimeException
- if an error occurs.RTXInRowDataRuntimeException
- when already data have been added. It is not allowed to add a newsource
to theRTXMetadata
, when alreadyRTXRows
have been added.RTXMetadataReadOnlyRuntimeException
- if the metadata is read-only.- See Also:
addSource(RTXSource)
,setMetadata(RTXMetadata)
-
addSources
default void addSources(Map<?,RTXSource> sources)
Convenience method to add multiple sources to theRTXMetadata
, which is set previously withsetMetadata(RTXMetadata)
- Parameters:
sources
- aMap
withRTXSources
as values. The keys of the map are ignored and irrelevant for this method.- Throws:
RTXMetadataRuntimeException
- if an error occurs.RTXInRowDataRuntimeException
- when already data have been added. It is not allowed to add a newsource
to theRTXMetadata
, when alreadyRTXRows
have been added.RTXMetadataReadOnlyRuntimeException
- if the metadata is read-only.- See Also:
addSource(RTXSource)
,setMetadata(RTXMetadata)
-
addSources
default void addSources(Map<?,RTXSource> sources, String prefix)
Convenience method to add multiple sources, with a prefix, to theRTXMetadata
, which is set previously withsetMetadata(RTXMetadata)
- Parameters:
sources
- aMap
withRTXSources
as values. The keys of the map are ignored and irrelevant for this method.prefix
-- Throws:
RTXMetadataRuntimeException
- if an error occurs.RTXInRowDataRuntimeException
- when already data have been added. It is not allowed to add a newsource
to theRTXMetadata
, when alreadyRTXRows
have been added.RTXMetadataReadOnlyRuntimeException
- if the metadata is read-only.- See Also:
addSource(RTXSource)
,setMetadata(RTXMetadata)
-
close
void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
copyColumns
default void copyColumns(RTXMetadata templateMetadata) throws RTXWriterException
Add all columns that are defined in the metadata passed in to the output writer.- Parameters:
templateMetadata
-- Throws:
RTXWriterException
- if an error occurs.RTXColumnRuntimeException
- if an error occurs.RTXMetadataRuntimeException
- if an error occurs.RTXInRowDataRuntimeException
- when already data have been added. It is not allowed to add a newcolumn
to theRTXMetadata
, when alreadyRTXRows
have been added.RTXMetadataReadOnlyRuntimeException
- if the metadata is read-only.
-
flush
void flush() throws XMLStreamException
Write any cached data to the underlying output mechanism.- Throws:
XMLStreamException
-
getMetadata
RTXMetadata getMetadata()
- Returns:
- the
RTXMetadata
- See Also:
setMetadata(RTXMetadata)
-
getRowNumber
int getRowNumber()
- Returns:
- the current row number, i.e. the row number of added rows. Initially it returns 0, meaning no row has been added.
-
newRow
default RTXRow newRow()
Create an empty row (you will need to add it later).- Returns:
- a new row with the metadata set.
-
setLogger
void setLogger(Logger log)
Replace the default logger with anotherLogger
.- Parameters:
log
-
-
setMetadata
void setMetadata(RTXMetadata newMetadata)
Sets theRTXMetadata
. This is not allowed anymore, when data was already added, but needs to be set before any data is added.- Parameters:
newMetadata
-- Throws:
RTXColumnRuntimeException
RTXInRowDataRuntimeException
- when already data have been added. It is not allowed to set newRTXMetadata
, when alreadyRTXRows
have been added.- See Also:
getMetadata()
-
-