|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.knime.core.node.BufferedDataTable
public final class BufferedDataTable
DataTable implementation that is passed along the KNIME workflow. This
implementation is provided in a NodeModel's
NodeModel.execute(
BufferedDataTable[], ExecutionContext) method as input data and
must also be returned as output data.
BufferedDataTable are not created directly (via a
constructor, for instance) but they are rather instantiated using the
ExecutionContext that is provided in the execute method.
Implementation note: The iterator returned by this class is a
CloseableRowIterator, meaning that if your implementation is likely
to open many iterators without pushing them to the end of the table, you
should consider to close them when done in order to free system resources.
| Nested Class Summary | |
|---|---|
static interface |
BufferedDataTable.KnowsRowCountTable
Internally used interface. |
| Nested classes/interfaces inherited from interface org.knime.core.node.port.PortObject |
|---|
PortObject.PortObjectSerializer<T extends PortObject> |
| Field Summary | |
|---|---|
static PortType |
TYPE
Define port type of objects of this class when used as PortObjects. |
| Constructor Summary | |
|---|---|
BufferedDataTable(ConcatenateTable table)
Creates a new buffered data table based on a concatenation of BufferedDataTables. |
|
BufferedDataTable(ContainerTable table,
int bufferID)
Creates a new buffered data table based on a container table (caching everything). |
|
BufferedDataTable(ExtensionTable table)
Creates a new BufferedDataTable for an extended table type. |
|
BufferedDataTable(JoinedTable table)
Creates a new buffered data table based on a join of BufferedDataTables. |
|
BufferedDataTable(RearrangeColumnsTable table)
Creates a new buffered data table based on a changed columns table (only memorize columns that changed). |
|
BufferedDataTable(TableSpecReplacerTable table)
Creates a new buffered data table based on a changed spec table (only keep new spec). |
|
BufferedDataTable(WrappedTable table)
Creates a new buffered data table based on a wrapped table. |
|
| Method Summary | |
|---|---|
(package private) void |
clear(Node dataOwner)
Clears any associated storage, for instance temp files. |
(package private) void |
clearSingle(Node dataOwner)
Clears any associated storage, for instance temp files. |
(package private) void |
ensureOpen()
Reads table from its saved location (usually the workspace). |
(package private) static int |
generateNewID()
Returns a table identifier and increments the internal counter. |
Integer |
getBufferedTableId()
Method being used internally, not interesting for the implementor of a new node model. |
static BufferedDataTable |
getDataTable(Map<Integer,BufferedDataTable> tblRep,
Integer tableID)
Method that is used internally while the workflow is being loaded. |
DataTableSpec |
getDataTableSpec()
Returns the DataTableSpec object of this table which gives
information about the structure of this data table. |
(package private) BufferedDataTable.KnowsRowCountTable |
getDelegate()
Package scope getter for underlying table implementation. |
(package private) Node |
getOwner()
|
(package private) static PortObject.PortObjectSerializer<BufferedDataTable> |
getPortObjectSerializer()
Throws IllegalStateException as this method is not
supposed to be called; refer to the API of PortObject for details
on this method. |
int |
getRowCount()
Get the row count of the this table. |
DataTableSpec |
getSpec()
Get specification to this port object. |
String |
getSummary()
Get a short summary of this PortObject. |
JComponent[] |
getViews()
The returned views are displayed in the out port view of the referring node. |
CloseableRowIterator |
iterator()
Returns a row iterator which returns each row one-by-one from the table. |
CloseableRowIterator |
iteratorFailProve()
Get an iterator instance that will return missing values when the table is cleared as part of a node reset. |
(package private) static BufferedDataTable |
loadFromFile(ReferencedFile dirRef,
NodeSettingsRO settings,
ExecutionMonitor exec,
Map<Integer,BufferedDataTable> tblRep,
HashMap<Integer,ContainerTable> bufferRep)
Factory method to restore a table that has been written using the save method. |
(package private) static DataTableSpec |
loadSpec(ReferencedFile dataPortDir)
Utility method used in the node's load method. |
static void |
putDataTable(Map<Integer,BufferedDataTable> tblRep,
BufferedDataTable t)
Method that is used internally while the workflow is being loaded. |
(package private) void |
putIntoTableRepository(HashMap<Integer,ContainerTable> rep)
Called after execution of node has finished to put the tables that are returned from the execute method into a global table repository. |
(package private) int |
removeFromTableRepository(HashMap<Integer,ContainerTable> rep,
Node owner)
Remove this table and all of its delegates from the table repository, if and only if its owner is the argument node. |
(package private) void |
save(File dir,
ExecutionMonitor exec)
Saves the table to a directory and writes some settings to the argument NodeSettingsWO object. |
(package private) static void |
saveSpec(DataTableSpec spec,
File dataPortDir)
Utility method that is used when the node saves its state. |
(package private) void |
setOwnerRecursively(Node owner)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final PortType TYPE
| Constructor Detail |
|---|
BufferedDataTable(ContainerTable table,
int bufferID)
table - The reference.bufferID - The buffer ID.BufferedDataTable(RearrangeColumnsTable table)
table - The reference.BufferedDataTable(TableSpecReplacerTable table)
table - The reference.BufferedDataTable(WrappedTable table)
table - The reference.BufferedDataTable(ConcatenateTable table)
table - The reference.BufferedDataTable(JoinedTable table)
table - The reference.BufferedDataTable(ExtensionTable table)
table - The extended table| Method Detail |
|---|
public static BufferedDataTable getDataTable(Map<Integer,BufferedDataTable> tblRep,
Integer tableID)
throws InvalidSettingsException
tblRep - The table repositorytableID - The table ID
InvalidSettingsException - If no such table exists.
public static void putDataTable(Map<Integer,BufferedDataTable> tblRep,
BufferedDataTable t)
tblRep - The table repositoryt - The table to put into the repository.static int generateNewID()
static PortObject.PortObjectSerializer<BufferedDataTable> getPortObjectSerializer()
IllegalStateException as this method is not
supposed to be called; refer to the API of PortObject for details
on this method. The KNIME engine treats objects of this kind differently.
BufferedDataTable.KnowsRowCountTable getDelegate()
void putIntoTableRepository(HashMap<Integer,ContainerTable> rep)
rep - The repository from the workflow
int removeFromTableRepository(HashMap<Integer,ContainerTable> rep,
Node owner)
rep - The repository to be removed from.owner - The dedicated owner.
public DataTableSpec getDataTableSpec()
DataTableSpec object of this table which gives
information about the structure of this data table.
getDataTableSpec in interface DataTablepublic DataTableSpec getSpec()
PortObjectSpec which is used to configure any successor node
after execution, e.g. a BufferedDataTable can return a
DataTableSpec.
Subclasses should narrow the return type if possible.
getSpec in interface PortObjectPortObjectSpec or any derived spec,
never null.getDataTableSpec()public String getSummary()
PortObject.
The return value will be shown in a node port's tooltip, for instance.
getSummary in interface PortObjectpublic CloseableRowIterator iterator()
iterator in interface Iterable<DataRow>iterator in interface DataTableDataRowpublic CloseableRowIterator iteratorFailProve()
In general, node implementations are guaranteed not to be active
(executing none of the abstract methods) when a node is reset. However,
if the data is displayed in a view using an iterator (e.g. a table view),
there is no guarantee when the data is accessed. Reading the data and
clearing the table may occur concurrently, specifically if used in fast
executing loops. An iterator returned by this method will ensure that
(invalid = missing) data is returned and that there are as many rows as
suggested by the getRowCount() method.
Client implementations should generally use the iterator()
method to read the data unless the data is potentially accessed in a node
or port view outside the
NodeModel.execute(BufferedDataTable[], ExecutionContext) method.
public int getRowCount()
public Integer getBufferedTableId()
void save(File dir,
ExecutionMonitor exec)
throws IOException,
CanceledExecutionException
dir - The directory to write to.exec - The progress monitor for cancellation.
IOException - If writing fails.
CanceledExecutionException - If canceled.
static void saveSpec(DataTableSpec spec,
File dataPortDir)
throws IOException
spec - To savedataPortDir - destination directory
IOException - if that fails for any reason
static DataTableSpec loadSpec(ReferencedFile dataPortDir)
throws IOException,
InvalidSettingsException
dataPortDir.
dataPortDir - To load from.
IOException - If that fails.
InvalidSettingsException - If the settings in the spec.xml can't
be parsed.
static BufferedDataTable loadFromFile(ReferencedFile dirRef,
NodeSettingsRO settings,
ExecutionMonitor exec,
Map<Integer,BufferedDataTable> tblRep,
HashMap<Integer,ContainerTable> bufferRep)
throws IOException,
CanceledExecutionException,
InvalidSettingsException
dirRef - The directory to load from.settings - The settings to load from.exec - The exec mon for progress/canceltblRep - The table repositorybufferRep - The buffer repository (needed for blobs).
IOException - If reading fails.
CanceledExecutionException - If canceled.
InvalidSettingsException - If settings are invalid.Node getOwner()
void setOwnerRecursively(Node owner)
owner - The owner to set.void clear(Node dataOwner)
dataOwner - The owner of the tables. If
getOwner() != dataOwner, we return immediately.void clearSingle(Node dataOwner)
dataOwner - The owner of the tables. If
getOwner() != dataOwner, we return immediately.void ensureOpen()
public JComponent[] getViews()
getViews in interface PortObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||