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 voidaddColumn(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.voidaddColumn(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.voidaddColumn(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.voidaddColumns(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.voidaddRow(RTXRow row)Adds arowdefault voidaddRow(Object[] data)Adds arowwith the supplied data, where the row will not have a key.default voidaddRow(Object[] data, String key)Adds arowwith the supplied data and key.voidaddSource(RTXSource source)Add a source to theRTXMetadata, which is set previously withsetMetadata(RTXMetadata)default voidaddSources(Collection<RTXSource> sources)Add multiple sources to theRTXMetadata, which is set previously withsetMetadata(RTXMetadata)voidaddSources(Collection<RTXSource> sources, String prefix)Convenience method to add multiple sources, with a prefix, to theRTXMetadata, which is set previously withsetMetadata(RTXMetadata)default voidaddSources(Map<?,RTXSource> sources)Convenience method to add multiple sources to theRTXMetadata, which is set previously withsetMetadata(RTXMetadata)default voidaddSources(Map<?,RTXSource> sources, String prefix)Convenience method to add multiple sources, with a prefix, to theRTXMetadata, which is set previously withsetMetadata(RTXMetadata)voidclose()default voidcopyColumns(RTXMetadata templateMetadata)Add all columns that are defined in the metadata passed in to the output writer.voidflush()Write any cached data to the underlying output mechanism.RTXMetadatagetMetadata()intgetRowNumber()default RTXRownewRow()Create an empty row (you will need to add it later).voidsetLogger(Logger log)Replace the default logger with anotherLogger.voidsetMetadata(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 newcolumnto theRTXMetadata, when alreadyRTXRowshave 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 newcolumnto theRTXMetadata, when alreadyRTXRowshave 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 newcolumnto theRTXMetadata, when alreadyRTXRowshave 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 newcolumnto theRTXMetadata, when alreadyRTXRowshave been added.RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.
-
addRow
default void addRow(Object[] data) throws RTXWriterException
Adds arowwith 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:
RTXWriterExceptionRTXColumnRuntimeException
-
addRow
default void addRow(Object[] data, String key) throws RTXWriterException
Adds arowwith 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:
RTXWriterExceptionRTXColumnRuntimeException
-
addRow
void addRow(RTXRow row) throws RTXWriterException
Adds arow- Parameters:
row-- Throws:
RTXWriterExceptionRTXColumnRuntimeException
-
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 newsourceto theRTXMetadata, when alreadyRTXRowshave 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 newsourceto theRTXMetadata, when alreadyRTXRowshave 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 newsourceto theRTXMetadata, when alreadyRTXRowshave 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- aMapwithRTXSourcesas 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 newsourceto theRTXMetadata, when alreadyRTXRowshave 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- aMapwithRTXSourcesas 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 newsourceto theRTXMetadata, when alreadyRTXRowshave been added.RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.- See Also:
addSource(RTXSource),setMetadata(RTXMetadata)
-
close
void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein 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 newcolumnto theRTXMetadata, when alreadyRTXRowshave been added.RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.
-
flush
void flush() throws XMLStreamExceptionWrite 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:
RTXColumnRuntimeExceptionRTXInRowDataRuntimeException- when already data have been added. It is not allowed to set newRTXMetadata, when alreadyRTXRowshave been added.- See Also:
getMetadata()
-
-