T
- type of file serializerpublic abstract class AbstractFSCommitter<T> extends AbstractCommitter implements IXMLConfigurable
Base class for committers writing to the local file system.
The following are configuration options inherited by subclasses:
<directory>(path where to save the files)</directory>
<docsPerFile>(max number of docs per file)</docsPerFile>
<compress>[false|true]</compress>
<splitUpsertDelete>[false|true]</splitUpsertDelete>
<fileNamePrefix>(optional prefix to created file names)</fileNamePrefix>
<fileNameSuffix>(optional suffix to created file names)</fileNameSuffix>
<!-- multiple "restrictTo" tags allowed (only one needs to match) -->
<restrictTo>
<fieldMatcher
method="[basic|csv|wildcard|regex]"
ignoreCase="[false|true]"
ignoreDiacritic="[false|true]"
partial="[false|true]">
(field-matching expression)
</fieldMatcher>
<valueMatcher
method="[basic|csv|wildcard|regex]"
ignoreCase="[false|true]"
ignoreDiacritic="[false|true]"
partial="[false|true]">
(value-matching expression)
</valueMatcher>
</restrictTo>
<fieldMappings>
<!-- Add as many field mappings as needed -->
<mapping
fromField="(source field name)"
toField="(target field name)"/>
</fieldMappings>
Constructor and Description |
---|
AbstractFSCommitter() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
closeDocWriter(T docWriter) |
protected abstract T |
createDocWriter(Writer writer) |
protected void |
doClean() |
protected void |
doClose()
Subclasses can perform additional closing logic by overriding this
method.
|
protected void |
doDelete(DeleteRequest deleteRequest) |
protected void |
doInit()
Subclasses can perform additional initialization by overriding this
method.
|
protected void |
doUpsert(UpsertRequest upsertRequest) |
boolean |
equals(Object other) |
Path |
getDirectory()
Gets the directory where files are committed.
|
int |
getDocsPerFile() |
protected abstract String |
getFileExtension() |
String |
getFileNamePrefix()
Gets the file name prefix (default is
null ). |
String |
getFileNameSuffix()
Gets the file name suffix (default is
null ). |
int |
hashCode() |
boolean |
isCompress() |
boolean |
isSplitUpsertDelete() |
void |
loadCommitterFromXML(XML xml) |
void |
loadFSCommitterFromXML(XML xml) |
void |
saveCommitterToXML(XML xml) |
void |
saveFSCommitterToXML(XML xml) |
void |
setCompress(boolean compress) |
void |
setDirectory(Path directory) |
void |
setDocsPerFile(int docsPerFile) |
void |
setFileNamePrefix(String fileNamePrefix)
Sets an optional file name prefix.
|
void |
setFileNameSuffix(String fileNameSuffix)
Sets an optional file name suffix.
|
void |
setSplitUpsertDelete(boolean separateAddDelete) |
String |
toString() |
protected abstract void |
writeDelete(T docWriter,
DeleteRequest deleteRequest) |
protected abstract void |
writeUpsert(T docWriter,
UpsertRequest upsertRequest) |
accept, addRestriction, addRestrictions, applyFieldMappings, clean, clearFieldMappings, clearRestrictions, close, delete, fireDebug, fireDebug, fireError, fireError, fireInfo, fireInfo, getCommitterContext, getFieldMappings, getRestrictions, init, loadFromXML, removeFieldMapping, removeRestriction, removeRestriction, saveToXML, setFieldMapping, setFieldMappings, upsert
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
loadFromXML, saveToXML
public Path getDirectory()
public void setDirectory(Path directory)
public int getDocsPerFile()
public void setDocsPerFile(int docsPerFile)
public boolean isCompress()
public void setCompress(boolean compress)
public boolean isSplitUpsertDelete()
public void setSplitUpsertDelete(boolean separateAddDelete)
public String getFileNamePrefix()
null
).public void setFileNamePrefix(String fileNamePrefix)
fileNamePrefix
- file name prefixpublic String getFileNameSuffix()
null
).public void setFileNameSuffix(String fileNameSuffix)
fileNameSuffix
- file name suffixprotected void doInit() throws CommitterException
AbstractCommitter
CommitterContext
will be initialized when invoking
AbstractCommitter.getCommitterContext()
doInit
in class AbstractCommitter
CommitterException
- error initializingprotected void doUpsert(UpsertRequest upsertRequest) throws CommitterException
doUpsert
in class AbstractCommitter
CommitterException
protected void doDelete(DeleteRequest deleteRequest) throws CommitterException
doDelete
in class AbstractCommitter
CommitterException
protected void doClose() throws CommitterException
AbstractCommitter
doClose
in class AbstractCommitter
CommitterException
- error closing committerprotected void doClean() throws CommitterException
doClean
in class AbstractCommitter
CommitterException
public final void loadCommitterFromXML(XML xml)
loadCommitterFromXML
in class AbstractCommitter
public final void saveCommitterToXML(XML xml)
saveCommitterToXML
in class AbstractCommitter
public void loadFSCommitterFromXML(XML xml)
public void saveFSCommitterToXML(XML xml)
protected abstract String getFileExtension()
protected abstract T createDocWriter(Writer writer) throws IOException
IOException
protected abstract void writeUpsert(T docWriter, UpsertRequest upsertRequest) throws IOException
IOException
protected abstract void writeDelete(T docWriter, DeleteRequest deleteRequest) throws IOException
IOException
protected abstract void closeDocWriter(T docWriter) throws IOException
IOException
public boolean equals(Object other)
equals
in class AbstractCommitter
public int hashCode()
hashCode
in class AbstractCommitter
public String toString()
toString
in class AbstractCommitter
Copyright © 2009–2022 Norconex Inc.. All rights reserved.