#!/usr/bin/python
import os
import sys
from xml.dom import minidom

if len(sys.argv) is 1:
	print "Usage: " + os.path.basename(__file__) + " <PropertyName>"
	sys.exit(1)

property = sys.argv[1]

config = os.popen("hbase org.apache.hadoop.hbase.HBaseConfiguration").read()

xmldoc = minidom.parseString(config)

properties = xmldoc.getElementsByTagName('property')
value = ""

for propertyKV in properties:
	xmlKV = propertyKV.toxml()
	if property in xmlKV:
		xmlval = minidom.parseString(xmlKV)
		value = xmlval.getElementsByTagName('value')[0].firstChild.nodeValue

if value is "":
	print "Property " + property + " was not found in HBase configuration file"
	sys.exit(2)

print value

