You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2013/07/10 13:17:37 UTC

svn commit: r1501723 [7/11] - in /hbase/branches/0.95/hbase-examples: src/main/java/org/apache/hadoop/hbase/thrift/generated/ src/main/java/org/apache/hadoop/hbase/thrift2/ src/main/python/ src/main/python/gen-py/hbase/ src/main/python/thrift1/ src/mai...

Modified: hbase/branches/0.95/hbase-examples/src/main/python/gen-py/hbase/__init__.py
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-examples/src/main/python/gen-py/hbase/__init__.py?rev=1501723&r1=1501722&r2=1501723&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-examples/src/main/python/gen-py/hbase/__init__.py (original)
+++ hbase/branches/0.95/hbase-examples/src/main/python/gen-py/hbase/__init__.py Wed Jul 10 11:17:36 2013
@@ -1 +0,0 @@
-__all__ = ['ttypes', 'constants', 'Hbase']

Modified: hbase/branches/0.95/hbase-examples/src/main/python/gen-py/hbase/constants.py
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-examples/src/main/python/gen-py/hbase/constants.py?rev=1501723&r1=1501722&r2=1501723&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-examples/src/main/python/gen-py/hbase/constants.py (original)
+++ hbase/branches/0.95/hbase-examples/src/main/python/gen-py/hbase/constants.py Wed Jul 10 11:17:36 2013
@@ -1,11 +0,0 @@
-#
-# Autogenerated by Thrift Compiler (0.9.0)
-#
-# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
-#
-#  options string: py
-#
-
-from thrift.Thrift import TType, TMessageType, TException, TApplicationException
-from ttypes import *
-

