Package com.day.cq.dam.core.process
Class CommandLineProcess
- java.lang.Object
-
- com.day.cq.dam.commons.process.AbstractAssetWorkflowProcess
-
- com.day.cq.dam.core.process.CommandLineProcess
-
- All Implemented Interfaces:
WorkflowProcess
@Service @Property(name="process.label", value="Command Line") public class CommandLineProcess extends AbstractAssetWorkflowProcess
Workflow process that calls a command-line program and uses each output file that it produces as an additional rendition. Optionally creates thumbnails based on those renditions.
The dimensions given in the thumbnail specifications are the maximal size the result must have. Aspect ratio is maintained for image resizing. As a precondition, the payload of this Workflow process has to be anAsset
or part of an Asset.Example with the following workflow step arguments:
mime:application/postscript, tn:140:100,tn:48:48, cmd:/bin/convert ${directory}/${filename} ${directory}/${basename}.jpg
The process will call /bin/convert, pass it the full path of the asset being processed (temporarily dumped to disk), and create thumbnails of size 140x100 and 48x48 based on the output created by /bin/convert.
This will only happen for assets having theapplication/postscript
mime-type, others are ignored.Arguments:
Name Prefix Description Required Multiple Example Command cmd: Command as executed on the consle.
The command can contain varibales which are replaced before execution. The following variables are available:
filename: name of the file as exported to disk.
file: absolute path of the file exported.
directory: absolute path of the directory the command is run and the asset is exported to.
basename: the assets name on the disk without possible file-extension
extension: the assets file extension.
required multiple cmd:/bin/convert ${directory}/${filename} ${directory}/${basename}.jpg Mimetype Filter mime: Mimetype the Asset must have. If the Asset is of a diffrent type, this process will not be executed. required multiple mime:application/postscript Thumbnail Specification tn: Dimensions of the Thumbnails to be generated from the Asset.
width:height[:false]
width:Number the maximal width in Pixel the Thumbnail must not exceed height:Number the maximal height in Pixel the Thumbnail must not exceed. center:Boolean, optional flag to indicate that the resulting Thumbnail must not be centered, true is default.multiple tn:140:100 - See Also:
AbstractAssetWorkflowProcess
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CommandLineProcess.Arguments
The available arguments to this process implementation.
-
Field Summary
-
Fields inherited from class com.day.cq.dam.commons.process.AbstractAssetWorkflowProcess
TYPE_JCR_PATH
-
-
Constructor Summary
Constructors Constructor Description CommandLineProcess()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]
buildArguments(MetaDataMap metaData)
void
execute(WorkItem workItem, WorkflowSession wfsession, MetaDataMap args)
Executes a new Java process with the given
andWorkItem
.WorkflowSession
-
-
-
Method Detail
-
execute
public void execute(WorkItem workItem, WorkflowSession wfsession, MetaDataMap args) throws WorkflowException
Description copied from interface:WorkflowProcess
Executes a new Java process with the given
andWorkItem
.WorkflowSession
- Parameters:
workItem
- The
that defines the newly startedWorkItem
JavaProcessNew
.wfsession
- The
that is used for starting theWorkflowSession
JavaProcess
.args
- Process specific arguments can be passed here- Throws:
WorkflowException
- Thrown in case something goes wrong during execution.
-
buildArguments
public java.lang.String[] buildArguments(MetaDataMap metaData)
-
-