org.imirsel.m2k.util
Class ExternalIntegrationModule

java.lang.Object
  extended byjava.util.Observable
      extended byncsa.d2k.core.modules.RootModule
          extended byncsa.d2k.core.modules.ConfigurableModule
              extended byncsa.d2k.core.modules.EmbeddedPipeModule
                  extended byncsa.d2k.core.modules.ExecModule
                      extended byncsa.d2k.core.modules.ComputeModule
                          extended byorg.imirsel.m2k.util.ExternalIntegrationModule
All Implemented Interfaces:
java.lang.Cloneable, ncsa.d2k.core.modules.Module, java.io.Serializable, ncsa.d2k.core.modules.SystemModule
Direct Known Subclasses:
MatlabIntegrationModule

public class ExternalIntegrationModule
extends ncsa.d2k.core.modules.ComputeModule

A module that executes a command via the java Runtime object.

Author:
kw
See Also:
Serialized Form

Field Summary
 
Fields inherited from class ncsa.d2k.core.modules.ConfigurableModule
addedInputInfo, addedInputNames, addedInputTypes, addedOutputInfo, addedOutputNames, addedOutputTypes, addPortListeners
 
Fields inherited from class ncsa.d2k.core.modules.RootModule
alias, children, DEBUG_LEVEL, EMPTY_INPUT, ERROR_LEVEL, executionManager, FATAL_LEVEL, HAVE_INPUT, INFO_LEVEL, iPipes, iPipesIndex, iTriggers, oPipes, oPipesIndex, oTriggers, parents, pipesFullManager, stats, triggerChildren, triggerParents, WARN_LEVEL
 
Fields inherited from interface ncsa.d2k.core.modules.SystemModule
BLOCKED_STATE, IDLE_STATE, MEDIUM, MEDIUM_RARE, MEDIUM_WELL, RARE, READY_STATE, WELL, WORKING_STATE
 
Constructor Summary
ExternalIntegrationModule()
          Creates a new instance of ExternalIntegrationModule.
 
Method Summary
 void beginExecution()
          Clears variable when any itinery containing the module is run.
protected  void doit()
          Executes the external command via the java Runtime object.
 void endExecution()
          Destroys any lingering processes when the module execution is ended.
 boolean getAddExtensionToInput()
          Returns the value of the flag that determines whether an extension is added to the input filename in order to generate the output filename, this takes precedence over any output filename specified.
 java.lang.String getCommandFormattingStr()
          Returns the external command formatting string.
 java.lang.String getExtension()
          Returns the extension that is added to the input filename in order to generate the output filename, which takes precedence over any output filename specified.
 java.lang.String getInputInfo(int param)
          Returns a text description for the indicated input.
 java.lang.String getInputName(int i)
          Returns a text name for the given input.
 java.lang.String[] getInputTypes()
          Returns an array of strings containing the Java data types of the input.
 java.lang.String getMainCommand()
          Returns the external command to be run.
 java.lang.String getModuleInfo()
          Returns information about the module.
 java.lang.String getOutputFilename()
          Returns filename to be passed as output to the next module in the itinery.
 java.lang.String getOutputInfo(int param)
          Returns a text name for the given output.
 java.lang.String getOutputName(int i)
          Returns a text name for the given output.
 java.lang.String[] getOutputTypes()
          Returns an array of strings containing the Java data types of the outputs.
 ncsa.d2k.core.modules.PropertyDescription[] getPropertiesDescriptions()
          Returns an array of description objects for each property of the Module.
 java.lang.String getWorkingDir()
          Returns the path to the working directory to execute the external command in.
 boolean isReady()
          Controls whether the module is ready to run
 void setAddExtensionToInput(boolean addExtension)
          Sets the flag that determines whether an extension is added to the input filename in order to generate the output filename, this takes precedence over any output filename specified.
 void setCommandFormattingStr(java.lang.String theCommand)
          Sets the external command formatting string.
 void setExtension(java.lang.String ext)
          Sets the extension that is added to the input filename in order to generate the output filename, which takes precedence over any output filename specified.
 void setMainCommand(java.lang.String theCommand)
          Sets the external command to be run.
 void setOutputFilename(java.lang.String outFile)
          Sets filename to be passed as output to the next module in the itinery.
 void setWorkingDir(java.lang.String path)
          Sets the path to the working directory to execute the external command in.
 
Methods inherited from class ncsa.d2k.core.modules.ExecModule
execute, setExecutionManager
 
Methods inherited from class ncsa.d2k.core.modules.ConfigurableModule
addAddPortListener, addInput, addInputTrigger, addOutput, addOutputTrigger, getAddedInputTypes, getAddedOutputTypes, getAddPortListeners, insertInput, insertOutput, removeAddPortListener, removeInput, removeInputTrigger, removeOutput, removeOutputTrigger, setAddedInputTypes, setInputType, setOutputType
 
