org.knime.core.node
Class ModelContent

java.lang.Object
  extended by org.knime.core.node.config.AbstractConfigEntry
      extended by org.knime.core.node.config.Config
          extended by org.knime.core.node.ModelContent
All Implemented Interfaces:
Serializable, Iterable<String>, TreeNode, ConfigRO, ConfigWO, ModelContentRO, ModelContentWO

public final class ModelContent
extends Config
implements ModelContentRO, ModelContentWO

This ModelContent is used to store XML-like model settings.

Author:
Thomas Gabriel, University of Konstanz
See Also:
Serialized Form

Constructor Summary
ModelContent(String key)
          Creates new content object.
 
Method Summary
 void addModelContent(ModelContent modelContent)
          Add the given ModelContent object to this Config using the key of the argument's ModelContent.
 ModelContentWO addModelContent(String key)
          Creates new ModelContentWO object for the given key and returns it.
 Config getInstance(String key)
          Creates a new Config of this type.
 ModelContent getModelContent(String key)
          Returns a read-only ModelContentRO object from this config.
(package private)  void load(InputStream in, ExecutionMonitor exec)
          Load this object from a directory.
static ModelContentRO loadFromXML(InputStream in)
          Reads ModelContent settings from the given XML stream and returns a new ModelContent object.
(package private)  void save(OutputStream out, ExecutionMonitor exec)
          Saves this object to an output stream.
 
Methods inherited from class org.knime.core.node.config.Config
addBoolean, addBooleanArray, addByte, addByteArray, addChar, addCharArray, addConfig, addConfig, addDataCell, addDataCellArray, addDataType, addDataTypeArray, addDouble, addDoubleArray, addFloat, addFloatArray, addInt, addIntArray, addLong, addLongArray, addRowKey, addRowKeyArray, addShort, addShortArray, addString, addStringArray, children, containsKey, copyTo, getBoolean, getBoolean, getBooleanArray, getBooleanArray, getByte, getByte, getByteArray, getByteArray, getChar, getChar, getCharArray, getCharArray, getChildAt, getChildCount, getConfig, getDataCell, getDataCell, getDataCellArray, getDataCellArray, getDataType, getDataType, getDataTypeArray, getDataTypeArray, getDouble, getDouble, getDoubleArray, getDoubleArray, getFloat, getFloat, getFloatArray, getFloatArray, getIndex, getInt, getInt, getIntArray, getIntArray, getLong, getLong, getLongArray, getLongArray, getRowKey, getRowKey, getRowKeyArray, getRowKeyArray, getShort, getShort, getShortArray, getShortArray, getString, getString, getStringArray, getStringArray, hasIdenticalValue, isLeaf, iterator, keySet, load, loadFromXML, readFromFile, saveToXML, toString, toString, toStringValue, writeToFile
 
Methods inherited from class org.knime.core.node.config.AbstractConfigEntry
equals, getAllowsChildren, getKey, getParent, hashCode, isIdentical
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.knime.core.node.config.ConfigRO
containsKey, copyTo, getBoolean, getBoolean, getBooleanArray, getBooleanArray, getByte, getByte, getByteArray, getByteArray, getChar, getChar, getCharArray, getCharArray, getConfig, getDataCell, getDataCell, getDataCellArray, getDataCellArray, getDataType, getDataType, getDataTypeArray, getDataTypeArray, getDouble, getDouble, getDoubleArray, getDoubleArray, getFloat, getFloat, getFloatArray, getFloatArray, getInt, getInt, getIntArray, getIntArray, getKey, getLong, getLong, getLongArray, getLongArray, getRowKey, getRowKey, getRowKeyArray, getRowKeyArray, getShort, getShort, getShortArray, getShortArray, getString, getString, getStringArray, getStringArray, iterator, keySet, saveToXML
 
Methods inherited from interface javax.swing.tree.TreeNode
children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf
 
Methods inherited from interface org.knime.core.node.config.ConfigWO
addBoolean, addBooleanArray, addByte, addByteArray, addChar, addCharArray, addConfig, addDataCell, addDataCellArray, addDataType, addDataTypeArray, addDouble, addDoubleArray, addFloat, addFloatArray, addInt, addIntArray, addLong, addLongArray, addRowKey, addRowKeyArray, addShort, addShortArray, addString, addStringArray, getKey
 

Constructor Detail

ModelContent

public ModelContent(String key)
Creates new content object.

Parameters:
key - The key for this ModelContent.
Method Detail

getInstance

public Config getInstance(String key)
Creates a new Config of this type.

Specified by:
getInstance in class Config
Parameters:
key - The new Config's key.
Returns:
A new instance of this Config.

loadFromXML

public static ModelContentRO loadFromXML(InputStream in)
                                  throws IOException
Reads ModelContent settings from the given XML stream and returns a new ModelContent object.

Parameters:
in - XML input stream to read settings from.
Returns:
A new settings object.
Throws:
IOException - If the stream could not be read.
NullPointerException - If one of the arguments is null.

addModelContent

public void addModelContent(ModelContent modelContent)
Add the given ModelContent object to this Config using the key of the argument's ModelContent.

Specified by:
addModelContent in interface ModelContentWO
Parameters:
modelContent - The object to add to this Config.

addModelContent

public ModelContentWO addModelContent(String key)
Creates new ModelContentWO object for the given key and returns it.

Specified by:
addModelContent in interface ModelContentWO
Parameters:
key - The identifier for the given config.
Returns:
A new ModelContentWO object.

getModelContent

public ModelContent getModelContent(String key)
                             throws InvalidSettingsException
Returns a read-only ModelContentRO object from this config.

Specified by:
getModelContent in interface ModelContentRO
Parameters:
key - The identifier.
Returns:
A new ModelContentRO object.
Throws:
InvalidSettingsException - If the object can't be accessed.

save

final void save(OutputStream out,
                ExecutionMonitor exec)
         throws IOException,
                CanceledExecutionException
Saves this object to an output stream. This method is used when (derived) objects represent a PortObject.

Parameters:
out - Where to save to.
exec - To report progress to.
Throws:
IOException - If saving fails for IO problems.
CanceledExecutionException - If canceled.
See Also:
Config.load(InputStream)

load

final void load(InputStream in,
                ExecutionMonitor exec)
         throws IOException,
                CanceledExecutionException
Load this object from a directory. This method is used when (derived) objects represent a PortObject.

Parameters:
in - Where to load from
exec - To report progress to.
Throws:
IOException - If loading fails for IO problems.
CanceledExecutionException - If canceled.
See Also:
save(OutputStream, ExecutionMonitor)


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.