public class RecordingDocIdPusher extends AbstractDocIdPusher
DocIdPusher
that simply records
the values it receives. This implementation is not thread-safe.
Methods that return collections all return unmodifiable views of
the recorded values. The collections cannot be changed directly,
but they will reflect changes to the recorded values that are made
through the DocIdPusher
interface.
DocIdPusher.FeedType, DocIdPusher.Record
EVERYTHING_CASE_INSENSITIVE, EVERYTHING_CASE_SENSITIVE
Constructor and Description |
---|
RecordingDocIdPusher() |
Modifier and Type | Method and Description |
---|---|
List<DocId> |
getDocIds()
Gets an unmodifiable list of the accumulated
DocIds
passed to any of the pushDocIds or pushRecords
methods. |
Map<GroupPrincipal,Collection<Principal>> |
getGroupDefinitions()
Gets an unmodifiable map of the accumulated group definitions
passed to any of the
pushGroupDefinitions methods. |
Map<GroupPrincipal,Collection<Principal>> |
getGroupDefinitions(String sourceName)
Gets an unmodifiable map of the accumulated group definitions
passed to any of the
pushGroupDefinitions methods. |
Map<DocId,Acl> |
getNamedResources()
Gets an unmodifiable map of the accumulated named resources
passed to any of the
pushNamedResources methods. |
List<DocIdPusher.Record> |
getRecords()
Gets an unmodifiable list of the accumulated
Records
passed to any of the pushRecords methods. |
GroupPrincipal |
pushGroupDefinitions(Map<GroupPrincipal,? extends Collection<Principal>> defs,
boolean caseSensitive,
DocIdPusher.FeedType feedType,
String sourceName,
ExceptionHandler exceptionHandler)
Records the group definitions.
|
DocId |
pushNamedResources(Map<DocId,Acl> resources,
ExceptionHandler handler)
Records the named resources.
|
DocIdPusher.Record |
pushRecords(Iterable<DocIdPusher.Record> records,
ExceptionHandler handler)
Records the records and their
DocId values. |
void |
reset()
Clears all of the recorded data.
|
pushDocIds, pushDocIds, pushGroupDefinitions, pushGroupDefinitions, pushNamedResources, pushRecords
public DocIdPusher.Record pushRecords(Iterable<DocIdPusher.Record> records, ExceptionHandler handler) throws InterruptedException
DocId
values.records
- are document ids to be pushedhandler
- for dealing with errors pushingnull
, to indicate successInterruptedException
- if interrupted and no Records were sentpublic DocId pushNamedResources(Map<DocId,Acl> resources, ExceptionHandler handler) throws InterruptedException
resources
- are labeled access control listshandler
- for dealing with errors pushingnull
, to indicate successInterruptedException
- if interrupted and no resources were sentpublic GroupPrincipal pushGroupDefinitions(Map<GroupPrincipal,? extends Collection<Principal>> defs, boolean caseSensitive, DocIdPusher.FeedType feedType, String sourceName, ExceptionHandler exceptionHandler) throws InterruptedException
If a membership Collection
for a group is a List
or Set
, then a copy of the collection is made that
preserves order and equality.
defs
- map of group definitionscaseSensitive
- when comparing PrincipalsfeedType
- if INCREMENTAL, an incremental update is done;
if REPLACE, a full replacement is done.sourceName
- the feed data source nameexceptionHandler
- for dealing with errors pushingnull
, to indicate successInterruptedException
- if interrupted and no definitions were sentpublic List<DocId> getDocIds()
DocIds
passed to any of the pushDocIds
or pushRecords
methods.DocIds
public List<DocIdPusher.Record> getRecords()
Records
passed to any of the pushRecords
methods.Records
public Map<DocId,Acl> getNamedResources()
pushNamedResources
methods. In cases
where the same DocId
has been passed multiple times in
different calls to pushNamedResources
, the most recently
pushed one is included in the returned map.public Map<GroupPrincipal,Collection<Principal>> getGroupDefinitions()
pushGroupDefinitions
methods. In
cases where the same GroupPrincipal
has been passed
multiple times in different calls to pushGroupDefinitions
,
the most recently pushed one is included in the returned map.public Map<GroupPrincipal,Collection<Principal>> getGroupDefinitions(String sourceName)
pushGroupDefinitions
methods. In
cases where the same GroupPrincipal
has been passed
multiple times in different calls to pushGroupDefinitions
,
the most recently pushed one is included in the returned map.sourceName
- the group source for the group definitionspublic void reset()