org.alfresco.repo.content.transform.magick
Class ImageMagickContentTransformerWorker

java.lang.Object
  extended by org.alfresco.repo.content.transform.ContentTransformerHelper
      extended by org.alfresco.repo.content.transform.magick.AbstractImageMagickContentTransformerWorker
          extended by org.alfresco.repo.content.transform.magick.ImageMagickContentTransformerWorker
All Implemented Interfaces:
ContentTransformerWorker, org.springframework.beans.factory.InitializingBean

public class ImageMagickContentTransformerWorker
extends AbstractImageMagickContentTransformerWorker

Executes a statement to implement


Field Summary
 
Fields inherited from class org.alfresco.repo.content.transform.magick.AbstractImageMagickContentTransformerWorker
MIMETYPE_IMAGE_PREFIX
 
Constructor Summary
ImageMagickContentTransformerWorker()
          Default constructor
 
Method Summary
 void afterPropertiesSet()
          Checks for the JMagick and ImageMagick dependencies, using the common transformation method to check that the sample image can be converted.
 java.lang.String getVersionString()
          Gets the version string captured from the check command.
 void setCheckCommand(org.alfresco.util.exec.RuntimeExec checkCommand)
          Sets the command that must be executed in order to retrieve version information from the converting executable and thus test that the executable itself is present.
 void setExecuter(org.alfresco.util.exec.RuntimeExec executer)
          Set the runtime command executer that must be executed in order to run ImageMagick.
protected  void transformInternal(java.io.File sourceFile, java.io.File targetFile, TransformationOptions options)
          Transform the image content from the source file to the target file
 
Methods inherited from class org.alfresco.repo.content.transform.magick.AbstractImageMagickContentTransformerWorker
isAvailable, isSupported, isTransformable, setAvailable, transform
 
Methods inherited from class org.alfresco.repo.content.transform.ContentTransformerHelper
getMimetype, getMimetypeService, isExplicitTransformation, setExplicitTransformations, setMimetypeService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageMagickContentTransformerWorker

public ImageMagickContentTransformerWorker()
Default constructor

Method Detail

setExecuter

public void setExecuter(org.alfresco.util.exec.RuntimeExec executer)
Set the runtime command executer that must be executed in order to run ImageMagick. Whether or not this is the full path to the convertCommand or just the convertCommand itself depends the environment setup.

The command must contain the variables ${source} and ${target}, which will be replaced by the names of the file to be transformed and the name of the output file respectively.

    convert ${source} ${target}
 

Parameters:
executer - the system command executer

setCheckCommand

public void setCheckCommand(org.alfresco.util.exec.RuntimeExec checkCommand)
Sets the command that must be executed in order to retrieve version information from the converting executable and thus test that the executable itself is present.

Parameters:
checkCommand - command executer to retrieve version information

getVersionString

public java.lang.String getVersionString()
Gets the version string captured from the check command.

Returns:
the version string

afterPropertiesSet

public void afterPropertiesSet()
Checks for the JMagick and ImageMagick dependencies, using the common transformation method to check that the sample image can be converted.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Overrides:
afterPropertiesSet in class AbstractImageMagickContentTransformerWorker

transformInternal

protected void transformInternal(java.io.File sourceFile,
                                 java.io.File targetFile,
                                 TransformationOptions options)
                          throws java.lang.Exception
Transform the image content from the source file to the target file

Specified by:
transformInternal in class AbstractImageMagickContentTransformerWorker
Parameters:
sourceFile - the source of the transformation
targetFile - the target of the transformation
options - the transformation options supported by ImageMagick
Throws:
java.lang.Exception


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.