com.norconex.committer
Class BaseCommitter

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

public abstract class BaseCommitter
extends FileSystemQueueCommitter
implements IXMLConfigurable

A base class batching documents and offering mappings of source id and content fields to target id and content fields. Batched documents are queued on the file system.

ID Mapping:

Both the idSourceField and idTargetField must be set for ID mapping to take place. The default source id field is the metadata normally set by the Norconex Importer module called document.reference. The default (or constant) target id field is for subclasses to define. When an ID mapping is defined, the source id field will be deleted unless the keepIdSourceField attribute is set to true.

Content Mapping:

Only the contentTargetField needs to be set for content mapping to take place. The default source content is the actual document content. Defining a contentSourceField will use the matching metadata property instead. The default (or constant) target content field is for subclasses to define. When a content mapping is defined, the content id field will be deleted (if provided) unless the keepContentSourceField attribute is set to true.

Author:
Pascal Essiembre, Pascal Dimassimo
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.norconex.committer.FileSystemQueueCommitter
FileSystemQueueCommitter.QueuedAddedDocument, FileSystemQueueCommitter.QueuedDeletedDocument
 
Field Summary
protected  String contentSourceField
           
protected  String contentTargetField
           
protected  String idSourceField
           
protected  String idTargetField
           
protected  boolean keepContentSourceField
           
protected  boolean keepIdSourceField
           
 
Fields inherited from class com.norconex.committer.FileSystemQueueCommitter
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
BaseCommitter()
           
BaseCommitter(int batchSize)
           
 
Method Summary
 boolean equals(Object obj)
           
 String getContentSourceField()
           
 String getContentTargetField()
           
 String getIdSourceField()
           
 String getIdTargetField()
           
 int hashCode()
           
 boolean isKeepContentSourceField()
           
 boolean isKeepIdSourceField()
           
 void loadFromXML(Reader in)
           
protected abstract  void loadFromXml(XMLConfiguration xml)
          Allows subclasses to load their config from xml
protected  void preCommitAddedDocument(FileSystemQueueCommitter.QueuedAddedDocument document)
          Optionally performs operations on a document to be added before actually committing it.
 void saveToXML(Writer out)
           
protected abstract  void saveToXML(XMLStreamWriter writer)
          Allows subclasses to write their config to xml
 void setContentSourceField(String contentSourceField)
           
 void setContentTargetField(String contentTargetField)
           
 void setIdSourceField(String idSourceField)
           
 void setIdTargetField(String idTargetField)
           
 void setKeepContentSourceField(boolean keepContentSourceField)
           
 void setKeepIdSourceField(boolean keepIdSourceField)
           
 String toString()
           
 
Methods inherited from class com.norconex.committer.FileSystemQueueCommitter
commit, commitAddedDocument, commitComplete, commitDeletedDocument, getQueueDir, preCommitDeletedDocument, queueBatchableAdd, queueBatchableRemove, setQueueDir
 
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

idTargetField

protected String idTargetField

idSourceField

protected String idSourceField

keepIdSourceField

protected boolean keepIdSourceField

contentTargetField

protected String contentTargetField

contentSourceField

protected String contentSourceField

keepContentSourceField

protected boolean keepContentSourceField
Constructor Detail

BaseCommitter

public BaseCommitter()

BaseCommitter

public BaseCommitter(int batchSize)
Method Detail

getIdSourceField

public String getIdSourceField()

setIdSourceField

public void setIdSourceField(String idSourceField)

getIdTargetField

public String getIdTargetField()

setIdTargetField

public void setIdTargetField(String idTargetField)

getContentTargetField

public String getContentTargetField()

setContentTargetField

public void setContentTargetField(String contentTargetField)

getContentSourceField

public String getContentSourceField()

setContentSourceField

public void setContentSourceField(String contentSourceField)

isKeepIdSourceField

public boolean isKeepIdSourceField()

setKeepIdSourceField

public void setKeepIdSourceField(boolean keepIdSourceField)

isKeepContentSourceField

public boolean isKeepContentSourceField()

setKeepContentSourceField

public void setKeepContentSourceField(boolean keepContentSourceField)

preCommitAddedDocument

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

Overrides:
preCommitAddedDocument in class FileSystemQueueCommitter
Parameters:
document - document to be added
Throws:
IOException

saveToXML

public void saveToXML(Writer out)
               throws IOException
Specified by:
saveToXML in interface IXMLConfigurable
Throws:
IOException

saveToXML

protected abstract void saveToXML(XMLStreamWriter writer)
                           throws XMLStreamException
Allows subclasses to write their config to xml

Parameters:
writer -
Throws:
XMLStreamException

loadFromXML

public void loadFromXML(Reader in)
Specified by:
loadFromXML in interface IXMLConfigurable

loadFromXml

protected abstract void loadFromXml(XMLConfiguration xml)
Allows subclasses to load their config from xml

Parameters:
xml -

hashCode

public int hashCode()
Overrides:
hashCode in class FileSystemQueueCommitter

equals

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

toString

public String toString()
Overrides:
toString in class FileSystemQueueCommitter


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