org.knime.core.data.container
Class BlobWrapperDataCell

java.lang.Object
  extended by org.knime.core.data.DataCell
      extended by org.knime.core.data.container.BlobWrapperDataCell
All Implemented Interfaces:
Serializable, DataValue

public final class BlobWrapperDataCell
extends DataCell

Wrapper for BlobDataCell. We explicitly wrap those cells in this package to delay the access to the latest time possible (when someone calls getCell() on the row). If such a cell has been added to an table (by calling e.g. addRowToTable in a DataContainer, the framework will write the underlying blob to a dedicated file and internally link to this blob file. The blob object itself can be garbage collected and will silently re-instantiated if accessed.

Author:
Bernd Wiswedel, University of Konstanz
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.knime.core.data.DataValue
DataValue.UtilityFactory
 
Field Summary
 
Fields inherited from interface org.knime.core.data.DataValue
UTILITY
 
Constructor Summary
BlobWrapperDataCell(BlobDataCell cell)
          Create a new wrapper cell for a blob object.
BlobWrapperDataCell(Buffer b, BlobDataCell.BlobAddress ba, CellClassInfo cl)
          Keeps references.
 
Method Summary
protected  boolean equalsDataCell(DataCell dc)
          Derived classes implement their specific equals function here.
(package private)  BlobDataCell.BlobAddress getAddress()
           
 Class<? extends BlobDataCell> getBlobClass()
           
(package private)  CellClassInfo getBlobClassInfo()
           
(package private)  DataType getBlobDataType()
           
(package private)  Buffer getBuffer()
           
 DataCell getCell()
          Fetches the content of the blob cell.
 int hashCode()
          This method must be implemented in order to ensure that two equal DataCell objects return the same hash code.
(package private)  void setAddressAndBuffer(BlobDataCell.BlobAddress address, Buffer buffer)
          Framework method to set buffer and address.
 String toString()
          Returns the String representation of this cell's value.
 
Methods inherited from class org.knime.core.data.DataCell
equals, getType, isMissing
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BlobWrapperDataCell

BlobWrapperDataCell(Buffer b,
                    BlobDataCell.BlobAddress ba,
                    CellClassInfo cl)
Keeps references.

Parameters:
b - The buffer that owns the cell.
ba - Its address.
cl - The class information of the blob.

BlobWrapperDataCell

public BlobWrapperDataCell(BlobDataCell cell)
Create a new wrapper cell for a blob object. The wrapper will keep a hard reference to the cell unless the cell is added to data container, in which case the reference is softened.

Parameters:
cell - The cell to wrap.
Method Detail

getCell

public DataCell getCell()
Fetches the content of the blob cell. May last long. The returned DataCell is an instance of BlobDataCell unless there were problems retrieving the blob from the file system, in which case a missing cell is returned (and a warning message is logged to the logging system).

Returns:
The blob Data cell being read.

setAddressAndBuffer

void setAddressAndBuffer(BlobDataCell.BlobAddress address,
                         Buffer buffer)
Framework method to set buffer and address.

Parameters:
address - Address to set.
buffer - Owner buffer to set.

getAddress

BlobDataCell.BlobAddress getAddress()
Returns:
The blob address.

getBlobClass

public Class<? extends BlobDataCell> getBlobClass()
Returns:
Class of the blob.

getBlobClassInfo

CellClassInfo getBlobClassInfo()
Returns:
Class info to the blob.

getBlobDataType

DataType getBlobDataType()
Returns:
DataType associated with the underlying blob cell.

getBuffer

Buffer getBuffer()
Returns:
owning buffer or null if not set yet.

equalsDataCell

protected boolean equalsDataCell(DataCell dc)
Derived classes implement their specific equals function here. The argument is guaranteed to be not null or a missing value, to be of the same class like this.

Specified by:
equalsDataCell in class DataCell
Parameters:
dc - the cell to compare this to
Returns:
true if this is equal to the argument, false if not

hashCode

public int hashCode()
This method must be implemented in order to ensure that two equal DataCell objects return the same hash code.

Specified by:
hashCode in class DataCell
Returns:
the hash code of your specific DataCell
See Also:
Object.hashCode(), DataCell.equals(java.lang.Object)

toString

public String toString()
Returns the String representation of this cell's value.

Specified by:
toString in class DataCell
Returns:
a String representation of this cell's value


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.