Modified: hbase/branches/0.95/hbase-examples/src/main/python/gen-py/hbase/ttypes.py
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-examples/src/main/python/gen-py/hbase/ttypes.py?rev=1501723&r1=1501722&r2=1501723&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-examples/src/main/python/gen-py/hbase/ttypes.py (original)
+++ hbase/branches/0.95/hbase-examples/src/main/python/gen-py/hbase/ttypes.py Wed Jul 10 11:17:36 2013
@@ -1,1083 +0,0 @@
-#
-# Autogenerated by Thrift Compiler (0.9.0)
-#
-# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
-#
-#  options string: py
-#
-
-from thrift.Thrift import TType, TMessageType, TException, TApplicationException
-
-from thrift.transport import TTransport
-from thrift.protocol import TBinaryProtocol, TProtocol
-try:
-  from thrift.protocol import fastbinary
-except:
-  fastbinary = None
-
-
-
-class TCell:
-  """
-  TCell - Used to transport a cell value (byte[]) and the timestamp it was
-  stored with together as a result for get and getRow methods. This promotes
-  the timestamp of a cell to a first-class value, making it easy to take
-  note of temporal data. Cell is used all the way from HStore up to HTable.
-
-  Attributes:
-   - value
-   - timestamp
-  """
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.STRING, 'value', None, None, ), # 1
-    (2, TType.I64, 'timestamp', None, None, ), # 2
-  )
-
-  def __init__(self, value=None, timestamp=None,):
-    self.value = value
-    self.timestamp = timestamp
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.STRING:
-          self.value = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 2:
-        if ftype == TType.I64:
-          self.timestamp = iprot.readI64();
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('TCell')
-    if self.value is not None:
-      oprot.writeFieldBegin('value', TType.STRING, 1)
-      oprot.writeString(self.value)
-      oprot.writeFieldEnd()
-    if self.timestamp is not None:
-      oprot.writeFieldBegin('timestamp', TType.I64, 2)
-      oprot.writeI64(self.timestamp)
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def validate(self):
-    return
-
-
-  def __repr__(self):
-    L = ['%s=%r' % (key, value)
-      for key, value in self.__dict__.iteritems()]
-    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class ColumnDescriptor:
-  """
-  An HColumnDescriptor contains information about a column family
-  such as the number of versions, compression settings, etc. It is
-  used as input when creating a table or adding a column.
-
-  Attributes:
-   - name
-   - maxVersions
-   - compression
-   - inMemory
-   - bloomFilterType
-   - bloomFilterVectorSize
-   - bloomFilterNbHashes
-   - blockCacheEnabled
-   - timeToLive
-  """
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.STRING, 'name', None, None, ), # 1
-    (2, TType.I32, 'maxVersions', None, 3, ), # 2
-    (3, TType.STRING, 'compression', None, "NONE", ), # 3
-    (4, TType.BOOL, 'inMemory', None, False, ), # 4
-    (5, TType.STRING, 'bloomFilterType', None, "NONE", ), # 5
-    (6, TType.I32, 'bloomFilterVectorSize', None, 0, ), # 6
-    (7, TType.I32, 'bloomFilterNbHashes', None, 0, ), # 7
-    (8, TType.BOOL, 'blockCacheEnabled', None, False, ), # 8
-    (9, TType.I32, 'timeToLive', None, -1, ), # 9
-  )
-
-  def __init__(self, name=None, maxVersions=thrift_spec[2][4], compression=thrift_spec[3][4], inMemory=thrift_spec[4][4], bloomFilterType=thrift_spec[5][4], bloomFilterVectorSize=thrift_spec[6][4], bloomFilterNbHashes=thrift_spec[7][4], blockCacheEnabled=thrift_spec[8][4], timeToLive=thrift_spec[9][4],):
-    self.name = name
-    self.maxVersions = maxVersions
-    self.compression = compression
-    self.inMemory = inMemory
-    self.bloomFilterType = bloomFilterType
-    self.bloomFilterVectorSize = bloomFilterVectorSize
-    self.bloomFilterNbHashes = bloomFilterNbHashes
-    self.blockCacheEnabled = blockCacheEnabled
-    self.timeToLive = timeToLive
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.STRING:
-          self.name = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 2:
-        if ftype == TType.I32:
-          self.maxVersions = iprot.readI32();
-        else:
-          iprot.skip(ftype)
-      elif fid == 3:
-        if ftype == TType.STRING:
-          self.compression = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 4:
-        if ftype == TType.BOOL:
-          self.inMemory = iprot.readBool();
-        else:
-          iprot.skip(ftype)
-      elif fid == 5:
-        if ftype == TType.STRING:
-          self.bloomFilterType = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 6:
-        if ftype == TType.I32:
-          self.bloomFilterVectorSize = iprot.readI32();
-        else:
-          iprot.skip(ftype)
-      elif fid == 7:
-        if ftype == TType.I32:
-          self.bloomFilterNbHashes = iprot.readI32();
-        else:
-          iprot.skip(ftype)
-      elif fid == 8:
-        if ftype == TType.BOOL:
-          self.blockCacheEnabled = iprot.readBool();
-        else:
-          iprot.skip(ftype)
-      elif fid == 9:
-        if ftype == TType.I32:
-          self.timeToLive = iprot.readI32();
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('ColumnDescriptor')
-    if self.name is not None:
-      oprot.writeFieldBegin('name', TType.STRING, 1)
-      oprot.writeString(self.name)
-      oprot.writeFieldEnd()
-    if self.maxVersions is not None:
-      oprot.writeFieldBegin('maxVersions', TType.I32, 2)
-      oprot.writeI32(self.maxVersions)
-      oprot.writeFieldEnd()
-    if self.compression is not None:
-      oprot.writeFieldBegin('compression', TType.STRING, 3)
-      oprot.writeString(self.compression)
-      oprot.writeFieldEnd()
-    if self.inMemory is not None:
-      oprot.writeFieldBegin('inMemory', TType.BOOL, 4)
-      oprot.writeBool(self.inMemory)
-      oprot.writeFieldEnd()
-    if self.bloomFilterType is not None:
-      oprot.writeFieldBegin('bloomFilterType', TType.STRING, 5)
-      oprot.writeString(self.bloomFilterType)
-      oprot.writeFieldEnd()
-    if self.bloomFilterVectorSize is not None:
-      oprot.writeFieldBegin('bloomFilterVectorSize', TType.I32, 6)
-      oprot.writeI32(self.bloomFilterVectorSize)
-      oprot.writeFieldEnd()
-    if self.bloomFilterNbHashes is not None:
-      oprot.writeFieldBegin('bloomFilterNbHashes', TType.I32, 7)
-      oprot.writeI32(self.bloomFilterNbHashes)
-      oprot.writeFieldEnd()
-    if self.blockCacheEnabled is not None:
-      oprot.writeFieldBegin('blockCacheEnabled', TType.BOOL, 8)
-      oprot.writeBool(self.blockCacheEnabled)
-      oprot.writeFieldEnd()
-    if self.timeToLive is not None:
-      oprot.writeFieldBegin('timeToLive', TType.I32, 9)
-      oprot.writeI32(self.timeToLive)
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def validate(self):
-    return
-
-
-  def __repr__(self):
-    L = ['%s=%r' % (key, value)
-      for key, value in self.__dict__.iteritems()]
-    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class TRegionInfo:
-  """
-  A TRegionInfo contains information about an HTable region.
-
-  Attributes:
-   - startKey
-   - endKey
-   - id
-   - name
-   - version
-   - serverName
-   - port
-  """
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.STRING, 'startKey', None, None, ), # 1
-    (2, TType.STRING, 'endKey', None, None, ), # 2
-    (3, TType.I64, 'id', None, None, ), # 3
-    (4, TType.STRING, 'name', None, None, ), # 4
-    (5, TType.BYTE, 'version', None, None, ), # 5
-    (6, TType.STRING, 'serverName', None, None, ), # 6
-    (7, TType.I32, 'port', None, None, ), # 7
-  )
-
-  def __init__(self, startKey=None, endKey=None, id=None, name=None, version=None, serverName=None, port=None,):
-    self.startKey = startKey
-    self.endKey = endKey
-    self.id = id
-    self.name = name
-    self.version = version
-    self.serverName = serverName
-    self.port = port
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.STRING:
-          self.startKey = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 2:
-        if ftype == TType.STRING:
-          self.endKey = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 3:
-        if ftype == TType.I64:
-          self.id = iprot.readI64();
-        else:
-          iprot.skip(ftype)
-      elif fid == 4:
-        if ftype == TType.STRING:
-          self.name = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 5:
-        if ftype == TType.BYTE:
-          self.version = iprot.readByte();
-        else:
-          iprot.skip(ftype)
-      elif fid == 6:
-        if ftype == TType.STRING:
-          self.serverName = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 7:
-        if ftype == TType.I32:
-          self.port = iprot.readI32();
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('TRegionInfo')
-    if self.startKey is not None:
-      oprot.writeFieldBegin('startKey', TType.STRING, 1)
-      oprot.writeString(self.startKey)
-      oprot.writeFieldEnd()
-    if self.endKey is not None:
-      oprot.writeFieldBegin('endKey', TType.STRING, 2)
-      oprot.writeString(self.endKey)
-      oprot.writeFieldEnd()
-    if self.id is not None:
-      oprot.writeFieldBegin('id', TType.I64, 3)
-      oprot.writeI64(self.id)
-      oprot.writeFieldEnd()
-    if self.name is not None:
-      oprot.writeFieldBegin('name', TType.STRING, 4)
-      oprot.writeString(self.name)
-      oprot.writeFieldEnd()
-    if self.version is not None:
-      oprot.writeFieldBegin('version', TType.BYTE, 5)
-      oprot.writeByte(self.version)
-      oprot.writeFieldEnd()
-    if self.serverName is not None:
-      oprot.writeFieldBegin('serverName', TType.STRING, 6)
-      oprot.writeString(self.serverName)
-      oprot.writeFieldEnd()
-    if self.port is not None:
-      oprot.writeFieldBegin('port', TType.I32, 7)
-      oprot.writeI32(self.port)
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def validate(self):
-    return
-
-
-  def __repr__(self):
-    L = ['%s=%r' % (key, value)
-      for key, value in self.__dict__.iteritems()]
-    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class Mutation:
-  """
-  A Mutation object is used to either update or delete a column-value.
-
-  Attributes:
-   - isDelete
-   - column
-   - value
-   - writeToWAL
-  """
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.BOOL, 'isDelete', None, False, ), # 1
-    (2, TType.STRING, 'column', None, None, ), # 2
-    (3, TType.STRING, 'value', None, None, ), # 3
-    (4, TType.BOOL, 'writeToWAL', None, True, ), # 4
-  )
-
-  def __init__(self, isDelete=thrift_spec[1][4], column=None, value=None, writeToWAL=thrift_spec[4][4],):
-    self.isDelete = isDelete
-    self.column = column
-    self.value = value
-    self.writeToWAL = writeToWAL
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.BOOL:
-          self.isDelete = iprot.readBool();
-        else:
-          iprot.skip(ftype)
-      elif fid == 2:
-        if ftype == TType.STRING:
-          self.column = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 3:
-        if ftype == TType.STRING:
-          self.value = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 4:
-        if ftype == TType.BOOL:
-          self.writeToWAL = iprot.readBool();
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('Mutation')
-    if self.isDelete is not None:
-      oprot.writeFieldBegin('isDelete', TType.BOOL, 1)
-      oprot.writeBool(self.isDelete)
-      oprot.writeFieldEnd()
-    if self.column is not None:
-      oprot.writeFieldBegin('column', TType.STRING, 2)
-      oprot.writeString(self.column)
-      oprot.writeFieldEnd()
-    if self.value is not None:
-      oprot.writeFieldBegin('value', TType.STRING, 3)
-      oprot.writeString(self.value)
-      oprot.writeFieldEnd()
-    if self.writeToWAL is not None:
-      oprot.writeFieldBegin('writeToWAL', TType.BOOL, 4)
-      oprot.writeBool(self.writeToWAL)
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def validate(self):
-    return
-
-
-  def __repr__(self):
-    L = ['%s=%r' % (key, value)
-      for key, value in self.__dict__.iteritems()]
-    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class BatchMutation:
-  """
-  A BatchMutation object is used to apply a number of Mutations to a single row.
-
-  Attributes:
-   - row
-   - mutations
-  """
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.STRING, 'row', None, None, ), # 1
-    (2, TType.LIST, 'mutations', (TType.STRUCT,(Mutation, Mutation.thrift_spec)), None, ), # 2
-  )
-
-  def __init__(self, row=None, mutations=None,):
-    self.row = row
-    self.mutations = mutations
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.STRING:
-          self.row = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 2:
-        if ftype == TType.LIST:
-          self.mutations = []
-          (_etype3, _size0) = iprot.readListBegin()
-          for _i4 in xrange(_size0):
-            _elem5 = Mutation()
-            _elem5.read(iprot)
-            self.mutations.append(_elem5)
-          iprot.readListEnd()
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('BatchMutation')
-    if self.row is not None:
-      oprot.writeFieldBegin('row', TType.STRING, 1)
-      oprot.writeString(self.row)
-      oprot.writeFieldEnd()
-    if self.mutations is not None:
-      oprot.writeFieldBegin('mutations', TType.LIST, 2)
-      oprot.writeListBegin(TType.STRUCT, len(self.mutations))
-      for iter6 in self.mutations:
-        iter6.write(oprot)
-      oprot.writeListEnd()
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def validate(self):
-    return
-
-
-  def __repr__(self):
-    L = ['%s=%r' % (key, value)
-      for key, value in self.__dict__.iteritems()]
-    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class TIncrement:
-  """
-  For increments that are not incrementColumnValue
-  equivalents.
-
-  Attributes:
-   - table
-   - row
-   - column
-   - ammount
-  """
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.STRING, 'table', None, None, ), # 1
-    (2, TType.STRING, 'row', None, None, ), # 2
-    (3, TType.STRING, 'column', None, None, ), # 3
-    (4, TType.I64, 'ammount', None, None, ), # 4
-  )
-
-  def __init__(self, table=None, row=None, column=None, ammount=None,):
-    self.table = table
-    self.row = row
-    self.column = column
-    self.ammount = ammount
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.STRING:
-          self.table = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 2:
-        if ftype == TType.STRING:
-          self.row = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 3:
-        if ftype == TType.STRING:
-          self.column = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 4:
-        if ftype == TType.I64:
-          self.ammount = iprot.readI64();
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('TIncrement')
-    if self.table is not None:
-      oprot.writeFieldBegin('table', TType.STRING, 1)
-      oprot.writeString(self.table)
-      oprot.writeFieldEnd()
-    if self.row is not None:
-      oprot.writeFieldBegin('row', TType.STRING, 2)
-      oprot.writeString(self.row)
-      oprot.writeFieldEnd()
-    if self.column is not None:
-      oprot.writeFieldBegin('column', TType.STRING, 3)
-      oprot.writeString(self.column)
-      oprot.writeFieldEnd()
-    if self.ammount is not None:
-      oprot.writeFieldBegin('ammount', TType.I64, 4)
-      oprot.writeI64(self.ammount)
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def validate(self):
-    return
-
-
-  def __repr__(self):
-    L = ['%s=%r' % (key, value)
-      for key, value in self.__dict__.iteritems()]
-    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class TRowResult:
-  """
-  Holds row name and then a map of columns to cells.
-
-  Attributes:
-   - row
-   - columns
-  """
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.STRING, 'row', None, None, ), # 1
-    (2, TType.MAP, 'columns', (TType.STRING,None,TType.STRUCT,(TCell, TCell.thrift_spec)), None, ), # 2
-  )
-
-  def __init__(self, row=None, columns=None,):
-    self.row = row
-    self.columns = columns
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.STRING:
-          self.row = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 2:
-        if ftype == TType.MAP:
-          self.columns = {}
-          (_ktype8, _vtype9, _size7 ) = iprot.readMapBegin() 
-          for _i11 in xrange(_size7):
-            _key12 = iprot.readString();
-            _val13 = TCell()
-            _val13.read(iprot)
-            self.columns[_key12] = _val13
-          iprot.readMapEnd()
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('TRowResult')
-    if self.row is not None:
-      oprot.writeFieldBegin('row', TType.STRING, 1)
-      oprot.writeString(self.row)
-      oprot.writeFieldEnd()
-    if self.columns is not None:
-      oprot.writeFieldBegin('columns', TType.MAP, 2)
-      oprot.writeMapBegin(TType.STRING, TType.STRUCT, len(self.columns))
-      for kiter14,viter15 in self.columns.items():
-        oprot.writeString(kiter14)
-        viter15.write(oprot)
-      oprot.writeMapEnd()
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def validate(self):
-    return
-
-
-  def __repr__(self):
-    L = ['%s=%r' % (key, value)
-      for key, value in self.__dict__.iteritems()]
-    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class TScan:
-  """
-  A Scan object is used to specify scanner parameters when opening a scanner.
-
-  Attributes:
-   - startRow
-   - stopRow
-   - timestamp
-   - columns
-   - caching
-   - filterString
-  """
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.STRING, 'startRow', None, None, ), # 1
-    (2, TType.STRING, 'stopRow', None, None, ), # 2
-    (3, TType.I64, 'timestamp', None, None, ), # 3
-    (4, TType.LIST, 'columns', (TType.STRING,None), None, ), # 4
-    (5, TType.I32, 'caching', None, None, ), # 5
-    (6, TType.STRING, 'filterString', None, None, ), # 6
-  )
-
-  def __init__(self, startRow=None, stopRow=None, timestamp=None, columns=None, caching=None, filterString=None,):
-    self.startRow = startRow
-    self.stopRow = stopRow
-    self.timestamp = timestamp
-    self.columns = columns
-    self.caching = caching
-    self.filterString = filterString
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.STRING:
-          self.startRow = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 2:
-        if ftype == TType.STRING:
-          self.stopRow = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      elif fid == 3:
-        if ftype == TType.I64:
-          self.timestamp = iprot.readI64();
-        else:
-          iprot.skip(ftype)
-      elif fid == 4:
-        if ftype == TType.LIST:
-          self.columns = []
-          (_etype19, _size16) = iprot.readListBegin()
-          for _i20 in xrange(_size16):
-            _elem21 = iprot.readString();
-            self.columns.append(_elem21)
-          iprot.readListEnd()
-        else:
-          iprot.skip(ftype)
-      elif fid == 5:
-        if ftype == TType.I32:
-          self.caching = iprot.readI32();
-        else:
-          iprot.skip(ftype)
-      elif fid == 6:
-        if ftype == TType.STRING:
-          self.filterString = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('TScan')
-    if self.startRow is not None:
-      oprot.writeFieldBegin('startRow', TType.STRING, 1)
-      oprot.writeString(self.startRow)
-      oprot.writeFieldEnd()
-    if self.stopRow is not None:
-      oprot.writeFieldBegin('stopRow', TType.STRING, 2)
-      oprot.writeString(self.stopRow)
-      oprot.writeFieldEnd()
-    if self.timestamp is not None:
-      oprot.writeFieldBegin('timestamp', TType.I64, 3)
-      oprot.writeI64(self.timestamp)
-      oprot.writeFieldEnd()
-    if self.columns is not None:
-      oprot.writeFieldBegin('columns', TType.LIST, 4)
-      oprot.writeListBegin(TType.STRING, len(self.columns))
-      for iter22 in self.columns:
-        oprot.writeString(iter22)
-      oprot.writeListEnd()
-      oprot.writeFieldEnd()
-    if self.caching is not None:
-      oprot.writeFieldBegin('caching', TType.I32, 5)
-      oprot.writeI32(self.caching)
-      oprot.writeFieldEnd()
-    if self.filterString is not None:
-      oprot.writeFieldBegin('filterString', TType.STRING, 6)
-      oprot.writeString(self.filterString)
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def validate(self):
-    return
-
-
-  def __repr__(self):
-    L = ['%s=%r' % (key, value)
-      for key, value in self.__dict__.iteritems()]
-    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class IOError(TException):
-  """
-  An IOError exception signals that an error occurred communicating
-  to the Hbase master or an Hbase region server.  Also used to return
-  more general Hbase error conditions.
-
-  Attributes:
-   - message
-  """
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.STRING, 'message', None, None, ), # 1
-  )
-
-  def __init__(self, message=None,):
-    self.message = message
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.STRING:
-          self.message = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('IOError')
-    if self.message is not None:
-      oprot.writeFieldBegin('message', TType.STRING, 1)
-      oprot.writeString(self.message)
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def validate(self):
-    return
-
-
-  def __str__(self):
-    return repr(self)
-
-  def __repr__(self):
-    L = ['%s=%r' % (key, value)
-      for key, value in self.__dict__.iteritems()]
-    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class IllegalArgument(TException):
-  """
-  An IllegalArgument exception indicates an illegal or invalid
-  argument was passed into a procedure.
-
-  Attributes:
-   - message
-  """
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.STRING, 'message', None, None, ), # 1
-  )
-
-  def __init__(self, message=None,):
-    self.message = message
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.STRING:
-          self.message = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('IllegalArgument')
-    if self.message is not None:
-      oprot.writeFieldBegin('message', TType.STRING, 1)
-      oprot.writeString(self.message)
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def validate(self):
-    return
-
-
-  def __str__(self):
-    return repr(self)
-
-  def __repr__(self):
-    L = ['%s=%r' % (key, value)
-      for key, value in self.__dict__.iteritems()]
-    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)
-
-class AlreadyExists(TException):
-  """
-  An AlreadyExists exceptions signals that a table with the specified
-  name already exists
-
-  Attributes:
-   - message
-  """
-
-  thrift_spec = (
-    None, # 0
-    (1, TType.STRING, 'message', None, None, ), # 1
-  )
-
-  def __init__(self, message=None,):
-    self.message = message
-
-  def read(self, iprot):
-    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-      return
-    iprot.readStructBegin()
-    while True:
-      (fname, ftype, fid) = iprot.readFieldBegin()
-      if ftype == TType.STOP:
-        break
-      if fid == 1:
-        if ftype == TType.STRING:
-          self.message = iprot.readString();
-        else:
-          iprot.skip(ftype)
-      else:
-        iprot.skip(ftype)
-      iprot.readFieldEnd()
-    iprot.readStructEnd()
-
-  def write(self, oprot):
-    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-      return
-    oprot.writeStructBegin('AlreadyExists')
-    if self.message is not None:
-      oprot.writeFieldBegin('message', TType.STRING, 1)
-      oprot.writeString(self.message)
-      oprot.writeFieldEnd()
-    oprot.writeFieldStop()
-    oprot.writeStructEnd()
-
-  def validate(self):
-    return
-
-
-  def __str__(self):
-    return repr(self)
-
-  def __repr__(self):
-    L = ['%s=%r' % (key, value)
-      for key, value in self.__dict__.iteritems()]
-    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
-  def __eq__(self, other):
-    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
-  def __ne__(self, other):
-    return not (self == other)

