com.rapidminer.operator
Class AbstractIOObject

java.lang.Object
  extended by com.rapidminer.operator.AbstractIOObject
All Implemented Interfaces:
IOObject, java.io.Serializable
Direct Known Subclasses:
ResultObjectAdapter

public abstract class AbstractIOObject
extends java.lang.Object
implements IOObject

This is an abstract superclass for all IOObject. It provides basic implementations for all methods of the IOObject interface. In addition, it also provides static methods which can be used for reading IOObjects from XML strings and input streams / files containing the XML serialization.

Author:
Ingo Mierswa
See Also:
Serialized Form

Nested Class Summary
static interface AbstractIOObject.InputStreamProvider
          This interface is needed since we must reset the stream in case of an exception.
 
Constructor Summary
AbstractIOObject()
           
 
Method Summary
 void appendOperatorToHistory(Operator operator, OutputPort port)
          This method is called if this IOObject is put out of the specified port after being created or processed by the given operator.
 IOObject copy()
          Returns not a copy but the very same object.
 LoggingHandler getLog()
          Gets the logging associated with the operator currently working on this IOObject or the global log service if no operator was set.
 java.util.List<ProcessingStep> getProcessingHistory()
          This method must return a list of each step of processing steps this IOObject has been made including it's creating operator.
 java.lang.String getSource()
          Returns the source of this IOObject (might return null if the source is unknown).
protected  void initWriting()
          Initializes the writing of this object.
static IOObject read(AbstractIOObject.InputStreamProvider inProvider)
           
static IOObject read(byte[] buf)
           
static IOObject read(java.io.File file)
           
static IOObject read(java.io.InputStream in)
          Deprecated. Use #read(InputStreamProvider, String) to be able to read all formats (xml zipped/not zipped and binary)
 void setLoggingHandler(LoggingHandler loggingHandler)
          Sets the current working operator, i.e. the operator which is currently working on this IOObject.
 void setSource(java.lang.String sourceName)
          Sets the source of this IOObject.
 void write(java.io.OutputStream out)
          Just serializes this object with help of a XMLSerialization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.rapidminer.operator.IOObject
getAnnotations
 

Constructor Detail

AbstractIOObject

public AbstractIOObject()
Method Detail

setSource

public void setSource(java.lang.String sourceName)
Sets the source of this IOObject.

Specified by:
setSource in interface IOObject

getSource

public java.lang.String getSource()
Returns the source of this IOObject (might return null if the source is unknown).

Specified by:
getSource in interface IOObject

appendOperatorToHistory

public void appendOperatorToHistory(Operator operator,
                                    OutputPort port)
Description copied from interface: IOObject
This method is called if this IOObject is put out of the specified port after being created or processed by the given operator. This method has to keep track of the processing stations of this object, so that they are remembered and might be returned by the method getProcessingHistory.

Specified by:
appendOperatorToHistory in interface IOObject

getProcessingHistory

public java.util.List<ProcessingStep> getProcessingHistory()
Description copied from interface: IOObject
This method must return a list of each step of processing steps this IOObject has been made including it's creating operator.

Specified by:
getProcessingHistory in interface IOObject

getLog

public LoggingHandler getLog()
Gets the logging associated with the operator currently working on this IOObject or the global log service if no operator was set.

Specified by:
getLog in interface IOObject

setLoggingHandler

public void setLoggingHandler(LoggingHandler loggingHandler)
Sets the current working operator, i.e. the operator which is currently working on this IOObject. This might be used for example for logging.

Specified by:
setLoggingHandler in interface IOObject

copy

public IOObject copy()
Returns not a copy but the very same object. This is ok for IOObjects which cannot be altered after creation. However, IOObjects which might be changed (e.g. ExampleSets) should overwrite this method and return a proper copy.

Specified by:
copy in interface IOObject

initWriting

protected void initWriting()
Initializes the writing of this object. This method is invoked before the actual writing is performed. The default implementation does nothing. This method should also be used for clean up processes which should be performed before the actual writing is done. For example, models might decide to keep the example set information directly after learning (e.g. for visualization reasons) but not to write them down. Please note that all fields will be written into files unless they are set to null in this method or they are marked as transient.


write

public final void write(java.io.OutputStream out)
                 throws java.io.IOException
Just serializes this object with help of a XMLSerialization. Initializes initWriting() before the actual writing is performed.

Specified by:
write in interface IOObject
Throws:
java.io.IOException

read

@Deprecated
public static IOObject read(java.io.InputStream in)
                     throws java.io.IOException
Deprecated. Use #read(InputStreamProvider, String) to be able to read all formats (xml zipped/not zipped and binary)

Deserializes an IOObect from the given XML stream. TODO: Make private and remove deprecated annotation

Throws:
java.io.IOException - if any IO error occurs.
java.lang.IllegalStateException - if XMLSerialization.init(ClassLoader) has never been called.

read

public static IOObject read(java.io.File file)
                     throws java.io.IOException
Throws:
java.io.IOException

read

public static IOObject read(byte[] buf)
                     throws java.io.IOException
Throws:
java.io.IOException

read

public static IOObject read(AbstractIOObject.InputStreamProvider inProvider)
                     throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2001-2009 by Rapid-I