Class AbstractContentTransformer2
- java.lang.Object
-
- org.alfresco.repo.content.transform.ContentTransformerHelper
-
- org.alfresco.repo.content.transform.AbstractContentTransformerLimits
-
- org.alfresco.repo.content.transform.AbstractContentTransformer2
-
- All Implemented Interfaces:
ContentWorker,ContentTransformer,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware
- Direct Known Subclasses:
AbstractRemoteContentTransformer,BinaryPassThroughContentTransformer,ComplexContentTransformer,EMLTransformer,FailoverContentTransformer,MediaWikiContentTransformer,OOXMLThumbnailContentTransformer,ProxyContentTransformer
@Deprecated @AlfrescoPublicApi public abstract class AbstractContentTransformer2 extends AbstractContentTransformerLimits
Deprecated.The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries.Provides basic services forContentTransformerimplementations.This class maintains the performance measures for the transformers as well, making sure that there is an extra penalty for transformers that fail regularly.
- Author:
- Derek Hulley, Roy Wetherall
-
-
Field Summary
-
Fields inherited from class org.alfresco.repo.content.transform.AbstractContentTransformerLimits
transformerDebug
-
Fields inherited from class org.alfresco.repo.content.transform.ContentTransformerHelper
transformerConfig
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractContentTransformer2()Deprecated.All transformers start with an average transformation time of 0.0 ms, unless there is an Alfresco global property<beanName>.time.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidcheckTransformable(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, TransformationOptions options)Deprecated.Convenience method to check the transformability of a transformationprotected java.util.concurrent.ExecutorServicegetExecutorService()Deprecated.Gets theExecutorServiceto be used for timeout-aware extraction.java.lang.ObjectgetRetryTransformOnDifferentMimeType()Deprecated.booleangetStrictMimeTypeCheck()Deprecated.longgetTransformationTime()Deprecated.longgetTransformationTime(java.lang.String sourceMimetype, java.lang.String targetMimetype)Deprecated.Provides an estimate, usually a worst case guess, of how long a transformation will take.java.lang.BooleanisTransformationLimitedInternally()Deprecated.protected voidrecordError(java.lang.String sourceMimetype, java.lang.String targetMimetype, long transformationTime)Deprecated.Records an error and updates the average time as if the transformation took a long time, so that it is less likely to be called again.protected voidrecordTime(long transformationTime)Deprecated.use method with mimetypes.protected voidrecordTime(java.lang.String sourceMimetype, java.lang.String targetMimetype, long transformationTime)Deprecated.Records and updates the average transformation time for this transformer.voidregister()Deprecated.Registers this instance with theregistryif it is present.voidsetAdditionalThreadTimout(long additionalThreadTimout)Deprecated.voidsetExecutorService(java.util.concurrent.ExecutorService executorService)Deprecated.Sets theExecutorServiceto be used for timeout-aware transformation.voidsetRegisterTransformer(boolean registerTransformer)Deprecated.voidsetRegistry(ContentTransformerRegistry registry)Deprecated.The registry to auto-register withvoidsetRetryTransformOnDifferentMimeType(boolean retryTransformOnDifferentMimeType)Deprecated.voidsetStrictMimeTypeCheck(boolean strictMimeTypeCheck)Deprecated.voidsetUseTimeoutThread(java.lang.Boolean useTimeoutThread)Deprecated.java.lang.StringtoString()Deprecated.voidtransform(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer)Deprecated.voidtransform(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, java.util.Map<java.lang.String,java.lang.Object> options)Deprecated.Transforms the content provided by the reader and source mimetype to the writer and target mimetype.voidtransform(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, TransformationOptions options)Deprecated.Transforms the content provided by the reader and source mimetype to the writer and target mimetype with the provided transformation options.protected abstract voidtransformInternal(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, TransformationOptions options)Deprecated.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.AbstractContentTransformerLimits
getLimits, getLimits, getLimits, getMaxPages, getMaxSourceSizeKBytes, getMaxSourceSizeKBytes, getPageLimit, getReadLimitKBytes, getReadLimitTimeMs, getTimeoutMs, isPageLimitSupported, isTransformable, isTransformable, isTransformableMimetype, isTransformableSize, setLimits, setMaxPages, setMaxSourceSizeKBytes, setMimetypeLimits, setPageLimit, setPageLimitsSupported, setReaderLimits, setReadLimitKBytes, setReadLimitTimeMs, setTimeoutMs, setTransformerDebug
-
Methods inherited from class org.alfresco.repo.content.transform.ContentTransformerHelper
deprecatedSetter, equals, getBeanName, getComments, getCommentsOnlySupports, getExtensionOrAny, getMimetype, getMimetypeService, getName, getSimpleName, hashCode, isExplicitTransformation, 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
getComments, getName, isExplicitTransformation
-
-
-
-
Constructor Detail
-
AbstractContentTransformer2
protected AbstractContentTransformer2()
Deprecated.All transformers start with an average transformation time of 0.0 ms, unless there is an Alfresco global property<beanName>.time. May also be set for given combinations of source and target mimetypes.
-
-
Method Detail
-
setRegistry
public void setRegistry(ContentTransformerRegistry registry)
Deprecated.The registry to auto-register with- Parameters:
registry- the transformer registry
-
setRegisterTransformer
public void setRegisterTransformer(boolean registerTransformer)
Deprecated.- Parameters:
registerTransformer- as been available for selection. Iffalsethis indicates that the transformer may only be used as part of another transformer.
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toStringin classContentTransformerHelper
-
register
public void register()
Deprecated.Registers this instance with theregistryif it is present. THIS IS A CUSTOM SPRING INIT METHOD- Overrides:
registerin classContentTransformerHelper
-
checkTransformable
protected void checkTransformable(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, TransformationOptions options)Deprecated.Convenience method to check the transformability of a transformation- Parameters:
reader- content readerwriter- content writeroptions- transformation options- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the the transformation isn't supported
-
transformInternal
protected abstract void transformInternal(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, TransformationOptions options) throws java.lang.ExceptionDeprecated.Method to be implemented by subclasses wishing to make use of the common infrastructural code provided by this class.- Parameters:
reader- the source of the content to transformwriter- the target to which to write the transformed contentoptions- 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
-
transform
public final void transform(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer) throws org.alfresco.service.cmr.repository.ContentIOExceptionDeprecated.- Throws:
org.alfresco.service.cmr.repository.ContentIOException- See Also:
transform(ContentReader, ContentWriter, Map),transformInternal(ContentReader, ContentWriter, TransformationOptions)
-
transform
public final void transform(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, TransformationOptions options) throws org.alfresco.service.cmr.repository.ContentIOExceptionDeprecated.Description copied from interface:ContentTransformerTransforms the content provided by the reader and source mimetype to the writer and target mimetype with the provided transformation options.The transformation viability can be determined by an up front call to
ContentTransformer.isTransformable(String, String, TransformationOptions).The source and target mimetypes must be available on the
ContentAccessor.getMimetype()methods of both the reader and the writer.Both reader and writer will be closed after the transformation completes.
The provided options can be null.
- Parameters:
reader- the source of the contentwriter- the destination of the transformed contentoptions- transformation options, these can be null- Throws:
org.alfresco.service.cmr.repository.ContentIOException- if an IO exception occurs- See Also:
ContentTransformer.transform(org.alfresco.service.cmr.repository.ContentReader, org.alfresco.service.cmr.repository.ContentWriter, org.alfresco.service.cmr.repository.TransformationOptions)
-
transform
public final void transform(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, java.util.Map<java.lang.String,java.lang.Object> options) throws org.alfresco.service.cmr.repository.ContentIOExceptionDeprecated.Description copied from interface:ContentTransformerTransforms the content provided by the reader and source mimetype to the writer and target mimetype.The source and target mimetypes must be available on the
ContentAccessor.getMimetype()methods of both the reader and the writer.Both reader and writer will be closed after the transformation completes.
- Parameters:
reader- the source of the contentwriter- the destination of the transformed contentoptions- options to pass to the transformer. These are transformer dependent and may be null.- Throws:
org.alfresco.service.cmr.repository.ContentIOException- if an IO exception occurs
-
getTransformationTime
public long getTransformationTime()
Deprecated.- Returns:
- Returns the calculated running average of the current transformations
-
getTransformationTime
public long getTransformationTime(java.lang.String sourceMimetype, java.lang.String targetMimetype)Deprecated.Description copied from interface:ContentTransformerProvides an estimate, usually a worst case guess, of how long a transformation will take. Null mimetype values provide the overall value for the transformer.This method is used to determine, up front, which of a set of equally reliant transformers will be used for a specific transformation.
- Parameters:
sourceMimetype- the source mimetypetargetMimetype- the target mimetype- Returns:
- Returns the calculated running average of the current transformations
-
recordTime
protected final void recordTime(long transformationTime)
Deprecated.use method with mimetypes.
-
recordTime
protected final void recordTime(java.lang.String sourceMimetype, java.lang.String targetMimetype, long transformationTime)Deprecated.Records and updates the average transformation time for this transformer.Subclasses should call this after every transformation in order to keep the running average of the transformation times up to date.
This method is thread-safe. The time spent in this method is negligible so the impact will be minor.
- Parameters:
sourceMimetype- StringtargetMimetype- StringtransformationTime- the time it took to perform the transformation.
-
getExecutorService
protected java.util.concurrent.ExecutorService getExecutorService()
Deprecated.Gets theExecutorServiceto be used for timeout-aware extraction.If no
ExecutorServicehas been defined a default ofExecutors.newCachedThreadPool()is used duringAbstractMappingMetadataExtracter.init().- Returns:
- the defined or default
ExecutorService
-
setExecutorService
public void setExecutorService(java.util.concurrent.ExecutorService executorService)
Deprecated.Sets theExecutorServiceto be used for timeout-aware transformation.- Parameters:
executorService- -ExecutorServiceinstance for timeouts
-
setUseTimeoutThread
public void setUseTimeoutThread(java.lang.Boolean useTimeoutThread)
Deprecated.- Parameters:
useTimeoutThread- -Booleanvalue which specifies timeout limiting mechanism for the current transformer- See Also:
useTimeoutThread
-
setAdditionalThreadTimout
public void setAdditionalThreadTimout(long additionalThreadTimout)
Deprecated.
-
isTransformationLimitedInternally
public java.lang.Boolean isTransformationLimitedInternally()
Deprecated.
-
recordError
protected final void recordError(java.lang.String sourceMimetype, java.lang.String targetMimetype, long transformationTime)Deprecated.Records an error and updates the average time as if the transformation took a long time, so that it is less likely to be called again.- Parameters:
sourceMimetype- StringtargetMimetype- StringtransformationTime- the time it took to perform the transformation.
-
getRetryTransformOnDifferentMimeType
public java.lang.Object getRetryTransformOnDifferentMimeType()
Deprecated.
-
setRetryTransformOnDifferentMimeType
public void setRetryTransformOnDifferentMimeType(boolean retryTransformOnDifferentMimeType)
Deprecated.
-
getStrictMimeTypeCheck
public boolean getStrictMimeTypeCheck()
Deprecated.
-
setStrictMimeTypeCheck
public void setStrictMimeTypeCheck(boolean strictMimeTypeCheck)
Deprecated.
-
-