public abstract class AbstractContentTransformerLimits extends ContentTransformerHelper implements ContentTransformer, org.springframework.beans.factory.BeanNameAware
ContentTransformer
implementations.
This class maintains the limits and provides methods that combine limits:
a) for the transformer as a whole
b) for specific combinations if source and target mimetypes
c) for the TransformationOptions provided for a specific transform.
| Modifier and Type | Field and Description |
|---|---|
protected TransformerDebug |
transformerDebug
For debug
|
| Constructor and Description |
|---|
AbstractContentTransformerLimits() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getBeanName()
Returns the Spring bean name - only for use in debug.
|
protected TransformationOptionLimits |
getLimits()
Returns max and limit values for time, size and pages in a single operation.
|
protected TransformationOptionLimits |
getLimits(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer,
TransformationOptions options)
Returns max and limit values for time, size and pages for a specified source and
target mimetypes, combined with this Transformer's general limits and optionally
the supplied transformation option's limits.
|
protected TransformationOptionLimits |
getLimits(java.lang.String sourceMimetype,
java.lang.String targetMimetype,
TransformationOptions options)
Returns max and limit values for time, size and pages for a specified source and
target mimetypes, combined with this Transformer's general limits and optionally
the supplied transformation option's limits.
|
protected int |
getMaxPages()
Get the maximum number of pages read before an exception is thrown.
|
protected long |
getMaxSourceSizeKBytes()
Gets the maximum source content size, to skip transformations where
the source is just too large to expect it to perform.
|
long |
getMaxSourceSizeKBytes(java.lang.String sourceMimetype,
java.lang.String targetMimetype,
TransformationOptions options)
Returns the maximum source size (in KBytes) allowed given the supplied values.
|
protected java.util.Map |
getMimetypeLimits()
Gets the max and limit values for time, size and pages per source and target mimetype
combination.
|
protected int |
getPageLimit()
Get the page limit before returning EOF.
|
protected long |
getReadLimitKBytes()
Gets the limit in terms of the about of data read to limit transformations where
only the start of the content is needed.
|
protected long |
getReadLimitTimeMs()
Gets the limit in terms of the amount of data read (by time) to limit transformations where
only the start of the content is needed.
|
protected long |
getTimeoutMs()
Gets the timeout (ms) on the InputStream after which an IOExecption is thrown
to terminate very slow transformations or a subprocess is terminated (killed).
|
protected boolean |
isPageLimitSupported(java.lang.String sourceMimetype,
java.lang.String targetMimetype,
TransformationOptions options)
Indicates if 'page' limits are supported.
|
boolean |
isTransformable(java.lang.String sourceMimetype,
long sourceSize,
java.lang.String targetMimetype,
TransformationOptions options)
Indicates whether the provided source mimetype can be transformed into the target mimetype with
the options specified by this content transformer.
|
boolean |
isTransformable(java.lang.String sourceMimetype,
java.lang.String targetMimetype,
TransformationOptions options) |
boolean |
isTransformableMimetype(java.lang.String sourceMimetype,
java.lang.String targetMimetype,
TransformationOptions options)
Indicates if this transformer is able to transform the given source mimetype
to the target mimetype.
|
boolean |
isTransformableSize(java.lang.String sourceMimetype,
long sourceSize,
java.lang.String targetMimetype,
TransformationOptions options)
Indicates if this transformer is able to transform the given
sourceSize. |
void |
setBeanName(java.lang.String beanName)
Sets the Spring bean name - only for use in debug.
|
void |
setLimits(TransformationOptionLimits limits)
Sets max and limit values for time, size and pages in a single operation.
|
void |
setMaxPages(int maxPages)
Set the number of pages read from the source before an exception is thrown.
|
void |
setMaxSourceSizeKBytes(long maxSourceSizeKBytes)
Sets a maximum source content size, to skip transformations where
the source is just too large to expect it to perform.
|
void |
setMimetypeLimits(java.util.Map mimetypeLimits)
Sets the max and limit values for time, size and pages per source and target mimetype
combination.
|
void |
setPageLimit(int pageLimit)
Set the number of pages read from the source before returning EOF.
|
void |
setPageLimitsSuported(boolean pageLimitsSupported)
Indicates if 'page' limits are supported.
|
protected void |
setReaderLimits(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer,
TransformationOptions options)
Pass on any limits to the reader.
|
void |
setReadLimitKBytes(long readLimitKBytes)
Sets a limit in terms of the about of data read to limit transformations where
only the start of the content is needed.
|
void |
setReadLimitTimeMs(long readLimitTimeMs)
Sets a limit in terms of the amount of data read (by time) to limit transformations where
only the start of the content is needed.
|
void |
setTimeoutMs(long timeoutMs)
Sets a timeout (ms) on the InputStream after which an IOExecption is thrown
to terminate very slow transformations or to terminate (kill) a subprocess.
|
void |
setTransformerDebug(TransformerDebug transformerDebug)
Helper setter of the transformer debug.
|
getMimetype, getMimetypeService, isExplicitTransformation, isSupportedTransformation, setExplicitTransformations, setMimetypeService, setSupportedTransformationsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetTransformationTime, isExplicitTransformation, transform, transform, transformprotected TransformerDebug transformerDebug
protected boolean isPageLimitSupported(java.lang.String sourceMimetype,
java.lang.String targetMimetype,
TransformationOptions options)
public void setPageLimitsSuported(boolean pageLimitsSupported)
public void setTransformerDebug(TransformerDebug transformerDebug)
transformerDebug - public boolean isTransformable(java.lang.String sourceMimetype,
java.lang.String targetMimetype,
TransformationOptions options)
isTransformable in interface ContentTransformerpublic boolean isTransformable(java.lang.String sourceMimetype,
long sourceSize,
java.lang.String targetMimetype,
TransformationOptions options)
Implementation calls the deprecated overloaded method without the sourceSize parameter
and then AbstractContentTransformerLimits.isTransformableSize(String, long, String, TransformationOptions).
isTransformable in interface ContentTransformersourceMimetype - the source mimetypesourceSize - the size (bytes) of the source. If negative it is unknown.targetMimetype - the target mimetypeoptions - the transformation optionspublic boolean isTransformableMimetype(java.lang.String sourceMimetype,
java.lang.String targetMimetype,
TransformationOptions options)
isTransformableMimetype in interface ContentTransformersourceMimetype - the source mimetypetargetMimetype - the target mimetypeoptions - the transformation optionspublic boolean isTransformableSize(java.lang.String sourceMimetype,
long sourceSize,
java.lang.String targetMimetype,
TransformationOptions options)
sourceSize.
The maxSourceSizeKBytes property may indicate that only small source files
may be transformed.isTransformableSize in interface ContentTransformersourceSize - size in bytes of the source. If negative, the source size is unknown.sourceMimetype - the source mimetypetargetMimetype - the target mimetypeoptions - the transformation optionstrue if the source is transformable.public long getMaxSourceSizeKBytes(java.lang.String sourceMimetype,
java.lang.String targetMimetype,
TransformationOptions options)
getMaxSourceSizeKBytes in interface ContentTransformerprotected long getTimeoutMs()
public void setTimeoutMs(long timeoutMs)
timeoutMs - in milliseconds. If less than or equal to zero (the default)
there is no timeout.
If greater than zero the readLimitTimeMs must not be set.protected long getReadLimitTimeMs()
public void setReadLimitTimeMs(long readLimitTimeMs)
readLimitBytes - if less than or equal to zero (the default) there is no limit.
If greater than zero the timeoutMs must not be set.protected long getMaxSourceSizeKBytes()
public void setMaxSourceSizeKBytes(long maxSourceSizeKBytes)
maxSourceSizeKBytes - if less than or equal to zero (the default) there is no limit.
If greater than zero the readLimitKBytes must not be set.protected long getReadLimitKBytes()
public void setReadLimitKBytes(long readLimitKBytes)
readLimitKBytes - if less than or equal to zero (the default) there is no limit.
If greater than zero the maxSourceSizeKBytes must not be set.protected int getMaxPages()
public void setMaxPages(int maxPages)
maxPages - the number of pages to be read from the source. If less than or equal to zero
(the default) no limit is applied.protected int getPageLimit()
public void setPageLimit(int pageLimit)
pageLimit - the number of pages to be read from the source. If less
than or equal to zero (the default) no limit is applied.protected TransformationOptionLimits getLimits()
public void setLimits(TransformationOptionLimits limits)
protected java.util.Map getMimetypeLimits()
public void setMimetypeLimits(java.util.Map mimetypeLimits)
protected TransformationOptionLimits getLimits(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, TransformationOptions options)
protected TransformationOptionLimits getLimits(java.lang.String sourceMimetype, java.lang.String targetMimetype, TransformationOptions options)
public void setBeanName(java.lang.String beanName)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarepublic java.lang.String getBeanName()
protected void setReaderLimits(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer,
TransformationOptions options)
AbstractContentReader.reader - passed to {@link #transform(ContentReader, ContentWriter, TransformationOptions).writer - passed to {@link #transform(ContentReader, ContentWriter, TransformationOptions).options - passed to {@link #transform(ContentReader, ContentWriter, TransformationOptions).Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.