public interface QueryResultsHandler extends AutoCloseable
#start()
handleQueryResult(java.lang.String, java.util.List, java.util.Map, java.util.Map, java.util.Map) called once per key
finish()
close()
#start() or handleQueryResult(java.lang.String, java.util.List, java.util.Map, java.util.Map, java.util.Map),
finish() will be skipped.
If cancel() is called before finish() is called, the
latter will be skipped.
The cancel() method may be called in parallel
with execution of any of the other methods in the interface. The
different methods of this interface may be called by different (albeit
synchronized) threads.| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Requests cancellation of whatever this object is currently doing.
|
void |
close()
Called by Protempa after
#handleFinish() to clean up any
resources used by the handler. |
void |
finish()
Called by Protempa as soon as all query results have been retrieved from
the data source.
|
String |
getDisplayName()
Gets the query result handler's display name for user interfaces.
|
String |
getId()
Gets the query result handler's identifier string for logging and
internal purposes.
|
void |
handleQueryResult(String keyId,
List<Proposition> propositions,
Map<Proposition,List<Proposition>> forwardDerivations,
Map<Proposition,List<Proposition>> backwardDerivations,
Map<UniqueId,Proposition> references)
Handles a single query result, which is the list of propositions
associated with the given key.
|
void |
start(Collection<PropositionDefinition> cache)
Called by Protempa prior to the first invocation of
handleQueryResult(java.lang.String, java.util.List, java.util.Map, java.util.Map, java.util.Map). |
void |
validate()
Validates this query results handler's specification.
|
String getId()
String getDisplayName()
void validate()
throws QueryResultsHandlerValidationFailedException
QueryResultsHandlerValidationFailedException - if validation
failed.void start(Collection<PropositionDefinition> cache) throws QueryResultsHandlerProcessingException
handleQueryResult(java.lang.String, java.util.List, java.util.Map, java.util.Map, java.util.Map).
Implementers of this method may perform arbitrary processing related to
the output of the handler, such as printing out headers of a file or
extracting metadata for the handler's output.cache - a cache of all of the proposition definitions that were
queried.QueryResultsHandlerProcessingException - if any exceptions occur at
a lower level.void handleQueryResult(String keyId, List<Proposition> propositions, Map<Proposition,List<Proposition>> forwardDerivations, Map<Proposition,List<Proposition>> backwardDerivations, Map<UniqueId,Proposition> references) throws QueryResultsHandlerProcessingException
keyId - the identifying key id for the resultpropositions - the proposition results for the given key as a newly
created List.derivationsList - a mapping from propositions to derived
abstractions. and propositions.QueryResultsHandlerProcessingExceptionvoid finish()
throws QueryResultsHandlerProcessingException
QueryResultsHandlerProcessingException - if any exceptions occur at
a lower levelvoid close()
throws QueryResultsHandlerCloseException
#handleFinish() to clean up any
resources used by the handler. It is called always, even if a previous
step failed.close in interface AutoCloseableQueryResultsHandlerCloseException - if any exceptions occur at a
lower levelvoid cancel()
Copyright © 2012–2016 Emory University. All rights reserved.