diff --git a/go/hello-world-tracing/README.md b/go/hello-world-tracing/README.md
deleted file mode 100644
index 6a083512..00000000
--- a/go/hello-world-tracing/README.md
+++ /dev/null
@@ -1,177 +0,0 @@
-# Cloud Bigtable Hello World
-
-This is a simple application that demonstrates using the go Google Cloud
-API to connect to and interact with Cloud Bigtable.
-This project adds automatic exports of [tracing to stackdriver](https://cloud.google.com/trace/) and
-[Z-Pages](https://github.com/census-instrumentation/opencensus-go/tree/master/zpages) that
-show information about traces on the local machine.
-
-See the [documentation for this
-sample](https://cloud.google.com/bigtable/docs/samples-go-hello) for a brief
-explanation of the hello world code.
-
-**Table of Contents**
-
-
-
-
-
-- [Downloading the sample](#downloading-the-sample)
-- [Costs](#costs)
-- [Before you begin](#before-you-begin)
- - [Importing Go dependencies](#importing-go-dependencies)
- - [Creating a Project in the Google Cloud Platform Console](#creating-a-project-in-the-google-cloud-platform-console)
- - [Enabling billing for your project.](#enabling-billing-for-your-project)
- - [Enable the Cloud Bigtable APIs.](#enable-the-cloud-bigtable-apis)
- - [Install the Google Cloud SDK.](#install-the-google-cloud-sdk)
- - [Setting Google Application Default Credentials](#setting-google-application-default-credentials)
-- [Provisioning an instance](#provisioning-an-instance)
-- [Running the application](#running-the-application)
-- [Cleaning up](#cleaning-up)
-
-
-
-
-## Downloading the sample
-
-Download the sample app and navigate into the app directory:
-
-1. Clone the [Cloud Bigtable examples repository][github-repo], to your local
- machine:
-
- git clone https://github.com/GoogleCloudPlatform/cloud-bigtable-examples.git
-
- Alternatively, you can [download the sample][github-zip] as a zip file and
- extract it.
-
-1. Change to the Hello World code sample directory.
-
- cd cloud-bigtable-examples/node/hello-world
-
-[github-repo]: https://github.com/GoogleCloudPlatform/cloud-bigtable-examples
-[github-zip]: https://github.com/GoogleCloudPlatform/cloud-bigtable-examples/archive/master.zip
-
-
-## Costs
-
-This sample uses billable components of Cloud Platform, including:
-
-+ Google Cloud Bigtable
-
-Use the [Pricing Calculator][bigtable-pricing] to generate a cost estimate
-based on your projected usage. New Cloud Platform users might be eligible for
-a [free trial][free-trial].
-
-[bigtable-pricing]: https://cloud.google.com/products/calculator/#id=1eb47664-13a2-4be1-9d16-6722902a7572
-[free-trial]: https://cloud.google.com/free-trial
-
-
-## Before you begin
-
-This sample assumes you have [Go][go] with a minimum version of 1.6.x
-installed.
-
-[go]: https://golang.org/
-
-### Importing Go dependencies
-
-Run the following command to import the bigtable library dependency:
-
- go get -u
-
-### Creating a Project in the Google Cloud Platform Console
-
-If you haven't already created a project, create one now. Projects enable you
-to manage all Google Cloud Platform resources for your app, including
-deployment, access control, billing, and services.
-
-1. Open the [Cloud Platform Console][cloud-console].
-1. In the drop-down menu at the top, select **Create a project**.
-1. Give your project a name.
-1. Make a note of the project ID, which might be different from the project
- name. The project ID is used in commands and in configurations.
-
-[cloud-console]: https://console.cloud.google.com/
-
-### Enabling billing for your project.
-
-If you haven't already enabled billing for your project, [enable
-billing][enable-billing] now. Enabling billing allows is required to use
-Cloud Bigtable and to create VM instances.
-
-[enable-billing]: https://console.cloud.google.com/project/_/settings
-
-### Enable the Cloud Bigtable APIs.
-
-Make sure to [enable the Bigtable APIs][enable-bigtable-api].
-
-[enable-bigtable-api]: https://console.cloud.google.com/apis/library?q=bigtable
-
-### Install the Google Cloud SDK.
-
-If you haven't already installed the Google Cloud SDK, [install the Google
-Cloud SDK][cloud-sdk] now. The SDK contains tools and libraries that enable you
-to create and manage resources on Google Cloud Platform.
-
-[cloud-sdk]: https://cloud.google.com/sdk/
-
-### Setting Google Application Default Credentials
-
-Set your [Google Application Default
-Credentials][application-default-credentials] by [initializing the Google Cloud
-SDK][cloud-sdk-init] with the command:
-
- gcloud init
-
-Generate a credentials file by running the [application-default login](https://cloud.google.com/sdk/gcloud/reference/auth/application-default/login) command:
-
- gcloud auth application-default login
-
-[cloud-sdk-init]: https://cloud.google.com/sdk/docs/initializing
-[application-default-credentials]: https://developers.google.com/identity/protocols/application-default-credentials
-
-
-## Provisioning an instance
-
-Follow the instructions in the [user
-documentation](https://cloud.google.com/bigtable/docs/creating-instance) to
-create a Google Cloud Platform project and Cloud Bigtable instance if necessary.
-You'll need to reference your project id and instance id to run the
-application.
-
-
-## Running the application
-
-Run the sample using node. Replace `BIGTABLEINSTANCE` with what you called
-it when provisioning the instance.
-
- INSTANCE_ID=BIGTABLEINSTANCE node index.js
-
-You will see output resembling the following, interspersed with informational logging
-from the underlying libraries:
-
- Creating table Hello-Bigtable
- Write some greetings to the table
- Reading a single row by row key
- Read: Hello World!
- Reading the entire table
- Read: Hello World!
- Read: Hello Bigtable!
- Read: Hello Node!
- Delete the table
-
-
-## Cleaning up
-
-To avoid incurring extra charges to your Google Cloud Platform account, remove
-the resources created for this sample.
-
-1. Go to the [Cloud Bigtable instance page](https://console.cloud.google.com/project/_/bigtable/instances) in the Cloud Console.
-
-1. Click on the instance name.
-
-1. Click **Delete instance**.
-
- ![Delete](https://cloud.google.com/bigtable/img/delete-quickstart-instance.png)
-
-1. Type the instance ID, then click **Delete** to delete the instance.
diff --git a/go/hello-world-tracing/helloworld.go b/go/hello-world-tracing/helloworld.go
deleted file mode 100644
index 966a4b97..00000000
--- a/go/hello-world-tracing/helloworld.go
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
-Copyright 2018 Google Inc. All Rights Reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package main
-
-import (
- "flag"
- "fmt"
- "log"
- "net/http"
- "time"
-
- "cloud.google.com/go/bigtable"
- "go.opencensus.io/exporter/stackdriver"
- ocgrpc "go.opencensus.io/plugin/grpc"
- "go.opencensus.io/stats"
- "go.opencensus.io/trace"
- "go.opencensus.io/zpages"
- "golang.org/x/net/context"
- "google.golang.org/api/option"
- "google.golang.org/grpc"
-)
-
-const (
- tableName = "Hello-Bigtable"
- columnFamilyName = "cf1"
- columnName = "greeting"
-)
-
-var greetings = []string{"Hello World!", "Hello Cloud Bigtable!", "Hello golang!"}
-
-// A minimal application to connect to bigtable, do basic operations
-// and demonstrate use of opencensus to push traces and stats to stackdriver
-// Usage: go run helloworld.go -project
-instance
-func main() {
- project := flag.String("project", "", "The Google Cloud Platform project ID. Required.")
- instance := flag.String("instance", "", "The Google Cloud Bigtable instance ID. Required.")
- flag.Parse()
-
- for _, f := range []string{"project", "instance"} {
- if flag.Lookup(f).Value.String() == "" {
- log.Fatalf("The %s flag is required.", f)
- }
- }
-
- ctx := context.Background()
- e, err := stackdriver.NewExporter(stackdriver.Options{ProjectID: *project})
- if err != nil {
- log.Fatalf("Could not create stackdriver exporter %v", err)
- }
- trace.RegisterExporter(trace.Exporter(e))
- stats.RegisterExporter(e)
-
- // Start server on port 8080 for tracing data
- go func() { log.Fatal(http.ListenAndServe(":8080", nil)) }()
- zpages.AddDefaultHTTPHandlers()
-
- // Always sample in the example
- trace.SetDefaultSampler(trace.AlwaysSample())
-
- ctx = traceStartSpan(ctx, "cloud.google.com/go/bigtable/example.helloworld")
- doHelloWorld(ctx, *project, *instance)
- traceEndSpan(ctx, err)
-
- // Sleep for 60 sec to see the output at http://localhost:8080/tracez
- fmt.Println("Pausing to view trace at http://localhost:8080/tracez")
- time.Sleep(60 * time.Second)
-}
-
-func sliceContains(list []string, target string) bool {
- for _, s := range list {
- if s == target {
- return true
- }
- }
- return false
-}
-
-func openCensusOptions() []option.ClientOption {
- return []option.ClientOption{
- option.WithGRPCDialOption(grpc.WithStatsHandler(ocgrpc.NewClientStatsHandler())),
- }
-}
-
-// doHelloWorld connects to Cloud Bigtable, runs basic operations and print the results.
-func doHelloWorld(ctx context.Context, project, instance string) {
- tableCount, err := stats.NewMeasureInt64("cloud.google.com/go/bigtable/example.helloworld/numtables", "count of tables", "Num")
- if err != nil {
- log.Fatalf("Table count measure not created: %v", err)
- }
-
- // Create view to see the processed table count cumulatively.
- view, err := stats.NewView(
- "cloud.google.com/go/bigtable/example.helloworld/views/num_table_view",
- "count of tables",
- nil,
- tableCount,
- stats.CountAggregation{},
- stats.Cumulative{},
- )
- if err != nil {
- log.Fatalf("Cannot create view: %v", err)
- }
-
- // Set reporting period to report data at every second.
- stats.SetReportingPeriod(1 * time.Second)
-
- // Subscribe will allow view data to be exported.
- // Once no longer need, you can unsubscribe from the view.
- if err := view.Subscribe(); err != nil {
- log.Fatalf("Cannot subscribe to the view: %v", err)
- }
- defer func() { view.Unsubscribe() }()
-
- adminClient, err := bigtable.NewAdminClient(ctx, project, instance)
- if err != nil {
- log.Fatalf("Could not create admin client: %v", err)
- }
-
- tables, err := adminClient.Tables(ctx)
- if err != nil {
- log.Fatalf("Could not fetch table list: %v", err)
- }
-
- if !sliceContains(tables, tableName) {
- tracePrintf(ctx, nil, "Creating a new table")
- log.Printf("Creating table %s", tableName)
- if err := adminClient.CreateTable(ctx, tableName); err != nil {
- log.Fatalf("Could not create table %s: %v", tableName, err)
- }
- }
-
- // Record data points.
- stats.Record(ctx, tableCount.M(int64(len(tables)+1)))
-
- tblInfo, err := adminClient.TableInfo(ctx, tableName)
- if err != nil {
- log.Fatalf("Could not read info for table %s: %v", tableName, err)
- }
-
- if !sliceContains(tblInfo.Families, columnFamilyName) {
- tracePrintf(ctx, nil, "Creating column family")
- if err := adminClient.CreateColumnFamily(ctx, tableName, columnFamilyName); err != nil {
- log.Fatalf("Could not create column family %s: %v", columnFamilyName, err)
- }
- }
-
- client, err := bigtable.NewClient(ctx, project, instance, openCensusOptions()...)
- if err != nil {
- log.Fatalf("Could not create data operations client: %v", err)
- }
-
- tbl := client.Open(tableName)
- muts := make([]*bigtable.Mutation, len(greetings))
- rowKeys := make([]string, len(greetings))
-
- log.Printf("Writing greeting rows to table")
- for i, greeting := range greetings {
- muts[i] = bigtable.NewMutation()
- muts[i].Set(columnFamilyName, columnName, bigtable.Now(), []byte(greeting))
-
- rowKeys[i] = fmt.Sprintf("%s%d", columnName, i)
- }
-
- rowErrs, err := tbl.ApplyBulk(ctx, rowKeys, muts)
- if err != nil {
- log.Fatalf("Could not apply bulk row mutation: %v", err)
- }
- if rowErrs != nil {
- for _, rowErr := range rowErrs {
- log.Printf("Error writing row: %v", rowErr)
- }
- log.Fatalf("Could not write some rows")
- }
-
- log.Printf("Getting a single greeting by row key:")
- row, err := tbl.ReadRow(ctx, rowKeys[0], bigtable.RowFilter(bigtable.ColumnFilter(columnName)))
- if err != nil {
- log.Fatalf("Could not read row with key %s: %v", rowKeys[0], err)
- }
- log.Printf("\t%s = %s\n", rowKeys[0], string(row[columnFamilyName][0].Value))
-
- log.Printf("Reading all greeting rows:")
- err = tbl.ReadRows(ctx, bigtable.PrefixRange(columnName), func(row bigtable.Row) bool {
- item := row[columnFamilyName][0]
- log.Printf("\t%s = %s\n", item.Row, string(item.Value))
- return true
- }, bigtable.RowFilter(bigtable.ColumnFilter(columnName)))
-
- if err = client.Close(); err != nil {
- log.Fatalf("Could not close data operations client: %v", err)
- }
-
- log.Printf("Deleting the table")
- if err = adminClient.DeleteTable(ctx, tableName); err != nil {
- log.Fatalf("Could not delete table %s: %v", tableName, err)
- }
-
- if err = adminClient.Close(); err != nil {
- log.Fatalf("Could not close admin client: %v", err)
- }
-}
-
-func traceStartSpan(ctx context.Context, name string) context.Context {
- ctx, _ = trace.StartSpan(ctx, name)
- return ctx
-}
-
-func traceEndSpan(ctx context.Context, err error) {
- span := trace.FromContext(ctx)
- if err != nil {
- span.SetStatus(trace.Status{Message: err.Error()})
- }
-
- span.End()
-}
-
-func tracePrintf(ctx context.Context, attrMap map[string]interface{}, format string, args ...interface{}) {
- var attrs []trace.Attribute
- for k, v := range attrMap {
- var a trace.Attribute
- switch v := v.(type) {
- case string:
- a = trace.StringAttribute{k, v}
- case bool:
- a = trace.BoolAttribute{k, v}
- case int:
- a = trace.Int64Attribute{k, int64(v)}
- case int64:
- a = trace.Int64Attribute{k, v}
- default:
- a = trace.StringAttribute{k, fmt.Sprintf("%#v", v)}
- }
- attrs = append(attrs, a)
- }
- trace.FromContext(ctx).Annotatef(attrs, format, args...)
-}
diff --git a/quickstart/LICENSE b/quickstart/LICENSE
deleted file mode 100644
index 261eeb9e..00000000
--- a/quickstart/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/quickstart/README.md b/quickstart/README.md
index 182c98d5..739ca066 100644
--- a/quickstart/README.md
+++ b/quickstart/README.md
@@ -1,81 +1,3 @@
## Apache HBase using Google Cloud Bigtable - QuickStart
-Following these steps should get you to the hbase shell in 3 minutes.
-
-## Prerequsites
- - [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
- - [Apache Maven](http://maven.apache.org/download.cgi)
- - [Cloud SDK](https://cloud.google.com/sdk/)
- - `gcloud components update`
- - `gcloud components install alpha beta`
- - Bash or [cygwin](http://www.cygwin.com/)
- - A copy of this [project]() installed on your computer
-
-## Project Setup, installation, and configuration
-1. Go to the [Cloud Console](https://cloud.google.com/console) and create or select your project.
-
-1. Enable Billing (if not all ready).
-
-1. Create a new [Bigtable Instance](https://cloud.google.com/bigtable/docs/creating-instance)
-
-1. Select **APIs & Auth > APIs**
-
- Verify that both the **Cloud Bigtable API** and the **Cloud Bigtable Admin API** are enabled.
-
-1. [Initialize gcloud](https://cloud.google.com/sdk/gcloud/#gcloud.init) via **`gcloud init`**. This will initialize your credentials, your default cloud zone and project id.
-
-1. **`chmod +x quickstart.sh`**
-
-1. **`./quickstart.sh`** will write a valid hbase-site.xml for you.
-
-Alternatively you can just use maven directly.
-
- mvn clean package exec:java -Dbigtable.projectID=... -Dbigtable.instanceID=...
-
-## HBase shell
-
- HBase Shell; enter 'help' for list of supported commands.
- Type "exit" to leave the HBase Shell
- Version 1.2.1, rd0a115a7267f54e01c72c603ec53e91ec418292f, Tue Jun 23 14:56:34 PDT 2015
-
- hbase(main):001:0>
-
-1. Create a table (tableName, Column Family)
-
- \> `create 'test', 'cf'`
-
-1. List Tables
-
- \> `list`
-
-1. Add some data
-
- \> `put 'test', 'row1', 'cf:a', 'value1'`
-
- \> `put 'test', 'row2', 'cf:b', 'value2'`
-
- \> `put 'test', 'row3', 'cf:c', 'value3'`
-
-1. Scan the table for data
-
- \> `scan 'test'`
-
-1. Get a single row of data
-
- \> `get 'test', 'row1'`
-
-1. Disable a table
-
- \> `disable 'test'`
-
-1. Drop the table
-
- \> `drop 'test'`
-
-1. Finished
-
- \> `exit`
-
-## Licensing
-
-* See [LICENSE](LICENSE)
+The quickstart has moved to https://github.com/GoogleCloudPlatform/cloud-bigtable-examples/tree/main/java/quickstart.
diff --git a/quickstart/pom.xml b/quickstart/pom.xml
deleted file mode 100644
index 747a4d31..00000000
--- a/quickstart/pom.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-
-
- 4.0.0
-
- cloud-bigtable
- quickstart
- 1.0-SNAPSHOT
- jar
-
-
- 1.4.0
- 1.4.3
-
- UTF-8
-
-
-
-
- com.google.cloud.bigtable
- bigtable-hbase-1.x
- ${bigtable.version}
-
-
-
- commons-configuration
- commons-configuration
- 1.6
-
-
-
- org.apache.hbase
- hbase-shell
- ${hbase.version}
-
-
-
-
-
-
-
- src/main/resources
- true
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
- 1.4.0
-
- org.jruby.Main
- false
-
- -d
- -X+O
- thirdparty/hirb.rb
-
-
-
- hbase.ruby.sources
- thirdparty/ruby
-
-
-
-
-
-
-
-
diff --git a/quickstart/quickstart.sh b/quickstart/quickstart.sh
deleted file mode 100755
index 9bbac68c..00000000
--- a/quickstart/quickstart.sh
+++ /dev/null
@@ -1,157 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2015 Google, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.set -x -e
-
-# quickstart.sh
-#
-# This will start hbase shell using the pom.xml, assuming you have:
-# 1. gcloud auth login
-# 2. either given --project NAME or gcloud config set project XXXXX
-# 3. have created a Cloud Bigtable Instance
-
-# Prequsites: gcloud, mvn, Java
-
-beta="beta"
-
-# Allow executing from any directory
-cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-# Allow overriding the date function for unit testing.
-function my_date() {
- date "$@"
-}
-
-# Simple wrapper around "echo" so that it's easy to add log messages with a
-# date/time prefix.
-function loginfo() {
- echo "$(my_date): ${@}"
-}
-
-# Simple wrapper around "echo" controllable with ${VERBOSE_MODE}.
-function logdebug() {
- if (( ${VERBOSE_MODE} )); then
- loginfo ${@}
- fi
-}
-
-# Simple wrapper to pass errors to stderr.
-function logerror() {
- loginfo ${@} >&2
-}
-
-# Handler for errors occuring during the deployment to print useful info before
-# exiting. The following global variables control whether handle_error() should
-# actually process and consolidate a trapped error, or otherwise simply flip
-# CAUGHT_ERROR to '1' without trying to consolidate logs or exiting in case
-# the caller wants to simply continue on error.
-SUPPRESS_TRAPPED_ERRORS=0
-CAUGHT_ERROR=0
-function handle_error() {
- # Save the error code responsible for the trap.
- local errcode=$?
- local bash_command=${BASH_COMMAND}
- local lineno=${BASH_LINENO[0]}
-
- CAUGHT_ERROR=1
-
- if (( ${SUPPRESS_TRAPPED_ERRORS} )); then
- loginfo "Continuing despite trapped error with code '${errcode}'"
- return
- fi
-
- # Wait for remaining async things to finish, otherwise our error message may
- # get lost among other logspam.
- wait
- logerror "Command failed: ${bash_command} on line ${lineno}."
- logerror "Exit code of failed command: ${errcode}"
-
-# consolidate_error_logs
- exit ${errcode}
-}
-
-# Given $1 prints and reads a response from the console.
-SKIP_PROMPT=0
-function prompt() {
- trap handle_error ERR
- local msg="$1"
-
- read -p "${msg}" PROMPT_RESPONSE
-}
-
-# Test for java
-hash java 2>/dev/null || { echo >&2 'Java needs to be installed'; exit 1; }
-
-# Test for Maven
-hash mvn 2>/dev/null || { echo >&2 'Apache Maven needs to be installed.'; exit 1; }
-
-# Test for gcloud
-hash gcloud 2>/dev/null || { echo >&2 'gcloud needs to be installed from https://cloud.google.com/sdk/'; exit 1; }
-NOTLOGGEDIN=$(gcloud auth list --format text 2>/dev/null | grep active_account | grep None)
-if [[ -n "$NOTLOGGEDIN" ]]; then
- echo >&2 'Please login using: gcloud init'; exit 1;
-fi
-
-if [ "$1" == "--project" ]; then
- _projectID=$2
-else
- # If possible set a default project
- _defProj=$(gcloud config list project 2>/dev/null | grep project)
- if [ $? -eq 0 ] && [ -n "${_defProj}" ]; then
- _projectID="${_defProj##project = }"
-
- HAVEPROJECT=$(gcloud projects list --format 'value (projectId)' 2>/dev/null | grep "${_projectID}")
- if [ $? -ne 0 ]; then
- { echo "Project ${_projectID} not found."; exit 1; }
- fi
- else
- ix=1;for item in $(gcloud projects list --format='value (projectId)' 2>/dev/null ); do PROJ[$ix]=$item; echo $ix. $item; ((ix++)); done
- prompt "Select the project? "
- _projectID=${PROJ[$PROMPT_RESPONSE]}
- fi
-fi
-
-gcloud -q components install beta bigtable
-
-# Test for api enabled
-
-HAVECLCMD=$(gcloud $beta bigtable instances list --project ${_projectID} 2>&1 1>/dev/null | grep ERROR)
-if [[ $HAVECLCMD == ERROR* ]]; then
- echo "Project ID= ${_projectID}"
- prompt 'Instance ID= '
- _instanceID=$PROMPT_RESPONSE
-else
- ix=0
- for item in $(gcloud $beta bigtable clusters list --project ${_projectID} --format 'value (INSTANCE)'); do
- _c[$ix]=$item
- ((ix++))
- done
- if [ $ix -eq 1 ]; then
- _instanceID=${_c[0]}
- else
- echo "Please choose an Instance to work with."
-
- for ((i=0; i<$ix; i++)); do
- echo $i. ${_c[$i]}
- done
- prompt 'Instance ID= '
- _instanceID=${_c[$PROMPT_RESPONSE]}
- fi
-fi
-
-echo "Project ID = ${_projectID}"
-echo "Instance ID= ${_instanceID}"
-
-mvn clean package exec:java -Dbigtable.projectID="${_projectID}" -Dbigtable.instanceID="${_instanceID}"
-
diff --git a/quickstart/src/main/resources/hbase-site.xml b/quickstart/src/main/resources/hbase-site.xml
deleted file mode 100644
index f30f47fc..00000000
--- a/quickstart/src/main/resources/hbase-site.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
- google.bigtable.project.id${bigtable.projectID}
- google.bigtable.instance.id${bigtable.instanceID}
-
- hbase.client.connection.impl
- com.google.cloud.bigtable.hbase1_x.BigtableConnection
-
-
diff --git a/quickstart/src/main/resources/log4j.properties b/quickstart/src/main/resources/log4j.properties
deleted file mode 100644
index 9f47fefe..00000000
--- a/quickstart/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-hbase.root.logger=INFO,console
-hbase.security.logger=INFO,console
-
-log4j.rootLogger=${hbase.root.logger}
-
-# Logging Threshold
-log4j.threshold=INFO
-
-log4j.appender.NullAppender=org.apache.log4j.varia.NullAppender
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.target=System.err
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c{2}: %m%n
diff --git a/quickstart/test.txt b/quickstart/test.txt
deleted file mode 100644
index b7d0a870..00000000
--- a/quickstart/test.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright 2016 Google, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Create the table
-
-t = create 'qs-eval', 'f'
-
-# What was created
-t.describe
-
-# See if our table exists
-list 'qs-eval'
-
-# Add some data
-t.put 'John', 'f:name', 'John Smith'
-t.put 'Jane', 'f:name', 'Jane Doe'
-t.put 'Bill', 'f:name', 'Bill Smith'
-t.put 'Les', 'f:name', 'Les Acme'
-
-t.incr 'Les', 'f:visit'
-t.incr 'Les', 'f:visit'
-
-# How many rows do we have?
-t.count CACHE => 1000
-
-# Get some data
-t.get 'Bill'
-
-# view the data in the table
-t.scan
-
-# View with a PrefixFilter
-scan 'qs-eval', { FILTER => "PrefixFilter('J')" }
-
-# Find only rows with columns who's name starts with visit.
-scan 'qs-eval', { FILTER => "ColumnPrefixFilter('visit')" }
-
-
-# Delete our table
-t.disable
-t.drop
-
-exit
diff --git a/quickstart/thirdparty/LICENSE.txt b/quickstart/thirdparty/LICENSE.txt
deleted file mode 100644
index d6456956..00000000
--- a/quickstart/thirdparty/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/quickstart/thirdparty/NOTICE.md b/quickstart/thirdparty/NOTICE.md
deleted file mode 100644
index 040c9901..00000000
--- a/quickstart/thirdparty/NOTICE.md
+++ /dev/null
@@ -1,2 +0,0 @@
-The contents of this directory were taken from Apache HBase 1.2.1.
-The changed / added lines are marked by the tag 'LV3'.
diff --git a/quickstart/thirdparty/hirb.rb b/quickstart/thirdparty/hirb.rb
deleted file mode 100755
index 269fb20a..00000000
--- a/quickstart/thirdparty/hirb.rb
+++ /dev/null
@@ -1,250 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# File passed to org.jruby.Main by bin/hbase. Pollutes jirb with hbase imports
-# and hbase commands and then loads jirb. Outputs a banner that tells user
-# where to find help, shell version, and loads up a custom hirb.
-#
-# In noninteractive mode, runs commands from stdin until completion or an error.
-# On success will exit with status 0, on any problem will exit non-zero. Callers
-# should only rely on "not equal to 0", because the current error exit code of 1
-# will likely be updated to diffentiate e.g. invalid commands, incorrect args,
-# permissions, etc.
-
-# TODO: Interrupt a table creation or a connection to a bad master. Currently
-# has to time out. Below we've set down the retries for rpc and hbase but
-# still can be annoying (And there seem to be times when we'll retry for
-# ever regardless)
-# TODO: Add support for listing and manipulating catalog tables, etc.
-# TODO: Encoding; need to know how to go from ruby String to UTF-8 bytes
-
-# Run the java magic include and import basic HBase types that will help ease
-# hbase hacking.
-$fullBackTrace = false # LV3
-include Java
-
-# Some goodies for hirb. Should these be left up to the user's discretion?
-require 'irb/completion'
-require 'pathname'
-
-# Add the directory names in hbase.jruby.sources commandline option
-# to the ruby load path so I can load up my HBase ruby modules
-sources = java.lang.System.getProperty('hbase.ruby.sources')
-$LOAD_PATH.unshift Pathname.new(sources)
-
-#
-# FIXME: Switch args processing to getopt
-#
-# See if there are args for this shell. If any, read and then strip from ARGV
-# so they don't go through to irb. Output shell 'usage' if user types '--help'
-cmdline_help = < exception
- message = exception.to_s
- # exception unwrapping in shell means we'll have to handle Java exceptions
- # as a special case in order to format them properly.
- if exception.kind_of? java.lang.Exception
- $stderr.puts "java exception"
- message = exception.get_message
- end
- # Include the 'ERROR' string to try to make transition easier for scripts that
- # may have already been relying on grepping output.
- puts "ERROR #{exception.class}: #{message}"
- if $fullBacktrace
- # re-raising the will include a backtrace and exit.
- raise exception
- else
- exit 1
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/hbase.rb b/quickstart/thirdparty/ruby/hbase.rb
deleted file mode 100644
index 2fd23d9b..00000000
--- a/quickstart/thirdparty/ruby/hbase.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# HBase ruby classes.
-# Has wrapper classes for org.apache.hadoop.hbase.client.Admin
-# and for org.apache.hadoop.hbase.client.Table. Classes take
-# Formatters on construction and outputs any results using
-# Formatter methods. These classes are only really for use by
-# the hirb.rb HBase Shell script; they don't make much sense elsewhere.
-# For example, the exists method on Admin class prints to the formatter
-# whether the table exists and returns nil regardless.
-include Java
-
-include_class('java.lang.Integer') {|package,name| "J#{name}" }
-include_class('java.lang.Long') {|package,name| "J#{name}" }
-include_class('java.lang.Boolean') {|package,name| "J#{name}" }
-
-module HBaseConstants
- COLUMN = "COLUMN"
- COLUMNS = "COLUMNS"
- TIMESTAMP = "TIMESTAMP"
- TIMERANGE = "TIMERANGE"
- NAME = org.apache.hadoop.hbase.HConstants::NAME
- VERSIONS = org.apache.hadoop.hbase.HConstants::VERSIONS
- IN_MEMORY = org.apache.hadoop.hbase.HConstants::IN_MEMORY
- METADATA = org.apache.hadoop.hbase.HConstants::METADATA
- STOPROW = "STOPROW"
- STARTROW = "STARTROW"
- ROWPREFIXFILTER = "ROWPREFIXFILTER"
- ENDROW = STOPROW
- RAW = "RAW"
- LIMIT = "LIMIT"
- METHOD = "METHOD"
- MAXLENGTH = "MAXLENGTH"
- CACHE_BLOCKS = "CACHE_BLOCKS"
- ALL_METRICS = "ALL_METRICS"
- METRICS = "METRICS"
- REVERSED = "REVERSED"
- REPLICATION_SCOPE = "REPLICATION_SCOPE"
- INTERVAL = 'INTERVAL'
- CACHE = 'CACHE'
- FILTER = 'FILTER'
- SPLITS = 'SPLITS'
- SPLITS_FILE = 'SPLITS_FILE'
- SPLITALGO = 'SPLITALGO'
- NUMREGIONS = 'NUMREGIONS'
- REGION_REPLICATION = 'REGION_REPLICATION'
- REGION_REPLICA_ID = 'REGION_REPLICA_ID'
- CONFIGURATION = org.apache.hadoop.hbase.HConstants::CONFIGURATION
- ATTRIBUTES="ATTRIBUTES"
- VISIBILITY="VISIBILITY"
- AUTHORIZATIONS = "AUTHORIZATIONS"
- SKIP_FLUSH = 'SKIP_FLUSH'
- CONSISTENCY = "CONSISTENCY"
- ENDPOINT_CLASSNAME = 'ENDPOINT_CLASSNAME'
- CLUSTER_KEY = 'CLUSTER_KEY'
- TABLE_CFS = 'TABLE_CFS'
- CONFIG = 'CONFIG'
- DATA = 'DATA'
- USER = 'USER'
- TABLE = 'TABLE'
- NAMESPACE = 'NAMESPACE'
- TYPE = 'TYPE'
- NONE = 'NONE'
- VALUE = 'VALUE'
-
- # Load constants from hbase java API
- def self.promote_constants(constants)
- # The constants to import are all in uppercase
- constants.each do |c|
- next if c =~ /DEFAULT_.*/ || c != c.upcase
- next if eval("defined?(#{c})")
- eval("#{c} = '#{c}'")
- end
- end
-
- promote_constants(org.apache.hadoop.hbase.HColumnDescriptor.constants)
- promote_constants(org.apache.hadoop.hbase.HTableDescriptor.constants)
-end
-
-# Include classes definition
-require 'hbase/hbase'
-require 'hbase/admin'
-require 'hbase/table'
-require 'hbase/quotas'
-require 'hbase/replication_admin'
-require 'hbase/security'
-require 'hbase/visibility_labels'
-
-
-include HBaseQuotasConstants
\ No newline at end of file
diff --git a/quickstart/thirdparty/ruby/hbase/admin.rb b/quickstart/thirdparty/ruby/hbase/admin.rb
deleted file mode 100644
index 7950ca65..00000000
--- a/quickstart/thirdparty/ruby/hbase/admin.rb
+++ /dev/null
@@ -1,1094 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include Java
-java_import java.util.Arrays
-java_import org.apache.hadoop.hbase.util.Pair
-java_import org.apache.hadoop.hbase.util.RegionSplitter
-java_import org.apache.hadoop.hbase.util.Bytes
-java_import org.apache.hadoop.hbase.ServerName
-java_import org.apache.hadoop.hbase.TableName
-java_import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos::SnapshotDescription
-
-# Wrapper for org.apache.hadoop.hbase.client.HBaseAdmin
-
-module Hbase
- class Admin
- include HBaseConstants
-
- def initialize(admin, formatter)
- @admin = admin
- @connection = @admin.getConnection()
- @formatter = formatter
- end
-
- def close
- @admin.close
- end
-
- #----------------------------------------------------------------------------------------------
- # Returns a list of tables in hbase
- def list(regex = ".*")
- @admin.listTableNames(regex).map { |t| t.getNameAsString }
- end
-
- #----------------------------------------------------------------------------------------------
- # Requests a table or region flush
- def flush(table_or_region_name)
- @admin.flush(table_or_region_name)
- end
-
- #----------------------------------------------------------------------------------------------
- # Requests a table or region or column family compaction
- def compact(table_or_region_name, family = nil)
- if family == nil
- @admin.compact(table_or_region_name)
- else
- # We are compacting a column family within a region.
- @admin.compact(table_or_region_name, family)
- end
- end
-
- # Requests to compact all regions on the regionserver
- def compact_regionserver(servername, major = false)
- @admin.compactRegionServer(ServerName.valueOf(servername), major)
- end
-
- #----------------------------------------------------------------------------------------------
- # Requests a table or region or column family major compaction
- def major_compact(table_or_region_name, family = nil)
- if family == nil
- @admin.majorCompact(table_or_region_name)
- else
- # We are major compacting a column family within a region or table.
- @admin.majorCompact(table_or_region_name, family)
- end
- end
-
- #----------------------------------------------------------------------------------------------
- # Requests a regionserver's WAL roll
- def wal_roll(server_name)
- @admin.rollWALWriter(ServerName.valueOf(server_name))
- end
- # TODO remove older hlog_roll version
- alias :hlog_roll :wal_roll
-
- #----------------------------------------------------------------------------------------------
- # Requests a table or region split
- def split(table_or_region_name, split_point)
- if split_point == nil
- @admin.split(table_or_region_name)
- else
- @admin.split(table_or_region_name, split_point)
- end
- end
-
- #----------------------------------------------------------------------------------------------
- # Enable/disable one split or merge switch
- # Returns previous switch setting.
- def splitormerge_switch(type, enabled)
- switch_type = nil
- if type == 'SPLIT'
- switch_type = org.apache.hadoop.hbase.client.Admin::MasterSwitchType::SPLIT
- elsif type == 'MERGE'
- switch_type = org.apache.hadoop.hbase.client.Admin::MasterSwitchType::MERGE
- else
- raise ArgumentError, 'only SPLIT or MERGE accepted for type!'
- end
- @admin.setSplitOrMergeEnabled(
- java.lang.Boolean.valueOf(enabled), java.lang.Boolean.valueOf(false),
- switch_type)[0]
- end
-
- #----------------------------------------------------------------------------------------------
- # Query the current state of the split or merge switch.
- # Returns the switch's state (true is enabled).
- def splitormerge_enabled(type)
- switch_type = nil
- if type == 'SPLIT'
- switch_type = org.apache.hadoop.hbase.client.Admin::MasterSwitchType::SPLIT
- elsif type == 'MERGE'
- switch_type = org.apache.hadoop.hbase.client.Admin::MasterSwitchType::MERGE
- else
- raise ArgumentError, 'only SPLIT or MERGE accepted for type!'
- end
- @admin.isSplitOrMergeEnabled(switch_type)
- end
-
- def locate_region(table_name, row_key)
- locator = @connection.getRegionLocator(TableName.valueOf(table_name))
- begin
- return locator.getRegionLocation(Bytes.toBytesBinary(row_key))
- ensure
- locator.close()
- end
- end
-
- #----------------------------------------------------------------------------------------------
- # Requests a cluster balance
- # Returns true if balancer ran
- def balancer(force)
- @admin.balancer(java.lang.Boolean::valueOf(force))
- end
-
- #----------------------------------------------------------------------------------------------
- # Enable/disable balancer
- # Returns previous balancer switch setting.
- def balance_switch(enableDisable)
- @admin.setBalancerRunning(
- java.lang.Boolean::valueOf(enableDisable), java.lang.Boolean::valueOf(false))
- end
-
- #----------------------------------------------------------------------------------------------
- # Query the current state of the LoadBalancer.
- # Returns the balancer's state (true is enabled).
- def balancer_enabled?()
- @admin.isBalancerEnabled()
- end
-
- #----------------------------------------------------------------------------------------------
- # Requests region normalization for all configured tables in the cluster
- # Returns true if normalizer ran successfully
- def normalize()
- @admin.normalize()
- end
-
- #----------------------------------------------------------------------------------------------
- # Enable/disable region normalizer
- # Returns previous normalizer switch setting.
- def normalizer_switch(enableDisable)
- @admin.setNormalizerRunning(java.lang.Boolean::valueOf(enableDisable))
- end
-
- #----------------------------------------------------------------------------------------------
- # Query the current state of region normalizer.
- # Returns the state of region normalizer (true is enabled).
- def normalizer_enabled?()
- @admin.isNormalizerEnabled()
- end
-
- #----------------------------------------------------------------------------------------------
- # Request a scan of the catalog table (for garbage collection)
- # Returns an int signifying the number of entries cleaned
- def catalogjanitor_run()
- @admin.runCatalogScan()
- end
-
- #----------------------------------------------------------------------------------------------
- # Enable/disable the catalog janitor
- # Returns previous catalog janitor switch setting.
- def catalogjanitor_switch(enableDisable)
- @admin.enableCatalogJanitor(java.lang.Boolean::valueOf(enableDisable))
- end
-
- #----------------------------------------------------------------------------------------------
- # Query on the catalog janitor state (enabled/disabled?)
- # Returns catalog janitor state (true signifies enabled).
- def catalogjanitor_enabled()
- @admin.isCatalogJanitorEnabled()
- end
-
- #----------------------------------------------------------------------------------------------
- # Enables a table
- def enable(table_name)
- tableExists(table_name)
- return if enabled?(table_name)
- @admin.enableTable(table_name)
- end
-
- #----------------------------------------------------------------------------------------------
- # Enables all tables matching the given regex
- def enable_all(regex)
- regex = regex.to_s
- @admin.enableTables(regex)
- end
-
- #----------------------------------------------------------------------------------------------
- # Disables a table
- def disable(table_name)
- tableExists(table_name)
- return if disabled?(table_name)
- @admin.disableTable(table_name)
- end
-
- #----------------------------------------------------------------------------------------------
- # Disables all tables matching the given regex
- def disable_all(regex)
- regex = regex.to_s
- @admin.disableTables(regex).map { |t| t.getTableName().getNameAsString }
- end
-
- #---------------------------------------------------------------------------------------------
- # Throw exception if table doesn't exist
- def tableExists(table_name)
- raise ArgumentError, "Table #{table_name} does not exist." unless exists?(table_name)
- end
-
- #----------------------------------------------------------------------------------------------
- # Is table disabled?
- def disabled?(table_name)
- @admin.isTableDisabled(table_name)
- end
-
- #----------------------------------------------------------------------------------------------
- # Drops a table
- def drop(table_name)
- tableExists(table_name)
- raise ArgumentError, "Table #{table_name} is enabled. Disable it first." if enabled?(table_name)
-
- @admin.deleteTable(org.apache.hadoop.hbase.TableName.valueOf(table_name))
- end
-
- #----------------------------------------------------------------------------------------------
- # Drops a table
- def drop_all(regex)
- regex = regex.to_s
- failed = @admin.deleteTables(regex).map { |t| t.getTableName().getNameAsString }
- return failed
- end
-
- #----------------------------------------------------------------------------------------------
- # Returns ZooKeeper status dump
- def zk_dump
- @zk_wrapper = org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.new(
- @admin.getConfiguration(),
- "admin",
- nil)
- zk = @zk_wrapper.getRecoverableZooKeeper().getZooKeeper()
- @zk_main = org.apache.zookeeper.ZooKeeperMain.new(zk)
- org.apache.hadoop.hbase.zookeeper.ZKUtil::dump(@zk_wrapper)
- end
-
- #----------------------------------------------------------------------------------------------
- # Parse arguments and update HTableDescriptor accordingly
- def parse_htd_args(htd, arg)
- htd.setNormalizationEnabled(JBoolean.valueOf(arg.delete(NORMALIZATION_ENABLED))) if arg[NORMALIZATION_ENABLED]
- end
-
- #----------------------------------------------------------------------------------------------
- # Creates a table
- def create(table_name, *args)
- # Fail if table name is not a string
- raise(ArgumentError, "Table name must be of type String") unless table_name.kind_of?(String)
-
- # Flatten params array
- args = args.flatten.compact
- has_columns = false
-
- # Start defining the table
- htd = org.apache.hadoop.hbase.HTableDescriptor.new(org.apache.hadoop.hbase.TableName.valueOf(table_name))
- splits = nil
- # Args are either columns or splits, add them to the table definition
- # TODO: add table options support
- args.each do |arg|
- unless arg.kind_of?(String) || arg.kind_of?(Hash)
- raise(ArgumentError, "#{arg.class} of #{arg.inspect} is not of Hash or String type")
- end
-
- # First, handle all the cases where arg is a column family.
- if arg.kind_of?(String) or arg.has_key?(NAME)
- # If the arg is a string, default action is to add a column to the table.
- # If arg has a name, it must also be a column descriptor.
- descriptor = hcd(arg, htd);
- # Warn if duplicate columns are added
- if htd.hasFamily(descriptor.getName)
- puts "Family '" + descriptor.getNameAsString() + "' already exists, the old one will be replaced"
- htd.modifyFamily(descriptor)
- else
- htd.addFamily(descriptor)
- end
- has_columns = true
- next
- end
- if arg.has_key?(REGION_REPLICATION)
- region_replication = JInteger.valueOf(arg.delete(REGION_REPLICATION))
- htd.setRegionReplication(region_replication)
- end
-
- # Get rid of the "METHOD", which is deprecated for create.
- # We'll do whatever it used to do below if it's table_att.
- if (method = arg.delete(METHOD))
- raise(ArgumentError, "table_att is currently the only supported method") unless method == 'table_att'
- end
-
- # The hash is not a column family. Figure out what's in it.
- # First, handle splits.
- if arg.has_key?(SPLITS_FILE)
- splits_file = arg.delete(SPLITS_FILE)
- unless File.exist?(splits_file)
- raise(ArgumentError, "Splits file #{splits_file} doesn't exist")
- end
- arg[SPLITS] = []
- File.foreach(splits_file) do |line|
- arg[SPLITS].push(line.strip())
- end
- htd.setValue(SPLITS_FILE, arg[SPLITS_FILE])
- end
-
- if arg.has_key?(SPLITS)
- splits = Java::byte[][arg[SPLITS].size].new
- idx = 0
- arg.delete(SPLITS).each do |split|
- splits[idx] = org.apache.hadoop.hbase.util.Bytes.toBytesBinary(split)
- idx = idx + 1
- end
- elsif arg.has_key?(NUMREGIONS) or arg.has_key?(SPLITALGO)
- # deprecated region pre-split API; if one of the above is specified, will be ignored.
- raise(ArgumentError, "Number of regions must be specified") unless arg.has_key?(NUMREGIONS)
- raise(ArgumentError, "Split algorithm must be specified") unless arg.has_key?(SPLITALGO)
- raise(ArgumentError, "Number of regions must be greater than 1") unless arg[NUMREGIONS] > 1
- num_regions = arg.delete(NUMREGIONS)
- split_algo = RegionSplitter.newSplitAlgoInstance(@conf, arg.delete(SPLITALGO))
- splits = split_algo.split(JInteger.valueOf(num_regions))
- end
-
- # Done with splits; apply formerly-table_att parameters.
- htd.setOwnerString(arg.delete(OWNER)) if arg[OWNER]
- htd.setMaxFileSize(JLong.valueOf(arg.delete(MAX_FILESIZE))) if arg[MAX_FILESIZE]
- htd.setReadOnly(JBoolean.valueOf(arg.delete(READONLY))) if arg[READONLY]
- htd.setCompactionEnabled(JBoolean.valueOf(arg[COMPACTION_ENABLED])) if arg[COMPACTION_ENABLED]
- htd.setMemStoreFlushSize(JLong.valueOf(arg.delete(MEMSTORE_FLUSHSIZE))) if arg[MEMSTORE_FLUSHSIZE]
- # DEFERRED_LOG_FLUSH is deprecated and was replaced by DURABILITY. To keep backward compatible, it still exists.
- # However, it has to be set before DURABILITY so that DURABILITY could overwrite if both args are set
- if arg.include?(DEFERRED_LOG_FLUSH)
- if arg.delete(DEFERRED_LOG_FLUSH).to_s.upcase == "TRUE"
- htd.setDurability(org.apache.hadoop.hbase.client.Durability.valueOf("ASYNC_WAL"))
- else
- htd.setDurability(org.apache.hadoop.hbase.client.Durability.valueOf("SYNC_WAL"))
- end
- end
- htd.setDurability(org.apache.hadoop.hbase.client.Durability.valueOf(arg.delete(DURABILITY))) if arg[DURABILITY]
- parse_htd_args(htd, arg)
- set_user_metadata(htd, arg.delete(METADATA)) if arg[METADATA]
- set_descriptor_config(htd, arg.delete(CONFIGURATION)) if arg[CONFIGURATION]
-
- arg.each_key do |ignored_key|
- puts("An argument ignored (unknown or overridden): %s" % [ ignored_key ])
- end
- end
-
- # Fail if no column families defined
- raise(ArgumentError, "Table must have at least one column family") if !has_columns
-
- if splits.nil?
- # Perform the create table call
- @admin.createTable(htd)
- else
- # Perform the create table call
- @admin.createTable(htd, splits)
- end
- end
-
- #----------------------------------------------------------------------------------------------
- # Closes a region.
- # If server name is nil, we presume region_name is full region name (HRegionInfo.getRegionName).
- # If server name is not nil, we presume it is the region's encoded name (HRegionInfo.getEncodedName)
- def close_region(region_name, server)
- if (server == nil || !closeEncodedRegion?(region_name, server))
- @admin.closeRegion(region_name, server)
- end
- end
-
- #----------------------------------------------------------------------------------------------
- #----------------------------------------------------------------------------------------------
- # Assign a region
- def assign(region_name)
- @admin.assign(region_name.to_java_bytes)
- end
-
- #----------------------------------------------------------------------------------------------
- # Unassign a region
- def unassign(region_name, force)
- @admin.unassign(region_name.to_java_bytes, java.lang.Boolean::valueOf(force))
- end
-
- #----------------------------------------------------------------------------------------------
- # Move a region
- def move(encoded_region_name, server = nil)
- @admin.move(encoded_region_name.to_java_bytes, server ? server.to_java_bytes: nil)
- end
-
- #----------------------------------------------------------------------------------------------
- # Merge two regions
- def merge_region(encoded_region_a_name, encoded_region_b_name, force)
- @admin.mergeRegions(encoded_region_a_name.to_java_bytes, encoded_region_b_name.to_java_bytes, java.lang.Boolean::valueOf(force))
- end
-
- #----------------------------------------------------------------------------------------------
- # Returns table's structure description
- def describe(table_name)
- @admin.getTableDescriptor(TableName.valueOf(table_name)).to_s
- end
-
- def get_column_families(table_name)
- @admin.getTableDescriptor(TableName.valueOf(table_name)).getColumnFamilies()
- end
-
- def get_table_attributes(table_name)
- @admin.getTableDescriptor(TableName.valueOf(table_name)).toStringTableAttributes
- end
-
- #----------------------------------------------------------------------------------------------
- # Truncates table (deletes all records by recreating the table)
- def truncate(table_name, conf = @conf)
- table_description = @admin.getTableDescriptor(TableName.valueOf(table_name))
- raise ArgumentError, "Table #{table_name} is not enabled. Enable it first." unless enabled?(table_name)
- yield 'Disabling table...' if block_given?
- @admin.disableTable(table_name)
-
- begin
- yield 'Truncating table...' if block_given?
- @admin.truncateTable(org.apache.hadoop.hbase.TableName.valueOf(table_name), false)
- rescue => e
- # Handle the compatibility case, where the truncate method doesn't exists on the Master
- raise e unless e.respond_to?(:cause) && e.cause != nil
- rootCause = e.cause
- if rootCause.kind_of?(org.apache.hadoop.hbase.DoNotRetryIOException) then
- # Handle the compatibility case, where the truncate method doesn't exists on the Master
- yield 'Dropping table...' if block_given?
- @admin.deleteTable(org.apache.hadoop.hbase.TableName.valueOf(table_name))
-
- yield 'Creating table...' if block_given?
- @admin.createTable(table_description)
- else
- raise e
- end
- end
- end
-
- #----------------------------------------------------------------------------------------------
- # Truncates table while maintaing region boundaries (deletes all records by recreating the table)
- def truncate_preserve(table_name, conf = @conf)
- h_table = @connection.getTable(TableName.valueOf(table_name))
- locator = @connection.getRegionLocator(TableName.valueOf(table_name))
- begin
- splits = locator.getAllRegionLocations().
- map{|i| Bytes.toString(i.getRegionInfo().getStartKey)}.
- delete_if{|k| k == ""}.to_java :String
- ensure
- locator.close()
- end
-
- table_description = @admin.getTableDescriptor(TableName.valueOf(table_name))
- yield 'Disabling table...' if block_given?
- disable(table_name)
-
- begin
- yield 'Truncating table...' if block_given?
- @admin.truncateTable(org.apache.hadoop.hbase.TableName.valueOf(table_name), true)
- rescue => e
- # Handle the compatibility case, where the truncate method doesn't exists on the Master
- raise e unless e.respond_to?(:cause) && e.cause != nil
- rootCause = e.cause
- if rootCause.kind_of?(org.apache.hadoop.hbase.DoNotRetryIOException) then
- # Handle the compatibility case, where the truncate method doesn't exists on the Master
- yield 'Dropping table...' if block_given?
- @admin.deleteTable(org.apache.hadoop.hbase.TableName.valueOf(table_name))
-
- yield 'Creating table with region boundaries...' if block_given?
- @admin.createTable(table_description, splits)
- else
- raise e
- end
- end
- end
-
- #----------------------------------------------------------------------------------------------
- # Check the status of alter command (number of regions reopened)
- def alter_status(table_name)
- # Table name should be a string
- raise(ArgumentError, "Table name must be of type String") unless table_name.kind_of?(String)
-
- # Table should exist
- raise(ArgumentError, "Can't find a table: #{table_name}") unless exists?(table_name)
-
- status = Pair.new()
- begin
- status = @admin.getAlterStatus(org.apache.hadoop.hbase.TableName.valueOf(table_name))
- if status.getSecond() != 0
- puts "#{status.getSecond() - status.getFirst()}/#{status.getSecond()} regions updated."
- else
- puts "All regions updated."
- end
- sleep 1
- end while status != nil && status.getFirst() != 0
- puts "Done."
- end
-
- #----------------------------------------------------------------------------------------------
- # Change table structure or table options
- def alter(table_name, wait = true, *args)
- # Table name should be a string
- raise(ArgumentError, "Table name must be of type String") unless table_name.kind_of?(String)
-
- # Table should exist
- raise(ArgumentError, "Can't find a table: #{table_name}") unless exists?(table_name)
-
- # There should be at least one argument
- raise(ArgumentError, "There should be at least one argument but the table name") if args.empty?
-
- # Get table descriptor
- htd = @admin.getTableDescriptor(TableName.valueOf(table_name))
- hasTableUpdate = false
-
- # Process all args
- args.each do |arg|
-
-
- # Normalize args to support column name only alter specs
- arg = { NAME => arg } if arg.kind_of?(String)
-
- # Normalize args to support shortcut delete syntax
- arg = { METHOD => 'delete', NAME => arg['delete'] } if arg['delete']
-
- # There are 3 possible options.
- # 1) Column family spec. Distinguished by having a NAME and no METHOD.
- method = arg.delete(METHOD)
- if method == nil and arg.has_key?(NAME)
- descriptor = hcd(arg, htd)
- column_name = descriptor.getNameAsString
-
- # If column already exist, then try to alter it. Create otherwise.
- if htd.hasFamily(column_name.to_java_bytes)
- htd.modifyFamily(descriptor)
- else
- htd.addFamily(descriptor)
- end
- hasTableUpdate = true
- next
- end
-
- # 2) Method other than table_att, with some args.
- name = arg.delete(NAME)
- if method != nil and method != "table_att"
- # Delete column family
- if method == "delete"
- raise(ArgumentError, "NAME parameter missing for delete method") unless name
- htd.removeFamily(name.to_java_bytes)
- hasTableUpdate = true
- # Unset table attributes
- elsif method == "table_att_unset"
- raise(ArgumentError, "NAME parameter missing for table_att_unset method") unless name
- if name.kind_of?(Array)
- name.each do |key|
- if (htd.getValue(key) == nil)
- raise ArgumentError, "Could not find attribute: #{key}"
- end
- htd.remove(key)
- end
- else
- if (htd.getValue(name) == nil)
- raise ArgumentError, "Could not find attribute: #{name}"
- end
- htd.remove(name)
- end
- hasTableUpdate = true
- # Unknown method
- else
- raise ArgumentError, "Unknown method: #{method}"
- end
-
- arg.each_key do |unknown_key|
- puts("Unknown argument ignored: %s" % [unknown_key])
- end
-
- next
- end
-
- # 3) Some args for the table, optionally with METHOD => table_att (deprecated)
- raise(ArgumentError, "NAME argument in an unexpected place") if name
- htd.setOwnerString(arg.delete(OWNER)) if arg[OWNER]
- htd.setMaxFileSize(JLong.valueOf(arg.delete(MAX_FILESIZE))) if arg[MAX_FILESIZE]
- htd.setReadOnly(JBoolean.valueOf(arg.delete(READONLY))) if arg[READONLY]
- htd.setCompactionEnabled(JBoolean.valueOf(arg[COMPACTION_ENABLED])) if arg[COMPACTION_ENABLED]
- parse_htd_args(htd, arg)
- htd.setMemStoreFlushSize(JLong.valueOf(arg.delete(MEMSTORE_FLUSHSIZE))) if arg[MEMSTORE_FLUSHSIZE]
- # DEFERRED_LOG_FLUSH is deprecated and was replaced by DURABILITY. To keep backward compatible, it still exists.
- # However, it has to be set before DURABILITY so that DURABILITY could overwrite if both args are set
- if arg.include?(DEFERRED_LOG_FLUSH)
- if arg.delete(DEFERRED_LOG_FLUSH).to_s.upcase == "TRUE"
- htd.setDurability(org.apache.hadoop.hbase.client.Durability.valueOf("ASYNC_WAL"))
- else
- htd.setDurability(org.apache.hadoop.hbase.client.Durability.valueOf("SYNC_WAL"))
- end
- end
- htd.setDurability(org.apache.hadoop.hbase.client.Durability.valueOf(arg.delete(DURABILITY))) if arg[DURABILITY]
- htd.setRegionReplication(JInteger.valueOf(arg.delete(REGION_REPLICATION))) if arg[REGION_REPLICATION]
- set_user_metadata(htd, arg.delete(METADATA)) if arg[METADATA]
- set_descriptor_config(htd, arg.delete(CONFIGURATION)) if arg[CONFIGURATION]
-
- # set a coprocessor attribute
- valid_coproc_keys = []
- if arg.kind_of?(Hash)
- arg.each do |key, value|
- k = String.new(key) # prepare to strip
- k.strip!
-
- if (k =~ /coprocessor/i)
- v = String.new(value)
- v.strip!
- htd.addCoprocessorWithSpec(v)
- valid_coproc_keys << key
- end
- end
-
- valid_coproc_keys.each do |key|
- arg.delete(key)
- end
-
- hasTableUpdate = true
-
- arg.each_key do |unknown_key|
- puts("Unknown argument ignored: %s" % [unknown_key])
- end
-
- next
- end
- end
-
- # Bulk apply all table modifications.
- if hasTableUpdate
- @admin.modifyTable(table_name, htd)
-
- if wait == true
- puts "Updating all regions with the new schema..."
- alter_status(table_name)
- end
- end
- end
-
- def status(format, type)
- status = @admin.getClusterStatus()
- if format == "detailed"
- puts("version %s" % [ status.getHBaseVersion() ])
- # Put regions in transition first because usually empty
- puts("%d regionsInTransition" % status.getRegionsInTransition().size())
- for k, v in status.getRegionsInTransition()
- puts(" %s" % [v])
- end
- master = status.getMaster()
- puts("active master: %s:%d %d" % [master.getHostname(), master.getPort(), master.getStartcode()])
- puts("%d backup masters" % [ status.getBackupMastersSize() ])
- for server in status.getBackupMasters()
- puts(" %s:%d %d" % \
- [ server.getHostname(), server.getPort(), server.getStartcode() ])
- end
-
- master_coprocs = java.util.Arrays.toString(@admin.getMasterCoprocessors())
- if master_coprocs != nil
- puts("master coprocessors: %s" % master_coprocs)
- end
- puts("%d live servers" % [ status.getServersSize() ])
- for server in status.getServers()
- puts(" %s:%d %d" % \
- [ server.getHostname(), server.getPort(), server.getStartcode() ])
- puts(" %s" % [ status.getLoad(server).toString() ])
- for name, region in status.getLoad(server).getRegionsLoad()
- puts(" %s" % [ region.getNameAsString().dump ])
- puts(" %s" % [ region.toString() ])
- end
- end
- puts("%d dead servers" % [ status.getDeadServers() ])
- for server in status.getDeadServerNames()
- puts(" %s" % [ server ])
- end
- elsif format == "replication"
- #check whether replication is enabled or not
- if (!@admin.getConfiguration().getBoolean(org.apache.hadoop.hbase.HConstants::REPLICATION_ENABLE_KEY,
- org.apache.hadoop.hbase.HConstants::REPLICATION_ENABLE_DEFAULT))
- puts("Please enable replication first.")
- else
- puts("version %s" % [ status.getHBaseVersion() ])
- puts("%d live servers" % [ status.getServersSize() ])
- for server in status.getServers()
- sl = status.getLoad(server)
- rSinkString = " SINK :"
- rSourceString = " SOURCE:"
- rLoadSink = sl.getReplicationLoadSink()
- rSinkString << " AgeOfLastAppliedOp=" + rLoadSink.getAgeOfLastAppliedOp().to_s
- rSinkString << ", TimeStampsOfLastAppliedOp=" +
- (java.util.Date.new(rLoadSink.getTimeStampsOfLastAppliedOp())).toString()
- rLoadSourceList = sl.getReplicationLoadSourceList()
- index = 0
- while index < rLoadSourceList.size()
- rLoadSource = rLoadSourceList.get(index)
- rSourceString << " PeerID=" + rLoadSource.getPeerID()
- rSourceString << ", AgeOfLastShippedOp=" + rLoadSource.getAgeOfLastShippedOp().to_s
- rSourceString << ", SizeOfLogQueue=" + rLoadSource.getSizeOfLogQueue().to_s
- rSourceString << ", TimeStampsOfLastShippedOp=" +
- (java.util.Date.new(rLoadSource.getTimeStampOfLastShippedOp())).toString()
- rSourceString << ", Replication Lag=" + rLoadSource.getReplicationLag().to_s
- index = index + 1
- end
- puts(" %s:" %
- [ server.getHostname() ])
- if type.casecmp("SOURCE") == 0
- puts("%s" % rSourceString)
- elsif type.casecmp("SINK") == 0
- puts("%s" % rSinkString)
- else
- puts("%s" % rSourceString)
- puts("%s" % rSinkString)
- end
- end
- end
- elsif format == "simple"
- load = 0
- regions = 0
- master = status.getMaster()
- puts("active master: %s:%d %d" % [master.getHostname(), master.getPort(), master.getStartcode()])
- puts("%d backup masters" % [ status.getBackupMastersSize() ])
- for server in status.getBackupMasters()
- puts(" %s:%d %d" % \
- [ server.getHostname(), server.getPort(), server.getStartcode() ])
- end
- puts("%d live servers" % [ status.getServersSize() ])
- for server in status.getServers()
- puts(" %s:%d %d" % \
- [ server.getHostname(), server.getPort(), server.getStartcode() ])
- puts(" %s" % [ status.getLoad(server).toString() ])
- load += status.getLoad(server).getNumberOfRequests()
- regions += status.getLoad(server).getNumberOfRegions()
- end
- puts("%d dead servers" % [ status.getDeadServers() ])
- for server in status.getDeadServerNames()
- puts(" %s" % [ server ])
- end
- puts("Aggregate load: %d, regions: %d" % [ load , regions ] )
- else
- puts "1 active master, #{status.getBackupMastersSize} backup masters, #{status.getServersSize} servers, #{status.getDeadServers} dead, #{'%.4f' % status.getAverageLoad} average load"
- end
- end
-
- #----------------------------------------------------------------------------------------------
- #
- # Helper methods
- #
-
- # Does table exist?
- def exists?(table_name)
- @admin.tableExists(table_name)
- end
-
- #----------------------------------------------------------------------------------------------
- # Is table enabled
- def enabled?(table_name)
- @admin.isTableEnabled(table_name)
- end
-
- #----------------------------------------------------------------------------------------------
- #Is supplied region name is encoded region name
- def closeEncodedRegion?(region_name, server)
- @admin.closeRegionWithEncodedRegionName(region_name, server)
- end
-
- #----------------------------------------------------------------------------------------------
- # Return a new HColumnDescriptor made of passed args
- def hcd(arg, htd)
- # String arg, single parameter constructor
- return org.apache.hadoop.hbase.HColumnDescriptor.new(arg) if arg.kind_of?(String)
-
- raise(ArgumentError, "Column family #{arg} must have a name") unless name = arg.delete(NAME)
-
- family = htd.getFamily(name.to_java_bytes)
- # create it if it's a new family
- family ||= org.apache.hadoop.hbase.HColumnDescriptor.new(name.to_java_bytes)
-
- family.setBlockCacheEnabled(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::BLOCKCACHE))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::BLOCKCACHE)
- family.setScope(JInteger.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::REPLICATION_SCOPE))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::REPLICATION_SCOPE)
- family.setCacheDataOnWrite(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::CACHE_DATA_ON_WRITE))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::CACHE_DATA_ON_WRITE)
- family.setInMemory(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::IN_MEMORY))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::IN_MEMORY)
- family.setTimeToLive(JInteger.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::TTL))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::TTL)
- family.setDataBlockEncoding(org.apache.hadoop.hbase.io.encoding.DataBlockEncoding.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::DATA_BLOCK_ENCODING))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::DATA_BLOCK_ENCODING)
- family.setBlocksize(JInteger.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::BLOCKSIZE))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::BLOCKSIZE)
- family.setMaxVersions(JInteger.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::VERSIONS))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::VERSIONS)
- family.setMinVersions(JInteger.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::MIN_VERSIONS))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::MIN_VERSIONS)
- family.setKeepDeletedCells(org.apache.hadoop.hbase.KeepDeletedCells.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::KEEP_DELETED_CELLS).to_s.upcase)) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::KEEP_DELETED_CELLS)
- family.setCompressTags(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESS_TAGS))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESS_TAGS)
- family.setPrefetchBlocksOnOpen(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::PREFETCH_BLOCKS_ON_OPEN))) if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::PREFETCH_BLOCKS_ON_OPEN)
- family.setValue(COMPRESSION_COMPACT, arg.delete(COMPRESSION_COMPACT)) if arg.include?(COMPRESSION_COMPACT)
- if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::BLOOMFILTER)
- bloomtype = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::BLOOMFILTER).upcase
- unless org.apache.hadoop.hbase.regionserver.BloomType.constants.include?(bloomtype)
- raise(ArgumentError, "BloomFilter type #{bloomtype} is not supported. Use one of " + org.apache.hadoop.hbase.regionserver.StoreFile::BloomType.constants.join(" "))
- else
- family.setBloomFilterType(org.apache.hadoop.hbase.regionserver.BloomType.valueOf(bloomtype))
- end
- end
- if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION)
- compression = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::COMPRESSION).upcase
- unless org.apache.hadoop.hbase.io.compress.Compression::Algorithm.constants.include?(compression)
- raise(ArgumentError, "Compression #{compression} is not supported. Use one of " + org.apache.hadoop.hbase.io.compress.Compression::Algorithm.constants.join(" "))
- else
- family.setCompressionType(org.apache.hadoop.hbase.io.compress.Compression::Algorithm.valueOf(compression))
- end
- end
- if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::ENCRYPTION)
- algorithm = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::ENCRYPTION).upcase
- family.setEncryptionType(algorithm)
- if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::ENCRYPTION_KEY)
- key = org.apache.hadoop.hbase.io.crypto.Encryption.pbkdf128(
- arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::ENCRYPTION_KEY))
- family.setEncryptionKey(org.apache.hadoop.hbase.security.EncryptionUtil.wrapKey(@conf, key,
- algorithm))
- end
- end
-
- set_user_metadata(family, arg.delete(METADATA)) if arg[METADATA]
- set_descriptor_config(family, arg.delete(CONFIGURATION)) if arg[CONFIGURATION]
- family.setDFSReplication(JInteger.valueOf(arg.delete(org.apache.hadoop.hbase.
- HColumnDescriptor::DFS_REPLICATION))) if arg.include?(org.apache.hadoop.hbase.
- HColumnDescriptor::DFS_REPLICATION)
-
- arg.each_key do |unknown_key|
- puts("Unknown argument ignored for column family %s: %s" % [name, unknown_key])
- end
-
- return family
- end
-
- #----------------------------------------------------------------------------------------------
- # Enables/disables a region by name
- def online(region_name, on_off)
- # Open meta table
- meta = @connection.getTable(org.apache.hadoop.hbase.TableName::META_TABLE_NAME)
-
- # Read region info
- # FIXME: fail gracefully if can't find the region
- region_bytes = region_name.to_java_bytes
- g = org.apache.hadoop.hbase.client.Get.new(region_bytes)
- g.addColumn(org.apache.hadoop.hbase.HConstants::CATALOG_FAMILY, org.apache.hadoop.hbase.HConstants::REGIONINFO_QUALIFIER)
- hri_bytes = meta.get(g).value
-
- # Change region status
- hri = org.apache.hadoop.hbase.util.Writables.getWritable(hri_bytes, org.apache.hadoop.hbase.HRegionInfo.new)
- hri.setOffline(on_off)
-
- # Write it back
- put = org.apache.hadoop.hbase.client.Put.new(region_bytes)
- put.add(org.apache.hadoop.hbase.HConstants::CATALOG_FAMILY, org.apache.hadoop.hbase.HConstants::REGIONINFO_QUALIFIER, org.apache.hadoop.hbase.util.Writables.getBytes(hri))
- meta.put(put)
- end
- # Apply user metadata to table/column descriptor
- def set_user_metadata(descriptor, metadata)
- raise(ArgumentError, "#{METADATA} must be a Hash type") unless metadata.kind_of?(Hash)
- for k,v in metadata
- v = v.to_s unless v.nil?
- descriptor.setValue(k, v)
- end
- end
-
- #----------------------------------------------------------------------------------------------
- # Take a snapshot of specified table
- def snapshot(table, snapshot_name, *args)
- if args.empty?
- @admin.snapshot(snapshot_name.to_java_bytes, table.to_java_bytes)
- else
- args.each do |arg|
- if arg[SKIP_FLUSH] == true
- @admin.snapshot(snapshot_name.to_java_bytes, table.to_java_bytes, SnapshotDescription::Type::SKIPFLUSH)
- else
- @admin.snapshot(snapshot_name.to_java_bytes, table.to_java_bytes)
- end
- end
- end
- end
-
- #----------------------------------------------------------------------------------------------
- # Restore specified snapshot
- def restore_snapshot(snapshot_name)
- @admin.restoreSnapshot(snapshot_name.to_java_bytes)
- end
-
- #----------------------------------------------------------------------------------------------
- # Create a new table by cloning the snapshot content
- def clone_snapshot(snapshot_name, table)
- @admin.cloneSnapshot(snapshot_name.to_java_bytes, table.to_java_bytes)
- end
-
- #----------------------------------------------------------------------------------------------
- # Delete specified snapshot
- def delete_snapshot(snapshot_name)
- @admin.deleteSnapshot(snapshot_name.to_java_bytes)
- end
-
- #----------------------------------------------------------------------------------------------
- # Deletes the snapshots matching the given regex
- def delete_all_snapshot(regex)
- @admin.deleteSnapshots(regex).to_a
- end
-
- #----------------------------------------------------------------------------------------------
- # Deletes the table snapshots matching the given regex
- def delete_table_snapshots(tableNameRegex, snapshotNameRegex = ".*")
- @admin.deleteTableSnapshots(tableNameRegex, snapshotNameRegex).to_a
- end
-
- #----------------------------------------------------------------------------------------------
- # Returns a list of snapshots
- def list_snapshot(regex = ".*")
- @admin.listSnapshots(regex).to_a
- end
-
- #----------------------------------------------------------------------------------------------
- # Returns a list of table snapshots
- def list_table_snapshots(tableNameRegex, snapshotNameRegex = ".*")
- @admin.listTableSnapshots(tableNameRegex, snapshotNameRegex).to_a
- end
-
- # Apply config specific to a table/column to its descriptor
- def set_descriptor_config(descriptor, config)
- raise(ArgumentError, "#{CONFIGURATION} must be a Hash type") unless config.kind_of?(Hash)
- for k,v in config
- v = v.to_s unless v.nil?
- descriptor.setConfiguration(k, v)
- end
- end
-
- #----------------------------------------------------------------------------------------------
- # Updates the configuration of one regionserver.
- def update_config(serverName)
- @admin.updateConfiguration(ServerName.valueOf(serverName));
- end
-
- #----------------------------------------------------------------------------------------------
- # Updates the configuration of all the regionservers.
- def update_all_config()
- @admin.updateConfiguration();
- end
-
- #----------------------------------------------------------------------------------------------
- # Returns namespace's structure description
- def describe_namespace(namespace_name)
- namespace = @admin.getNamespaceDescriptor(namespace_name)
-
- unless namespace.nil?
- return namespace.to_s
- end
-
- raise(ArgumentError, "Failed to find namespace named #{namespace_name}")
- end
-
- #----------------------------------------------------------------------------------------------
- # Returns a list of namespaces in hbase
- def list_namespace(regex = ".*")
- pattern = java.util.regex.Pattern.compile(regex)
- list = @admin.listNamespaceDescriptors.map { |ns| ns.getName }
- list.select {|s| pattern.match(s) }
- end
-
- #----------------------------------------------------------------------------------------------
- # Returns a list of tables in namespace
- def list_namespace_tables(namespace_name)
- unless namespace_name.nil?
- return @admin.listTableNamesByNamespace(namespace_name).map { |t| t.getQualifierAsString() }
- end
-
- raise(ArgumentError, "Failed to find namespace named #{namespace_name}")
- end
-
- #----------------------------------------------------------------------------------------------
- # Creates a namespace
- def create_namespace(namespace_name, *args)
- # Fail if table name is not a string
- raise(ArgumentError, "Namespace name must be of type String") unless namespace_name.kind_of?(String)
-
- # Flatten params array
- args = args.flatten.compact
-
- # Start defining the table
- nsb = org.apache.hadoop.hbase.NamespaceDescriptor::create(namespace_name)
- args.each do |arg|
- unless arg.kind_of?(Hash)
- raise(ArgumentError, "#{arg.class} of #{arg.inspect} is not of Hash or String type")
- end
- for k,v in arg
- v = v.to_s unless v.nil?
- nsb.addConfiguration(k, v)
- end
- end
- @admin.createNamespace(nsb.build());
- end
-
- #----------------------------------------------------------------------------------------------
- # modify a namespace
- def alter_namespace(namespace_name, *args)
- # Fail if table name is not a string
- raise(ArgumentError, "Namespace name must be of type String") unless namespace_name.kind_of?(String)
-
- nsd = @admin.getNamespaceDescriptor(namespace_name)
-
- unless nsd
- raise(ArgumentError, "Namespace does not exist")
- end
- nsb = org.apache.hadoop.hbase.NamespaceDescriptor::create(nsd)
-
- # Flatten params array
- args = args.flatten.compact
-
- # Start defining the table
- args.each do |arg|
- unless arg.kind_of?(Hash)
- raise(ArgumentError, "#{arg.class} of #{arg.inspect} is not of Hash type")
- end
- method = arg[METHOD]
- if method == "unset"
- nsb.removeConfiguration(arg[NAME])
- elsif method == "set"
- arg.delete(METHOD)
- for k,v in arg
- v = v.to_s unless v.nil?
-
- nsb.addConfiguration(k, v)
- end
- else
- raise(ArgumentError, "Unknown method #{method}")
- end
- end
- @admin.modifyNamespace(nsb.build());
- end
-
-
- #----------------------------------------------------------------------------------------------
- # Drops a table
- def drop_namespace(namespace_name)
- @admin.deleteNamespace(namespace_name)
- end
-
- #----------------------------------------------------------------------------------------------
- # Get security capabilities
- def get_security_capabilities
- @admin.getSecurityCapabilities
- end
-
- # Abort a procedure
- def abort_procedure?(proc_id, may_interrupt_if_running=nil)
- if may_interrupt_if_running.nil?
- @admin.abortProcedure(proc_id, true)
- else
- @admin.abortProcedure(proc_id, may_interrupt_if_running)
- end
- end
-
- # List all procedures
- def list_procedures()
- @admin.listProcedures()
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/hbase/hbase.rb b/quickstart/thirdparty/ruby/hbase/hbase.rb
deleted file mode 100644
index e7c2f020..00000000
--- a/quickstart/thirdparty/ruby/hbase/hbase.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include Java
-
-require 'hbase/admin'
-require 'hbase/table'
-require 'hbase/quotas'
-require 'hbase/security'
-require 'hbase/visibility_labels'
-
-module Hbase
- class Hbase
- attr_accessor :configuration
-
- def initialize(config = nil)
- # Create configuration
- if config
- self.configuration = config
- else
- self.configuration = org.apache.hadoop.hbase.HBaseConfiguration.create
- # Turn off retries in hbase and ipc. Human doesn't want to wait on N retries.
- configuration.setInt("hbase.client.retries.number", 7)
- configuration.setInt("hbase.ipc.client.connect.max.retries", 3)
- end
- @connection = org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(
- self.configuration)
-
- at_exit do # LV3 -- Make sure the connection is closed
- shutdown # LV3 -- ideally we'd call shutdown, but it gives a lot of logging now.
-# Kernel.exit!(0) # LV3 -- close and ignore threads
- end # LV3
-
- end
-
- def admin(formatter)
- ::Hbase::Admin.new(@connection.getAdmin, formatter)
- end
-
- # Create new one each time
- def table(table, shell)
- ::Hbase::Table.new(@connection.getTable(table), shell)
- end
-
- def replication_admin(formatter)
- ::Hbase::RepAdmin.new(configuration, formatter)
- end
-
- def security_admin(formatter)
- ::Hbase::SecurityAdmin.new(@connection.getAdmin, formatter)
- end
-
- def visibility_labels_admin(formatter)
- ::Hbase::VisibilityLabelsAdmin.new(@connection.getAdmin, formatter)
- end
-
- def quotas_admin(formatter)
- ::Hbase::QuotasAdmin.new(@connection.getAdmin, formatter)
- end
-
- def shutdown
- @connection.close
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/hbase/quotas.rb b/quickstart/thirdparty/ruby/hbase/quotas.rb
deleted file mode 100644
index 0be428de..00000000
--- a/quickstart/thirdparty/ruby/hbase/quotas.rb
+++ /dev/null
@@ -1,219 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include Java
-java_import java.util.concurrent.TimeUnit
-java_import org.apache.hadoop.hbase.TableName
-java_import org.apache.hadoop.hbase.quotas.ThrottleType
-java_import org.apache.hadoop.hbase.quotas.QuotaFilter
-java_import org.apache.hadoop.hbase.quotas.QuotaRetriever
-java_import org.apache.hadoop.hbase.quotas.QuotaSettingsFactory
-
-module HBaseQuotasConstants
- GLOBAL_BYPASS = 'GLOBAL_BYPASS'
- THROTTLE_TYPE = 'THROTTLE_TYPE'
- THROTTLE = 'THROTTLE'
- REQUEST = 'REQUEST'
- WRITE = 'WRITE'
- READ = 'READ'
-end
-
-module Hbase
- class QuotasAdmin
- def initialize(admin, formatter)
- @admin = admin
- @formatter = formatter
- end
-
- def close
- @admin.close
- end
-
- def throttle(args)
- raise(ArgumentError, "Arguments should be a Hash") unless args.kind_of?(Hash)
- type = args.fetch(THROTTLE_TYPE, REQUEST)
- args.delete(THROTTLE_TYPE)
- type, limit, time_unit = _parse_limit(args.delete(LIMIT), ThrottleType, type)
- if args.has_key?(USER)
- user = args.delete(USER)
- if args.has_key?(TABLE)
- table = TableName.valueOf(args.delete(TABLE))
- raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty?
- settings = QuotaSettingsFactory.throttleUser(user, table, type, limit, time_unit)
- elsif args.has_key?(NAMESPACE)
- namespace = args.delete(NAMESPACE)
- raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty?
- settings = QuotaSettingsFactory.throttleUser(user, namespace, type, limit, time_unit)
- else
- raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty?
- settings = QuotaSettingsFactory.throttleUser(user, type, limit, time_unit)
- end
- elsif args.has_key?(TABLE)
- table = TableName.valueOf(args.delete(TABLE))
- raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty?
- settings = QuotaSettingsFactory.throttleTable(table, type, limit, time_unit)
- elsif args.has_key?(NAMESPACE)
- namespace = args.delete(NAMESPACE)
- raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty?
- settings = QuotaSettingsFactory.throttleNamespace(namespace, type, limit, time_unit)
- else
- raise "One of USER, TABLE or NAMESPACE must be specified"
- end
- @admin.setQuota(settings)
- end
-
- def unthrottle(args)
- raise(ArgumentError, "Arguments should be a Hash") unless args.kind_of?(Hash)
- if args.has_key?(USER)
- user = args.delete(USER)
- if args.has_key?(TABLE)
- table = TableName.valueOf(args.delete(TABLE))
- raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty?
- settings = QuotaSettingsFactory.unthrottleUser(user, table)
- elsif args.has_key?(NAMESPACE)
- namespace = args.delete(NAMESPACE)
- raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty?
- settings = QuotaSettingsFactory.unthrottleUser(user, namespace)
- else
- raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty?
- settings = QuotaSettingsFactory.unthrottleUser(user)
- end
- elsif args.has_key?(TABLE)
- table = TableName.valueOf(args.delete(TABLE))
- raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty?
- settings = QuotaSettingsFactory.unthrottleTable(table)
- elsif args.has_key?(NAMESPACE)
- namespace = args.delete(NAMESPACE)
- raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty?
- settings = QuotaSettingsFactory.unthrottleNamespace(namespace)
- else
- raise "One of USER, TABLE or NAMESPACE must be specified"
- end
- @admin.setQuota(settings)
- end
-
- def set_global_bypass(bypass, args)
- raise(ArgumentError, "Arguments should be a Hash") unless args.kind_of?(Hash)
-
- if args.has_key?(USER)
- user = args.delete(USER)
- raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty?
- settings = QuotaSettingsFactory.bypassGlobals(user, bypass)
- else
- raise "Expected USER"
- end
- @admin.setQuota(settings)
- end
-
- def list_quotas(args = {})
- raise(ArgumentError, "Arguments should be a Hash") unless args.kind_of?(Hash)
-
- limit = args.delete("LIMIT") || -1
- count = 0
-
- filter = QuotaFilter.new()
- filter.setUserFilter(args.delete(USER)) if args.has_key?(USER)
- filter.setTableFilter(args.delete(TABLE)) if args.has_key?(TABLE)
- filter.setNamespaceFilter(args.delete(NAMESPACE)) if args.has_key?(NAMESPACE)
- raise(ArgumentError, "Unexpected arguments: " + args.inspect) unless args.empty?
-
- # Start the scanner
- scanner = @admin.getQuotaRetriever(filter)
- begin
- iter = scanner.iterator
-
- # Iterate results
- while iter.hasNext
- if limit > 0 && count >= limit
- break
- end
-
- settings = iter.next
- owner = {
- USER => settings.getUserName(),
- TABLE => settings.getTableName(),
- NAMESPACE => settings.getNamespace(),
- }.delete_if { |k, v| v.nil? }.map {|k, v| k.to_s + " => " + v.to_s} * ', '
-
- yield owner, settings.to_s
-
- count += 1
- end
- ensure
- scanner.close()
- end
-
- return count
- end
-
- def _parse_size(str_limit)
- str_limit = str_limit.downcase
- match = /(\d+)([bkmgtp%]*)/.match(str_limit)
- if match
- if match[2] == '%'
- return match[1].to_i
- else
- return _size_from_str(match[1].to_i, match[2])
- end
- else
- raise "Invalid size limit syntax"
- end
- end
-
- def _parse_limit(str_limit, type_cls, type)
- str_limit = str_limit.downcase
- match = /(\d+)(req|[bkmgtp])\/(sec|min|hour|day)/.match(str_limit)
- if match
- if match[2] == 'req'
- limit = match[1].to_i
- type = type_cls.valueOf(type + "_NUMBER")
- else
- limit = _size_from_str(match[1].to_i, match[2])
- type = type_cls.valueOf(type + "_SIZE")
- end
-
- if limit <= 0
- raise "Invalid throttle limit, must be greater then 0"
- end
-
- case match[3]
- when 'sec' then time_unit = TimeUnit::SECONDS
- when 'min' then time_unit = TimeUnit::MINUTES
- when 'hour' then time_unit = TimeUnit::HOURS
- when 'day' then time_unit = TimeUnit::DAYS
- end
-
- return type, limit, time_unit
- else
- raise "Invalid throttle limit syntax"
- end
- end
-
- def _size_from_str(value, suffix)
- case suffix
- when 'k' then value <<= 10
- when 'm' then value <<= 20
- when 'g' then value <<= 30
- when 't' then value <<= 40
- when 'p' then value <<= 50
- end
- return value
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/hbase/replication_admin.rb b/quickstart/thirdparty/ruby/hbase/replication_admin.rb
deleted file mode 100644
index 1c64f096..00000000
--- a/quickstart/thirdparty/ruby/hbase/replication_admin.rb
+++ /dev/null
@@ -1,182 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include Java
-
-java_import org.apache.hadoop.hbase.client.replication.ReplicationAdmin
-java_import org.apache.hadoop.hbase.replication.ReplicationPeerConfig
-java_import org.apache.hadoop.hbase.util.Bytes
-java_import org.apache.hadoop.hbase.zookeeper.ZKConfig
-java_import org.apache.hadoop.hbase.TableName
-
-# Wrapper for org.apache.hadoop.hbase.client.replication.ReplicationAdmin
-
-module Hbase
- class RepAdmin
- include HBaseConstants
-
- def initialize(configuration, formatter)
- @replication_admin = ReplicationAdmin.new(configuration)
- @configuration = configuration
- @formatter = formatter
- end
-
- #----------------------------------------------------------------------------------------------
- # Add a new peer cluster to replicate to
- def add_peer(id, args = {}, peer_tableCFs = nil)
- # make add_peer backwards compatible to take in string for clusterKey and peer_tableCFs
- if args.is_a?(String)
- cluster_key = args
- @replication_admin.addPeer(id, cluster_key, peer_tableCFs)
- elsif args.is_a?(Hash)
- unless peer_tableCFs.nil?
- raise(ArgumentError, "peer_tableCFs should be specified as TABLE_CFS in args")
- end
-
- endpoint_classname = args.fetch(ENDPOINT_CLASSNAME, nil)
- cluster_key = args.fetch(CLUSTER_KEY, nil)
-
- # Handle cases where custom replication endpoint and cluster key are either both provided
- # or neither are provided
- if endpoint_classname.nil? and cluster_key.nil?
- raise(ArgumentError, "Either ENDPOINT_CLASSNAME or CLUSTER_KEY must be specified.")
- elsif !endpoint_classname.nil? and !cluster_key.nil?
- raise(ArgumentError, "ENDPOINT_CLASSNAME and CLUSTER_KEY cannot both be specified.")
- end
-
- # Cluster Key is required for ReplicationPeerConfig for a custom replication endpoint
- if !endpoint_classname.nil? and cluster_key.nil?
- cluster_key = ZKConfig.getZooKeeperClusterKey(@configuration)
- end
-
- # Optional parameters
- config = args.fetch(CONFIG, nil)
- data = args.fetch(DATA, nil)
- table_cfs = args.fetch(TABLE_CFS, nil)
-
- # Create and populate a ReplicationPeerConfig
- replication_peer_config = ReplicationPeerConfig.new
- replication_peer_config.set_cluster_key(cluster_key)
-
- unless endpoint_classname.nil?
- replication_peer_config.set_replication_endpoint_impl(endpoint_classname)
- end
-
- unless config.nil?
- replication_peer_config.get_configuration.put_all(config)
- end
-
- unless data.nil?
- # Convert Strings to Bytes for peer_data
- peer_data = replication_peer_config.get_peer_data
- data.each{|key, val|
- peer_data.put(Bytes.to_bytes(key), Bytes.to_bytes(val))
- }
- end
-
- @replication_admin.add_peer(id, replication_peer_config, table_cfs)
- else
- raise(ArgumentError, "args must be either a String or Hash")
- end
- end
-
- #----------------------------------------------------------------------------------------------
- # Remove a peer cluster, stops the replication
- def remove_peer(id)
- @replication_admin.removePeer(id)
- end
-
-
- #---------------------------------------------------------------------------------------------
- # Show replcated tables/column families, and their ReplicationType
- def list_replicated_tables(regex = ".*")
- pattern = java.util.regex.Pattern.compile(regex)
- list = @replication_admin.listReplicated()
- list.select {|s| pattern.match(s.get(ReplicationAdmin::TNAME))}
- end
-
- #----------------------------------------------------------------------------------------------
- # List all peer clusters
- def list_peers
- @replication_admin.listPeers
- end
-
- #----------------------------------------------------------------------------------------------
- # Get peer cluster state
- def get_peer_state(id)
- @replication_admin.getPeerState(id) ? "ENABLED" : "DISABLED"
- end
-
- #----------------------------------------------------------------------------------------------
- # Restart the replication stream to the specified peer
- def enable_peer(id)
- @replication_admin.enablePeer(id)
- end
-
- #----------------------------------------------------------------------------------------------
- # Stop the replication stream to the specified peer
- def disable_peer(id)
- @replication_admin.disablePeer(id)
- end
-
- #----------------------------------------------------------------------------------------------
- # Show the current tableCFs config for the specified peer
- def show_peer_tableCFs(id)
- @replication_admin.getPeerTableCFs(id)
- end
-
- #----------------------------------------------------------------------------------------------
- # Set new tableCFs config for the specified peer
- def set_peer_tableCFs(id, tableCFs)
- @replication_admin.setPeerTableCFs(id, tableCFs)
- end
-
- #----------------------------------------------------------------------------------------------
- # Append a tableCFs config for the specified peer
- def append_peer_tableCFs(id, tableCFs)
- @replication_admin.appendPeerTableCFs(id, tableCFs)
- end
-
- #----------------------------------------------------------------------------------------------
- # Remove some tableCFs from the tableCFs config of the specified peer
- def remove_peer_tableCFs(id, tableCFs)
- @replication_admin.removePeerTableCFs(id, tableCFs)
- end
- #----------------------------------------------------------------------------------------------
- # Enables a table's replication switch
- def enable_tablerep(table_name)
- tableName = TableName.valueOf(table_name)
- @replication_admin.enableTableRep(tableName)
- end
- #----------------------------------------------------------------------------------------------
- # Disables a table's replication switch
- def disable_tablerep(table_name)
- tableName = TableName.valueOf(table_name)
- @replication_admin.disableTableRep(tableName)
- end
-
- def list_peer_configs
- @replication_admin.list_peer_configs
- end
-
- def get_peer_config(id)
- @replication_admin.get_peer_config(id)
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/hbase/security.rb b/quickstart/thirdparty/ruby/hbase/security.rb
deleted file mode 100644
index aef23094..00000000
--- a/quickstart/thirdparty/ruby/hbase/security.rb
+++ /dev/null
@@ -1,201 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include Java
-
-# Wrapper for org.apache.hadoop.hbase.client.HBaseAdmin
-
-module Hbase
- class SecurityAdmin
- include HBaseConstants
-
- def initialize(admin, formatter)
- @admin = admin
- @connection = @admin.getConnection()
- @formatter = formatter
- end
-
- def close
- @admin.close
- end
-
- #----------------------------------------------------------------------------------------------
- def grant(user, permissions, table_name=nil, family=nil, qualifier=nil)
- security_available?
-
- # TODO: need to validate user name
-
- begin
- # Verify that the specified permission is valid
- if (permissions == nil || permissions.length == 0)
- raise(ArgumentError, "Invalid permission: no actions associated with user")
- end
-
- perm = org.apache.hadoop.hbase.security.access.Permission.new(
- permissions.to_java_bytes)
-
- if (table_name != nil)
- tablebytes=table_name.to_java_bytes
- #check if the tablename passed is actually a namespace
- if (isNamespace?(table_name))
- # Namespace should exist first.
- namespace_name = table_name[1...table_name.length]
- raise(ArgumentError, "Can't find a namespace: #{namespace_name}") unless
- namespace_exists?(namespace_name)
-
- org.apache.hadoop.hbase.security.access.AccessControlClient.grant(
- @connection, namespace_name, user, perm.getActions())
- else
- # Table should exist
- raise(ArgumentError, "Can't find a table: #{table_name}") unless exists?(table_name)
-
- tableName = org.apache.hadoop.hbase.TableName.valueOf(table_name.to_java_bytes)
- htd = @admin.getTableDescriptor(tableName)
-
- if (family != nil)
- raise(ArgumentError, "Can't find a family: #{family}") unless htd.hasFamily(family.to_java_bytes)
- end
-
- fambytes = family.to_java_bytes if (family != nil)
- qualbytes = qualifier.to_java_bytes if (qualifier != nil)
-
- org.apache.hadoop.hbase.security.access.AccessControlClient.grant(
- @connection, tableName, user, fambytes, qualbytes, perm.getActions())
- end
- else
- # invoke cp endpoint to perform access controls
- org.apache.hadoop.hbase.security.access.AccessControlClient.grant(
- @connection, user, perm.getActions())
- end
- end
- end
-
- #----------------------------------------------------------------------------------------------
- def revoke(user, table_name=nil, family=nil, qualifier=nil)
- security_available?
-
- # TODO: need to validate user name
-
- begin
- if (table_name != nil)
- #check if the tablename passed is actually a namespace
- if (isNamespace?(table_name))
- # Namespace should exist first.
- namespace_name = table_name[1...table_name.length]
- raise(ArgumentError, "Can't find a namespace: #{namespace_name}") unless namespace_exists?(namespace_name)
-
- tablebytes=table_name.to_java_bytes
- org.apache.hadoop.hbase.security.access.AccessControlClient.revoke(
- @connection, namespace_name, user)
- else
- # Table should exist
- raise(ArgumentError, "Can't find a table: #{table_name}") unless exists?(table_name)
-
- tableName = org.apache.hadoop.hbase.TableName.valueOf(table_name.to_java_bytes)
- htd = @admin.getTableDescriptor(tableName)
-
- if (family != nil)
- raise(ArgumentError, "Can't find a family: #{family}") unless htd.hasFamily(family.to_java_bytes)
- end
-
- fambytes = family.to_java_bytes if (family != nil)
- qualbytes = qualifier.to_java_bytes if (qualifier != nil)
-
- org.apache.hadoop.hbase.security.access.AccessControlClient.revoke(
- @connection, tableName, user, fambytes, qualbytes)
- end
- else
- perm = org.apache.hadoop.hbase.security.access.Permission.new(''.to_java_bytes)
- org.apache.hadoop.hbase.security.access.AccessControlClient.revoke(
- @connection, user, perm.getActions())
- end
- end
- end
-
- #----------------------------------------------------------------------------------------------
- def user_permission(table_regex=nil)
- security_available?
- all_perms = org.apache.hadoop.hbase.security.access.AccessControlClient.getUserPermissions(
- @connection,table_regex)
- res = {}
- count = 0
- all_perms.each do |value|
- user_name = String.from_java_bytes(value.getUser)
- if (table_regex != nil && isNamespace?(table_regex))
- namespace = value.getNamespace()
- else
- namespace = (value.getTableName != nil) ? value.getTableName.getNamespaceAsString() : value.getNamespace()
- end
- table = (value.getTableName != nil) ? value.getTableName.getNameAsString() : ''
- family = (value.getFamily != nil) ?
- org.apache.hadoop.hbase.util.Bytes::toStringBinary(value.getFamily) :
- ''
- qualifier = (value.getQualifier != nil) ?
- org.apache.hadoop.hbase.util.Bytes::toStringBinary(value.getQualifier) :
- ''
-
- action = org.apache.hadoop.hbase.security.access.Permission.new value.getActions
-
- if block_given?
- yield(user_name, "#{namespace},#{table},#{family},#{qualifier}: #{action.to_s}")
- else
- res[user_name] ||= {}
- res[user_name][family + ":" +qualifier] = action
- end
- count += 1
- end
-
- return ((block_given?) ? count : res)
- end
-
- # Does table exist?
- def exists?(table_name)
- @admin.tableExists(table_name)
- end
-
- def isNamespace?(table_name)
- table_name.start_with?('@')
- end
-
- # Does Namespace exist
- def namespace_exists?(namespace_name)
- return @admin.getNamespaceDescriptor(namespace_name) != nil
- rescue org.apache.hadoop.hbase.NamespaceNotFoundException => e
- return false
- end
-
- # Make sure that security features are available
- def security_available?()
- caps = []
- begin
- # Try the getSecurityCapabilities API where supported.
- # We only need to look at AUTHORIZATION, the AccessController doesn't support
- # CELL_AUTHORIZATION without AUTHORIZATION also available.
- caps = @admin.getSecurityCapabilities
- rescue
- # If we are unable to use getSecurityCapabilities, fall back with a check for
- # deployment of the ACL table
- raise(ArgumentError, "DISABLED: Security features are not available") unless \
- exists?(org.apache.hadoop.hbase.security.access.AccessControlLists::ACL_TABLE_NAME)
- return
- end
- raise(ArgumentError, "DISABLED: Security features are not available") unless \
- caps.include? org.apache.hadoop.hbase.client.security.SecurityCapability::AUTHORIZATION
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/hbase/table.rb b/quickstart/thirdparty/ruby/hbase/table.rb
deleted file mode 100644
index 9ebe9ad7..00000000
--- a/quickstart/thirdparty/ruby/hbase/table.rb
+++ /dev/null
@@ -1,717 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include Java
-
-# Wrapper for org.apache.hadoop.hbase.client.Table
-
-module Hbase
- class Table
- include HBaseConstants
-
- @@thread_pool = nil
-
- # Add the command 'name' to table s.t. the shell command also called via 'name'
- # and has an internal method also called 'name'.
- #
- # e.g. name = scan, adds table.scan which calls Scan.scan
- def self.add_shell_command(name)
- self.add_command(name, name, name)
- end
-
- # add a named command to the table instance
- #
- # name - name of the command that should added to the table
- # (eg. sending 'scan' here would allow you to do table.scan)
- # shell_command - name of the command in the shell
- # internal_method_name - name of the method in the shell command to forward the call
- def self.add_command(name, shell_command, internal_method_name)
- method = name.to_sym
- self.class_eval do
- define_method method do |*args|
- @shell.internal_command(shell_command, internal_method_name, self, *args)
- end
- end
- end
-
- # General help for the table
- # class level so we can call it from anywhere
- def self.help
- return <<-EOF
-Help for table-reference commands.
-
-You can either create a table via 'create' and then manipulate the table via commands like 'put', 'get', etc.
-See the standard help information for how to use each of these commands.
-
-However, as of 0.96, you can also get a reference to a table, on which you can invoke commands.
-For instance, you can get create a table and keep around a reference to it via:
-
- hbase> t = create 't', 'cf'
-
-Or, if you have already created the table, you can get a reference to it:
-
- hbase> t = get_table 't'
-
-You can do things like call 'put' on the table:
-
- hbase> t.put 'r', 'cf:q', 'v'
-
-which puts a row 'r' with column family 'cf', qualifier 'q' and value 'v' into table t.
-
-To read the data out, you can scan the table:
-
- hbase> t.scan
-
-which will read all the rows in table 't'.
-
-Essentially, any command that takes a table name can also be done via table reference.
-Other commands include things like: get, delete, deleteall,
-get_all_columns, get_counter, count, incr. These functions, along with
-the standard JRuby object methods are also available via tab completion.
-
-For more information on how to use each of these commands, you can also just type:
-
- hbase> t.help 'scan'
-
-which will output more information on how to use that command.
-
-You can also do general admin actions directly on a table; things like enable, disable,
-flush and drop just by typing:
-
- hbase> t.enable
- hbase> t.flush
- hbase> t.disable
- hbase> t.drop
-
-Note that after dropping a table, your reference to it becomes useless and further usage
-is undefined (and not recommended).
-EOF
- end
-
- #---------------------------------------------------------------------------------------------
-
- # let external objects read the underlying table object
- attr_reader :table
- # let external objects read the table name
- attr_reader :name
-
- def initialize(table, shell)
- @table = table
- @name = @table.getName().getNameAsString()
- @shell = shell
- @converters = Hash.new()
- end
-
- def close()
- @table.close()
- end
-
- # Note the below methods are prefixed with '_' to hide them from the average user, as
- # they will be much less likely to tab complete to the 'dangerous' internal method
- #----------------------------------------------------------------------------------------------
-
- # Put a cell 'value' at specified table/row/column
- def _put_internal(row, column, value, timestamp = nil, args = {})
- p = org.apache.hadoop.hbase.client.Put.new(row.to_s.to_java_bytes)
- family, qualifier = parse_column_name(column)
- if args.any?
- attributes = args[ATTRIBUTES]
- set_attributes(p, attributes) if attributes
- visibility = args[VISIBILITY]
- set_cell_visibility(p, visibility) if visibility
- ttl = args[TTL]
- set_op_ttl(p, ttl) if ttl
- end
- #Case where attributes are specified without timestamp
- if timestamp.kind_of?(Hash)
- timestamp.each do |k, v|
- if k == 'ATTRIBUTES'
- set_attributes(p, v)
- elsif k == 'VISIBILITY'
- set_cell_visibility(p, v)
- elsif k == "TTL"
- set_op_ttl(p, v)
- end
- end
- timestamp = nil
- end
- if timestamp
- p.add(family, qualifier, timestamp, value.to_s.to_java_bytes)
- else
- p.add(family, qualifier, value.to_s.to_java_bytes)
- end
- @table.put(p)
- end
-
- #----------------------------------------------------------------------------------------------
- # Delete a cell
- def _delete_internal(row, column,
- timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
- _deleteall_internal(row, column, timestamp, args)
- end
-
- #----------------------------------------------------------------------------------------------
- # Delete a row
- def _deleteall_internal(row, column = nil,
- timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
- # delete operation doesn't need read permission. Retaining the read check for
- # meta table as a part of HBASE-5837.
- if is_meta_table?
- raise ArgumentError, "Row Not Found" if _get_internal(row).nil?
- end
- temptimestamp = timestamp
- if temptimestamp.kind_of?(Hash)
- timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP
- end
- d = org.apache.hadoop.hbase.client.Delete.new(row.to_s.to_java_bytes, timestamp)
- if temptimestamp.kind_of?(Hash)
- temptimestamp.each do |k, v|
- if v.kind_of?(String)
- set_cell_visibility(d, v) if v
- end
- end
- end
- if args.any?
- visibility = args[VISIBILITY]
- set_cell_visibility(d, visibility) if visibility
- end
- if column
- family, qualifier = parse_column_name(column)
- d.deleteColumns(family, qualifier, timestamp)
- end
- @table.delete(d)
- end
-
- #----------------------------------------------------------------------------------------------
- # Increment a counter atomically
- def _incr_internal(row, column, value = nil, args={})
- if value.kind_of?(Hash)
- value = 1
- end
- value ||= 1
- incr = org.apache.hadoop.hbase.client.Increment.new(row.to_s.to_java_bytes)
- family, qualifier = parse_column_name(column)
- if qualifier.nil?
- raise ArgumentError, "Failed to provide both column family and column qualifier for incr"
- end
- if args.any?
- attributes = args[ATTRIBUTES]
- visibility = args[VISIBILITY]
- set_attributes(incr, attributes) if attributes
- set_cell_visibility(incr, visibility) if visibility
- ttl = args[TTL]
- set_op_ttl(incr, ttl) if ttl
- end
- incr.addColumn(family, qualifier, value)
- result = @table.increment(incr)
- return nil if result.isEmpty
-
- # Fetch cell value
- cell = result.listCells[0]
- org.apache.hadoop.hbase.util.Bytes::toLong(cell.getValue)
- end
-
- #----------------------------------------------------------------------------------------------
- # appends the value atomically
- def _append_internal(row, column, value, args={})
- append = org.apache.hadoop.hbase.client.Append.new(row.to_s.to_java_bytes)
- family, qualifier = parse_column_name(column)
- if qualifier.nil?
- raise ArgumentError, "Failed to provide both column family and column qualifier for append"
- end
- if args.any?
- attributes = args[ATTRIBUTES]
- visibility = args[VISIBILITY]
- set_attributes(append, attributes) if attributes
- set_cell_visibility(append, visibility) if visibility
- ttl = args[TTL]
- set_op_ttl(append, ttl) if ttl
- end
- append.add(family, qualifier, value.to_s.to_java_bytes)
- @table.append(append)
- end
-
- #----------------------------------------------------------------------------------------------
- # Count rows in a table
- def _count_internal(interval = 1000, caching_rows = 10)
- # We can safely set scanner caching with the first key only filter
- scan = org.apache.hadoop.hbase.client.Scan.new
- scan.setCacheBlocks(false)
- scan.setCaching(caching_rows)
- scan.setFilter(org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter.new)
-
- # Run the scanner
- scanner = @table.getScanner(scan)
- count = 0
- iter = scanner.iterator
-
- # Iterate results
- while iter.hasNext
- row = iter.next
- count += 1
- next unless (block_given? && count % interval == 0)
- # Allow command modules to visualize counting process
- yield(count,
- org.apache.hadoop.hbase.util.Bytes::toStringBinary(row.getRow))
- end
-
- scanner.close()
- # Return the counter
- return count
- end
-
- #----------------------------------------------------------------------------------------------
- # Get from table
- def _get_internal(row, *args)
- get = org.apache.hadoop.hbase.client.Get.new(row.to_s.to_java_bytes)
- maxlength = -1
- count = 0
- @converters.clear()
-
- # Normalize args
- args = args.first if args.first.kind_of?(Hash)
- if args.kind_of?(String) || args.kind_of?(Array)
- columns = [ args ].flatten.compact
- args = { COLUMNS => columns }
- end
-
- #
- # Parse arguments
- #
- unless args.kind_of?(Hash)
- raise ArgumentError, "Failed parse of of #{args.inspect}, #{args.class}"
- end
-
- # Get maxlength parameter if passed
- maxlength = args.delete(MAXLENGTH) if args[MAXLENGTH]
- filter = args.delete(FILTER) if args[FILTER]
- attributes = args[ATTRIBUTES]
- authorizations = args[AUTHORIZATIONS]
- consistency = args.delete(CONSISTENCY) if args[CONSISTENCY]
- replicaId = args.delete(REGION_REPLICA_ID) if args[REGION_REPLICA_ID]
- unless args.empty?
- columns = args[COLUMN] || args[COLUMNS]
- if args[VERSIONS]
- vers = args[VERSIONS]
- else
- vers = 1
- end
- if columns
- # Normalize types, convert string to an array of strings
- columns = [ columns ] if columns.is_a?(String)
-
- # At this point it is either an array or some unsupported stuff
- unless columns.kind_of?(Array)
- raise ArgumentError, "Failed parse column argument type #{args.inspect}, #{args.class}"
- end
-
- # Get each column name and add it to the filter
- columns.each do |column|
- family, qualifier = parse_column_name(column.to_s)
- if qualifier
- get.addColumn(family, qualifier)
- else
- get.addFamily(family)
- end
- end
-
- # Additional params
- get.setMaxVersions(vers)
- get.setTimeStamp(args[TIMESTAMP]) if args[TIMESTAMP]
- get.setTimeRange(args[TIMERANGE][0], args[TIMERANGE][1]) if args[TIMERANGE]
- else
- if attributes
- set_attributes(get, attributes)
- elsif authorizations
- set_authorizations(get, authorizations)
- else
- # May have passed TIMESTAMP and row only; wants all columns from ts.
- unless ts = args[TIMESTAMP] || tr = args[TIMERANGE]
- raise ArgumentError, "Failed parse of #{args.inspect}, #{args.class}"
- end
- end
-
- get.setMaxVersions(vers)
- # Set the timestamp/timerange
- get.setTimeStamp(ts.to_i) if args[TIMESTAMP]
- get.setTimeRange(args[TIMERANGE][0], args[TIMERANGE][1]) if args[TIMERANGE]
- end
- set_attributes(get, attributes) if attributes
- set_authorizations(get, authorizations) if authorizations
- end
-
- unless filter.class == String
- get.setFilter(filter)
- else
- get.setFilter(
- org.apache.hadoop.hbase.filter.ParseFilter.new.parseFilterString(filter.to_java_bytes))
- end
-
- get.setConsistency(org.apache.hadoop.hbase.client.Consistency.valueOf(consistency)) if consistency
- get.setReplicaId(replicaId) if replicaId
-
- # Call hbase for the results
- result = @table.get(get)
- return nil if result.isEmpty
-
- # Get stale info from results
- is_stale = result.isStale
- count += 1
-
- # Print out results. Result can be Cell or RowResult.
- res = {}
- result.list.each do |kv|
- family = String.from_java_bytes(kv.getFamily)
- qualifier = org.apache.hadoop.hbase.util.Bytes::toStringBinary(kv.getQualifier)
-
- column = "#{family}:#{qualifier}"
- value = to_string(column, kv, maxlength)
-
- if block_given?
- yield(column, value)
- else
- res[column] = value
- end
- end
-
- # If block given, we've yielded all the results, otherwise just return them
- return ((block_given?) ? [count, is_stale]: res)
- end
-
- #----------------------------------------------------------------------------------------------
- # Fetches and decodes a counter value from hbase
- def _get_counter_internal(row, column)
- family, qualifier = parse_column_name(column.to_s)
- # Format get request
- get = org.apache.hadoop.hbase.client.Get.new(row.to_s.to_java_bytes)
- get.addColumn(family, qualifier)
- get.setMaxVersions(1)
-
- # Call hbase
- result = @table.get(get)
- return nil if result.isEmpty
-
- # Fetch cell value
- cell = result.list[0]
- org.apache.hadoop.hbase.util.Bytes::toLong(cell.getValue)
- end
-
- def _hash_to_scan(args)
- if args.any?
- enablemetrics = args["ALL_METRICS"].nil? ? false : args["ALL_METRICS"]
- enablemetrics = enablemetrics || !args["METRICS"].nil?
- filter = args["FILTER"]
- startrow = args["STARTROW"] || ''
- stoprow = args["STOPROW"]
- rowprefixfilter = args["ROWPREFIXFILTER"]
- timestamp = args["TIMESTAMP"]
- columns = args["COLUMNS"] || args["COLUMN"] || []
- # If CACHE_BLOCKS not set, then default 'true'.
- cache_blocks = args["CACHE_BLOCKS"].nil? ? true: args["CACHE_BLOCKS"]
- cache = args["CACHE"] || 0
- reversed = args["REVERSED"] || false
- versions = args["VERSIONS"] || 1
- timerange = args[TIMERANGE]
- raw = args["RAW"] || false
- attributes = args[ATTRIBUTES]
- authorizations = args[AUTHORIZATIONS]
- consistency = args[CONSISTENCY]
- # Normalize column names
- columns = [columns] if columns.class == String
- limit = args["LIMIT"] || -1
- unless columns.kind_of?(Array)
- raise ArgumentError.new("COLUMNS must be specified as a String or an Array")
- end
-
- scan = if stoprow
- org.apache.hadoop.hbase.client.Scan.new(startrow.to_java_bytes, stoprow.to_java_bytes)
- else
- org.apache.hadoop.hbase.client.Scan.new(startrow.to_java_bytes)
- end
-
- # This will overwrite any startrow/stoprow settings
- scan.setRowPrefixFilter(rowprefixfilter.to_java_bytes) if rowprefixfilter
-
- # Clear converters from last scan.
- @converters.clear()
-
- columns.each do |c|
- family, qualifier = parse_column_name(c.to_s)
- if qualifier
- scan.addColumn(family, qualifier)
- else
- scan.addFamily(family)
- end
- end
-
- unless filter.class == String
- scan.setFilter(filter)
- else
- scan.setFilter(
- org.apache.hadoop.hbase.filter.ParseFilter.new.parseFilterString(filter.to_java_bytes))
- end
-
- scan.setScanMetricsEnabled(enablemetrics) if enablemetrics
- scan.setTimeStamp(timestamp) if timestamp
- scan.setCacheBlocks(cache_blocks)
- scan.setReversed(reversed)
- scan.setCaching(cache) if cache > 0
- scan.setMaxVersions(versions) if versions > 1
- scan.setTimeRange(timerange[0], timerange[1]) if timerange
- scan.setRaw(raw)
- scan.setCaching(limit) if limit > 0
- set_attributes(scan, attributes) if attributes
- set_authorizations(scan, authorizations) if authorizations
- scan.setConsistency(org.apache.hadoop.hbase.client.Consistency.valueOf(consistency)) if consistency
- else
- scan = org.apache.hadoop.hbase.client.Scan.new
- end
-
- scan
- end
-
- def _get_scanner(args)
- @table.getScanner(_hash_to_scan(args))
- end
-
- #----------------------------------------------------------------------------------------------
- # Scans whole table or a range of keys and returns rows matching specific criteria
- def _scan_internal(args = {}, scan = nil)
- raise(ArgumentError, "Args should be a Hash") unless args.kind_of?(Hash)
- raise(ArgumentError, "Scan argument should be org.apache.hadoop.hbase.client.Scan") \
- unless scan == nil || scan.kind_of?(org.apache.hadoop.hbase.client.Scan)
-
- limit = args["LIMIT"] || -1
- maxlength = args.delete("MAXLENGTH") || -1
- count = 0
- res = {}
-
- # Start the scanner
- scan = scan == nil ? _hash_to_scan(args) : scan
- scanner = @table.getScanner(scan)
- iter = scanner.iterator
-
- # Iterate results
- while iter.hasNext
- row = iter.next
- key = org.apache.hadoop.hbase.util.Bytes::toStringBinary(row.getRow)
- is_stale |= row.isStale
-
- row.list.each do |kv|
- family = String.from_java_bytes(kv.getFamily)
- qualifier = org.apache.hadoop.hbase.util.Bytes::toStringBinary(kv.getQualifier)
-
- column = "#{family}:#{qualifier}"
- cell = to_string(column, kv, maxlength)
-
- if block_given?
- yield(key, "column=#{column}, #{cell}")
- else
- res[key] ||= {}
- res[key][column] = cell
- end
- end
-
- # One more row processed
- count += 1
- if limit > 0 && count >= limit
- # If we reached the limit, exit before the next call to hasNext
- break
- end
- end
-
- scanner.close()
- return ((block_given?) ? [count, is_stale] : res)
- end
-
- # Apply OperationAttributes to puts/scans/gets
- def set_attributes(oprattr, attributes)
- raise(ArgumentError, "Attributes must be a Hash type") unless attributes.kind_of?(Hash)
- for k,v in attributes
- v = v.to_s unless v.nil?
- oprattr.setAttribute(k.to_s, v.to_java_bytes)
- end
- end
-
- def set_cell_permissions(op, permissions)
- raise(ArgumentError, "Permissions must be a Hash type") unless permissions.kind_of?(Hash)
- map = java.util.HashMap.new
- permissions.each do |user,perms|
- map.put(user.to_s, org.apache.hadoop.hbase.security.access.Permission.new(
- perms.to_java_bytes))
- end
- op.setACL(map)
- end
-
- def set_cell_visibility(oprattr, visibility)
- oprattr.setCellVisibility(
- org.apache.hadoop.hbase.security.visibility.CellVisibility.new(
- visibility.to_s))
- end
-
- def set_authorizations(oprattr, authorizations)
- raise(ArgumentError, "Authorizations must be a Array type") unless authorizations.kind_of?(Array)
- auths = [ authorizations ].flatten.compact
- oprattr.setAuthorizations(
- org.apache.hadoop.hbase.security.visibility.Authorizations.new(
- auths.to_java(:string)))
- end
-
- def set_op_ttl(op, ttl)
- op.setTTL(ttl.to_java(:long))
- end
-
- #----------------------------
- # Add general administration utilities to the shell
- # each of the names below adds this method name to the table
- # by callling the corresponding method in the shell
- # Add single method utilities to the current class
- # Generally used for admin functions which just have one name and take the table name
- def self.add_admin_utils(*args)
- args.each do |method|
- define_method method do |*method_args|
- @shell.command(method, @name, *method_args)
- end
- end
- end
-
- #Add the following admin utilities to the table
- add_admin_utils :enable, :disable, :flush, :drop, :describe, :snapshot
-
- #----------------------------
- #give the general help for the table
- # or the named command
- def help (command = nil)
- #if there is a command, get the per-command help from the shell
- if command
- begin
- return @shell.help_command(command)
- rescue NoMethodError
- puts "Command \'#{command}\' does not exist. Please see general table help."
- return nil
- end
- end
- return @shell.help('table_help')
- end
-
- # Table to string
- def to_s
- cl = self.class()
- return "#{cl} - #{@name}"
- end
-
- # Standard ruby call to get the return value for an object
- # overriden here so we get sane semantics for printing a table on return
- def inspect
- to_s
- end
-
- #----------------------------------------------------------------------------------------
- # Helper methods
-
- # Returns a list of column names in the table
- def get_all_columns
- @table.table_descriptor.getFamilies.map do |family|
- "#{family.getNameAsString}:"
- end
- end
-
- # Checks if current table is one of the 'meta' tables
- def is_meta_table?
- org.apache.hadoop.hbase.TableName::META_TABLE_NAME.equals(@table.getName())
- end
-
- # Returns family and (when has it) qualifier for a column name
- def parse_column_name(column)
- split = org.apache.hadoop.hbase.KeyValue.parseColumn(column.to_java_bytes)
- set_converter(split) if split.length > 1
- return split[0], (split.length > 1) ? split[1] : nil
- end
-
- # Make a String of the passed kv
- # Intercept cells whose format we know such as the info:regioninfo in hbase:meta
- def to_string(column, kv, maxlength = -1)
- if is_meta_table?
- if column == 'info:regioninfo' or column == 'info:splitA' or column == 'info:splitB'
- hri = org.apache.hadoop.hbase.HRegionInfo.parseFromOrNull(kv.getValue)
- return "timestamp=%d, value=%s" % [kv.getTimestamp, hri.toString]
- end
- if column == 'info:serverstartcode'
- if kv.getValue.length > 0
- str_val = org.apache.hadoop.hbase.util.Bytes.toLong(kv.getValue)
- else
- str_val = org.apache.hadoop.hbase.util.Bytes.toStringBinary(kv.getValue)
- end
- return "timestamp=%d, value=%s" % [kv.getTimestamp, str_val]
- end
- end
-
- if kv.isDelete
- val = "timestamp=#{kv.getTimestamp}, type=#{org.apache.hadoop.hbase.KeyValue::Type::codeToType(kv.getType)}"
- else
- val = "timestamp=#{kv.getTimestamp}, value=#{convert(column, kv)}"
- end
- (maxlength != -1) ? val[0, maxlength] : val
- end
-
- def convert(column, kv)
- #use org.apache.hadoop.hbase.util.Bytes as the default class
- klazz_name = 'org.apache.hadoop.hbase.util.Bytes'
- #use org.apache.hadoop.hbase.util.Bytes::toStringBinary as the default convertor
- converter = 'toStringBinary'
- if @converters.has_key?(column)
- # lookup the CONVERTER for certain column - "cf:qualifier"
- matches = /c\((.+)\)\.(.+)/.match(@converters[column])
- if matches.nil?
- # cannot match the pattern of 'c(className).functionname'
- # use the default klazz_name
- converter = @converters[column]
- else
- klazz_name = matches[1]
- converter = matches[2]
- end
- end
- method = eval(klazz_name).method(converter)
- return method.call(kv.getValue) # apply the converter
- end
-
- # if the column spec contains CONVERTER information, to get rid of :CONVERTER info from column pair.
- # 1. return back normal column pair as usual, i.e., "cf:qualifier[:CONVERTER]" to "cf" and "qualifier" only
- # 2. register the CONVERTER information based on column spec - "cf:qualifier"
- def set_converter(column)
- family = String.from_java_bytes(column[0])
- parts = org.apache.hadoop.hbase.KeyValue.parseColumn(column[1])
- if parts.length > 1
- @converters["#{family}:#{String.from_java_bytes(parts[0])}"] = String.from_java_bytes(parts[1])
- column[1] = parts[0]
- end
- end
-
- #----------------------------------------------------------------------------------------------
- # Get the split points for the table
- def _get_splits_internal()
- locator = @table.getRegionLocator()
- splits = locator.getAllRegionLocations().
- map{|i| Bytes.toStringBinary(i.getRegionInfo().getStartKey)}.delete_if{|k| k == ""}
- locator.close()
- puts("Total number of splits = %s" % [splits.size + 1])
- return splits
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/hbase/visibility_labels.rb b/quickstart/thirdparty/ruby/hbase/visibility_labels.rb
deleted file mode 100644
index 676903f7..00000000
--- a/quickstart/thirdparty/ruby/hbase/visibility_labels.rb
+++ /dev/null
@@ -1,159 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include Java
-java_import org.apache.hadoop.hbase.security.visibility.VisibilityClient
-java_import org.apache.hadoop.hbase.security.visibility.VisibilityConstants
-java_import org.apache.hadoop.hbase.util.Bytes
-
-module Hbase
- class VisibilityLabelsAdmin
-
- def initialize(admin, formatter)
- @admin = admin
- @config = @admin.getConfiguration()
- @formatter = formatter
- end
-
- def close
- @admin.close
- end
-
- def add_labels(*args)
- visibility_feature_available?
- # Normalize args
- if args.kind_of?(Array)
- labels = [ args ].flatten.compact
- end
- if labels.size() == 0
- raise(ArgumentError, "Arguments cannot be null")
- end
-
- begin
- response = VisibilityClient.addLabels(@config, labels.to_java(:string))
- if response.nil?
- raise(ArgumentError, "DISABLED: Visibility labels feature is not available")
- end
- labelsWithException = ""
- list = response.getResultList()
- list.each do |result|
- if result.hasException()
- labelsWithException += Bytes.toString(result.getException().getValue().toByteArray())
- end
- end
- if labelsWithException.length > 0
- raise(ArgumentError, labelsWithException)
- end
- end
- end
-
- def set_auths(user, *args)
- visibility_feature_available?
- # Normalize args
- if args.kind_of?(Array)
- auths = [ args ].flatten.compact
- end
-
- begin
- response = VisibilityClient.setAuths(@config, auths.to_java(:string), user)
- if response.nil?
- raise(ArgumentError, "DISABLED: Visibility labels feature is not available")
- end
- labelsWithException = ""
- list = response.getResultList()
- list.each do |result|
- if result.hasException()
- labelsWithException += Bytes.toString(result.getException().getValue().toByteArray())
- end
- end
- if labelsWithException.length > 0
- raise(ArgumentError, labelsWithException)
- end
- end
- end
-
- def get_auths(user)
- visibility_feature_available?
- begin
- response = VisibilityClient.getAuths(@config, user)
- if response.nil?
- raise(ArgumentError, "DISABLED: Visibility labels feature is not available")
- end
- return response.getAuthList
- end
- end
-
- def list_labels(regex = ".*")
- visibility_feature_available?
- begin
- response = VisibilityClient.listLabels(@config, regex)
- if response.nil?
- raise(ArgumentError, "DISABLED: Visibility labels feature is not available")
- end
- return response.getLabelList
- end
- end
-
- def clear_auths(user, *args)
- visibility_feature_available?
- # Normalize args
- if args.kind_of?(Array)
- auths = [ args ].flatten.compact
- end
-
- begin
- response = VisibilityClient.clearAuths(@config, auths.to_java(:string), user)
- if response.nil?
- raise(ArgumentError, "DISABLED: Visibility labels feature is not available")
- end
- labelsWithException = ""
- list = response.getResultList()
- list.each do |result|
- if result.hasException()
- labelsWithException += Bytes.toString(result.getException().getValue().toByteArray())
- end
- end
- if labelsWithException.length > 0
- raise(ArgumentError, labelsWithException)
- end
- end
- end
-
- # Make sure that lables table is available
- def visibility_feature_available?()
- caps = []
- begin
- # Try the getSecurityCapabilities API where supported.
- caps = @admin.getSecurityCapabilities
- rescue
- # If we are unable to use getSecurityCapabilities, fall back with a check for
- # deployment of the labels table
- raise(ArgumentError, "DISABLED: Visibility labels feature is not available") unless \
- exists?(VisibilityConstants::LABELS_TABLE_NAME)
- return
- end
- raise(ArgumentError, "DISABLED: Visibility labels feature is not available") unless \
- caps.include? org.apache.hadoop.hbase.client.security.SecurityCapability::CELL_VISIBILITY
- end
-
- # Does table exist?
- def exists?(table_name)
- @admin.tableExists(table_name)
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/irb/hirb.rb b/quickstart/thirdparty/ruby/irb/hirb.rb
deleted file mode 100644
index b32e691c..00000000
--- a/quickstart/thirdparty/ruby/irb/hirb.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-require 'rbconfig'
-
-module IRB
- WINDOZE = Config::CONFIG['host_os'] =~ /mswin|mingw/
-
- # Subclass of IRB so can intercept methods
- class HIRB < Irb
- def initialize
- # This is ugly. Our 'help' method above provokes the following message
- # on irb construction: 'irb: warn: can't alias help from irb_help.'
- # Below, we reset the output so its pointed at /dev/null during irb
- # construction just so this message does not come out after we emit
- # the banner. Other attempts at playing with the hash of methods
- # down in IRB didn't seem to work. I think the worst thing that can
- # happen is the shell exiting because of failed IRB construction with
- # no error (though we're not blanking STDERR)
- begin
- # Map the '/dev/null' according to the runing platform
- # Under Windows platform the 'dev/null' is not fully compliant with unix,
- # and the 'NUL' object need to be use instead.
- devnull = "/dev/null"
- devnull = "NUL" if WINDOZE
- f = File.open(devnull, "w")
- $stdout = f
- super
- ensure
- f.close()
- $stdout = STDOUT
- end
- end
-
- def output_value
- # Suppress output if last_value is 'nil'
- # Otherwise, when user types help, get ugly 'nil'
- # after all output.
- if @context.last_value != nil
- super
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell.rb b/quickstart/thirdparty/ruby/shell.rb
deleted file mode 100644
index 7b5766c2..00000000
--- a/quickstart/thirdparty/ruby/shell.rb
+++ /dev/null
@@ -1,433 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Shell commands module
-module Shell
- @@commands = {}
- def self.commands
- @@commands
- end
-
- @@command_groups = {}
- def self.command_groups
- @@command_groups
- end
-
- def self.load_command(name, group, aliases=[])
- return if commands[name]
-
- # Register command in the group
- raise ArgumentError, "Unknown group: #{group}" unless command_groups[group]
- command_groups[group][:commands] << name
-
- # Load command
- begin
- require "shell/commands/#{name}"
- klass_name = name.to_s.gsub(/(?:^|_)(.)/) { $1.upcase } # camelize
- commands[name] = eval("Commands::#{klass_name}")
- aliases.each do |an_alias|
- commands[an_alias] = commands[name]
- end
- rescue => e
- raise "Can't load hbase shell command: #{name}. Error: #{e}\n#{e.backtrace.join("\n")}"
- end
- end
-
- def self.load_command_group(group, opts)
- raise ArgumentError, "No :commands for group #{group}" unless opts[:commands]
-
- command_groups[group] = {
- :commands => [],
- :command_names => opts[:commands],
- :full_name => opts[:full_name] || group,
- :comment => opts[:comment]
- }
-
- all_aliases = opts[:aliases] || {}
-
- opts[:commands].each do |command|
- aliases = all_aliases[command] || []
- load_command(command, group, aliases)
- end
- end
-
- #----------------------------------------------------------------------
- class Shell
- attr_accessor :hbase
- attr_accessor :formatter
- attr_accessor :interactive
- alias interactive? interactive
-
- @debug = false
- attr_accessor :debug
-
- def initialize(hbase, formatter, interactive=true)
- self.hbase = hbase
- self.formatter = formatter
- self.interactive = interactive
- end
-
- def hbase_admin
- @hbase_admin ||= hbase.admin(formatter)
- end
-
- def hbase_table(name)
- hbase.table(name, self)
- end
-
- def hbase_replication_admin
- @hbase_replication_admin ||= hbase.replication_admin(formatter)
- end
-
- def hbase_security_admin
- @hbase_security_admin ||= hbase.security_admin(formatter)
- end
-
- def hbase_visibility_labels_admin
- @hbase_visibility_labels_admin ||= hbase.visibility_labels_admin(formatter)
- end
-
- def hbase_quotas_admin
- @hbase_quotas_admin ||= hbase.quotas_admin(formatter)
- end
-
- def export_commands(where)
- ::Shell.commands.keys.each do |cmd|
- # here where is the IRB namespace
- # this method just adds the call to the specified command
- # which just references back to 'this' shell object
- # a decently extensible way to add commands
- where.send :instance_eval, <<-EOF
- def #{cmd}(*args)
- ret = @shell.command('#{cmd}', *args)
- puts
- return ret
- end
- EOF
- end
- end
-
- def command_instance(command)
- ::Shell.commands[command.to_s].new(self)
- end
-
- #call the method 'command' on the specified command
- def command(command, *args)
- internal_command(command, :command, *args)
- end
-
- #call a specific internal method in the command instance
- # command - name of the command to call
- # method_name - name of the method on the command to call. Defaults to just 'command'
- # args - to be passed to the named method
- def internal_command(command, method_name= :command, *args)
- command_instance(command).command_safe(self.debug,method_name, *args)
- end
-
- def print_banner
- puts "HBase Shell; enter 'help' for list of supported commands."
- puts 'Type "exit" to leave the HBase Shell'
- print 'Version '
- command('version')
- puts
- end
-
- def help_multi_command(command)
- puts "Command: #{command}"
- puts command_instance(command).help
- puts
- return nil
- end
-
- def help_command(command)
- puts command_instance(command).help
- return nil
- end
-
- def help_group(group_name)
- group = ::Shell.command_groups[group_name.to_s]
- group[:commands].sort.each { |cmd| help_multi_command(cmd) }
- if group[:comment]
- puts '-' * 80
- puts
- puts group[:comment]
- puts
- end
- return nil
- end
-
- def help(command = nil)
- if command
- return help_command(command) if ::Shell.commands[command.to_s]
- return help_group(command) if ::Shell.command_groups[command.to_s]
- puts "ERROR: Invalid command or command group name: #{command}"
- puts
- end
-
- puts help_header
- puts
- puts 'COMMAND GROUPS:'
- ::Shell.command_groups.each do |name, group|
- puts " Group name: " + name
- puts " Commands: " + group[:command_names].sort.join(', ')
- puts
- end
- unless command
- puts 'SHELL USAGE:'
- help_footer
- end
- return nil
- end
-
- def help_header
- return "HBase Shell, version #{org.apache.hadoop.hbase.util.VersionInfo.getVersion()}, " +
- "r#{org.apache.hadoop.hbase.util.VersionInfo.getRevision()}, " +
- "#{org.apache.hadoop.hbase.util.VersionInfo.getDate()}" + "\n" +
- "Type 'help \"COMMAND\"', (e.g. 'help \"get\"' -- the quotes are necessary) for help on a specific command.\n" +
- "Commands are grouped. Type 'help \"COMMAND_GROUP\"', (e.g. 'help \"general\"') for help on a command group."
- end
-
- def help_footer
- puts <<-HERE
-Quote all names in HBase Shell such as table and column names. Commas delimit
-command parameters. Type after entering a command to run it.
-Dictionaries of configuration used in the creation and alteration of tables are
-Ruby Hashes. They look like this:
-
- {'key1' => 'value1', 'key2' => 'value2', ...}
-
-and are opened and closed with curley-braces. Key/values are delimited by the
-'=>' character combination. Usually keys are predefined constants such as
-NAME, VERSIONS, COMPRESSION, etc. Constants do not need to be quoted. Type
-'Object.constants' to see a (messy) list of all constants in the environment.
-
-If you are using binary keys or values and need to enter them in the shell, use
-double-quote'd hexadecimal representation. For example:
-
- hbase> get 't1', "key\\x03\\x3f\\xcd"
- hbase> get 't1', "key\\003\\023\\011"
- hbase> put 't1', "test\\xef\\xff", 'f1:', "\\x01\\x33\\x40"
-
-The HBase shell is the (J)Ruby IRB with the above HBase-specific commands added.
-For more on the HBase Shell, see http://hbase.apache.org/book.html
- HERE
- end
- end
-end
-
-# Load commands base class
-require 'shell/commands'
-
-# Load all commands
-Shell.load_command_group(
- 'general',
- :full_name => 'GENERAL HBASE SHELL COMMANDS',
- :commands => %w[
- status
- version
- table_help
- whoami
- ]
-)
-
-Shell.load_command_group(
- 'ddl',
- :full_name => 'TABLES MANAGEMENT COMMANDS',
- :commands => %w[
- alter
- create
- describe
- disable
- disable_all
- is_disabled
- drop
- drop_all
- enable
- enable_all
- is_enabled
- exists
- list
- show_filters
- alter_status
- alter_async
- get_table
- locate_region
- ],
- :aliases => {
- 'describe' => ['desc']
- }
-)
-
-Shell.load_command_group(
- 'namespace',
- :full_name => 'NAMESPACE MANAGEMENT COMMANDS',
- :commands => %w[
- create_namespace
- drop_namespace
- alter_namespace
- describe_namespace
- list_namespace
- list_namespace_tables
- ]
-)
-
-Shell.load_command_group(
- 'dml',
- :full_name => 'DATA MANIPULATION COMMANDS',
- :commands => %w[
- count
- delete
- deleteall
- get
- get_counter
- incr
- put
- scan
- truncate
- truncate_preserve
- append
- get_splits
- ]
-)
-
-Shell.load_command_group(
- 'tools',
- :full_name => 'HBASE SURGERY TOOLS',
- :comment => "WARNING: Above commands are for 'experts'-only as misuse can damage an install",
- :commands => %w[
- assign
- balancer
- balance_switch
- balancer_enabled
- normalize
- normalizer_switch
- normalizer_enabled
- close_region
- compact
- flush
- major_compact
- move
- split
- merge_region
- unassign
- zk_dump
- wal_roll
- catalogjanitor_run
- catalogjanitor_switch
- catalogjanitor_enabled
- compact_rs
- trace
- splitormerge_switch
- splitormerge_enabled
- ],
- # TODO remove older hlog_roll command
- :aliases => {
- 'wal_roll' => ['hlog_roll']
- }
-)
-
-Shell.load_command_group(
- 'replication',
- :full_name => 'CLUSTER REPLICATION TOOLS',
- :comment => "In order to use these tools, hbase.replication must be true.",
- :commands => %w[
- add_peer
- remove_peer
- list_peers
- enable_peer
- disable_peer
- show_peer_tableCFs
- set_peer_tableCFs
- list_replicated_tables
- append_peer_tableCFs
- remove_peer_tableCFs
- enable_table_replication
- disable_table_replication
- get_peer_config
- list_peer_configs
- ]
-)
-
-Shell.load_command_group(
- 'snapshots',
- :full_name => 'CLUSTER SNAPSHOT TOOLS',
- :commands => %w[
- snapshot
- clone_snapshot
- restore_snapshot
- delete_snapshot
- delete_all_snapshot
- delete_table_snapshots
- list_snapshots
- list_table_snapshots
- ]
-)
-
-Shell.load_command_group(
- 'configuration',
- :full_name => 'ONLINE CONFIGURATION TOOLS',
- :commands => %w[
- update_config
- update_all_config
- ]
-)
-
-Shell.load_command_group(
- 'quotas',
- :full_name => 'CLUSTER QUOTAS TOOLS',
- :commands => %w[
- set_quota
- list_quotas
- ]
-)
-
-Shell.load_command_group(
- 'security',
- :full_name => 'SECURITY TOOLS',
- :comment => "NOTE: Above commands are only applicable if running with the AccessController coprocessor",
- :commands => %w[
- list_security_capabilities
- grant
- revoke
- user_permission
- ]
-)
-
-Shell.load_command_group(
- 'procedures',
- :full_name => 'PROCEDURES MANAGEMENT',
- :commands => %w[
- abort_procedure
- list_procedures
- ]
-)
-
-Shell.load_command_group(
- 'visibility labels',
- :full_name => 'VISIBILITY LABEL TOOLS',
- :comment => "NOTE: Above commands are only applicable if running with the VisibilityController coprocessor",
- :commands => %w[
- add_labels
- list_labels
- set_auths
- get_auths
- clear_auths
- set_visibility
- ]
-)
diff --git a/quickstart/thirdparty/ruby/shell/commands.rb b/quickstart/thirdparty/ruby/shell/commands.rb
deleted file mode 100644
index b18063e6..00000000
--- a/quickstart/thirdparty/ruby/shell/commands.rb
+++ /dev/null
@@ -1,152 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Command
-
- def initialize(shell)
- @shell = shell
- end
-
- #wrap an execution of cmd to catch hbase exceptions
- # cmd - command name to execture
- # args - arguments to pass to the command
- def command_safe(debug, cmd = :command, *args)
- # send is internal ruby method to call 'cmd' with *args
- #(everything is a message, so this is just the formal semantics to support that idiom)
- translate_hbase_exceptions(*args) { send(cmd,*args) }
- rescue => e
- rootCause = e
- while rootCause != nil && rootCause.respond_to?(:cause) && rootCause.cause != nil
- rootCause = rootCause.cause
- end
- if @shell.interactive?
- puts
- puts "ERROR: #{rootCause}"
- puts "Backtrace: #{rootCause.backtrace.join("\n ")}" if debug
- puts
- puts "Here is some help for this command:"
- puts help
- puts
- else
- raise rootCause
- end
- end
-
- def admin
- @shell.hbase_admin
- end
-
- def table(name)
- @shell.hbase_table(name)
- end
-
- def replication_admin
- @shell.hbase_replication_admin
- end
-
- def security_admin
- @shell.hbase_security_admin
- end
-
- def visibility_labels_admin
- @shell.hbase_visibility_labels_admin
- end
-
- def quotas_admin
- @shell.hbase_quotas_admin
- end
-
- #----------------------------------------------------------------------
-
- def formatter
- @shell.formatter
- end
-
- def format_simple_command
- now = Time.now
- yield
- formatter.header
- formatter.footer(now)
- end
-
- def format_and_return_simple_command
- now = Time.now
- ret = yield
- formatter.header
- formatter.footer(now)
- return ret
- end
-
- def translate_hbase_exceptions(*args)
- yield
- rescue => e
- # Since exceptions will be thrown from the java code, 'e' will always be NativeException.
- # Check for the original java exception and use it if present.
- raise e unless e.respond_to?(:cause) && e.cause != nil
- cause = e.cause
-
- # let individual command handle exceptions first
- if self.respond_to?(:handle_exceptions)
- self.handle_exceptions(cause, *args)
- end
- # Global HBase exception handling below if not handled by respective command above
- if cause.kind_of?(org.apache.hadoop.hbase.TableNotFoundException) then
- raise "Unknown table #{args.first}!"
- end
- if cause.kind_of?(org.apache.hadoop.hbase.UnknownRegionException) then
- raise "Unknown region #{args.first}!"
- end
- if cause.kind_of?(org.apache.hadoop.hbase.NamespaceNotFoundException) then
- raise "Unknown namespace #{args.first}!"
- end
- if cause.kind_of?(org.apache.hadoop.hbase.snapshot.SnapshotDoesNotExistException) then
- raise "Unknown snapshot #{args.first}!"
- end
- if cause.kind_of?(org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException) then
- exceptions = cause.getCauses
- exceptions.each do |exception|
- if exception.kind_of?(org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException) then
- valid_cols = table(args.first).get_all_columns.map { |c| c + '*' }
- raise "Unknown column family! Valid column names: #{valid_cols.join(", ")}"
- end
- end
- end
- if cause.kind_of?(org.apache.hadoop.hbase.TableExistsException) then
- raise "Table already exists: #{args.first}!"
- end
- # To be safe, here only AccessDeniedException is considered. In future
- # we might support more in more generic approach when possible.
- if cause.kind_of?(org.apache.hadoop.hbase.security.AccessDeniedException) then
- str = java.lang.String.new("#{cause}")
- # Error message is merged with stack trace, reference StringUtils.stringifyException
- # This is to parse and get the error message from the whole.
- strs = str.split("\n")
- if strs.size > 0 then
- raise "#{strs[0]}"
- end
- end
-
- # Throw the other exception which hasn't been handled above
- raise e
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/abort_procedure.rb b/quickstart/thirdparty/ruby/shell/commands/abort_procedure.rb
deleted file mode 100644
index 6f77ab70..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/abort_procedure.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class AbortProcedure < Command
- def help
- return <<-EOF
-Given a procedure Id (and optional boolean may_interrupt_if_running parameter,
-default is true), abort a procedure in hbase. Use with caution. Some procedures
-might not be abortable. For experts only.
-
-If this command is accepted and the procedure is in the process of aborting,
-it will return true; if the procedure could not be aborted (eg. procedure
-does not exist, or procedure already completed or abort will cause corruption),
-this command will return false.
-
-Examples:
-
- hbase> abort_procedure proc_id
- hbase> abort_procedure proc_id, true
- hbase> abort_procedure proc_id, false
-EOF
- end
-
- def command(proc_id, may_interrupt_if_running=nil)
- format_simple_command do
- formatter.row([
- admin.abort_procedure?(proc_id, may_interrupt_if_running).to_s
- ])
- end
- end
- end
- end
-end
\ No newline at end of file
diff --git a/quickstart/thirdparty/ruby/shell/commands/add_labels.rb b/quickstart/thirdparty/ruby/shell/commands/add_labels.rb
deleted file mode 100644
index 65a1140f..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/add_labels.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class AddLabels < Command
- def help
- return <<-EOF
-Add a set of visibility labels.
-Syntax : add_labels [label1, label2]
-
-For example:
-
- hbase> add_labels ['SECRET','PRIVATE']
-EOF
- end
-
- def command(*args)
- format_simple_command do
- visibility_labels_admin.add_labels(args)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/add_peer.rb b/quickstart/thirdparty/ruby/shell/commands/add_peer.rb
deleted file mode 100644
index be010416..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/add_peer.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class AddPeer< Command
- def help
- return <<-EOF
-A peer can either be another HBase cluster or a custom replication endpoint. In either case an id
-must be specified to identify the peer.
-
-For a HBase cluster peer, a cluster key must be provided and is composed like this:
-hbase.zookeeper.quorum:hbase.zookeeper.property.clientPort:zookeeper.znode.parent
-This gives a full path for HBase to connect to another HBase cluster. An optional parameter for
-table column families identifies which column families will be replicated to the peer cluster.
-Examples:
-
- hbase> add_peer '1', "server1.cie.com:2181:/hbase"
- hbase> add_peer '2', "zk1,zk2,zk3:2182:/hbase-prod"
- hbase> add_peer '3', "zk4,zk5,zk6:11000:/hbase-test", "table1; table2:cf1; table3:cf1,cf2"
- hbase> add_peer '4', CLUSTER_KEY => "server1.cie.com:2181:/hbase"
- hbase> add_peer '5', CLUSTER_KEY => "server1.cie.com:2181:/hbase",
- TABLE_CFS => { "table1" => [], "table2" => ["cf1"], "table3" => ["cf1", "cf2"] }
-
-For a custom replication endpoint, the ENDPOINT_CLASSNAME can be provided. Two optional arguments
-are DATA and CONFIG which can be specified to set different either the peer_data or configuration
-for the custom replication endpoint. Table column families is optional and can be specified with
-the key TABLE_CFS.
-
- hbase> add_peer '6', ENDPOINT_CLASSNAME => 'org.apache.hadoop.hbase.MyReplicationEndpoint'
- hbase> add_peer '7', ENDPOINT_CLASSNAME => 'org.apache.hadoop.hbase.MyReplicationEndpoint',
- DATA => { "key1" => 1 }
- hbase> add_peer '8', ENDPOINT_CLASSNAME => 'org.apache.hadoop.hbase.MyReplicationEndpoint',
- CONFIG => { "config1" => "value1", "config2" => "value2" }
- hbase> add_peer '9', ENDPOINT_CLASSNAME => 'org.apache.hadoop.hbase.MyReplicationEndpoint',
- DATA => { "key1" => 1 }, CONFIG => { "config1" => "value1", "config2" => "value2" },
- hbase> add_peer '10', ENDPOINT_CLASSNAME => 'org.apache.hadoop.hbase.MyReplicationEndpoint',
- TABLE_CFS => { "table1" => [], "table2" => ["cf1"], "table3" => ["cf1", "cf2"] }
- hbase> add_peer '11', ENDPOINT_CLASSNAME => 'org.apache.hadoop.hbase.MyReplicationEndpoint',
- DATA => { "key1" => 1 }, CONFIG => { "config1" => "value1", "config2" => "value2" },
- TABLE_CFS => { "table1" => [], "table2" => ["cf1"], "table3" => ["cf1", "cf2"] }
-
-Note: Either CLUSTER_KEY or ENDPOINT_CLASSNAME must be specified but not both.
-EOF
- end
-
- def command(id, args = {}, peer_tableCFs = nil)
- format_simple_command do
- replication_admin.add_peer(id, args, peer_tableCFs)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/alter.rb b/quickstart/thirdparty/ruby/shell/commands/alter.rb
deleted file mode 100644
index 2c3aa6f8..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/alter.rb
+++ /dev/null
@@ -1,101 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Alter < Command
- def help
- return <<-EOF
-Alter a table. If the "hbase.online.schema.update.enable" property is set to
-false, then the table must be disabled (see help 'disable'). If the
-"hbase.online.schema.update.enable" property is set to true, tables can be
-altered without disabling them first. Altering enabled tables has caused problems
-in the past, so use caution and test it before using in production.
-
-You can use the alter command to add,
-modify or delete column families or change table configuration options.
-Column families work in a similar way as the 'create' command. The column family
-specification can either be a name string, or a dictionary with the NAME attribute.
-Dictionaries are described in the output of the 'help' command, with no arguments.
-
-For example, to change or add the 'f1' column family in table 't1' from
-current value to keep a maximum of 5 cell VERSIONS, do:
-
- hbase> alter 't1', NAME => 'f1', VERSIONS => 5
-
-You can operate on several column families:
-
- hbase> alter 't1', 'f1', {NAME => 'f2', IN_MEMORY => true}, {NAME => 'f3', VERSIONS => 5}
-
-To delete the 'f1' column family in table 'ns1:t1', use one of:
-
- hbase> alter 'ns1:t1', NAME => 'f1', METHOD => 'delete'
- hbase> alter 'ns1:t1', 'delete' => 'f1'
-
-You can also change table-scope attributes like MAX_FILESIZE, READONLY,
-MEMSTORE_FLUSHSIZE, DURABILITY, etc. These can be put at the end;
-for example, to change the max size of a region to 128MB, do:
-
- hbase> alter 't1', MAX_FILESIZE => '134217728'
-
-You can add a table coprocessor by setting a table coprocessor attribute:
-
- hbase> alter 't1',
- 'coprocessor'=>'hdfs:///foo.jar|com.foo.FooRegionObserver|1001|arg1=1,arg2=2'
-
-Since you can have multiple coprocessors configured for a table, a
-sequence number will be automatically appended to the attribute name
-to uniquely identify it.
-
-The coprocessor attribute must match the pattern below in order for
-the framework to understand how to load the coprocessor classes:
-
- [coprocessor jar file location] | class name | [priority] | [arguments]
-
-You can also set configuration settings specific to this table or column family:
-
- hbase> alter 't1', CONFIGURATION => {'hbase.hregion.scan.loadColumnFamiliesOnDemand' => 'true'}
- hbase> alter 't1', {NAME => 'f2', CONFIGURATION => {'hbase.hstore.blockingStoreFiles' => '10'}}
-
-You can also remove a table-scope attribute:
-
- hbase> alter 't1', METHOD => 'table_att_unset', NAME => 'MAX_FILESIZE'
-
- hbase> alter 't1', METHOD => 'table_att_unset', NAME => 'coprocessor$1'
-
-You can also set REGION_REPLICATION:
-
- hbase> alter 't1', {REGION_REPLICATION => 2}
-
-There could be more than one alteration in one command:
-
- hbase> alter 't1', { NAME => 'f1', VERSIONS => 3 },
- { MAX_FILESIZE => '134217728' }, { METHOD => 'delete', NAME => 'f2' },
- OWNER => 'johndoe', METADATA => { 'mykey' => 'myvalue' }
-EOF
- end
-
- def command(table, *args)
- format_simple_command do
- admin.alter(table, true, *args)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/alter_async.rb b/quickstart/thirdparty/ruby/shell/commands/alter_async.rb
deleted file mode 100644
index bddff010..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/alter_async.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class AlterAsync < Command
- def help
- return <<-EOF
-Alter column family schema, does not wait for all regions to receive the
-schema changes. Pass table name and a dictionary specifying new column
-family schema. Dictionaries are described on the main help command output.
-Dictionary must include name of column family to alter. For example,
-
-To change or add the 'f1' column family in table 't1' from defaults
-to instead keep a maximum of 5 cell VERSIONS, do:
-
- hbase> alter_async 't1', NAME => 'f1', VERSIONS => 5
-
-To delete the 'f1' column family in table 'ns1:t1', do:
-
- hbase> alter_async 'ns1:t1', NAME => 'f1', METHOD => 'delete'
-
-or a shorter version:
-
- hbase> alter_async 'ns1:t1', 'delete' => 'f1'
-
-You can also change table-scope attributes like MAX_FILESIZE
-MEMSTORE_FLUSHSIZE, READONLY, and DEFERRED_LOG_FLUSH.
-
-For example, to change the max size of a family to 128MB, do:
-
- hbase> alter 't1', METHOD => 'table_att', MAX_FILESIZE => '134217728'
-
-There could be more than one alteration in one command:
-
- hbase> alter 't1', {NAME => 'f1'}, {NAME => 'f2', METHOD => 'delete'}
-
-To check if all the regions have been updated, use alter_status
-EOF
- end
-
- def command(table, *args)
- format_simple_command do
- admin.alter(table, false, *args)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/alter_namespace.rb b/quickstart/thirdparty/ruby/shell/commands/alter_namespace.rb
deleted file mode 100644
index a16e10d8..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/alter_namespace.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class AlterNamespace < Command
- def help
- return <<-EOF
-Alter namespace properties.
-
-To add/modify a property:
-
- hbase> alter_namespace 'ns1', {METHOD => 'set', 'PROPERTY_NAME' => 'PROPERTY_VALUE'}
-
-To delete a property:
-
- hbase> alter_namespace 'ns1', {METHOD => 'unset', NAME=>'PROPERTY_NAME'}
-EOF
- end
-
- def command(namespace, *args)
- format_simple_command do
- admin.alter_namespace(namespace, *args)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/alter_status.rb b/quickstart/thirdparty/ruby/shell/commands/alter_status.rb
deleted file mode 100644
index 72f044db..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/alter_status.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class AlterStatus < Command
- def help
- return <<-EOF
-Get the status of the alter command. Indicates the number of regions of the
-table that have received the updated schema
-Pass table name.
-
-hbase> alter_status 't1'
-hbase> alter_status 'ns1:t1'
-EOF
- end
- def command(table)
- admin.alter_status(table)
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/append.rb b/quickstart/thirdparty/ruby/shell/commands/append.rb
deleted file mode 100644
index a0ef36d2..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/append.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Append < Command
- def help
- return <<-EOF
-Appends a cell 'value' at specified table/row/column coordinates.
-
- hbase> append 't1', 'r1', 'c1', 'value', ATTRIBUTES=>{'mykey'=>'myvalue'}
- hbase> append 't1', 'r1', 'c1', 'value', {VISIBILITY=>'PRIVATE|SECRET'}
-
-The same commands also can be run on a table reference. Suppose you had a reference
-t to table 't1', the corresponding command would be:
-
- hbase> t.append 'r1', 'c1', 'value', ATTRIBUTES=>{'mykey'=>'myvalue'}
- hbase> t.append 'r1', 'c1', 'value', {VISIBILITY=>'PRIVATE|SECRET'}
-EOF
- end
-
- def command(table, row, column, value, args={})
- append(table(table), row, column, value, args)
- end
-
- def append(table, row, column, value, args={})
- format_simple_command do
- table._append_internal(row, column, value, args)
- end
- end
- end
- end
-end
-
-#add incr comamnd to Table
-::Hbase::Table.add_shell_command("append")
diff --git a/quickstart/thirdparty/ruby/shell/commands/append_peer_tableCFs.rb b/quickstart/thirdparty/ruby/shell/commands/append_peer_tableCFs.rb
deleted file mode 100644
index 3919b203..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/append_peer_tableCFs.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class AppendPeerTableCFs< Command
- def help
- return <<-EOF
-Append a replicable table-cf config for the specified peer
-Examples:
-
- # append a table / table-cf to be replicable for a peer
- hbase> append_peer_tableCFs '2', "table4:cfA,cfB"
-
-EOF
- end
-
- def command(id, table_cfs)
- format_simple_command do
- replication_admin.append_peer_tableCFs(id, table_cfs)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/assign.rb b/quickstart/thirdparty/ruby/shell/commands/assign.rb
deleted file mode 100644
index 448a5460..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/assign.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Assign < Command
- def help
- return <<-EOF
-Assign a region. Use with caution. If region already assigned,
-this command will do a force reassign. For experts only.
-Examples:
-
- hbase> assign 'REGIONNAME'
- hbase> assign 'ENCODED_REGIONNAME'
-EOF
- end
-
- def command(region_name)
- format_simple_command do
- admin.assign(region_name)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/balance_switch.rb b/quickstart/thirdparty/ruby/shell/commands/balance_switch.rb
deleted file mode 100644
index 4d7778da..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/balance_switch.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class BalanceSwitch < Command
- def help
- return <<-EOF
-Enable/Disable balancer. Returns previous balancer state.
-Examples:
-
- hbase> balance_switch true
- hbase> balance_switch false
-EOF
- end
-
- def command(enableDisable)
- format_simple_command do
- formatter.row([
- admin.balance_switch(enableDisable)? "true" : "false"
- ])
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/balancer.rb b/quickstart/thirdparty/ruby/shell/commands/balancer.rb
deleted file mode 100644
index ee53ca00..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/balancer.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Balancer < Command
- def help
- return <<-EOF
-Trigger the cluster balancer. Returns true if balancer ran and was able to
-tell the region servers to unassign all the regions to balance (the re-assignment itself is async).
-Otherwise false (Will not run if regions in transition).
-Parameter tells master whether we should force balance even if there is region in transition.
-
-WARNING: For experts only. Forcing a balance may do more damage than repair
-when assignment is confused
-
-Examples:
-
- hbase> balancer
- hbase> balancer "force"
-EOF
- end
-
- def command(force=nil)
- format_simple_command do
- formatter.row([
- if force.nil?
- admin.balancer("false")? "true": "false"
- elsif force == "force"
- admin.balancer("true")? "true": "false"
- end
- ])
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/balancer_enabled.rb b/quickstart/thirdparty/ruby/shell/commands/balancer_enabled.rb
deleted file mode 100644
index 3b2f5c64..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/balancer_enabled.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env hbase-jruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with this
-# work for additional information regarding copyright ownership. The ASF
-# licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# Prints the current balancer status
-
-module Shell
- module Commands
- class BalancerEnabled < Command
- def help
- return <<-EOF
-Query the balancer's state.
-Examples:
-
- hbase> balancer_enabled
-EOF
- end
-
- def command()
- format_simple_command do
- formatter.row([
- admin.balancer_enabled?.to_s
- ])
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/catalogjanitor_enabled.rb b/quickstart/thirdparty/ruby/shell/commands/catalogjanitor_enabled.rb
deleted file mode 100644
index b310c3a7..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/catalogjanitor_enabled.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class CatalogjanitorEnabled < Command
- def help
- return <<-EOF
-Query for the CatalogJanitor state (enabled/disabled?)
-Examples:
-
- hbase> catalogjanitor_enabled
-EOF
- end
-
- def command()
- format_simple_command do
- formatter.row([
- admin.catalogjanitor_enabled()? "true" : "false"
- ])
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/catalogjanitor_run.rb b/quickstart/thirdparty/ruby/shell/commands/catalogjanitor_run.rb
deleted file mode 100644
index 03426cb4..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/catalogjanitor_run.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class CatalogjanitorRun < Command
- def help
- return <<-EOF
-Catalog janitor command to run the (garbage collection) scan from command line.
-
- hbase> catalogjanitor_run
-
-EOF
- end
- def command()
- format_simple_command do
- admin.catalogjanitor_run()
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/catalogjanitor_switch.rb b/quickstart/thirdparty/ruby/shell/commands/catalogjanitor_switch.rb
deleted file mode 100644
index fce1925e..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/catalogjanitor_switch.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class CatalogjanitorSwitch < Command
- def help
- return <<-EOF
-Enable/Disable CatalogJanitor. Returns previous CatalogJanitor state.
-Examples:
-
- hbase> catalogjanitor_switch true
- hbase> catalogjanitor_switch false
-EOF
- end
-
- def command(enableDisable)
- format_simple_command do
- formatter.row([
- admin.catalogjanitor_switch(enableDisable)? "true" : "false"
- ])
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/clear_auths.rb b/quickstart/thirdparty/ruby/shell/commands/clear_auths.rb
deleted file mode 100644
index 8553fa64..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/clear_auths.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class ClearAuths < Command
- def help
- return <<-EOF
-Clear visibility labels from a user or group
-Syntax : clear_auths 'user',[label1, label2]
-
-For example:
-
- hbase> clear_auths 'user1', ['SECRET','PRIVATE']
- hbase> clear_auths '@group1', ['SECRET','PRIVATE']
-EOF
- end
-
- def command(user, *args)
- format_simple_command do
- visibility_labels_admin.clear_auths(user, args)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/clone_snapshot.rb b/quickstart/thirdparty/ruby/shell/commands/clone_snapshot.rb
deleted file mode 100644
index 0498c8e3..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/clone_snapshot.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class CloneSnapshot < Command
- def help
- return <<-EOF
-Create a new table by cloning the snapshot content.
-There're no copies of data involved.
-And writing on the newly created table will not influence the snapshot data.
-
-Examples:
- hbase> clone_snapshot 'snapshotName', 'tableName'
- hbase> clone_snapshot 'snapshotName', 'namespace:tableName'
-EOF
- end
-
- def command(snapshot_name, table)
- format_simple_command do
- admin.clone_snapshot(snapshot_name, table)
- end
- end
-
- def handle_exceptions(cause, *args)
- if cause.kind_of?(org.apache.hadoop.hbase.TableExistsException) then
- tableName = args[1]
- raise "Table already exists: #{tableName}!"
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/close_region.rb b/quickstart/thirdparty/ruby/shell/commands/close_region.rb
deleted file mode 100644
index 9e2900c3..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/close_region.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class CloseRegion < Command
- def help
- return <<-EOF
-Close a single region. Ask the master to close a region out on the cluster
-or if 'SERVER_NAME' is supplied, ask the designated hosting regionserver to
-close the region directly. Closing a region, the master expects 'REGIONNAME'
-to be a fully qualified region name. When asking the hosting regionserver to
-directly close a region, you pass the regions' encoded name only. A region
-name looks like this:
-
- TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.
-or
- Namespace:TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.
-
-The trailing period is part of the regionserver name. A region's encoded name
-is the hash at the end of a region name; e.g. 527db22f95c8a9e0116f0cc13c680396
-(without the period). A 'SERVER_NAME' is its host, port plus startcode. For
-example: host187.example.com,60020,1289493121758 (find servername in master ui
-or when you do detailed status in shell). This command will end up running
-close on the region hosting regionserver. The close is done without the
-master's involvement (It will not know of the close). Once closed, region will
-stay closed. Use assign to reopen/reassign. Use unassign or move to assign
-the region elsewhere on cluster. Use with caution. For experts only.
-Examples:
-
- hbase> close_region 'REGIONNAME'
- hbase> close_region 'REGIONNAME', 'SERVER_NAME'
- hbase> close_region 'ENCODED_REGIONNAME'
- hbase> close_region 'ENCODED_REGIONNAME', 'SERVER_NAME'
-EOF
- end
-
- def command(region_name, server = nil)
- format_simple_command do
- admin.close_region(region_name, server)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/compact.rb b/quickstart/thirdparty/ruby/shell/commands/compact.rb
deleted file mode 100644
index adeffa2d..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/compact.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Compact < Command
- def help
- return <<-EOF
- Compact all regions in passed table or pass a region row
- to compact an individual region. You can also compact a single column
- family within a region.
- Examples:
- Compact all regions in a table:
- hbase> compact 'ns1:t1'
- hbase> compact 't1'
- Compact an entire region:
- hbase> compact 'r1'
- Compact only a column family within a region:
- hbase> compact 'r1', 'c1'
- Compact a column family within a table:
- hbase> compact 't1', 'c1'
- EOF
- end
-
- def command(table_or_region_name, family = nil)
- format_simple_command do
- admin.compact(table_or_region_name, family)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/compact_rs.rb b/quickstart/thirdparty/ruby/shell/commands/compact_rs.rb
deleted file mode 100644
index 0ecdd211..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/compact_rs.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class CompactRs < Command
- def help
- return <<-EOF
- Compact all regions on passed regionserver.
- Examples:
- Compact all regions on a regionserver:
- hbase> compact_rs 'host187.example.com,60020'
- or
- hbase> compact_rs 'host187.example.com,60020,1289493121758'
- Major compact all regions on a regionserver:
- hbase> compact_rs 'host187.example.com,60020,1289493121758', true
- EOF
- end
-
- def command(regionserver, major = false)
- format_simple_command do
- admin.compact_regionserver(regionserver, major)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/count.rb b/quickstart/thirdparty/ruby/shell/commands/count.rb
deleted file mode 100644
index 225005ee..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/count.rb
+++ /dev/null
@@ -1,77 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Count < Command
- def help
- return <<-EOF
-Count the number of rows in a table. Return value is the number of rows.
-This operation may take a LONG time (Run '$HADOOP_HOME/bin/hadoop jar
-hbase.jar rowcount' to run a counting mapreduce job). Current count is shown
-every 1000 rows by default. Count interval may be optionally specified. Scan
-caching is enabled on count scans by default. Default cache size is 10 rows.
-If your rows are small in size, you may want to increase this
-parameter. Examples:
-
- hbase> count 'ns1:t1'
- hbase> count 't1'
- hbase> count 't1', INTERVAL => 100000
- hbase> count 't1', CACHE => 1000
- hbase> count 't1', INTERVAL => 10, CACHE => 1000
-
-The same commands also can be run on a table reference. Suppose you had a reference
-t to table 't1', the corresponding commands would be:
-
- hbase> t.count
- hbase> t.count INTERVAL => 100000
- hbase> t.count CACHE => 1000
- hbase> t.count INTERVAL => 10, CACHE => 1000
-EOF
- end
-
- def command(table, params = {})
- count(table(table), params)
- end
-
- def count(table, params = {})
- # If the second parameter is an integer, then it is the old command syntax
- params = { 'INTERVAL' => params } if params.kind_of?(Fixnum)
-
- # Merge params with defaults
- params = {
- 'INTERVAL' => 1000,
- 'CACHE' => 10
- }.merge(params)
-
- # Call the counter method
- now = Time.now
- formatter.header
- count = table._count_internal(params['INTERVAL'].to_i, params['CACHE'].to_i) do |cnt, row|
- formatter.row([ "Current count: #{cnt}, row: #{row}" ])
- end
- formatter.footer(now, count)
- return count
- end
- end
- end
-end
-
-#Add the method table.count that calls count.count
-::Hbase::Table.add_shell_command("count")
diff --git a/quickstart/thirdparty/ruby/shell/commands/create.rb b/quickstart/thirdparty/ruby/shell/commands/create.rb
deleted file mode 100644
index a5a125e1..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/create.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Create < Command
- def help
- return <<-EOF
-Creates a table. Pass a table name, and a set of column family
-specifications (at least one), and, optionally, table configuration.
-Column specification can be a simple string (name), or a dictionary
-(dictionaries are described below in main help output), necessarily
-including NAME attribute.
-Examples:
-
-Create a table with namespace=ns1 and table qualifier=t1
- hbase> create 'ns1:t1', {NAME => 'f1', VERSIONS => 5}
-
-Create a table with namespace=default and table qualifier=t1
- hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'}
- hbase> # The above in shorthand would be the following:
- hbase> create 't1', 'f1', 'f2', 'f3'
- hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL => 2592000, BLOCKCACHE => true}
- hbase> create 't1', {NAME => 'f1', CONFIGURATION => {'hbase.hstore.blockingStoreFiles' => '10'}}
-
-Table configuration options can be put at the end.
-Examples:
-
- hbase> create 'ns1:t1', 'f1', SPLITS => ['10', '20', '30', '40']
- hbase> create 't1', 'f1', SPLITS => ['10', '20', '30', '40']
- hbase> create 't1', 'f1', SPLITS_FILE => 'splits.txt', OWNER => 'johndoe'
- hbase> create 't1', {NAME => 'f1', VERSIONS => 5}, METADATA => { 'mykey' => 'myvalue' }
- hbase> # Optionally pre-split the table into NUMREGIONS, using
- hbase> # SPLITALGO ("HexStringSplit", "UniformSplit" or classname)
- hbase> create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit'}
- hbase> create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit', REGION_REPLICATION => 2, CONFIGURATION => {'hbase.hregion.scan.loadColumnFamiliesOnDemand' => 'true'}}
- hbase> create 't1', {NAME => 'f1', DFS_REPLICATION => 1}
-
-You can also keep around a reference to the created table:
-
- hbase> t1 = create 't1', 'f1'
-
-Which gives you a reference to the table named 't1', on which you can then
-call methods.
-EOF
- end
-
- def command(table, *args)
- format_simple_command do
- ret = admin.create(table, *args)
- end
- #and then return the table you just created
- table(table)
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/create_namespace.rb b/quickstart/thirdparty/ruby/shell/commands/create_namespace.rb
deleted file mode 100644
index adb6897b..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/create_namespace.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class CreateNamespace < Command
- def help
- return <<-EOF
-Create namespace; pass namespace name,
-and optionally a dictionary of namespace configuration.
-Examples:
-
- hbase> create_namespace 'ns1'
- hbase> create_namespace 'ns1', {'PROPERTY_NAME'=>'PROPERTY_VALUE'}
-EOF
- end
-
- def command(namespace, *args)
- format_simple_command do
- admin.create_namespace(namespace, *args)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/delete.rb b/quickstart/thirdparty/ruby/shell/commands/delete.rb
deleted file mode 100644
index dcb83414..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/delete.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Delete < Command
- def help
- return <<-EOF
-Put a delete cell value at specified table/row/column and optionally
-timestamp coordinates. Deletes must match the deleted cell's
-coordinates exactly. When scanning, a delete cell suppresses older
-versions. To delete a cell from 't1' at row 'r1' under column 'c1'
-marked with the time 'ts1', do:
-
- hbase> delete 'ns1:t1', 'r1', 'c1', ts1
- hbase> delete 't1', 'r1', 'c1', ts1
- hbase> delete 't1', 'r1', 'c1', ts1, {VISIBILITY=>'PRIVATE|SECRET'}
-
-The same command can also be run on a table reference. Suppose you had a reference
-t to table 't1', the corresponding command would be:
-
- hbase> t.delete 'r1', 'c1', ts1
- hbase> t.delete 'r1', 'c1', ts1, {VISIBILITY=>'PRIVATE|SECRET'}
-EOF
- end
-
- def command(table, row, column,
- timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
- delete(table(table), row, column, timestamp, args)
- end
-
- def delete(table, row, column,
- timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
- format_simple_command do
- table._delete_internal(row, column, timestamp, args)
- end
- end
- end
- end
-end
-
-#Add the method table.delete that calls delete.delete
-::Hbase::Table.add_shell_command("delete")
diff --git a/quickstart/thirdparty/ruby/shell/commands/delete_all_snapshot.rb b/quickstart/thirdparty/ruby/shell/commands/delete_all_snapshot.rb
deleted file mode 100644
index bc072597..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/delete_all_snapshot.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class DeleteAllSnapshot < Command
- def help
- return <<-EOF
-Delete all of the snapshots matching the given regex. Examples:
-
- hbase> delete_all_snapshot 's.*'
-
-EOF
- end
-
- def command(regex)
- formatter.header([ "SNAPSHOT", "TABLE + CREATION TIME"])
- list = admin.list_snapshot(regex)
- count = list.size
- list.each do |snapshot|
- creation_time = Time.at(snapshot.getCreationTime() / 1000).to_s
- formatter.row([ snapshot.getName, snapshot.getTable + " (" + creation_time + ")" ])
- end
- puts "\nDelete the above #{count} snapshots (y/n)?" unless count == 0
- answer = 'n'
- answer = gets.chomp unless count == 0
- puts "No snapshots matched the regex #{regex.to_s}" if count == 0
- return unless answer =~ /y.*/i
- format_simple_command do
- admin.delete_all_snapshot(regex)
- end
- list = admin.list_snapshot(regex)
- leftOverSnapshotCount = list.size
- successfullyDeleted = count - leftOverSnapshotCount
- puts "#{successfullyDeleted} snapshots successfully deleted." unless successfullyDeleted == 0
- return if leftOverSnapshotCount == 0
- puts "\nFailed to delete the below #{leftOverSnapshotCount} snapshots."
- formatter.header([ "SNAPSHOT", "TABLE + CREATION TIME"])
- list.each do |snapshot|
- creation_time = Time.at(snapshot.getCreationTime() / 1000).to_s
- formatter.row([ snapshot.getName, snapshot.getTable + " (" + creation_time + ")" ])
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/delete_snapshot.rb b/quickstart/thirdparty/ruby/shell/commands/delete_snapshot.rb
deleted file mode 100644
index b8c3791a..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/delete_snapshot.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class DeleteSnapshot < Command
- def help
- return <<-EOF
-Delete a specified snapshot. Examples:
-
- hbase> delete_snapshot 'snapshotName',
-EOF
- end
-
- def command(snapshot_name)
- format_simple_command do
- admin.delete_snapshot(snapshot_name)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/delete_table_snapshots.rb b/quickstart/thirdparty/ruby/shell/commands/delete_table_snapshots.rb
deleted file mode 100644
index dc4e0a23..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/delete_table_snapshots.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class DeleteTableSnapshots < Command
- def help
- return <<-EOF
-Delete all of the snapshots matching the given table name regular expression
-and snapshot name regular expression.
-By default snapshot name regular expression will delete all the snapshots of the
-matching table name regular expression.
-
-Examples:
- hbase> delete_table_snapshots 'tableName'
- hbase> delete_table_snapshots 'tableName.*'
- hbase> delete_table_snapshots 'tableName', 'snapshotName'
- hbase> delete_table_snapshots 'tableName', 'snapshotName.*'
- hbase> delete_table_snapshots 'tableName.*', 'snapshotName.*'
- hbase> delete_table_snapshots 'ns:tableName.*', 'snapshotName.*'
-
-EOF
- end
-
- def command(tableNameregex, snapshotNameRegex = ".*")
- formatter.header([ "SNAPSHOT", "TABLE + CREATION TIME"])
- list = admin.list_table_snapshots(tableNameregex, snapshotNameRegex)
- count = list.size
- list.each do |snapshot|
- creation_time = Time.at(snapshot.getCreationTime() / 1000).to_s
- formatter.row([ snapshot.getName, snapshot.getTable + " (" + creation_time + ")" ])
- end
- puts "\nDelete the above #{count} snapshots (y/n)?" unless count == 0
- answer = 'n'
- answer = gets.chomp unless count == 0
- puts "No snapshots matched the table name regular expression #{tableNameregex.to_s} and the snapshot name regular expression #{snapshotNameRegex.to_s}" if count == 0
- return unless answer =~ /y.*/i
-
- format_simple_command do
- list.each do |deleteSnapshot|
- begin
- admin.delete_snapshot(deleteSnapshot.getName)
- puts "Successfully deleted snapshot: #{deleteSnapshot.getName}"
- puts "\n"
- rescue RuntimeError
- puts "Failed to delete snapshot: #{deleteSnapshot.getName}, due to below exception,\n" + $!
- puts "\n"
- end
- end
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/deleteall.rb b/quickstart/thirdparty/ruby/shell/commands/deleteall.rb
deleted file mode 100644
index e6118c91..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/deleteall.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Deleteall < Command
- def help
- return <<-EOF
-Delete all cells in a given row; pass a table name, row, and optionally
-a column and timestamp. Examples:
-
- hbase> deleteall 'ns1:t1', 'r1'
- hbase> deleteall 't1', 'r1'
- hbase> deleteall 't1', 'r1', 'c1'
- hbase> deleteall 't1', 'r1', 'c1', ts1
- hbase> deleteall 't1', 'r1', 'c1', ts1, {VISIBILITY=>'PRIVATE|SECRET'}
-
-The same commands also can be run on a table reference. Suppose you had a reference
-t to table 't1', the corresponding command would be:
-
- hbase> t.deleteall 'r1'
- hbase> t.deleteall 'r1', 'c1'
- hbase> t.deleteall 'r1', 'c1', ts1
- hbase> t.deleteall 'r1', 'c1', ts1, {VISIBILITY=>'PRIVATE|SECRET'}
-EOF
- end
-
- def command(table, row, column = nil,
- timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
- deleteall(table(table), row, column, timestamp, args)
- end
-
- def deleteall(table, row, column = nil,
- timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
- format_simple_command do
- table._deleteall_internal(row, column, timestamp, args)
- end
- end
- end
- end
-end
-
-#Add the method table.deleteall that calls deleteall.deleteall
-::Hbase::Table.add_shell_command("deleteall")
diff --git a/quickstart/thirdparty/ruby/shell/commands/describe.rb b/quickstart/thirdparty/ruby/shell/commands/describe.rb
deleted file mode 100644
index bfa16cdc..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/describe.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Describe < Command
- def help
- return <<-EOF
-Describe the named table. For example:
- hbase> describe 't1'
- hbase> describe 'ns1:t1'
-
-Alternatively, you can use the abbreviated 'desc' for the same thing.
- hbase> desc 't1'
- hbase> desc 'ns1:t1'
-EOF
- end
-
- def command(table)
- now = Time.now
-
- column_families = admin.get_column_families(table)
-
- formatter.header(["Table " + table.to_s + " is " + if admin.enabled?(table) then "ENABLED" else "DISABLED" end])
- formatter.row([table.to_s + admin.get_table_attributes(table)], true)
- formatter.header(["COLUMN FAMILIES DESCRIPTION"])
- column_families.each do |column_family|
- formatter.row([ column_family.to_s ], true)
- end
- formatter.footer(now)
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/describe_namespace.rb b/quickstart/thirdparty/ruby/shell/commands/describe_namespace.rb
deleted file mode 100644
index cf135da5..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/describe_namespace.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class DescribeNamespace < Command
- def help
- return <<-EOF
-Describe the named namespace. For example:
- hbase> describe_namespace 'ns1'
-EOF
- end
-
- def command(namespace)
- now = Time.now
-
- desc = admin.describe_namespace(namespace)
-
- formatter.header([ "DESCRIPTION" ], [ 64 ])
- formatter.row([ desc ], true, [ 64 ])
- formatter.footer(now)
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/disable.rb b/quickstart/thirdparty/ruby/shell/commands/disable.rb
deleted file mode 100644
index 79bcd864..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/disable.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Disable < Command
- def help
- return <<-EOF
-Start disable of named table:
- hbase> disable 't1'
- hbase> disable 'ns1:t1'
-EOF
- end
-
- def command(table)
- format_simple_command do
- admin.disable(table)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/disable_all.rb b/quickstart/thirdparty/ruby/shell/commands/disable_all.rb
deleted file mode 100644
index 212db249..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/disable_all.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class DisableAll < Command
- def help
- return <<-EOF
-Disable all of tables matching the given regex:
-
-hbase> disable_all 't.*'
-hbase> disable_all 'ns:t.*'
-hbase> disable_all 'ns:.*'
-EOF
- end
-
- def command(regex)
- list = admin.list(regex)
- count = list.size
- list.each do |table|
- formatter.row([ table ])
- end
- puts "\nDisable the above #{count} tables (y/n)?" unless count == 0
- answer = 'n'
- answer = gets.chomp unless count == 0
- puts "No tables matched the regex #{regex.to_s}" if count == 0
- return unless answer =~ /y.*/i
- failed = admin.disable_all(regex)
- puts "#{count - failed.size} tables successfully disabled"
- puts "#{failed.size} tables not disabled due to an exception: #{failed.join ','}" unless failed.size == 0
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/disable_peer.rb b/quickstart/thirdparty/ruby/shell/commands/disable_peer.rb
deleted file mode 100644
index 416545b2..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/disable_peer.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class DisablePeer< Command
- def help
- return <<-EOF
-Stops the replication stream to the specified cluster, but still
-keeps track of new edits to replicate.
-
-Examples:
-
- hbase> disable_peer '1'
-EOF
- end
-
- def command(id)
- format_simple_command do
- replication_admin.disable_peer(id)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/disable_table_replication.rb b/quickstart/thirdparty/ruby/shell/commands/disable_table_replication.rb
deleted file mode 100644
index 5bf96679..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/disable_table_replication.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class DisableTableReplication< Command
- def help
- return <<-EOF
-Disable a table's replication switch.
-
-Examples:
-
- hbase> disable_table_replication 'table_name'
-EOF
- end
-
- def command(table_name)
- format_simple_command do
- replication_admin.disable_tablerep(table_name)
- end
- puts "The replication swith of table '#{table_name}' successfully disabled"
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/drop.rb b/quickstart/thirdparty/ruby/shell/commands/drop.rb
deleted file mode 100644
index fc7b1344..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/drop.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Drop < Command
- def help
- return <<-EOF
-Drop the named table. Table must first be disabled:
- hbase> drop 't1'
- hbase> drop 'ns1:t1'
-EOF
- end
-
- def command(table)
- format_simple_command do
- admin.drop(table)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/drop_all.rb b/quickstart/thirdparty/ruby/shell/commands/drop_all.rb
deleted file mode 100644
index 73398fbf..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/drop_all.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class DropAll < Command
- def help
- return <<-EOF
-Drop all of the tables matching the given regex:
-
-hbase> drop_all 't.*'
-hbase> drop_all 'ns:t.*'
-hbase> drop_all 'ns:.*'
-EOF
- end
-
- def command(regex)
- list = admin.list(regex)
- count = list.size
- list.each do |table|
- formatter.row([ table ])
- end
- puts "\nDrop the above #{count} tables (y/n)?" unless count == 0
- answer = 'n'
- answer = gets.chomp unless count == 0
- puts "No tables matched the regex #{regex.to_s}" if count == 0
- return unless answer =~ /y.*/i
- failed = admin.drop_all(regex)
- puts "#{count - failed.size} tables successfully dropped"
- puts "#{failed.size} tables not dropped due to an exception: #{failed.join ','}" unless failed.size == 0
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/drop_namespace.rb b/quickstart/thirdparty/ruby/shell/commands/drop_namespace.rb
deleted file mode 100644
index b030d279..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/drop_namespace.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class DropNamespace < Command
- def help
- return <<-EOF
-Drop the named namespace. The namespace must be empty.
-EOF
- end
-
- def command(namespace)
- format_simple_command do
- admin.drop_namespace(namespace)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/enable.rb b/quickstart/thirdparty/ruby/shell/commands/enable.rb
deleted file mode 100644
index deeb70cc..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/enable.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Enable < Command
- def help
- return <<-EOF
-Start enable of named table:
- hbase> enable 't1'
- hbase> enable 'ns1:t1'
-EOF
- end
-
- def command(table)
- format_simple_command do
- admin.enable(table)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/enable_all.rb b/quickstart/thirdparty/ruby/shell/commands/enable_all.rb
deleted file mode 100644
index 2b899f2a..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/enable_all.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class EnableAll < Command
- def help
- return <<-EOF
-Enable all of the tables matching the given regex:
-
-hbase> enable_all 't.*'
-hbase> enable_all 'ns:t.*'
-hbase> enable_all 'ns:.*'
-EOF
- end
-
- def command(regex)
- list = admin.list(regex)
- count = list.size
- list.each do |table|
- formatter.row([ table ])
- end
- puts "\nEnable the above #{count} tables (y/n)?" unless count == 0
- answer = 'n'
- answer = gets.chomp unless count == 0
- puts "No tables matched the regex #{regex.to_s}" if count == 0
- return unless answer =~ /y.*/i
- failed = admin.enable_all(regex)
- puts "#{count - failed.size} tables successfully enabled"
- puts "#{failed.size} tables not enabled due to an exception: #{failed.join ','}" unless failed.size == 0
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/enable_peer.rb b/quickstart/thirdparty/ruby/shell/commands/enable_peer.rb
deleted file mode 100644
index 55136ffb..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/enable_peer.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class EnablePeer< Command
- def help
- return <<-EOF
-Restarts the replication to the specified peer cluster,
-continuing from where it was disabled.
-
-Examples:
-
- hbase> enable_peer '1'
-EOF
- end
-
- def command(id)
- format_simple_command do
- replication_admin.enable_peer(id)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/enable_table_replication.rb b/quickstart/thirdparty/ruby/shell/commands/enable_table_replication.rb
deleted file mode 100644
index 15e3133a..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/enable_table_replication.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class EnableTableReplication< Command
- def help
- return <<-EOF
-Enable a table's replication switch.
-
-Examples:
-
- hbase> enable_table_replication 'table_name'
-EOF
- end
-
- def command(table_name)
- format_simple_command do
- replication_admin.enable_tablerep(table_name)
- end
- puts "The replication swith of table '#{table_name}' successfully enabled"
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/exists.rb b/quickstart/thirdparty/ruby/shell/commands/exists.rb
deleted file mode 100644
index bacf6c94..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/exists.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Exists < Command
- def help
- return <<-EOF
-Does the named table exist?
- hbase> exists 't1'
- hbase> exists 'ns1:t1'
-EOF
- end
-
- def command(table)
- format_simple_command do
- formatter.row([
- "Table #{table} " + (admin.exists?(table.to_s) ? "does exist" : "does not exist")
- ])
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/flush.rb b/quickstart/thirdparty/ruby/shell/commands/flush.rb
deleted file mode 100644
index 2aefec52..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/flush.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Flush < Command
- def help
- return <<-EOF
-Flush all regions in passed table or pass a region row to
-flush an individual region. For example:
-
- hbase> flush 'TABLENAME'
- hbase> flush 'REGIONNAME'
- hbase> flush 'ENCODED_REGIONNAME'
-EOF
- end
-
- def command(table_or_region_name)
- format_simple_command do
- admin.flush(table_or_region_name)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/get.rb b/quickstart/thirdparty/ruby/shell/commands/get.rb
deleted file mode 100644
index b8bfd520..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/get.rb
+++ /dev/null
@@ -1,98 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Get < Command
- def help
- return <<-EOF
-Get row or cell contents; pass table name, row, and optionally
-a dictionary of column(s), timestamp, timerange and versions. Examples:
-
- hbase> get 'ns1:t1', 'r1'
- hbase> get 't1', 'r1'
- hbase> get 't1', 'r1', {TIMERANGE => [ts1, ts2]}
- hbase> get 't1', 'r1', {COLUMN => 'c1'}
- hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']}
- hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1}
- hbase> get 't1', 'r1', {COLUMN => 'c1', TIMERANGE => [ts1, ts2], VERSIONS => 4}
- hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4}
- hbase> get 't1', 'r1', {FILTER => "ValueFilter(=, 'binary:abc')"}
- hbase> get 't1', 'r1', 'c1'
- hbase> get 't1', 'r1', 'c1', 'c2'
- hbase> get 't1', 'r1', ['c1', 'c2']
- hbase> get 't1', 'r1', {COLUMN => 'c1', ATTRIBUTES => {'mykey'=>'myvalue'}}
- hbase> get 't1', 'r1', {COLUMN => 'c1', AUTHORIZATIONS => ['PRIVATE','SECRET']}
- hbase> get 't1', 'r1', {CONSISTENCY => 'TIMELINE'}
- hbase> get 't1', 'r1', {CONSISTENCY => 'TIMELINE', REGION_REPLICA_ID => 1}
-
-Besides the default 'toStringBinary' format, 'get' also supports custom formatting by
-column. A user can define a FORMATTER by adding it to the column name in the get
-specification. The FORMATTER can be stipulated:
-
- 1. either as a org.apache.hadoop.hbase.util.Bytes method name (e.g, toInt, toString)
- 2. or as a custom class followed by method name: e.g. 'c(MyFormatterClass).format'.
-
-Example formatting cf:qualifier1 and cf:qualifier2 both as Integers:
- hbase> get 't1', 'r1' {COLUMN => ['cf:qualifier1:toInt',
- 'cf:qualifier2:c(org.apache.hadoop.hbase.util.Bytes).toInt'] }
-
-Note that you can specify a FORMATTER by column only (cf:qualifier). You cannot specify
-a FORMATTER for all columns of a column family.
-
-The same commands also can be run on a reference to a table (obtained via get_table or
-create_table). Suppose you had a reference t to table 't1', the corresponding commands
-would be:
-
- hbase> t.get 'r1'
- hbase> t.get 'r1', {TIMERANGE => [ts1, ts2]}
- hbase> t.get 'r1', {COLUMN => 'c1'}
- hbase> t.get 'r1', {COLUMN => ['c1', 'c2', 'c3']}
- hbase> t.get 'r1', {COLUMN => 'c1', TIMESTAMP => ts1}
- hbase> t.get 'r1', {COLUMN => 'c1', TIMERANGE => [ts1, ts2], VERSIONS => 4}
- hbase> t.get 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4}
- hbase> t.get 'r1', {FILTER => "ValueFilter(=, 'binary:abc')"}
- hbase> t.get 'r1', 'c1'
- hbase> t.get 'r1', 'c1', 'c2'
- hbase> t.get 'r1', ['c1', 'c2']
- hbase> t.get 'r1', {CONSISTENCY => 'TIMELINE'}
- hbase> t.get 'r1', {CONSISTENCY => 'TIMELINE', REGION_REPLICA_ID => 1}
-EOF
- end
-
- def command(table, row, *args)
- get(table(table), row, *args)
- end
-
- def get(table, row, *args)
- now = Time.now
- formatter.header(["COLUMN", "CELL"])
-
- count, is_stale = table._get_internal(row, *args) do |column, value|
- formatter.row([ column, value ])
- end
-
- formatter.footer(now, count, is_stale)
- end
- end
- end
-end
-
-#add get command to table
-::Hbase::Table.add_shell_command('get')
diff --git a/quickstart/thirdparty/ruby/shell/commands/get_auths.rb b/quickstart/thirdparty/ruby/shell/commands/get_auths.rb
deleted file mode 100644
index 1b758ef9..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/get_auths.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class GetAuths < Command
- def help
- return <<-EOF
-Get the visibility labels set for a particular user or group
-Syntax : get_auths 'user'
-
-For example:
-
- hbase> get_auths 'user1'
- hbase> get_auths '@group1'
-EOF
- end
-
- def command(user)
- format_simple_command do
- list = visibility_labels_admin.get_auths(user)
- list.each do |auths|
- formatter.row([org.apache.hadoop.hbase.util.Bytes::toStringBinary(auths.toByteArray)])
- end
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/get_counter.rb b/quickstart/thirdparty/ruby/shell/commands/get_counter.rb
deleted file mode 100644
index 6708c6a5..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/get_counter.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class GetCounter < Command
- def help
- return <<-EOF
-Return a counter cell value at specified table/row/column coordinates.
-A counter cell should be managed with atomic increment functions on HBase
-and the data should be binary encoded (as long value). Example:
-
- hbase> get_counter 'ns1:t1', 'r1', 'c1'
- hbase> get_counter 't1', 'r1', 'c1'
-
-The same commands also can be run on a table reference. Suppose you had a reference
-t to table 't1', the corresponding command would be:
-
- hbase> t.get_counter 'r1', 'c1'
-EOF
- end
-
- def command(table, row, column)
- get_counter(table(table), row, column)
- end
-
- def get_counter(table, row, column)
- if cnt = table._get_counter_internal(row, column)
- puts "COUNTER VALUE = #{cnt}"
- else
- puts "No counter found at specified coordinates"
- end
- end
- end
- end
-end
-
-::Hbase::Table.add_shell_command('get_counter')
diff --git a/quickstart/thirdparty/ruby/shell/commands/get_peer_config.rb b/quickstart/thirdparty/ruby/shell/commands/get_peer_config.rb
deleted file mode 100644
index ee02229c..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/get_peer_config.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class GetPeerConfig < Command
- def help
- return <<-EOF
- Outputs the cluster key, replication endpoint class (if present), and any replication configuration parameters
- EOF
- end
-
- def command(id)
- peer_config = replication_admin.get_peer_config(id)
- format_simple_command do
- format_peer_config(peer_config)
- end
- end
-
- def format_peer_config(peer_config)
- cluster_key = peer_config.get_cluster_key
- endpoint = peer_config.get_replication_endpoint_impl
-
- unless cluster_key.nil?
- formatter.row(["Cluster Key", cluster_key])
- end
- unless endpoint.nil?
- formatter.row(["Replication Endpoint", endpoint])
- end
- unless peer_config.get_configuration.nil?
- peer_config.get_configuration.each do |config_entry|
- formatter.row(config_entry)
- end
- end
-
- end
- end
- end
-end
\ No newline at end of file
diff --git a/quickstart/thirdparty/ruby/shell/commands/get_splits.rb b/quickstart/thirdparty/ruby/shell/commands/get_splits.rb
deleted file mode 100644
index 8b6ae825..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/get_splits.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class GetSplits < Command
- def help
- return <<-EOF
-Get the splits of the named table:
- hbase> get_splits 't1'
- hbase> get_splits 'ns1:t1'
-
-The same commands also can be run on a table reference. Suppose you had a reference
-t to table 't1', the corresponding command would be:
-
- hbase> t.get_splits
-EOF
- end
-
- def command(table)
- get_splits(table(table))
- end
-
- def get_splits(table)
- table._get_splits_internal()
- end
- end
- end
-end
-
-::Hbase::Table.add_shell_command("get_splits")
\ No newline at end of file
diff --git a/quickstart/thirdparty/ruby/shell/commands/get_table.rb b/quickstart/thirdparty/ruby/shell/commands/get_table.rb
deleted file mode 100644
index 43e7c1af..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/get_table.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class GetTable < Command
- def help
- return <<-EOF
-Get the given table name and return it as an actual object to
-be manipulated by the user. See table.help for more information
-on how to use the table.
-Eg.
-
- hbase> t1 = get_table 't1'
- hbase> t1 = get_table 'ns1:t1'
-
-returns the table named 't1' as a table object. You can then do
-
- hbase> t1.help
-
-which will then print the help for that table.
-EOF
- end
-
- def command(table, *args)
- format_and_return_simple_command do
- table(table)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/grant.rb b/quickstart/thirdparty/ruby/shell/commands/grant.rb
deleted file mode 100644
index 78800264..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/grant.rb
+++ /dev/null
@@ -1,118 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Grant < Command
- def help
- return <<-EOF
-Grant users specific rights.
-Syntax : grant , [, <@namespace> [, [, [, ]]]
-
-permissions is either zero or more letters from the set "RWXCA".
-READ('R'), WRITE('W'), EXEC('X'), CREATE('C'), ADMIN('A')
-
-Note: Groups and users are granted access in the same way, but groups are prefixed with an '@'
- character. In the same way, tables and namespaces are specified, but namespaces are
- prefixed with an '@' character.
-
-For example:
-
- hbase> grant 'bobsmith', 'RWXCA'
- hbase> grant '@admins', 'RWXCA'
- hbase> grant 'bobsmith', 'RWXCA', '@ns1'
- hbase> grant 'bobsmith', 'RW', 't1', 'f1', 'col1'
- hbase> grant 'bobsmith', 'RW', 'ns1:t1', 'f1', 'col1'
-EOF
- end
-
- def command(*args)
-
- # command form is ambiguous at first argument
- table_name = user = args[0]
- raise(ArgumentError, "First argument should be a String") unless user.kind_of?(String)
-
- if args[1].kind_of?(String)
-
- # Original form of the command
- # user in args[0]
- # permissions in args[1]
- # table_name in args[2]
- # family in args[3] or nil
- # qualifier in args[4] or nil
-
- permissions = args[1]
- raise(ArgumentError, "Permissions are not of String type") unless permissions.kind_of?(
- String)
- table_name = family = qualifier = nil
- table_name = args[2] # will be nil if unset
- if not table_name.nil?
- raise(ArgumentError, "Table name is not of String type") unless table_name.kind_of?(
- String)
- family = args[3] # will be nil if unset
- if not family.nil?
- raise(ArgumentError, "Family is not of String type") unless family.kind_of?(String)
- qualifier = args[4] # will be nil if unset
- if not qualifier.nil?
- raise(ArgumentError, "Qualifier is not of String type") unless qualifier.kind_of?(
- String)
- end
- end
- end
- format_simple_command do
- security_admin.grant(user, permissions, table_name, family, qualifier)
- end
-
- elsif args[1].kind_of?(Hash)
-
- # New form of the command, a cell ACL update
- # table_name in args[0], a string
- # a Hash mapping users (or groups) to permisisons in args[1]
- # a Hash argument suitable for passing to Table#_get_scanner in args[2]
- # Useful for feature testing and debugging.
-
- permissions = args[1]
- raise(ArgumentError, "Permissions are not of Hash type") unless permissions.kind_of?(Hash)
- scan = args[2]
- raise(ArgumentError, "Scanner specification is not a Hash") unless scan.kind_of?(Hash)
-
- t = table(table_name)
- now = Time.now
- scanner = t._get_scanner(scan)
- count = 0
- iter = scanner.iterator
- while iter.hasNext
- row = iter.next
- row.list.each do |cell|
- put = org.apache.hadoop.hbase.client.Put.new(row.getRow)
- put.add(cell)
- t.set_cell_permissions(put, permissions)
- t.table.put(put)
- end
- count += 1
- end
- formatter.footer(now, count)
-
- else
- raise(ArgumentError, "Second argument should be a String or Hash")
- end
-
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/incr.rb b/quickstart/thirdparty/ruby/shell/commands/incr.rb
deleted file mode 100644
index d223a45a..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/incr.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Incr < Command
- def help
- return <<-EOF
-Increments a cell 'value' at specified table/row/column coordinates.
-To increment a cell value in table 'ns1:t1' or 't1' at row 'r1' under column
-'c1' by 1 (can be omitted) or 10 do:
-
- hbase> incr 'ns1:t1', 'r1', 'c1'
- hbase> incr 't1', 'r1', 'c1'
- hbase> incr 't1', 'r1', 'c1', 1
- hbase> incr 't1', 'r1', 'c1', 10
- hbase> incr 't1', 'r1', 'c1', 10, {ATTRIBUTES=>{'mykey'=>'myvalue'}}
- hbase> incr 't1', 'r1', 'c1', {ATTRIBUTES=>{'mykey'=>'myvalue'}}
- hbase> incr 't1', 'r1', 'c1', 10, {VISIBILITY=>'PRIVATE|SECRET'}
-
-The same commands also can be run on a table reference. Suppose you had a reference
-t to table 't1', the corresponding command would be:
-
- hbase> t.incr 'r1', 'c1'
- hbase> t.incr 'r1', 'c1', 1
- hbase> t.incr 'r1', 'c1', 10, {ATTRIBUTES=>{'mykey'=>'myvalue'}}
- hbase> t.incr 'r1', 'c1', 10, {VISIBILITY=>'PRIVATE|SECRET'}
-EOF
- end
-
- def command(table, row, column, value = nil, args = {})
- incr(table(table), row, column, value, args)
- end
-
- def incr(table, row, column, value = nil, args={})
- format_simple_command do
- if cnt = table._incr_internal(row, column, value, args)
- puts "COUNTER VALUE = #{cnt}"
- else
- puts "No counter found at specified coordinates"
- end
- end
- end
- end
- end
-end
-
-#add incr comamnd to Table
-::Hbase::Table.add_shell_command("incr")
diff --git a/quickstart/thirdparty/ruby/shell/commands/is_disabled.rb b/quickstart/thirdparty/ruby/shell/commands/is_disabled.rb
deleted file mode 100644
index 6da7046b..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/is_disabled.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class IsDisabled < Command
- def help
- return <<-EOF
-Is named table disabled? For example:
- hbase> is_disabled 't1'
- hbase> is_disabled 'ns1:t1'
-EOF
- end
-
- def command(table)
- format_simple_command do
- formatter.row([
- admin.disabled?(table)? "true" : "false"
- ])
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/is_enabled.rb b/quickstart/thirdparty/ruby/shell/commands/is_enabled.rb
deleted file mode 100644
index 960ade75..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/is_enabled.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class IsEnabled < Command
- def help
- return <<-EOF
-Is named table enabled? For example:
- hbase> is_enabled 't1'
- hbase> is_enabled 'ns1:t1'
-EOF
- end
-
- def command(table)
- format_simple_command do
- formatter.row([
- admin.enabled?(table)? "true" : "false"
- ])
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/list.rb b/quickstart/thirdparty/ruby/shell/commands/list.rb
deleted file mode 100644
index dce0ae2a..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/list.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class List < Command
- def help
- return <<-EOF
-List all tables in hbase. Optional regular expression parameter could
-be used to filter the output. Examples:
-
- hbase> list
- hbase> list 'abc.*'
- hbase> list 'ns:abc.*'
- hbase> list 'ns:.*'
-EOF
- end
-
- def command(regex = ".*")
- now = Time.now
- formatter.header([ "TABLE" ])
-
- list = admin.list(regex)
- list.each do |table|
- formatter.row([ table ])
- end
-
- formatter.footer(now, list.size)
- return list
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/list_labels.rb b/quickstart/thirdparty/ruby/shell/commands/list_labels.rb
deleted file mode 100644
index 6c7f9913..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/list_labels.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class ListLabels < Command
- def help
- return <<-EOF
-List the visibility labels defined in the system.
-Optional regular expression parameter could be used to filter the labels being returned.
-Syntax : list_labels
-
-For example:
-
- hbase> list_labels 'secret.*'
- hbase> list_labels
-EOF
- end
-
- def command(regex = ".*")
- format_simple_command do
- list = visibility_labels_admin.list_labels(regex)
- list.each do |label|
- formatter.row([org.apache.hadoop.hbase.util.Bytes::toStringBinary(label.toByteArray)])
- end
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/list_namespace.rb b/quickstart/thirdparty/ruby/shell/commands/list_namespace.rb
deleted file mode 100644
index 5d25604a..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/list_namespace.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class ListNamespace < Command
- def help
- return <<-EOF
-List all namespaces in hbase. Optional regular expression parameter could
-be used to filter the output. Examples:
-
- hbase> list_namespace
- hbase> list_namespace 'abc.*'
-EOF
- end
-
- def command(regex = ".*")
- now = Time.now
- formatter.header([ "NAMESPACE" ])
-
- list = admin.list_namespace(regex)
- list.each do |table|
- formatter.row([ table ])
- end
-
- formatter.footer(now, list.size)
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/list_namespace_tables.rb b/quickstart/thirdparty/ruby/shell/commands/list_namespace_tables.rb
deleted file mode 100644
index 29e18123..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/list_namespace_tables.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class ListNamespaceTables < Command
- def help
- return <<-EOF
-List all tables that are members of the namespace.
-Examples:
-
- hbase> list_namespace_tables 'ns1'
-EOF
- end
-
- def command(namespace)
- now = Time.now
- formatter.header([ "TABLE" ])
-
- list = admin.list_namespace_tables(namespace)
- list.each do |table|
- formatter.row([ table ])
- end
-
- formatter.footer(now, list.size)
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/list_peer_configs.rb b/quickstart/thirdparty/ruby/shell/commands/list_peer_configs.rb
deleted file mode 100644
index fc6e4a78..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/list_peer_configs.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class ListPeerConfigs < Command
- def help
- return <<-EOF
- No-argument method that outputs the replication peer configuration for each peer defined on this cluster.
- EOF
- end
-
- def command
- format_simple_command do
- peer_configs = replication_admin.list_peer_configs
- unless peer_configs.nil?
- peer_configs.each do |peer_config_entry|
- peer_id = peer_config_entry[0]
- peer_config = peer_config_entry[1]
- formatter.row(["PeerId", peer_id])
- GetPeerConfig.new(@shell).format_peer_config(peer_config)
- formatter.row([" "])
- end
- end
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/list_peers.rb b/quickstart/thirdparty/ruby/shell/commands/list_peers.rb
deleted file mode 100644
index cc1be044..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/list_peers.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Copyright The Apache Software Foundation
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class ListPeers< Command
- def help
- return <<-EOF
-List all replication peer clusters.
-
- hbase> list_peers
-EOF
- end
-
- def command()
- now = Time.now
- peers = replication_admin.list_peers
-
- formatter.header(["PEER_ID", "CLUSTER_KEY", "STATE", "TABLE_CFS"])
-
- peers.entrySet().each do |e|
- state = replication_admin.get_peer_state(e.key)
- tableCFs = replication_admin.show_peer_tableCFs(e.key)
- formatter.row([ e.key, e.value, state, tableCFs ])
- end
-
- formatter.footer(now)
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/list_procedures.rb b/quickstart/thirdparty/ruby/shell/commands/list_procedures.rb
deleted file mode 100644
index f407547f..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/list_procedures.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class ListProcedures < Command
- def help
- return <<-EOF
-List all procedures in hbase. Examples:
-
- hbase> list_procedures
-EOF
- end
-
- def command()
- now = Time.now
- formatter.header([ "Id", "Name", "State", "Start_Time", "Last_Update" ])
-
- list = admin.list_procedures()
- list.each do |proc|
- start_time = Time.at(proc.getStartTime / 1000).to_s
- last_update = Time.at(proc.getLastUpdate / 1000).to_s
- formatter.row([ proc.getProcId, proc.getProcName, proc.getProcState, start_time, last_update ])
- end
-
- formatter.footer(now, list.size)
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/list_quotas.rb b/quickstart/thirdparty/ruby/shell/commands/list_quotas.rb
deleted file mode 100644
index 682bb719..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/list_quotas.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class ListQuotas < Command
- def help
- return <<-EOF
-List the quota settings added to the system.
-You can filter the result based on USER, TABLE, or NAMESPACE.
-
-For example:
-
- hbase> list_quotas
- hbase> list_quotas USER => 'bob.*'
- hbase> list_quotas USER => 'bob.*', TABLE => 't1'
- hbase> list_quotas USER => 'bob.*', NAMESPACE => 'ns.*'
- hbase> list_quotas TABLE => 'myTable'
- hbase> list_quotas NAMESPACE => 'ns.*'
-EOF
- end
-
- def command(args = {})
- now = Time.now
- formatter.header(["OWNER", "QUOTAS"])
-
- #actually do the scanning
- count = quotas_admin.list_quotas(args) do |row, cells|
- formatter.row([ row, cells ])
- end
-
- formatter.footer(now, count)
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/list_replicated_tables.rb b/quickstart/thirdparty/ruby/shell/commands/list_replicated_tables.rb
deleted file mode 100644
index 0db1d83a..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/list_replicated_tables.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# Copyright The Apache Software Foundation
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class ListReplicatedTables< Command
- def help
- return <<-EOF
-List all the tables and column families replicated from this cluster
-
- hbase> list_replicated_tables
- hbase> list_replicated_tables 'abc.*'
-EOF
- end
-
- def command(regex = ".*")
- now = Time.now
-
- formatter.header([ "TABLE:COLUMNFAMILY", "ReplicationType" ], [ 32 ])
- list = replication_admin.list_replicated_tables(regex)
- list.each do |e|
- if e.get(org.apache.hadoop.hbase.client.replication.ReplicationAdmin::REPLICATIONTYPE) == org.apache.hadoop.hbase.client.replication.ReplicationAdmin::REPLICATIONGLOBAL
- replicateType = "GLOBAL"
- else
- replicateType = "unknown"
- end
- formatter.row([e.get(org.apache.hadoop.hbase.client.replication.ReplicationAdmin::TNAME) + ":" + e.get(org.apache.hadoop.hbase.client.replication.ReplicationAdmin::CFNAME), replicateType], true, [32])
- end
- formatter.footer(now)
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/list_security_capabilities.rb b/quickstart/thirdparty/ruby/shell/commands/list_security_capabilities.rb
deleted file mode 100644
index 922ad11a..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/list_security_capabilities.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class ListSecurityCapabilities < Command
- def help
- return <<-EOF
-List supported security capabilities
-
-Example:
- hbase> list_security_capabilities
-EOF
- end
-
- def command()
- begin
- list = admin.get_security_capabilities
- list.each do |s|
- puts s.getName
- end
- return list.map { |s| s.getName() }
- rescue Exception => e
- if e.to_s.include? "UnsupportedOperationException"
- puts "ERROR: Master does not support getSecurityCapabilities"
- return []
- end
- raise e
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/list_snapshots.rb b/quickstart/thirdparty/ruby/shell/commands/list_snapshots.rb
deleted file mode 100644
index 4e68802f..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/list_snapshots.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require 'time'
-
-module Shell
- module Commands
- class ListSnapshots < Command
- def help
- return <<-EOF
-List all snapshots taken (by printing the names and relative information).
-Optional regular expression parameter could be used to filter the output
-by snapshot name.
-
-Examples:
- hbase> list_snapshots
- hbase> list_snapshots 'abc.*'
-EOF
- end
-
- def command(regex = ".*")
- now = Time.now
- formatter.header([ "SNAPSHOT", "TABLE + CREATION TIME"])
-
- list = admin.list_snapshot(regex)
- list.each do |snapshot|
- creation_time = Time.at(snapshot.getCreationTime() / 1000).to_s
- formatter.row([ snapshot.getName, snapshot.getTable + " (" + creation_time + ")" ])
- end
-
- formatter.footer(now, list.size)
- return list.map { |s| s.getName() }
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/list_table_snapshots.rb b/quickstart/thirdparty/ruby/shell/commands/list_table_snapshots.rb
deleted file mode 100644
index 3a32e9e3..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/list_table_snapshots.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require 'time'
-
-module Shell
- module Commands
- class ListTableSnapshots < Command
- def help
- return <<-EOF
-List all completed snapshots matching the table name regular expression and the
-snapshot name regular expression (by printing the names and relative information).
-Optional snapshot name regular expression parameter could be used to filter the output
-by snapshot name.
-
-Examples:
- hbase> list_table_snapshots 'tableName'
- hbase> list_table_snapshots 'tableName.*'
- hbase> list_table_snapshots 'tableName', 'snapshotName'
- hbase> list_table_snapshots 'tableName', 'snapshotName.*'
- hbase> list_table_snapshots 'tableName.*', 'snapshotName.*'
- hbase> list_table_snapshots 'ns:tableName.*', 'snapshotName.*'
-EOF
- end
-
- def command(tableNameRegex, snapshotNameRegex = ".*")
- now = Time.now
- formatter.header([ "SNAPSHOT", "TABLE + CREATION TIME"])
-
- list = admin.list_table_snapshots(tableNameRegex, snapshotNameRegex)
- list.each do |snapshot|
- creation_time = Time.at(snapshot.getCreationTime() / 1000).to_s
- formatter.row([ snapshot.getName, snapshot.getTable + " (" + creation_time + ")" ])
- end
-
- formatter.footer(now, list.size)
- return list.map { |s| s.getName() }
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/locate_region.rb b/quickstart/thirdparty/ruby/shell/commands/locate_region.rb
deleted file mode 100644
index b1e8c7bf..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/locate_region.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Copyright The Apache Software Foundation
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class LocateRegion < Command
- def help
- return <<-EOF
-Locate the region given a table name and a row-key
-
- hbase> locate_region 'tableName', 'key0'
-EOF
- end
-
- def command(table, row_key)
- now = Time.now
-
- region_location = admin.locate_region(table, row_key)
- hri = region_location.getRegionInfo()
-
- formatter.header([ "HOST", "REGION" ])
- formatter.row([region_location.getHostnamePort(), hri.toString()])
- formatter.footer(now, 1)
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/major_compact.rb b/quickstart/thirdparty/ruby/shell/commands/major_compact.rb
deleted file mode 100644
index 82574833..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/major_compact.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class MajorCompact < Command
- def help
- return <<-EOF
- Run major compaction on passed table or pass a region row
- to major compact an individual region. To compact a single
- column family within a region specify the region name
- followed by the column family name.
- Examples:
- Compact all regions in a table:
- hbase> major_compact 't1'
- hbase> major_compact 'ns1:t1'
- Compact an entire region:
- hbase> major_compact 'r1'
- Compact a single column family within a region:
- hbase> major_compact 'r1', 'c1'
- Compact a single column family within a table:
- hbase> major_compact 't1', 'c1'
- EOF
- end
-
- def command(table_or_region_name, family = nil)
- format_simple_command do
- admin.major_compact(table_or_region_name, family)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/merge_region.rb b/quickstart/thirdparty/ruby/shell/commands/merge_region.rb
deleted file mode 100644
index 6afa2e5b..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/merge_region.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class MergeRegion < Command
- def help
- return <<-EOF
-Merge two regions. Passing 'true' as the optional third parameter will force
-a merge ('force' merges regardless else merge will fail unless passed
-adjacent regions. 'force' is for expert use only).
-
-NOTE: You must pass the encoded region name, not the full region name so
-this command is a little different from other region operations. The encoded
-region name is the hash suffix on region names: e.g. if the region name were
-TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396. then
-the encoded region name portion is 527db22f95c8a9e0116f0cc13c680396
-
-Examples:
-
- hbase> merge_region 'ENCODED_REGIONNAME', 'ENCODED_REGIONNAME'
- hbase> merge_region 'ENCODED_REGIONNAME', 'ENCODED_REGIONNAME', true
-EOF
- end
-
- def command(encoded_region_a_name, encoded_region_b_name, force = 'false')
- format_simple_command do
- admin.merge_region(encoded_region_a_name, encoded_region_b_name, force)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/move.rb b/quickstart/thirdparty/ruby/shell/commands/move.rb
deleted file mode 100644
index e6b28288..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/move.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Move < Command
- def help
- return <<-EOF
-Move a region. Optionally specify target regionserver else we choose one
-at random. NOTE: You pass the encoded region name, not the region name so
-this command is a little different to the others. The encoded region name
-is the hash suffix on region names: e.g. if the region name were
-TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396. then
-the encoded region name portion is 527db22f95c8a9e0116f0cc13c680396
-A server name is its host, port plus startcode. For example:
-host187.example.com,60020,1289493121758
-Examples:
-
- hbase> move 'ENCODED_REGIONNAME'
- hbase> move 'ENCODED_REGIONNAME', 'SERVER_NAME'
-EOF
- end
-
- def command(encoded_region_name, server_name = nil)
- format_simple_command do
- admin.move(encoded_region_name, server_name)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/normalize.rb b/quickstart/thirdparty/ruby/shell/commands/normalize.rb
deleted file mode 100644
index 7e6302c8..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/normalize.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Normalize < Command
- def help
- return <<-EOF
-Trigger region normalizer for all tables which have NORMALIZATION_ENABLED flag set. Returns true
- if normalizer ran successfully, false otherwise. Note that this command has no effect
- if region normalizer is disabled (make sure it's turned on using 'normalizer_switch' command).
-
- Examples:
-
- hbase> normalize
-EOF
- end
-
- def command()
- format_simple_command do
- formatter.row([
- admin.normalize()? "true": "false"
- ])
- end
- end
- end
- end
-end
-
diff --git a/quickstart/thirdparty/ruby/shell/commands/normalizer_enabled.rb b/quickstart/thirdparty/ruby/shell/commands/normalizer_enabled.rb
deleted file mode 100644
index 1121b25e..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/normalizer_enabled.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env hbase-jruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with this
-# work for additional information regarding copyright ownership. The ASF
-# licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# Prints current region normalizer status
-
-module Shell
- module Commands
- class NormalizerEnabled < Command
- def help
- return <<-EOF
-Query the state of region normalizer.
-Examples:
-
- hbase> normalizer_enabled
-EOF
- end
-
- def command()
- format_simple_command do
- formatter.row([
- admin.normalizer_enabled?.to_s
- ])
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/normalizer_switch.rb b/quickstart/thirdparty/ruby/shell/commands/normalizer_switch.rb
deleted file mode 100644
index 6d959c49..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/normalizer_switch.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class NormalizerSwitch < Command
- def help
- return <<-EOF
-Enable/Disable region normalizer. Returns previous normalizer state.
-When normalizer is enabled, it handles all tables with 'NORMALIZATION_ENABLED' => true.
-Examples:
-
- hbase> normalizer_switch true
- hbase> normalizer_switch false
-EOF
- end
-
- def command(enableDisable)
- format_simple_command do
- formatter.row([
- admin.normalizer_switch(enableDisable)? "true" : "false"
- ])
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/put.rb b/quickstart/thirdparty/ruby/shell/commands/put.rb
deleted file mode 100644
index 2b47a4d5..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/put.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Put < Command
- def help
- return <<-EOF
-Put a cell 'value' at specified table/row/column and optionally
-timestamp coordinates. To put a cell value into table 'ns1:t1' or 't1'
-at row 'r1' under column 'c1' marked with the time 'ts1', do:
-
- hbase> put 'ns1:t1', 'r1', 'c1', 'value'
- hbase> put 't1', 'r1', 'c1', 'value'
- hbase> put 't1', 'r1', 'c1', 'value', ts1
- hbase> put 't1', 'r1', 'c1', 'value', {ATTRIBUTES=>{'mykey'=>'myvalue'}}
- hbase> put 't1', 'r1', 'c1', 'value', ts1, {ATTRIBUTES=>{'mykey'=>'myvalue'}}
- hbase> put 't1', 'r1', 'c1', 'value', ts1, {VISIBILITY=>'PRIVATE|SECRET'}
-
-The same commands also can be run on a table reference. Suppose you had a reference
-t to table 't1', the corresponding command would be:
-
- hbase> t.put 'r1', 'c1', 'value', ts1, {ATTRIBUTES=>{'mykey'=>'myvalue'}}
-EOF
- end
-
- def command(table, row, column, value, timestamp=nil, args = {})
- put table(table), row, column, value, timestamp, args
- end
-
- def put(table, row, column, value, timestamp = nil, args = {})
- format_simple_command do
- table._put_internal(row, column, value, timestamp, args)
- end
- end
- end
- end
-end
-
-#Add the method table.put that calls Put.put
-::Hbase::Table.add_shell_command("put")
diff --git a/quickstart/thirdparty/ruby/shell/commands/remove_peer.rb b/quickstart/thirdparty/ruby/shell/commands/remove_peer.rb
deleted file mode 100644
index 5ae5786f..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/remove_peer.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class RemovePeer< Command
- def help
- return <<-EOF
-Stops the specified replication stream and deletes all the meta
-information kept about it. Examples:
-
- hbase> remove_peer '1'
-EOF
- end
-
- def command(id)
- format_simple_command do
- replication_admin.remove_peer(id)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/remove_peer_tableCFs.rb b/quickstart/thirdparty/ruby/shell/commands/remove_peer_tableCFs.rb
deleted file mode 100644
index 5b15b529..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/remove_peer_tableCFs.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class RemovePeerTableCFs < Command
- def help
- return <<-EOF
-Remove a table / table-cf from the table-cfs config for the specified peer
-Examples:
-
- # Remove a table / table-cf from the replicable table-cfs for a peer
- hbase> remove_peer_tableCFs '2', "table1"
- hbase> remove_peer_tableCFs '2', "table1:cf1"
-
-EOF
- end
-
- def command(id, table_cfs)
- format_simple_command do
- replication_admin.remove_peer_tableCFs(id, table_cfs)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/restore_snapshot.rb b/quickstart/thirdparty/ruby/shell/commands/restore_snapshot.rb
deleted file mode 100644
index 4d531711..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/restore_snapshot.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class RestoreSnapshot < Command
- def help
- return <<-EOF
-Restore a specified snapshot.
-The restore will replace the content of the original table,
-bringing back the content to the snapshot state.
-The table must be disabled.
-
-Examples:
- hbase> restore_snapshot 'snapshotName'
-EOF
- end
-
- def command(snapshot_name)
- format_simple_command do
- admin.restore_snapshot(snapshot_name)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/revoke.rb b/quickstart/thirdparty/ruby/shell/commands/revoke.rb
deleted file mode 100644
index 4a0d5ff6..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/revoke.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Revoke < Command
- def help
- return <<-EOF
-Revoke a user's access rights.
-Syntax : revoke [, <@namespace> [, [, [, ]]]]
-
-Note: Groups and users access are revoked in the same way, but groups are prefixed with an '@'
- character. In the same way, tables and namespaces are specified, but namespaces are
- prefixed with an '@' character.
-
-For example:
-
- hbase> revoke 'bobsmith'
- hbase> revoke '@admins'
- hbase> revoke 'bobsmith', '@ns1'
- hbase> revoke 'bobsmith', 't1', 'f1', 'col1'
- hbase> revoke 'bobsmith', 'ns1:t1', 'f1', 'col1'
-EOF
- end
-
- def command(user, table_name=nil, family=nil, qualifier=nil)
- format_simple_command do
- security_admin.revoke(user, table_name, family, qualifier)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/scan.rb b/quickstart/thirdparty/ruby/shell/commands/scan.rb
deleted file mode 100644
index 106eccf6..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/scan.rb
+++ /dev/null
@@ -1,127 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Scan < Command
- def help
- return <<-EOF
-Scan a table; pass table name and optionally a dictionary of scanner
-specifications. Scanner specifications may include one or more of:
-TIMERANGE, FILTER, LIMIT, STARTROW, STOPROW, ROWPREFIXFILTER, TIMESTAMP,
-MAXLENGTH or COLUMNS, CACHE or RAW, VERSIONS, ALL_METRICS or METRICS
-
-If no columns are specified, all columns will be scanned.
-To scan all members of a column family, leave the qualifier empty as in
-'col_family'.
-
-The filter can be specified in two ways:
-1. Using a filterString - more information on this is available in the
-Filter Language document attached to the HBASE-4176 JIRA
-2. Using the entire package name of the filter.
-
-If you wish to see metrics regarding the execution of the scan, the
-ALL_METRICS boolean should be set to true. Alternatively, if you would
-prefer to see only a subset of the metrics, the METRICS array can be
-defined to include the names of only the metrics you care about.
-
-Some examples:
-
- hbase> scan 'hbase:meta'
- hbase> scan 'hbase:meta', {COLUMNS => 'info:regioninfo'}
- hbase> scan 'ns1:t1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}
- hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}
- hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [1303668804, 1303668904]}
- hbase> scan 't1', {REVERSED => true}
- hbase> scan 't1', {ALL_METRICS => true}
- hbase> scan 't1', {METRICS => ['RPC_RETRIES', 'ROWS_FILTERED']}
- hbase> scan 't1', {ROWPREFIXFILTER => 'row2', FILTER => "
- (QualifierFilter (>=, 'binary:xyz')) AND (TimestampsFilter ( 123, 456))"}
- hbase> scan 't1', {FILTER =>
- org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(1, 0)}
- hbase> scan 't1', {CONSISTENCY => 'TIMELINE'}
-For setting the Operation Attributes
- hbase> scan 't1', { COLUMNS => ['c1', 'c2'], ATTRIBUTES => {'mykey' => 'myvalue'}}
- hbase> scan 't1', { COLUMNS => ['c1', 'c2'], AUTHORIZATIONS => ['PRIVATE','SECRET']}
-For experts, there is an additional option -- CACHE_BLOCKS -- which
-switches block caching for the scanner on (true) or off (false). By
-default it is enabled. Examples:
-
- hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false}
-
-Also for experts, there is an advanced option -- RAW -- which instructs the
-scanner to return all cells (including delete markers and uncollected deleted
-cells). This option cannot be combined with requesting specific COLUMNS.
-Disabled by default. Example:
-
- hbase> scan 't1', {RAW => true, VERSIONS => 10}
-
-Besides the default 'toStringBinary' format, 'scan' supports custom formatting
-by column. A user can define a FORMATTER by adding it to the column name in
-the scan specification. The FORMATTER can be stipulated:
-
- 1. either as a org.apache.hadoop.hbase.util.Bytes method name (e.g, toInt, toString)
- 2. or as a custom class followed by method name: e.g. 'c(MyFormatterClass).format'.
-
-Example formatting cf:qualifier1 and cf:qualifier2 both as Integers:
- hbase> scan 't1', {COLUMNS => ['cf:qualifier1:toInt',
- 'cf:qualifier2:c(org.apache.hadoop.hbase.util.Bytes).toInt'] }
-
-Note that you can specify a FORMATTER by column only (cf:qualifier). You cannot
-specify a FORMATTER for all columns of a column family.
-
-Scan can also be used directly from a table, by first getting a reference to a
-table, like such:
-
- hbase> t = get_table 't'
- hbase> t.scan
-
-Note in the above situation, you can still provide all the filtering, columns,
-options, etc as described above.
-
-EOF
- end
-
- def command(table, args = {})
- scan(table(table), args)
- end
-
- #internal command that actually does the scanning
- def scan(table, args = {})
- now = Time.now
- formatter.header(["ROW", "COLUMN+CELL"])
-
- scan = table._hash_to_scan(args)
- #actually do the scanning
- count, is_stale = table._scan_internal(args, scan) do |row, cells|
- formatter.row([ row, cells ])
- end
-
- formatter.footer(now, count, is_stale)
- # if scan metrics were enabled, print them after the results
- if (scan != nil && scan.isScanMetricsEnabled())
- formatter.scan_metrics(scan.getScanMetrics(), args["METRICS"])
- end
- end
- end
- end
-end
-
-#Add the method table.scan that calls Scan.scan
-::Hbase::Table.add_shell_command("scan")
diff --git a/quickstart/thirdparty/ruby/shell/commands/set_auths.rb b/quickstart/thirdparty/ruby/shell/commands/set_auths.rb
deleted file mode 100644
index 4a52eb0e..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/set_auths.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class SetAuths < Command
- def help
- return <<-EOF
-Add a set of visibility labels for a user or group
-Syntax : set_auths 'user',[label1, label2]
-
-For example:
-
- hbase> set_auths 'user1', ['SECRET','PRIVATE']
- hbase> set_auths '@group1', ['SECRET','PRIVATE']
-EOF
- end
-
- def command(user, *args)
- format_simple_command do
- visibility_labels_admin.set_auths(user, args)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/set_peer_tableCFs.rb b/quickstart/thirdparty/ruby/shell/commands/set_peer_tableCFs.rb
deleted file mode 100644
index 3a88dbb7..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/set_peer_tableCFs.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Copyright The Apache Software Foundation
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class SetPeerTableCFs< Command
- def help
- return <<-EOF
- Set the replicable table-cf config for the specified peer
- Examples:
-
- # set all tables to be replicable for a peer
- hbase> set_peer_tableCFs '1', ""
- hbase> set_peer_tableCFs '1'
- # set table / table-cf to be replicable for a peer, for a table without
- # an explicit column-family list, all replicable column-families (with
- # replication_scope == 1) will be replicated
- hbase> set_peer_tableCFs '2', "table1; table2:cf1,cf2; table3:cfA,cfB"
-
- EOF
- end
-
- def command(id, peer_table_cfs = nil)
- format_simple_command do
- replication_admin.set_peer_tableCFs(id, peer_table_cfs)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/set_quota.rb b/quickstart/thirdparty/ruby/shell/commands/set_quota.rb
deleted file mode 100644
index a638b939..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/set_quota.rb
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class SetQuota < Command
- def help
- return <<-EOF
-Set a quota for a user, table, or namespace.
-Syntax : set_quota TYPE => ,
-
-TYPE => THROTTLE
-User can either set quota on read, write or on both the requests together(i.e., read+write)
-The read, write, or read+write(default throttle type) request limit can be expressed using
-the form 100req/sec, 100req/min and the read, write, read+write(default throttle type) limit
-can be expressed using the form 100k/sec, 100M/min with (B, K, M, G, T, P) as valid size unit
-and (sec, min, hour, day) as valid time unit.
-Currently the throttle limit is per machine - a limit of 100req/min
-means that each machine can execute 100req/min.
-
-For example:
-
- hbase> set_quota TYPE => THROTTLE, USER => 'u1', LIMIT => '10req/sec'
- hbase> set_quota TYPE => THROTTLE, THROTTLE_TYPE => READ, USER => 'u1', LIMIT => '10req/sec'
-
- hbase> set_quota TYPE => THROTTLE, USER => 'u1', LIMIT => '10M/sec'
- hbase> set_quota TYPE => THROTTLE, THROTTLE_TYPE => WRITE, USER => 'u1', LIMIT => '10M/sec'
-
- hbase> set_quota TYPE => THROTTLE, USER => 'u1', TABLE => 't2', LIMIT => '5K/min'
- hbase> set_quota TYPE => THROTTLE, USER => 'u1', NAMESPACE => 'ns2', LIMIT => NONE
-
- hbase> set_quota TYPE => THROTTLE, NAMESPACE => 'ns1', LIMIT => '10req/sec'
- hbase> set_quota TYPE => THROTTLE, TABLE => 't1', LIMIT => '10M/sec'
- hbase> set_quota TYPE => THROTTLE, THROTTLE_TYPE => WRITE, TABLE => 't1', LIMIT => '10M/sec'
- hbase> set_quota TYPE => THROTTLE, USER => 'u1', LIMIT => NONE
- hbase> set_quota TYPE => THROTTLE, THROTTLE_TYPE => WRITE, USER => 'u1', LIMIT => NONE
-
- hbase> set_quota USER => 'u1', GLOBAL_BYPASS => true
-EOF
- end
-
- def command(args = {})
- if args.has_key?(TYPE)
- qtype = args.delete(TYPE)
- case qtype
- when THROTTLE
- if args[LIMIT].eql? NONE
- args.delete(LIMIT)
- quotas_admin.unthrottle(args)
- else
- quotas_admin.throttle(args)
- end
- else
- raise "Invalid TYPE argument. got " + qtype
- end
- elsif args.has_key?(GLOBAL_BYPASS)
- quotas_admin.set_global_bypass(args.delete(GLOBAL_BYPASS), args)
- else
- raise "Expected TYPE argument"
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/set_visibility.rb b/quickstart/thirdparty/ruby/shell/commands/set_visibility.rb
deleted file mode 100644
index 59779fb1..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/set_visibility.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class SetVisibility < Command
- def help
- return <<-EOF
-Set the visibility expression on one or more existing cells.
-
-Pass table name, visibility expression, and a dictionary containing
-scanner specifications. Scanner specifications may include one or more
-of: TIMERANGE, FILTER, STARTROW, STOPROW, ROWPREFIXFILTER, TIMESTAMP, or COLUMNS
-
-If no columns are specified, all columns will be included.
-To include all members of a column family, leave the qualifier empty as in
-'col_family:'.
-
-The filter can be specified in two ways:
-1. Using a filterString - more information on this is available in the
-Filter Language document attached to the HBASE-4176 JIRA
-2. Using the entire package name of the filter.
-
-Examples:
-
- hbase> set_visibility 't1', 'A|B', {COLUMNS => ['c1', 'c2']}
- hbase> set_visibility 't1', '(A&B)|C', {COLUMNS => 'c1',
- TIMERANGE => [1303668804, 1303668904]}
- hbase> set_visibility 't1', 'A&B&C', {ROWPREFIXFILTER => 'row2',
- FILTER => "(QualifierFilter (>=, 'binary:xyz')) AND
- (TimestampsFilter ( 123, 456))"}
-
-This command will only affect existing cells and is expected to be mainly
-useful for feature testing and functional verification.
-EOF
- end
-
- def command(table, visibility, scan)
- t = table(table)
- now = Time.now
- scanner = t._get_scanner(scan)
- count = 0
- iter = scanner.iterator
- while iter.hasNext
- row = iter.next
- row.list.each do |cell|
- put = org.apache.hadoop.hbase.client.Put.new(row.getRow)
- put.add(cell)
- t.set_cell_visibility(put, visibility)
- t.table.put(put)
- end
- count += 1
- end
- formatter.footer(now, count)
- end
-
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/show_filters.rb b/quickstart/thirdparty/ruby/shell/commands/show_filters.rb
deleted file mode 100644
index cdbd9ed9..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/show_filters.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-java_import org.apache.hadoop.hbase.filter.ParseFilter
-
-module Shell
- module Commands
- class ShowFilters < Command
- def help
- return <<-EOF
-Show all the filters in hbase. Example:
- hbase> show_filters
-
- ColumnPrefixFilter
- TimestampsFilter
- PageFilter
- .....
- KeyOnlyFilter
-EOF
- end
-
- def command( )
- now = Time.now
- parseFilter = ParseFilter.new
- supportedFilters = parseFilter.getSupportedFilters
-
- supportedFilters.each do |filter|
- formatter.row([filter])
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/show_peer_tableCFs.rb b/quickstart/thirdparty/ruby/shell/commands/show_peer_tableCFs.rb
deleted file mode 100644
index 3ce3d06f..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/show_peer_tableCFs.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Copyright The Apache Software Foundation
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class ShowPeerTableCFs< Command
- def help
- return <<-EOF
- Show replicable table-cf config for the specified peer.
-
- hbase> show_peer_tableCFs
- EOF
- end
-
- def command(id)
- puts replication_admin.show_peer_tableCFs(id)
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/snapshot.rb b/quickstart/thirdparty/ruby/shell/commands/snapshot.rb
deleted file mode 100644
index 15bf298e..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/snapshot.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Snapshot < Command
- def help
- return <<-EOF
-Take a snapshot of specified table. Examples:
-
- hbase> snapshot 'sourceTable', 'snapshotName'
- hbase> snapshot 'namespace:sourceTable', 'snapshotName', {SKIP_FLUSH => true}
-EOF
- end
-
- def command(table, snapshot_name, *args)
- format_simple_command do
- admin.snapshot(table, snapshot_name, *args)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/split.rb b/quickstart/thirdparty/ruby/shell/commands/split.rb
deleted file mode 100644
index 9dc424ff..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/split.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Split < Command
- def help
- return <<-EOF
-Split entire table or pass a region to split individual region. With the
-second parameter, you can specify an explicit split key for the region.
-Examples:
- split 'tableName'
- split 'namespace:tableName'
- split 'regionName' # format: 'tableName,startKey,id'
- split 'tableName', 'splitKey'
- split 'regionName', 'splitKey'
-EOF
- end
-
- def command(table_or_region_name, split_point = nil)
- format_simple_command do
- admin.split(table_or_region_name, split_point)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/splitormerge_enabled.rb b/quickstart/thirdparty/ruby/shell/commands/splitormerge_enabled.rb
deleted file mode 100644
index 7da7564a..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/splitormerge_enabled.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env hbase-jruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with this
-# work for additional information regarding copyright ownership. The ASF
-# licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# Prints the current split or merge status
-module Shell
- module Commands
- # Command for check split or merge switch status
- class SplitormergeEnabled < Command
- def help
- print <<-EOF
-Query the switch's state. You can set switch type, 'SPLIT' or 'MERGE'
-Examples:
-
- hbase> splitormerge_enabled 'SPLIT'
-EOF
- end
-
- def command(switch_type)
- format_simple_command do
- formatter.row(
- [admin.splitormerge_enabled(switch_type) ? 'true' : 'false']
- )
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/splitormerge_switch.rb b/quickstart/thirdparty/ruby/shell/commands/splitormerge_switch.rb
deleted file mode 100644
index f4c28580..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/splitormerge_switch.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- # Command for set switch for split and merge
- class SplitormergeSwitch < Command
- def help
- print <<-EOF
-Enable/Disable one switch. You can set switch type 'SPLIT' or 'MERGE'. Returns previous split state.
-Examples:
-
- hbase> splitormerge_switch 'SPLIT', true
- hbase> splitormerge_switch 'SPLIT', false
-EOF
- end
-
- def command(switch_type, enabled)
- format_simple_command do
- formatter.row(
- [admin.splitormerge_switch(switch_type, enabled) ? 'true' : 'false']
- )
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/status.rb b/quickstart/thirdparty/ruby/shell/commands/status.rb
deleted file mode 100644
index b22b2723..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/status.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Status < Command
- def help
- return <<-EOF
-Show cluster status. Can be 'summary', 'simple', 'detailed', or 'replication'. The
-default is 'summary'. Examples:
-
- hbase> status
- hbase> status 'simple'
- hbase> status 'summary'
- hbase> status 'detailed'
- hbase> status 'replication'
- hbase> status 'replication', 'source'
- hbase> status 'replication', 'sink'
-EOF
- end
-
- def command(format = 'summary',type = 'both')
- admin.status(format, type)
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/table_help.rb b/quickstart/thirdparty/ruby/shell/commands/table_help.rb
deleted file mode 100644
index e5a1858a..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/table_help.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class TableHelp < Command
- def help
- return Hbase::Table.help
- end
-
- #just print the help
- def command
- # call the shell to get the nice formatting there
- @shell.help_command 'table_help'
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/trace.rb b/quickstart/thirdparty/ruby/shell/commands/trace.rb
deleted file mode 100644
index 5e009309..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/trace.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-HTrace = org.apache.htrace.Trace
-java_import org.apache.htrace.Sampler
-java_import org.apache.hadoop.hbase.trace.SpanReceiverHost
-
-module Shell
- module Commands
- class Trace < Command
- def help
- return <<-EOF
-Start or Stop tracing using HTrace.
-Always returns true if tracing is running, otherwise false.
-If the first argument is 'start', new span is started.
-If the first argument is 'stop', current running span is stopped.
-('stop' returns false on success.)
-If the first argument is 'status', just returns if or not tracing is running.
-On 'start'-ing, you can optionally pass the name of span as the second argument.
-The default name of span is 'HBaseShell'.
-Repeating 'start' does not start nested span.
-
-Examples:
-
- hbase> trace 'start'
- hbase> trace 'status'
- hbase> trace 'stop'
-
- hbase> trace 'start', 'MySpanName'
- hbase> trace 'stop'
-
-EOF
- end
-
- def command(startstop="status", spanname="HBaseShell")
- format_and_return_simple_command do
- trace(startstop, spanname)
- end
- end
-
- def trace(startstop, spanname)
- @@receiver ||= SpanReceiverHost.getInstance(@shell.hbase.configuration)
- if startstop == "start"
- if not tracing?
- @@tracescope = HTrace.startSpan(spanname, Sampler.ALWAYS)
- end
- elsif startstop == "stop"
- if tracing?
- @@tracescope.close()
- end
- end
- tracing?
- end
-
- def tracing?()
- HTrace.isTracing()
- end
-
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/truncate.rb b/quickstart/thirdparty/ruby/shell/commands/truncate.rb
deleted file mode 100644
index b7812fbe..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/truncate.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Truncate < Command
- def help
- return <<-EOF
- Disables, drops and recreates the specified table.
-EOF
- end
-
- def command(table)
- format_simple_command do
- puts "Truncating '#{table}' table (it may take a while):"
- admin.truncate(table) { |log| puts " - #{log}" }
- end
- end
-
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/truncate_preserve.rb b/quickstart/thirdparty/ruby/shell/commands/truncate_preserve.rb
deleted file mode 100644
index 918b2328..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/truncate_preserve.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class TruncatePreserve < Command
- def help
- return <<-EOF
- Disables, drops and recreates the specified table while still maintaing the previous region boundaries.
-EOF
- end
-
- def command(table)
- format_simple_command do
- puts "Truncating '#{table}' table (it may take a while):"
- admin.truncate_preserve(table) { |log| puts " - #{log}" }
- end
- end
-
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/unassign.rb b/quickstart/thirdparty/ruby/shell/commands/unassign.rb
deleted file mode 100644
index 5eea71f6..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/unassign.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Unassign < Command
- def help
- return <<-EOF
-Unassign a region. Unassign will close region in current location and then
-reopen it again. Pass 'true' to force the unassignment ('force' will clear
-all in-memory state in master before the reassign. If results in
-double assignment use hbck -fix to resolve. To be used by experts).
-Use with caution. For expert use only. Examples:
-
- hbase> unassign 'REGIONNAME'
- hbase> unassign 'REGIONNAME', true
- hbase> unassign 'ENCODED_REGIONNAME'
- hbase> unassign 'ENCODED_REGIONNAME', true
-EOF
- end
-
- def command(region_name, force = 'false')
- format_simple_command do
- admin.unassign(region_name, force)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/update_all_config.rb b/quickstart/thirdparty/ruby/shell/commands/update_all_config.rb
deleted file mode 100644
index 05295b79..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/update_all_config.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class UpdateAllConfig < Command
- def help
- return <<-EOF
-Reload a subset of configuration on all servers in the cluster. See
-http://hbase.apache.org/book.html?dyn_config for more details. Here is how
-you would run the command in the hbase shell:
- hbase> update_all_config
-EOF
- end
-
- def command()
- format_simple_command do
- admin.update_all_config()
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/update_config.rb b/quickstart/thirdparty/ruby/shell/commands/update_config.rb
deleted file mode 100644
index 9f65fddd..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/update_config.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class UpdateConfig < Command
- def help
- return <<-EOF
-Reload a subset of configuration on server 'servername' where servername is
-host, port plus startcode. For example: host187.example.com,60020,1289493121758
-See http://hbase.apache.org/book.html?dyn_config for more details. Here is how
-you would run the command in the hbase shell:
- hbase> update_config 'servername'
-EOF
- end
-
- def command(serverName)
- format_simple_command do
- admin.update_config(serverName)
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/user_permission.rb b/quickstart/thirdparty/ruby/shell/commands/user_permission.rb
deleted file mode 100644
index 71b98f37..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/user_permission.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class UserPermission < Command
- def help
- return <<-EOF
-Show all permissions for the particular user.
-Syntax : user_permission
-
-Note: A namespace must always precede with '@' character.
-
-For example:
-
- hbase> user_permission
- hbase> user_permission '@ns1'
- hbase> user_permission '@.*'
- hbase> user_permission '@^[a-c].*'
- hbase> user_permission 'table1'
- hbase> user_permission 'namespace1:table1'
- hbase> user_permission '.*'
- hbase> user_permission '^[A-C].*'
-EOF
- end
-
- def command(table_regex=nil)
- #format_simple_command do
- #admin.user_permission(table_regex)
- now = Time.now
- formatter.header(["User", "Namespace,Table,Family,Qualifier:Permission"])
-
- count = security_admin.user_permission(table_regex) do |user, permission|
- formatter.row([ user, permission])
- end
-
- formatter.footer(now, count)
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/version.rb b/quickstart/thirdparty/ruby/shell/commands/version.rb
deleted file mode 100644
index 63e9712a..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/version.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Version < Command
- def help
- return <<-EOF
-Output this HBase version
-EOF
- end
-
- def command
- # Output version.
- puts "#{org.apache.hadoop.hbase.util.VersionInfo.getVersion()}, " +
- "r#{org.apache.hadoop.hbase.util.VersionInfo.getRevision()}, " +
- "#{org.apache.hadoop.hbase.util.VersionInfo.getDate()}"
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/wal_roll.rb b/quickstart/thirdparty/ruby/shell/commands/wal_roll.rb
deleted file mode 100644
index 0fe1870a..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/wal_roll.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-module Shell
- module Commands
- class WalRoll < Command
- def help
- return <<-EOF
-Roll the log writer. That is, start writing log messages to a new file.
-The name of the regionserver should be given as the parameter. A
-'server_name' is the host, port plus startcode of a regionserver. For
-example: host187.example.com,60020,1289493121758 (find servername in
-master ui or when you do detailed status in shell)
-EOF
- end
-
- def command(server_name)
- format_simple_command do
- admin.wal_roll(server_name)
- end
- end
- end
- #TODO remove old HLog version
- class HlogRoll < WalRoll
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/whoami.rb b/quickstart/thirdparty/ruby/shell/commands/whoami.rb
deleted file mode 100644
index 3b6b32d2..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/whoami.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class Whoami < Command
- def help
- return <<-EOF
-Show the current hbase user.
-Syntax : whoami
-For example:
-
- hbase> whoami
-EOF
- end
-
- def command()
- user = org.apache.hadoop.hbase.security.User.getCurrent()
- puts "#{user.toString()}"
- groups = user.getGroupNames().to_a
- if not groups.nil? and groups.length > 0
- puts " groups: #{groups.join(', ')}"
- end
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/commands/zk_dump.rb b/quickstart/thirdparty/ruby/shell/commands/zk_dump.rb
deleted file mode 100644
index c0b509a3..00000000
--- a/quickstart/thirdparty/ruby/shell/commands/zk_dump.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-module Shell
- module Commands
- class ZkDump < Command
- def help
- return <<-EOF
-Dump status of HBase cluster as seen by ZooKeeper.
-EOF
- end
-
- def command
- puts admin.zk_dump
- end
- end
- end
-end
diff --git a/quickstart/thirdparty/ruby/shell/formatter.rb b/quickstart/thirdparty/ruby/shell/formatter.rb
deleted file mode 100644
index 6e598fb9..00000000
--- a/quickstart/thirdparty/ruby/shell/formatter.rb
+++ /dev/null
@@ -1,206 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Results formatter
-module Shell
- module Formatter
- # Base abstract class for results formatting.
- class Base
- attr_reader :row_count
-
- def is_valid_io?(obj)
- obj.instance_of?(IO) || obj == Kernel
- end
-
- def refresh_width()
- if $stdout.tty?
- @max_width = Java::jline.Terminal.getTerminal().getTerminalWidth()
- else
- @max_width = 0
- end
- end
-
- # Takes an output stream and a print width.
- def initialize(opts = {})
- options = {
- :output_stream => Kernel,
- }.merge(opts)
-
- @out = options[:output_stream]
- refresh_width
- @row_count = 0
-
- # raise an error if the stream is not valid
- raise(TypeError, "Type #{@out.class} of parameter #{@out} is not IO") unless is_valid_io?(@out)
- end
-
- def header(args = [], widths = [])
- refresh_width
- row(args, false, widths) if args.length > 0
- @row_count = 0
- end
-
- # Output a row.
- # Inset is whether or not to offset row by a space.
- def row(args = [], inset = true, widths = [])
- # Print out nothing
- return if !args || args.empty?
-
- # Print a string
- if args.is_a?(String)
- output(args)
- @out.puts
- return
- end
-
- # TODO: Look at the type. Is it RowResult?
- if args.length == 1
- splits = split(@max_width, dump(args[0]))
- for l in splits
- output(@max_width, l)
- @out.puts
- end
- elsif args.length == 2
- if @max_width == 0
- col1width = col2width = 0
- else
- col1width = (not widths or widths.length == 0) ? @max_width / 4 : @max_width * widths[0] / 100
- col2width = (not widths or widths.length < 2) ? @max_width - col1width - 2 : @max_width * widths[1] / 100 - 2
- end
- splits1 = split(col1width, dump(args[0]))
- splits2 = split(col2width, dump(args[1]))
- biggest = (splits2.length > splits1.length)? splits2.length: splits1.length
- index = 0
- while index < biggest
- # Inset by one space if inset is set.
- @out.print(" ") if inset
- output(col1width, splits1[index])
- # Add extra space so second column lines up w/ second column output
- @out.print(" ") unless inset
- @out.print(" ")
- output(col2width, splits2[index])
- index += 1
- @out.puts
- end
- else
- # Print a space to set off multi-column rows
- print ' '
- first = true
- for e in args
- @out.print " " unless first
- first = false
- @out.print e
- end
- puts
- end
- @row_count += 1
- end
-
- # Output the scan metrics. Can be filtered to output only those metrics whose keys exists
- # in the metric_filter
- def scan_metrics(scan_metrics = nil, metric_filter = [])
- return if scan_metrics == nil
- raise(ArgumentError, \
- "Argument should be org.apache.hadoop.hbase.client.metrics.ScanMetrics") \
- unless scan_metrics.kind_of?(org.apache.hadoop.hbase.client.metrics.ScanMetrics)
- # prefix output with empty line
- @out.puts
- # save row count to restore after printing metrics
- # (metrics should not count towards row count)
- saved_row_count = @row_count
- iter = scan_metrics.getMetricsMap().entrySet().iterator()
- metric_hash = Hash.new()
- # put keys in hash so they can be sorted easily
- while iter.hasNext
- metric = iter.next
- metric_hash[metric.getKey.to_s] = metric.getValue.to_s
- end
- # print in alphabetical order
- row(["METRIC", "VALUE"], false)
- metric_hash.sort.map do |key, value|
- if (not metric_filter or metric_filter.length == 0 or metric_filter.include?(key))
- row([key, value])
- end
- end
-
- @row_count = saved_row_count
- return
- end
-
- def split(width, str)
- if width == 0
- return [str]
- end
- result = []
- index = 0
- while index < str.length do
- result << str.slice(index, width)
- index += width
- end
- result
- end
-
- def dump(str)
- return if str.instance_of?(Fixnum)
- # Remove double-quotes added by 'dump'.
- return str
- end
-
- def output(str)
- output(@max_width, str)
- end
-
- def output(width, str)
- if str == nil
- str = ''
- end
- if not width or width == str.length
- @out.print(str)
- else
- @out.printf('%-*s', width, str)
- end
- end
-
- def footer(start_time = nil, row_count = nil, is_stale = false)
- return unless start_time
- row_count ||= @row_count
- # Only output elapsed time and row count if startTime passed
- @out.print("%d row(s) in %.4f seconds" % [row_count, Time.now - start_time])
- if is_stale == true
- @out.puts(" (possible stale results) ")
- else
- @out.puts("")
- end
- end
- end
-
-
- class Console < Base
- end
-
- class XHTMLFormatter < Base
- # http://www.germane-software.com/software/rexml/doc/classes/REXML/Document.html
- # http://www.crummy.com/writing/RubyCookbook/test_results/75942.html
- end
-
- class JSON < Base
- end
- end
-end
-