public abstract class AbstractFileContentTransformerWorker extends AbstractContentTransformerWorker
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractFileContentTransformerWorker.FileContentReferencePair
Wrapper for a content reference and a
File, useful
for passing around an already instantiated File object with
a related content reference. |
targetContentReferenceHandler| Constructor and Description |
|---|
AbstractFileContentTransformerWorker() |
| Modifier and Type | Method and Description |
|---|---|
protected org.gytheio.content.ContentReference |
createTargetContentReference(String mediaType)
Creates a target content references using the targetContentReferenceHandler
|
protected File |
createTempFile(org.gytheio.content.ContentReference contentReference)
Creates a temp file from the given content reference
|
protected List<AbstractFileContentTransformerWorker.FileContentReferencePair> |
getSourcePairs(List<org.gytheio.content.ContentReference> sources)
Creates source pairs from the given source content references
|
protected List<AbstractFileContentTransformerWorker.FileContentReferencePair> |
getTargetPairs(List<org.gytheio.content.ContentReference> targets)
Creates target pairs from the given target content references
|
protected void |
initializationTest(String sourcePath,
String targetMediaType,
TransformationOptions options)
Tests that the worker is configured and working as expected.
|
protected boolean |
isTempTargetUsed()
Determines if the target content references must be managed via local temp file copies
or can be managed directly.
|
List<org.gytheio.content.ContentWorkResult> |
transform(List<org.gytheio.content.ContentReference> sources,
List<org.gytheio.content.ContentReference> targets,
TransformationOptions options,
ContentTransformerWorkerProgressReporter progressReporter)
Transforms the given source content references into the given target content references
with the given options, reporting back via the given progress reporter.
|
List<org.gytheio.content.ContentWorkResult> |
transform(List<org.gytheio.content.ContentReference> sources,
String targetMediaType,
TransformationOptions options,
ContentTransformerWorkerProgressReporter progressReporter)
Transforms the given source content references into target content references created by the
worker based on the given media type with the given options, reporting back
via the given progress reporter.
|
protected abstract List<File> |
transformInternal(List<AbstractFileContentTransformerWorker.FileContentReferencePair> sources,
List<AbstractFileContentTransformerWorker.FileContentReferencePair> targets,
TransformationOptions options,
ContentTransformerWorkerProgressReporter progressReporter)
Transforms the given source file to the given target file and media type using
the given transformation options and reports progress via the given progress reporter.
|
getExtension, initialize, setTargetContentReferenceHandler, toStringgetProperties, getVersionDetailsString, getVersionString, initializeVersionDetailsString, initializeVersionString, isAvailable, loadProperties, setIsAvailable, setSourceContentReferenceHandlerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisTransformablepublic AbstractFileContentTransformerWorker()
protected List<AbstractFileContentTransformerWorker.FileContentReferencePair> getSourcePairs(List<org.gytheio.content.ContentReference> sources) throws org.gytheio.content.ContentIOException, InterruptedException, IOException
sources - org.gytheio.content.ContentIOExceptionInterruptedExceptionIOExceptionprotected List<AbstractFileContentTransformerWorker.FileContentReferencePair> getTargetPairs(List<org.gytheio.content.ContentReference> targets) throws org.gytheio.content.ContentIOException, InterruptedException, IOException
targets - org.gytheio.content.ContentIOExceptionInterruptedExceptionIOExceptionprotected boolean isTempTargetUsed()
public List<org.gytheio.content.ContentWorkResult> transform(List<org.gytheio.content.ContentReference> sources, List<org.gytheio.content.ContentReference> targets, TransformationOptions options, ContentTransformerWorkerProgressReporter progressReporter) throws Exception
ContentTransformerWorkerDepending on the transformation being requested, multiple sources may be merged into a single target, a single source may be split into multiple targets, multiple sources may be transformed to multiple targets, etc. It is up to the caller to know what type of targets to expect.
Additionally, some implementations may not be able to transform into the targets specified or the number of targets may not be known before hand so implementations must return the final target references.
Use {@link #transform(List, String, TransformationOptions, ContentTransformerWorkerProgressReporter) to have the worker create the target content references.
sources - the list of source content referencestargets - the list of target content referencesExceptionpublic List<org.gytheio.content.ContentWorkResult> transform(List<org.gytheio.content.ContentReference> sources, String targetMediaType, TransformationOptions options, ContentTransformerWorkerProgressReporter progressReporter) throws Exception
ContentTransformerWorkerDepending on the transformation being requested, multiple sources may be merged into a single target, a single source may be split into multiple targets, multiple sources may be transformed to multiple targets, etc. It is up to the caller to know what type of targets to expect.
Exceptionprotected File createTempFile(org.gytheio.content.ContentReference contentReference)
contentReference - protected abstract List<File> transformInternal(List<AbstractFileContentTransformerWorker.FileContentReferencePair> sources, List<AbstractFileContentTransformerWorker.FileContentReferencePair> targets, TransformationOptions options, ContentTransformerWorkerProgressReporter progressReporter) throws Exception
sourceFiles - sourceRefs - targetFiles - targetRefs - options - progressReporter - Exceptionprotected org.gytheio.content.ContentReference createTargetContentReference(String mediaType)
mediaType - protected void initializationTest(String sourcePath, String targetMediaType, TransformationOptions options) throws Exception
sourcePath - targetMediaType - options - ExceptionCopyright © 2015 Alfresco Software. All rights reserved.