Added: hbase/branches/0.95/hbase-examples/src/main/python/thrift1/DemoClient.py
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-examples/src/main/python/thrift1/DemoClient.py?rev=1501723&view=auto
==============================================================================
--- hbase/branches/0.95/hbase-examples/src/main/python/thrift1/DemoClient.py (added)
+++ hbase/branches/0.95/hbase-examples/src/main/python/thrift1/DemoClient.py Wed Jul 10 11:17:36 2013
@@ -0,0 +1,218 @@
+#!/usr/bin/python
+'''
+  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.
+'''
+
+import sys
+import time
+import os
+
+# Modify this import path to point to the correct location to thrift.
+thrift_path = os.path.abspath('/Users/sergey/Downloads/thrift/lib/py/build/lib.macosx-10.8-intel-2.7')
+sys.path.append(thrift_path)
+gen_py_path = os.path.abspath('gen-py')
+sys.path.append(gen_py_path)
+
+from thrift import Thrift
+from thrift.transport import TSocket, TTransport
+from thrift.protocol import TBinaryProtocol
+from hbase import ttypes
+from hbase.Hbase import Client, ColumnDescriptor, Mutation
+
+def printVersions(row, versions):
+  print "row: " + row + ", values: ",
+  for cell in versions:
+    print cell.value + "; ",
+  print
+
+def printRow(entry):
+  print "row: " + entry.row + ", cols:",
+  for k in sorted(entry.columns):
+    print k + " => " + entry.columns[k].value,
+  print
+
+
+def demo_client(host, port, is_framed_transport):
+
+  # Make socket
+  socket = TSocket.TSocket(host, port)
+
+  # Make transport
+  if is_framed_transport:
+    transport = TTransport.TFramedTransport(socket)
+  else:
+    transport = TTransport.TBufferedTransport(socket)
+
+  # Wrap in a protocol
+  protocol = TBinaryProtocol.TBinaryProtocol(transport)
+
+  # Create a client to use the protocol encoder
+  client = Client(protocol)
+
+  # Connect!
+  transport.open()
+
+  t = "demo_table"
+
+  #
+  # Scan all tables, look for the demo table and delete it.
+  #
+  print "scanning tables..."
+  for table in client.getTableNames():
+    print "  found: %s" %(table)
+    if table == t:
+      if client.isTableEnabled(table):
+        print "    disabling table: %s"  %(t)
+        client.disableTable(table)
+      print "    deleting table: %s"  %(t)
+      client.deleteTable(table)
+
+  columns = []
+  col = ColumnDescriptor()
+  col.name = 'entry:'
+  col.maxVersions = 10
+  columns.append(col)
+  col = ColumnDescriptor()
+  col.name = 'unused:'
+  columns.append(col)
+
+  try:
+    print "creating table: %s" %(t)
+    client.createTable(t, columns)
+  except AlreadyExists, ae:
+    print "WARN: " + ae.message
+
+  cols = client.getColumnDescriptors(t)
+  print "column families in %s" %(t)
+  for col_name in cols.keys():
+    col = cols[col_name]
+    print "  column: %s, maxVer: %d" % (col.name, col.maxVersions)
+
+  dummy_attributes = {}
+  #
+  # Test UTF-8 handling
+  #
+  invalid = "foo-\xfc\xa1\xa1\xa1\xa1\xa1"
+  valid = "foo-\xE7\x94\x9F\xE3\x83\x93\xE3\x83\xBC\xE3\x83\xAB";
+
+  # non-utf8 is fine for data
+  mutations = [Mutation(column="entry:foo",value=invalid)]
+  print str(mutations)
+  client.mutateRow(t, "foo", mutations, dummy_attributes)
+
+  # try empty strings
+  mutations = [Mutation(column="entry:", value="")]
+  client.mutateRow(t, "", mutations, dummy_attributes)
+
+  # this row name is valid utf8
+  mutations = [Mutation(column="entry:foo", value=valid)]
+  client.mutateRow(t, valid, mutations, dummy_attributes)
+
+  # non-utf8 is not allowed in row names
+  try:
+    mutations = [Mutation(column="entry:foo", value=invalid)]
+    client.mutateRow(t, invalid, mutations, dummy_attributes)
+  except ttypes.IOError, e:
+    print 'expected exception: %s' %(e.message)
+
+  # Run a scanner on the rows we just created
+  print "Starting scanner..."
+  scanner = client.scannerOpen(t, "", ["entry:"], dummy_attributes)
+
+  r = client.scannerGet(scanner)
+  while r:
+    printRow(r[0])
+    r = client.scannerGet(scanner)
+  print "Scanner finished"
+
+  #
+  # Run some operations on a bunch of rows.
+  #
+  for e in range(100, 0, -1):
+    # format row keys as "00000" to "00100"
+    row = "%0.5d" % (e)
+
+    mutations = [Mutation(column="unused:", value="DELETE_ME")]
+    client.mutateRow(t, row, mutations, dummy_attributes)
+    printRow(client.getRow(t, row, dummy_attributes)[0])
+    client.deleteAllRow(t, row, dummy_attributes)
+
+    mutations = [Mutation(column="entry:num", value="0"),
+                 Mutation(column="entry:foo", value="FOO")]
+    client.mutateRow(t, row, mutations, dummy_attributes)
+    printRow(client.getRow(t, row, dummy_attributes)[0]);
+
+    mutations = [Mutation(column="entry:foo",isDelete=True),
+                 Mutation(column="entry:num",value="-1")]
+    client.mutateRow(t, row, mutations, dummy_attributes)
+    printRow(client.getRow(t, row, dummy_attributes)[0])
+
+    mutations = [Mutation(column="entry:num", value=str(e)),
+                 Mutation(column="entry:sqr", value=str(e*e))]
+    client.mutateRow(t, row, mutations, dummy_attributes)
+    printRow(client.getRow(t, row, dummy_attributes)[0])
+
+    time.sleep(0.05)
+
+    mutations = [Mutation(column="entry:num",value="-999"),
+                 Mutation(column="entry:sqr",isDelete=True)]
+    client.mutateRowTs(t, row, mutations, 1, dummy_attributes) # shouldn't override latest
+    printRow(client.getRow(t, row, dummy_attributes)[0])
+
+    versions = client.getVer(t, row, "entry:num", 10, dummy_attributes)
+    printVersions(row, versions)
+    if len(versions) != 3:
+      print("FATAL: wrong # of versions")
+      sys.exit(-1)
+
+    r = client.get(t, row, "entry:foo", dummy_attributes)
+    # just to be explicit, we get lists back, if it's empty there was no matching row.
+    if len(r) > 0:
+      raise "shouldn't get here!"
+
+  columnNames = []
+  for (col, desc) in client.getColumnDescriptors(t).items():
+    print "column with name: "+desc.name
+    print desc
+    columnNames.append(desc.name+":")
+
+  print "Starting scanner..."
+  scanner = client.scannerOpenWithStop(t, "00020", "00040", columnNames, dummy_attributes)
+
+  r = client.scannerGet(scanner)
+  while r:
+    printRow(r[0])
+    r = client.scannerGet(scanner)
+
+  client.scannerClose(scanner)
+  print "Scanner finished"
+
+  transport.close()
+
+
+if __name__ == '__main__':
+
+  import sys
+  if len(sys.argv) < 3:
+    print 'usage: %s <host> <port>' % __file__
+    sys.exit(1)
+
+  host = sys.argv[1]
+  port = sys.argv[2]
+  is_framed_transport = False
+  demo_client(host, port, is_framed_transport)
+

