public class JDBCEmitter extends AbstractEmitter implements Initializable, Closeable
It is currently NOT thread safe because of the shared prepared statement, and depending on the jdbc implementation because of the shared connection.
As of the 2.5.0 release, this is ALPHA version. There may be breaking changes in the future.
Modifier and Type | Class and Description |
---|---|
static class |
JDBCEmitter.AttachmentStrategy |
Constructor and Description |
---|
JDBCEmitter() |
Modifier and Type | Method and Description |
---|---|
void |
checkInitialization(InitializableProblemHandler problemHandler) |
void |
close() |
void |
emit(List<? extends EmitData> emitData)
The default behavior is to call
Emitter.emit(String, List) on each item. |
void |
emit(String emitKey,
List<Metadata> metadataList)
This executes the emit with each call.
|
void |
initialize(Map<String,Param> params) |
void |
setAlterTable(String alterTable)
This is called immediately after the table is created.
|
void |
setAttachmentStrategy(JDBCEmitter.AttachmentStrategy attachmentStrategy) |
void |
setAttachmentStrategy(String attachmentStrategy) |
void |
setConnection(String connectionString) |
void |
setCreateTable(String createTable) |
void |
setInsert(String insert) |
void |
setKeys(Map<String,String> keys)
The implementation of keys should be a LinkedHashMap because
order matters!
|
getName, setName
public void setAlterTable(String alterTable)
alterTable
- @Field public void setKeys(Map<String,String> keys)
Key is the name of the metadata field, value is the type of column: boolean, string, int, long
keys
- public void setAttachmentStrategy(JDBCEmitter.AttachmentStrategy attachmentStrategy)
public void emit(String emitKey, List<Metadata> metadataList) throws IOException, TikaEmitterException
emit(List)
.emit
in interface Emitter
emitKey
- emit keymetadataList
- list of metadata per fileIOException
TikaEmitterException
public void emit(List<? extends EmitData> emitData) throws IOException, TikaEmitterException
AbstractEmitter
Emitter.emit(String, List)
on each item.
Some implementations, e.g. Solr/ES/vespa, can benefit from subclassing this and
emitting a bunch of docs at once.emit
in interface Emitter
emit
in class AbstractEmitter
IOException
TikaEmitterException
public void initialize(Map<String,Param> params) throws TikaConfigException
initialize
in interface Initializable
params
- params to use for initializationTikaConfigException
public void checkInitialization(InitializableProblemHandler problemHandler) throws TikaConfigException
checkInitialization
in interface Initializable
problemHandler
- if there is a problem and no
custom initializableProblemHandler has been configured
via Initializable parameters,
this is called to respond.TikaConfigException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2007–2022 The Apache Software Foundation. All rights reserved.