Class ListCommand

java.lang.Object
com.mapr.cliframework.base.CLIBaseClass
com.mapr.cli.common.ListCommand
All Implemented Interfaces:
ListIterator, com.mapr.cliframework.base.CLIInterface
Direct Known Subclasses:
AlarmCommands, ClusterGroupCommands, DiskCommands, EntityCommands, FileFilterCommands, Heatmap, IamRolesCommands, IdentityPolicyCommands, InstallerCommands, NfsShareCommands, OffloadRuleCommands, S3BucketCommands, S3DomainCommands, S3KeysCommands, S3UserCommands, SecurityPolicyCommands, ServerCommands, ShareTemplateCommands, SnapshotCommands, TierCommands, UserSessionCommands, VirtualIPCommands, VolumeCommands, VolumeMetricsCommand

public abstract class ListCommand extends com.mapr.cliframework.base.CLIBaseClass implements ListIterator
  • Field Summary

    Fields inherited from class com.mapr.cliframework.base.CLIBaseClass

    cliCommand, CLUSTER_NAME_PARAM, clusterParams, HELP_PARAM, input, isServerCall, NOT_REQUIRED, output, REQUIRED, userInfo, version

    Fields inherited from interface com.mapr.cliframework.base.CLIInterface

    KEY_PREFIX, PASSWORD_PREFIX
  • Constructor Summary

    Constructors
    Constructor
    Description
    ListCommand(com.mapr.cliframework.base.ProcessedInput input, com.mapr.cliframework.base.CLICommand cliCommand)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract com.google.protobuf.MessageLite
    buildNextRequest(com.google.protobuf.MessageLite prevReq, com.google.protobuf.MessageLite prevResp)
    Builds the next request object by inspecting the previous request and previous response.
    protected <T> List<com.mapr.fs.cli.proto.CLIProto.Filter>
    getFilters(Map<T,com.mapr.cliframework.util.FieldInfo> table, String filterParam)
    Helper method for the sub classes to build a list of Filters from the input filter string.
    protected com.mapr.fs.cli.proto.CLIProto.Limiter
    getNextLimiter(int prevStart, int prevCount, int origStart, int origLimit, int numRecsPerRpc)
    Helper method to build limiter for next request.
    protected boolean
    hasMore(int origStart, int origLimit, int prevStart, int prevCount)
    A method that helps the sub classes to determine if there are more records to be processed.
    abstract boolean
    hasMore(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.
    void
    list(com.mapr.cliframework.base.CommandOutput.OutputHierarchy out)
    Initiates the iteration process.
    abstract void
    processResponse(com.mapr.cliframework.base.CommandOutput.OutputHierarchy out, com.google.protobuf.MessageLite resp)
    Parse the response and populate the output hierarchy.
    abstract com.google.protobuf.MessageLite
    sendRequest(com.google.protobuf.MessageLite req)
    Send the request using RPC and fetch the response.

    Methods inherited from class com.mapr.cliframework.base.CLIBaseClass

    executeCommand, executeRealCommand, executeSimpleSHHCommand, executeSimpleSHHCommand, getBooleanParam, getCLICommand, getCommandUsage, getGIds, getInput, getKeyType, getParamBooleanValue, getParamDateValue, getParamIntValue, getParamLongValue, getParamObjectValue, getParamTextValue, getUserClusterOps, getUserCredentials, getUserId, getUserLoginId, getVersion, isParamPresent, isParamValueEmpty, setServerCall, setUserClusterOps, setUserCredentials, setUserCredentialsByJwt, setVersion, skipValidation, validateInput

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ListCommand

      public ListCommand(com.mapr.cliframework.base.ProcessedInput input, com.mapr.cliframework.base.CLICommand cliCommand)
  • Method Details

    • getNextLimiter

      protected com.mapr.fs.cli.proto.CLIProto.Limiter getNextLimiter(int prevStart, int prevCount, int origStart, int origLimit, int numRecsPerRpc)
      Helper method to build limiter for next request.
      Parameters:
      prevStart - - start index of the limiter in prev request
      prevCount - - number of records returned in prev response
      origStart - - starting index of the records originally requested (using the cli -start param)
      origLimit - - number of records originally requested (using the cli -limit param)
      numRecsPerRpc - - number of records an rpc response can carry
      Returns:
      - Limiter object for the next request
    • getFilters

      protected <T> List<com.mapr.fs.cli.proto.CLIProto.Filter> getFilters(Map<T,com.mapr.cliframework.util.FieldInfo> table, String filterParam) throws com.mapr.cliframework.base.CLIProcessingException
      Helper method for the sub classes to build a list of Filters from the input filter string.
      Type Parameters:
      T -
      Parameters:
      table -
      filterParam -
      Returns:
      Throws:
      com.mapr.cliframework.base.CLIProcessingException
    • hasMore

      protected boolean hasMore(int origStart, int origLimit, int prevStart, int prevCount)
      A method that helps the sub classes to determine if there are more records to be processed.
      Parameters:
      origStart - - The original value for the -start parameter
      origLimit - - The original value for the -limit parameter
      prevStart - - The value for the start parameter supplied during previous iteration.
      prevCount - - The number of records returned in the previous iteration.
      Returns:
      - true, if there are more records. false otherwise.
    • list

      public void list(com.mapr.cliframework.base.CommandOutput.OutputHierarchy out) throws com.mapr.cliframework.base.CLIProcessingException
      Description copied from interface: ListIterator
      Initiates the iteration process. while (hasMore()) { buildNextRequest sendRequest processResponse }
      Specified by:
      list in interface ListIterator
      Parameters:
      out - - The output of all the processed responses.
      Throws:
      com.mapr.cliframework.base.CLIProcessingException
    • hasMore

      public abstract boolean hasMore(com.google.protobuf.MessageLite prevReq, com.google.protobuf.MessageLite prevResp) throws com.mapr.cliframework.base.CLIProcessingException
      Description copied from interface: ListIterator
      Inspect the last request and last response to see if there are more records to be fetched.
      Specified by:
      hasMore in interface ListIterator
      Returns:
      - true, if there are more records. false, if no more.
      Throws:
      com.mapr.cliframework.base.CLIProcessingException
    • buildNextRequest

      public abstract com.google.protobuf.MessageLite buildNextRequest(com.google.protobuf.MessageLite prevReq, com.google.protobuf.MessageLite prevResp) throws com.mapr.cliframework.base.CLIProcessingException
      Description copied from interface: ListIterator
      Builds the next request object by inspecting the previous request and previous response.
      Specified by:
      buildNextRequest in interface ListIterator
      Returns:
      - new request object
      Throws:
      com.mapr.cliframework.base.CLIProcessingException
    • sendRequest

      public abstract com.google.protobuf.MessageLite sendRequest(com.google.protobuf.MessageLite req) throws com.mapr.cliframework.base.CLIProcessingException
      Description copied from interface: ListIterator
      Send the request using RPC and fetch the response.
      Specified by:
      sendRequest in interface ListIterator
      Parameters:
      req - - request object.
      Returns:
      - the response object.
      Throws:
      com.mapr.cliframework.base.CLIProcessingException
    • processResponse

      public abstract void processResponse(com.mapr.cliframework.base.CommandOutput.OutputHierarchy out, com.google.protobuf.MessageLite resp) throws com.mapr.cliframework.base.CLIProcessingException
      Description copied from interface: ListIterator
      Parse the response and populate the output hierarchy.
      Specified by:
      processResponse in interface ListIterator
      Parameters:
      out - - CommandOutput.OutputHierarchy
      resp - - response object
      Throws:
      com.mapr.cliframework.base.CLIProcessingException