public abstract class AbstractFileQueueCommitter extends AbstractCommitter
prepareCommitAddition(IAddOperation)
and
prepareCommitDeletion(IDeleteOperation)
to manipulate the
data supplied with the operations before committing takes place.
To also control how many documents are sent on each call to
a remote repository, consider extending AbstractBatchCommitter
.
Subclasses implementing IXMLConfigurable
should allow this inner
configuration:
<queueDir>(optional path where to queue files)</queueDir> <queueSize>(max queue size before committing)</queueSize>
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_QUEUE_DIR
Default directory where to queue files.
|
DEFAULT_QUEUE_SIZE
DEFAULT_DOCUMENT_REFERENCE
Constructor and Description |
---|
AbstractFileQueueCommitter()
Constructor.
|
AbstractFileQueueCommitter(int batchSize)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
commit()
Commits queued documents.
|
protected abstract void |
commitAddition(IAddOperation operation)
Allow subclasses to commit a file to be added.
|
protected abstract void |
commitComplete()
Allow subclasses to operate upon the end of the commit operation.
|
protected abstract void |
commitDeletion(IDeleteOperation operation)
Allow subclasses to commit a file to be deleted.
|
boolean |
equals(Object obj) |
String |
getQueueDir()
Gets the directory where queued files are stored.
|
int |
hashCode() |
protected void |
prepareCommitAddition(IAddOperation operation)
Optionally performs actions on a document to be added before
actually committing it.
|
protected void |
prepareCommitDeletion(IDeleteOperation operation)
Optionally performs operations on a document to be deleted before
actually committing it.
|
protected void |
queueAddittion(String reference,
File document,
Properties metadata)
Queues a document to be added.
|
protected void |
queueRemoval(String ref,
File document,
Properties metadata)
Queues a document to be deleted.
|
void |
setQueueDir(String queueDir)
Sets the directory where queued files are stored.
|
String |
toString() |
getQueueSize, queueAdd, queueRemove, setQueueSize
public static final String DEFAULT_QUEUE_DIR
public AbstractFileQueueCommitter()
public AbstractFileQueueCommitter(int batchSize)
batchSize
- batch sizepublic String getQueueDir()
public void setQueueDir(String queueDir)
queueDir
- directoryprotected void queueAddittion(String reference, File document, Properties metadata)
AbstractCommitter
queueAddittion
in class AbstractCommitter
reference
- document referencedocument
- document filemetadata
- document metadataprotected void queueRemoval(String ref, File document, Properties metadata)
AbstractCommitter
queueRemoval
in class AbstractCommitter
ref
- document referencedocument
- document filemetadata
- document metadatapublic void commit()
ICommitter
protected abstract void commitAddition(IAddOperation operation) throws IOException
Allow subclasses to commit a file to be added.
The subclass has the responsibility of deleting the file once the content is permanently stored. The subclass may decide to further batch those documents before storing them if more efficient this way.
operation
- the document operation to performIOException
protected abstract void commitDeletion(IDeleteOperation operation) throws IOException
Allow subclasses to commit a file to be deleted.
The subclass has the responsibility of deleting the file once the content is permanently stored. The subclass may decide to further batch those deletions before storing them if more efficient that way.
operation
- the document operation to performIOException
protected abstract void commitComplete()
protected void prepareCommitAddition(IAddOperation operation) throws IOException
operation
- addition to be performedIOException
protected void prepareCommitDeletion(IDeleteOperation operation) throws IOException
operation
- deletion to be performedIOException
public boolean equals(Object obj)
equals
in class AbstractCommitter
public int hashCode()
hashCode
in class AbstractCommitter
public String toString()
toString
in class AbstractCommitter
Copyright © 2009-2014 Norconex Inc.. All Rights Reserved.