com.day.cq.dam.core.process
Class CommandLineProcess

java.lang.Object
  extended by com.day.cq.dam.commons.process.AbstractAssetWorkflowProcess
      extended by 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 an Asset 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 the application/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
static class CommandLineProcess.Arguments
          The available arguments to this process implementation.
 
Field Summary
 
Fields inherited from class com.day.cq.dam.commons.process.AbstractAssetWorkflowProcess
APPLICATION_OCTET_STREAM_MIMETYPE, mimeTypeService, TYPE_JCR_PATH
 
Constructor Summary
CommandLineProcess()
           
 
Method Summary
 String[] buildArguments(MetaDataMap metaData)
           
protected  void createThumbnails(Asset asset, Rendition rendition, Collection<ThumbnailConfig> configs)
           
 void execute(WorkItem workItem, WorkflowSession wfsession, MetaDataMap args)
          Executes a new Java process with the given WorkItem and WorkflowSession.
 
Methods inherited from class com.day.cq.dam.commons.process.AbstractAssetWorkflowProcess
getAssetFromPayload, getAssetHandler, getAssetManager, getMimetype, getNodeFromPayload, getResourceResolver, getValuesFromArgs, isNotReadyForProcessing, recheck, safeGetPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandLineProcess

public CommandLineProcess()
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 WorkItem and WorkflowSession.

Parameters:
workItem - The WorkItem that defines the newly started JavaProcessNew.
wfsession - The WorkflowSession that is used for starting the JavaProcess.
args - Process specific arguments can be passed here
Throws:
WorkflowException - Thrown in case something goes wrong during execution.

createThumbnails

protected void createThumbnails(Asset asset,
                                Rendition rendition,
                                Collection<ThumbnailConfig> configs)
                         throws Exception
Throws:
Exception

buildArguments

public String[] buildArguments(MetaDataMap metaData)


Copyright © 2011-2012 Adobe Systems Incorporated. All Rights Reserved.