Methods inherited from class ncsa.d2k.core.modules.RootModule
activateTriggers, begin, canRun, clone, debug, debug, disconnectInputPipe, disconnectInputTriggers, disconnectOutputPipe, disconnectOutputTriggers, end, error, error, fatal, fatal, fetchInputs, getAlias, getChildIndex, getChildMux, getChildren, getExecutionManager, getFile, getFlags, getFullPipeManager, getGuiComponent, getImage, getInputPipes, getInputPipeSize, getInputTriggers, getModuleName, getModuleStatistics, getNumInputs, getNumOutputs, getOutputCounts, getOutputPipes, getOutputPipeSize, getOutputTriggers, getParentIndex, getParentMux, getParents, getPipesFull, getPriority, getPropertyEditor, getResource, getRootName, getState, info, info, initModule, isAborting, isHead, isInputPipeConnected, isOutputPipeConnected, pullInput, pushOutput, resetInputs, setAlias, setBlocked, setD2KModulesLoggingLevel, setFlags, setFullPipeManager, setIdle, setInputPipe, setLogLevel, setModuleStatistics, setModuleStatisticsByMachine, setOutputCounts, setOutputPipe, setPipesFull, setReady, setResource, setState, setThePriority, setWorking, trigger, triggersActivated, warn, warn
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalIntegrationModule

public ExternalIntegrationModule()
Creates a new instance of ExternalIntegrationModule.

Method Detail

setCommandFormattingStr

public void setCommandFormattingStr(java.lang.String theCommand)
Sets the external command formatting string.

Parameters:
theCommand - a string describing how the command should be entered on the command line

getCommandFormattingStr

public java.lang.String getCommandFormattingStr()
Returns the external command formatting string.

Returns:
a string describing how the command should be entered on the command line

setMainCommand

public void setMainCommand(java.lang.String theCommand)
Sets the external command to be run.

Parameters:
theCommand - the command to be run, as it would be entered on the command line

getMainCommand

public java.lang.String getMainCommand()
Returns the external command to be run.

Returns:
the command to be run, as it would be entered on the command line

setOutputFilename

public void setOutputFilename(java.lang.String outFile)
Sets filename to be passed as output to the next module in the itinery. If AddOutputFilenameToCommand is set this filename is also appended to the external command

Parameters:
outFile - filename to be passed as output to the next module in the itinery

getOutputFilename

public java.lang.String getOutputFilename()
Returns filename to be passed as output to the next module in the itinery. If AddOutputFilenameToCommand is set this filename is also appended to the external command

Returns:
filename to be passed as output to the next module in the itinery

setWorkingDir

public void setWorkingDir(java.lang.String path)
Sets the path to the working directory to execute the external command in.

Parameters:
path - The path to the working directory to execute the external command in

getWorkingDir

public java.lang.String getWorkingDir()
Returns the path to the working directory to execute the external command in.

Returns:
The path to the working directory to execute the external command in

setAddExtensionToInput

public void setAddExtensionToInput(boolean addExtension)
Sets the flag that determines whether an extension is added to the input filename in order to generate the output filename, this takes precedence over any output filename specified.

Parameters:
addExtension - The value of the flag that determines whether an extension is added to the input filename

getAddExtensionToInput

public boolean getAddExtensionToInput()
Returns the value of the flag that determines whether an extension is added to the input filename in order to generate the output filename, this takes precedence over any output filename specified.

Returns:
The value of the flag that determines whether an extension is added to the input filename

setExtension

public void setExtension(java.lang.String ext)
Sets the extension that is added to the input filename in order to generate the output filename, which takes precedence over any output filename specified.

Parameters:
ext - The extension to add to the input filename

getExtension

public java.lang.String getExtension()
Returns the extension that is added to the input filename in order to generate the output filename, which takes precedence over any output filename specified.

Returns:
The extension to add to the input filename

getPropertiesDescriptions

public ncsa.d2k.core.modules.PropertyDescription[] getPropertiesDescriptions()
Returns an array of description objects for each property of the Module.

Returns:
an array of description objects for each property of the Module.

beginExecution

public void beginExecution()
Clears variable when any itinery containing the module is run.


endExecution

public void endExecution()
Destroys any lingering processes when the module execution is ended.


isReady

public boolean isReady()
Controls whether the module is ready to run

Returns:
a boolean flag indicating whether the module is ready to run

doit

protected void doit()
             throws java.lang.Exception
Executes the external command via the java Runtime object.

Throws:
java.lang.Exception - If an error occurs.

getInputInfo

public java.lang.String getInputInfo(int param)
Returns a text description for the indicated input.

Parameters:
param - the index of the input
Returns:
a text description of the indexed input

getInputTypes

public java.lang.String[] getInputTypes()
Returns an array of strings containing the Java data types of the input.

Returns:
the fully qualified java types for each of the inputs

getInputName

public java.lang.String getInputName(int i)
Returns a text name for the given input.

Parameters:
i - the index of the input
Returns:
the name of the indexed input

getModuleInfo

public java.lang.String getModuleInfo()
Returns information about the module.

Returns:
Module information

getOutputInfo

public java.lang.String getOutputInfo(int param)
Returns a text name for the given output.

Parameters:
param - the index of the output
Returns:
the name of the indexed output

getOutputTypes

public java.lang.String[] getOutputTypes()
Returns an array of strings containing the Java data types of the outputs.

Returns:
the fully qualified java types for each of the outputs.

getOutputName

public java.lang.String getOutputName(int i)
Returns a text name for the given output.

Parameters:
i - the index of the output
Returns:
the name of the indexed output