Search in sources :

Example 1 with FileStoreCell

use of org.knime.core.data.filestore.FileStoreCell in project knime-core by knime.

the class Buffer method mustBeFlushedPriorSave.

private boolean mustBeFlushedPriorSave(final DataCell cell) {
    if (cell instanceof FileStoreCell) {
        FileStore fileStore = FileStoreUtil.getFileStore((FileStoreCell) cell);
        return ((IWriteFileStoreHandler) m_fileStoreHandler).mustBeFlushedPriorSave(fileStore);
    } else if (cell instanceof CollectionDataValue) {
        for (DataCell c : (CollectionDataValue) cell) {
            if (mustBeFlushedPriorSave(c)) {
                return true;
            }
        }
    } else if (cell instanceof BlobWrapperDataCell) {
        final BlobWrapperDataCell blobWrapperCell = (BlobWrapperDataCell) cell;
        Class<? extends BlobDataCell> blobClass = blobWrapperCell.getBlobClass();
        if (CollectionDataValue.class.isAssignableFrom(blobClass)) {
            return mustBeFlushedPriorSave(blobWrapperCell.getCell());
        }
    }
    return false;
}
Also used : FileStore(org.knime.core.data.filestore.FileStore) IWriteFileStoreHandler(org.knime.core.data.filestore.internal.IWriteFileStoreHandler) DataCell(org.knime.core.data.DataCell) FileStoreCell(org.knime.core.data.filestore.FileStoreCell) CollectionDataValue(org.knime.core.data.collection.CollectionDataValue)

Example 2 with FileStoreCell

use of org.knime.core.data.filestore.FileStoreCell in project knime-core by knime.

the class AbstractTableStoreWriter method getFileStoreKeyAndFlush.

/**
 * @param cell
 * @return
 * @throws IOException
 */
public FileStoreKey getFileStoreKeyAndFlush(final DataCell cell) throws IOException {
    FileStoreKey fileStoreKey = null;
    if (cell instanceof FileStoreCell) {
        final FileStoreCell fsCell = (FileStoreCell) cell;
        FileStore fileStore = FileStoreUtil.getFileStore(fsCell);
        // TODO is the 'else' case realistic?
        if (getFileStoreHandler() instanceof IWriteFileStoreHandler) {
            fileStoreKey = getFileStoreHandler().translateToLocal(fileStore, fsCell);
        } else {
            // handler is not an IWriteFileStoreHandler but the buffer still contains file stores:
            // the flow is part of a workflow and all file stores were already properly handled
            // (this buffer is restored from disc - and then a memory alert forces the data back onto disc)
            fileStoreKey = FileStoreUtil.getFileStoreKey(fileStore);
        }
        FileStoreUtil.invokeFlush(fsCell);
    }
    return fileStoreKey;
}
Also used : FileStore(org.knime.core.data.filestore.FileStore) IWriteFileStoreHandler(org.knime.core.data.filestore.internal.IWriteFileStoreHandler) FileStoreKey(org.knime.core.data.filestore.FileStoreKey) FileStoreCell(org.knime.core.data.filestore.FileStoreCell)

Aggregations

FileStore (org.knime.core.data.filestore.FileStore)2 FileStoreCell (org.knime.core.data.filestore.FileStoreCell)2 IWriteFileStoreHandler (org.knime.core.data.filestore.internal.IWriteFileStoreHandler)2 DataCell (org.knime.core.data.DataCell)1 CollectionDataValue (org.knime.core.data.collection.CollectionDataValue)1 FileStoreKey (org.knime.core.data.filestore.FileStoreKey)1