Class TableCommands

  • All Implemented Interfaces:
    org.springframework.shell.core.CommandMarker, org.springframework.shell.core.ExecutionProcessor

    @Component
    public class TableCommands
    extends ShellCommands
    • Constructor Summary

      Constructors 
      Constructor Description
      TableCommands()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void create​(java.lang.String tablePath)  
      void delete​(java.lang.String tablePath, java.lang.String id, java.lang.String conditionString)  
      void desc​(java.lang.String tablePath)  
      void drop​(java.lang.String tablePath)  
      void exists​(java.lang.String path)  
      void find​(java.lang.String tablePath, java.lang.String indexName, java.lang.String _id, java.lang.String fromId, java.lang.String toId, java.lang.String limit, java.lang.String withTags, java.lang.String pretty, java.lang.String offset, java.lang.String orderby, java.lang.String conditionString, java.lang.String projectionString, java.lang.String queryString)  
      void get​(java.lang.String tablePath, java.lang.String _id, java.lang.String conditionString, java.lang.String projectionString, java.lang.String withTags, java.lang.String pretty)  
      void indexlist​(java.lang.String tablePath)  
      void indexscan​(java.lang.String tablePath, java.lang.String indexName, java.lang.String limit, java.lang.String withTags, java.lang.String pretty, java.lang.String mode, java.lang.String queryString, java.lang.String projectionString, java.lang.String decodeIndexedFields)  
      void insert​(java.lang.String tablePath, java.lang.String _id, java.lang.String jsonStr, java.lang.String conditionString)  
      boolean isDMLAvailable()  
      void list​(java.lang.String patternOrPath)  
      void replace​(java.lang.String tablePath, java.lang.String _id, java.lang.String jsonStr, java.lang.String conditionString)  
      void update​(java.lang.String tablePath, java.lang.String _id, java.lang.String kvs, java.lang.String conditionString)  
      • Methods inherited from class java.lang.Object

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

      • TableCommands

        public TableCommands()
                      throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • isDMLAvailable

        @CliAvailabilityIndicator({"find","insert","delete","exists","create","drop","list","desc"})
        public boolean isDMLAvailable()
      • exists

        @CliCommand(value="exists",
                    help="Returns true if the table exists.")
        public void exists​(@CliOption(key={"","path","p"},mandatory=true,help="Table path.")
                           java.lang.String path)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • list

        @CliCommand(value="list",
                    help="Lists all tables in a folder or matching the specified pattern.")
        public void list​(@CliOption(key={"","p","patternOrPath"},help="A path and/or a file pattern.")
                         java.lang.String patternOrPath)
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • desc

        @CliCommand(value="desc",
                    help="Describes the properties of a table.")
        public void desc​(@CliOption(key={"","t","table"},mandatory=true,help="Table path.")
                         java.lang.String tablePath)
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • create

        @CliCommand(value="create",
                    help="Create a json table at the given path.")
        public void create​(@CliOption(key={"","t","table"},mandatory=true,help="Table path.")
                           java.lang.String tablePath)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • drop

        @CliCommand(value="drop",
                    help="Deletes a MapR-DB json table.")
        public void drop​(@CliOption(key={"","t","table"},mandatory=true,help="Table path.")
                         java.lang.String tablePath)
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • insert

        @CliCommand(value="insert",
                    help="Inserts or replaces a document into the table.",
                    examples={"insert /tables/users --value \'{\"_id\":\"user001\" , \"first_name\":\"John\", \"last_name\":\"Doe\"}\'","insert /tables/users --id user002 --value \'{\"first_name\":\"Jane\", \"last_name\":\"Dane\"}\'"})
        public void insert​(@CliOption(key={"","t","table"},mandatory=true,help="Table path.")
                           java.lang.String tablePath,
                           @CliOption(key="id",help="Document Id.")
                           java.lang.String _id,
                           @CliOption(key={"v","value"},mandatory=true,help="Json document to insert or replace.")
                           java.lang.String jsonStr,
                           @CliOption(key={"c","where"},mandatory=false,help="Condition in JSON format")
                           java.lang.String conditionString)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • replace

        @CliCommand(value="replace",
                    help="Replace a document based on condition.",
                    examples="replace /tables/users --id user002 --value \'{\"first_name\":\"Jane\", \"last_name\":\"Doe\"}\'")
        public void replace​(@CliOption(key={"","t","table"},mandatory=true,help="Table path.")
                            java.lang.String tablePath,
                            @CliOption(key="id",help="Document Id.")
                            java.lang.String _id,
                            @CliOption(key={"v","value"},mandatory=true,help="Json document to insert or replace.")
                            java.lang.String jsonStr,
                            @CliOption(key={"c","where"},mandatory=false,help="Condition in JSON format")
                            java.lang.String conditionString)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • get

        @CliCommand(value="findbyid",
                    help="Retrieves a single document from the table.",
                    examples="findbyid /tables/users --id user001")
        public void get​(@CliOption(key={"","table","t"},mandatory=true,help="Table path.")
                        java.lang.String tablePath,
                        @CliOption(key="id",mandatory=true,help="Document Id.")
                        java.lang.String _id,
                        @CliOption(key={"c","where"},help="Condition in JSON format")
                        java.lang.String conditionString,
                        @CliOption(key={"f","fields"},help="Projections in JSON documents")
                        java.lang.String projectionString,
                        @CliOption(key={"withtags","withTags"},help="Enables/disables printing with extended Type Tags.",specifiedDefaultValue="true")
                        java.lang.String withTags,
                        @CliOption(key="pretty",help="Enables/disables pretty printing of the document.",specifiedDefaultValue="true")
                        java.lang.String pretty)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • find

        @CliCommand(value="find",
                    help="Retrieves one or more documents from the table.",
                    examples={"find /tables/users","find /tables/users --fromid user001 --toid user00a --limit 32"})
        public void find​(@CliOption(key={"","t","table"},mandatory=true,help="Table path.")
                         java.lang.String tablePath,
                         @CliOption(key={"indexName","indexname"},hidden=true)
                         java.lang.String indexName,
                         @CliOption(key="id",help="Document Id.")
                         java.lang.String _id,
                         @CliOption(key="fromid",help="Document Id to start from (inclusive)")
                         java.lang.String fromId,
                         @CliOption(key="toid",help="Document Id to stop at (exclusive)")
                         java.lang.String toId,
                         @CliOption(key="limit",help="Maximum number of documents to return.")
                         java.lang.String limit,
                         @CliOption(key={"withtags","withTags"},help="Enables/disables printing with extended Type Tags.",specifiedDefaultValue="true")
                         java.lang.String withTags,
                         @CliOption(key="pretty",help="Enables/disables pretty printing of the document.",specifiedDefaultValue="true")
                         java.lang.String pretty,
                         @CliOption(key="offset",help="Skip first n number of rows in the result.")
                         java.lang.String offset,
                         @CliOption(key="orderby",help="Sort result by the given fields.")
                         java.lang.String orderby,
                         @CliOption(key={"c","where"},help="Condition in JSON format")
                         java.lang.String conditionString,
                         @CliOption(key={"f","fields"},help="Projections in JSON documents")
                         java.lang.String projectionString,
                         @CliOption(key={"q","query"},mandatory=false,help="Query in JSON documents")
                         java.lang.String queryString)
                  throws java.io.IOException,
                         javax.naming.OperationNotSupportedException
        Throws:
        java.io.IOException
        javax.naming.OperationNotSupportedException
      • indexlist

        @CliCommand(value="indexlist",
                    help="Retrieves the list of indexes for the specified table.",
                    hidden=false,
                    examples="indexlist /tables/users")
        public void indexlist​(@CliOption(key={"","t","table"},mandatory=true,help="Table path.")
                              java.lang.String tablePath)
      • indexscan

        @CliCommand(value="indexscan",
                    help="Scan the index and return the document in their natural order.",
                    hidden=false,
                    examples={"indexscan /table --indexname idx --limit 7","indexscan /table --indexname idx --mode err"})
        public void indexscan​(@CliOption(key={"","t","table"},mandatory=true,help="Table path.")
                              java.lang.String tablePath,
                              @CliOption(key={"indexname","indexName"},mandatory=true,help="Name of the index.")
                              java.lang.String indexName,
                              @CliOption(key="limit",help="Maximum number of documents to return.")
                              java.lang.String limit,
                              @CliOption(key={"withtags","withTags"},help="Enables/disables printing with extended Type Tags.",specifiedDefaultValue="true")
                              java.lang.String withTags,
                              @CliOption(key="pretty",help="Enables/disables pretty printing of the document.",specifiedDefaultValue="true")
                              java.lang.String pretty,
                              @CliOption(key="mode",help="Scan mode, currently support error scan with --mode err")
                              java.lang.String mode,
                              @CliOption(key={"c","where"},help="Condition in JSON format")
                              java.lang.String queryString,
                              @CliOption(key={"f","fields"},help="Projections in JSON documents")
                              java.lang.String projectionString,
                              @CliOption(key="decodeindexedfields",help="Decode all indexed fields into a special array",specifiedDefaultValue="false")
                              java.lang.String decodeIndexedFields)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • delete

        @CliCommand(value="delete",
                    help="Delete a document from the table.")
        public void delete​(@CliOption(key={"","t","table"},mandatory=true,help="Table path.")
                           java.lang.String tablePath,
                           @CliOption(key="id",mandatory=true,help="Document Id.")
                           java.lang.String id,
                           @CliOption(key={"c","where"},mandatory=false,help="Condition in JSON format")
                           java.lang.String conditionString)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • update

        @CliCommand(value="update",
                    help="Update field in a single document.")
        public void update​(@CliOption(key={"","t","table"},mandatory=true,help="Table path.")
                           java.lang.String tablePath,
                           @CliOption(key="id",mandatory=true,help="Document Id.")
                           java.lang.String _id,
                           @CliOption(key={"m","mutation"},mandatory=true,help="Json document containing field and their values.")
                           java.lang.String kvs,
                           @CliOption(key={"c","where"},mandatory=false,help="Condition in JSON format")
                           java.lang.String conditionString)
                    throws java.io.IOException
        Throws:
        java.io.IOException