public abstract class AbstractContentTransformer2 extends AbstractContentTransformerLimits
ContentTransformer
implementations.
This class maintains the performance measures for the transformers as well, making sure that there is an extra penalty for transformers that fail regularly.
transformerDebug| Modifier | Constructor and Description |
|---|---|
protected |
AbstractContentTransformer2()
All transformers start with an average transformation time of 0.0 ms,
unless there is an Alfresco global property
<beanName>.initialTime. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkTransformable(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer,
TransformationOptions options)
Convenience method to check the transformability of a transformation
|
long |
getTransformationTime()
Provides an estimate, usually a worst case guess, of how long a transformation
will take.
|
protected void |
recordTime(long transformationTime)
Records and updates the average transformation time for this transformer.
|
void |
register()
Registers this instance with the
registry
if it is present. |
void |
setProperties(java.util.Properties properties)
The Alfresco global properties.
|
void |
setRegistry(ContentTransformerRegistry registry)
The registry to auto-register with
|
java.lang.String |
toString() |
void |
transform(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer) |
void |
transform(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer,
java.util.Map options)
Transforms the content provided by the reader and source mimetype
to the writer and target mimetype.
|
void |
transform(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer,
TransformationOptions options)
Transforms the content provided by the reader and source mimetype
to the writer and target mimetype with the provided transformation options.
|
protected abstract void |
transformInternal(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer,
TransformationOptions options)
Method to be implemented by subclasses wishing to make use of the common infrastructural code
provided by this class.
|
getBeanName, getLimits, getLimits, getLimits, getMaxPages, getMaxSourceSizeKBytes, getMaxSourceSizeKBytes, getMimetypeLimits, getPageLimit, getReadLimitKBytes, getReadLimitTimeMs, getTimeoutMs, isPageLimitSupported, isTransformable, isTransformable, isTransformableMimetype, isTransformableSize, setBeanName, setLimits, setMaxPages, setMaxSourceSizeKBytes, setMimetypeLimits, setPageLimit, setPageLimitsSuported, setReaderLimits, setReadLimitKBytes, setReadLimitTimeMs, setTimeoutMs, setTransformerDebuggetMimetype, getMimetypeService, isExplicitTransformation, isSupportedTransformation, setExplicitTransformations, setMimetypeService, setSupportedTransformationsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisExplicitTransformationprotected AbstractContentTransformer2()
<beanName>.initialTime.public void setRegistry(ContentTransformerRegistry registry)
registry - the transformer registrypublic void setProperties(java.util.Properties properties)
public java.lang.String toString()
toString in class java.lang.Objectpublic void register()
registry
if it is present.
THIS IS A CUSTOME SPRING INIT METHODprotected void checkTransformable(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer,
TransformationOptions options)
reader - content readerwriter - content writeroptions - transformation optionsorg.alfresco.error.AlfrescoRuntimeException - if the the transformation isn't supportedprotected abstract void transformInternal(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer,
TransformationOptions options)
throws java.lang.Exception
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.java.lang.Exception - exceptions will be handled by this class - subclasses can throw anythingpublic final void transform(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer)
throws org.alfresco.service.cmr.repository.ContentIOException
org.alfresco.service.cmr.repository.ContentIOExceptionAbstractContentTransformer2.transform(ContentReader, ContentWriter, Map),
#transformInternal(ContentReader, ContentWriter, Map)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.ContentIOException
ContentTransformer
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.
reader - the source of the contentwriter - the destination of the transformed contentoptions - transformation options, these can be nullorg.alfresco.service.cmr.repository.ContentIOException - if an IO exception occursContentTransformer.transform(org.alfresco.service.cmr.repository.ContentReader, org.alfresco.service.cmr.repository.ContentWriter, org.alfresco.service.cmr.repository.TransformationOptions)public final void transform(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer,
java.util.Map options)
throws org.alfresco.service.cmr.repository.ContentIOException
ContentTransformer
The transformation viability can be determined by an up front call
to #getReliability(String, String).
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.
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.org.alfresco.service.cmr.repository.ContentIOException - if an IO exception occurspublic long getTransformationTime()
ContentTransformerThis method is used to determine, up front, which of a set of equally reliant transformers will be used for a specific transformation.
protected final void recordTime(long transformationTime)
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.
transformationTime - the time it took to perform the transformation.
The value may be 0.Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.