Package com.mapr.cli.common
Interface ListIterator
-
- All Known Implementing Classes:
AlarmCommands,DiskCommands,EntityCommands,FileFilterCommands,Heatmap,ListCommand,OffloadRuleCommands,S3BucketCommands,S3DomainCommands,S3KeysCommands,S3UserCommands,SecurityPolicyCommands,ServerCommands,SnapshotCommands,TierCommands,VirtualIPCommands,VolumeCommands
public interface ListIteratorInterface to fetch records from server in iterations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description com.google.protobuf.MessageLitebuildNextRequest(com.google.protobuf.MessageLite prevReq, com.google.protobuf.MessageLite prevResp)Builds the next request object by inspecting the previous request and previous response.booleanhasMore(com.google.protobuf.MessageLite prevReq, com.google.protobuf.MessageLite prevResp)Inspect the last request and last response to see if there are more records to be fetched.voidlist(com.mapr.cliframework.base.CommandOutput.OutputHierarchy out)Initiates the iteration process.voidprocessResponse(com.mapr.cliframework.base.CommandOutput.OutputHierarchy out, com.google.protobuf.MessageLite resp)Parse the response and populate the output hierarchy.com.google.protobuf.MessageLitesendRequest(com.google.protobuf.MessageLite req)Send the request using RPC and fetch the response.
-
-
-
Method Detail
-
list
void list(com.mapr.cliframework.base.CommandOutput.OutputHierarchy out) throws com.mapr.cliframework.base.CLIProcessingException
Initiates the iteration process. while (hasMore()) { buildNextRequest sendRequest processResponse }- Parameters:
out- - The output of all the processed responses.- Throws:
com.mapr.cliframework.base.CLIProcessingException
-
hasMore
boolean hasMore(com.google.protobuf.MessageLite prevReq, com.google.protobuf.MessageLite prevResp) throws com.mapr.cliframework.base.CLIProcessingExceptionInspect the last request and last response to see if there are more records to be fetched.- Parameters:
prevReq-prevResp-- Returns:
- - true, if there are more records. false, if no more.
- Throws:
com.mapr.cliframework.base.CLIProcessingException
-
buildNextRequest
com.google.protobuf.MessageLite buildNextRequest(com.google.protobuf.MessageLite prevReq, com.google.protobuf.MessageLite prevResp) throws com.mapr.cliframework.base.CLIProcessingExceptionBuilds the next request object by inspecting the previous request and previous response.- Parameters:
req- - Previous requestresp- - Previous response- Returns:
- - new request object
- Throws:
com.mapr.cliframework.base.CLIProcessingException
-
sendRequest
com.google.protobuf.MessageLite sendRequest(com.google.protobuf.MessageLite req) throws com.mapr.cliframework.base.CLIProcessingExceptionSend the request using RPC and fetch the response.- Parameters:
req- - request object.- Returns:
- - the response object.
- Throws:
com.mapr.cliframework.base.CLIProcessingException
-
processResponse
void processResponse(com.mapr.cliframework.base.CommandOutput.OutputHierarchy out, com.google.protobuf.MessageLite resp) throws com.mapr.cliframework.base.CLIProcessingExceptionParse the response and populate the output hierarchy.- Parameters:
out- -CommandOutput.OutputHierarchyresp- - response object- Throws:
com.mapr.cliframework.base.CLIProcessingException
-
-