Allow Tika powered transformers to customise the ParseContext, eg to enable recursion (which is off by default)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22858 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2010-10-04 20:31:07 +00:00
parent 4378355314
commit 82945aac38

View File

@@ -150,6 +150,14 @@ public abstract class TikaPoweredContentTransformer extends AbstractContentTrans
return handler;
}
/**
* By default returns a ParseContent that does not recurse
*/
protected ParseContext buildParseContext(Metadata metadata, String targetMimeType, TransformationOptions options)
{
return new ParseContext();
}
public void transformInternal(ContentReader reader, ContentWriter writer, TransformationOptions options)
throws Exception
{
@@ -162,7 +170,8 @@ public abstract class TikaPoweredContentTransformer extends AbstractContentTrans
Parser parser = getParser();
Metadata metadata = new Metadata();
ParseContext context = new ParseContext();
ParseContext context = buildParseContext(metadata, targetMimeType, options);
ContentHandler handler = getContentHandler(targetMimeType, ow);
if(handler == null)