com.rapidminer
Class Process

java.lang.Object
  extended by com.rapidminer.tools.AbstractObservable<Process>
      extended by com.rapidminer.Process
All Implemented Interfaces:
Observable<Process>, java.lang.Cloneable
Direct Known Subclasses:
Experiment

public class Process
extends AbstractObservable<Process>
implements java.lang.Cloneable

This class was introduced to avoid confusing handling of operator maps and other stuff when a new process definition is created. It is also necessary for file name resolving and breakpoint handling.

If you want to use RapidMiner from your own application the best way is often to create a process definition from scratch (by adding the complete operator tree to the process' root operator) or from a file (for example created with the GUI beforehand) and start it by invoking the run() method.

Observers can listen to changes of the associated file, repository location, and context.

TODO: Add reasonable class comment

Author:
Ingo Mierswa

Field Summary
static int PROCESS_STATE_PAUSED
           
static int PROCESS_STATE_RUNNING
           
static int PROCESS_STATE_STOPPED
           
static int PROCESS_STATE_UNKNOWN
           
 
Constructor Summary
Process()
          Constructs an process consisting only of a SimpleOperatorChain.
Process(java.io.File file)
           
Process(java.io.File file, ProgressListener progressListener)
          Creates a new process from the given process file.
Process(java.io.InputStream in)
          Reads an process configuration from the given stream.
Process(java.io.Reader in)
          Reads an process configuration from the given reader.
Process(java.lang.String xmlString)
          Reads an process configuration from an XML String.
Process(java.lang.String xml, Process process)
          Creates a new process from the given XML copying state information not covered by the XML from the parameter process.
Process(java.net.URL url)
          Reads an process configuration from the given URL.
 
Method Summary
 void addBreakpointListener(BreakpointListener listener)
          Removes a breakpoint listener.
 void addDataTable(DataTable table)
          Adds the given data table.
 void addLoggingListener(LoggingListener loggingListener)
          Adds the given logging listener.
 void addProcessSetupListener(ProcessSetupListener listener)
           
 void addReportStream(ReportStream stream)
          This method adds a new report stream with the given name
 void applyContextMacros()
           
 boolean checkExperiment(IOContainer inputContainer)
          Deprecated. Use checkProcess(IOContainer) instead
 boolean checkProcess(IOContainer inputContainer)
          Checks for correct number of inner operators, properties, and io.
 void clearDataTable(java.lang.String name)
          Clears a single data table, i.e. removes all entries.
 void clearMacros()
          Clears all macros.
 void clearReportStreams()
           
 void clearStorage()
          Clears all macros.
 void clearUnknownParameters()
          Clears the information about unknown parameter types which occurred during process creation (from streams or files).
 java.lang.Object clone()
           
 boolean dataTableExists(java.lang.String name)
          Returns true if a data table object with the given name exists.
 void deleteDataTable(java.lang.String name)
          Deletes a single data table.
 void fireExecutionOrderChanged(ExecutionUnit unit)
           
 void fireOperatorAdded(Operator operator)
           
 void fireOperatorChanged(Operator operator)
           
 void fireOperatorRemoved(Operator operator, int oldIndex, int oldIndexAmongEnabled)
           
 void fireResumeEvent()
          Fires the event that the process was resumed.
 java.util.Collection<java.lang.String> getAllOperatorNames()
          Returns a Set view of all operator names (i.e.
 java.util.Collection<Operator> getAllOperators()
          Returns a Collection view of all operators.
 Annotations getAnnotations()
           
 ProcessContext getContext()
           
 Operator getCurrentOperator()
          Returns the operator that is currently being executed.
 DataTable getDataTable(java.lang.String name)
          Returns the data table associated with the given name.
 java.util.Collection<DataTable> getDataTables()
          Returns all data tables.
 DebugMode getDebugMode()
           
static java.nio.charset.Charset getEncoding(java.lang.String encoding)
           
 ExecutionMode getExecutionMode()
           
 java.io.File getExperimentFile()
          Deprecated. Use getProcessFile() instead
 int getExperimentState()
          Deprecated. Use getProcessState() instead
 java.lang.String getImportMessage()
          Returns some user readable messages generated during import by XMLImporter.
 LoggingHandler getLog()
           
 java.util.logging.Logger getLogger()
           
 MacroHandler getMacroHandler()
          Returns the macro handler.
 Operator getOperator(java.lang.String name)
          Returns the operator with the given name.
 java.io.File getProcessFile()
          Deprecated. Use getProcessLocation()
 ProcessLocation getProcessLocation()
           
 int getProcessState()
           
 ReportStream getReportStream(java.lang.String name)
          Returns the reportStream with given name
 RepositoryAccessor getRepositoryAccessor()
           
 RepositoryLocation getRepositoryLocation()
           
 ProcessRootOperator getRootOperator()
          Delivers the current root operator.
 java.util.List<UnknownParameterInformation> getUnknownParameters()
          Delivers the information about unknown parameter types which occurred during process creation (from streams or files).
 boolean hasSaveDestination()
          Returns true iff either a file or a repository location is defined.
 boolean isProcessConverted()
          This returns true if the process has been imported and ImportRules have been applied during importing.
protected  void loadInitialData()
          Loads results from the repository if specified in the ProcessContext.
protected  java.util.logging.Logger makeLogger()
           
 java.lang.String makeRelativeRepositoryLocation(RepositoryLocation loc)
          Turns loc into a repository location relative to getRepositoryLocation().
 void notifyRenaming(java.lang.String oldName, java.lang.String newName)
           
 void pause()
          Stops the process as soon as possible.
 void pause(Operator operator, IOContainer iocontainer, int breakpointType)
          Pauses the process at a breakpoint.
 void readProcess(java.io.Reader in)
          Reads the process setup from the given input stream.
 void readProcess(java.io.Reader in, ProgressListener progressListener)
           
 java.lang.String registerName(java.lang.String name, Operator operator)
          Returns a "name (i)" if name is already in use.
 void removeBreakpointListener(BreakpointListener listener)
          Adds a breakpoint listener.
 void removeLoggingListener(LoggingListener loggingListener)
          Removes the given logging listener.
 void removeProcessSetupListener(ProcessSetupListener listener)
           
 void removeReportStream(java.lang.String name)
          Removes this reportStream from process.
 java.io.File resolveFileName(java.lang.String name)
          Resolves the given filename against the directory containing the process file.
 RepositoryLocation resolveRepositoryLocation(java.lang.String loc)
          Resolves a repository location relative to getRepositoryLocation().
 void resume()
          Resumes the process after it has been paused.
 IOObject retrieve(java.lang.String name, boolean remove)
          Retrieves the stored object.
 IOContainer run()
          Starts the process with no input.
 IOContainer run(int logVerbosity)
          Starts the process with the given log verbosity.
 IOContainer run(IOContainer input)
          Starts the process with the given input.
 IOContainer run(IOContainer input, boolean unused)
          Deprecated. 
 IOContainer run(IOContainer input, int logVerbosity)
          Starts the process with the given input.
 IOContainer run(IOContainer input, int logVerbosity, boolean cleanUp)
          Deprecated. 
 IOContainer run(IOContainer input, int logVerbosity, boolean cleanUp, java.util.Map<java.lang.String,java.lang.String> macroMap)
          Deprecated. 
 IOContainer run(IOContainer input, int logVerbosity, java.util.Map<java.lang.String,java.lang.String> macroMap)
          Starts the process with the given input.
 void save()
          Saves the process to the process file.
 void save(java.io.File file)
          Saves the process to the given process file.
protected  void saveResults()
          Stores the results in the repository if specified in the ProcessContext.
 void setContext(ProcessContext context)
           
 void setCurrentOperator(Operator operator)
          Returns the operator that is currently being executed.
 void setDebugMode(DebugMode mode)
           
 void setExecutionMode(ExecutionMode mode)
           
 void setExperimentFile(java.io.File file)
          Deprecated. Please use setProcessFile(File) instead.
 void setExperimentState(int state)
          Deprecated. Use setProcessState(int) instead
 void setImportMessage(java.lang.String importMessage)
           
 void setProcessConverted(boolean isProcessConverted)
          This sets whether the process is converted.
 void setProcessFile(java.io.File file)
          Sets the process file.
 void setProcessLocation(ProcessLocation processLocation)
           
 void setRepositoryAccessor(RepositoryAccessor repositoryAccessor)
           
 void setRootOperator(ProcessRootOperator root)
          Sets the current root operator.
 boolean shouldPause()
          Returns true iff the process should be stopped.
 boolean shouldStop()
          Returns true iff the process should be stopped.
 void stop()
          Stops the process as soon as possible.
 void store(java.lang.String name, IOObject object)
          Returns the macro handler.
 java.lang.String toString()
           
 void unregisterName(java.lang.String name)
          This method is used for unregistering a name from the operator name map.
 void updateNotify()
          Can be called by GUI components if visual representation or any other state not known to the process itself has changed.
 
Methods inherited from class com.rapidminer.tools.AbstractObservable
addObserver, addObserverAsFirst, fireUpdate, fireUpdate, removeObserver
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROCESS_STATE_UNKNOWN

public static final int PROCESS_STATE_UNKNOWN
See Also:
Constant Field Values

PROCESS_STATE_STOPPED

public static final int PROCESS_STATE_STOPPED
See Also:
Constant Field Values

PROCESS_STATE_PAUSED

public static final int PROCESS_STATE_PAUSED
See Also:
Constant Field Values

PROCESS_STATE_RUNNING

public static final int PROCESS_STATE_RUNNING
See Also:
Constant Field Values
Constructor Detail

Process

public Process()
Constructs an process consisting only of a SimpleOperatorChain.


Process

public Process(java.io.File file)
        throws java.io.IOException,
               XMLException
Throws:
java.io.IOException
XMLException

Process

public Process(java.io.File file,
               ProgressListener progressListener)
        throws java.io.IOException,
               XMLException
Creates a new process from the given process file. This might have been created with the GUI beforehand.

Throws:
java.io.IOException
XMLException

Process

public Process(java.lang.String xml,
               Process process)
        throws java.io.IOException,
               XMLException
Creates a new process from the given XML copying state information not covered by the XML from the parameter process.

Throws:
java.io.IOException
XMLException

Process

public Process(java.lang.String xmlString)
        throws java.io.IOException,
               XMLException
Reads an process configuration from an XML String.

Throws:
java.io.IOException
XMLException

Process

public Process(java.io.Reader in)
        throws java.io.IOException,
               XMLException
Reads an process configuration from the given reader.

Throws:
java.io.IOException
XMLException

Process

public Process(java.io.InputStream in)
        throws java.io.IOException,
               XMLException
Reads an process configuration from the given stream.

Throws:
java.io.IOException
XMLException

Process

public Process(java.net.URL url)
        throws java.io.IOException,
               XMLException
Reads an process configuration from the given URL.

Throws:
java.io.IOException
XMLException
Method Detail

makeLogger

protected java.util.logging.Logger makeLogger()

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

setExperimentState

@Deprecated
public void setExperimentState(int state)
Deprecated. Use setProcessState(int) instead


getExperimentState

@Deprecated
public int getExperimentState()
Deprecated. Use getProcessState() instead


getProcessState

public int getProcessState()

getLog

public LoggingHandler getLog()

getLogger

public java.util.logging.Logger getLogger()

getMacroHandler

public MacroHandler getMacroHandler()
Returns the macro handler.


clearMacros

public void clearMacros()
Clears all macros.


store

public void store(java.lang.String name,
                  IOObject object)
Returns the macro handler.


retrieve

public IOObject retrieve(java.lang.String name,
                         boolean remove)
Retrieves the stored object.


clearStorage

public void clearStorage()
Clears all macros.


addLoggingListener

public void addLoggingListener(LoggingListener loggingListener)
Adds the given logging listener.


removeLoggingListener

public void removeLoggingListener(LoggingListener loggingListener)
Removes the given logging listener.


dataTableExists

public boolean dataTableExists(java.lang.String name)
Returns true if a data table object with the given name exists.


addDataTable

public void addDataTable(DataTable table)
Adds the given data table.


clearDataTable

public void clearDataTable(java.lang.String name)
Clears a single data table, i.e. removes all entries.


deleteDataTable

public void deleteDataTable(java.lang.String name)
Deletes a single data table.


getDataTable

public DataTable getDataTable(java.lang.String name)
Returns the data table associated with the given name. If the name was not used yet, an empty DataTable object is created with the given columnNames.


getDataTables

public java.util.Collection<DataTable> getDataTables()
Returns all data tables.


addReportStream

public void addReportStream(ReportStream stream)
This method adds a new report stream with the given name


getReportStream

public ReportStream getReportStream(java.lang.String name)
Returns the reportStream with given name


removeReportStream

public void removeReportStream(java.lang.String name)
Removes this reportStream from process. This report Stream will not be notified about new report items.

Parameters:
name - of the report stream given in the ReportGenerator operator

clearReportStreams

public void clearReportStreams()

setRootOperator

public void setRootOperator(ProcessRootOperator root)
Sets the current root operator. This might lead to a new registering of operator names.


getRootOperator

public ProcessRootOperator getRootOperator()
Delivers the current root operator.


getOperator

public Operator getOperator(java.lang.String name)
Returns the operator with the given name.


getCurrentOperator

public Operator getCurrentOperator()
Returns the operator that is currently being executed.


getAllOperators

public java.util.Collection<Operator> getAllOperators()
Returns a Collection view of all operators.


getAllOperatorNames

public java.util.Collection<java.lang.String> getAllOperatorNames()
Returns a Set view of all operator names (i.e. Strings).


setCurrentOperator

public void setCurrentOperator(Operator operator)
Returns the operator that is currently being executed.


pause

public void pause(Operator operator,
                  IOContainer iocontainer,
                  int breakpointType)
Pauses the process at a breakpoint.


resume

public void resume()
Resumes the process after it has been paused.


stop

public void stop()
Stops the process as soon as possible.


pause

public void pause()
Stops the process as soon as possible.


shouldStop

public boolean shouldStop()
Returns true iff the process should be stopped.


shouldPause

public boolean shouldPause()
Returns true iff the process should be stopped.


addBreakpointListener

public void addBreakpointListener(BreakpointListener listener)
Removes a breakpoint listener.


removeBreakpointListener

public void removeBreakpointListener(BreakpointListener listener)
Adds a breakpoint listener.


fireResumeEvent

public void fireResumeEvent()
Fires the event that the process was resumed.


getUnknownParameters

public java.util.List<UnknownParameterInformation> getUnknownParameters()
Delivers the information about unknown parameter types which occurred during process creation (from streams or files).


clearUnknownParameters

public void clearUnknownParameters()
Clears the information about unknown parameter types which occurred during process creation (from streams or files).


checkExperiment

@Deprecated
public boolean checkExperiment(IOContainer inputContainer)
Deprecated. Use checkProcess(IOContainer) instead

Checks for correct number of inner operators, properties, and io.


checkProcess

public boolean checkProcess(IOContainer inputContainer)
Checks for correct number of inner operators, properties, and io.


loadInitialData

protected void loadInitialData()
                        throws UserError
Loads results from the repository if specified in the ProcessContext.

Throws:
UserError

saveResults

protected void saveResults()
                    throws UserError
Stores the results in the repository if specified in the ProcessContext.

Throws:
UserError

applyContextMacros

public void applyContextMacros()

run

public final IOContainer run()
                      throws OperatorException
Starts the process with no input.

Throws:
OperatorException

run

public final IOContainer run(int logVerbosity)
                      throws OperatorException
Starts the process with the given log verbosity.

Throws:
OperatorException

run

public final IOContainer run(IOContainer input)
                      throws OperatorException
Starts the process with the given input.

Throws:
OperatorException

run

public final IOContainer run(IOContainer input,
                             int logVerbosity)
                      throws OperatorException
Starts the process with the given input. The process uses the given log verbosity.

Throws:
OperatorException

run

@Deprecated
public final IOContainer run(IOContainer input,
                                        boolean unused)
                      throws OperatorException
Deprecated. 

Starts the process with the given input. The process uses a default log verbosity. The boolean flag indicates if some static initializations should be cleaned before the process is started. This should usually be true but it might be useful to set this to false if, for example, several process runs uses the same object visualizer which would have been cleaned otherwise.

Throws:
OperatorException

run

@Deprecated
public final IOContainer run(IOContainer input,
                                        int logVerbosity,
                                        boolean cleanUp)
                      throws OperatorException
Deprecated. 

Starts the process with the given input. The process uses the given log verbosity. The boolean flag indicates if some static initializations should be cleaned before the process is started. This should usually be true but it might be useful to set this to false if, for example, several process runs uses the same object visualizer which would have been cleaned otherwise.

Throws:
OperatorException

run

@Deprecated
public final IOContainer run(IOContainer input,
                                        int logVerbosity,
                                        boolean cleanUp,
                                        java.util.Map<java.lang.String,java.lang.String> macroMap)
                      throws OperatorException
Deprecated. 

Starts the process with the given input. The process uses the given log verbosity. The boolean flag indicates if some static initializations should be cleaned before the process is started. This should usually be true but it might be useful to set this to false if, for example, several process runs uses the same object visualizer which would have been cleaned otherwise. Since the macros are cleaned then as well it is not possible to set macros to a process but with the given macroMap of this method.

Throws:
OperatorException

run

public final IOContainer run(IOContainer input,
                             int logVerbosity,
                             java.util.Map<java.lang.String,java.lang.String> macroMap)
                      throws OperatorException
Starts the process with the given input. The process uses the given log verbosity. The boolean flag indicates if some static initializations should be cleaned before the process is started. This should usually be true but it might be useful to set this to false if, for example, several process runs uses the same object visualizer which would have been cleaned otherwise. Since the macros are cleaned then as well it is not possible to set macros to a process but with the given macroMap of this method.

Throws:
OperatorException

getEncoding

public static java.nio.charset.Charset getEncoding(java.lang.String encoding)

save

public void save()
          throws java.io.IOException
Saves the process to the process file.

Throws:
java.io.IOException

save

public void save(java.io.File file)
          throws java.io.IOException
Saves the process to the given process file.

Throws:
java.io.IOException

resolveFileName

public java.io.File resolveFileName(java.lang.String name)
Resolves the given filename against the directory containing the process file.


readProcess

public void readProcess(java.io.Reader in)
                 throws XMLException,
                        java.io.IOException
Reads the process setup from the given input stream.

Throws:
XMLException
java.io.IOException

readProcess

public void readProcess(java.io.Reader in,
                        ProgressListener progressListener)
                 throws XMLException,
                        java.io.IOException
Throws:
XMLException
java.io.IOException

registerName

public java.lang.String registerName(java.lang.String name,
                                     Operator operator)
Returns a "name (i)" if name is already in use. This new name should then be used as operator name.


unregisterName

public void unregisterName(java.lang.String name)
This method is used for unregistering a name from the operator name map.


notifyRenaming

public void notifyRenaming(java.lang.String oldName,
                           java.lang.String newName)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addProcessSetupListener

public void addProcessSetupListener(ProcessSetupListener listener)

removeProcessSetupListener

public void removeProcessSetupListener(ProcessSetupListener listener)

fireOperatorAdded

public void fireOperatorAdded(Operator operator)

fireOperatorChanged

public void fireOperatorChanged(Operator operator)

fireOperatorRemoved

public void fireOperatorRemoved(Operator operator,
                                int oldIndex,
                                int oldIndexAmongEnabled)

fireExecutionOrderChanged

public void fireExecutionOrderChanged(ExecutionUnit unit)

getExecutionMode

public ExecutionMode getExecutionMode()

setExecutionMode

public void setExecutionMode(ExecutionMode mode)

getDebugMode

public DebugMode getDebugMode()

setDebugMode

public void setDebugMode(DebugMode mode)

resolveRepositoryLocation

public RepositoryLocation resolveRepositoryLocation(java.lang.String loc)
                                             throws UserError,
                                                    MalformedRepositoryLocationException
Resolves a repository location relative to getRepositoryLocation().

Throws:
UserError
MalformedRepositoryLocationException

makeRelativeRepositoryLocation

public java.lang.String makeRelativeRepositoryLocation(RepositoryLocation loc)
Turns loc into a repository location relative to getRepositoryLocation().


setContext

public void setContext(ProcessContext context)

getContext

public ProcessContext getContext()

setImportMessage

public void setImportMessage(java.lang.String importMessage)

isProcessConverted

public boolean isProcessConverted()
This returns true if the process has been imported and ImportRules have been applied during importing. Since the backward compatibility is lost on save, one can warn by retrieving this value.


setProcessConverted

public void setProcessConverted(boolean isProcessConverted)
This sets whether the process is converted.


getImportMessage

public java.lang.String getImportMessage()
Returns some user readable messages generated during import by XMLImporter.


hasSaveDestination

public boolean hasSaveDestination()
Returns true iff either a file or a repository location is defined.


getExperimentFile

@Deprecated
public java.io.File getExperimentFile()
Deprecated. Use getProcessFile() instead

Returns the current process file.


getProcessFile

@Deprecated
public java.io.File getProcessFile()
Deprecated. Use getProcessLocation()

Returns the current process file.


setExperimentFile

@Deprecated
public void setExperimentFile(java.io.File file)
Deprecated. Please use setProcessFile(File) instead.

Sets the process file. This file might be used for resolving relative filenames.


setProcessFile

public void setProcessFile(java.io.File file)
Sets the process file. This file might be used for resolving relative filenames.


setProcessLocation

public void setProcessLocation(ProcessLocation processLocation)

getProcessLocation

public ProcessLocation getProcessLocation()

getRepositoryLocation

public RepositoryLocation getRepositoryLocation()

updateNotify

public void updateNotify()
Can be called by GUI components if visual representation or any other state not known to the process itself has changed.


getRepositoryAccessor

public RepositoryAccessor getRepositoryAccessor()

setRepositoryAccessor

public void setRepositoryAccessor(RepositoryAccessor repositoryAccessor)

getAnnotations

public Annotations getAnnotations()


Copyright © 2001-2009 by Rapid-I