Class ExternalProcessCallNode
- java.lang.Object
-
- com.levigo.jadice.server.internal.NodeInternal
-
- com.levigo.jadice.server.Node
-
- com.levigo.jadice.server.external.ExternalProcessCallNode
-
public class ExternalProcessCallNode extends Node
Calls an external program that is used to convert streams.Stream
s that are passed to this node will first be converted to temporary files. Resulting files will be re-converted toStream
s streams and passed to subsequentNode
s. Those files are deleted after the external program afterwards.This node can also act as a source or a sink in the workflow:
- If
INFILE_PLACEHOLDER
does not appear in the program arguments it is considered as a source. - If neither
OUTFILE_PLACEHOLDER
does appear nor the flagisInfileEqOutfile()
is set, this node is considered as a sink.
- If
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.levigo.jadice.server.Node
Node.Cardinality
-
-
Field Summary
Fields Modifier and Type Field Description static String
INFILE_PLACEHOLDER
Template for thearguments
that will replaced by the input file.static String
OUTFILE_PLACEHOLDER
Template for thearguments
that will replaced by the output file.static Pattern
OUTFILE_PLACEHOLDER_PATTERN
Matcher for theOUTFILE_PLACEHOLDER
.
-
Constructor Summary
Constructors Constructor Description ExternalProcessCallNode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getArguments()
Node.Cardinality
getInputCardinality()
Calculates the Input cardinality according to theprogram arguments
.String
getInputFilename()
String
getOutfileExtension()
Node.Cardinality
getOutputCardinality()
Calculates the Output cardinality according to theprogram arguments
.String
getOutputMimeType()
String
getProgramName()
String
getWorkerClassName()
Return the node's associatedcom.levigo.jadice.server.core.NodeWorker
full qualified class's name.boolean
isDestroyRemainingProcessesOnAbort()
boolean
isInfileEqOutfile()
boolean
isInputStreamExists()
boolean
isOutputStreamExists()
boolean
isWaitForApplication()
void
setArguments(String arguments)
Set the command line arguments.void
setDestroyRemainingProcessesOnAbort(boolean destroyRemainingProcessesOnAbort)
If this property is set totrue
, the external processes started by this node will bedestroyed
when the associatedJob is aborted
or fails.void
setInfileEqOutfile(boolean infileEqOutfile)
If the external program does not create a new (resulting) file but processes the input file, this processed file can be passed to the subsequent workflow.void
setInputFilename(String filename)
Sets the filename for the input stream.void
setOutfileExtension(String outfileExtension)
Set the default extension of an temporary output file if needed, if not present in the argument placeholders.void
setOutputMimeType(String outputMimeType)
Set the MIME type of the result of this external process call.void
setProgramName(String programName)
Set the path to the external program.void
setWaitForApplication(boolean waitForApplication)
Causes the Worker to wait until the process of the external program has terminated before it passes the result the subsequent workflow.protected void
validateConfiguration()
-
Methods inherited from class com.levigo.jadice.server.Node
addTransportReceiver, appendSuccessor, apply, equals, getJob, getPredecessors, getSubsidiaryNodes, getSuccessors, getTransportSender, getUUID, hashCode, initialize, prependPredecessor, remove
-
-
-
-
Field Detail
-
INFILE_PLACEHOLDER
public static final String INFILE_PLACEHOLDER
Template for thearguments
that will replaced by the input file.- See Also:
- Constant Field Values
-
OUTFILE_PLACEHOLDER
public static final String OUTFILE_PLACEHOLDER
Template for thearguments
that will replaced by the output file.- See Also:
- Constant Field Values
-
OUTFILE_PLACEHOLDER_PATTERN
public static final Pattern OUTFILE_PLACEHOLDER_PATTERN
Matcher for theOUTFILE_PLACEHOLDER
. Enhanced by the capability to introduce a parameter that hold the outfile's extension.Examples:
${outfile}
- The resulting outfile will use the default extension
getOutfileExtension()
${outfile:pdf}
- The resulting outfile will use the extension
pdf
- Since:
- jadice server 4.5.1.0
-
-
Method Detail
-
getWorkerClassName
public String getWorkerClassName()
Description copied from class:Node
Return the node's associatedcom.levigo.jadice.server.core.NodeWorker
full qualified class's name. By default, the worker class name is- The same as the node name with the trailing "Node" replaced by "Worker" if the node name ends in "Node"
- The node class name with an appended "Worker" otherwise.
This behavior can be overridden in concrete subclasses.
- Overrides:
getWorkerClassName
in classNode
- Returns:
- the full qualified class name of the worker of this node.
-
getArguments
public String getArguments()
-
setArguments
public void setArguments(String arguments)
Set the command line arguments. Optional placeholders are:INFILE_PLACEHOLDER
- for the position of the input filename
OUTFILE_PLACEHOLDER
- for the position of the output filename with
default extension
${outfile:ext}
- for the position of the output filename with extension
ext
Example:
-s -a "${infile}" /convert="${outfile}" /log=${outfile:log}
- Parameters:
arguments
- The program's command line arguments
-
getOutfileExtension
public String getOutfileExtension()
-
setOutfileExtension
public void setOutfileExtension(String outfileExtension)
Set the default extension of an temporary output file if needed, if not present in the argument placeholders.Example:
.jpg
- Parameters:
outfileExtension
- Extension of the output file the external program expects
-
getProgramName
public String getProgramName()
-
setProgramName
public void setProgramName(String programName)
Set the path to the external program. E.g.:C:\Programme\Notepad++\Notepad++.exe
- Parameters:
programName
- Full path to the external program
-
isWaitForApplication
public boolean isWaitForApplication()
-
setWaitForApplication
public void setWaitForApplication(boolean waitForApplication)
Causes the Worker to wait until the process of the external program has terminated before it passes the result the subsequent workflow. (default:true
)- Parameters:
waitForApplication
- iftrue
the worker will wait for the external process to wait
-
isOutputStreamExists
public boolean isOutputStreamExists()
- Returns:
true
iff an output stream will exists (i.e.OUTFILE_PLACEHOLDER
was set in theprogram argument
).
-
isInputStreamExists
public boolean isInputStreamExists()
- Returns:
true
iff an input stream will exists (i.e.INFILE_PLACEHOLDER
was set in theprogram argument
).
-
isInfileEqOutfile
public boolean isInfileEqOutfile()
-
setInfileEqOutfile
public void setInfileEqOutfile(boolean infileEqOutfile)
If the external program does not create a new (resulting) file but processes the input file, this processed file can be passed to the subsequent workflow. Therefore the value must be set totrue
.- Parameters:
infileEqOutfile
- if true the processed INPUT file will be passed
-
getOutputMimeType
public String getOutputMimeType()
-
setOutputMimeType
public void setOutputMimeType(String outputMimeType)
Set the MIME type of the result of this external process call. This helps subsequentNode
s as that information will be stored withinthe stream descriptor
of the resulting stream.- Parameters:
outputMimeType
- The MIME type of the external process call's result.
-
validateConfiguration
protected void validateConfiguration() throws ConfigurationException
- Overrides:
validateConfiguration
in classNode
- Throws:
ConfigurationException
-
isDestroyRemainingProcessesOnAbort
public boolean isDestroyRemainingProcessesOnAbort()
-
setDestroyRemainingProcessesOnAbort
public void setDestroyRemainingProcessesOnAbort(boolean destroyRemainingProcessesOnAbort)
If this property is set totrue
, the external processes started by this node will bedestroyed
when the associatedJob is aborted
or fails.Default value is
false
so that is not guaranteed that no idling processes remain.- Parameters:
destroyRemainingProcessesOnAbort
- flag if external processes shall be destroyed when a Job is aborted or fails
-
getInputCardinality
public Node.Cardinality getInputCardinality()
Calculates the Input cardinality according to theprogram arguments
.- Overrides:
getInputCardinality
in classNode
- Returns:
- input cardinality
-
getOutputCardinality
public Node.Cardinality getOutputCardinality()
Calculates the Output cardinality according to theprogram arguments
.- Overrides:
getOutputCardinality
in classNode
- Returns:
- output cardinality
-
setInputFilename
public void setInputFilename(String filename)
Sets the filename for the input stream. Primary the filename from theStreamDescriptor
is used.- Parameters:
filename
- filename for the input stream- See Also:
StreamDescriptor.getFileName()
-
getInputFilename
public String getInputFilename()
-
-