You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 19:42:44 UTC

svn commit: r1181930 [3/3] - in /hbase/branches/0.89: ./ src/main/java/org/apache/hadoop/hbase/thrift/ src/main/java/org/apache/hadoop/hbase/thrift/generated/ src/test/java/org/apache/hadoop/hbase/thrift/

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java?rev=1181930&r1=1181929&r2=1181930&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java Tue Oct 11 17:42:43 2011
@@ -1,10 +1,23 @@
 /**
- * Autogenerated by Thrift
+ * 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
  *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *     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.
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import org.apache.commons.lang.builder.HashCodeBuilder;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Map;
@@ -15,15 +28,12 @@ import java.util.HashSet;
 import java.util.EnumSet;
 import java.util.Collections;
 import java.util.BitSet;
-import java.nio.ByteBuffer;
 import java.util.Arrays;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.thrift.*;
-import org.apache.thrift.async.*;
 import org.apache.thrift.meta_data.*;
-import org.apache.thrift.transport.*;
 import org.apache.thrift.protocol.*;
 
 /**
@@ -31,7 +41,7 @@ import org.apache.thrift.protocol.*;
  * to the Hbase master or an Hbase region server.  Also used to return
  * more general Hbase error conditions.
  */
-public class IOError extends Exception implements TBase<IOError, IOError._Fields>, java.io.Serializable, Cloneable {
+public class IOError extends Exception implements TBase<IOError._Fields>, java.io.Serializable, Cloneable, Comparable<IOError> {
   private static final TStruct STRUCT_DESC = new TStruct("IOError");
 
   private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1);
@@ -42,10 +52,12 @@ public class IOError extends Exception i
   public enum _Fields implements TFieldIdEnum {
     MESSAGE((short)1, "message");
 
+    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
     static {
       for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byId.put((int)field._thriftId, field);
         byName.put(field.getFieldName(), field);
       }
     }
@@ -54,12 +66,7 @@ public class IOError extends Exception i
      * Find the _Fields constant that matches fieldId, or null if its not found.
      */
     public static _Fields findByThriftId(int fieldId) {
-      switch(fieldId) {
-        case 1: // MESSAGE
-          return MESSAGE;
-        default:
-          return null;
-      }
+      return byId.get(fieldId);
     }
 
     /**
@@ -98,12 +105,12 @@ public class IOError extends Exception i
 
   // isset id assignments
 
-  public static final Map<_Fields, FieldMetaData> metaDataMap;
-  static {
-    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
+  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
+    put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
         new FieldValueMetaData(TType.STRING)));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
+  }});
+
+  static {
     FieldMetaData.addStructMetaDataMap(IOError.class, metaDataMap);
   }
 
@@ -130,9 +137,9 @@ public class IOError extends Exception i
     return new IOError(this);
   }
 
-  @Override
-  public void clear() {
-    this.message = null;
+  @Deprecated
+  public IOError clone() {
+    return new IOError(this);
   }
 
   public String getMessage() {
@@ -172,6 +179,10 @@ public class IOError extends Exception i
     }
   }
 
+  public void setFieldValue(int fieldID, Object value) {
+    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
+  }
+
   public Object getFieldValue(_Fields field) {
     switch (field) {
     case MESSAGE:
@@ -181,12 +192,12 @@ public class IOError extends Exception i
     throw new IllegalStateException();
   }
 
+  public Object getFieldValue(int fieldId) {
+    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
+  }
+
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
-    if (field == null) {
-      throw new IllegalArgumentException();
-    }
-
     switch (field) {
     case MESSAGE:
       return isSetMessage();
@@ -194,6 +205,10 @@ public class IOError extends Exception i
     throw new IllegalStateException();
   }
 
+  public boolean isSet(int fieldID) {
+    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
+  }
+
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -221,7 +236,14 @@ public class IOError extends Exception i
 
   @Override
   public int hashCode() {
-    return 0;
+    HashCodeBuilder builder = new HashCodeBuilder();
+
+    boolean present_message = true && (isSetMessage());
+    builder.append(present_message);
+    if (present_message)
+      builder.append(message);
+
+    return builder.toHashCode();
   }
 
   public int compareTo(IOError other) {
@@ -232,23 +254,17 @@ public class IOError extends Exception i
     int lastComparison = 0;
     IOError typedOther = (IOError)other;
 
-    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
+    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(isSetMessage());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetMessage()) {
-      lastComparison = TBaseHelper.compareTo(this.message, typedOther.message);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
+    lastComparison = TBaseHelper.compareTo(message, typedOther.message);
+    if (lastComparison != 0) {
+      return lastComparison;
     }
     return 0;
   }
 
-  public _Fields fieldForId(int fieldId) {
-    return _Fields.findByThriftId(fieldId);
-  }
-
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();
@@ -258,18 +274,21 @@ public class IOError extends Exception i
       if (field.type == TType.STOP) {
         break;
       }
-      switch (field.id) {
-        case 1: // MESSAGE
-          if (field.type == TType.STRING) {
-            this.message = iprot.readString();
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
+      _Fields fieldId = _Fields.findByThriftId(field.id);
+      if (fieldId == null) {
+        TProtocolUtil.skip(iprot, field.type);
+      } else {
+        switch (fieldId) {
+          case MESSAGE:
+            if (field.type == TType.STRING) {
+              this.message = iprot.readString();
+            } else {
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+        }
+        iprot.readFieldEnd();
       }
-      iprot.readFieldEnd();
     }
     iprot.readStructEnd();
 

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java?rev=1181930&r1=1181929&r2=1181930&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java Tue Oct 11 17:42:43 2011
@@ -1,10 +1,23 @@
 /**
- * Autogenerated by Thrift
+ * 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
  *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *     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.
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import org.apache.commons.lang.builder.HashCodeBuilder;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Map;
@@ -15,22 +28,19 @@ import java.util.HashSet;
 import java.util.EnumSet;
 import java.util.Collections;
 import java.util.BitSet;
-import java.nio.ByteBuffer;
 import java.util.Arrays;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.thrift.*;
-import org.apache.thrift.async.*;
 import org.apache.thrift.meta_data.*;
-import org.apache.thrift.transport.*;
 import org.apache.thrift.protocol.*;
 
 /**
  * An IllegalArgument exception indicates an illegal or invalid
  * argument was passed into a procedure.
  */
-public class IllegalArgument extends Exception implements TBase<IllegalArgument, IllegalArgument._Fields>, java.io.Serializable, Cloneable {
+public class IllegalArgument extends Exception implements TBase<IllegalArgument._Fields>, java.io.Serializable, Cloneable, Comparable<IllegalArgument> {
   private static final TStruct STRUCT_DESC = new TStruct("IllegalArgument");
 
   private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1);
@@ -41,10 +51,12 @@ public class IllegalArgument extends Exc
   public enum _Fields implements TFieldIdEnum {
     MESSAGE((short)1, "message");
 
+    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
     static {
       for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byId.put((int)field._thriftId, field);
         byName.put(field.getFieldName(), field);
       }
     }
@@ -53,12 +65,7 @@ public class IllegalArgument extends Exc
      * Find the _Fields constant that matches fieldId, or null if its not found.
      */
     public static _Fields findByThriftId(int fieldId) {
-      switch(fieldId) {
-        case 1: // MESSAGE
-          return MESSAGE;
-        default:
-          return null;
-      }
+      return byId.get(fieldId);
     }
 
     /**
@@ -97,12 +104,12 @@ public class IllegalArgument extends Exc
 
   // isset id assignments
 
-  public static final Map<_Fields, FieldMetaData> metaDataMap;
-  static {
-    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
+  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
+    put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
         new FieldValueMetaData(TType.STRING)));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
+  }});
+
+  static {
     FieldMetaData.addStructMetaDataMap(IllegalArgument.class, metaDataMap);
   }
 
@@ -129,9 +136,9 @@ public class IllegalArgument extends Exc
     return new IllegalArgument(this);
   }
 
-  @Override
-  public void clear() {
-    this.message = null;
+  @Deprecated
+  public IllegalArgument clone() {
+    return new IllegalArgument(this);
   }
 
   public String getMessage() {
@@ -171,6 +178,10 @@ public class IllegalArgument extends Exc
     }
   }
 
+  public void setFieldValue(int fieldID, Object value) {
+    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
+  }
+
   public Object getFieldValue(_Fields field) {
     switch (field) {
     case MESSAGE:
@@ -180,12 +191,12 @@ public class IllegalArgument extends Exc
     throw new IllegalStateException();
   }
 
+  public Object getFieldValue(int fieldId) {
+    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
+  }
+
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
-    if (field == null) {
-      throw new IllegalArgumentException();
-    }
-
     switch (field) {
     case MESSAGE:
       return isSetMessage();
@@ -193,6 +204,10 @@ public class IllegalArgument extends Exc
     throw new IllegalStateException();
   }
 
+  public boolean isSet(int fieldID) {
+    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
+  }
+
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -220,7 +235,14 @@ public class IllegalArgument extends Exc
 
   @Override
   public int hashCode() {
-    return 0;
+    HashCodeBuilder builder = new HashCodeBuilder();
+
+    boolean present_message = true && (isSetMessage());
+    builder.append(present_message);
+    if (present_message)
+      builder.append(message);
+
+    return builder.toHashCode();
   }
 
   public int compareTo(IllegalArgument other) {
@@ -231,23 +253,17 @@ public class IllegalArgument extends Exc
     int lastComparison = 0;
     IllegalArgument typedOther = (IllegalArgument)other;
 
-    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
+    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(isSetMessage());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetMessage()) {
-      lastComparison = TBaseHelper.compareTo(this.message, typedOther.message);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
+    lastComparison = TBaseHelper.compareTo(message, typedOther.message);
+    if (lastComparison != 0) {
+      return lastComparison;
     }
     return 0;
   }
 
-  public _Fields fieldForId(int fieldId) {
-    return _Fields.findByThriftId(fieldId);
-  }
-
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();
@@ -257,18 +273,21 @@ public class IllegalArgument extends Exc
       if (field.type == TType.STOP) {
         break;
       }
-      switch (field.id) {
-        case 1: // MESSAGE
-          if (field.type == TType.STRING) {
-            this.message = iprot.readString();
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
+      _Fields fieldId = _Fields.findByThriftId(field.id);
+      if (fieldId == null) {
+        TProtocolUtil.skip(iprot, field.type);
+      } else {
+        switch (fieldId) {
+          case MESSAGE:
+            if (field.type == TType.STRING) {
+              this.message = iprot.readString();
+            } else {
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+        }
+        iprot.readFieldEnd();
       }
-      iprot.readFieldEnd();
     }
     iprot.readStructEnd();
 

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java?rev=1181930&r1=1181929&r2=1181930&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java Tue Oct 11 17:42:43 2011
@@ -1,10 +1,23 @@
 /**
- * Autogenerated by Thrift
+ * 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
  *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *     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.
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import org.apache.commons.lang.builder.HashCodeBuilder;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Map;
@@ -15,21 +28,18 @@ import java.util.HashSet;
 import java.util.EnumSet;
 import java.util.Collections;
 import java.util.BitSet;
-import java.nio.ByteBuffer;
 import java.util.Arrays;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.thrift.*;
-import org.apache.thrift.async.*;
 import org.apache.thrift.meta_data.*;
-import org.apache.thrift.transport.*;
 import org.apache.thrift.protocol.*;
 
 /**
  * A Mutation object is used to either update or delete a column-value.
  */
-public class Mutation implements TBase<Mutation, Mutation._Fields>, java.io.Serializable, Cloneable {
+public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable, Cloneable, Comparable<Mutation> {
   private static final TStruct STRUCT_DESC = new TStruct("Mutation");
 
   private static final TField IS_DELETE_FIELD_DESC = new TField("isDelete", TType.BOOL, (short)1);
@@ -37,8 +47,8 @@ public class Mutation implements TBase<M
   private static final TField VALUE_FIELD_DESC = new TField("value", TType.STRING, (short)3);
 
   public boolean isDelete;
-  public ByteBuffer column;
-  public ByteBuffer value;
+  public byte[] column;
+  public byte[] value;
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements TFieldIdEnum {
@@ -46,10 +56,12 @@ public class Mutation implements TBase<M
     COLUMN((short)2, "column"),
     VALUE((short)3, "value");
 
+    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
     static {
       for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byId.put((int)field._thriftId, field);
         byName.put(field.getFieldName(), field);
       }
     }
@@ -58,16 +70,7 @@ public class Mutation implements TBase<M
      * Find the _Fields constant that matches fieldId, or null if its not found.
      */
     public static _Fields findByThriftId(int fieldId) {
-      switch(fieldId) {
-        case 1: // IS_DELETE
-          return IS_DELETE;
-        case 2: // COLUMN
-          return COLUMN;
-        case 3: // VALUE
-          return VALUE;
-        default:
-          return null;
-      }
+      return byId.get(fieldId);
     }
 
     /**
@@ -108,16 +111,16 @@ public class Mutation implements TBase<M
   private static final int __ISDELETE_ISSET_ID = 0;
   private BitSet __isset_bit_vector = new BitSet(1);
 
-  public static final Map<_Fields, FieldMetaData> metaDataMap;
-  static {
-    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.IS_DELETE, new FieldMetaData("isDelete", TFieldRequirementType.DEFAULT,
+  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
+    put(_Fields.IS_DELETE, new FieldMetaData("isDelete", TFieldRequirementType.DEFAULT,
         new FieldValueMetaData(TType.BOOL)));
-    tmpMap.put(_Fields.COLUMN, new FieldMetaData("column", TFieldRequirementType.DEFAULT,
-        new FieldValueMetaData(TType.STRING        , "Text")));
-    tmpMap.put(_Fields.VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT,
-        new FieldValueMetaData(TType.STRING        , "Text")));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    put(_Fields.COLUMN, new FieldMetaData("column", TFieldRequirementType.DEFAULT,
+        new FieldValueMetaData(TType.STRING)));
+    put(_Fields.VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT,
+        new FieldValueMetaData(TType.STRING)));
+  }});
+
+  static {
     FieldMetaData.addStructMetaDataMap(Mutation.class, metaDataMap);
   }
 
@@ -128,8 +131,8 @@ public class Mutation implements TBase<M
 
   public Mutation(
     boolean isDelete,
-    ByteBuffer column,
-    ByteBuffer value)
+    byte[] column,
+    byte[] value)
   {
     this();
     this.isDelete = isDelete;
@@ -157,12 +160,9 @@ public class Mutation implements TBase<M
     return new Mutation(this);
   }
 
-  @Override
-  public void clear() {
-    this.isDelete = false;
-
-    this.column = null;
-    this.value = null;
+  @Deprecated
+  public Mutation clone() {
+    return new Mutation(this);
   }
 
   public boolean isIsDelete() {
@@ -189,20 +189,10 @@ public class Mutation implements TBase<M
   }
 
   public byte[] getColumn() {
-    setColumn(TBaseHelper.rightSize(column));
-    return column.array();
-  }
-
-  public ByteBuffer BufferForColumn() {
-    return column;
+    return this.column;
   }
 
   public Mutation setColumn(byte[] column) {
-    setColumn(ByteBuffer.wrap(column));
-    return this;
-  }
-
-  public Mutation setColumn(ByteBuffer column) {
     this.column = column;
     return this;
   }
@@ -223,20 +213,10 @@ public class Mutation implements TBase<M
   }
 
   public byte[] getValue() {
-    setValue(TBaseHelper.rightSize(value));
-    return value.array();
-  }
-
-  public ByteBuffer BufferForValue() {
-    return value;
+    return this.value;
   }
 
   public Mutation setValue(byte[] value) {
-    setValue(ByteBuffer.wrap(value));
-    return this;
-  }
-
-  public Mutation setValue(ByteBuffer value) {
     this.value = value;
     return this;
   }
@@ -270,7 +250,7 @@ public class Mutation implements TBase<M
       if (value == null) {
         unsetColumn();
       } else {
-        setColumn((ByteBuffer)value);
+        setColumn((byte[])value);
       }
       break;
 
@@ -278,13 +258,17 @@ public class Mutation implements TBase<M
       if (value == null) {
         unsetValue();
       } else {
-        setValue((ByteBuffer)value);
+        setValue((byte[])value);
       }
       break;
 
     }
   }
 
+  public void setFieldValue(int fieldID, Object value) {
+    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
+  }
+
   public Object getFieldValue(_Fields field) {
     switch (field) {
     case IS_DELETE:
@@ -300,12 +284,12 @@ public class Mutation implements TBase<M
     throw new IllegalStateException();
   }
 
+  public Object getFieldValue(int fieldId) {
+    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
+  }
+
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
-    if (field == null) {
-      throw new IllegalArgumentException();
-    }
-
     switch (field) {
     case IS_DELETE:
       return isSetIsDelete();
@@ -317,6 +301,10 @@ public class Mutation implements TBase<M
     throw new IllegalStateException();
   }
 
+  public boolean isSet(int fieldID) {
+    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
+  }
+
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -344,7 +332,7 @@ public class Mutation implements TBase<M
     if (this_present_column || that_present_column) {
       if (!(this_present_column && that_present_column))
         return false;
-      if (!this.column.equals(that.column))
+      if (!java.util.Arrays.equals(this.column, that.column))
         return false;
     }
 
@@ -353,7 +341,7 @@ public class Mutation implements TBase<M
     if (this_present_value || that_present_value) {
       if (!(this_present_value && that_present_value))
         return false;
-      if (!this.value.equals(that.value))
+      if (!java.util.Arrays.equals(this.value, that.value))
         return false;
     }
 
@@ -362,7 +350,24 @@ public class Mutation implements TBase<M
 
   @Override
   public int hashCode() {
-    return 0;
+    HashCodeBuilder builder = new HashCodeBuilder();
+
+    boolean present_isDelete = true;
+    builder.append(present_isDelete);
+    if (present_isDelete)
+      builder.append(isDelete);
+
+    boolean present_column = true && (isSetColumn());
+    builder.append(present_column);
+    if (present_column)
+      builder.append(column);
+
+    boolean present_value = true && (isSetValue());
+    builder.append(present_value);
+    if (present_value)
+      builder.append(value);
+
+    return builder.toHashCode();
   }
 
   public int compareTo(Mutation other) {
@@ -373,43 +378,33 @@ public class Mutation implements TBase<M
     int lastComparison = 0;
     Mutation typedOther = (Mutation)other;
 
-    lastComparison = Boolean.valueOf(isSetIsDelete()).compareTo(typedOther.isSetIsDelete());
+    lastComparison = Boolean.valueOf(isSetIsDelete()).compareTo(isSetIsDelete());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetIsDelete()) {
-      lastComparison = TBaseHelper.compareTo(this.isDelete, typedOther.isDelete);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
+    lastComparison = TBaseHelper.compareTo(isDelete, typedOther.isDelete);
+    if (lastComparison != 0) {
+      return lastComparison;
     }
-    lastComparison = Boolean.valueOf(isSetColumn()).compareTo(typedOther.isSetColumn());
+    lastComparison = Boolean.valueOf(isSetColumn()).compareTo(isSetColumn());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetColumn()) {
-      lastComparison = TBaseHelper.compareTo(this.column, typedOther.column);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
+    lastComparison = TBaseHelper.compareTo(column, typedOther.column);
+    if (lastComparison != 0) {
+      return lastComparison;
     }
-    lastComparison = Boolean.valueOf(isSetValue()).compareTo(typedOther.isSetValue());
+    lastComparison = Boolean.valueOf(isSetValue()).compareTo(isSetValue());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetValue()) {
-      lastComparison = TBaseHelper.compareTo(this.value, typedOther.value);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
+    lastComparison = TBaseHelper.compareTo(value, typedOther.value);
+    if (lastComparison != 0) {
+      return lastComparison;
     }
     return 0;
   }
 
-  public _Fields fieldForId(int fieldId) {
-    return _Fields.findByThriftId(fieldId);
-  }
-
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();
@@ -419,33 +414,36 @@ public class Mutation implements TBase<M
       if (field.type == TType.STOP) {
         break;
       }
-      switch (field.id) {
-        case 1: // IS_DELETE
-          if (field.type == TType.BOOL) {
-            this.isDelete = iprot.readBool();
-            setIsDeleteIsSet(true);
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 2: // COLUMN
-          if (field.type == TType.STRING) {
-            this.column = iprot.readBinary();
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 3: // VALUE
-          if (field.type == TType.STRING) {
-            this.value = iprot.readBinary();
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
+      _Fields fieldId = _Fields.findByThriftId(field.id);
+      if (fieldId == null) {
+        TProtocolUtil.skip(iprot, field.type);
+      } else {
+        switch (fieldId) {
+          case IS_DELETE:
+            if (field.type == TType.BOOL) {
+              this.isDelete = iprot.readBool();
+              setIsDeleteIsSet(true);
+            } else {
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case COLUMN:
+            if (field.type == TType.STRING) {
+              this.column = iprot.readBinary();
+            } else {
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case VALUE:
+            if (field.type == TType.STRING) {
+              this.value = iprot.readBinary();
+            } else {
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+        }
+        iprot.readFieldEnd();
       }
-      iprot.readFieldEnd();
     }
     iprot.readStructEnd();
 

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/TCell.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/TCell.java?rev=1181930&r1=1181929&r2=1181930&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/TCell.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/TCell.java Tue Oct 11 17:42:43 2011
@@ -1,10 +1,23 @@
 /**
- * Autogenerated by Thrift
+ * 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
  *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *     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.
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import org.apache.commons.lang.builder.HashCodeBuilder;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Map;
@@ -15,15 +28,12 @@ import java.util.HashSet;
 import java.util.EnumSet;
 import java.util.Collections;
 import java.util.BitSet;
-import java.nio.ByteBuffer;
 import java.util.Arrays;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.thrift.*;
-import org.apache.thrift.async.*;
 import org.apache.thrift.meta_data.*;
-import org.apache.thrift.transport.*;
 import org.apache.thrift.protocol.*;
 
 /**
@@ -32,13 +42,13 @@ import org.apache.thrift.protocol.*;
  * 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.
  */
-public class TCell implements TBase<TCell, TCell._Fields>, java.io.Serializable, Cloneable {
+public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Cloneable, Comparable<TCell> {
   private static final TStruct STRUCT_DESC = new TStruct("TCell");
 
   private static final TField VALUE_FIELD_DESC = new TField("value", TType.STRING, (short)1);
   private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)2);
 
-  public ByteBuffer value;
+  public byte[] value;
   public long timestamp;
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -46,10 +56,12 @@ public class TCell implements TBase<TCel
     VALUE((short)1, "value"),
     TIMESTAMP((short)2, "timestamp");
 
+    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
     static {
       for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byId.put((int)field._thriftId, field);
         byName.put(field.getFieldName(), field);
       }
     }
@@ -58,14 +70,7 @@ public class TCell implements TBase<TCel
      * Find the _Fields constant that matches fieldId, or null if its not found.
      */
     public static _Fields findByThriftId(int fieldId) {
-      switch(fieldId) {
-        case 1: // VALUE
-          return VALUE;
-        case 2: // TIMESTAMP
-          return TIMESTAMP;
-        default:
-          return null;
-      }
+      return byId.get(fieldId);
     }
 
     /**
@@ -106,14 +111,14 @@ public class TCell implements TBase<TCel
   private static final int __TIMESTAMP_ISSET_ID = 0;
   private BitSet __isset_bit_vector = new BitSet(1);
 
-  public static final Map<_Fields, FieldMetaData> metaDataMap;
-  static {
-    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT,
-        new FieldValueMetaData(TType.STRING        , "Bytes")));
-    tmpMap.put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT,
+  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
+    put(_Fields.VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT,
+        new FieldValueMetaData(TType.STRING)));
+    put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT,
         new FieldValueMetaData(TType.I64)));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
+  }});
+
+  static {
     FieldMetaData.addStructMetaDataMap(TCell.class, metaDataMap);
   }
 
@@ -121,7 +126,7 @@ public class TCell implements TBase<TCel
   }
 
   public TCell(
-    ByteBuffer value,
+    byte[] value,
     long timestamp)
   {
     this();
@@ -146,28 +151,16 @@ public class TCell implements TBase<TCel
     return new TCell(this);
   }
 
-  @Override
-  public void clear() {
-    this.value = null;
-    setTimestampIsSet(false);
-    this.timestamp = 0;
+  @Deprecated
+  public TCell clone() {
+    return new TCell(this);
   }
 
   public byte[] getValue() {
-    setValue(TBaseHelper.rightSize(value));
-    return value.array();
-  }
-
-  public ByteBuffer BufferForValue() {
-    return value;
+    return this.value;
   }
 
   public TCell setValue(byte[] value) {
-    setValue(ByteBuffer.wrap(value));
-    return this;
-  }
-
-  public TCell setValue(ByteBuffer value) {
     this.value = value;
     return this;
   }
@@ -216,7 +209,7 @@ public class TCell implements TBase<TCel
       if (value == null) {
         unsetValue();
       } else {
-        setValue((ByteBuffer)value);
+        setValue((byte[])value);
       }
       break;
 
@@ -231,6 +224,10 @@ public class TCell implements TBase<TCel
     }
   }
 
+  public void setFieldValue(int fieldID, Object value) {
+    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
+  }
+
   public Object getFieldValue(_Fields field) {
     switch (field) {
     case VALUE:
@@ -243,12 +240,12 @@ public class TCell implements TBase<TCel
     throw new IllegalStateException();
   }
 
+  public Object getFieldValue(int fieldId) {
+    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
+  }
+
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
-    if (field == null) {
-      throw new IllegalArgumentException();
-    }
-
     switch (field) {
     case VALUE:
       return isSetValue();
@@ -258,6 +255,10 @@ public class TCell implements TBase<TCel
     throw new IllegalStateException();
   }
 
+  public boolean isSet(int fieldID) {
+    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
+  }
+
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -276,7 +277,7 @@ public class TCell implements TBase<TCel
     if (this_present_value || that_present_value) {
       if (!(this_present_value && that_present_value))
         return false;
-      if (!this.value.equals(that.value))
+      if (!java.util.Arrays.equals(this.value, that.value))
         return false;
     }
 
@@ -294,7 +295,19 @@ public class TCell implements TBase<TCel
 
   @Override
   public int hashCode() {
-    return 0;
+    HashCodeBuilder builder = new HashCodeBuilder();
+
+    boolean present_value = true && (isSetValue());
+    builder.append(present_value);
+    if (present_value)
+      builder.append(value);
+
+    boolean present_timestamp = true;
+    builder.append(present_timestamp);
+    if (present_timestamp)
+      builder.append(timestamp);
+
+    return builder.toHashCode();
   }
 
   public int compareTo(TCell other) {
@@ -305,33 +318,25 @@ public class TCell implements TBase<TCel
     int lastComparison = 0;
     TCell typedOther = (TCell)other;
 
-    lastComparison = Boolean.valueOf(isSetValue()).compareTo(typedOther.isSetValue());
+    lastComparison = Boolean.valueOf(isSetValue()).compareTo(isSetValue());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetValue()) {
-      lastComparison = TBaseHelper.compareTo(this.value, typedOther.value);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
+    lastComparison = TBaseHelper.compareTo(value, typedOther.value);
+    if (lastComparison != 0) {
+      return lastComparison;
     }
-    lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(typedOther.isSetTimestamp());
+    lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(isSetTimestamp());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetTimestamp()) {
-      lastComparison = TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
+    lastComparison = TBaseHelper.compareTo(timestamp, typedOther.timestamp);
+    if (lastComparison != 0) {
+      return lastComparison;
     }
     return 0;
   }
 
-  public _Fields fieldForId(int fieldId) {
-    return _Fields.findByThriftId(fieldId);
-  }
-
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();
@@ -341,26 +346,29 @@ public class TCell implements TBase<TCel
       if (field.type == TType.STOP) {
         break;
       }
-      switch (field.id) {
-        case 1: // VALUE
-          if (field.type == TType.STRING) {
-            this.value = iprot.readBinary();
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 2: // TIMESTAMP
-          if (field.type == TType.I64) {
-            this.timestamp = iprot.readI64();
-            setTimestampIsSet(true);
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
+      _Fields fieldId = _Fields.findByThriftId(field.id);
+      if (fieldId == null) {
+        TProtocolUtil.skip(iprot, field.type);
+      } else {
+        switch (fieldId) {
+          case VALUE:
+            if (field.type == TType.STRING) {
+              this.value = iprot.readBinary();
+            } else {
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case TIMESTAMP:
+            if (field.type == TType.I64) {
+              this.timestamp = iprot.readI64();
+              setTimestampIsSet(true);
+            } else {
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+        }
+        iprot.readFieldEnd();
       }
-      iprot.readFieldEnd();
     }
     iprot.readStructEnd();
 

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java?rev=1181930&r1=1181929&r2=1181930&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java Tue Oct 11 17:42:43 2011
@@ -1,10 +1,23 @@
 /**
- * Autogenerated by Thrift
+ * 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
  *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *     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.
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import org.apache.commons.lang.builder.HashCodeBuilder;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Map;
@@ -15,21 +28,18 @@ import java.util.HashSet;
 import java.util.EnumSet;
 import java.util.Collections;
 import java.util.BitSet;
-import java.nio.ByteBuffer;
 import java.util.Arrays;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.thrift.*;
-import org.apache.thrift.async.*;
 import org.apache.thrift.meta_data.*;
-import org.apache.thrift.transport.*;
 import org.apache.thrift.protocol.*;
 
 /**
  * A TRegionInfo contains information about an HTable region.
  */
-public class TRegionInfo implements TBase<TRegionInfo, TRegionInfo._Fields>, java.io.Serializable, Cloneable {
+public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializable, Cloneable, Comparable<TRegionInfo> {
   private static final TStruct STRUCT_DESC = new TStruct("TRegionInfo");
 
   private static final TField START_KEY_FIELD_DESC = new TField("startKey", TType.STRING, (short)1);
@@ -38,10 +48,10 @@ public class TRegionInfo implements TBas
   private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)4);
   private static final TField VERSION_FIELD_DESC = new TField("version", TType.BYTE, (short)5);
 
-  public ByteBuffer startKey;
-  public ByteBuffer endKey;
+  public byte[] startKey;
+  public byte[] endKey;
   public long id;
-  public ByteBuffer name;
+  public byte[] name;
   public byte version;
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -52,10 +62,12 @@ public class TRegionInfo implements TBas
     NAME((short)4, "name"),
     VERSION((short)5, "version");
 
+    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
     static {
       for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byId.put((int)field._thriftId, field);
         byName.put(field.getFieldName(), field);
       }
     }
@@ -64,20 +76,7 @@ public class TRegionInfo implements TBas
      * Find the _Fields constant that matches fieldId, or null if its not found.
      */
     public static _Fields findByThriftId(int fieldId) {
-      switch(fieldId) {
-        case 1: // START_KEY
-          return START_KEY;
-        case 2: // END_KEY
-          return END_KEY;
-        case 3: // ID
-          return ID;
-        case 4: // NAME
-          return NAME;
-        case 5: // VERSION
-          return VERSION;
-        default:
-          return null;
-      }
+      return byId.get(fieldId);
     }
 
     /**
@@ -119,20 +118,20 @@ public class TRegionInfo implements TBas
   private static final int __VERSION_ISSET_ID = 1;
   private BitSet __isset_bit_vector = new BitSet(2);
 
-  public static final Map<_Fields, FieldMetaData> metaDataMap;
-  static {
-    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.START_KEY, new FieldMetaData("startKey", TFieldRequirementType.DEFAULT,
-        new FieldValueMetaData(TType.STRING        , "Text")));
-    tmpMap.put(_Fields.END_KEY, new FieldMetaData("endKey", TFieldRequirementType.DEFAULT,
-        new FieldValueMetaData(TType.STRING        , "Text")));
-    tmpMap.put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT,
+  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
+    put(_Fields.START_KEY, new FieldMetaData("startKey", TFieldRequirementType.DEFAULT,
+        new FieldValueMetaData(TType.STRING)));
+    put(_Fields.END_KEY, new FieldMetaData("endKey", TFieldRequirementType.DEFAULT,
+        new FieldValueMetaData(TType.STRING)));
+    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT,
         new FieldValueMetaData(TType.I64)));
-    tmpMap.put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT,
-        new FieldValueMetaData(TType.STRING        , "Text")));
-    tmpMap.put(_Fields.VERSION, new FieldMetaData("version", TFieldRequirementType.DEFAULT,
+    put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT,
+        new FieldValueMetaData(TType.STRING)));
+    put(_Fields.VERSION, new FieldMetaData("version", TFieldRequirementType.DEFAULT,
         new FieldValueMetaData(TType.BYTE)));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
+  }});
+
+  static {
     FieldMetaData.addStructMetaDataMap(TRegionInfo.class, metaDataMap);
   }
 
@@ -140,10 +139,10 @@ public class TRegionInfo implements TBas
   }
 
   public TRegionInfo(
-    ByteBuffer startKey,
-    ByteBuffer endKey,
+    byte[] startKey,
+    byte[] endKey,
     long id,
-    ByteBuffer name,
+    byte[] name,
     byte version)
   {
     this();
@@ -179,32 +178,16 @@ public class TRegionInfo implements TBas
     return new TRegionInfo(this);
   }
 
-  @Override
-  public void clear() {
-    this.startKey = null;
-    this.endKey = null;
-    setIdIsSet(false);
-    this.id = 0;
-    this.name = null;
-    setVersionIsSet(false);
-    this.version = 0;
+  @Deprecated
+  public TRegionInfo clone() {
+    return new TRegionInfo(this);
   }
 
   public byte[] getStartKey() {
-    setStartKey(TBaseHelper.rightSize(startKey));
-    return startKey.array();
-  }
-
-  public ByteBuffer BufferForStartKey() {
-    return startKey;
+    return this.startKey;
   }
 
   public TRegionInfo setStartKey(byte[] startKey) {
-    setStartKey(ByteBuffer.wrap(startKey));
-    return this;
-  }
-
-  public TRegionInfo setStartKey(ByteBuffer startKey) {
     this.startKey = startKey;
     return this;
   }
@@ -225,20 +208,10 @@ public class TRegionInfo implements TBas
   }
 
   public byte[] getEndKey() {
-    setEndKey(TBaseHelper.rightSize(endKey));
-    return endKey.array();
-  }
-
-  public ByteBuffer BufferForEndKey() {
-    return endKey;
+    return this.endKey;
   }
 
   public TRegionInfo setEndKey(byte[] endKey) {
-    setEndKey(ByteBuffer.wrap(endKey));
-    return this;
-  }
-
-  public TRegionInfo setEndKey(ByteBuffer endKey) {
     this.endKey = endKey;
     return this;
   }
@@ -282,20 +255,10 @@ public class TRegionInfo implements TBas
   }
 
   public byte[] getName() {
-    setName(TBaseHelper.rightSize(name));
-    return name.array();
-  }
-
-  public ByteBuffer BufferForName() {
-    return name;
+    return this.name;
   }
 
   public TRegionInfo setName(byte[] name) {
-    setName(ByteBuffer.wrap(name));
-    return this;
-  }
-
-  public TRegionInfo setName(ByteBuffer name) {
     this.name = name;
     return this;
   }
@@ -344,7 +307,7 @@ public class TRegionInfo implements TBas
       if (value == null) {
         unsetStartKey();
       } else {
-        setStartKey((ByteBuffer)value);
+        setStartKey((byte[])value);
       }
       break;
 
@@ -352,7 +315,7 @@ public class TRegionInfo implements TBas
       if (value == null) {
         unsetEndKey();
       } else {
-        setEndKey((ByteBuffer)value);
+        setEndKey((byte[])value);
       }
       break;
 
@@ -368,7 +331,7 @@ public class TRegionInfo implements TBas
       if (value == null) {
         unsetName();
       } else {
-        setName((ByteBuffer)value);
+        setName((byte[])value);
       }
       break;
 
@@ -383,6 +346,10 @@ public class TRegionInfo implements TBas
     }
   }
 
+  public void setFieldValue(int fieldID, Object value) {
+    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
+  }
+
   public Object getFieldValue(_Fields field) {
     switch (field) {
     case START_KEY:
@@ -404,12 +371,12 @@ public class TRegionInfo implements TBas
     throw new IllegalStateException();
   }
 
+  public Object getFieldValue(int fieldId) {
+    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
+  }
+
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
-    if (field == null) {
-      throw new IllegalArgumentException();
-    }
-
     switch (field) {
     case START_KEY:
       return isSetStartKey();
@@ -425,6 +392,10 @@ public class TRegionInfo implements TBas
     throw new IllegalStateException();
   }
 
+  public boolean isSet(int fieldID) {
+    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
+  }
+
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -443,7 +414,7 @@ public class TRegionInfo implements TBas
     if (this_present_startKey || that_present_startKey) {
       if (!(this_present_startKey && that_present_startKey))
         return false;
-      if (!this.startKey.equals(that.startKey))
+      if (!java.util.Arrays.equals(this.startKey, that.startKey))
         return false;
     }
 
@@ -452,7 +423,7 @@ public class TRegionInfo implements TBas
     if (this_present_endKey || that_present_endKey) {
       if (!(this_present_endKey && that_present_endKey))
         return false;
-      if (!this.endKey.equals(that.endKey))
+      if (!java.util.Arrays.equals(this.endKey, that.endKey))
         return false;
     }
 
@@ -470,7 +441,7 @@ public class TRegionInfo implements TBas
     if (this_present_name || that_present_name) {
       if (!(this_present_name && that_present_name))
         return false;
-      if (!this.name.equals(that.name))
+      if (!java.util.Arrays.equals(this.name, that.name))
         return false;
     }
 
@@ -488,7 +459,34 @@ public class TRegionInfo implements TBas
 
   @Override
   public int hashCode() {
-    return 0;
+    HashCodeBuilder builder = new HashCodeBuilder();
+
+    boolean present_startKey = true && (isSetStartKey());
+    builder.append(present_startKey);
+    if (present_startKey)
+      builder.append(startKey);
+
+    boolean present_endKey = true && (isSetEndKey());
+    builder.append(present_endKey);
+    if (present_endKey)
+      builder.append(endKey);
+
+    boolean present_id = true;
+    builder.append(present_id);
+    if (present_id)
+      builder.append(id);
+
+    boolean present_name = true && (isSetName());
+    builder.append(present_name);
+    if (present_name)
+      builder.append(name);
+
+    boolean present_version = true;
+    builder.append(present_version);
+    if (present_version)
+      builder.append(version);
+
+    return builder.toHashCode();
   }
 
   public int compareTo(TRegionInfo other) {
@@ -499,63 +497,49 @@ public class TRegionInfo implements TBas
     int lastComparison = 0;
     TRegionInfo typedOther = (TRegionInfo)other;
 
-    lastComparison = Boolean.valueOf(isSetStartKey()).compareTo(typedOther.isSetStartKey());
+    lastComparison = Boolean.valueOf(isSetStartKey()).compareTo(isSetStartKey());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetStartKey()) {
-      lastComparison = TBaseHelper.compareTo(this.startKey, typedOther.startKey);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
+    lastComparison = TBaseHelper.compareTo(startKey, typedOther.startKey);
+    if (lastComparison != 0) {
+      return lastComparison;
     }
-    lastComparison = Boolean.valueOf(isSetEndKey()).compareTo(typedOther.isSetEndKey());
+    lastComparison = Boolean.valueOf(isSetEndKey()).compareTo(isSetEndKey());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetEndKey()) {
-      lastComparison = TBaseHelper.compareTo(this.endKey, typedOther.endKey);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
+    lastComparison = TBaseHelper.compareTo(endKey, typedOther.endKey);
+    if (lastComparison != 0) {
+      return lastComparison;
     }
-    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
+    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetId()) {
-      lastComparison = TBaseHelper.compareTo(this.id, typedOther.id);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
+    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
+    if (lastComparison != 0) {
+      return lastComparison;
     }
-    lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName());
+    lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetName()) {
-      lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
+    lastComparison = TBaseHelper.compareTo(name, typedOther.name);
+    if (lastComparison != 0) {
+      return lastComparison;
     }
-    lastComparison = Boolean.valueOf(isSetVersion()).compareTo(typedOther.isSetVersion());
+    lastComparison = Boolean.valueOf(isSetVersion()).compareTo(isSetVersion());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetVersion()) {
-      lastComparison = TBaseHelper.compareTo(this.version, typedOther.version);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
+    lastComparison = TBaseHelper.compareTo(version, typedOther.version);
+    if (lastComparison != 0) {
+      return lastComparison;
     }
     return 0;
   }
 
-  public _Fields fieldForId(int fieldId) {
-    return _Fields.findByThriftId(fieldId);
-  }
-
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();
@@ -565,48 +549,51 @@ public class TRegionInfo implements TBas
       if (field.type == TType.STOP) {
         break;
       }
-      switch (field.id) {
-        case 1: // START_KEY
-          if (field.type == TType.STRING) {
-            this.startKey = iprot.readBinary();
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 2: // END_KEY
-          if (field.type == TType.STRING) {
-            this.endKey = iprot.readBinary();
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 3: // ID
-          if (field.type == TType.I64) {
-            this.id = iprot.readI64();
-            setIdIsSet(true);
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 4: // NAME
-          if (field.type == TType.STRING) {
-            this.name = iprot.readBinary();
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 5: // VERSION
-          if (field.type == TType.BYTE) {
-            this.version = iprot.readByte();
-            setVersionIsSet(true);
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
+      _Fields fieldId = _Fields.findByThriftId(field.id);
+      if (fieldId == null) {
+        TProtocolUtil.skip(iprot, field.type);
+      } else {
+        switch (fieldId) {
+          case START_KEY:
+            if (field.type == TType.STRING) {
+              this.startKey = iprot.readBinary();
+            } else {
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case END_KEY:
+            if (field.type == TType.STRING) {
+              this.endKey = iprot.readBinary();
+            } else {
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case ID:
+            if (field.type == TType.I64) {
+              this.id = iprot.readI64();
+              setIdIsSet(true);
+            } else {
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case NAME:
+            if (field.type == TType.STRING) {
+              this.name = iprot.readBinary();
+            } else {
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case VERSION:
+            if (field.type == TType.BYTE) {
+              this.version = iprot.readByte();
+              setVersionIsSet(true);
+            } else {
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+        }
+        iprot.readFieldEnd();
       }
-      iprot.readFieldEnd();
     }
     iprot.readStructEnd();
 

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java?rev=1181930&r1=1181929&r2=1181930&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java Tue Oct 11 17:42:43 2011
@@ -1,10 +1,23 @@
 /**
- * Autogenerated by Thrift
+ * 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
  *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *     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.
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import org.apache.commons.lang.builder.HashCodeBuilder;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Map;
@@ -15,38 +28,37 @@ import java.util.HashSet;
 import java.util.EnumSet;
 import java.util.Collections;
 import java.util.BitSet;
-import java.nio.ByteBuffer;
 import java.util.Arrays;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.thrift.*;
-import org.apache.thrift.async.*;
 import org.apache.thrift.meta_data.*;
-import org.apache.thrift.transport.*;
 import org.apache.thrift.protocol.*;
 
 /**
  * Holds row name and then a map of columns to cells.
  */
-public class TRowResult implements TBase<TRowResult, TRowResult._Fields>, java.io.Serializable, Cloneable {
+public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializable, Cloneable {
   private static final TStruct STRUCT_DESC = new TStruct("TRowResult");
 
   private static final TField ROW_FIELD_DESC = new TField("row", TType.STRING, (short)1);
   private static final TField COLUMNS_FIELD_DESC = new TField("columns", TType.MAP, (short)2);
 
-  public ByteBuffer row;
-  public Map<ByteBuffer,TCell> columns;
+  public byte[] row;
+  public Map<byte[],TCell> columns;
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements TFieldIdEnum {
     ROW((short)1, "row"),
     COLUMNS((short)2, "columns");
 
+    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
     static {
       for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byId.put((int)field._thriftId, field);
         byName.put(field.getFieldName(), field);
       }
     }
@@ -55,14 +67,7 @@ public class TRowResult implements TBase
      * Find the _Fields constant that matches fieldId, or null if its not found.
      */
     public static _Fields findByThriftId(int fieldId) {
-      switch(fieldId) {
-        case 1: // ROW
-          return ROW;
-        case 2: // COLUMNS
-          return COLUMNS;
-        default:
-          return null;
-      }
+      return byId.get(fieldId);
     }
 
     /**
@@ -101,16 +106,16 @@ public class TRowResult implements TBase
 
   // isset id assignments
 
-  public static final Map<_Fields, FieldMetaData> metaDataMap;
-  static {
-    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.ROW, new FieldMetaData("row", TFieldRequirementType.DEFAULT,
-        new FieldValueMetaData(TType.STRING        , "Text")));
-    tmpMap.put(_Fields.COLUMNS, new FieldMetaData("columns", TFieldRequirementType.DEFAULT,
+  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
+    put(_Fields.ROW, new FieldMetaData("row", TFieldRequirementType.DEFAULT,
+        new FieldValueMetaData(TType.STRING)));
+    put(_Fields.COLUMNS, new FieldMetaData("columns", TFieldRequirementType.DEFAULT,
         new MapMetaData(TType.MAP,
-            new FieldValueMetaData(TType.STRING            , "Text"),
+            new FieldValueMetaData(TType.STRING),
             new StructMetaData(TType.STRUCT, TCell.class))));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
+  }});
+
+  static {
     FieldMetaData.addStructMetaDataMap(TRowResult.class, metaDataMap);
   }
 
@@ -118,8 +123,8 @@ public class TRowResult implements TBase
   }
 
   public TRowResult(
-    ByteBuffer row,
-    Map<ByteBuffer,TCell> columns)
+    byte[] row,
+    Map<byte[],TCell> columns)
   {
     this();
     this.row = row;
@@ -134,13 +139,13 @@ public class TRowResult implements TBase
       this.row = other.row;
     }
     if (other.isSetColumns()) {
-      Map<ByteBuffer,TCell> __this__columns = new HashMap<ByteBuffer,TCell>();
-      for (Map.Entry<ByteBuffer, TCell> other_element : other.columns.entrySet()) {
+      Map<byte[],TCell> __this__columns = new HashMap<byte[],TCell>();
+      for (Map.Entry<byte[], TCell> other_element : other.columns.entrySet()) {
 
-        ByteBuffer other_element_key = other_element.getKey();
+        byte[] other_element_key = other_element.getKey();
         TCell other_element_value = other_element.getValue();
 
-        ByteBuffer __this__columns_copy_key = other_element_key;
+        byte[] __this__columns_copy_key = other_element_key;
 
         TCell __this__columns_copy_value = new TCell(other_element_value);
 
@@ -154,27 +159,16 @@ public class TRowResult implements TBase
     return new TRowResult(this);
   }
 
-  @Override
-  public void clear() {
-    this.row = null;
-    this.columns = null;
+  @Deprecated
+  public TRowResult clone() {
+    return new TRowResult(this);
   }
 
   public byte[] getRow() {
-    setRow(TBaseHelper.rightSize(row));
-    return row.array();
-  }
-
-  public ByteBuffer BufferForRow() {
-    return row;
+    return this.row;
   }
 
   public TRowResult setRow(byte[] row) {
-    setRow(ByteBuffer.wrap(row));
-    return this;
-  }
-
-  public TRowResult setRow(ByteBuffer row) {
     this.row = row;
     return this;
   }
@@ -198,18 +192,18 @@ public class TRowResult implements TBase
     return (this.columns == null) ? 0 : this.columns.size();
   }
 
-  public void putToColumns(ByteBuffer key, TCell val) {
+  public void putToColumns(byte[] key, TCell val) {
     if (this.columns == null) {
-      this.columns = new HashMap<ByteBuffer,TCell>();
+      this.columns = new HashMap<byte[],TCell>();
     }
     this.columns.put(key, val);
   }
 
-  public Map<ByteBuffer,TCell> getColumns() {
+  public Map<byte[],TCell> getColumns() {
     return this.columns;
   }
 
-  public TRowResult setColumns(Map<ByteBuffer,TCell> columns) {
+  public TRowResult setColumns(Map<byte[],TCell> columns) {
     this.columns = columns;
     return this;
   }
@@ -235,7 +229,7 @@ public class TRowResult implements TBase
       if (value == null) {
         unsetRow();
       } else {
-        setRow((ByteBuffer)value);
+        setRow((byte[])value);
       }
       break;
 
@@ -243,13 +237,17 @@ public class TRowResult implements TBase
       if (value == null) {
         unsetColumns();
       } else {
-        setColumns((Map<ByteBuffer,TCell>)value);
+        setColumns((Map<byte[],TCell>)value);
       }
       break;
 
     }
   }
 
+  public void setFieldValue(int fieldID, Object value) {
+    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
+  }
+
   public Object getFieldValue(_Fields field) {
     switch (field) {
     case ROW:
@@ -262,12 +260,12 @@ public class TRowResult implements TBase
     throw new IllegalStateException();
   }
 
+  public Object getFieldValue(int fieldId) {
+    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
+  }
+
   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
   public boolean isSet(_Fields field) {
-    if (field == null) {
-      throw new IllegalArgumentException();
-    }
-
     switch (field) {
     case ROW:
       return isSetRow();
@@ -277,6 +275,10 @@ public class TRowResult implements TBase
     throw new IllegalStateException();
   }
 
+  public boolean isSet(int fieldID) {
+    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
+  }
+
   @Override
   public boolean equals(Object that) {
     if (that == null)
@@ -295,7 +297,7 @@ public class TRowResult implements TBase
     if (this_present_row || that_present_row) {
       if (!(this_present_row && that_present_row))
         return false;
-      if (!this.row.equals(that.row))
+      if (!java.util.Arrays.equals(this.row, that.row))
         return false;
     }
 
@@ -313,42 +315,19 @@ public class TRowResult implements TBase
 
   @Override
   public int hashCode() {
-    return 0;
-  }
+    HashCodeBuilder builder = new HashCodeBuilder();
 
-  public int compareTo(TRowResult other) {
-    if (!getClass().equals(other.getClass())) {
-      return getClass().getName().compareTo(other.getClass().getName());
-    }
-
-    int lastComparison = 0;
-    TRowResult typedOther = (TRowResult)other;
+    boolean present_row = true && (isSetRow());
+    builder.append(present_row);
+    if (present_row)
+      builder.append(row);
+
+    boolean present_columns = true && (isSetColumns());
+    builder.append(present_columns);
+    if (present_columns)
+      builder.append(columns);
 
-    lastComparison = Boolean.valueOf(isSetRow()).compareTo(typedOther.isSetRow());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetRow()) {
-      lastComparison = TBaseHelper.compareTo(this.row, typedOther.row);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetColumns()).compareTo(typedOther.isSetColumns());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetColumns()) {
-      lastComparison = TBaseHelper.compareTo(this.columns, typedOther.columns);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    return 0;
-  }
-
-  public _Fields fieldForId(int fieldId) {
-    return _Fields.findByThriftId(fieldId);
+    return builder.toHashCode();
   }
 
   public void read(TProtocol iprot) throws TException {
@@ -360,38 +339,41 @@ public class TRowResult implements TBase
       if (field.type == TType.STOP) {
         break;
       }
-      switch (field.id) {
-        case 1: // ROW
-          if (field.type == TType.STRING) {
-            this.row = iprot.readBinary();
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case 2: // COLUMNS
-          if (field.type == TType.MAP) {
-            {
-              TMap _map4 = iprot.readMapBegin();
-              this.columns = new HashMap<ByteBuffer,TCell>(2*_map4.size);
-              for (int _i5 = 0; _i5 < _map4.size; ++_i5)
+      _Fields fieldId = _Fields.findByThriftId(field.id);
+      if (fieldId == null) {
+        TProtocolUtil.skip(iprot, field.type);
+      } else {
+        switch (fieldId) {
+          case ROW:
+            if (field.type == TType.STRING) {
+              this.row = iprot.readBinary();
+            } else {
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case COLUMNS:
+            if (field.type == TType.MAP) {
               {
-                ByteBuffer _key6;
-                TCell _val7;
-                _key6 = iprot.readBinary();
-                _val7 = new TCell();
-                _val7.read(iprot);
-                this.columns.put(_key6, _val7);
+                TMap _map4 = iprot.readMapBegin();
+                this.columns = new HashMap<byte[],TCell>(2*_map4.size);
+                for (int _i5 = 0; _i5 < _map4.size; ++_i5)
+                {
+                  byte[] _key6;
+                  TCell _val7;
+                  _key6 = iprot.readBinary();
+                  _val7 = new TCell();
+                  _val7.read(iprot);
+                  this.columns.put(_key6, _val7);
+                }
+                iprot.readMapEnd();
               }
-              iprot.readMapEnd();
+            } else {
+              TProtocolUtil.skip(iprot, field.type);
             }
-          } else {
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
+            break;
+        }
+        iprot.readFieldEnd();
       }
-      iprot.readFieldEnd();
     }
     iprot.readStructEnd();
 
@@ -412,7 +394,7 @@ public class TRowResult implements TBase
       oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
       {
         oprot.writeMapBegin(new TMap(TType.STRING, TType.STRUCT, this.columns.size()));
-        for (Map.Entry<ByteBuffer, TCell> _iter8 : this.columns.entrySet())
+        for (Map.Entry<byte[], TCell> _iter8 : this.columns.entrySet())
         {
           oprot.writeBinary(_iter8.getKey());
           _iter8.getValue().write(oprot);

Modified: hbase/branches/0.89/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java?rev=1181930&r1=1181929&r2=1181930&view=diff
==============================================================================
--- hbase/branches/0.89/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java (original)
+++ hbase/branches/0.89/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java Tue Oct 11 17:42:43 2011
@@ -19,7 +19,6 @@
  */
 package org.apache.hadoop.hbase.thrift;
 
-import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -38,16 +37,16 @@ import org.apache.hadoop.hbase.util.Byte
 public class TestThriftServer extends HBaseClusterTestCase {
 
   // Static names for tables, columns, rows, and values
-  private static ByteBuffer tableAname = ByteBuffer.wrap(Bytes.toBytes("tableA"));
-  private static ByteBuffer tableBname = ByteBuffer.wrap(Bytes.toBytes("tableB"));
-  private static ByteBuffer columnAname = ByteBuffer.wrap(Bytes.toBytes("columnA:"));
-  private static ByteBuffer columnBname = ByteBuffer.wrap(Bytes.toBytes("columnB:"));
-  private static ByteBuffer rowAname = ByteBuffer.wrap(Bytes.toBytes("rowA"));
-  private static ByteBuffer rowBname = ByteBuffer.wrap(Bytes.toBytes("rowB"));
-  private static ByteBuffer valueAname = ByteBuffer.wrap(Bytes.toBytes("valueA"));
-  private static ByteBuffer valueBname = ByteBuffer.wrap(Bytes.toBytes("valueB"));
-  private static ByteBuffer valueCname = ByteBuffer.wrap(Bytes.toBytes("valueC"));
-  private static ByteBuffer valueDname = ByteBuffer.wrap(Bytes.toBytes("valueD"));
+  private static byte[] tableAname = Bytes.toBytes("tableA");
+  private static byte[] tableBname = Bytes.toBytes("tableB");
+  private static byte[] columnAname = Bytes.toBytes("columnA:");
+  private static byte[] columnBname = Bytes.toBytes("columnB:");
+  private static byte[] rowAname = Bytes.toBytes("rowA");
+  private static byte[] rowBname = Bytes.toBytes("rowB");
+  private static byte[] valueAname = Bytes.toBytes("valueA");
+  private static byte[] valueBname = Bytes.toBytes("valueB");
+  private static byte[] valueCname = Bytes.toBytes("valueC");
+  private static byte[] valueDname = Bytes.toBytes("valueD");
 
   /**
    * Runs all of the tests under a single JUnit test method.  We
@@ -113,10 +112,12 @@ public class TestThriftServer extends HB
     handler.mutateRow(tableAname, rowAname, getMutations());
 
     // Assert that the changes were made
-    assertEquals(valueAname, handler.get(tableAname, rowAname, columnAname).get(0).value);
+    assertTrue(Bytes.equals(valueAname,
+      handler.get(tableAname, rowAname, columnAname).get(0).value));
     TRowResult rowResult1 = handler.getRow(tableAname, rowAname).get(0);
-    assertEquals(rowAname, rowResult1.row);
-    assertEquals(valueBname, rowResult1.columns.get(columnBname).value);
+    assertTrue(Bytes.equals(rowAname, rowResult1.row));
+    assertTrue(Bytes.equals(valueBname,
+      rowResult1.columns.get(columnBname).value));
 
     // Apply a few BatchMutations for rowA and rowB
     // rowAmutations.add(new Mutation(true, columnAname, null));
@@ -131,16 +132,16 @@ public class TestThriftServer extends HB
     // Assert that changes were made to rowA
     List<TCell> cells = handler.get(tableAname, rowAname, columnAname);
     assertFalse(cells.size() > 0);
-    assertEquals(valueCname, handler.get(tableAname, rowAname, columnBname).get(0).value);
+    assertTrue(Bytes.equals(valueCname, handler.get(tableAname, rowAname, columnBname).get(0).value));
     List<TCell> versions = handler.getVer(tableAname, rowAname, columnBname, MAXVERSIONS);
-    assertEquals(valueCname, versions.get(0).value);
-    assertEquals(valueBname, versions.get(1).value);
+    assertTrue(Bytes.equals(valueCname, versions.get(0).value));
+    assertTrue(Bytes.equals(valueBname, versions.get(1).value));
 
     // Assert that changes were made to rowB
     TRowResult rowResult2 = handler.getRow(tableAname, rowBname).get(0);
-    assertEquals(rowBname, rowResult2.row);
-    assertEquals(valueCname, rowResult2.columns.get(columnAname).value);
-    assertEquals(valueDname, rowResult2.columns.get(columnBname).value);
+    assertTrue(Bytes.equals(rowBname, rowResult2.row));
+    assertTrue(Bytes.equals(valueCname, rowResult2.columns.get(columnAname).value));
+	  assertTrue(Bytes.equals(valueDname, rowResult2.columns.get(columnBname).value));
 
     // Apply some deletes
     handler.deleteAll(tableAname, rowAname, columnBname);
@@ -188,29 +189,29 @@ public class TestThriftServer extends HB
 
     // Assert that the timestamp-related methods retrieve the correct data
     assertEquals(2, handler.getVerTs(tableAname, rowAname, columnBname, time2,
-                                     MAXVERSIONS).size());
+      MAXVERSIONS).size());
     assertEquals(1, handler.getVerTs(tableAname, rowAname, columnBname, time1,
-                                     MAXVERSIONS).size());
+      MAXVERSIONS).size());
 
     TRowResult rowResult1 = handler.getRowTs(tableAname, rowAname, time1).get(0);
     TRowResult rowResult2 = handler.getRowTs(tableAname, rowAname, time2).get(0);
     // columnA was completely deleted
     //assertTrue(Bytes.equals(rowResult1.columns.get(columnAname).value, valueAname));
-    assertEquals(rowResult1.columns.get(columnBname).value, valueBname);
-    assertEquals(rowResult2.columns.get(columnBname).value, valueCname);
+    assertTrue(Bytes.equals(rowResult1.columns.get(columnBname).value, valueBname));
+    assertTrue(Bytes.equals(rowResult2.columns.get(columnBname).value, valueCname));
 
     // ColumnAname has been deleted, and will never be visible even with a getRowTs()
     assertFalse(rowResult2.columns.containsKey(columnAname));
 
-    List<ByteBuffer> columns = new ArrayList<ByteBuffer>();
+    List<byte[]> columns = new ArrayList<byte[]>();
     columns.add(columnBname);
 
     rowResult1 = handler.getRowWithColumns(tableAname, rowAname, columns).get(0);
-    assertEquals(rowResult1.columns.get(columnBname).value, valueCname);
+    assertTrue(Bytes.equals(rowResult1.columns.get(columnBname).value, valueCname));
     assertFalse(rowResult1.columns.containsKey(columnAname));
 
     rowResult1 = handler.getRowWithColumnsTs(tableAname, rowAname, columns, time1).get(0);
-    assertEquals(rowResult1.columns.get(columnBname).value, valueBname);
+    assertTrue(Bytes.equals(rowResult1.columns.get(columnBname).value, valueBname));
     assertFalse(rowResult1.columns.containsKey(columnAname));
 
     // Apply some timestamped deletes
@@ -227,7 +228,7 @@ public class TestThriftServer extends HB
     assertEquals(1, size);
 
     // should be available....
-    assertEquals(handler.get(tableAname, rowAname, columnBname).get(0).value, valueCname);
+    assertTrue(Bytes.equals(handler.get(tableAname, rowAname, columnBname).get(0).value, valueCname));
 
     assertEquals(0, handler.getRow(tableAname, rowBname).size());
 
@@ -264,18 +265,18 @@ public class TestThriftServer extends HB
     // Test a scanner on all rows and all columns, no timestamp
     int scanner1 = handler.scannerOpen(tableAname, rowAname, getColumnList(true, true));
     TRowResult rowResult1a = handler.scannerGet(scanner1).get(0);
-    assertEquals(rowResult1a.row, rowAname);
+    assertTrue(Bytes.equals(rowResult1a.row, rowAname));
     // This used to be '1'.  I don't know why when we are asking for two columns
     // and when the mutations above would seem to add two columns to the row.
     // -- St.Ack 05/12/2009
     assertEquals(rowResult1a.columns.size(), 1);
-    assertEquals(rowResult1a.columns.get(columnBname).value, valueCname);
+    assertTrue(Bytes.equals(rowResult1a.columns.get(columnBname).value, valueCname));
 
     TRowResult rowResult1b = handler.scannerGet(scanner1).get(0);
-    assertEquals(rowResult1b.row, rowBname);
+    assertTrue(Bytes.equals(rowResult1b.row, rowBname));
     assertEquals(rowResult1b.columns.size(), 2);
-    assertEquals(rowResult1b.columns.get(columnAname).value, valueCname);
-    assertEquals(rowResult1b.columns.get(columnBname).value, valueDname);
+    assertTrue(Bytes.equals(rowResult1b.columns.get(columnAname).value, valueCname));
+    assertTrue(Bytes.equals(rowResult1b.columns.get(columnBname).value, valueDname));
     closeScanner(scanner1, handler);
 
     // Test a scanner on all rows and all columns, with timestamp
@@ -284,20 +285,20 @@ public class TestThriftServer extends HB
     assertEquals(rowResult2a.columns.size(), 1);
     // column A deleted, does not exist.
     //assertTrue(Bytes.equals(rowResult2a.columns.get(columnAname).value, valueAname));
-    assertEquals(rowResult2a.columns.get(columnBname).value, valueBname);
+    assertTrue(Bytes.equals(rowResult2a.columns.get(columnBname).value, valueBname));
     closeScanner(scanner2, handler);
 
     // Test a scanner on the first row and first column only, no timestamp
     int scanner3 = handler.scannerOpenWithStop(tableAname, rowAname, rowBname,
-                                               getColumnList(true, false));
+        getColumnList(true, false));
     closeScanner(scanner3, handler);
 
     // Test a scanner on the first row and second column only, with timestamp
     int scanner4 = handler.scannerOpenWithStopTs(tableAname, rowAname, rowBname,
-                                                 getColumnList(false, true), time1);
+        getColumnList(false, true), time1);
     TRowResult rowResult4a = handler.scannerGet(scanner4).get(0);
     assertEquals(rowResult4a.columns.size(), 1);
-    assertEquals(rowResult4a.columns.get(columnBname).value, valueBname);
+    assertTrue(Bytes.equals(rowResult4a.columns.get(columnBname).value, valueBname));
 
     // Teardown
     handler.disableTable(tableAname);
@@ -319,7 +320,7 @@ public class TestThriftServer extends HB
 
     // A slightly customized ColumnDescriptor (only 2 versions)
     ColumnDescriptor cDescB = new ColumnDescriptor(columnBname, 2, "NONE",
-                                                   false, "NONE", 0, 0, false, -1);
+        false, "NONE", 0, 0, false, -1);
     cDescriptors.add(cDescB);
 
     return cDescriptors;
@@ -331,8 +332,8 @@ public class TestThriftServer extends HB
    * @param includeB whether or not to include columnB
    * @return a List of column names for use in retrieving a scanner
    */
-  private List<ByteBuffer> getColumnList(boolean includeA, boolean includeB) {
-    List<ByteBuffer> columnList = new ArrayList<ByteBuffer>();
+  private List<byte[]> getColumnList(boolean includeA, boolean includeB) {
+    List<byte[]> columnList = new ArrayList<byte[]>();
     if (includeA) columnList.add(columnAname);
     if (includeB) columnList.add(columnBname);
     return columnList;