Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.repo.content.transform
Class FailoverContentTransformer
java.lang.Object
  org.alfresco.repo.content.transform.ContentTransformerHelper
      org.alfresco.repo.content.transform.AbstractContentTransformerLimits
          org.alfresco.repo.content.transform.AbstractContentTransformer2
              org.alfresco.repo.content.transform.FailoverContentTransformer
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, ContentTransformer, ContentWorker, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.Aware

@org.alfresco.api.AlfrescoPublicApi
public class FailoverContentTransformer
extends AbstractContentTransformer2
implements org.springframework.beans.factory.InitializingBean
This class is a transformer which contains a fixed sequence of delegate transformers. Requests to transform a document will be passed to the first transformer in the sequence. If that transformer successfully transforms the document then the process is complete. However should it fail, the transformation will be passed on to the next transformer in the sequence and so on.

Transformers are considered to have failed of they throw an exception.

Author:
Neil McErlean

Fields inherited from class org.alfresco.repo.content.transform.AbstractContentTransformerLimits
transformerDebug
Fields inherited from class org.alfresco.repo.content.transform.ContentTransformerHelper
transformerConfig
Constructor Summary
FailoverContentTransformer()
Method Summary
void
afterPropertiesSet()
          Ensures that required properties have been set
getComments(boolean available)
          Returns the transformer properties predefined (hard coded or implied) by this transformer.
boolean
isExplicitTransformation(String sourceMimetype, String targetMimetype, TransformationOptions options)
boolean
isTransformable(String sourceMimetype, long sourceSize, String targetMimetype, TransformationOptions options)
          Overrides super class method to avoid calling isTransformableMimetype(String, String, TransformationOptions) twice on each transformer in the list, as isTransformableSize(String, long, String, TransformationOptions) in this class must check the mimetype too.
boolean
isTransformableMimetype(String sourceMimetype, String targetMimetype, TransformationOptions options)
          Indicates if this transformer is able to transform the given source mimetype to the target mimetype.
boolean
isTransformableSize(String sourceMimetype, long sourceSize, String targetMimetype, TransformationOptions options)
          Indicates if this transformer is able to transform the given sourceSize.
void
setTransformers(List<ContentTransformer> transformers)
          The list of transformers to use.
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.
Methods inherited from class org.alfresco.repo.content.transform.AbstractContentTransformer2
checkTransformable, getExecutorService, getTransformationTime, getTransformationTime, isTransformationLimitedInternally, recordError, recordTime, recordTime, register, setAdditionalThreadTimout, setExecutorService, setMetadataExtracterConfig, setRegisterTransformer, setRegistry, setRetryTransformOnDifferentMimeType, setUseTimeoutThread, toString, transform, transform, transform
Methods inherited from class org.alfresco.repo.content.transform.AbstractContentTransformerLimits
getLimits, getLimits, getLimits, getMaxPages, getMaxSourceSizeKBytes, getMaxSourceSizeKBytes, getPageLimit, getReadLimitKBytes, getReadLimitTimeMs, getTimeoutMs, isPageLimitSupported, isTransformable, setLimits, setMaxPages, setMaxSourceSizeKBytes, setMimetypeLimits, setPageLimit, setPageLimitsSupported, setReaderLimits, setReadLimitKBytes, setReadLimitTimeMs, setTimeoutMs, setTransformerDebug
Methods inherited from class org.alfresco.repo.content.transform.ContentTransformerHelper
deprecatedSetter, equals, getBeanName, getCommentsOnlySupports, getExtensionOrAny, getMimetype, getMimetypeService, getName, getSimpleName, hashCode, isSupportedTransformation, onlySupports, setBeanName, setExplicitTransformations, setMimetypeService, setSupportedTransformations, setTransformerConfig, setUnsupportedTransformations
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.alfresco.repo.content.transform.ContentTransformer
getName
Constructor Detail
FailoverContentTransformer
public FailoverContentTransformer()
Method Detail
setTransformers
public void setTransformers(List<ContentTransformer> transformers)
The list of transformers to use. There must be at least one, but for failover behaviour to work there should be at least two.
Parameters:
transformers - list of transformers.

afterPropertiesSet
public void afterPropertiesSet()
                        throws Exception
Ensures that required properties have been set
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

isTransformable
public boolean isTransformable(String sourceMimetype,
                               long sourceSize,
                               String targetMimetype,
                               TransformationOptions options)
Overrides super class method to avoid calling isTransformableMimetype(String, String, TransformationOptions) twice on each transformer in the list, as isTransformableSize(String, long, String, TransformationOptions) in this class must check the mimetype too.
Specified by:
isTransformable in interface ContentTransformer
Overrides:
isTransformable in class AbstractContentTransformerLimits
Parameters:
sourceMimetype - the source mimetype
sourceSize - the size (bytes) of the source. If negative it is unknown.
targetMimetype - the target mimetype
options - the transformation options
Returns:
boolean true if this content transformer can satify the mimetypes and options specified, false otherwise

isTransformableMimetype
public boolean isTransformableMimetype(String sourceMimetype,
                                       String targetMimetype,
                                       TransformationOptions options)
Description copied from class: AbstractContentTransformerLimits
Indicates if this transformer is able to transform the given source mimetype to the target mimetype. If overridden, consider also overriding ContentTransformerHelper.getComments(boolean).
Specified by:
isTransformableMimetype in interface ContentTransformer
Overrides:
isTransformableMimetype in class AbstractContentTransformerLimits
Parameters:
sourceMimetype - the source mimetype
targetMimetype - the target mimetype
options - the transformation options
Returns:
boolean true if this content transformer can satify the mimetypes, false otherwise

isTransformableSize
public boolean isTransformableSize(String sourceMimetype,
                                   long sourceSize,
                                   String targetMimetype,
                                   TransformationOptions options)
Description copied from class: AbstractContentTransformerLimits
Indicates if this transformer is able to transform the given sourceSize. The maxSourceSizeKBytes property may indicate that only small source files may be transformed.
Specified by:
isTransformableSize in interface ContentTransformer
Overrides:
isTransformableSize in class AbstractContentTransformerLimits
Parameters:
sourceMimetype - the source mimetype
sourceSize - size in bytes of the source. If negative, the source size is unknown.
targetMimetype - the target mimetype
options - the transformation options
Returns:
true if the source is transformable.

isExplicitTransformation
public boolean isExplicitTransformation(String sourceMimetype,
                                        String targetMimetype,
                                        TransformationOptions options)
Specified by:
isExplicitTransformation in interface ContentTransformer
Overrides:
isExplicitTransformation in class ContentTransformerHelper
Parameters:
sourceMimetype - the source mimetype
targetMimetype - the target mimetype
options - the transformation options
Returns:
boolean true if it is an explicit transformation, false otherwise

transformInternal
public void transformInternal(ContentReader reader,
                              ContentWriter writer,
                              TransformationOptions options)
                       throws 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.
Overrides:
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:
Exception - exceptions will be handled by this class - subclasses can throw anything
See Also:
AbstractContentTransformer2.transformInternal(org.alfresco.service.cmr.repository.ContentReader, org.alfresco.service.cmr.repository.ContentWriter, org.alfresco.service.cmr.repository.TransformationOptions)

getComments
public String getComments(boolean available)
Returns the transformer properties predefined (hard coded or implied) by this transformer.
Specified by:
getComments in interface ContentTransformer
Overrides:
getComments in class ContentTransformerHelper
Parameters:
available - indicates if the transformer has been registered and is available to be selected. false indicates that the transformer is only available as a component of a complex transformer.
Returns:
one line per property. The simple transformer name is returned by default as a comment.

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2018 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.