You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2009/05/05 09:26:51 UTC
svn commit: r771604 [3/3] - in /hadoop/hbase/trunk: ./ lib/
src/java/org/apache/hadoop/hbase/thrift/
src/java/org/apache/hadoop/hbase/thrift/generated/
src/test/org/apache/hadoop/hbase/thrift/
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IOError.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IOError.java?rev=771604&r1=771603&r2=771604&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IOError.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IOError.java Tue May 5 07:26:49 2009
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
/**
* Autogenerated by Thrift
*
@@ -29,22 +28,35 @@
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
-import com.facebook.thrift.*;
+import java.util.Collections;
-import com.facebook.thrift.protocol.*;
-import com.facebook.thrift.transport.*;
+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, java.io.Serializable {
+public class IOError extends Exception implements TBase, java.io.Serializable, Cloneable {
+ private static final TStruct STRUCT_DESC = new TStruct("IOError");
+ private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1);
+
public String message;
+ public static final int MESSAGE = 1;
+
+ private final Isset __isset = new Isset();
+ private static final class Isset implements java.io.Serializable {
+ }
+
+ public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
+ put(MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ }});
- public final Isset __isset = new Isset();
- public static final class Isset implements java.io.Serializable {
- public boolean message = false;
+ static {
+ FieldMetaData.addStructMetaDataMap(IOError.class, metaDataMap);
}
public IOError() {
@@ -55,9 +67,81 @@
{
this();
this.message = message;
- this.__isset.message = true;
}
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public IOError(IOError other) {
+ if (other.isSetMessage()) {
+ this.message = other.message;
+ }
+ }
+
+ @Override
+ public IOError clone() {
+ return new IOError(this);
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public void unsetMessage() {
+ this.message = null;
+ }
+
+ // Returns true if field message is set (has been asigned a value) and false otherwise
+ public boolean isSetMessage() {
+ return this.message != null;
+ }
+
+ public void setMessageIsSet(boolean value) {
+ if (!value) {
+ this.message = null;
+ }
+ }
+
+ public void setFieldValue(int fieldID, Object value) {
+ switch (fieldID) {
+ case MESSAGE:
+ if (value == null) {
+ unsetMessage();
+ } else {
+ setMessage((String)value);
+ }
+ break;
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ public Object getFieldValue(int fieldID) {
+ switch (fieldID) {
+ case MESSAGE:
+ return getMessage();
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
+ public boolean isSet(int fieldID) {
+ switch (fieldID) {
+ case MESSAGE:
+ return isSetMessage();
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ @Override
public boolean equals(Object that) {
if (that == null)
return false;
@@ -70,8 +154,8 @@
if (that == null)
return false;
- boolean this_present_message = true && (this.message != null);
- boolean that_present_message = true && (that.message != null);
+ boolean this_present_message = true && this.isSetMessage();
+ boolean that_present_message = true && that.isSetMessage();
if (this_present_message || that_present_message) {
if (!(this_present_message && that_present_message))
return false;
@@ -82,6 +166,7 @@
return true;
}
+ @Override
public int hashCode() {
return 0;
}
@@ -97,10 +182,9 @@
}
switch (field.id)
{
- case 1:
+ case MESSAGE:
if (field.type == TType.STRING) {
this.message = iprot.readString();
- this.__isset.message = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -112,17 +196,18 @@
iprot.readFieldEnd();
}
iprot.readStructEnd();
+
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ validate();
}
public void write(TProtocol oprot) throws TException {
- TStruct struct = new TStruct("IOError");
- oprot.writeStructBegin(struct);
- TField field = new TField();
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
if (this.message != null) {
- field.name = "message";
- field.type = TType.STRING;
- field.id = 1;
- oprot.writeFieldBegin(field);
+ oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
oprot.writeString(this.message);
oprot.writeFieldEnd();
}
@@ -130,13 +215,26 @@
oprot.writeStructEnd();
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder("IOError(");
+ boolean first = true;
+
sb.append("message:");
- sb.append(this.message);
+ if (this.message == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.message);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
+ public void validate() throws TException {
+ // check for required fields
+ // check that fields of type enum have valid values
+ }
+
}
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java?rev=771604&r1=771603&r2=771604&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java Tue May 5 07:26:49 2009
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
/**
* Autogenerated by Thrift
*
@@ -29,21 +28,34 @@
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
-import com.facebook.thrift.*;
+import java.util.Collections;
-import com.facebook.thrift.protocol.*;
-import com.facebook.thrift.transport.*;
+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, java.io.Serializable {
+public class IllegalArgument extends Exception implements TBase, java.io.Serializable, Cloneable {
+ private static final TStruct STRUCT_DESC = new TStruct("IllegalArgument");
+ private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1);
+
public String message;
+ public static final int MESSAGE = 1;
+
+ private final Isset __isset = new Isset();
+ private static final class Isset implements java.io.Serializable {
+ }
+
+ public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
+ put(MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ }});
- public final Isset __isset = new Isset();
- public static final class Isset implements java.io.Serializable {
- public boolean message = false;
+ static {
+ FieldMetaData.addStructMetaDataMap(IllegalArgument.class, metaDataMap);
}
public IllegalArgument() {
@@ -54,9 +66,81 @@
{
this();
this.message = message;
- this.__isset.message = true;
}
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public IllegalArgument(IllegalArgument other) {
+ if (other.isSetMessage()) {
+ this.message = other.message;
+ }
+ }
+
+ @Override
+ public IllegalArgument clone() {
+ return new IllegalArgument(this);
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public void unsetMessage() {
+ this.message = null;
+ }
+
+ // Returns true if field message is set (has been asigned a value) and false otherwise
+ public boolean isSetMessage() {
+ return this.message != null;
+ }
+
+ public void setMessageIsSet(boolean value) {
+ if (!value) {
+ this.message = null;
+ }
+ }
+
+ public void setFieldValue(int fieldID, Object value) {
+ switch (fieldID) {
+ case MESSAGE:
+ if (value == null) {
+ unsetMessage();
+ } else {
+ setMessage((String)value);
+ }
+ break;
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ public Object getFieldValue(int fieldID) {
+ switch (fieldID) {
+ case MESSAGE:
+ return getMessage();
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
+ public boolean isSet(int fieldID) {
+ switch (fieldID) {
+ case MESSAGE:
+ return isSetMessage();
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ @Override
public boolean equals(Object that) {
if (that == null)
return false;
@@ -69,8 +153,8 @@
if (that == null)
return false;
- boolean this_present_message = true && (this.message != null);
- boolean that_present_message = true && (that.message != null);
+ boolean this_present_message = true && this.isSetMessage();
+ boolean that_present_message = true && that.isSetMessage();
if (this_present_message || that_present_message) {
if (!(this_present_message && that_present_message))
return false;
@@ -81,6 +165,7 @@
return true;
}
+ @Override
public int hashCode() {
return 0;
}
@@ -96,10 +181,9 @@
}
switch (field.id)
{
- case 1:
+ case MESSAGE:
if (field.type == TType.STRING) {
this.message = iprot.readString();
- this.__isset.message = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -111,17 +195,18 @@
iprot.readFieldEnd();
}
iprot.readStructEnd();
+
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ validate();
}
public void write(TProtocol oprot) throws TException {
- TStruct struct = new TStruct("IllegalArgument");
- oprot.writeStructBegin(struct);
- TField field = new TField();
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
if (this.message != null) {
- field.name = "message";
- field.type = TType.STRING;
- field.id = 1;
- oprot.writeFieldBegin(field);
+ oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
oprot.writeString(this.message);
oprot.writeFieldEnd();
}
@@ -129,13 +214,26 @@
oprot.writeStructEnd();
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder("IllegalArgument(");
+ boolean first = true;
+
sb.append("message:");
- sb.append(this.message);
+ if (this.message == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.message);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
+ public void validate() throws TException {
+ // check for required fields
+ // check that fields of type enum have valid values
+ }
+
}
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java?rev=771604&r1=771603&r2=771604&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java Tue May 5 07:26:49 2009
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
/**
* Autogenerated by Thrift
*
@@ -29,24 +28,44 @@
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
-import com.facebook.thrift.*;
+import java.util.Collections;
-import com.facebook.thrift.protocol.*;
-import com.facebook.thrift.transport.*;
+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, java.io.Serializable {
+public class Mutation implements TBase, java.io.Serializable, Cloneable {
+ private static final TStruct STRUCT_DESC = new TStruct("Mutation");
+ 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 static final int ISDELETE = 1;
public byte[] column;
+ public static final int COLUMN = 2;
public byte[] value;
+ public static final int VALUE = 3;
- public final Isset __isset = new Isset();
- public static final class Isset implements java.io.Serializable {
+ private final Isset __isset = new Isset();
+ private static final class Isset implements java.io.Serializable {
public boolean isDelete = false;
- public boolean column = false;
- public boolean value = false;
+ }
+
+ public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
+ put(ISDELETE, new FieldMetaData("isDelete", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.BOOL)));
+ put(COLUMN, new FieldMetaData("column", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ put(VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ }});
+
+ static {
+ FieldMetaData.addStructMetaDataMap(Mutation.class, metaDataMap);
}
public Mutation() {
@@ -63,11 +82,158 @@
this.isDelete = isDelete;
this.__isset.isDelete = true;
this.column = column;
- this.__isset.column = true;
this.value = value;
- this.__isset.value = true;
}
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public Mutation(Mutation other) {
+ __isset.isDelete = other.__isset.isDelete;
+ this.isDelete = other.isDelete;
+ if (other.isSetColumn()) {
+ this.column = other.column;
+ }
+ if (other.isSetValue()) {
+ this.value = other.value;
+ }
+ }
+
+ @Override
+ public Mutation clone() {
+ return new Mutation(this);
+ }
+
+ public boolean isIsDelete() {
+ return this.isDelete;
+ }
+
+ public void setIsDelete(boolean isDelete) {
+ this.isDelete = isDelete;
+ this.__isset.isDelete = true;
+ }
+
+ public void unsetIsDelete() {
+ this.__isset.isDelete = false;
+ }
+
+ // Returns true if field isDelete is set (has been asigned a value) and false otherwise
+ public boolean isSetIsDelete() {
+ return this.__isset.isDelete;
+ }
+
+ public void setIsDeleteIsSet(boolean value) {
+ this.__isset.isDelete = value;
+ }
+
+ public byte[] getColumn() {
+ return this.column;
+ }
+
+ public void setColumn(byte[] column) {
+ this.column = column;
+ }
+
+ public void unsetColumn() {
+ this.column = null;
+ }
+
+ // Returns true if field column is set (has been asigned a value) and false otherwise
+ public boolean isSetColumn() {
+ return this.column != null;
+ }
+
+ public void setColumnIsSet(boolean value) {
+ if (!value) {
+ this.column = null;
+ }
+ }
+
+ public byte[] getValue() {
+ return this.value;
+ }
+
+ public void setValue(byte[] value) {
+ this.value = value;
+ }
+
+ public void unsetValue() {
+ this.value = null;
+ }
+
+ // Returns true if field value is set (has been asigned a value) and false otherwise
+ public boolean isSetValue() {
+ return this.value != null;
+ }
+
+ public void setValueIsSet(boolean value) {
+ if (!value) {
+ this.value = null;
+ }
+ }
+
+ public void setFieldValue(int fieldID, Object value) {
+ switch (fieldID) {
+ case ISDELETE:
+ if (value == null) {
+ unsetIsDelete();
+ } else {
+ setIsDelete((Boolean)value);
+ }
+ break;
+
+ case COLUMN:
+ if (value == null) {
+ unsetColumn();
+ } else {
+ setColumn((byte[])value);
+ }
+ break;
+
+ case VALUE:
+ if (value == null) {
+ unsetValue();
+ } else {
+ setValue((byte[])value);
+ }
+ break;
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ public Object getFieldValue(int fieldID) {
+ switch (fieldID) {
+ case ISDELETE:
+ return new Boolean(isIsDelete());
+
+ case COLUMN:
+ return getColumn();
+
+ case VALUE:
+ return getValue();
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
+ public boolean isSet(int fieldID) {
+ switch (fieldID) {
+ case ISDELETE:
+ return isSetIsDelete();
+ case COLUMN:
+ return isSetColumn();
+ case VALUE:
+ return isSetValue();
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ @Override
public boolean equals(Object that) {
if (that == null)
return false;
@@ -89,8 +255,8 @@
return false;
}
- boolean this_present_column = true && (this.column != null);
- boolean that_present_column = true && (that.column != null);
+ boolean this_present_column = true && this.isSetColumn();
+ boolean that_present_column = true && that.isSetColumn();
if (this_present_column || that_present_column) {
if (!(this_present_column && that_present_column))
return false;
@@ -98,8 +264,8 @@
return false;
}
- boolean this_present_value = true && (this.value != null);
- boolean that_present_value = true && (that.value != null);
+ boolean this_present_value = true && this.isSetValue();
+ boolean that_present_value = true && that.isSetValue();
if (this_present_value || that_present_value) {
if (!(this_present_value && that_present_value))
return false;
@@ -110,6 +276,7 @@
return true;
}
+ @Override
public int hashCode() {
return 0;
}
@@ -125,7 +292,7 @@
}
switch (field.id)
{
- case 1:
+ case ISDELETE:
if (field.type == TType.BOOL) {
this.isDelete = iprot.readBool();
this.__isset.isDelete = true;
@@ -133,18 +300,16 @@
TProtocolUtil.skip(iprot, field.type);
}
break;
- case 2:
+ case COLUMN:
if (field.type == TType.STRING) {
this.column = iprot.readBinary();
- this.__isset.column = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
- case 3:
+ case VALUE:
if (field.type == TType.STRING) {
this.value = iprot.readBinary();
- this.__isset.value = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -156,31 +321,26 @@
iprot.readFieldEnd();
}
iprot.readStructEnd();
+
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ validate();
}
public void write(TProtocol oprot) throws TException {
- TStruct struct = new TStruct("Mutation");
- oprot.writeStructBegin(struct);
- TField field = new TField();
- field.name = "isDelete";
- field.type = TType.BOOL;
- field.id = 1;
- oprot.writeFieldBegin(field);
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(IS_DELETE_FIELD_DESC);
oprot.writeBool(this.isDelete);
oprot.writeFieldEnd();
if (this.column != null) {
- field.name = "column";
- field.type = TType.STRING;
- field.id = 2;
- oprot.writeFieldBegin(field);
+ oprot.writeFieldBegin(COLUMN_FIELD_DESC);
oprot.writeBinary(this.column);
oprot.writeFieldEnd();
}
if (this.value != null) {
- field.name = "value";
- field.type = TType.STRING;
- field.id = 3;
- oprot.writeFieldBegin(field);
+ oprot.writeFieldBegin(VALUE_FIELD_DESC);
oprot.writeBinary(this.value);
oprot.writeFieldEnd();
}
@@ -188,17 +348,38 @@
oprot.writeStructEnd();
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder("Mutation(");
+ boolean first = true;
+
sb.append("isDelete:");
sb.append(this.isDelete);
- sb.append(",column:");
- sb.append(this.column);
- sb.append(",value:");
- sb.append(this.value);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("column:");
+ if (this.column == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.column);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("value:");
+ if (this.value == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.value);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
+ public void validate() throws TException {
+ // check for required fields
+ // check that fields of type enum have valid values
+ }
+
}
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TCell.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TCell.java?rev=771604&r1=771603&r2=771604&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TCell.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TCell.java Tue May 5 07:26:49 2009
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
/**
* Autogenerated by Thrift
*
@@ -29,10 +28,11 @@
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
-import com.facebook.thrift.*;
+import java.util.Collections;
-import com.facebook.thrift.protocol.*;
-import com.facebook.thrift.transport.*;
+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
@@ -40,16 +40,32 @@
* 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, java.io.Serializable {
+public class TCell implements TBase, java.io.Serializable, Cloneable {
+ 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 byte[] value;
+ public static final int VALUE = 1;
public long timestamp;
+ public static final int TIMESTAMP = 2;
- public final Isset __isset = new Isset();
- public static final class Isset implements java.io.Serializable {
- public boolean value = false;
+ private final Isset __isset = new Isset();
+ private static final class Isset implements java.io.Serializable {
public boolean timestamp = false;
}
+ public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
+ put(VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ put(TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.I64)));
+ }});
+
+ static {
+ FieldMetaData.addStructMetaDataMap(TCell.class, metaDataMap);
+ }
+
public TCell() {
}
@@ -59,11 +75,120 @@
{
this();
this.value = value;
- this.__isset.value = true;
this.timestamp = timestamp;
this.__isset.timestamp = true;
}
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TCell(TCell other) {
+ if (other.isSetValue()) {
+ this.value = other.value;
+ }
+ __isset.timestamp = other.__isset.timestamp;
+ this.timestamp = other.timestamp;
+ }
+
+ @Override
+ public TCell clone() {
+ return new TCell(this);
+ }
+
+ public byte[] getValue() {
+ return this.value;
+ }
+
+ public void setValue(byte[] value) {
+ this.value = value;
+ }
+
+ public void unsetValue() {
+ this.value = null;
+ }
+
+ // Returns true if field value is set (has been asigned a value) and false otherwise
+ public boolean isSetValue() {
+ return this.value != null;
+ }
+
+ public void setValueIsSet(boolean value) {
+ if (!value) {
+ this.value = null;
+ }
+ }
+
+ public long getTimestamp() {
+ return this.timestamp;
+ }
+
+ public void setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ this.__isset.timestamp = true;
+ }
+
+ public void unsetTimestamp() {
+ this.__isset.timestamp = false;
+ }
+
+ // Returns true if field timestamp is set (has been asigned a value) and false otherwise
+ public boolean isSetTimestamp() {
+ return this.__isset.timestamp;
+ }
+
+ public void setTimestampIsSet(boolean value) {
+ this.__isset.timestamp = value;
+ }
+
+ public void setFieldValue(int fieldID, Object value) {
+ switch (fieldID) {
+ case VALUE:
+ if (value == null) {
+ unsetValue();
+ } else {
+ setValue((byte[])value);
+ }
+ break;
+
+ case TIMESTAMP:
+ if (value == null) {
+ unsetTimestamp();
+ } else {
+ setTimestamp((Long)value);
+ }
+ break;
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ public Object getFieldValue(int fieldID) {
+ switch (fieldID) {
+ case VALUE:
+ return getValue();
+
+ case TIMESTAMP:
+ return new Long(getTimestamp());
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
+ public boolean isSet(int fieldID) {
+ switch (fieldID) {
+ case VALUE:
+ return isSetValue();
+ case TIMESTAMP:
+ return isSetTimestamp();
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ @Override
public boolean equals(Object that) {
if (that == null)
return false;
@@ -76,8 +201,8 @@
if (that == null)
return false;
- boolean this_present_value = true && (this.value != null);
- boolean that_present_value = true && (that.value != null);
+ boolean this_present_value = true && this.isSetValue();
+ boolean that_present_value = true && that.isSetValue();
if (this_present_value || that_present_value) {
if (!(this_present_value && that_present_value))
return false;
@@ -97,6 +222,7 @@
return true;
}
+ @Override
public int hashCode() {
return 0;
}
@@ -112,15 +238,14 @@
}
switch (field.id)
{
- case 1:
+ case VALUE:
if (field.type == TType.STRING) {
this.value = iprot.readBinary();
- this.__isset.value = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
- case 2:
+ case TIMESTAMP:
if (field.type == TType.I64) {
this.timestamp = iprot.readI64();
this.__isset.timestamp = true;
@@ -135,39 +260,52 @@
iprot.readFieldEnd();
}
iprot.readStructEnd();
+
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ validate();
}
public void write(TProtocol oprot) throws TException {
- TStruct struct = new TStruct("TCell");
- oprot.writeStructBegin(struct);
- TField field = new TField();
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
if (this.value != null) {
- field.name = "value";
- field.type = TType.STRING;
- field.id = 1;
- oprot.writeFieldBegin(field);
+ oprot.writeFieldBegin(VALUE_FIELD_DESC);
oprot.writeBinary(this.value);
oprot.writeFieldEnd();
}
- field.name = "timestamp";
- field.type = TType.I64;
- field.id = 2;
- oprot.writeFieldBegin(field);
+ oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
oprot.writeI64(this.timestamp);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder("TCell(");
+ boolean first = true;
+
sb.append("value:");
- sb.append(this.value);
- sb.append(",timestamp:");
+ if (this.value == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.value);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("timestamp:");
sb.append(this.timestamp);
+ first = false;
sb.append(")");
return sb.toString();
}
+ public void validate() throws TException {
+ // check for required fields
+ // check that fields of type enum have valid values
+ }
+
}
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java?rev=771604&r1=771603&r2=771604&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java Tue May 5 07:26:49 2009
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
/**
* Autogenerated by Thrift
*
@@ -29,30 +28,57 @@
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
-import com.facebook.thrift.*;
+import java.util.Collections;
-import com.facebook.thrift.protocol.*;
-import com.facebook.thrift.transport.*;
+import org.apache.thrift.*;
+import org.apache.thrift.meta_data.*;
+import org.apache.thrift.protocol.*;
/**
* A TRegionInfo contains information about an HTable region.
*/
-public class TRegionInfo implements TBase, java.io.Serializable {
+public class TRegionInfo implements TBase, java.io.Serializable, Cloneable {
+ private static final TStruct STRUCT_DESC = new TStruct("TRegionInfo");
+ private static final TField START_KEY_FIELD_DESC = new TField("startKey", TType.STRING, (short)1);
+ private static final TField END_KEY_FIELD_DESC = new TField("endKey", TType.STRING, (short)2);
+ private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)3);
+ 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 byte[] startKey;
+ public static final int STARTKEY = 1;
public byte[] endKey;
+ public static final int ENDKEY = 2;
public long id;
+ public static final int ID = 3;
public byte[] name;
+ public static final int NAME = 4;
public byte version;
+ public static final int VERSION = 5;
- public final Isset __isset = new Isset();
- public static final class Isset implements java.io.Serializable {
- public boolean startKey = false;
- public boolean endKey = false;
+ private final Isset __isset = new Isset();
+ private static final class Isset implements java.io.Serializable {
public boolean id = false;
- public boolean name = false;
public boolean version = false;
}
+ public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
+ put(STARTKEY, new FieldMetaData("startKey", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ put(ENDKEY, new FieldMetaData("endKey", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ put(ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.I64)));
+ put(NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ put(VERSION, new FieldMetaData("version", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.BYTE)));
+ }});
+
+ static {
+ FieldMetaData.addStructMetaDataMap(TRegionInfo.class, metaDataMap);
+ }
+
public TRegionInfo() {
}
@@ -65,17 +91,239 @@
{
this();
this.startKey = startKey;
- this.__isset.startKey = true;
this.endKey = endKey;
- this.__isset.endKey = true;
this.id = id;
this.__isset.id = true;
this.name = name;
- this.__isset.name = true;
this.version = version;
this.__isset.version = true;
}
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TRegionInfo(TRegionInfo other) {
+ if (other.isSetStartKey()) {
+ this.startKey = other.startKey;
+ }
+ if (other.isSetEndKey()) {
+ this.endKey = other.endKey;
+ }
+ __isset.id = other.__isset.id;
+ this.id = other.id;
+ if (other.isSetName()) {
+ this.name = other.name;
+ }
+ __isset.version = other.__isset.version;
+ this.version = other.version;
+ }
+
+ @Override
+ public TRegionInfo clone() {
+ return new TRegionInfo(this);
+ }
+
+ public byte[] getStartKey() {
+ return this.startKey;
+ }
+
+ public void setStartKey(byte[] startKey) {
+ this.startKey = startKey;
+ }
+
+ public void unsetStartKey() {
+ this.startKey = null;
+ }
+
+ // Returns true if field startKey is set (has been asigned a value) and false otherwise
+ public boolean isSetStartKey() {
+ return this.startKey != null;
+ }
+
+ public void setStartKeyIsSet(boolean value) {
+ if (!value) {
+ this.startKey = null;
+ }
+ }
+
+ public byte[] getEndKey() {
+ return this.endKey;
+ }
+
+ public void setEndKey(byte[] endKey) {
+ this.endKey = endKey;
+ }
+
+ public void unsetEndKey() {
+ this.endKey = null;
+ }
+
+ // Returns true if field endKey is set (has been asigned a value) and false otherwise
+ public boolean isSetEndKey() {
+ return this.endKey != null;
+ }
+
+ public void setEndKeyIsSet(boolean value) {
+ if (!value) {
+ this.endKey = null;
+ }
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ this.__isset.id = true;
+ }
+
+ public void unsetId() {
+ this.__isset.id = false;
+ }
+
+ // Returns true if field id is set (has been asigned a value) and false otherwise
+ public boolean isSetId() {
+ return this.__isset.id;
+ }
+
+ public void setIdIsSet(boolean value) {
+ this.__isset.id = value;
+ }
+
+ public byte[] getName() {
+ return this.name;
+ }
+
+ public void setName(byte[] name) {
+ this.name = name;
+ }
+
+ public void unsetName() {
+ this.name = null;
+ }
+
+ // Returns true if field name is set (has been asigned a value) and false otherwise
+ public boolean isSetName() {
+ return this.name != null;
+ }
+
+ public void setNameIsSet(boolean value) {
+ if (!value) {
+ this.name = null;
+ }
+ }
+
+ public byte getVersion() {
+ return this.version;
+ }
+
+ public void setVersion(byte version) {
+ this.version = version;
+ this.__isset.version = true;
+ }
+
+ public void unsetVersion() {
+ this.__isset.version = false;
+ }
+
+ // Returns true if field version is set (has been asigned a value) and false otherwise
+ public boolean isSetVersion() {
+ return this.__isset.version;
+ }
+
+ public void setVersionIsSet(boolean value) {
+ this.__isset.version = value;
+ }
+
+ public void setFieldValue(int fieldID, Object value) {
+ switch (fieldID) {
+ case STARTKEY:
+ if (value == null) {
+ unsetStartKey();
+ } else {
+ setStartKey((byte[])value);
+ }
+ break;
+
+ case ENDKEY:
+ if (value == null) {
+ unsetEndKey();
+ } else {
+ setEndKey((byte[])value);
+ }
+ break;
+
+ case ID:
+ if (value == null) {
+ unsetId();
+ } else {
+ setId((Long)value);
+ }
+ break;
+
+ case NAME:
+ if (value == null) {
+ unsetName();
+ } else {
+ setName((byte[])value);
+ }
+ break;
+
+ case VERSION:
+ if (value == null) {
+ unsetVersion();
+ } else {
+ setVersion((Byte)value);
+ }
+ break;
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ public Object getFieldValue(int fieldID) {
+ switch (fieldID) {
+ case STARTKEY:
+ return getStartKey();
+
+ case ENDKEY:
+ return getEndKey();
+
+ case ID:
+ return new Long(getId());
+
+ case NAME:
+ return getName();
+
+ case VERSION:
+ return new Byte(getVersion());
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
+ public boolean isSet(int fieldID) {
+ switch (fieldID) {
+ case STARTKEY:
+ return isSetStartKey();
+ case ENDKEY:
+ return isSetEndKey();
+ case ID:
+ return isSetId();
+ case NAME:
+ return isSetName();
+ case VERSION:
+ return isSetVersion();
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ @Override
public boolean equals(Object that) {
if (that == null)
return false;
@@ -88,8 +336,8 @@
if (that == null)
return false;
- boolean this_present_startKey = true && (this.startKey != null);
- boolean that_present_startKey = true && (that.startKey != null);
+ boolean this_present_startKey = true && this.isSetStartKey();
+ boolean that_present_startKey = true && that.isSetStartKey();
if (this_present_startKey || that_present_startKey) {
if (!(this_present_startKey && that_present_startKey))
return false;
@@ -97,8 +345,8 @@
return false;
}
- boolean this_present_endKey = true && (this.endKey != null);
- boolean that_present_endKey = true && (that.endKey != null);
+ boolean this_present_endKey = true && this.isSetEndKey();
+ boolean that_present_endKey = true && that.isSetEndKey();
if (this_present_endKey || that_present_endKey) {
if (!(this_present_endKey && that_present_endKey))
return false;
@@ -115,8 +363,8 @@
return false;
}
- boolean this_present_name = true && (this.name != null);
- boolean that_present_name = true && (that.name != null);
+ boolean this_present_name = true && this.isSetName();
+ boolean that_present_name = true && that.isSetName();
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
@@ -136,6 +384,7 @@
return true;
}
+ @Override
public int hashCode() {
return 0;
}
@@ -151,23 +400,21 @@
}
switch (field.id)
{
- case 1:
+ case STARTKEY:
if (field.type == TType.STRING) {
this.startKey = iprot.readBinary();
- this.__isset.startKey = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
- case 2:
+ case ENDKEY:
if (field.type == TType.STRING) {
this.endKey = iprot.readBinary();
- this.__isset.endKey = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
- case 3:
+ case ID:
if (field.type == TType.I64) {
this.id = iprot.readI64();
this.__isset.id = true;
@@ -175,15 +422,14 @@
TProtocolUtil.skip(iprot, field.type);
}
break;
- case 4:
+ case NAME:
if (field.type == TType.STRING) {
this.name = iprot.readBinary();
- this.__isset.name = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
- case 5:
+ case VERSION:
if (field.type == TType.BYTE) {
this.version = iprot.readByte();
this.__isset.version = true;
@@ -198,67 +444,85 @@
iprot.readFieldEnd();
}
iprot.readStructEnd();
+
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ validate();
}
public void write(TProtocol oprot) throws TException {
- TStruct struct = new TStruct("TRegionInfo");
- oprot.writeStructBegin(struct);
- TField field = new TField();
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
if (this.startKey != null) {
- field.name = "startKey";
- field.type = TType.STRING;
- field.id = 1;
- oprot.writeFieldBegin(field);
+ oprot.writeFieldBegin(START_KEY_FIELD_DESC);
oprot.writeBinary(this.startKey);
oprot.writeFieldEnd();
}
if (this.endKey != null) {
- field.name = "endKey";
- field.type = TType.STRING;
- field.id = 2;
- oprot.writeFieldBegin(field);
+ oprot.writeFieldBegin(END_KEY_FIELD_DESC);
oprot.writeBinary(this.endKey);
oprot.writeFieldEnd();
}
- field.name = "id";
- field.type = TType.I64;
- field.id = 3;
- oprot.writeFieldBegin(field);
+ oprot.writeFieldBegin(ID_FIELD_DESC);
oprot.writeI64(this.id);
oprot.writeFieldEnd();
if (this.name != null) {
- field.name = "name";
- field.type = TType.STRING;
- field.id = 4;
- oprot.writeFieldBegin(field);
+ oprot.writeFieldBegin(NAME_FIELD_DESC);
oprot.writeBinary(this.name);
oprot.writeFieldEnd();
}
- field.name = "version";
- field.type = TType.BYTE;
- field.id = 5;
- oprot.writeFieldBegin(field);
+ oprot.writeFieldBegin(VERSION_FIELD_DESC);
oprot.writeByte(this.version);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder("TRegionInfo(");
+ boolean first = true;
+
sb.append("startKey:");
- sb.append(this.startKey);
- sb.append(",endKey:");
- sb.append(this.endKey);
- sb.append(",id:");
+ if (this.startKey == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.startKey);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("endKey:");
+ if (this.endKey == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.endKey);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("id:");
sb.append(this.id);
- sb.append(",name:");
- sb.append(this.name);
- sb.append(",version:");
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("name:");
+ if (this.name == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.name);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("version:");
sb.append(this.version);
+ first = false;
sb.append(")");
return sb.toString();
}
+ public void validate() throws TException {
+ // check for required fields
+ // check that fields of type enum have valid values
+ }
+
}
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java?rev=771604&r1=771603&r2=771604&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java Tue May 5 07:26:49 2009
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
/**
* Autogenerated by Thrift
*
@@ -29,22 +28,40 @@
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
-import com.facebook.thrift.*;
+import java.util.Collections;
-import com.facebook.thrift.protocol.*;
-import com.facebook.thrift.transport.*;
+import org.apache.thrift.*;
+import org.apache.thrift.meta_data.*;
+import org.apache.thrift.protocol.*;
/**
* Holds row name and then a map of columns to cells.
*/
-public class TRowResult implements TBase, java.io.Serializable {
+public class TRowResult implements TBase, 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 byte[] row;
+ public static final int ROW = 1;
public Map<byte[],TCell> columns;
+ public static final int COLUMNS = 2;
+
+ private final Isset __isset = new Isset();
+ private static final class Isset implements java.io.Serializable {
+ }
+
+ public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
+ put(ROW, new FieldMetaData("row", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ put(COLUMNS, new FieldMetaData("columns", TFieldRequirementType.DEFAULT,
+ new MapMetaData(TType.MAP,
+ new FieldValueMetaData(TType.STRING),
+ new StructMetaData(TType.STRUCT, TCell.class))));
+ }});
- public final Isset __isset = new Isset();
- public static final class Isset implements java.io.Serializable {
- public boolean row = false;
- public boolean columns = false;
+ static {
+ FieldMetaData.addStructMetaDataMap(TRowResult.class, metaDataMap);
}
public TRowResult() {
@@ -56,11 +73,144 @@
{
this();
this.row = row;
- this.__isset.row = true;
this.columns = columns;
- this.__isset.columns = true;
}
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TRowResult(TRowResult other) {
+ if (other.isSetRow()) {
+ this.row = other.row;
+ }
+ if (other.isSetColumns()) {
+ Map<byte[],TCell> __this__columns = new HashMap<byte[],TCell>();
+ for (Map.Entry<byte[], TCell> other_element : other.columns.entrySet()) {
+
+ byte[] other_element_key = other_element.getKey();
+ TCell other_element_value = other_element.getValue();
+
+ byte[] __this__columns_copy_key = other_element_key;
+
+ TCell __this__columns_copy_value = new TCell(other_element_value);
+
+ __this__columns.put(__this__columns_copy_key, __this__columns_copy_value);
+ }
+ this.columns = __this__columns;
+ }
+ }
+
+ @Override
+ public TRowResult clone() {
+ return new TRowResult(this);
+ }
+
+ public byte[] getRow() {
+ return this.row;
+ }
+
+ public void setRow(byte[] row) {
+ this.row = row;
+ }
+
+ public void unsetRow() {
+ this.row = null;
+ }
+
+ // Returns true if field row is set (has been asigned a value) and false otherwise
+ public boolean isSetRow() {
+ return this.row != null;
+ }
+
+ public void setRowIsSet(boolean value) {
+ if (!value) {
+ this.row = null;
+ }
+ }
+
+ public int getColumnsSize() {
+ return (this.columns == null) ? 0 : this.columns.size();
+ }
+
+ public void putToColumns(byte[] key, TCell val) {
+ if (this.columns == null) {
+ this.columns = new HashMap<byte[],TCell>();
+ }
+ this.columns.put(key, val);
+ }
+
+ public Map<byte[],TCell> getColumns() {
+ return this.columns;
+ }
+
+ public void setColumns(Map<byte[],TCell> columns) {
+ this.columns = columns;
+ }
+
+ public void unsetColumns() {
+ this.columns = null;
+ }
+
+ // Returns true if field columns is set (has been asigned a value) and false otherwise
+ public boolean isSetColumns() {
+ return this.columns != null;
+ }
+
+ public void setColumnsIsSet(boolean value) {
+ if (!value) {
+ this.columns = null;
+ }
+ }
+
+ public void setFieldValue(int fieldID, Object value) {
+ switch (fieldID) {
+ case ROW:
+ if (value == null) {
+ unsetRow();
+ } else {
+ setRow((byte[])value);
+ }
+ break;
+
+ case COLUMNS:
+ if (value == null) {
+ unsetColumns();
+ } else {
+ setColumns((Map<byte[],TCell>)value);
+ }
+ break;
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ public Object getFieldValue(int fieldID) {
+ switch (fieldID) {
+ case ROW:
+ return getRow();
+
+ case COLUMNS:
+ return getColumns();
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
+ public boolean isSet(int fieldID) {
+ switch (fieldID) {
+ case ROW:
+ return isSetRow();
+ case COLUMNS:
+ return isSetColumns();
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ @Override
public boolean equals(Object that) {
if (that == null)
return false;
@@ -73,8 +223,8 @@
if (that == null)
return false;
- boolean this_present_row = true && (this.row != null);
- boolean that_present_row = true && (that.row != null);
+ boolean this_present_row = true && this.isSetRow();
+ boolean that_present_row = true && that.isSetRow();
if (this_present_row || that_present_row) {
if (!(this_present_row && that_present_row))
return false;
@@ -82,8 +232,8 @@
return false;
}
- boolean this_present_columns = true && (this.columns != null);
- boolean that_present_columns = true && (that.columns != null);
+ boolean this_present_columns = true && this.isSetColumns();
+ boolean that_present_columns = true && that.isSetColumns();
if (this_present_columns || that_present_columns) {
if (!(this_present_columns && that_present_columns))
return false;
@@ -94,6 +244,7 @@
return true;
}
+ @Override
public int hashCode() {
return 0;
}
@@ -109,15 +260,14 @@
}
switch (field.id)
{
- case 1:
+ case ROW:
if (field.type == TType.STRING) {
this.row = iprot.readBinary();
- this.__isset.row = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
- case 2:
+ case COLUMNS:
if (field.type == TType.MAP) {
{
TMap _map4 = iprot.readMapBegin();
@@ -133,7 +283,6 @@
}
iprot.readMapEnd();
}
- this.__isset.columns = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
@@ -145,30 +294,28 @@
iprot.readFieldEnd();
}
iprot.readStructEnd();
+
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ validate();
}
public void write(TProtocol oprot) throws TException {
- TStruct struct = new TStruct("TRowResult");
- oprot.writeStructBegin(struct);
- TField field = new TField();
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
if (this.row != null) {
- field.name = "row";
- field.type = TType.STRING;
- field.id = 1;
- oprot.writeFieldBegin(field);
+ oprot.writeFieldBegin(ROW_FIELD_DESC);
oprot.writeBinary(this.row);
oprot.writeFieldEnd();
}
if (this.columns != null) {
- field.name = "columns";
- field.type = TType.MAP;
- field.id = 2;
- oprot.writeFieldBegin(field);
+ oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
{
oprot.writeMapBegin(new TMap(TType.STRING, TType.STRUCT, this.columns.size()));
- for (byte[] _iter8 : this.columns.keySet()) {
- oprot.writeBinary(_iter8);
- this.columns.get(_iter8).write(oprot);
+ for (Map.Entry<byte[], TCell> _iter8 : this.columns.entrySet()) {
+ oprot.writeBinary(_iter8.getKey());
+ _iter8.getValue().write(oprot);
}
oprot.writeMapEnd();
}
@@ -178,15 +325,34 @@
oprot.writeStructEnd();
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder("TRowResult(");
+ boolean first = true;
+
sb.append("row:");
- sb.append(this.row);
- sb.append(",columns:");
- sb.append(this.columns);
+ if (this.row == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.row);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("columns:");
+ if (this.columns == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.columns);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
+ public void validate() throws TException {
+ // check for required fields
+ // check that fields of type enum have valid values
+ }
+
}
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/package.html
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/package.html?rev=771604&r1=771603&r2=771604&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/package.html (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/package.html Tue May 5 07:26:49 2009
@@ -62,9 +62,6 @@
under the hbase/lib directory.
</p>
-<p>The version of Thrift used to generate the Java files is release 20080411p1 from
-the <a href="http://developers.facebook.com/thrift/">thrift homepage</a>.</p>
-
<p>To start ThriftServer, use:
<pre>
./bin/hbase-daemon.sh start thrift [--port=PORT]
Modified: hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/thrift/DisabledTestThriftServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/thrift/DisabledTestThriftServer.java?rev=771604&r1=771603&r2=771604&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/thrift/DisabledTestThriftServer.java (original)
+++ hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/thrift/DisabledTestThriftServer.java Tue May 5 07:26:49 2009
@@ -1,5 +1,5 @@
/**
- * Copyright 2008 The Apache Software Foundation
+ * Copyright 2008-2009 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -27,7 +27,6 @@
import org.apache.hadoop.hbase.thrift.generated.ColumnDescriptor;
import org.apache.hadoop.hbase.thrift.generated.IllegalArgument;
import org.apache.hadoop.hbase.thrift.generated.Mutation;
-import org.apache.hadoop.hbase.thrift.generated.NotFound;
import org.apache.hadoop.hbase.thrift.generated.TCell;
import org.apache.hadoop.hbase.thrift.generated.TRowResult;
import org.apache.hadoop.hbase.util.Bytes;
@@ -127,8 +126,8 @@
handler.mutateRow(tableAname, rowAname, getMutations());
// Assert that the changes were made
- assertTrue(Bytes.equals(valueAname, handler.get(tableAname, rowAname, columnAname).value));
- TRowResult rowResult1 = handler.getRow(tableAname, rowAname);
+ assertTrue(Bytes.equals(valueAname, handler.get(tableAname, rowAname, columnAname).get(0).value));
+ TRowResult rowResult1 = handler.getRow(tableAname, rowAname).get(0);
assertTrue(Bytes.equals(rowAname, rowResult1.row));
assertTrue(Bytes.equals(valueBname, rowResult1.columns.get(columnBname).value));
@@ -136,20 +135,14 @@
handler.mutateRows(tableAname, getBatchMutations());
// Assert that changes were made to rowA
- boolean failed1 = false;
- try {
- handler.get(tableAname, rowAname, columnAname);
- } catch (NotFound nf) {
- failed1 = true;
- }
- assertTrue(failed1);
- assertTrue(Bytes.equals(valueCname, handler.get(tableAname, rowAname, columnBname).value));
+ assertFalse(handler.get(tableAname, rowAname, columnAname).size() > 0);
+ assertTrue(Bytes.equals(valueCname, handler.get(tableAname, rowAname, columnBname).get(0).value));
List<TCell> versions = handler.getVer(tableAname, rowAname, columnBname, MAXVERSIONS);
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);
+ TRowResult rowResult2 = handler.getRow(tableAname, rowBname).get(0);
assertTrue(Bytes.equals(rowBname, rowResult2.row));
assertTrue(Bytes.equals(valueCname, rowResult2.columns.get(columnAname).value));
assertTrue(Bytes.equals(valueDname, rowResult2.columns.get(columnBname).value));
@@ -159,20 +152,8 @@
handler.deleteAllRow(tableAname, rowBname);
// Assert that the deletes were applied
- boolean failed2 = false;
- try {
- handler.get(tableAname, rowAname, columnBname);
- } catch (NotFound nf) {
- failed2 = true;
- }
- assertTrue(failed2);
- boolean failed3 = false;
- try {
- handler.getRow(tableAname, rowBname);
- } catch (NotFound nf) {
- failed3 = true;
- }
- assertTrue(failed3);
+ assertFalse(handler.get(tableAname, rowAname, columnBname).size() == 0);
+ assertFalse(handler.getRow(tableAname, rowBname).size() == 0);
// Teardown
handler.disableTable(tableAname);
@@ -210,8 +191,8 @@
assertEquals(handler.getVerTs(tableAname, rowAname, columnBname, time2, MAXVERSIONS).size(), 2);
assertEquals(handler.getVerTs(tableAname, rowAname, columnBname, time1, MAXVERSIONS).size(), 1);
- TRowResult rowResult1 = handler.getRowTs(tableAname, rowAname, time1);
- TRowResult rowResult2 = handler.getRowTs(tableAname, rowAname, time2);
+ TRowResult rowResult1 = handler.getRowTs(tableAname, rowAname, time1).get(0);
+ TRowResult rowResult2 = handler.getRowTs(tableAname, rowAname, time2).get(0);
assertTrue(Bytes.equals(rowResult1.columns.get(columnAname).value, valueAname));
assertTrue(Bytes.equals(rowResult1.columns.get(columnBname).value, valueBname));
assertTrue(Bytes.equals(rowResult2.columns.get(columnBname).value, valueCname));
@@ -221,11 +202,11 @@
List<byte[]> columns = new ArrayList<byte[]>();
columns.add(columnBname);
- rowResult1 = handler.getRowWithColumns(tableAname, rowAname, columns);
+ rowResult1 = handler.getRowWithColumns(tableAname, rowAname, columns).get(0);
assertTrue(Bytes.equals(rowResult1.columns.get(columnBname).value, valueCname));
assertFalse(rowResult1.columns.containsKey(columnAname));
- rowResult1 = handler.getRowWithColumnsTs(tableAname, rowAname, columns, time1);
+ rowResult1 = handler.getRowWithColumnsTs(tableAname, rowAname, columns, time1).get(0);
assertTrue(Bytes.equals(rowResult1.columns.get(columnBname).value, valueBname));
assertFalse(rowResult1.columns.containsKey(columnAname));
@@ -234,21 +215,9 @@
handler.deleteAllRowTs(tableAname, rowBname, time2);
// Assert that the timestamp-related methods retrieve the correct data
- boolean failed = false;
- try {
- handler.getVerTs(tableAname, rowAname, columnBname, time1, MAXVERSIONS);
- } catch (NotFound nf) {
- failed = true;
- }
- assertTrue(failed);
- assertTrue(Bytes.equals(handler.get(tableAname, rowAname, columnBname).value, valueCname));
- boolean failed2 = false;
- try {
- handler.getRow(tableAname, rowBname);
- } catch (NotFound nf) {
- failed2 = true;
- }
- assertTrue(failed2);
+ assertFalse(handler.getVerTs(tableAname, rowAname, columnBname, time1, MAXVERSIONS).size() > 0);
+ assertTrue(Bytes.equals(handler.get(tableAname, rowAname, columnBname).get(0).value, valueCname));
+ assertFalse(handler.getRow(tableAname, rowBname).size() > 0);
// Teardown
handler.disableTable(tableAname);
@@ -280,11 +249,11 @@
// 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);
+ TRowResult rowResult1a = handler.scannerGet(scanner1).get(0);
assertTrue(Bytes.equals(rowResult1a.row, rowAname));
assertEquals(rowResult1a.columns.size(), 1);
assertTrue(Bytes.equals(rowResult1a.columns.get(columnBname).value, valueCname));
- TRowResult rowResult1b = handler.scannerGet(scanner1);
+ TRowResult rowResult1b = handler.scannerGet(scanner1).get(0);
assertTrue(Bytes.equals(rowResult1b.row, rowBname));
assertEquals(rowResult1b.columns.size(), 2);
assertTrue(Bytes.equals(rowResult1b.columns.get(columnAname).value, valueCname));
@@ -293,7 +262,7 @@
// Test a scanner on all rows and all columns, with timestamp
int scanner2 = handler.scannerOpenTs(tableAname, rowAname, getColumnList(true, true), time1);
- TRowResult rowResult2a = handler.scannerGet(scanner2);
+ TRowResult rowResult2a = handler.scannerGet(scanner2).get(0);
assertEquals(rowResult2a.columns.size(), 2);
assertTrue(Bytes.equals(rowResult2a.columns.get(columnAname).value, valueAname));
assertTrue(Bytes.equals(rowResult2a.columns.get(columnBname).value, valueBname));
@@ -307,7 +276,7 @@
// Test a scanner on the first row and second column only, with timestamp
int scanner4 = handler.scannerOpenWithStopTs(tableAname, rowAname, rowBname,
getColumnList(false, true), time1);
- TRowResult rowResult4a = handler.scannerGet(scanner4);
+ TRowResult rowResult4a = handler.scannerGet(scanner4).get(0);
assertEquals(rowResult4a.columns.size(), 1);
assertTrue(Bytes.equals(rowResult4a.columns.get(columnBname).value, valueBname));
@@ -394,13 +363,7 @@
* @throws Exception
*/
private void closeScanner(int scannerId, ThriftServer.HBaseHandler handler) throws Exception {
- boolean failed = false;
- try {
- handler.scannerGet(scannerId);
- } catch (NotFound nf) {
- failed = true;
- }
- assertTrue(failed);
+ handler.scannerGet(scannerId);
handler.scannerClose(scannerId);
}
}