Class TransformerDebug
- java.lang.Object
-
- org.alfresco.repo.content.transform.TransformerDebug
-
@Deprecated @AlfrescoPublicApi public class TransformerDebug extends Object
Deprecated.The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries.Debugs transformers selection and activity.As transformations are frequently composed of lower level transformations, log messages include a prefix to identify the transformation. A numeric dot notation is used (such as
123.1.2indicating the second third level transformation of the 123rd top level transformation).In order to track of the nesting of transforms, this class has a stack to represent the Transformers. Each Transformer calls
pushTransform(org.alfresco.repo.content.transform.ContentTransformer, java.lang.String, java.lang.String, java.lang.String, long, org.alfresco.service.cmr.repository.TransformationOptions)at the start of a transform andpopTransform()at the end. However the top level transform may be selected from a list of available transformers. To record this activity,pushAvailable(java.lang.String, java.lang.String, java.lang.String, org.alfresco.service.cmr.repository.TransformationOptions),unavailableTransformer(org.alfresco.repo.content.transform.ContentTransformer, java.lang.String, java.lang.String, long)(to record the reason a transformer is rejected),availableTransformers(java.util.List<org.alfresco.repo.content.transform.ContentTransformer>, long, org.alfresco.service.cmr.repository.TransformationOptions, java.lang.String)(to record the available transformers) andpopAvailable()are called.- Author:
- Alan Davis
-
-
Constructor Summary
Constructors Constructor Description TransformerDebug(org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.cmr.repository.MimetypeService mimetypeService, ContentTransformerRegistry transformerRegistry, TransformerConfig transformerConfig, org.apache.commons.logging.Log transformerLog, org.apache.commons.logging.Log transformerDebugLog)Deprecated.Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidactiveTransformer(int mimetypePairCount, ContentTransformer transformer, String sourceMimetype, String targetMimetype, long maxSourceSizeKBytes, boolean firstMimetypePair)Deprecated.voidactiveTransformer(String sourceMimetype, String targetMimetype, int transformerCount, ContentTransformer transformer, long maxSourceSizeKBytes, boolean firstTransformer)Deprecated.voidavailableTransformers(List<ContentTransformer> transformers, long sourceSize, TransformationOptions options, String calledFrom)Deprecated.Called once all available transformers have been identified.voidblacklistTransform(ContentTransformer transformer, String sourceMimetype, String targetMimetype, TransformationOptions options)Deprecated.Called when a transformer has been ignored because of a blacklist entry.voiddebug(String message)Deprecated.Log a message prefixed with the current transformation reference.voiddebug(String message, Throwable t)Deprecated.Log a message prefixed with the current transformation reference and include a exception, suppressing the stack trace if repeated as we return up the stack of transformers.intdebugTransformServiceRequest(String sourceMimetype, long sourceSize, org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, int contentHashcode, String fileName, String targetMimetype, String use)Deprecated.Debugs a request to the Transform ServicevoiddebugTransformServiceResponse(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, int contentHashcode, long requested, int seq, String sourceExt, String targetExt, String msg)Deprecated.Debugs a response to the Transform ServiceStringfileSize(long size)Deprecated.StringgetFileName(TransformationOptions options, boolean firstLevel, long sourceSize)Deprecated.Collection<String>getSourceMimetypes(String sourceExtension)Deprecated.Returns a collection of mimetypes ordered by extension, but unlike the version in MimetypeService throws an exception if the sourceExtension is supplied but does not match a mimetype.StringBuildergetStringBuilder()Deprecated.Returns the current StringBuilder (if any) being used to capture debug information for the current Thread.Collection<String>getTargetMimetypes(String sourceExtension, String targetExtension, Collection<String> sourceMimetypes)Deprecated.Identical to getSourceMimetypes for the target, but avoids doing the look up if the sourceExtension is the same as the tragetExtension, so will have the same result.String[]getTestFileExtensionsAndMimetypes()Deprecated.voidinactiveTransformer(ContentTransformer transformer)Deprecated.booleanisEnabled()Deprecated.Indicates if any logging is required.Stringms(long time)Deprecated.voidpopAvailable()Deprecated.Called after working out what transformers are available and any resulting transform has been called.voidpopIsTransformableSize()Deprecated.Called after returning from a nested isTransformable.voidpopMisc()Deprecated.Removes a frame from the stack.voidpopTransform()Deprecated.Called after performing a transform.voidpushAvailable(String fromUrl, String sourceMimetype, String targetMimetype, TransformationOptions options)Deprecated.Called prior to working out what transformers are available.voidpushIsTransformableSize(ContentTransformer transformer)Deprecated.Called prior to calling a nested isTransformable.voidpushMisc()Deprecated.Adds a new level to the stack to get a new request number or nesting number.voidpushTransform(ContentTransformer transformer, String fromUrl, String sourceMimetype, String targetMimetype, long sourceSize, TransformationOptions options)Deprecated.Called prior to performing a transform.<T extends Throwable>
TsetCause(T t)Deprecated.Sets the cause of a transformation failure, so that only the message of the Throwable is reported later rather than the full stack trace over and over.voidsetContentService(ContentService contentService)Deprecated.static booleansetDebugOutput(boolean debugOutput)Deprecated.Enable or disable debug log output.voidsetStringBuilder(StringBuilder sb)Deprecated.Sets the StringBuilder to be used to capture debug information for the current Thread.Collection<ContentTransformer>sortTransformersByName(String transformerName)Deprecated.Returns a sorted list of all transformers sorted by name.StringtestTransform(String sourceExtension, String targetExtension, String use)Deprecated.StringtestTransform(String transformerName, String sourceExtension, String targetExtension, String use)Deprecated.StringtransformationsByExtension(String sourceExtension, String targetExtension, boolean toString, boolean format42, boolean onlyNonDeterministic, String use)Deprecated.Returns a String and /or debug that provides a list of supported transformations sorted by source and target mimetype extension.StringtransformationsByTransformer(String transformerName, boolean toString, boolean format42, String use)Deprecated.Returns a String and /or debug that provides a list of supported transformations for each transformer.voidunavailableTransformer(ContentTransformer transformer, String sourceMimetype, String targetMimetype, long maxSourceSizeKBytes)Deprecated.Called to identify a transformer that cannot be used during working out available transformers.
-
-
-
Constructor Detail
-
TransformerDebug
public TransformerDebug(org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.cmr.repository.MimetypeService mimetypeService, ContentTransformerRegistry transformerRegistry, TransformerConfig transformerConfig, org.apache.commons.logging.Log transformerLog, org.apache.commons.logging.Log transformerDebugLog)Deprecated.Constructor
-
-
Method Detail
-
setContentService
public void setContentService(ContentService contentService)
Deprecated.
-
pushAvailable
public void pushAvailable(String fromUrl, String sourceMimetype, String targetMimetype, TransformationOptions options)
Deprecated.Called prior to working out what transformers are available.
-
blacklistTransform
public void blacklistTransform(ContentTransformer transformer, String sourceMimetype, String targetMimetype, TransformationOptions options)
Deprecated.Called when a transformer has been ignored because of a blacklist entry.
-
pushTransform
public void pushTransform(ContentTransformer transformer, String fromUrl, String sourceMimetype, String targetMimetype, long sourceSize, TransformationOptions options)
Deprecated.Called prior to performing a transform.
-
pushMisc
public void pushMisc()
Deprecated.Adds a new level to the stack to get a new request number or nesting number. Called prior to working out what transformers are active and prior to listing the supported mimetypes for an active transformer.
-
pushIsTransformableSize
public void pushIsTransformableSize(ContentTransformer transformer)
Deprecated.Called prior to calling a nested isTransformable.
-
unavailableTransformer
public void unavailableTransformer(ContentTransformer transformer, String sourceMimetype, String targetMimetype, long maxSourceSizeKBytes)
Deprecated.Called to identify a transformer that cannot be used during working out available transformers.
-
availableTransformers
public void availableTransformers(List<ContentTransformer> transformers, long sourceSize, TransformationOptions options, String calledFrom)
Deprecated.Called once all available transformers have been identified.
-
inactiveTransformer
public void inactiveTransformer(ContentTransformer transformer)
Deprecated.
-
activeTransformer
public void activeTransformer(int mimetypePairCount, ContentTransformer transformer, String sourceMimetype, String targetMimetype, long maxSourceSizeKBytes, boolean firstMimetypePair)Deprecated.
-
activeTransformer
public void activeTransformer(String sourceMimetype, String targetMimetype, int transformerCount, ContentTransformer transformer, long maxSourceSizeKBytes, boolean firstTransformer)
Deprecated.
-
popAvailable
public void popAvailable()
Deprecated.Called after working out what transformers are available and any resulting transform has been called.
-
popTransform
public void popTransform()
Deprecated.Called after performing a transform.
-
popMisc
public void popMisc()
Deprecated.Removes a frame from the stack. Called prior to working out what transformers are active and prior to listing the supported mimetypes for an active transformer.
-
popIsTransformableSize
public void popIsTransformableSize()
Deprecated.Called after returning from a nested isTransformable.
-
isEnabled
public boolean isEnabled()
Deprecated.Indicates if any logging is required.
-
setDebugOutput
public static boolean setDebugOutput(boolean debugOutput)
Deprecated.Enable or disable debug log output. Normally used to hide calls to getTransformer as trace rather than debug level log messages. There are lots of these and it makes it hard to see what is going on.- Parameters:
debugOutput- iftrueboth debug and trace is generated. Otherwise all output is trace.- Returns:
- the original value.
-
debug
public void debug(String message)
Deprecated.Log a message prefixed with the current transformation reference.- Parameters:
message-
-
debug
public void debug(String message, Throwable t)
Deprecated.Log a message prefixed with the current transformation reference and include a exception, suppressing the stack trace if repeated as we return up the stack of transformers.- Parameters:
message-
-
setCause
public <T extends Throwable> T setCause(T t)
Deprecated.Sets the cause of a transformation failure, so that only the message of the Throwable is reported later rather than the full stack trace over and over.
-
getStringBuilder
public StringBuilder getStringBuilder()
Deprecated.Returns the current StringBuilder (if any) being used to capture debug information for the current Thread.
-
setStringBuilder
public void setStringBuilder(StringBuilder sb)
Deprecated.Sets the StringBuilder to be used to capture debug information for the current Thread.
-
transformationsByTransformer
public String transformationsByTransformer(String transformerName, boolean toString, boolean format42, String use)
Deprecated.Returns a String and /or debug that provides a list of supported transformations for each transformer.- Parameters:
transformerName- restricts the list to one transformer. Unrestricted if null.toString- indicates that a String value should be returned in addition to any debug.format42- indicates the old 4.1.4 format should be used which did not order the transformers and only included top level transformers.use- to which the transformation will be put (such as "Index", "Preview", null).
-
transformationsByExtension
public String transformationsByExtension(String sourceExtension, String targetExtension, boolean toString, boolean format42, boolean onlyNonDeterministic, String use)
Deprecated.Returns a String and /or debug that provides a list of supported transformations sorted by source and target mimetype extension.- Parameters:
sourceExtension- restricts the list to one source extension. Unrestricted if null.targetExtension- restricts the list to one target extension. Unrestricted if null.toString- indicates that a String value should be returned in addition to any debug.format42- indicates the new 4.2 rather than older 4.1.4 format should be used. The 4.1.4 format did not order the transformers or mimetypes and only included top level transformers.onlyNonDeterministic- if true only report transformations where there is more than one transformer available with the same priority.use- to which the transformation will be put (such as "Index", "Preview", null).
-
getSourceMimetypes
public Collection<String> getSourceMimetypes(String sourceExtension)
Deprecated.Returns a collection of mimetypes ordered by extension, but unlike the version in MimetypeService throws an exception if the sourceExtension is supplied but does not match a mimetype.- Parameters:
sourceExtension- to restrict the collection to one entry- Throws:
IllegalArgumentException- if there is no match. The message indicates this.
-
getTargetMimetypes
public Collection<String> getTargetMimetypes(String sourceExtension, String targetExtension, Collection<String> sourceMimetypes)
Deprecated.Identical to getSourceMimetypes for the target, but avoids doing the look up if the sourceExtension is the same as the tragetExtension, so will have the same result.- Parameters:
sourceExtension- used to restrict the sourceMimetypestargetExtension- to restrict the collection to one entrysourceMimetypes- that match the sourceExtension- Throws:
IllegalArgumentException- if there is no match. The message indicates this.
-
getFileName
public String getFileName(TransformationOptions options, boolean firstLevel, long sourceSize)
Deprecated.
-
ms
public String ms(long time)
Deprecated.
-
fileSize
public String fileSize(long size)
Deprecated.
-
sortTransformersByName
public Collection<ContentTransformer> sortTransformersByName(String transformerName)
Deprecated.Returns a sorted list of all transformers sorted by name.- Parameters:
transformerName- to restrict the collection to one entry- Returns:
- a new Collection of sorted transformers
- Throws:
IllegalArgumentException- if transformerName is not found.
-
debugTransformServiceRequest
public int debugTransformServiceRequest(String sourceMimetype, long sourceSize, org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, int contentHashcode, String fileName, String targetMimetype, String use)
Deprecated.Debugs a request to the Transform Service
-
debugTransformServiceResponse
public void debugTransformServiceResponse(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, int contentHashcode, long requested, int seq, String sourceExt, String targetExt, String msg)Deprecated.Debugs a response to the Transform Service
-
testTransform
public String testTransform(String sourceExtension, String targetExtension, String use)
Deprecated.
-
testTransform
public String testTransform(String transformerName, String sourceExtension, String targetExtension, String use)
Deprecated.
-
getTestFileExtensionsAndMimetypes
public String[] getTestFileExtensionsAndMimetypes()
Deprecated.
-
-