3 # Licensed to the Apache Software Foundation (ASF) under one
4 # or more contributor license agreements. See the NOTICE file
5 # distributed with this work for additional information
6 # regarding copyright ownership. The ASF licenses this file
7 # to you under the Apache License, Version 2.0 (the
8 # "License"); you may not use this file except in compliance
9 # with the License. You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
21 # Has wrapper classes for org.apache.hadoop.hbase.client.Admin
22 # and for org.apache.hadoop.hbase.client.Table. Classes take
23 # Formatters on construction and outputs any results using
24 # Formatter methods. These classes are only really for use by
25 # the hirb.rb HBase Shell script; they don't make much sense elsewhere.
26 # For example, the exists method on Admin class prints to the formatter
27 # whether the table exists and returns nil regardless.
30 java_import('java.lang.Integer') { |_package, name| "J#{name}" }
31 java_import('java.lang.Long') { |_package, name| "J#{name}" }
32 java_import('java.lang.Boolean') { |_package, name| "J#{name}" }
35 ALLOW_PARTIAL_RESULTS = 'ALLOW_PARTIAL_RESULTS'.freeze
36 ALL_METRICS = 'ALL_METRICS'.freeze
37 ATTRIBUTES = 'ATTRIBUTES'.freeze
38 AUTHORIZATIONS = 'AUTHORIZATIONS'.freeze
39 BATCH = 'BATCH'.freeze
40 CACHE = 'CACHE'.freeze
41 CACHE_BLOCKS = 'CACHE_BLOCKS'.freeze
42 CLASSNAME = 'CLASSNAME'.freeze
43 CLONE_SFT = 'CLONE_SFT'.freeze
44 CLUSTER_KEY = 'CLUSTER_KEY'.freeze
45 COLUMN = 'COLUMN'.freeze
46 COLUMNS = 'COLUMNS'.freeze
47 CONFIG = 'CONFIG'.freeze
48 CONFIGURATION = org.apache.hadoop.hbase.HConstants::CONFIGURATION
49 CONSISTENCY = 'CONSISTENCY'.freeze
50 COPROCESSOR = 'COPROCESSOR'.freeze
52 ENDPOINT_CLASSNAME = 'ENDPOINT_CLASSNAME'.freeze
53 FILTER = 'FILTER'.freeze
54 FOREVER = org.apache.hadoop.hbase.HConstants::FOREVER
55 FORMATTER = 'FORMATTER'.freeze
56 FORMATTER_CLASS = 'FORMATTER_CLASS'.freeze
57 INTERVAL = 'INTERVAL'.freeze
58 IN_MEMORY = org.apache.hadoop.hbase.HConstants::IN_MEMORY
59 IN_MEMORY_COMPACTION = org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder::IN_MEMORY_COMPACTION
60 ISOLATION_LEVEL = 'ISOLATION_LEVEL'.freeze
61 IS_ROOT = 'IS_ROOT'.freeze
62 JAR_PATH = 'JAR_PATH'.freeze
63 LIMIT = 'LIMIT'.freeze
64 LOCALITY_THRESHOLD = 'LOCALITY_THRESHOLD'.freeze
65 MAXLENGTH = 'MAXLENGTH'.freeze
66 MAX_RESULT_SIZE = 'MAX_RESULT_SIZE'.freeze
67 METADATA = org.apache.hadoop.hbase.HConstants::METADATA
68 METHOD = 'METHOD'.freeze
69 METRICS = 'METRICS'.freeze
70 NAME = org.apache.hadoop.hbase.HConstants::NAME
71 NAMESPACE = 'NAMESPACE'.freeze
72 NAMESPACES = 'NAMESPACES'.freeze
74 NUMREGIONS = 'NUMREGIONS'.freeze
75 POLICY = 'POLICY'.freeze
76 PRIORITY = 'PRIORITY'.freeze
77 PROPERTIES = 'PROPERTIES'.freeze
79 READ_TYPE = 'READ_TYPE'.freeze
80 REGEX = 'REGEX'.freeze
81 REGIONSERVER = 'REGIONSERVER'.freeze
82 REGION_REPLICATION = 'REGION_REPLICATION'.freeze
83 REGION_REPLICA_ID = 'REGION_REPLICA_ID'.freeze
84 REMOTE_WAL_DIR = 'REMOTE_WAL_DIR'.freeze
85 REPLICATION_SCOPE = 'REPLICATION_SCOPE'.freeze
86 REPLICATION_SCOPE_BYTES = org.apache.hadoop.hbase.client.ColumnFamilyDescriptor::REPLICATION_SCOPE_BYTES
87 RESTORE_ACL = 'RESTORE_ACL'.freeze
88 REVERSED = 'REVERSED'.freeze
89 ROWPREFIXFILTER = 'ROWPREFIXFILTER'.freeze
90 SERIAL = 'SERIAL'.freeze
91 SERVER_NAME = 'SERVER_NAME'.freeze
92 SKIP_FLUSH = 'SKIP_FLUSH'.freeze
93 SPLITALGO = 'SPLITALGO'.freeze
94 SPLITS = 'SPLITS'.freeze
95 SPLITS_FILE = 'SPLITS_FILE'.freeze
96 STARTROW = 'STARTROW'.freeze
97 STATE = 'STATE'.freeze
98 STOPROW = 'STOPROW'.freeze
99 TABLE = 'TABLE'.freeze
100 TABLE_CFS = 'TABLE_CFS'.freeze
101 TABLE_NAME = 'TABLE_NAME'.freeze
102 TABLE_NAMES = 'TABLE_NAMES'.freeze
103 TIMERANGE = 'TIMERANGE'.freeze
104 TIMESTAMP = 'TIMESTAMP'.freeze
107 VALUE = 'VALUE'.freeze
108 VERSIONS = org.apache.hadoop.hbase.HConstants::VERSIONS
109 VISIBILITY = 'VISIBILITY'.freeze
116 # Load constants from hbase java API
117 def self.promote_constants(constants)
118 # The constants to import are all in uppercase
119 constants.each do |c|
120 next if c =~ /DEFAULT_.*/ || c != c.upcase
121 next if eval("defined?(#{c})")
122 eval("#{c} = '#{c}'")
126 promote_constants(org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder.constants)
127 promote_constants(org.apache.hadoop.hbase.client.TableDescriptorBuilder.constants)
130 # Ensure that hbase class definitions are imported
131 require 'hbase/hbase'
132 require 'hbase/admin'
133 require 'hbase/taskmonitor'
134 require 'hbase/table'
135 require 'hbase/quotas'
136 require 'hbase/replication_admin'
137 require 'hbase/security'
138 require 'hbase/visibility_labels'
139 require 'hbase/rsgroup_admin'