|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.content.transform.ContentTransformerHelper
org.alfresco.repo.content.transform.AbstractContentTransformer2
org.alfresco.repo.content.transform.TikaPoweredContentTransformer
public abstract class TikaPoweredContentTransformer
Provides helpful services for ContentTransformer
implementations which are powered by Apache Tika.
To use Tika to transform some content into Text, Html or XML, create an
implementation of this / use the Auto Detect transformer.
For now, all transformers are registered as regular, rather than explicit
transformations. This should allow you to register your own explicit
transformers and have them nicely take priority.
Field Summary | |
---|---|
protected static java.lang.String |
LINE_BREAK
Windows carriage return line feed pair. |
protected java.util.List |
sourceMimeTypes
|
static java.lang.String |
WRONG_FORMAT_MESSAGE_ID
|
Constructor Summary | |
---|---|
protected |
TikaPoweredContentTransformer(java.util.List sourceMimeTypes)
|
protected |
TikaPoweredContentTransformer(java.lang.String[] sourceMimeTypes)
|
Method Summary | |
---|---|
protected org.apache.tika.parser.ParseContext |
buildParseContext(org.apache.tika.metadata.Metadata metadata,
java.lang.String targetMimeType,
TransformationOptions options)
By default returns a ParseContent that does not recurse |
protected org.xml.sax.ContentHandler |
getContentHandler(java.lang.String targetMimeType,
java.io.Writer output)
Returns an appropriate Tika ContentHandler for the requested content type. |
protected abstract org.apache.tika.parser.Parser |
getParser()
Returns the correct Tika Parser to process the document. |
boolean |
isTransformable(java.lang.String sourceMimetype,
java.lang.String targetMimetype,
TransformationOptions options)
Can we do the requested transformation via Tika? We support transforming to HTML, XML or Text |
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. |
Methods inherited from class org.alfresco.repo.content.transform.AbstractContentTransformer2 |
---|
checkTransformable, getTransformationTime, recordTime, register, setRegistry, toString, transform, transform, transform |
Methods inherited from class org.alfresco.repo.content.transform.ContentTransformerHelper |
---|
getMimetype, getMimetypeService, isExplicitTransformation, setExplicitTransformations, setMimetypeService |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.alfresco.repo.content.transform.ContentTransformer |
---|
isExplicitTransformation |
Field Detail |
---|
protected java.util.List sourceMimeTypes
protected static final java.lang.String LINE_BREAK
public static final java.lang.String WRONG_FORMAT_MESSAGE_ID
Constructor Detail |
---|
protected TikaPoweredContentTransformer(java.util.List sourceMimeTypes)
protected TikaPoweredContentTransformer(java.lang.String[] sourceMimeTypes)
Method Detail |
---|
protected abstract org.apache.tika.parser.Parser getParser()
TikaAutoContentTransformer
which
makes use of the Tika auto-detection.
public boolean isTransformable(java.lang.String sourceMimetype, java.lang.String targetMimetype, TransformationOptions options)
sourceMimetype
- the source mimetypeoptions
- the transformation options
protected org.xml.sax.ContentHandler getContentHandler(java.lang.String targetMimeType, java.io.Writer output) throws javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerConfigurationException
protected org.apache.tika.parser.ParseContext buildParseContext(org.apache.tika.metadata.Metadata metadata, java.lang.String targetMimeType, TransformationOptions options)
public void transformInternal(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, TransformationOptions options) throws java.lang.Exception
AbstractContentTransformer2
transformInternal
in class AbstractContentTransformer2
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 anything
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |