2008-05-30 15:19:46 -04:00
|
|
|
# Module passed to jirb using the '-r' flag when bin/hbase shell is invoked.
|
|
|
|
# Pollutes jirb with hbase imports and hbase commands. Outputs a banner
|
|
|
|
# that tells user where to find help, shell version, etc.
|
|
|
|
|
|
|
|
# TODO: Process command-line arguments: e.g. --master= or -Dhbase.etc and --formatter
|
|
|
|
# or read hbase shell configurations from irbrc
|
|
|
|
# TODO: Read from environment which outputter to use (outputter should
|
|
|
|
# be able to output to a passed Stream as well as STDIN and STDOUT)
|
|
|
|
# TODO: Write a base class for formatters with ascii, xhtml, and json subclasses.
|
|
|
|
# TODO: Intercept 'help'
|
2008-05-30 01:13:58 -04:00
|
|
|
|
|
|
|
# Run the java magic include and import basic HBase types.
|
|
|
|
include Java
|
2008-06-01 01:06:52 -04:00
|
|
|
import org.apache.hadoop.hbase.HBaseConfiguration
|
2008-05-30 01:13:58 -04:00
|
|
|
import org.apache.hadoop.hbase.client.HTable
|
|
|
|
import org.apache.hadoop.hbase.client.HBaseAdmin
|
|
|
|
import org.apache.hadoop.hbase.HColumnDescriptor
|
|
|
|
import org.apache.hadoop.hbase.HConstants
|
|
|
|
import org.apache.hadoop.hbase.HTableDescriptor
|
|
|
|
import org.apache.hadoop.hbase.io.BatchUpdate
|
|
|
|
|
2008-05-30 15:19:46 -04:00
|
|
|
# Some goodies for hirb. Should these be left up to the user's discretion?
|
|
|
|
require 'irb/completion'
|
|
|
|
|
2008-05-30 01:13:58 -04:00
|
|
|
# Set the irb shell name to be hbase.
|
|
|
|
IRB.conf[:IRB_NAME] = "hbase"
|
|
|
|
|
2008-05-30 15:19:46 -04:00
|
|
|
def hbase
|
|
|
|
puts 'HBase Shell Commands:'
|
|
|
|
puts ' version Output HBase version'
|
2008-05-30 01:13:58 -04:00
|
|
|
end
|
|
|
|
|
2008-06-01 01:06:52 -04:00
|
|
|
def version
|
|
|
|
puts "Version: #{org.apache.hadoop.hbase.util.VersionInfo.getVersion()},\
|
2008-05-30 15:19:46 -04:00
|
|
|
r#{org.apache.hadoop.hbase.util.VersionInfo.getRevision()},\
|
|
|
|
#{org.apache.hadoop.hbase.util.VersionInfo.getDate()}"
|
2008-05-30 01:13:58 -04:00
|
|
|
end
|
2008-05-30 15:19:46 -04:00
|
|
|
|
|
|
|
# Output a banner message that tells users where to go for help
|
|
|
|
# TODO: Test that we're in irb context. For now presume it.
|
2008-06-01 01:06:52 -04:00
|
|
|
# TODO: Test that we are in shell context.
|
|
|
|
puts "HBase Shell; type 'hbase<RETURN>' for the list of supported HBase commands"
|
|
|
|
version
|