public class MultiCommitter extends Object implements ICommitter, com.norconex.commons.lang.config.IXMLConfigurable
This committer allows you to define user many committers as one. Every committing requests will be dispatched and handled by all nested committers defined (in the order they were added).
<committer class="com.norconex.committer.core.impl.MultiCommitter"> <committer class="(committer class)"> (Commmitter-specific configuration here) </committer> <committer class="(committer class)"> (Commmitter-specific configuration here) </committer> ... </committer>
The following will commit files in two different locations on the filesystem.
<committer class="com.norconex.committer.core.impl.MultiCommitter"> <committer class="com.norconex.committer.core.impl.FileSystemCommitter"> <directory>/export/path1/</directory> </committer> <committer class="com.norconex.committer.core.impl.FileSystemCommitter"> <directory>/export/path2/</directory> </committer> </committer>
Constructor and Description |
---|
MultiCommitter()
Constructor.
|
MultiCommitter(List<ICommitter> committers)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(String reference,
InputStream content,
com.norconex.commons.lang.map.Properties metadata)
Adds a new or modified document to the target destination.
|
void |
addCommitter(ICommitter... committer)
Adds one or more committers.
|
void |
commit()
Commits documents.
|
boolean |
equals(Object other) |
List<ICommitter> |
getCommitters()
Gets nested committers.
|
int |
hashCode() |
void |
loadFromXML(Reader in) |
void |
remove(String reference,
com.norconex.commons.lang.map.Properties metadata)
Removes a document from the target destination.
|
void |
removeCommitter(ICommitter... committer)
Removes one or more committers.
|
void |
saveToXML(Writer out) |
String |
toString() |
public MultiCommitter()
public MultiCommitter(List<ICommitter> committers)
committers
- a list of committerspublic void addCommitter(ICommitter... committer)
committer
- committerspublic void removeCommitter(ICommitter... committer)
committer
- committerspublic List<ICommitter> getCommitters()
public void add(String reference, InputStream content, com.norconex.commons.lang.map.Properties metadata)
ICommitter
add
in interface ICommitter
reference
- document reference (e.g. URL)content
- document contentmetadata
- document metadatapublic void remove(String reference, com.norconex.commons.lang.map.Properties metadata)
ICommitter
remove
in interface ICommitter
reference
- document reference (e.g. URL)metadata
- document metadatapublic void commit()
ICommitter
commit
in interface ICommitter
public void loadFromXML(Reader in) throws IOException
loadFromXML
in interface com.norconex.commons.lang.config.IXMLConfigurable
IOException
public void saveToXML(Writer out) throws IOException
saveToXML
in interface com.norconex.commons.lang.config.IXMLConfigurable
IOException
Copyright © 2009–2020 Norconex Inc.. All rights reserved.