You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by mb...@apache.org on 2012/04/21 03:37:16 UTC
svn commit: r1328562 [6/9] - in /hbase/branches/0.89-fb: ./
src/main/java/org/apache/hadoop/hbase/
src/main/java/org/apache/hadoop/hbase/filter/
src/main/java/org/apache/hadoop/hbase/regionserver/
src/main/java/org/apache/hadoop/hbase/thrift/ src/main/...
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java?rev=1328562&r1=1328561&r2=1328562&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java Sat Apr 21 01:37:15 2012
@@ -1,11 +1,17 @@
/**
- * Autogenerated by Thrift
+ * Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.hadoop.hbase.thrift.generated;
-import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -16,36 +22,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.meta_data.*;
-import org.apache.thrift.protocol.*;
-
/**
* 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.
*/
-public class IOError extends Exception implements TBase<IOError._Fields>, java.io.Serializable, Cloneable, Comparable<IOError> {
- private static final TStruct STRUCT_DESC = new TStruct("IOError");
+public class IOError extends Exception implements org.apache.thrift.TBase<IOError, IOError._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IOError");
+
+ private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new IOErrorStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new IOErrorTupleSchemeFactory());
+ }
- public String message;
+ public String message; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements TFieldIdEnum {
+ public enum _Fields implements org.apache.thrift.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,7 +61,12 @@ 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) {
- return byId.get(fieldId);
+ switch(fieldId) {
+ case 1: // MESSAGE
+ return MESSAGE;
+ default:
+ return null;
+ }
}
/**
@@ -92,14 +104,13 @@ public class IOError extends Exception i
}
// isset id assignments
-
- 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)));
- }});
-
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- FieldMetaData.addStructMetaDataMap(IOError.class, metaDataMap);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(IOError.class, metaDataMap);
}
public IOError() {
@@ -125,9 +136,9 @@ public class IOError extends Exception i
return new IOError(this);
}
- @Deprecated
- public IOError clone() {
- return new IOError(this);
+ @Override
+ public void clear() {
+ this.message = null;
}
public String getMessage() {
@@ -143,7 +154,7 @@ public class IOError extends Exception i
this.message = null;
}
- /** Returns true if field message is set (has been asigned a value) and false otherwise */
+ /** Returns true if field message is set (has been assigned a value) and false otherwise */
public boolean isSetMessage() {
return this.message != null;
}
@@ -167,10 +178,6 @@ 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:
@@ -180,12 +187,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 */
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case MESSAGE:
return isSetMessage();
@@ -193,10 +200,6 @@ 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)
@@ -224,14 +227,7 @@ public class IOError extends Exception i
@Override
public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_message = true && (isSetMessage());
- builder.append(present_message);
- if (present_message)
- builder.append(message);
-
- return builder.toHashCode();
+ return 0;
}
public int compareTo(IOError other) {
@@ -242,59 +238,29 @@ public class IOError extends Exception i
int lastComparison = 0;
IOError typedOther = (IOError)other;
- lastComparison = Boolean.valueOf(isSetMessage()).compareTo(isSetMessage());
+ lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
if (lastComparison != 0) {
return lastComparison;
}
- lastComparison = TBaseHelper.compareTo(message, typedOther.message);
- if (lastComparison != 0) {
- return lastComparison;
+ if (isSetMessage()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
}
return 0;
}
- public void read(TProtocol iprot) throws TException {
- TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == TType.STOP) {
- break;
- }
- _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.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
}
- public void write(TProtocol oprot) throws TException {
- validate();
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.message != null) {
- oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
- oprot.writeString(this.message);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -313,9 +279,109 @@ public class IOError extends Exception i
return sb.toString();
}
- public void validate() throws TException {
+ public void validate() throws org.apache.thrift.TException {
// check for required fields
}
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class IOErrorStandardSchemeFactory implements SchemeFactory {
+ public IOErrorStandardScheme getScheme() {
+ return new IOErrorStandardScheme();
+ }
+ }
+
+ private static class IOErrorStandardScheme extends StandardScheme<IOError> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, IOError struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // MESSAGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.message = iprot.readString();
+ struct.setMessageIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, IOError struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.message != null) {
+ oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
+ oprot.writeString(struct.message);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class IOErrorTupleSchemeFactory implements SchemeFactory {
+ public IOErrorTupleScheme getScheme() {
+ return new IOErrorTupleScheme();
+ }
+ }
+
+ private static class IOErrorTupleScheme extends TupleScheme<IOError> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, IOError struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetMessage()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetMessage()) {
+ oprot.writeString(struct.message);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, IOError struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.message = iprot.readString();
+ struct.setMessageIsSet(true);
+ }
+ }
+ }
+
}
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java?rev=1328562&r1=1328561&r2=1328562&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java Sat Apr 21 01:37:15 2012
@@ -1,11 +1,17 @@
/**
- * Autogenerated by Thrift
+ * Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.hadoop.hbase.thrift.generated;
-import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -16,35 +22,36 @@ 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.meta_data.*;
-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._Fields>, java.io.Serializable, Cloneable, Comparable<IllegalArgument> {
- private static final TStruct STRUCT_DESC = new TStruct("IllegalArgument");
+public class IllegalArgument extends Exception implements org.apache.thrift.TBase<IllegalArgument, IllegalArgument._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IllegalArgument");
+
+ private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new IllegalArgumentStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new IllegalArgumentTupleSchemeFactory());
+ }
- public String message;
+ public String message; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements TFieldIdEnum {
+ public enum _Fields implements org.apache.thrift.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,7 +60,12 @@ public class IllegalArgument extends Exc
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
- return byId.get(fieldId);
+ switch(fieldId) {
+ case 1: // MESSAGE
+ return MESSAGE;
+ default:
+ return null;
+ }
}
/**
@@ -91,14 +103,13 @@ public class IllegalArgument extends Exc
}
// isset id assignments
-
- 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)));
- }});
-
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- FieldMetaData.addStructMetaDataMap(IllegalArgument.class, metaDataMap);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(IllegalArgument.class, metaDataMap);
}
public IllegalArgument() {
@@ -124,9 +135,9 @@ public class IllegalArgument extends Exc
return new IllegalArgument(this);
}
- @Deprecated
- public IllegalArgument clone() {
- return new IllegalArgument(this);
+ @Override
+ public void clear() {
+ this.message = null;
}
public String getMessage() {
@@ -142,7 +153,7 @@ public class IllegalArgument extends Exc
this.message = null;
}
- /** Returns true if field message is set (has been asigned a value) and false otherwise */
+ /** Returns true if field message is set (has been assigned a value) and false otherwise */
public boolean isSetMessage() {
return this.message != null;
}
@@ -166,10 +177,6 @@ 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:
@@ -179,12 +186,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 */
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case MESSAGE:
return isSetMessage();
@@ -192,10 +199,6 @@ 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)
@@ -223,14 +226,7 @@ public class IllegalArgument extends Exc
@Override
public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_message = true && (isSetMessage());
- builder.append(present_message);
- if (present_message)
- builder.append(message);
-
- return builder.toHashCode();
+ return 0;
}
public int compareTo(IllegalArgument other) {
@@ -241,59 +237,29 @@ public class IllegalArgument extends Exc
int lastComparison = 0;
IllegalArgument typedOther = (IllegalArgument)other;
- lastComparison = Boolean.valueOf(isSetMessage()).compareTo(isSetMessage());
+ lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
if (lastComparison != 0) {
return lastComparison;
}
- lastComparison = TBaseHelper.compareTo(message, typedOther.message);
- if (lastComparison != 0) {
- return lastComparison;
+ if (isSetMessage()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
}
return 0;
}
- public void read(TProtocol iprot) throws TException {
- TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == TType.STOP) {
- break;
- }
- _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.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
}
- public void write(TProtocol oprot) throws TException {
- validate();
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.message != null) {
- oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
- oprot.writeString(this.message);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -312,9 +278,109 @@ public class IllegalArgument extends Exc
return sb.toString();
}
- public void validate() throws TException {
+ public void validate() throws org.apache.thrift.TException {
// check for required fields
}
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class IllegalArgumentStandardSchemeFactory implements SchemeFactory {
+ public IllegalArgumentStandardScheme getScheme() {
+ return new IllegalArgumentStandardScheme();
+ }
+ }
+
+ private static class IllegalArgumentStandardScheme extends StandardScheme<IllegalArgument> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, IllegalArgument struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // MESSAGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.message = iprot.readString();
+ struct.setMessageIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, IllegalArgument struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.message != null) {
+ oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
+ oprot.writeString(struct.message);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class IllegalArgumentTupleSchemeFactory implements SchemeFactory {
+ public IllegalArgumentTupleScheme getScheme() {
+ return new IllegalArgumentTupleScheme();
+ }
+ }
+
+ private static class IllegalArgumentTupleScheme extends TupleScheme<IllegalArgument> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, IllegalArgument struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetMessage()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetMessage()) {
+ oprot.writeString(struct.message);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, IllegalArgument struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.message = iprot.readString();
+ struct.setMessageIsSet(true);
+ }
+ }
+ }
+
}
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java?rev=1328562&r1=1328561&r2=1328562&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java Sat Apr 21 01:37:15 2012
@@ -1,11 +1,17 @@
/**
- * Autogenerated by Thrift
+ * Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.hadoop.hbase.thrift.generated;
-import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -16,40 +22,41 @@ 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.meta_data.*;
-import org.apache.thrift.protocol.*;
-
/**
* A Mutation object is used to either update or delete a column-value.
*/
-public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable, Cloneable, Comparable<Mutation> {
- private static final TStruct STRUCT_DESC = new TStruct("Mutation");
+public class Mutation implements org.apache.thrift.TBase<Mutation, Mutation._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Mutation");
+
+ private static final org.apache.thrift.protocol.TField IS_DELETE_FIELD_DESC = new org.apache.thrift.protocol.TField("isDelete", org.apache.thrift.protocol.TType.BOOL, (short)1);
+ private static final org.apache.thrift.protocol.TField COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("column", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRING, (short)3);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new MutationStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new MutationTupleSchemeFactory());
+ }
- private static final TField IS_DELETE_FIELD_DESC = new TField("isDelete", TType.BOOL, (short)1);
- private static final TField COLUMN_FIELD_DESC = new TField("column", TType.STRING, (short)2);
- private static final TField VALUE_FIELD_DESC = new TField("value", TType.STRING, (short)3);
-
- public boolean isDelete;
- public byte[] column;
- public byte[] value;
+ public boolean isDelete; // required
+ public ByteBuffer column; // required
+ public ByteBuffer value; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements TFieldIdEnum {
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
IS_DELETE((short)1, "isDelete"),
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,7 +65,16 @@ 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) {
- return byId.get(fieldId);
+ switch(fieldId) {
+ case 1: // IS_DELETE
+ return IS_DELETE;
+ case 2: // COLUMN
+ return COLUMN;
+ case 3: // VALUE
+ return VALUE;
+ default:
+ return null;
+ }
}
/**
@@ -98,18 +114,17 @@ public class Mutation implements TBase<M
// isset id assignments
private static final int __ISDELETE_ISSET_ID = 0;
private BitSet __isset_bit_vector = new BitSet(1);
-
- 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)));
- put(_Fields.COLUMN, new FieldMetaData("column", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.STRING)));
- put(_Fields.VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.STRING)));
- }});
-
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- FieldMetaData.addStructMetaDataMap(Mutation.class, metaDataMap);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.IS_DELETE, new org.apache.thrift.meta_data.FieldMetaData("isDelete", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ tmpMap.put(_Fields.COLUMN, new org.apache.thrift.meta_data.FieldMetaData("column", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
+ tmpMap.put(_Fields.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Mutation.class, metaDataMap);
}
public Mutation() {
@@ -119,8 +134,8 @@ public class Mutation implements TBase<M
public Mutation(
boolean isDelete,
- byte[] column,
- byte[] value)
+ ByteBuffer column,
+ ByteBuffer value)
{
this();
this.isDelete = isDelete;
@@ -148,9 +163,12 @@ public class Mutation implements TBase<M
return new Mutation(this);
}
- @Deprecated
- public Mutation clone() {
- return new Mutation(this);
+ @Override
+ public void clear() {
+ this.isDelete = false;
+
+ this.column = null;
+ this.value = null;
}
public boolean isIsDelete() {
@@ -167,7 +185,7 @@ public class Mutation implements TBase<M
__isset_bit_vector.clear(__ISDELETE_ISSET_ID);
}
- /** Returns true if field isDelete is set (has been asigned a value) and false otherwise */
+ /** Returns true if field isDelete is set (has been assigned a value) and false otherwise */
public boolean isSetIsDelete() {
return __isset_bit_vector.get(__ISDELETE_ISSET_ID);
}
@@ -177,10 +195,20 @@ public class Mutation implements TBase<M
}
public byte[] getColumn() {
- return this.column;
+ setColumn(org.apache.thrift.TBaseHelper.rightSize(column));
+ return column == null ? null : column.array();
+ }
+
+ public ByteBuffer bufferForColumn() {
+ return column;
}
public Mutation setColumn(byte[] column) {
+ setColumn(column == null ? (ByteBuffer)null : ByteBuffer.wrap(column));
+ return this;
+ }
+
+ public Mutation setColumn(ByteBuffer column) {
this.column = column;
return this;
}
@@ -189,7 +217,7 @@ public class Mutation implements TBase<M
this.column = null;
}
- /** Returns true if field column is set (has been asigned a value) and false otherwise */
+ /** Returns true if field column is set (has been assigned a value) and false otherwise */
public boolean isSetColumn() {
return this.column != null;
}
@@ -201,10 +229,20 @@ public class Mutation implements TBase<M
}
public byte[] getValue() {
- return this.value;
+ setValue(org.apache.thrift.TBaseHelper.rightSize(value));
+ return value == null ? null : value.array();
+ }
+
+ public ByteBuffer bufferForValue() {
+ return value;
}
public Mutation setValue(byte[] value) {
+ setValue(value == null ? (ByteBuffer)null : ByteBuffer.wrap(value));
+ return this;
+ }
+
+ public Mutation setValue(ByteBuffer value) {
this.value = value;
return this;
}
@@ -213,7 +251,7 @@ public class Mutation implements TBase<M
this.value = null;
}
- /** Returns true if field value is set (has been asigned a value) and false otherwise */
+ /** Returns true if field value is set (has been assigned a value) and false otherwise */
public boolean isSetValue() {
return this.value != null;
}
@@ -238,7 +276,7 @@ public class Mutation implements TBase<M
if (value == null) {
unsetColumn();
} else {
- setColumn((byte[])value);
+ setColumn((ByteBuffer)value);
}
break;
@@ -246,21 +284,17 @@ public class Mutation implements TBase<M
if (value == null) {
unsetValue();
} else {
- setValue((byte[])value);
+ setValue((ByteBuffer)value);
}
break;
}
}
- public void setFieldValue(int fieldID, Object value) {
- setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
- }
-
public Object getFieldValue(_Fields field) {
switch (field) {
case IS_DELETE:
- return new Boolean(isIsDelete());
+ return Boolean.valueOf(isIsDelete());
case COLUMN:
return getColumn();
@@ -272,12 +306,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 */
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case IS_DELETE:
return isSetIsDelete();
@@ -289,10 +323,6 @@ 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)
@@ -320,7 +350,7 @@ public class Mutation implements TBase<M
if (this_present_column || that_present_column) {
if (!(this_present_column && that_present_column))
return false;
- if (!java.util.Arrays.equals(this.column, that.column))
+ if (!this.column.equals(that.column))
return false;
}
@@ -329,7 +359,7 @@ public class Mutation implements TBase<M
if (this_present_value || that_present_value) {
if (!(this_present_value && that_present_value))
return false;
- if (!java.util.Arrays.equals(this.value, that.value))
+ if (!this.value.equals(that.value))
return false;
}
@@ -338,24 +368,7 @@ public class Mutation implements TBase<M
@Override
public int hashCode() {
- 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();
+ return 0;
}
public int compareTo(Mutation other) {
@@ -366,98 +379,49 @@ public class Mutation implements TBase<M
int lastComparison = 0;
Mutation typedOther = (Mutation)other;
- lastComparison = Boolean.valueOf(isSetIsDelete()).compareTo(isSetIsDelete());
+ lastComparison = Boolean.valueOf(isSetIsDelete()).compareTo(typedOther.isSetIsDelete());
if (lastComparison != 0) {
return lastComparison;
}
- lastComparison = TBaseHelper.compareTo(isDelete, typedOther.isDelete);
- if (lastComparison != 0) {
- return lastComparison;
+ if (isSetIsDelete()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isDelete, typedOther.isDelete);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
}
- lastComparison = Boolean.valueOf(isSetColumn()).compareTo(isSetColumn());
+ lastComparison = Boolean.valueOf(isSetColumn()).compareTo(typedOther.isSetColumn());
if (lastComparison != 0) {
return lastComparison;
}
- lastComparison = TBaseHelper.compareTo(column, typedOther.column);
- if (lastComparison != 0) {
- return lastComparison;
+ if (isSetColumn()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column, typedOther.column);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
}
- lastComparison = Boolean.valueOf(isSetValue()).compareTo(isSetValue());
+ lastComparison = Boolean.valueOf(isSetValue()).compareTo(typedOther.isSetValue());
if (lastComparison != 0) {
return lastComparison;
}
- lastComparison = TBaseHelper.compareTo(value, typedOther.value);
- if (lastComparison != 0) {
- return lastComparison;
+ if (isSetValue()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, typedOther.value);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
}
return 0;
}
- public void read(TProtocol iprot) throws TException {
- TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == TType.STOP) {
- break;
- }
- _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.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
}
- public void write(TProtocol oprot) throws TException {
- validate();
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(IS_DELETE_FIELD_DESC);
- oprot.writeBool(this.isDelete);
- oprot.writeFieldEnd();
- if (this.column != null) {
- oprot.writeFieldBegin(COLUMN_FIELD_DESC);
- oprot.writeBinary(this.column);
- oprot.writeFieldEnd();
- }
- if (this.value != null) {
- oprot.writeFieldBegin(VALUE_FIELD_DESC);
- oprot.writeBinary(this.value);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -488,9 +452,155 @@ public class Mutation implements TBase<M
return sb.toString();
}
- public void validate() throws TException {
+ public void validate() throws org.apache.thrift.TException {
// check for required fields
}
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bit_vector = new BitSet(1);
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class MutationStandardSchemeFactory implements SchemeFactory {
+ public MutationStandardScheme getScheme() {
+ return new MutationStandardScheme();
+ }
+ }
+
+ private static class MutationStandardScheme extends StandardScheme<Mutation> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, Mutation struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // IS_DELETE
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.isDelete = iprot.readBool();
+ struct.setIsDeleteIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // COLUMN
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.column = iprot.readBinary();
+ struct.setColumnIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // VALUE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.value = iprot.readBinary();
+ struct.setValueIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, Mutation struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(IS_DELETE_FIELD_DESC);
+ oprot.writeBool(struct.isDelete);
+ oprot.writeFieldEnd();
+ if (struct.column != null) {
+ oprot.writeFieldBegin(COLUMN_FIELD_DESC);
+ oprot.writeBinary(struct.column);
+ oprot.writeFieldEnd();
+ }
+ if (struct.value != null) {
+ oprot.writeFieldBegin(VALUE_FIELD_DESC);
+ oprot.writeBinary(struct.value);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class MutationTupleSchemeFactory implements SchemeFactory {
+ public MutationTupleScheme getScheme() {
+ return new MutationTupleScheme();
+ }
+ }
+
+ private static class MutationTupleScheme extends TupleScheme<Mutation> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, Mutation struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetIsDelete()) {
+ optionals.set(0);
+ }
+ if (struct.isSetColumn()) {
+ optionals.set(1);
+ }
+ if (struct.isSetValue()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetIsDelete()) {
+ oprot.writeBool(struct.isDelete);
+ }
+ if (struct.isSetColumn()) {
+ oprot.writeBinary(struct.column);
+ }
+ if (struct.isSetValue()) {
+ oprot.writeBinary(struct.value);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, Mutation struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct.isDelete = iprot.readBool();
+ struct.setIsDeleteIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.column = iprot.readBinary();
+ struct.setColumnIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.value = iprot.readBinary();
+ struct.setValueIsSet(true);
+ }
+ }
+ }
+
}
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/TCell.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/TCell.java?rev=1328562&r1=1328561&r2=1328562&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/TCell.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/TCell.java Sat Apr 21 01:37:15 2012
@@ -1,11 +1,17 @@
/**
- * Autogenerated by Thrift
+ * Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.hadoop.hbase.thrift.generated;
-import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -16,40 +22,41 @@ 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.meta_data.*;
-import org.apache.thrift.protocol.*;
-
/**
* 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.
*/
-public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Cloneable, Comparable<TCell> {
- private static final TStruct STRUCT_DESC = new TStruct("TCell");
+public class TCell implements org.apache.thrift.TBase<TCell, TCell._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCell");
+
+ private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)2);
- 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);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TCellStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TCellTupleSchemeFactory());
+ }
- public byte[] value;
- public long timestamp;
+ public ByteBuffer value; // required
+ public long timestamp; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements TFieldIdEnum {
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
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,7 +65,14 @@ 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) {
- return byId.get(fieldId);
+ switch(fieldId) {
+ case 1: // VALUE
+ return VALUE;
+ case 2: // TIMESTAMP
+ return TIMESTAMP;
+ default:
+ return null;
+ }
}
/**
@@ -98,23 +112,22 @@ public class TCell implements TBase<TCel
// isset id assignments
private static final int __TIMESTAMP_ISSET_ID = 0;
private BitSet __isset_bit_vector = new BitSet(1);
-
- 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)));
- }});
-
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
- FieldMetaData.addStructMetaDataMap(TCell.class, metaDataMap);
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Bytes")));
+ tmpMap.put(_Fields.TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("timestamp", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCell.class, metaDataMap);
}
public TCell() {
}
public TCell(
- byte[] value,
+ ByteBuffer value,
long timestamp)
{
this();
@@ -139,16 +152,28 @@ public class TCell implements TBase<TCel
return new TCell(this);
}
- @Deprecated
- public TCell clone() {
- return new TCell(this);
+ @Override
+ public void clear() {
+ this.value = null;
+ setTimestampIsSet(false);
+ this.timestamp = 0;
}
public byte[] getValue() {
- return this.value;
+ setValue(org.apache.thrift.TBaseHelper.rightSize(value));
+ return value == null ? null : value.array();
+ }
+
+ public ByteBuffer bufferForValue() {
+ return value;
}
public TCell setValue(byte[] value) {
+ setValue(value == null ? (ByteBuffer)null : ByteBuffer.wrap(value));
+ return this;
+ }
+
+ public TCell setValue(ByteBuffer value) {
this.value = value;
return this;
}
@@ -157,7 +182,7 @@ public class TCell implements TBase<TCel
this.value = null;
}
- /** Returns true if field value is set (has been asigned a value) and false otherwise */
+ /** Returns true if field value is set (has been assigned a value) and false otherwise */
public boolean isSetValue() {
return this.value != null;
}
@@ -182,7 +207,7 @@ public class TCell implements TBase<TCel
__isset_bit_vector.clear(__TIMESTAMP_ISSET_ID);
}
- /** Returns true if field timestamp is set (has been asigned a value) and false otherwise */
+ /** Returns true if field timestamp is set (has been assigned a value) and false otherwise */
public boolean isSetTimestamp() {
return __isset_bit_vector.get(__TIMESTAMP_ISSET_ID);
}
@@ -197,7 +222,7 @@ public class TCell implements TBase<TCel
if (value == null) {
unsetValue();
} else {
- setValue((byte[])value);
+ setValue((ByteBuffer)value);
}
break;
@@ -212,28 +237,24 @@ 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:
return getValue();
case TIMESTAMP:
- return new Long(getTimestamp());
+ return Long.valueOf(getTimestamp());
}
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 */
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case VALUE:
return isSetValue();
@@ -243,10 +264,6 @@ 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)
@@ -265,7 +282,7 @@ public class TCell implements TBase<TCel
if (this_present_value || that_present_value) {
if (!(this_present_value && that_present_value))
return false;
- if (!java.util.Arrays.equals(this.value, that.value))
+ if (!this.value.equals(that.value))
return false;
}
@@ -283,19 +300,7 @@ public class TCell implements TBase<TCel
@Override
public int hashCode() {
- 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();
+ return 0;
}
public int compareTo(TCell other) {
@@ -306,78 +311,39 @@ public class TCell implements TBase<TCel
int lastComparison = 0;
TCell typedOther = (TCell)other;
- lastComparison = Boolean.valueOf(isSetValue()).compareTo(isSetValue());
+ lastComparison = Boolean.valueOf(isSetValue()).compareTo(typedOther.isSetValue());
if (lastComparison != 0) {
return lastComparison;
}
- lastComparison = TBaseHelper.compareTo(value, typedOther.value);
- if (lastComparison != 0) {
- return lastComparison;
+ if (isSetValue()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, typedOther.value);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
}
- lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(isSetTimestamp());
+ lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(typedOther.isSetTimestamp());
if (lastComparison != 0) {
return lastComparison;
}
- lastComparison = TBaseHelper.compareTo(timestamp, typedOther.timestamp);
- if (lastComparison != 0) {
- return lastComparison;
+ if (isSetTimestamp()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
}
return 0;
}
- public void read(TProtocol iprot) throws TException {
- TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == TType.STOP) {
- break;
- }
- _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.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
}
- public void write(TProtocol oprot) throws TException {
- validate();
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.value != null) {
- oprot.writeFieldBegin(VALUE_FIELD_DESC);
- oprot.writeBinary(this.value);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
- oprot.writeI64(this.timestamp);
- oprot.writeFieldEnd();
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -400,9 +366,132 @@ public class TCell implements TBase<TCel
return sb.toString();
}
- public void validate() throws TException {
+ public void validate() throws org.apache.thrift.TException {
// check for required fields
}
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bit_vector = new BitSet(1);
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TCellStandardSchemeFactory implements SchemeFactory {
+ public TCellStandardScheme getScheme() {
+ return new TCellStandardScheme();
+ }
+ }
+
+ private static class TCellStandardScheme extends StandardScheme<TCell> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TCell struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // VALUE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.value = iprot.readBinary();
+ struct.setValueIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // TIMESTAMP
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.timestamp = iprot.readI64();
+ struct.setTimestampIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TCell struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.value != null) {
+ oprot.writeFieldBegin(VALUE_FIELD_DESC);
+ oprot.writeBinary(struct.value);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
+ oprot.writeI64(struct.timestamp);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TCellTupleSchemeFactory implements SchemeFactory {
+ public TCellTupleScheme getScheme() {
+ return new TCellTupleScheme();
+ }
+ }
+
+ private static class TCellTupleScheme extends TupleScheme<TCell> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TCell struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetValue()) {
+ optionals.set(0);
+ }
+ if (struct.isSetTimestamp()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetValue()) {
+ oprot.writeBinary(struct.value);
+ }
+ if (struct.isSetTimestamp()) {
+ oprot.writeI64(struct.timestamp);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TCell struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.value = iprot.readBinary();
+ struct.setValueIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.timestamp = iprot.readI64();
+ struct.setTimestampIsSet(true);
+ }
+ }
+ }
+
}