com.norconex.committer
Class FileSystemQueueCommitter

java.lang.Object
  extended by com.norconex.committer.BatchableCommitter
      extended by com.norconex.committer.FileSystemQueueCommitter
All Implemented Interfaces:
ICommitter, Serializable
Direct Known Subclasses:
BaseCommitter

public abstract class FileSystemQueueCommitter
extends BatchableCommitter

Base batching implementation queuing documents on filesystem.

Author:
Pascal Essiembre
See Also:
Serialized Form

Nested Class Summary
 class FileSystemQueueCommitter.QueuedAddedDocument
           
 class FileSystemQueueCommitter.QueuedDeletedDocument
           
 
Field Summary
static String DEFAULT_QUEUE_DIR
           
 
Fields inherited from class com.norconex.committer.BatchableCommitter
DEFAULT_BATCH_SIZE
 
Fields inherited from interface com.norconex.committer.ICommitter
DEFAULT_DOCUMENT_REFERENCE
 
Constructor Summary
FileSystemQueueCommitter()
           
FileSystemQueueCommitter(int batchSize)
           
 
Method Summary
 void commit()
          Commits queued documents.
protected abstract  void commitAddedDocument(FileSystemQueueCommitter.QueuedAddedDocument document)
           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 commitDeletedDocument(FileSystemQueueCommitter.QueuedDeletedDocument document)
           Allow subclasses to commit a file to be deleted.
 boolean equals(Object obj)
           
 String getQueueDir()
           
 int hashCode()
           
protected  void preCommitAddedDocument(FileSystemQueueCommitter.QueuedAddedDocument document)
          Optionally performs operations on a document to be added before actually committing it.
protected  void preCommitDeletedDocument(FileSystemQueueCommitter.QueuedDeletedDocument document)
          Optionally performs operations on a document to be deleted before actually committing it.
protected  void queueBatchableAdd(String reference, File document, Properties metadata)
          Queues a document to be added.
protected  void queueBatchableRemove(String ref, File document, Properties metadata)
          Queues a document to be deleted.
 void setQueueDir(String queueDir)
           
 String toString()
           
 
Methods inherited from class com.norconex.committer.BatchableCommitter
getBatchSize, queueAdd, queueRemove, setBatchSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_QUEUE_DIR

public static final String DEFAULT_QUEUE_DIR
See Also:
Constant Field Values
Constructor Detail

FileSystemQueueCommitter

public FileSystemQueueCommitter()

FileSystemQueueCommitter

public FileSystemQueueCommitter(int batchSize)
Method Detail

getQueueDir

public String getQueueDir()

setQueueDir

public void setQueueDir(String queueDir)

queueBatchableAdd

protected void queueBatchableAdd(String reference,
                                 File document,
                                 Properties metadata)
Description copied from class: BatchableCommitter
Queues a document to be added.

Specified by:
queueBatchableAdd in class BatchableCommitter
Parameters:
reference - document reference
document - document file
metadata - document metadata

queueBatchableRemove

protected void queueBatchableRemove(String ref,
                                    File document,
                                    Properties metadata)
Description copied from class: BatchableCommitter
Queues a document to be deleted.

Specified by:
queueBatchableRemove in class BatchableCommitter
document - document file
metadata - document metadata

commit

public void commit()
Description copied from interface: ICommitter
Commits queued documents. Effectively apply the additions and removals.


commitAddedDocument

protected abstract void commitAddedDocument(FileSystemQueueCommitter.QueuedAddedDocument document)
                                     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 by invoking FileSystemQueueCommitter.QueuedAddedDocument.deleteFromQueue(). The subclass may decide to further batch those documents before storing them if more efficient this way.

Parameters:
document - the document to commit
Throws:
IOException

commitDeletedDocument

protected abstract void commitDeletedDocument(FileSystemQueueCommitter.QueuedDeletedDocument document)
                                       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 by invoking FileSystemQueueCommitter.QueuedDeletedDocument.deleteFromQueue(). The subclass may decide to further batch those deletions before storing them if more efficient that way.

Parameters:
document - the document to commit
Throws:
IOException

commitComplete

protected abstract void commitComplete()
Allow subclasses to operate upon the end of the commit operation. For example, if the subclass decided to batch documents to commit, it may decide to store all remaining documents on that event.


preCommitAddedDocument

protected void preCommitAddedDocument(FileSystemQueueCommitter.QueuedAddedDocument document)
                               throws IOException
Optionally performs operations on a document to be added before actually committing it. Default implementation does nothing.

Parameters:
document - document to be added
Throws:
IOException

preCommitDeletedDocument

protected void preCommitDeletedDocument(FileSystemQueueCommitter.QueuedDeletedDocument document)
                                 throws IOException
Optionally performs operations on a document to be deleted before actually committing it. Default implementation does nothing.

Parameters:
document - document to be deleted
Throws:
IOException

hashCode

public int hashCode()
Overrides:
hashCode in class BatchableCommitter

equals

public boolean equals(Object obj)
Overrides:
equals in class BatchableCommitter

toString

public String toString()
Overrides:
toString in class BatchableCommitter


Copyright © 2009-2013 Norconex Inc.. All Rights Reserved.