Class JDBCEmitter
java.lang.Object
org.apache.tika.plugins.AbstractTikaExtension
org.apache.tika.pipes.api.emitter.AbstractEmitter
org.apache.tika.pipes.emitter.jdbc.JDBCEmitter
- All Implemented Interfaces:
Closeable,AutoCloseable,Emitter,TikaExtension
Emitter to write parsed documents to a JDBC database.
Example JSON configuration:
{
"emitters": {
"jdbc-emitter": {
"my-db": {
"connection": "jdbc:postgresql://localhost/mydb",
"createTable": "CREATE TABLE IF NOT EXISTS docs (path VARCHAR(1024), content TEXT)",
"insert": "INSERT INTO docs (path, content) VALUES (?, ?)",
"keys": {
"tika:content": "string"
},
"attachmentStrategy": "FIRST_ONLY",
"multivaluedFieldStrategy": "CONCATENATE"
}
}
}
}
This is only an initial, basic implementation of an emitter for JDBC. It is currently NOT thread safe because of the shared prepared statement, and depending on the jdbc implementation because of the shared connection.
-
Field Summary
Fields inherited from class org.apache.tika.plugins.AbstractTikaExtension
pluginConfig -
Method Summary
Modifier and TypeMethodDescriptionstatic JDBCEmitterbuild(ExtensionConfig extensionConfig) voidclose()voidemit(String emitKey, List<Metadata> metadataList, ParseContext parseContext) voidMethods inherited from class org.apache.tika.plugins.AbstractTikaExtension
getExtensionConfigMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.tika.plugins.TikaExtension
getExtensionConfig
-
Method Details
-
build
public static JDBCEmitter build(ExtensionConfig extensionConfig) throws TikaConfigException, IOException - Throws:
TikaConfigExceptionIOException
-
emit
public void emit(String emitKey, List<Metadata> metadataList, ParseContext parseContext) throws IOException - Specified by:
emitin interfaceEmitter- Throws:
IOException
-
emit
- Specified by:
emitin interfaceEmitter- Overrides:
emitin classAbstractEmitter- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-