You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2013/08/11 04:59:59 UTC

svn commit: r1512859 - /hbase/trunk/hbase-server/src/main/ruby/shell/commands/

Author: stack
Date: Sun Aug 11 02:59:59 2013
New Revision: 1512859

URL: http://svn.apache.org/r1512859
Log:
HBASE-9130 Invert the name of namespace commands to match the snapshots and replication form

Added:
    hbase/trunk/hbase-server/src/main/ruby/shell/commands/alter_namespace.rb
    hbase/trunk/hbase-server/src/main/ruby/shell/commands/create_namespace.rb
    hbase/trunk/hbase-server/src/main/ruby/shell/commands/describe_namespace.rb
    hbase/trunk/hbase-server/src/main/ruby/shell/commands/drop_namespace.rb
    hbase/trunk/hbase-server/src/main/ruby/shell/commands/list_namespace.rb
    hbase/trunk/hbase-server/src/main/ruby/shell/commands/list_namespace_tables.rb
Removed:
    hbase/trunk/hbase-server/src/main/ruby/shell/commands/namespace_alter.rb
    hbase/trunk/hbase-server/src/main/ruby/shell/commands/namespace_create.rb
    hbase/trunk/hbase-server/src/main/ruby/shell/commands/namespace_describe.rb
    hbase/trunk/hbase-server/src/main/ruby/shell/commands/namespace_drop.rb
    hbase/trunk/hbase-server/src/main/ruby/shell/commands/namespace_list.rb
    hbase/trunk/hbase-server/src/main/ruby/shell/commands/namespace_list_tables.rb

Added: hbase/trunk/hbase-server/src/main/ruby/shell/commands/alter_namespace.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/ruby/shell/commands/alter_namespace.rb?rev=1512859&view=auto
==============================================================================
--- hbase/trunk/hbase-server/src/main/ruby/shell/commands/alter_namespace.rb (added)
+++ hbase/trunk/hbase-server/src/main/ruby/shell/commands/alter_namespace.rb Sun Aug 11 02:59:59 2013
@@ -0,0 +1,44 @@
+#
+#
+# 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', 'PROERTY_NAME' => 'PROPERTY_VALUE'}
+
+To delete a property:
+
+  hbase> alter_namespace 'ns1', {METHOD => 'unset', NAME=>'PROERTY_NAME'}
+EOF
+      end
+
+      def command(namespace, *args)
+        format_simple_command do
+          admin.alter_namespace(namespace, *args)
+        end
+      end
+    end
+  end
+end

Added: hbase/trunk/hbase-server/src/main/ruby/shell/commands/create_namespace.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/ruby/shell/commands/create_namespace.rb?rev=1512859&view=auto
==============================================================================
--- hbase/trunk/hbase-server/src/main/ruby/shell/commands/create_namespace.rb (added)
+++ hbase/trunk/hbase-server/src/main/ruby/shell/commands/create_namespace.rb Sun Aug 11 02:59:59 2013
@@ -0,0 +1,41 @@
+#
+#
+# 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', {'PROERTY_NAME'=>'PROPERTY_VALUE'}
+EOF
+      end
+
+      def command(namespace, *args)
+        format_simple_command do
+          admin.create_namespace(namespace, *args)
+        end
+      end
+    end
+  end
+end

Added: hbase/trunk/hbase-server/src/main/ruby/shell/commands/describe_namespace.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/ruby/shell/commands/describe_namespace.rb?rev=1512859&view=auto
==============================================================================
--- hbase/trunk/hbase-server/src/main/ruby/shell/commands/describe_namespace.rb (added)
+++ hbase/trunk/hbase-server/src/main/ruby/shell/commands/describe_namespace.rb Sun Aug 11 02:59:59 2013
@@ -0,0 +1,41 @@
+#
+#
+# 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

Added: hbase/trunk/hbase-server/src/main/ruby/shell/commands/drop_namespace.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/ruby/shell/commands/drop_namespace.rb?rev=1512859&view=auto
==============================================================================
--- hbase/trunk/hbase-server/src/main/ruby/shell/commands/drop_namespace.rb (added)
+++ hbase/trunk/hbase-server/src/main/ruby/shell/commands/drop_namespace.rb Sun Aug 11 02:59:59 2013
@@ -0,0 +1,36 @@
+#
+#
+# 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

Added: hbase/trunk/hbase-server/src/main/ruby/shell/commands/list_namespace.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/ruby/shell/commands/list_namespace.rb?rev=1512859&view=auto
==============================================================================
--- hbase/trunk/hbase-server/src/main/ruby/shell/commands/list_namespace.rb (added)
+++ hbase/trunk/hbase-server/src/main/ruby/shell/commands/list_namespace.rb Sun Aug 11 02:59:59 2013
@@ -0,0 +1,47 @@
+#
+#
+# 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" ])
+
+        regex = /#{regex}/ unless regex.is_a?(Regexp)
+        list = admin.list_namespace.grep(regex)
+        list.each do |table|
+          formatter.row([ table ])
+        end
+
+        formatter.footer(now, list.size)
+      end
+    end
+  end
+end

Added: hbase/trunk/hbase-server/src/main/ruby/shell/commands/list_namespace_tables.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/ruby/shell/commands/list_namespace_tables.rb?rev=1512859&view=auto
==============================================================================
--- hbase/trunk/hbase-server/src/main/ruby/shell/commands/list_namespace_tables.rb (added)
+++ hbase/trunk/hbase-server/src/main/ruby/shell/commands/list_namespace_tables.rb Sun Aug 11 02:59:59 2013
@@ -0,0 +1,45 @@
+#
+#
+# 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