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

java.lang.Object
  extended by org.alfresco.repo.content.transform.AbstractContentTransformer2
      extended by org.alfresco.repo.content.transform.magick.AbstractImageMagickContentTransformer
All Implemented Interfaces:
ContentWorker, ContentTransformer
Direct Known Subclasses:
ImageMagickContentTransformer

public abstract class AbstractImageMagickContentTransformer
extends AbstractContentTransformer2

Abstract helper for transformations based on ImageMagick


Field Summary
static java.lang.String MIMETYPE_IMAGE_PREFIX
          the prefix for mimetypes supported by the transformer
 
Constructor Summary
AbstractImageMagickContentTransformer()
           
 
Method Summary
 void init()
          Checks for the JMagick and ImageMagick dependencies, using the common transformation method to check that the sample image can be converted.
 boolean isAvailable()
           
static boolean isSupported(java.lang.String mimetype)
          Some image formats are not supported by ImageMagick, or at least appear not to work.
 boolean isTransformable(java.lang.String sourceMimetype, java.lang.String targetMimetype, TransformationOptions options)
          Supports image to image conversion, but only if the JMagick library and required libraries are available.
protected  void setAvailable(boolean available)
          Make the transformer available
protected  void transformInternal(ContentReader reader, ContentWriter writer, TransformationOptions options)
          Method to be implemented by subclasses wishing to make use of the common infrastructural code provided by this class.
protected abstract  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.AbstractContentTransformer2
checkTransformable, getMimetype, getMimetypeService, getTransformationTime, isExplicitTransformation, recordTime, register, setExplicitTransformations, setMimetypeService, setRegistry, toString, transform, transform, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MIMETYPE_IMAGE_PREFIX

public static final java.lang.String MIMETYPE_IMAGE_PREFIX
the prefix for mimetypes supported by the transformer

See Also:
Constant Field Values
Constructor Detail

AbstractImageMagickContentTransformer

public AbstractImageMagickContentTransformer()
Method Detail

isAvailable

public boolean isAvailable()
Returns:
Returns true if the transformer is functioning otherwise false

setAvailable

protected void setAvailable(boolean available)
Make the transformer available

Parameters:
available -

init

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

If initialization is successful, then autoregistration takes place.


isSupported

public static boolean isSupported(java.lang.String mimetype)
Some image formats are not supported by ImageMagick, or at least appear not to work.

Parameters:
mimetype - the mimetype to check
Returns:
Returns true if ImageMagic can handle the given image format

isTransformable

public boolean isTransformable(java.lang.String sourceMimetype,
                               java.lang.String targetMimetype,
                               TransformationOptions options)
Supports image to image conversion, but only if the JMagick library and required libraries are available.

Parameters:
sourceMimetype - the source mimetype
options - the transformation options
Returns:
boolean true if this content transformer can satify the mimetypes and options specified, false otherwise

transformInternal

protected final void transformInternal(ContentReader reader,
                                       ContentWriter writer,
                                       TransformationOptions options)
                                throws java.lang.Exception
Description copied from class: AbstractContentTransformer2
Method to be implemented by subclasses wishing to make use of the common infrastructural code provided by this class.

Specified by:
transformInternal in class AbstractContentTransformer2
Parameters:
reader - the source of the content to transform
writer - the target to which to write the transformed content
options - a map of options to use when performing the transformation. The map will never be null.
Throws:
java.lang.Exception - exceptions will be handled by this class - subclasses can throw anything
See Also:
#transformInternal(File, File)

transformInternal

protected abstract 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

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 - 2008 Alfresco Software, Inc. All Rights Reserved.