public final class CursorCallback extends AbstractReplyCallback<MongoIterator<Document>> implements AddressAware
ERROR_CODE_FIELD, ERROR_MESSAGE_FIELDS| Constructor and Description |
|---|
CursorCallback(Client client,
CursorableMessage message,
boolean command,
Callback<MongoIterator<Document>> results)
Create a new CursorCallback.
|
| Modifier and Type | Method and Description |
|---|---|
protected MongoDbException |
asError(Reply reply,
int okValue,
int errorNumber,
String errorMessage)
Creates an exception from the parsed reply fields.
|
protected MongoIterator<Document> |
convert(Reply reply)
Converts the
Reply into the final response type. |
String |
getAddress()
Returns the server the original request was sent to.
|
protected void |
handle(Reply reply)
Called once the
Reply has been validated. |
protected boolean |
isCommand()
Returns true if the callback should expect a command formated cursor
reply.
|
void |
setAddress(String address)
Sets the value of the server the original request was sent to.
|
exception, getForwardCallback, isLightWeightasError, asError, asError, asString, callback, checkForError, toInt, verifypublic CursorCallback(Client client, CursorableMessage message, boolean command, Callback<MongoIterator<Document>> results)
client - The client interface to the server.message - The original query.command - If true then the callback should expect a command formated
cursor reply.results - The callback to update once the first set of results are
ready.public String getAddress()
public void setAddress(String address)
setAddress in interface AddressAwareaddress - The new value for the server the original request was sent to.protected MongoDbException asError(Reply reply, int okValue, int errorNumber, String errorMessage)
Overridden to add the Query to the exception.
asError in class AbstractValidatingReplyCallbackreply - The raw reply.okValue - The 'ok' field.errorNumber - The 'errno' field.errorMessage - The 'errmsg' field.AbstractValidatingReplyCallback.asError(Reply, int, int, String)protected MongoIterator<Document> convert(Reply reply) throws MongoDbException
Reply into the final response type.
Overridden to construct a MongoIteratorImpl around the reply.
convert in class AbstractReplyCallback<MongoIterator<Document>>reply - The reply to convert.MongoDbException - On a failure converting the reply. Generally, the
AbstractValidatingReplyCallback.verify(Reply) method should be used to report
errors.AbstractReplyCallback.convert(Reply)protected void handle(Reply reply)
Reply has been validated.
Overriden to convert and then pass the converted
reply to the forward callback.
Overridden to check if the server address has been set and if so then
pass the converted reply to the forward
callback. Otherwise the call is dropped.
handle in class AbstractReplyCallback<MongoIterator<Document>>reply - The Reply to be handled.protected boolean isCommand()
Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.