com.rapidminer.operator
Class CommandLineOperator

java.lang.Object
  extended by com.rapidminer.tools.AbstractObservable<Operator>
      extended by com.rapidminer.operator.Operator
          extended by com.rapidminer.operator.CommandLineOperator
All Implemented Interfaces:
ConfigurationListener, PreviewListener, ResourceConsumer, ParameterHandler, LoggingHandler, Observable<Operator>

public class CommandLineOperator
extends Operator

This operator executes a system command. The command and all its arguments are specified by the parameter command. The standard output stream and the error stream of the process can be redirected to the logfile.
Please note also that the command is system dependent. Characters that have special meaning on the shell like e.g. the pipe symbol or brackets and braces do not have a special meaning to Java.
The method Runtime.exec(String) is used to execute the command. Please note, that this (Java) method parses the string into tokens before it is executed. These tokens are not interpreted by a shell (which?). If the desired command involves piping, redirection or other shell features, it is best to create a small shell script to handle this.

A hint for Windows / MS DOS users: simple commands should be preceeded by cmd call which opens a new shell, executes the command and closes the shell again. After this, the rest of the process will be executed. Another option would be to preceed the command with cmd start which opens the shell and keeps it open. The rest process will not be executed until the shell is closed by the user.

Author:
Ingo Mierswa, Simon Fischer

Field Summary
static java.lang.String PARAMETER_COMMAND
           
static java.lang.String PARAMETER_LOG_STDERR
           
static java.lang.String PARAMETER_LOG_STDOUT
           
 
Constructor Summary
CommandLineOperator(OperatorDescription description)
           
 
Method Summary
 void doWork()
          Performs the actual work of the operator and must be implemented by subclasses.
 java.util.List<ParameterType> getParameterTypes()
          Returns a list of ParameterTypes describing the parameters of this operator.
 
Methods inherited from class com.rapidminer.operator.Operator
acceptsInput, addError, addError, addValue, addWarning, apply, apply, assumePreconditionsSatisfied, checkAll, checkAllExcludingMetaData, checkDeprecations, checkForStop, checkIO, checkProperties, clear, clearErrorList, cloneOperator, collectErrors, createExperimentTree, createExperimentTree, createFromXML, createFromXML, createFromXML, createMarkedExperimentTree, createMarkedProcessTree, createProcessTree, createProcessTree, disconnectPorts, execute, fireUpdate, freeMemory, getAddOnlyAdditionalOutput, getApplyCount, getCompatibilityLevel, getDeliveredOutputClasses, getDeprecationInfo, getDesiredInputClasses, getDOMRepresentation, getEncoding, getErrorList, getExecutionUnit, getExperiment, getIncompatibleVersionChanges, getInput, getInput, getInput, getInputClasses, getInputDescription, getInputPorts, getIODescription, getLog, getLogger, getName, getNumberOfBreakpoints, getOperatorClassName, getOperatorDescription, getOutputClasses, getOutputPorts, getParameter, getParameterAsBoolean, getParameterAsChar, getParameterAsColor, getParameterAsDouble, getParameterAsFile, getParameterAsFile, getParameterAsInputStream, getParameterAsInt, getParameterAsMatrix, getParameterAsRepositoryLocation, getParameterAsString, getParameterHandler, getParameterList, getParameters, getParameterTupel, getParameterType, getParent, getPortOwner, getProcess, getResourceConsumptionEstimator, getRoot, getStartTime, getTransformer, getUserDescription, getValue, getValues, getXML, getXML, getXML, hasBreakpoint, hasBreakpoint, hasInput, inApplyLoop, isDebugMode, isDirty, isEnabled, isExpanded, isParallel, isParameterSet, isRunning, log, log, logError, logNote, logWarning, lookupOperator, makeDirty, makeDirtyOnUpdate, notifyRenaming, performAdditionalChecks, preAutoWire, processFinished, processStarts, producesOutput, propagateDirtyness, register, registerOperator, remove, removeAndKeepConnections, rename, resume, setBreakpoint, setCompatibilityLevel, setEnabled, setEnclosingProcess, setExpanded, setInput, setListParameter, setPairParameter, setParameter, setParameters, setUserDescription, shouldAutoConnect, shouldAutoConnect, shouldStopStandaloneExecution, toString, transformMetaData, unregisterOperator, updateExecutionOrder, walk, writeXML, writeXML
 
Methods inherited from class com.rapidminer.tools.AbstractObservable
addObserver, addObserverAsFirst, fireUpdate, removeObserver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAMETER_COMMAND

public static final java.lang.String PARAMETER_COMMAND
See Also:
Constant Field Values

PARAMETER_LOG_STDOUT

public static final java.lang.String PARAMETER_LOG_STDOUT
See Also:
Constant Field Values

PARAMETER_LOG_STDERR

public static final java.lang.String PARAMETER_LOG_STDERR
See Also:
Constant Field Values
Constructor Detail

CommandLineOperator

public CommandLineOperator(OperatorDescription description)
Method Detail

doWork

public void doWork()
            throws OperatorException
Description copied from class: Operator
Performs the actual work of the operator and must be implemented by subclasses. Replaces the old method apply().

Overrides:
doWork in class Operator
Throws:
OperatorException

getParameterTypes

public java.util.List<ParameterType> getParameterTypes()
Description copied from class: Operator
Returns a list of ParameterTypes describing the parameters of this operator. The default implementation returns an empty list if no input objects can be retained and special parameters for those input objects which can be prevented from being consumed. ATTENTION! This will create new parameterTypes. For calling already existing parameter types use getParameters().getParameterTypes();

Specified by:
getParameterTypes in interface ParameterHandler
Overrides:
getParameterTypes in class Operator


Copyright © 2001-2009 by Rapid-I