You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2013/07/17 14:58:17 UTC
[03/10] ACCUMULO-1000 initial checkin of conditional mutations that
does locking on tablet server. The implementation is pretty far along,
but still a good bit to do.
http://git-wip-us.apache.org/repos/asf/accumulo/blob/49a7626c/core/src/main/java/org/apache/accumulo/core/data/thrift/TCondition.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/data/thrift/TCondition.java b/core/src/main/java/org/apache/accumulo/core/data/thrift/TCondition.java
new file mode 100644
index 0000000..95de004
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/data/thrift/TCondition.java
@@ -0,0 +1,1306 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.accumulo.core.data.thrift;
+
+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 org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+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;
+
+@SuppressWarnings("all") public class TCondition implements org.apache.thrift.TBase<TCondition, TCondition._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCondition");
+
+ private static final org.apache.thrift.protocol.TField CF_FIELD_DESC = new org.apache.thrift.protocol.TField("cf", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField CQ_FIELD_DESC = new org.apache.thrift.protocol.TField("cq", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField CV_FIELD_DESC = new org.apache.thrift.protocol.TField("cv", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField TS_FIELD_DESC = new org.apache.thrift.protocol.TField("ts", org.apache.thrift.protocol.TType.I64, (short)4);
+ private static final org.apache.thrift.protocol.TField HAS_TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("hasTimestamp", org.apache.thrift.protocol.TType.BOOL, (short)5);
+ private static final org.apache.thrift.protocol.TField VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("val", org.apache.thrift.protocol.TType.STRING, (short)6);
+ private static final org.apache.thrift.protocol.TField SSI_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("ssiList", org.apache.thrift.protocol.TType.LIST, (short)7);
+ private static final org.apache.thrift.protocol.TField SSIO_FIELD_DESC = new org.apache.thrift.protocol.TField("ssio", org.apache.thrift.protocol.TType.MAP, (short)8);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TConditionStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TConditionTupleSchemeFactory());
+ }
+
+ public ByteBuffer cf; // required
+ public ByteBuffer cq; // required
+ public ByteBuffer cv; // required
+ public long ts; // required
+ public boolean hasTimestamp; // required
+ public ByteBuffer val; // required
+ public List<IterInfo> ssiList; // required
+ public Map<String,Map<String,String>> ssio; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ CF((short)1, "cf"),
+ CQ((short)2, "cq"),
+ CV((short)3, "cv"),
+ TS((short)4, "ts"),
+ HAS_TIMESTAMP((short)5, "hasTimestamp"),
+ VAL((short)6, "val"),
+ SSI_LIST((short)7, "ssiList"),
+ SSIO((short)8, "ssio");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // CF
+ return CF;
+ case 2: // CQ
+ return CQ;
+ case 3: // CV
+ return CV;
+ case 4: // TS
+ return TS;
+ case 5: // HAS_TIMESTAMP
+ return HAS_TIMESTAMP;
+ case 6: // VAL
+ return VAL;
+ case 7: // SSI_LIST
+ return SSI_LIST;
+ case 8: // SSIO
+ return SSIO;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __TS_ISSET_ID = 0;
+ private static final int __HASTIMESTAMP_ISSET_ID = 1;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.CF, new org.apache.thrift.meta_data.FieldMetaData("cf", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
+ tmpMap.put(_Fields.CQ, new org.apache.thrift.meta_data.FieldMetaData("cq", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
+ tmpMap.put(_Fields.CV, new org.apache.thrift.meta_data.FieldMetaData("cv", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
+ tmpMap.put(_Fields.TS, new org.apache.thrift.meta_data.FieldMetaData("ts", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.HAS_TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("hasTimestamp", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ tmpMap.put(_Fields.VAL, new org.apache.thrift.meta_data.FieldMetaData("val", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
+ tmpMap.put(_Fields.SSI_LIST, new org.apache.thrift.meta_data.FieldMetaData("ssiList", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, IterInfo.class))));
+ tmpMap.put(_Fields.SSIO, new org.apache.thrift.meta_data.FieldMetaData("ssio", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
+ new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCondition.class, metaDataMap);
+ }
+
+ public TCondition() {
+ }
+
+ public TCondition(
+ ByteBuffer cf,
+ ByteBuffer cq,
+ ByteBuffer cv,
+ long ts,
+ boolean hasTimestamp,
+ ByteBuffer val,
+ List<IterInfo> ssiList,
+ Map<String,Map<String,String>> ssio)
+ {
+ this();
+ this.cf = cf;
+ this.cq = cq;
+ this.cv = cv;
+ this.ts = ts;
+ setTsIsSet(true);
+ this.hasTimestamp = hasTimestamp;
+ setHasTimestampIsSet(true);
+ this.val = val;
+ this.ssiList = ssiList;
+ this.ssio = ssio;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TCondition(TCondition other) {
+ __isset_bitfield = other.__isset_bitfield;
+ if (other.isSetCf()) {
+ this.cf = org.apache.thrift.TBaseHelper.copyBinary(other.cf);
+;
+ }
+ if (other.isSetCq()) {
+ this.cq = org.apache.thrift.TBaseHelper.copyBinary(other.cq);
+;
+ }
+ if (other.isSetCv()) {
+ this.cv = org.apache.thrift.TBaseHelper.copyBinary(other.cv);
+;
+ }
+ this.ts = other.ts;
+ this.hasTimestamp = other.hasTimestamp;
+ if (other.isSetVal()) {
+ this.val = org.apache.thrift.TBaseHelper.copyBinary(other.val);
+;
+ }
+ if (other.isSetSsiList()) {
+ List<IterInfo> __this__ssiList = new ArrayList<IterInfo>();
+ for (IterInfo other_element : other.ssiList) {
+ __this__ssiList.add(new IterInfo(other_element));
+ }
+ this.ssiList = __this__ssiList;
+ }
+ if (other.isSetSsio()) {
+ Map<String,Map<String,String>> __this__ssio = new HashMap<String,Map<String,String>>();
+ for (Map.Entry<String, Map<String,String>> other_element : other.ssio.entrySet()) {
+
+ String other_element_key = other_element.getKey();
+ Map<String,String> other_element_value = other_element.getValue();
+
+ String __this__ssio_copy_key = other_element_key;
+
+ Map<String,String> __this__ssio_copy_value = new HashMap<String,String>();
+ for (Map.Entry<String, String> other_element_value_element : other_element_value.entrySet()) {
+
+ String other_element_value_element_key = other_element_value_element.getKey();
+ String other_element_value_element_value = other_element_value_element.getValue();
+
+ String __this__ssio_copy_value_copy_key = other_element_value_element_key;
+
+ String __this__ssio_copy_value_copy_value = other_element_value_element_value;
+
+ __this__ssio_copy_value.put(__this__ssio_copy_value_copy_key, __this__ssio_copy_value_copy_value);
+ }
+
+ __this__ssio.put(__this__ssio_copy_key, __this__ssio_copy_value);
+ }
+ this.ssio = __this__ssio;
+ }
+ }
+
+ public TCondition deepCopy() {
+ return new TCondition(this);
+ }
+
+ @Override
+ public void clear() {
+ this.cf = null;
+ this.cq = null;
+ this.cv = null;
+ setTsIsSet(false);
+ this.ts = 0;
+ setHasTimestampIsSet(false);
+ this.hasTimestamp = false;
+ this.val = null;
+ this.ssiList = null;
+ this.ssio = null;
+ }
+
+ public byte[] getCf() {
+ setCf(org.apache.thrift.TBaseHelper.rightSize(cf));
+ return cf == null ? null : cf.array();
+ }
+
+ public ByteBuffer bufferForCf() {
+ return cf;
+ }
+
+ public TCondition setCf(byte[] cf) {
+ setCf(cf == null ? (ByteBuffer)null : ByteBuffer.wrap(cf));
+ return this;
+ }
+
+ public TCondition setCf(ByteBuffer cf) {
+ this.cf = cf;
+ return this;
+ }
+
+ public void unsetCf() {
+ this.cf = null;
+ }
+
+ /** Returns true if field cf is set (has been assigned a value) and false otherwise */
+ public boolean isSetCf() {
+ return this.cf != null;
+ }
+
+ public void setCfIsSet(boolean value) {
+ if (!value) {
+ this.cf = null;
+ }
+ }
+
+ public byte[] getCq() {
+ setCq(org.apache.thrift.TBaseHelper.rightSize(cq));
+ return cq == null ? null : cq.array();
+ }
+
+ public ByteBuffer bufferForCq() {
+ return cq;
+ }
+
+ public TCondition setCq(byte[] cq) {
+ setCq(cq == null ? (ByteBuffer)null : ByteBuffer.wrap(cq));
+ return this;
+ }
+
+ public TCondition setCq(ByteBuffer cq) {
+ this.cq = cq;
+ return this;
+ }
+
+ public void unsetCq() {
+ this.cq = null;
+ }
+
+ /** Returns true if field cq is set (has been assigned a value) and false otherwise */
+ public boolean isSetCq() {
+ return this.cq != null;
+ }
+
+ public void setCqIsSet(boolean value) {
+ if (!value) {
+ this.cq = null;
+ }
+ }
+
+ public byte[] getCv() {
+ setCv(org.apache.thrift.TBaseHelper.rightSize(cv));
+ return cv == null ? null : cv.array();
+ }
+
+ public ByteBuffer bufferForCv() {
+ return cv;
+ }
+
+ public TCondition setCv(byte[] cv) {
+ setCv(cv == null ? (ByteBuffer)null : ByteBuffer.wrap(cv));
+ return this;
+ }
+
+ public TCondition setCv(ByteBuffer cv) {
+ this.cv = cv;
+ return this;
+ }
+
+ public void unsetCv() {
+ this.cv = null;
+ }
+
+ /** Returns true if field cv is set (has been assigned a value) and false otherwise */
+ public boolean isSetCv() {
+ return this.cv != null;
+ }
+
+ public void setCvIsSet(boolean value) {
+ if (!value) {
+ this.cv = null;
+ }
+ }
+
+ public long getTs() {
+ return this.ts;
+ }
+
+ public TCondition setTs(long ts) {
+ this.ts = ts;
+ setTsIsSet(true);
+ return this;
+ }
+
+ public void unsetTs() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TS_ISSET_ID);
+ }
+
+ /** Returns true if field ts is set (has been assigned a value) and false otherwise */
+ public boolean isSetTs() {
+ return EncodingUtils.testBit(__isset_bitfield, __TS_ISSET_ID);
+ }
+
+ public void setTsIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TS_ISSET_ID, value);
+ }
+
+ public boolean isHasTimestamp() {
+ return this.hasTimestamp;
+ }
+
+ public TCondition setHasTimestamp(boolean hasTimestamp) {
+ this.hasTimestamp = hasTimestamp;
+ setHasTimestampIsSet(true);
+ return this;
+ }
+
+ public void unsetHasTimestamp() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __HASTIMESTAMP_ISSET_ID);
+ }
+
+ /** Returns true if field hasTimestamp is set (has been assigned a value) and false otherwise */
+ public boolean isSetHasTimestamp() {
+ return EncodingUtils.testBit(__isset_bitfield, __HASTIMESTAMP_ISSET_ID);
+ }
+
+ public void setHasTimestampIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __HASTIMESTAMP_ISSET_ID, value);
+ }
+
+ public byte[] getVal() {
+ setVal(org.apache.thrift.TBaseHelper.rightSize(val));
+ return val == null ? null : val.array();
+ }
+
+ public ByteBuffer bufferForVal() {
+ return val;
+ }
+
+ public TCondition setVal(byte[] val) {
+ setVal(val == null ? (ByteBuffer)null : ByteBuffer.wrap(val));
+ return this;
+ }
+
+ public TCondition setVal(ByteBuffer val) {
+ this.val = val;
+ return this;
+ }
+
+ public void unsetVal() {
+ this.val = null;
+ }
+
+ /** Returns true if field val is set (has been assigned a value) and false otherwise */
+ public boolean isSetVal() {
+ return this.val != null;
+ }
+
+ public void setValIsSet(boolean value) {
+ if (!value) {
+ this.val = null;
+ }
+ }
+
+ public int getSsiListSize() {
+ return (this.ssiList == null) ? 0 : this.ssiList.size();
+ }
+
+ public java.util.Iterator<IterInfo> getSsiListIterator() {
+ return (this.ssiList == null) ? null : this.ssiList.iterator();
+ }
+
+ public void addToSsiList(IterInfo elem) {
+ if (this.ssiList == null) {
+ this.ssiList = new ArrayList<IterInfo>();
+ }
+ this.ssiList.add(elem);
+ }
+
+ public List<IterInfo> getSsiList() {
+ return this.ssiList;
+ }
+
+ public TCondition setSsiList(List<IterInfo> ssiList) {
+ this.ssiList = ssiList;
+ return this;
+ }
+
+ public void unsetSsiList() {
+ this.ssiList = null;
+ }
+
+ /** Returns true if field ssiList is set (has been assigned a value) and false otherwise */
+ public boolean isSetSsiList() {
+ return this.ssiList != null;
+ }
+
+ public void setSsiListIsSet(boolean value) {
+ if (!value) {
+ this.ssiList = null;
+ }
+ }
+
+ public int getSsioSize() {
+ return (this.ssio == null) ? 0 : this.ssio.size();
+ }
+
+ public void putToSsio(String key, Map<String,String> val) {
+ if (this.ssio == null) {
+ this.ssio = new HashMap<String,Map<String,String>>();
+ }
+ this.ssio.put(key, val);
+ }
+
+ public Map<String,Map<String,String>> getSsio() {
+ return this.ssio;
+ }
+
+ public TCondition setSsio(Map<String,Map<String,String>> ssio) {
+ this.ssio = ssio;
+ return this;
+ }
+
+ public void unsetSsio() {
+ this.ssio = null;
+ }
+
+ /** Returns true if field ssio is set (has been assigned a value) and false otherwise */
+ public boolean isSetSsio() {
+ return this.ssio != null;
+ }
+
+ public void setSsioIsSet(boolean value) {
+ if (!value) {
+ this.ssio = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case CF:
+ if (value == null) {
+ unsetCf();
+ } else {
+ setCf((ByteBuffer)value);
+ }
+ break;
+
+ case CQ:
+ if (value == null) {
+ unsetCq();
+ } else {
+ setCq((ByteBuffer)value);
+ }
+ break;
+
+ case CV:
+ if (value == null) {
+ unsetCv();
+ } else {
+ setCv((ByteBuffer)value);
+ }
+ break;
+
+ case TS:
+ if (value == null) {
+ unsetTs();
+ } else {
+ setTs((Long)value);
+ }
+ break;
+
+ case HAS_TIMESTAMP:
+ if (value == null) {
+ unsetHasTimestamp();
+ } else {
+ setHasTimestamp((Boolean)value);
+ }
+ break;
+
+ case VAL:
+ if (value == null) {
+ unsetVal();
+ } else {
+ setVal((ByteBuffer)value);
+ }
+ break;
+
+ case SSI_LIST:
+ if (value == null) {
+ unsetSsiList();
+ } else {
+ setSsiList((List<IterInfo>)value);
+ }
+ break;
+
+ case SSIO:
+ if (value == null) {
+ unsetSsio();
+ } else {
+ setSsio((Map<String,Map<String,String>>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case CF:
+ return getCf();
+
+ case CQ:
+ return getCq();
+
+ case CV:
+ return getCv();
+
+ case TS:
+ return Long.valueOf(getTs());
+
+ case HAS_TIMESTAMP:
+ return Boolean.valueOf(isHasTimestamp());
+
+ case VAL:
+ return getVal();
+
+ case SSI_LIST:
+ return getSsiList();
+
+ case SSIO:
+ return getSsio();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** 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 CF:
+ return isSetCf();
+ case CQ:
+ return isSetCq();
+ case CV:
+ return isSetCv();
+ case TS:
+ return isSetTs();
+ case HAS_TIMESTAMP:
+ return isSetHasTimestamp();
+ case VAL:
+ return isSetVal();
+ case SSI_LIST:
+ return isSetSsiList();
+ case SSIO:
+ return isSetSsio();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TCondition)
+ return this.equals((TCondition)that);
+ return false;
+ }
+
+ public boolean equals(TCondition that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_cf = true && this.isSetCf();
+ boolean that_present_cf = true && that.isSetCf();
+ if (this_present_cf || that_present_cf) {
+ if (!(this_present_cf && that_present_cf))
+ return false;
+ if (!this.cf.equals(that.cf))
+ return false;
+ }
+
+ boolean this_present_cq = true && this.isSetCq();
+ boolean that_present_cq = true && that.isSetCq();
+ if (this_present_cq || that_present_cq) {
+ if (!(this_present_cq && that_present_cq))
+ return false;
+ if (!this.cq.equals(that.cq))
+ return false;
+ }
+
+ boolean this_present_cv = true && this.isSetCv();
+ boolean that_present_cv = true && that.isSetCv();
+ if (this_present_cv || that_present_cv) {
+ if (!(this_present_cv && that_present_cv))
+ return false;
+ if (!this.cv.equals(that.cv))
+ return false;
+ }
+
+ boolean this_present_ts = true;
+ boolean that_present_ts = true;
+ if (this_present_ts || that_present_ts) {
+ if (!(this_present_ts && that_present_ts))
+ return false;
+ if (this.ts != that.ts)
+ return false;
+ }
+
+ boolean this_present_hasTimestamp = true;
+ boolean that_present_hasTimestamp = true;
+ if (this_present_hasTimestamp || that_present_hasTimestamp) {
+ if (!(this_present_hasTimestamp && that_present_hasTimestamp))
+ return false;
+ if (this.hasTimestamp != that.hasTimestamp)
+ return false;
+ }
+
+ boolean this_present_val = true && this.isSetVal();
+ boolean that_present_val = true && that.isSetVal();
+ if (this_present_val || that_present_val) {
+ if (!(this_present_val && that_present_val))
+ return false;
+ if (!this.val.equals(that.val))
+ return false;
+ }
+
+ boolean this_present_ssiList = true && this.isSetSsiList();
+ boolean that_present_ssiList = true && that.isSetSsiList();
+ if (this_present_ssiList || that_present_ssiList) {
+ if (!(this_present_ssiList && that_present_ssiList))
+ return false;
+ if (!this.ssiList.equals(that.ssiList))
+ return false;
+ }
+
+ boolean this_present_ssio = true && this.isSetSsio();
+ boolean that_present_ssio = true && that.isSetSsio();
+ if (this_present_ssio || that_present_ssio) {
+ if (!(this_present_ssio && that_present_ssio))
+ return false;
+ if (!this.ssio.equals(that.ssio))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ public int compareTo(TCondition other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TCondition typedOther = (TCondition)other;
+
+ lastComparison = Boolean.valueOf(isSetCf()).compareTo(typedOther.isSetCf());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetCf()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cf, typedOther.cf);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetCq()).compareTo(typedOther.isSetCq());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetCq()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cq, typedOther.cq);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetCv()).compareTo(typedOther.isSetCv());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetCv()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cv, typedOther.cv);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetTs()).compareTo(typedOther.isSetTs());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetTs()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ts, typedOther.ts);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetHasTimestamp()).compareTo(typedOther.isSetHasTimestamp());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetHasTimestamp()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hasTimestamp, typedOther.hasTimestamp);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetVal()).compareTo(typedOther.isSetVal());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetVal()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.val, typedOther.val);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetSsiList()).compareTo(typedOther.isSetSsiList());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSsiList()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ssiList, typedOther.ssiList);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetSsio()).compareTo(typedOther.isSetSsio());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSsio()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ssio, typedOther.ssio);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("TCondition(");
+ boolean first = true;
+
+ sb.append("cf:");
+ if (this.cf == null) {
+ sb.append("null");
+ } else {
+ org.apache.thrift.TBaseHelper.toString(this.cf, sb);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("cq:");
+ if (this.cq == null) {
+ sb.append("null");
+ } else {
+ org.apache.thrift.TBaseHelper.toString(this.cq, sb);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("cv:");
+ if (this.cv == null) {
+ sb.append("null");
+ } else {
+ org.apache.thrift.TBaseHelper.toString(this.cv, sb);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("ts:");
+ sb.append(this.ts);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("hasTimestamp:");
+ sb.append(this.hasTimestamp);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("val:");
+ if (this.val == null) {
+ sb.append("null");
+ } else {
+ org.apache.thrift.TBaseHelper.toString(this.val, sb);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("ssiList:");
+ if (this.ssiList == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.ssiList);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("ssio:");
+ if (this.ssio == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.ssio);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ }
+
+ 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_bitfield = 0;
+ 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 TConditionStandardSchemeFactory implements SchemeFactory {
+ public TConditionStandardScheme getScheme() {
+ return new TConditionStandardScheme();
+ }
+ }
+
+ private static class TConditionStandardScheme extends StandardScheme<TCondition> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TCondition 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: // CF
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.cf = iprot.readBinary();
+ struct.setCfIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // CQ
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.cq = iprot.readBinary();
+ struct.setCqIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // CV
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.cv = iprot.readBinary();
+ struct.setCvIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // TS
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.ts = iprot.readI64();
+ struct.setTsIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // HAS_TIMESTAMP
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.hasTimestamp = iprot.readBool();
+ struct.setHasTimestampIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 6: // VAL
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.val = iprot.readBinary();
+ struct.setValIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 7: // SSI_LIST
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list78 = iprot.readListBegin();
+ struct.ssiList = new ArrayList<IterInfo>(_list78.size);
+ for (int _i79 = 0; _i79 < _list78.size; ++_i79)
+ {
+ IterInfo _elem80; // required
+ _elem80 = new IterInfo();
+ _elem80.read(iprot);
+ struct.ssiList.add(_elem80);
+ }
+ iprot.readListEnd();
+ }
+ struct.setSsiListIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 8: // SSIO
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map81 = iprot.readMapBegin();
+ struct.ssio = new HashMap<String,Map<String,String>>(2*_map81.size);
+ for (int _i82 = 0; _i82 < _map81.size; ++_i82)
+ {
+ String _key83; // required
+ Map<String,String> _val84; // required
+ _key83 = iprot.readString();
+ {
+ org.apache.thrift.protocol.TMap _map85 = iprot.readMapBegin();
+ _val84 = new HashMap<String,String>(2*_map85.size);
+ for (int _i86 = 0; _i86 < _map85.size; ++_i86)
+ {
+ String _key87; // required
+ String _val88; // required
+ _key87 = iprot.readString();
+ _val88 = iprot.readString();
+ _val84.put(_key87, _val88);
+ }
+ iprot.readMapEnd();
+ }
+ struct.ssio.put(_key83, _val84);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setSsioIsSet(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, TCondition struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.cf != null) {
+ oprot.writeFieldBegin(CF_FIELD_DESC);
+ oprot.writeBinary(struct.cf);
+ oprot.writeFieldEnd();
+ }
+ if (struct.cq != null) {
+ oprot.writeFieldBegin(CQ_FIELD_DESC);
+ oprot.writeBinary(struct.cq);
+ oprot.writeFieldEnd();
+ }
+ if (struct.cv != null) {
+ oprot.writeFieldBegin(CV_FIELD_DESC);
+ oprot.writeBinary(struct.cv);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(TS_FIELD_DESC);
+ oprot.writeI64(struct.ts);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(HAS_TIMESTAMP_FIELD_DESC);
+ oprot.writeBool(struct.hasTimestamp);
+ oprot.writeFieldEnd();
+ if (struct.val != null) {
+ oprot.writeFieldBegin(VAL_FIELD_DESC);
+ oprot.writeBinary(struct.val);
+ oprot.writeFieldEnd();
+ }
+ if (struct.ssiList != null) {
+ oprot.writeFieldBegin(SSI_LIST_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.ssiList.size()));
+ for (IterInfo _iter89 : struct.ssiList)
+ {
+ _iter89.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.ssio != null) {
+ oprot.writeFieldBegin(SSIO_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.MAP, struct.ssio.size()));
+ for (Map.Entry<String, Map<String,String>> _iter90 : struct.ssio.entrySet())
+ {
+ oprot.writeString(_iter90.getKey());
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, _iter90.getValue().size()));
+ for (Map.Entry<String, String> _iter91 : _iter90.getValue().entrySet())
+ {
+ oprot.writeString(_iter91.getKey());
+ oprot.writeString(_iter91.getValue());
+ }
+ oprot.writeMapEnd();
+ }
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TConditionTupleSchemeFactory implements SchemeFactory {
+ public TConditionTupleScheme getScheme() {
+ return new TConditionTupleScheme();
+ }
+ }
+
+ private static class TConditionTupleScheme extends TupleScheme<TCondition> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TCondition struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetCf()) {
+ optionals.set(0);
+ }
+ if (struct.isSetCq()) {
+ optionals.set(1);
+ }
+ if (struct.isSetCv()) {
+ optionals.set(2);
+ }
+ if (struct.isSetTs()) {
+ optionals.set(3);
+ }
+ if (struct.isSetHasTimestamp()) {
+ optionals.set(4);
+ }
+ if (struct.isSetVal()) {
+ optionals.set(5);
+ }
+ if (struct.isSetSsiList()) {
+ optionals.set(6);
+ }
+ if (struct.isSetSsio()) {
+ optionals.set(7);
+ }
+ oprot.writeBitSet(optionals, 8);
+ if (struct.isSetCf()) {
+ oprot.writeBinary(struct.cf);
+ }
+ if (struct.isSetCq()) {
+ oprot.writeBinary(struct.cq);
+ }
+ if (struct.isSetCv()) {
+ oprot.writeBinary(struct.cv);
+ }
+ if (struct.isSetTs()) {
+ oprot.writeI64(struct.ts);
+ }
+ if (struct.isSetHasTimestamp()) {
+ oprot.writeBool(struct.hasTimestamp);
+ }
+ if (struct.isSetVal()) {
+ oprot.writeBinary(struct.val);
+ }
+ if (struct.isSetSsiList()) {
+ {
+ oprot.writeI32(struct.ssiList.size());
+ for (IterInfo _iter92 : struct.ssiList)
+ {
+ _iter92.write(oprot);
+ }
+ }
+ }
+ if (struct.isSetSsio()) {
+ {
+ oprot.writeI32(struct.ssio.size());
+ for (Map.Entry<String, Map<String,String>> _iter93 : struct.ssio.entrySet())
+ {
+ oprot.writeString(_iter93.getKey());
+ {
+ oprot.writeI32(_iter93.getValue().size());
+ for (Map.Entry<String, String> _iter94 : _iter93.getValue().entrySet())
+ {
+ oprot.writeString(_iter94.getKey());
+ oprot.writeString(_iter94.getValue());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TCondition struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(8);
+ if (incoming.get(0)) {
+ struct.cf = iprot.readBinary();
+ struct.setCfIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.cq = iprot.readBinary();
+ struct.setCqIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.cv = iprot.readBinary();
+ struct.setCvIsSet(true);
+ }
+ if (incoming.get(3)) {
+ struct.ts = iprot.readI64();
+ struct.setTsIsSet(true);
+ }
+ if (incoming.get(4)) {
+ struct.hasTimestamp = iprot.readBool();
+ struct.setHasTimestampIsSet(true);
+ }
+ if (incoming.get(5)) {
+ struct.val = iprot.readBinary();
+ struct.setValIsSet(true);
+ }
+ if (incoming.get(6)) {
+ {
+ org.apache.thrift.protocol.TList _list95 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.ssiList = new ArrayList<IterInfo>(_list95.size);
+ for (int _i96 = 0; _i96 < _list95.size; ++_i96)
+ {
+ IterInfo _elem97; // required
+ _elem97 = new IterInfo();
+ _elem97.read(iprot);
+ struct.ssiList.add(_elem97);
+ }
+ }
+ struct.setSsiListIsSet(true);
+ }
+ if (incoming.get(7)) {
+ {
+ org.apache.thrift.protocol.TMap _map98 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.MAP, iprot.readI32());
+ struct.ssio = new HashMap<String,Map<String,String>>(2*_map98.size);
+ for (int _i99 = 0; _i99 < _map98.size; ++_i99)
+ {
+ String _key100; // required
+ Map<String,String> _val101; // required
+ _key100 = iprot.readString();
+ {
+ org.apache.thrift.protocol.TMap _map102 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ _val101 = new HashMap<String,String>(2*_map102.size);
+ for (int _i103 = 0; _i103 < _map102.size; ++_i103)
+ {
+ String _key104; // required
+ String _val105; // required
+ _key104 = iprot.readString();
+ _val105 = iprot.readString();
+ _val101.put(_key104, _val105);
+ }
+ }
+ struct.ssio.put(_key100, _val101);
+ }
+ }
+ struct.setSsioIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/accumulo/blob/49a7626c/core/src/main/java/org/apache/accumulo/core/data/thrift/TConditionalMutation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/data/thrift/TConditionalMutation.java b/core/src/main/java/org/apache/accumulo/core/data/thrift/TConditionalMutation.java
new file mode 100644
index 0000000..1928803
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/data/thrift/TConditionalMutation.java
@@ -0,0 +1,659 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.accumulo.core.data.thrift;
+
+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 org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+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;
+
+@SuppressWarnings("all") public class TConditionalMutation implements org.apache.thrift.TBase<TConditionalMutation, TConditionalMutation._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TConditionalMutation");
+
+ private static final org.apache.thrift.protocol.TField CONDITIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("conditions", org.apache.thrift.protocol.TType.LIST, (short)1);
+ private static final org.apache.thrift.protocol.TField MUTATION_FIELD_DESC = new org.apache.thrift.protocol.TField("mutation", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+ private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)3);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TConditionalMutationStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TConditionalMutationTupleSchemeFactory());
+ }
+
+ public List<TCondition> conditions; // required
+ public TMutation mutation; // required
+ public long id; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ CONDITIONS((short)1, "conditions"),
+ MUTATION((short)2, "mutation"),
+ ID((short)3, "id");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // CONDITIONS
+ return CONDITIONS;
+ case 2: // MUTATION
+ return MUTATION;
+ case 3: // ID
+ return ID;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __ID_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.CONDITIONS, new org.apache.thrift.meta_data.FieldMetaData("conditions", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCondition.class))));
+ tmpMap.put(_Fields.MUTATION, new org.apache.thrift.meta_data.FieldMetaData("mutation", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TMutation.class)));
+ tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", 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(TConditionalMutation.class, metaDataMap);
+ }
+
+ public TConditionalMutation() {
+ }
+
+ public TConditionalMutation(
+ List<TCondition> conditions,
+ TMutation mutation,
+ long id)
+ {
+ this();
+ this.conditions = conditions;
+ this.mutation = mutation;
+ this.id = id;
+ setIdIsSet(true);
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TConditionalMutation(TConditionalMutation other) {
+ __isset_bitfield = other.__isset_bitfield;
+ if (other.isSetConditions()) {
+ List<TCondition> __this__conditions = new ArrayList<TCondition>();
+ for (TCondition other_element : other.conditions) {
+ __this__conditions.add(new TCondition(other_element));
+ }
+ this.conditions = __this__conditions;
+ }
+ if (other.isSetMutation()) {
+ this.mutation = new TMutation(other.mutation);
+ }
+ this.id = other.id;
+ }
+
+ public TConditionalMutation deepCopy() {
+ return new TConditionalMutation(this);
+ }
+
+ @Override
+ public void clear() {
+ this.conditions = null;
+ this.mutation = null;
+ setIdIsSet(false);
+ this.id = 0;
+ }
+
+ public int getConditionsSize() {
+ return (this.conditions == null) ? 0 : this.conditions.size();
+ }
+
+ public java.util.Iterator<TCondition> getConditionsIterator() {
+ return (this.conditions == null) ? null : this.conditions.iterator();
+ }
+
+ public void addToConditions(TCondition elem) {
+ if (this.conditions == null) {
+ this.conditions = new ArrayList<TCondition>();
+ }
+ this.conditions.add(elem);
+ }
+
+ public List<TCondition> getConditions() {
+ return this.conditions;
+ }
+
+ public TConditionalMutation setConditions(List<TCondition> conditions) {
+ this.conditions = conditions;
+ return this;
+ }
+
+ public void unsetConditions() {
+ this.conditions = null;
+ }
+
+ /** Returns true if field conditions is set (has been assigned a value) and false otherwise */
+ public boolean isSetConditions() {
+ return this.conditions != null;
+ }
+
+ public void setConditionsIsSet(boolean value) {
+ if (!value) {
+ this.conditions = null;
+ }
+ }
+
+ public TMutation getMutation() {
+ return this.mutation;
+ }
+
+ public TConditionalMutation setMutation(TMutation mutation) {
+ this.mutation = mutation;
+ return this;
+ }
+
+ public void unsetMutation() {
+ this.mutation = null;
+ }
+
+ /** Returns true if field mutation is set (has been assigned a value) and false otherwise */
+ public boolean isSetMutation() {
+ return this.mutation != null;
+ }
+
+ public void setMutationIsSet(boolean value) {
+ if (!value) {
+ this.mutation = null;
+ }
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+ public TConditionalMutation setId(long id) {
+ this.id = id;
+ setIdIsSet(true);
+ return this;
+ }
+
+ public void unsetId() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID);
+ }
+
+ /** Returns true if field id is set (has been assigned a value) and false otherwise */
+ public boolean isSetId() {
+ return EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID);
+ }
+
+ public void setIdIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value);
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case CONDITIONS:
+ if (value == null) {
+ unsetConditions();
+ } else {
+ setConditions((List<TCondition>)value);
+ }
+ break;
+
+ case MUTATION:
+ if (value == null) {
+ unsetMutation();
+ } else {
+ setMutation((TMutation)value);
+ }
+ break;
+
+ case ID:
+ if (value == null) {
+ unsetId();
+ } else {
+ setId((Long)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case CONDITIONS:
+ return getConditions();
+
+ case MUTATION:
+ return getMutation();
+
+ case ID:
+ return Long.valueOf(getId());
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** 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 CONDITIONS:
+ return isSetConditions();
+ case MUTATION:
+ return isSetMutation();
+ case ID:
+ return isSetId();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TConditionalMutation)
+ return this.equals((TConditionalMutation)that);
+ return false;
+ }
+
+ public boolean equals(TConditionalMutation that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_conditions = true && this.isSetConditions();
+ boolean that_present_conditions = true && that.isSetConditions();
+ if (this_present_conditions || that_present_conditions) {
+ if (!(this_present_conditions && that_present_conditions))
+ return false;
+ if (!this.conditions.equals(that.conditions))
+ return false;
+ }
+
+ boolean this_present_mutation = true && this.isSetMutation();
+ boolean that_present_mutation = true && that.isSetMutation();
+ if (this_present_mutation || that_present_mutation) {
+ if (!(this_present_mutation && that_present_mutation))
+ return false;
+ if (!this.mutation.equals(that.mutation))
+ return false;
+ }
+
+ boolean this_present_id = true;
+ boolean that_present_id = true;
+ if (this_present_id || that_present_id) {
+ if (!(this_present_id && that_present_id))
+ return false;
+ if (this.id != that.id)
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ public int compareTo(TConditionalMutation other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TConditionalMutation typedOther = (TConditionalMutation)other;
+
+ lastComparison = Boolean.valueOf(isSetConditions()).compareTo(typedOther.isSetConditions());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetConditions()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.conditions, typedOther.conditions);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetMutation()).compareTo(typedOther.isSetMutation());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetMutation()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mutation, typedOther.mutation);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetId()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("TConditionalMutation(");
+ boolean first = true;
+
+ sb.append("conditions:");
+ if (this.conditions == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.conditions);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("mutation:");
+ if (this.mutation == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.mutation);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("id:");
+ sb.append(this.id);
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (mutation != null) {
+ mutation.validate();
+ }
+ }
+
+ 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_bitfield = 0;
+ 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 TConditionalMutationStandardSchemeFactory implements SchemeFactory {
+ public TConditionalMutationStandardScheme getScheme() {
+ return new TConditionalMutationStandardScheme();
+ }
+ }
+
+ private static class TConditionalMutationStandardScheme extends StandardScheme<TConditionalMutation> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TConditionalMutation 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: // CONDITIONS
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list106 = iprot.readListBegin();
+ struct.conditions = new ArrayList<TCondition>(_list106.size);
+ for (int _i107 = 0; _i107 < _list106.size; ++_i107)
+ {
+ TCondition _elem108; // required
+ _elem108 = new TCondition();
+ _elem108.read(iprot);
+ struct.conditions.add(_elem108);
+ }
+ iprot.readListEnd();
+ }
+ struct.setConditionsIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // MUTATION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.mutation = new TMutation();
+ struct.mutation.read(iprot);
+ struct.setMutationIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.id = iprot.readI64();
+ struct.setIdIsSet(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, TConditionalMutation struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.conditions != null) {
+ oprot.writeFieldBegin(CONDITIONS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.conditions.size()));
+ for (TCondition _iter109 : struct.conditions)
+ {
+ _iter109.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.mutation != null) {
+ oprot.writeFieldBegin(MUTATION_FIELD_DESC);
+ struct.mutation.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(ID_FIELD_DESC);
+ oprot.writeI64(struct.id);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TConditionalMutationTupleSchemeFactory implements SchemeFactory {
+ public TConditionalMutationTupleScheme getScheme() {
+ return new TConditionalMutationTupleScheme();
+ }
+ }
+
+ private static class TConditionalMutationTupleScheme extends TupleScheme<TConditionalMutation> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TConditionalMutation struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetConditions()) {
+ optionals.set(0);
+ }
+ if (struct.isSetMutation()) {
+ optionals.set(1);
+ }
+ if (struct.isSetId()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetConditions()) {
+ {
+ oprot.writeI32(struct.conditions.size());
+ for (TCondition _iter110 : struct.conditions)
+ {
+ _iter110.write(oprot);
+ }
+ }
+ }
+ if (struct.isSetMutation()) {
+ struct.mutation.write(oprot);
+ }
+ if (struct.isSetId()) {
+ oprot.writeI64(struct.id);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TConditionalMutation struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TList _list111 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.conditions = new ArrayList<TCondition>(_list111.size);
+ for (int _i112 = 0; _i112 < _list111.size; ++_i112)
+ {
+ TCondition _elem113; // required
+ _elem113 = new TCondition();
+ _elem113.read(iprot);
+ struct.conditions.add(_elem113);
+ }
+ }
+ struct.setConditionsIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.mutation = new TMutation();
+ struct.mutation.read(iprot);
+ struct.setMutationIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.id = iprot.readI64();
+ struct.setIdIsSet(true);
+ }
+ }
+ }
+
+}
+