Added: hbase/branches/0.95/hbase-examples/src/main/python/thrift1/gen-py/hbase/Hbase-remote
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-examples/src/main/python/thrift1/gen-py/hbase/Hbase-remote?rev=1501723&view=auto
==============================================================================
--- hbase/branches/0.95/hbase-examples/src/main/python/thrift1/gen-py/hbase/Hbase-remote (added)
+++ hbase/branches/0.95/hbase-examples/src/main/python/thrift1/gen-py/hbase/Hbase-remote Wed Jul 10 11:17:36 2013
@@ -0,0 +1,382 @@
+#!/usr/bin/env python
+#
+# Autogenerated by Thrift Compiler (0.9.0)
+#
+# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+#
+#  options string: py
+#
+
+import sys
+import pprint
+from urlparse import urlparse
+from thrift.transport import TTransport
+from thrift.transport import TSocket
+from thrift.transport import THttpClient
+from thrift.protocol import TBinaryProtocol
+
+import Hbase
+from ttypes import *
+
+if len(sys.argv) <= 1 or sys.argv[1] == '--help':
+  print ''
+  print 'Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
+  print ''
+  print 'Functions:'
+  print '  void enableTable(Bytes tableName)'
+  print '  void disableTable(Bytes tableName)'
+  print '  bool isTableEnabled(Bytes tableName)'
+  print '  void compact(Bytes tableNameOrRegionName)'
+  print '  void majorCompact(Bytes tableNameOrRegionName)'
+  print '   getTableNames()'
+  print '   getColumnDescriptors(Text tableName)'
+  print '   getTableRegions(Text tableName)'
+  print '  void createTable(Text tableName,  columnFamilies)'
+  print '  void deleteTable(Text tableName)'
+  print '   get(Text tableName, Text row, Text column,  attributes)'
+  print '   getVer(Text tableName, Text row, Text column, i32 numVersions,  attributes)'
+  print '   getVerTs(Text tableName, Text row, Text column, i64 timestamp, i32 numVersions,  attributes)'
+  print '   getRow(Text tableName, Text row,  attributes)'
+  print '   getRowWithColumns(Text tableName, Text row,  columns,  attributes)'
+  print '   getRowTs(Text tableName, Text row, i64 timestamp,  attributes)'
+  print '   getRowWithColumnsTs(Text tableName, Text row,  columns, i64 timestamp,  attributes)'
+  print '   getRows(Text tableName,  rows,  attributes)'
+  print '   getRowsWithColumns(Text tableName,  rows,  columns,  attributes)'
+  print '   getRowsTs(Text tableName,  rows, i64 timestamp,  attributes)'
+  print '   getRowsWithColumnsTs(Text tableName,  rows,  columns, i64 timestamp,  attributes)'
+  print '  void mutateRow(Text tableName, Text row,  mutations,  attributes)'
+  print '  void mutateRowTs(Text tableName, Text row,  mutations, i64 timestamp,  attributes)'
+  print '  void mutateRows(Text tableName,  rowBatches,  attributes)'
+  print '  void mutateRowsTs(Text tableName,  rowBatches, i64 timestamp,  attributes)'
+  print '  i64 atomicIncrement(Text tableName, Text row, Text column, i64 value)'
+  print '  void deleteAll(Text tableName, Text row, Text column,  attributes)'
+  print '  void deleteAllTs(Text tableName, Text row, Text column, i64 timestamp,  attributes)'
+  print '  void deleteAllRow(Text tableName, Text row,  attributes)'
+  print '  void increment(TIncrement increment)'
+  print '  void incrementRows( increments)'
+  print '  void deleteAllRowTs(Text tableName, Text row, i64 timestamp,  attributes)'
+  print '  ScannerID scannerOpenWithScan(Text tableName, TScan scan,  attributes)'
+  print '  ScannerID scannerOpen(Text tableName, Text startRow,  columns,  attributes)'
+  print '  ScannerID scannerOpenWithStop(Text tableName, Text startRow, Text stopRow,  columns,  attributes)'
+  print '  ScannerID scannerOpenWithPrefix(Text tableName, Text startAndPrefix,  columns,  attributes)'
+  print '  ScannerID scannerOpenTs(Text tableName, Text startRow,  columns, i64 timestamp,  attributes)'
+  print '  ScannerID scannerOpenWithStopTs(Text tableName, Text startRow, Text stopRow,  columns, i64 timestamp,  attributes)'
+  print '   scannerGet(ScannerID id)'
+  print '   scannerGetList(ScannerID id, i32 nbRows)'
+  print '  void scannerClose(ScannerID id)'
+  print '   getRowOrBefore(Text tableName, Text row, Text family)'
+  print '  TRegionInfo getRegionInfo(Text row)'
+  print ''
+  sys.exit(0)
+
+pp = pprint.PrettyPrinter(indent = 2)
+host = 'localhost'
+port = 9090
+uri = ''
+framed = False
+http = False
+argi = 1
+
+if sys.argv[argi] == '-h':
+  parts = sys.argv[argi+1].split(':')
+  host = parts[0]
+  if len(parts) > 1:
+    port = int(parts[1])
+  argi += 2
+
+if sys.argv[argi] == '-u':
+  url = urlparse(sys.argv[argi+1])
+  parts = url[1].split(':')
+  host = parts[0]
+  if len(parts) > 1:
+    port = int(parts[1])
+  else:
+    port = 80
+  uri = url[2]
+  if url[4]:
+    uri += '?%s' % url[4]
+  http = True
+  argi += 2
+
+if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
+  framed = True
+  argi += 1
+
+cmd = sys.argv[argi]
+args = sys.argv[argi+1:]
+
+if http:
+  transport = THttpClient.THttpClient(host, port, uri)
+else:
+  socket = TSocket.TSocket(host, port)
+  if framed:
+    transport = TTransport.TFramedTransport(socket)
+  else:
+    transport = TTransport.TBufferedTransport(socket)
+protocol = TBinaryProtocol.TBinaryProtocol(transport)
+client = Hbase.Client(protocol)
+transport.open()
+
+if cmd == 'enableTable':
+  if len(args) != 1:
+    print 'enableTable requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.enableTable(eval(args[0]),))
+
+elif cmd == 'disableTable':
+  if len(args) != 1:
+    print 'disableTable requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.disableTable(eval(args[0]),))
+
+elif cmd == 'isTableEnabled':
+  if len(args) != 1:
+    print 'isTableEnabled requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.isTableEnabled(eval(args[0]),))
+
+elif cmd == 'compact':
+  if len(args) != 1:
+    print 'compact requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.compact(eval(args[0]),))
+
+elif cmd == 'majorCompact':
+  if len(args) != 1:
+    print 'majorCompact requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.majorCompact(eval(args[0]),))
+
+elif cmd == 'getTableNames':
+  if len(args) != 0:
+    print 'getTableNames requires 0 args'
+    sys.exit(1)
+  pp.pprint(client.getTableNames())
+
+elif cmd == 'getColumnDescriptors':
+  if len(args) != 1:
+    print 'getColumnDescriptors requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.getColumnDescriptors(eval(args[0]),))
+
+elif cmd == 'getTableRegions':
+  if len(args) != 1:
+    print 'getTableRegions requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.getTableRegions(eval(args[0]),))
+
+elif cmd == 'createTable':
+  if len(args) != 2:
+    print 'createTable requires 2 args'
+    sys.exit(1)
+  pp.pprint(client.createTable(eval(args[0]),eval(args[1]),))
+
+elif cmd == 'deleteTable':
+  if len(args) != 1:
+    print 'deleteTable requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.deleteTable(eval(args[0]),))
+
+elif cmd == 'get':
+  if len(args) != 4:
+    print 'get requires 4 args'
+    sys.exit(1)
+  pp.pprint(client.get(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
+
+elif cmd == 'getVer':
+  if len(args) != 5:
+    print 'getVer requires 5 args'
+    sys.exit(1)
+  pp.pprint(client.getVer(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
+
+elif cmd == 'getVerTs':
+  if len(args) != 6:
+    print 'getVerTs requires 6 args'
+    sys.exit(1)
+  pp.pprint(client.getVerTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),eval(args[5]),))
+
+elif cmd == 'getRow':
+  if len(args) != 3:
+    print 'getRow requires 3 args'
+    sys.exit(1)
+  pp.pprint(client.getRow(eval(args[0]),eval(args[1]),eval(args[2]),))
+
+elif cmd == 'getRowWithColumns':
+  if len(args) != 4:
+    print 'getRowWithColumns requires 4 args'
+    sys.exit(1)
+  pp.pprint(client.getRowWithColumns(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
+
+elif cmd == 'getRowTs':
+  if len(args) != 4:
+    print 'getRowTs requires 4 args'
+    sys.exit(1)
+  pp.pprint(client.getRowTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
+
+elif cmd == 'getRowWithColumnsTs':
+  if len(args) != 5:
+    print 'getRowWithColumnsTs requires 5 args'
+    sys.exit(1)
+  pp.pprint(client.getRowWithColumnsTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
+
+elif cmd == 'getRows':
+  if len(args) != 3:
+    print 'getRows requires 3 args'
+    sys.exit(1)
+  pp.pprint(client.getRows(eval(args[0]),eval(args[1]),eval(args[2]),))
+
+elif cmd == 'getRowsWithColumns':
+  if len(args) != 4:
+    print 'getRowsWithColumns requires 4 args'
+    sys.exit(1)
+  pp.pprint(client.getRowsWithColumns(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
+
+elif cmd == 'getRowsTs':
+  if len(args) != 4:
+    print 'getRowsTs requires 4 args'
+    sys.exit(1)
+  pp.pprint(client.getRowsTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
+
+elif cmd == 'getRowsWithColumnsTs':
+  if len(args) != 5:
+    print 'getRowsWithColumnsTs requires 5 args'
+    sys.exit(1)
+  pp.pprint(client.getRowsWithColumnsTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
+
+elif cmd == 'mutateRow':
+  if len(args) != 4:
+    print 'mutateRow requires 4 args'
+    sys.exit(1)
+  pp.pprint(client.mutateRow(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
+
+elif cmd == 'mutateRowTs':
+  if len(args) != 5:
+    print 'mutateRowTs requires 5 args'
+    sys.exit(1)
+  pp.pprint(client.mutateRowTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
+
+elif cmd == 'mutateRows':
+  if len(args) != 3:
+    print 'mutateRows requires 3 args'
+    sys.exit(1)
+  pp.pprint(client.mutateRows(eval(args[0]),eval(args[1]),eval(args[2]),))
+
+elif cmd == 'mutateRowsTs':
+  if len(args) != 4:
+    print 'mutateRowsTs requires 4 args'
+    sys.exit(1)
+  pp.pprint(client.mutateRowsTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
+
+elif cmd == 'atomicIncrement':
+  if len(args) != 4:
+    print 'atomicIncrement requires 4 args'
+    sys.exit(1)
+  pp.pprint(client.atomicIncrement(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
+
+elif cmd == 'deleteAll':
+  if len(args) != 4:
+    print 'deleteAll requires 4 args'
+    sys.exit(1)
+  pp.pprint(client.deleteAll(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
+
+elif cmd == 'deleteAllTs':
+  if len(args) != 5:
+    print 'deleteAllTs requires 5 args'
+    sys.exit(1)
+  pp.pprint(client.deleteAllTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
+
+elif cmd == 'deleteAllRow':
+  if len(args) != 3:
+    print 'deleteAllRow requires 3 args'
+    sys.exit(1)
+  pp.pprint(client.deleteAllRow(eval(args[0]),eval(args[1]),eval(args[2]),))
+
+elif cmd == 'increment':
+  if len(args) != 1:
+    print 'increment requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.increment(eval(args[0]),))
+
+elif cmd == 'incrementRows':
+  if len(args) != 1:
+    print 'incrementRows requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.incrementRows(eval(args[0]),))
+
+elif cmd == 'deleteAllRowTs':
+  if len(args) != 4:
+    print 'deleteAllRowTs requires 4 args'
+    sys.exit(1)
+  pp.pprint(client.deleteAllRowTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
+
+elif cmd == 'scannerOpenWithScan':
+  if len(args) != 3:
+    print 'scannerOpenWithScan requires 3 args'
+    sys.exit(1)
+  pp.pprint(client.scannerOpenWithScan(eval(args[0]),eval(args[1]),eval(args[2]),))
+
+elif cmd == 'scannerOpen':
+  if len(args) != 4:
+    print 'scannerOpen requires 4 args'
+    sys.exit(1)
+  pp.pprint(client.scannerOpen(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
+
+elif cmd == 'scannerOpenWithStop':
+  if len(args) != 5:
+    print 'scannerOpenWithStop requires 5 args'
+    sys.exit(1)
+  pp.pprint(client.scannerOpenWithStop(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
+
+elif cmd == 'scannerOpenWithPrefix':
+  if len(args) != 4:
+    print 'scannerOpenWithPrefix requires 4 args'
+    sys.exit(1)
+  pp.pprint(client.scannerOpenWithPrefix(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
+
+elif cmd == 'scannerOpenTs':
+  if len(args) != 5:
+    print 'scannerOpenTs requires 5 args'
+    sys.exit(1)
+  pp.pprint(client.scannerOpenTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
+
+elif cmd == 'scannerOpenWithStopTs':
+  if len(args) != 6:
+    print 'scannerOpenWithStopTs requires 6 args'
+    sys.exit(1)
+  pp.pprint(client.scannerOpenWithStopTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),eval(args[5]),))
+
+elif cmd == 'scannerGet':
+  if len(args) != 1:
+    print 'scannerGet requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.scannerGet(eval(args[0]),))
+
+elif cmd == 'scannerGetList':
+  if len(args) != 2:
+    print 'scannerGetList requires 2 args'
+    sys.exit(1)
+  pp.pprint(client.scannerGetList(eval(args[0]),eval(args[1]),))
+
+elif cmd == 'scannerClose':
+  if len(args) != 1:
+    print 'scannerClose requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.scannerClose(eval(args[0]),))
+
+elif cmd == 'getRowOrBefore':
+  if len(args) != 3:
+    print 'getRowOrBefore requires 3 args'
+    sys.exit(1)
+  pp.pprint(client.getRowOrBefore(eval(args[0]),eval(args[1]),eval(args[2]),))
+
+elif cmd == 'getRegionInfo':
+  if len(args) != 1:
+    print 'getRegionInfo requires 1 args'
+    sys.exit(1)
+  pp.pprint(client.getRegionInfo(eval(args[0]),))
+
+else:
+  print 'Unrecognized method %s' % cmd
+  sys.exit(1)
+
+transport.close()