[ 
https://issues.apache.org/jira/browse/TIKA-1528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14288113#comment-14288113
 ] 

Tim Allison commented on TIKA-1528:
-----------------------------------

Ah, very elegant cheat. 

The challenge I face with that is that (I think) is what happens when someone 
tries to run a ParserContainerExtractor.  Client implementations of 
EmbeddedResourceHandler would have to know to grab the Connection object out of 
TikaInputStream's openContainer and ignore the InputStream.

My solution for now is to create a special JDBCInputStream that wraps a 
JDBCTableReader, if a client via EmbeddedResourceHandler reads the input stream 
they get a UTF-8 CSV version of the table, and all of the Blobs are properly 
processed.

For the more common case of someone calling an AutoDetectParser on the database 
file, I pass the JDBC Connection through TikaInputStream's (openContainer, 
thank you!), and the JDBCTableParser picks it up from there and writes to the 
passed-in handler.

> Add an OverrideDetector that overrides other detectors
> ------------------------------------------------------
>
>                 Key: TIKA-1528
>                 URL: https://issues.apache.org/jira/browse/TIKA-1528
>             Project: Tika
>          Issue Type: Improvement
>            Reporter: Tim Allison
>            Priority: Minor
>
> While working on TIKA-1511, I found a need to bypass our current detection 
> mechanism.  I think that there are other use cases for this.  The idea is 
> that a client or a tika-internal call wants to specify the Content-Type for a 
> document and bypass the regular mime detection chain.
> We currently have the TypeDetector that returns the "Content-Type" as 
> specified in the Metadata, but there are two deficiencies in using that class 
> for this purpose:
> * Content-Type is ambiguous, currently, when it comes into a Parser or 
> Detector, it could be used as a hint or as a direction.  I'd like the 
> OverrideDetector to use a different metadata key from our usual "Content-Type.
> * The ordering of the TypeDetector is based on alphabetic order of its class 
> name.  I'd like the OverrideDetector to be run first and then short 
> circuit/bypass the other detectors.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to