Updated Branches:
  refs/heads/master 314117714 -> 176df80fd

http://git-wip-us.apache.org/repos/asf/accumulo/blob/176df80f/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ConditionalWriterOptions.java
----------------------------------------------------------------------
diff --git 
a/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ConditionalWriterOptions.java
 
b/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ConditionalWriterOptions.java
new file mode 100644
index 0000000..8a045f1
--- /dev/null
+++ 
b/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ConditionalWriterOptions.java
@@ -0,0 +1,743 @@
+/*
+ * 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.proxy.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 ConditionalWriterOptions implements 
org.apache.thrift.TBase<ConditionalWriterOptions, 
ConditionalWriterOptions._Fields>, java.io.Serializable, Cloneable {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new 
org.apache.thrift.protocol.TStruct("ConditionalWriterOptions");
+
+  private static final org.apache.thrift.protocol.TField MAX_MEMORY_FIELD_DESC 
= new org.apache.thrift.protocol.TField("maxMemory", 
org.apache.thrift.protocol.TType.I64, (short)1);
+  private static final org.apache.thrift.protocol.TField TIMEOUT_MS_FIELD_DESC 
= new org.apache.thrift.protocol.TField("timeoutMs", 
org.apache.thrift.protocol.TType.I64, (short)2);
+  private static final org.apache.thrift.protocol.TField THREADS_FIELD_DESC = 
new org.apache.thrift.protocol.TField("threads", 
org.apache.thrift.protocol.TType.I32, (short)3);
+  private static final org.apache.thrift.protocol.TField 
AUTHORIZATIONS_FIELD_DESC = new 
org.apache.thrift.protocol.TField("authorizations", 
org.apache.thrift.protocol.TType.SET, (short)4);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = 
new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new 
ConditionalWriterOptionsStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new 
ConditionalWriterOptionsTupleSchemeFactory());
+  }
+
+  public long maxMemory; // optional
+  public long timeoutMs; // optional
+  public int threads; // optional
+  public Set<ByteBuffer> authorizations; // optional
+
+  /** 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 {
+    MAX_MEMORY((short)1, "maxMemory"),
+    TIMEOUT_MS((short)2, "timeoutMs"),
+    THREADS((short)3, "threads"),
+    AUTHORIZATIONS((short)4, "authorizations");
+
+    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: // MAX_MEMORY
+          return MAX_MEMORY;
+        case 2: // TIMEOUT_MS
+          return TIMEOUT_MS;
+        case 3: // THREADS
+          return THREADS;
+        case 4: // AUTHORIZATIONS
+          return AUTHORIZATIONS;
+        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 __MAXMEMORY_ISSET_ID = 0;
+  private static final int __TIMEOUTMS_ISSET_ID = 1;
+  private static final int __THREADS_ISSET_ID = 2;
+  private byte __isset_bitfield = 0;
+  private _Fields optionals[] = 
{_Fields.MAX_MEMORY,_Fields.TIMEOUT_MS,_Fields.THREADS,_Fields.AUTHORIZATIONS};
+  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.MAX_MEMORY, new 
org.apache.thrift.meta_data.FieldMetaData("maxMemory", 
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new 
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.TIMEOUT_MS, new 
org.apache.thrift.meta_data.FieldMetaData("timeoutMs", 
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new 
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.THREADS, new 
org.apache.thrift.meta_data.FieldMetaData("threads", 
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new 
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+    tmpMap.put(_Fields.AUTHORIZATIONS, new 
org.apache.thrift.meta_data.FieldMetaData("authorizations", 
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new 
org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
+            new 
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING
            , true))));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ConditionalWriterOptions.class,
 metaDataMap);
+  }
+
+  public ConditionalWriterOptions() {
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public ConditionalWriterOptions(ConditionalWriterOptions other) {
+    __isset_bitfield = other.__isset_bitfield;
+    this.maxMemory = other.maxMemory;
+    this.timeoutMs = other.timeoutMs;
+    this.threads = other.threads;
+    if (other.isSetAuthorizations()) {
+      Set<ByteBuffer> __this__authorizations = new HashSet<ByteBuffer>();
+      for (ByteBuffer other_element : other.authorizations) {
+        ByteBuffer temp_binary_element = 
org.apache.thrift.TBaseHelper.copyBinary(other_element);
+;
+        __this__authorizations.add(temp_binary_element);
+      }
+      this.authorizations = __this__authorizations;
+    }
+  }
+
+  public ConditionalWriterOptions deepCopy() {
+    return new ConditionalWriterOptions(this);
+  }
+
+  @Override
+  public void clear() {
+    setMaxMemoryIsSet(false);
+    this.maxMemory = 0;
+    setTimeoutMsIsSet(false);
+    this.timeoutMs = 0;
+    setThreadsIsSet(false);
+    this.threads = 0;
+    this.authorizations = null;
+  }
+
+  public long getMaxMemory() {
+    return this.maxMemory;
+  }
+
+  public ConditionalWriterOptions setMaxMemory(long maxMemory) {
+    this.maxMemory = maxMemory;
+    setMaxMemoryIsSet(true);
+    return this;
+  }
+
+  public void unsetMaxMemory() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, 
__MAXMEMORY_ISSET_ID);
+  }
+
+  /** Returns true if field maxMemory is set (has been assigned a value) and 
false otherwise */
+  public boolean isSetMaxMemory() {
+    return EncodingUtils.testBit(__isset_bitfield, __MAXMEMORY_ISSET_ID);
+  }
+
+  public void setMaxMemoryIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, 
__MAXMEMORY_ISSET_ID, value);
+  }
+
+  public long getTimeoutMs() {
+    return this.timeoutMs;
+  }
+
+  public ConditionalWriterOptions setTimeoutMs(long timeoutMs) {
+    this.timeoutMs = timeoutMs;
+    setTimeoutMsIsSet(true);
+    return this;
+  }
+
+  public void unsetTimeoutMs() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, 
__TIMEOUTMS_ISSET_ID);
+  }
+
+  /** Returns true if field timeoutMs is set (has been assigned a value) and 
false otherwise */
+  public boolean isSetTimeoutMs() {
+    return EncodingUtils.testBit(__isset_bitfield, __TIMEOUTMS_ISSET_ID);
+  }
+
+  public void setTimeoutMsIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, 
__TIMEOUTMS_ISSET_ID, value);
+  }
+
+  public int getThreads() {
+    return this.threads;
+  }
+
+  public ConditionalWriterOptions setThreads(int threads) {
+    this.threads = threads;
+    setThreadsIsSet(true);
+    return this;
+  }
+
+  public void unsetThreads() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, 
__THREADS_ISSET_ID);
+  }
+
+  /** Returns true if field threads is set (has been assigned a value) and 
false otherwise */
+  public boolean isSetThreads() {
+    return EncodingUtils.testBit(__isset_bitfield, __THREADS_ISSET_ID);
+  }
+
+  public void setThreadsIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, 
__THREADS_ISSET_ID, value);
+  }
+
+  public int getAuthorizationsSize() {
+    return (this.authorizations == null) ? 0 : this.authorizations.size();
+  }
+
+  public java.util.Iterator<ByteBuffer> getAuthorizationsIterator() {
+    return (this.authorizations == null) ? null : 
this.authorizations.iterator();
+  }
+
+  public void addToAuthorizations(ByteBuffer elem) {
+    if (this.authorizations == null) {
+      this.authorizations = new HashSet<ByteBuffer>();
+    }
+    this.authorizations.add(elem);
+  }
+
+  public Set<ByteBuffer> getAuthorizations() {
+    return this.authorizations;
+  }
+
+  public ConditionalWriterOptions setAuthorizations(Set<ByteBuffer> 
authorizations) {
+    this.authorizations = authorizations;
+    return this;
+  }
+
+  public void unsetAuthorizations() {
+    this.authorizations = null;
+  }
+
+  /** Returns true if field authorizations is set (has been assigned a value) 
and false otherwise */
+  public boolean isSetAuthorizations() {
+    return this.authorizations != null;
+  }
+
+  public void setAuthorizationsIsSet(boolean value) {
+    if (!value) {
+      this.authorizations = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case MAX_MEMORY:
+      if (value == null) {
+        unsetMaxMemory();
+      } else {
+        setMaxMemory((Long)value);
+      }
+      break;
+
+    case TIMEOUT_MS:
+      if (value == null) {
+        unsetTimeoutMs();
+      } else {
+        setTimeoutMs((Long)value);
+      }
+      break;
+
+    case THREADS:
+      if (value == null) {
+        unsetThreads();
+      } else {
+        setThreads((Integer)value);
+      }
+      break;
+
+    case AUTHORIZATIONS:
+      if (value == null) {
+        unsetAuthorizations();
+      } else {
+        setAuthorizations((Set<ByteBuffer>)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case MAX_MEMORY:
+      return Long.valueOf(getMaxMemory());
+
+    case TIMEOUT_MS:
+      return Long.valueOf(getTimeoutMs());
+
+    case THREADS:
+      return Integer.valueOf(getThreads());
+
+    case AUTHORIZATIONS:
+      return getAuthorizations();
+
+    }
+    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 MAX_MEMORY:
+      return isSetMaxMemory();
+    case TIMEOUT_MS:
+      return isSetTimeoutMs();
+    case THREADS:
+      return isSetThreads();
+    case AUTHORIZATIONS:
+      return isSetAuthorizations();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof ConditionalWriterOptions)
+      return this.equals((ConditionalWriterOptions)that);
+    return false;
+  }
+
+  public boolean equals(ConditionalWriterOptions that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_maxMemory = true && this.isSetMaxMemory();
+    boolean that_present_maxMemory = true && that.isSetMaxMemory();
+    if (this_present_maxMemory || that_present_maxMemory) {
+      if (!(this_present_maxMemory && that_present_maxMemory))
+        return false;
+      if (this.maxMemory != that.maxMemory)
+        return false;
+    }
+
+    boolean this_present_timeoutMs = true && this.isSetTimeoutMs();
+    boolean that_present_timeoutMs = true && that.isSetTimeoutMs();
+    if (this_present_timeoutMs || that_present_timeoutMs) {
+      if (!(this_present_timeoutMs && that_present_timeoutMs))
+        return false;
+      if (this.timeoutMs != that.timeoutMs)
+        return false;
+    }
+
+    boolean this_present_threads = true && this.isSetThreads();
+    boolean that_present_threads = true && that.isSetThreads();
+    if (this_present_threads || that_present_threads) {
+      if (!(this_present_threads && that_present_threads))
+        return false;
+      if (this.threads != that.threads)
+        return false;
+    }
+
+    boolean this_present_authorizations = true && this.isSetAuthorizations();
+    boolean that_present_authorizations = true && that.isSetAuthorizations();
+    if (this_present_authorizations || that_present_authorizations) {
+      if (!(this_present_authorizations && that_present_authorizations))
+        return false;
+      if (!this.authorizations.equals(that.authorizations))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  public int compareTo(ConditionalWriterOptions other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    ConditionalWriterOptions typedOther = (ConditionalWriterOptions)other;
+
+    lastComparison = 
Boolean.valueOf(isSetMaxMemory()).compareTo(typedOther.isSetMaxMemory());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetMaxMemory()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxMemory, 
typedOther.maxMemory);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = 
Boolean.valueOf(isSetTimeoutMs()).compareTo(typedOther.isSetTimeoutMs());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetTimeoutMs()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeoutMs, 
typedOther.timeoutMs);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = 
Boolean.valueOf(isSetThreads()).compareTo(typedOther.isSetThreads());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetThreads()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.threads, 
typedOther.threads);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = 
Boolean.valueOf(isSetAuthorizations()).compareTo(typedOther.isSetAuthorizations());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetAuthorizations()) {
+      lastComparison = 
org.apache.thrift.TBaseHelper.compareTo(this.authorizations, 
typedOther.authorizations);
+      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("ConditionalWriterOptions(");
+    boolean first = true;
+
+    if (isSetMaxMemory()) {
+      sb.append("maxMemory:");
+      sb.append(this.maxMemory);
+      first = false;
+    }
+    if (isSetTimeoutMs()) {
+      if (!first) sb.append(", ");
+      sb.append("timeoutMs:");
+      sb.append(this.timeoutMs);
+      first = false;
+    }
+    if (isSetThreads()) {
+      if (!first) sb.append(", ");
+      sb.append("threads:");
+      sb.append(this.threads);
+      first = false;
+    }
+    if (isSetAuthorizations()) {
+      if (!first) sb.append(", ");
+      sb.append("authorizations:");
+      if (this.authorizations == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.authorizations);
+      }
+      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 ConditionalWriterOptionsStandardSchemeFactory 
implements SchemeFactory {
+    public ConditionalWriterOptionsStandardScheme getScheme() {
+      return new ConditionalWriterOptionsStandardScheme();
+    }
+  }
+
+  private static class ConditionalWriterOptionsStandardScheme extends 
StandardScheme<ConditionalWriterOptions> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, 
ConditionalWriterOptions 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: // MAX_MEMORY
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.maxMemory = iprot.readI64();
+              struct.setMaxMemoryIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
+            }
+            break;
+          case 2: // TIMEOUT_MS
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.timeoutMs = iprot.readI64();
+              struct.setTimeoutMsIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
+            }
+            break;
+          case 3: // THREADS
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.threads = iprot.readI32();
+              struct.setThreadsIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
+            }
+            break;
+          case 4: // AUTHORIZATIONS
+            if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+              {
+                org.apache.thrift.protocol.TSet _set106 = iprot.readSetBegin();
+                struct.authorizations = new 
HashSet<ByteBuffer>(2*_set106.size);
+                for (int _i107 = 0; _i107 < _set106.size; ++_i107)
+                {
+                  ByteBuffer _elem108; // required
+                  _elem108 = iprot.readBinary();
+                  struct.authorizations.add(_elem108);
+                }
+                iprot.readSetEnd();
+              }
+              struct.setAuthorizationsIsSet(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, 
ConditionalWriterOptions struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.isSetMaxMemory()) {
+        oprot.writeFieldBegin(MAX_MEMORY_FIELD_DESC);
+        oprot.writeI64(struct.maxMemory);
+        oprot.writeFieldEnd();
+      }
+      if (struct.isSetTimeoutMs()) {
+        oprot.writeFieldBegin(TIMEOUT_MS_FIELD_DESC);
+        oprot.writeI64(struct.timeoutMs);
+        oprot.writeFieldEnd();
+      }
+      if (struct.isSetThreads()) {
+        oprot.writeFieldBegin(THREADS_FIELD_DESC);
+        oprot.writeI32(struct.threads);
+        oprot.writeFieldEnd();
+      }
+      if (struct.authorizations != null) {
+        if (struct.isSetAuthorizations()) {
+          oprot.writeFieldBegin(AUTHORIZATIONS_FIELD_DESC);
+          {
+            oprot.writeSetBegin(new 
org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, 
struct.authorizations.size()));
+            for (ByteBuffer _iter109 : struct.authorizations)
+            {
+              oprot.writeBinary(_iter109);
+            }
+            oprot.writeSetEnd();
+          }
+          oprot.writeFieldEnd();
+        }
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class ConditionalWriterOptionsTupleSchemeFactory implements 
SchemeFactory {
+    public ConditionalWriterOptionsTupleScheme getScheme() {
+      return new ConditionalWriterOptionsTupleScheme();
+    }
+  }
+
+  private static class ConditionalWriterOptionsTupleScheme extends 
TupleScheme<ConditionalWriterOptions> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, 
ConditionalWriterOptions struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetMaxMemory()) {
+        optionals.set(0);
+      }
+      if (struct.isSetTimeoutMs()) {
+        optionals.set(1);
+      }
+      if (struct.isSetThreads()) {
+        optionals.set(2);
+      }
+      if (struct.isSetAuthorizations()) {
+        optionals.set(3);
+      }
+      oprot.writeBitSet(optionals, 4);
+      if (struct.isSetMaxMemory()) {
+        oprot.writeI64(struct.maxMemory);
+      }
+      if (struct.isSetTimeoutMs()) {
+        oprot.writeI64(struct.timeoutMs);
+      }
+      if (struct.isSetThreads()) {
+        oprot.writeI32(struct.threads);
+      }
+      if (struct.isSetAuthorizations()) {
+        {
+          oprot.writeI32(struct.authorizations.size());
+          for (ByteBuffer _iter110 : struct.authorizations)
+          {
+            oprot.writeBinary(_iter110);
+          }
+        }
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, 
ConditionalWriterOptions struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(4);
+      if (incoming.get(0)) {
+        struct.maxMemory = iprot.readI64();
+        struct.setMaxMemoryIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.timeoutMs = iprot.readI64();
+        struct.setTimeoutMsIsSet(true);
+      }
+      if (incoming.get(2)) {
+        struct.threads = iprot.readI32();
+        struct.setThreadsIsSet(true);
+      }
+      if (incoming.get(3)) {
+        {
+          org.apache.thrift.protocol.TSet _set111 = new 
org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, 
iprot.readI32());
+          struct.authorizations = new HashSet<ByteBuffer>(2*_set111.size);
+          for (int _i112 = 0; _i112 < _set111.size; ++_i112)
+          {
+            ByteBuffer _elem113; // required
+            _elem113 = iprot.readBinary();
+            struct.authorizations.add(_elem113);
+          }
+        }
+        struct.setAuthorizationsIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/accumulo/blob/176df80f/proxy/src/main/java/org/apache/accumulo/proxy/thrift/DiskUsage.java
----------------------------------------------------------------------
diff --git 
a/proxy/src/main/java/org/apache/accumulo/proxy/thrift/DiskUsage.java 
b/proxy/src/main/java/org/apache/accumulo/proxy/thrift/DiskUsage.java
index d651e20..b82d185 100644
--- a/proxy/src/main/java/org/apache/accumulo/proxy/thrift/DiskUsage.java
+++ b/proxy/src/main/java/org/apache/accumulo/proxy/thrift/DiskUsage.java
@@ -436,7 +436,7 @@ import org.slf4j.LoggerFactory;
                 struct.tables = new ArrayList<String>(_list0.size);
                 for (int _i1 = 0; _i1 < _list0.size; ++_i1)
                 {
-                  String _elem2; // optional
+                  String _elem2; // required
                   _elem2 = iprot.readString();
                   struct.tables.add(_elem2);
                 }
@@ -534,7 +534,7 @@ import org.slf4j.LoggerFactory;
           struct.tables = new ArrayList<String>(_list5.size);
           for (int _i6 = 0; _i6 < _list5.size; ++_i6)
           {
-            String _elem7; // optional
+            String _elem7; // required
             _elem7 = iprot.readString();
             struct.tables.add(_elem7);
           }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/176df80f/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ScanOptions.java
----------------------------------------------------------------------
diff --git 
a/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ScanOptions.java 
b/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ScanOptions.java
index 5f5df4e..34ce213 100644
--- a/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ScanOptions.java
+++ b/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ScanOptions.java
@@ -707,7 +707,7 @@ import org.slf4j.LoggerFactory;
                 struct.authorizations = new HashSet<ByteBuffer>(2*_set26.size);
                 for (int _i27 = 0; _i27 < _set26.size; ++_i27)
                 {
-                  ByteBuffer _elem28; // optional
+                  ByteBuffer _elem28; // required
                   _elem28 = iprot.readBinary();
                   struct.authorizations.add(_elem28);
                 }
@@ -734,7 +734,7 @@ import org.slf4j.LoggerFactory;
                 struct.columns = new ArrayList<ScanColumn>(_list29.size);
                 for (int _i30 = 0; _i30 < _list29.size; ++_i30)
                 {
-                  ScanColumn _elem31; // optional
+                  ScanColumn _elem31; // required
                   _elem31 = new ScanColumn();
                   _elem31.read(iprot);
                   struct.columns.add(_elem31);
@@ -753,7 +753,7 @@ import org.slf4j.LoggerFactory;
                 struct.iterators = new 
ArrayList<IteratorSetting>(_list32.size);
                 for (int _i33 = 0; _i33 < _list32.size; ++_i33)
                 {
-                  IteratorSetting _elem34; // optional
+                  IteratorSetting _elem34; // required
                   _elem34 = new IteratorSetting();
                   _elem34.read(iprot);
                   struct.iterators.add(_elem34);
@@ -921,7 +921,7 @@ import org.slf4j.LoggerFactory;
           struct.authorizations = new HashSet<ByteBuffer>(2*_set41.size);
           for (int _i42 = 0; _i42 < _set41.size; ++_i42)
           {
-            ByteBuffer _elem43; // optional
+            ByteBuffer _elem43; // required
             _elem43 = iprot.readBinary();
             struct.authorizations.add(_elem43);
           }
@@ -939,7 +939,7 @@ import org.slf4j.LoggerFactory;
           struct.columns = new ArrayList<ScanColumn>(_list44.size);
           for (int _i45 = 0; _i45 < _list44.size; ++_i45)
           {
-            ScanColumn _elem46; // optional
+            ScanColumn _elem46; // required
             _elem46 = new ScanColumn();
             _elem46.read(iprot);
             struct.columns.add(_elem46);
@@ -953,7 +953,7 @@ import org.slf4j.LoggerFactory;
           struct.iterators = new ArrayList<IteratorSetting>(_list47.size);
           for (int _i48 = 0; _i48 < _list47.size; ++_i48)
           {
-            IteratorSetting _elem49; // optional
+            IteratorSetting _elem49; // required
             _elem49 = new IteratorSetting();
             _elem49.read(iprot);
             struct.iterators.add(_elem49);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/176df80f/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ScanResult.java
----------------------------------------------------------------------
diff --git 
a/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ScanResult.java 
b/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ScanResult.java
index 00c65aa..4402910 100644
--- a/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ScanResult.java
+++ b/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ScanResult.java
@@ -436,7 +436,7 @@ import org.slf4j.LoggerFactory;
                 struct.results = new ArrayList<KeyValue>(_list8.size);
                 for (int _i9 = 0; _i9 < _list8.size; ++_i9)
                 {
-                  KeyValue _elem10; // optional
+                  KeyValue _elem10; // required
                   _elem10 = new KeyValue();
                   _elem10.read(iprot);
                   struct.results.add(_elem10);
@@ -535,7 +535,7 @@ import org.slf4j.LoggerFactory;
           struct.results = new ArrayList<KeyValue>(_list13.size);
           for (int _i14 = 0; _i14 < _list13.size; ++_i14)
           {
-            KeyValue _elem15; // optional
+            KeyValue _elem15; // required
             _elem15 = new KeyValue();
             _elem15.read(iprot);
             struct.results.add(_elem15);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/176df80f/proxy/src/main/thrift/proxy.thrift
----------------------------------------------------------------------
diff --git a/proxy/src/main/thrift/proxy.thrift 
b/proxy/src/main/thrift/proxy.thrift
index 71ff452..bc83232 100644
--- a/proxy/src/main/thrift/proxy.thrift
+++ b/proxy/src/main/thrift/proxy.thrift
@@ -141,6 +141,33 @@ struct Column {
   3:binary colVisibility;
 }
 
+struct Condition {
+  1:Column column;
+  2:optional i64 timestamp;
+  3:optional binary value;
+  4:optional list<IteratorSetting> iterators;
+}
+
+struct ConditionalUpdates {
+       2:list<Condition> conditions
+       3:list<ColumnUpdate> updates 
+}
+
+enum ConditionalStatus {
+  ACCEPTED,
+  REJECTED,
+  VIOLATED,
+  UNKNOWN,
+  INVISIBLE_VISIBILITY
+}
+
+struct ConditionalWriterOptions {
+   1:optional i64 maxMemory
+   2:optional i64 timeoutMs
+   3:optional i32 threads
+   4:optional set<binary> authorizations;
+}
+
 struct ActiveScan {
   1:string client
   2:string user
@@ -341,6 +368,17 @@ service AccumuloProxy
   void flush(1:string writer)                                                  
                    throws (1:UnknownWriter ouch1, 2:MutationsRejectedException 
ouch2);
   void closeWriter(1:string writer)                                            
                    throws (1:UnknownWriter ouch1, 2:MutationsRejectedException 
ouch2);
 
+  //api for a single conditional update
+  ConditionalStatus updateRowConditionally(1:binary login, 2:string tableName, 
3:binary row, 
+                                           4:ConditionalUpdates updates)       
                    throws (1:AccumuloException ouch1, 
2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+  
+  //api for batch conditional updates
+  string createConditionalWriter(1:binary login, 2:string tableName, 
+                                 3:ConditionalWriterOptions options)           
                    throws (1:AccumuloException ouch1, 
2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+  map<binary, ConditionalStatus> updateRowsConditionally(1:string 
conditionalWriter,                   
+                                                     2:map<binary, 
ConditionalUpdates> updates)    throws (1:UnknownWriter ouch1, 
2:AccumuloException ouch2, 3:AccumuloSecurityException ouch3);
+  void closeConditionalWriter(1:string conditionalWriter);
+
   // utilities
   Range getRowRange(1:binary row);
   Key getFollowing(1:Key key, 2:PartialKey part);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/176df80f/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
----------------------------------------------------------------------
diff --git a/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java 
b/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
index 15dd2e5..f65d647 100644
--- a/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
+++ b/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
@@ -51,6 +51,7 @@ import 
org.apache.accumulo.core.iterators.SortedKeyValueIterator;
 import org.apache.accumulo.core.iterators.user.SummingCombiner;
 import org.apache.accumulo.core.iterators.user.VersioningIterator;
 import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.util.ByteBufferUtil;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.examples.simple.constraints.NumericValueConstraint;
 import org.apache.accumulo.minicluster.MiniAccumuloCluster;
@@ -60,13 +61,19 @@ import 
org.apache.accumulo.proxy.thrift.AccumuloSecurityException;
 import org.apache.accumulo.proxy.thrift.ActiveCompaction;
 import org.apache.accumulo.proxy.thrift.ActiveScan;
 import org.apache.accumulo.proxy.thrift.BatchScanOptions;
+import org.apache.accumulo.proxy.thrift.Column;
 import org.apache.accumulo.proxy.thrift.ColumnUpdate;
 import org.apache.accumulo.proxy.thrift.CompactionReason;
 import org.apache.accumulo.proxy.thrift.CompactionType;
+import org.apache.accumulo.proxy.thrift.Condition;
+import org.apache.accumulo.proxy.thrift.ConditionalStatus;
+import org.apache.accumulo.proxy.thrift.ConditionalUpdates;
+import org.apache.accumulo.proxy.thrift.ConditionalWriterOptions;
 import org.apache.accumulo.proxy.thrift.DiskUsage;
 import org.apache.accumulo.proxy.thrift.IteratorScope;
 import org.apache.accumulo.proxy.thrift.IteratorSetting;
 import org.apache.accumulo.proxy.thrift.Key;
+import org.apache.accumulo.proxy.thrift.KeyValue;
 import org.apache.accumulo.proxy.thrift.MutationsRejectedException;
 import org.apache.accumulo.proxy.thrift.PartialKey;
 import org.apache.accumulo.proxy.thrift.Range;
@@ -434,6 +441,10 @@ public class SimpleTest {
       client.testTableClassLoad(badLogin, table, 
VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName());
       fail("exception not thrown");
     } catch (AccumuloSecurityException ex) {}
+    try {
+      client.createConditionalWriter(badLogin, table, new 
ConditionalWriterOptions());
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
   }
   
   @Test(timeout = 10000)
@@ -589,6 +600,9 @@ public class SimpleTest {
       client.testTableClassLoad(creds, doesNotExist, 
VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName());
       fail("exception not thrown");
     } catch (TableNotFoundException ex) {}
+    try {
+      client.createConditionalWriter(creds, doesNotExist, new 
ConditionalWriterOptions());
+    } catch (TableNotFoundException ex) {}
   }
   
   @Test(timeout = 10000)
@@ -807,6 +821,9 @@ public class SimpleTest {
   
   @Test
   public void testSecurityOperations() throws Exception {
+    if (client.tableExists(creds, TABLE_TEST))
+      client.deleteTable(creds, TABLE_TEST);
+
     // check password
     assertTrue(client.authenticateUser(creds, "root", s2pp(secret)));
     assertFalse(client.authenticateUser(creds, "root", s2pp("")));
@@ -1103,6 +1120,320 @@ public class SimpleTest {
     assertTrue(client.testTableClassLoad(creds, "bar", 
VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName()));
   }
   
+  private Condition newCondition(String cf, String cq) {
+    return new Condition(new Column(s2bb(cf), s2bb(cq), s2bb("")));
+  }
+  
+  private Condition newCondition(String cf, String cq, String val) {
+    return newCondition(cf, cq).setValue(s2bb(val));
+  }
+  
+  private Condition newCondition(String cf, String cq, long ts, String val) {
+    return newCondition(cf, cq).setValue(s2bb(val)).setTimestamp(ts);
+  }
+
+  private ColumnUpdate newColUpdate(String cf, String cq, String val) {
+    return new ColumnUpdate(s2bb(cf), s2bb(cq)).setValue(s2bb(val));
+  }
+  
+  private ColumnUpdate newColUpdate(String cf, String cq, long ts, String val) 
{
+    return new ColumnUpdate(s2bb(cf), 
s2bb(cq)).setTimestamp(ts).setValue(s2bb(val));
+  }
+
+  private void assertScan(String[][] expected, String table) throws Exception {
+    String scid = client.createScanner(creds, TABLE_TEST, new ScanOptions());
+    ScanResult keyValues = client.nextK(scid, expected.length + 1);
+    
+    assertEquals(expected.length, keyValues.results.size());
+    assertFalse(keyValues.more);
+    
+    for (int i = 0; i < keyValues.results.size(); i++) {
+      checkKey(expected[i][0], expected[i][1], expected[i][2], expected[i][3], 
keyValues.results.get(i));
+    }
+    
+    client.closeScanner(scid);
+  }
+
+  @Test
+  public void testConditionalWriter() throws Exception {
+    if (client.tableExists(creds, TABLE_TEST))
+      client.deleteTable(creds, TABLE_TEST);
+    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+    
+    client.addConstraint(creds, TABLE_TEST, 
NumericValueConstraint.class.getName());
+
+    String cwid = client.createConditionalWriter(creds, TABLE_TEST, new 
ConditionalWriterOptions());
+    
+    Map<ByteBuffer,ConditionalUpdates> updates = new 
HashMap<ByteBuffer,ConditionalUpdates>();
+    
+    updates.put(
+        s2bb("00345"),
+        new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq")), 
Arrays.asList(newColUpdate("meta", "seq", 10, "1"),
+            newColUpdate("data", "img", "73435435"))));
+    
+    Map<ByteBuffer,ConditionalStatus> results = 
client.updateRowsConditionally(cwid, updates);
+    
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00345")));
+    
+    assertScan(new String[][] { {"00345", "data", "img", "73435435"}, 
{"00345", "meta", "seq", "1"}}, TABLE_TEST);
+    
+    // test not setting values on conditions
+    updates.clear();
+    
+    updates.put(s2bb("00345"), new 
ConditionalUpdates(Arrays.asList(newCondition("meta", "seq")), 
Arrays.asList(newColUpdate("meta", "seq", "2"))));
+    updates.put(s2bb("00346"), new 
ConditionalUpdates(Arrays.asList(newCondition("meta", "seq")), 
Arrays.asList(newColUpdate("meta", "seq", "1"))));
+    
+    results = client.updateRowsConditionally(cwid, updates);
+    
+    assertEquals(2, results.size());
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00345")));
+    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00346")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "73435435"}, 
{"00345", "meta", "seq", "1"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
+    
+    // test setting values on conditions
+    updates.clear();
+
+    updates.put(
+        s2bb("00345"),
+        new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", 
"1")), Arrays.asList(newColUpdate("meta", "seq", 20, "2"),
+            newColUpdate("data", "img", "567890"))));
+    
+    updates.put(s2bb("00346"), new 
ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", "2")), 
Arrays.asList(newColUpdate("meta", "seq", "3"))));
+    
+    results = client.updateRowsConditionally(cwid, updates);
+    
+    assertEquals(2, results.size());
+    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00345")));
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00346")));
+    
+    assertScan(new String[][] { {"00345", "data", "img", "567890"}, {"00345", 
"meta", "seq", "2"},
+        {"00346", "meta", "seq", "1"}}, TABLE_TEST);
+    
+    // test setting timestamp on condition to a non-existant version
+    updates.clear();
+    
+    updates.put(
+        s2bb("00345"),
+        new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", 10, 
"2")), Arrays.asList(newColUpdate("meta", "seq", 30, "3"),
+            newColUpdate("data", "img", "1234567890"))));
+    
+    results = client.updateRowsConditionally(cwid, updates);
+    
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00345")));
+    
+    assertScan(new String[][] { {"00345", "data", "img", "567890"}, {"00345", 
"meta", "seq", "2"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
+    
+
+    // test setting timestamp to an existing version
+    
+    updates.clear();
+    
+    updates.put(
+        s2bb("00345"),
+        new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", 20, 
"2")), Arrays.asList(newColUpdate("meta", "seq", 30, "3"),
+            newColUpdate("data", "img", "1234567890"))));
+    
+    
+    results = client.updateRowsConditionally(cwid, updates);
+    
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00345")));
+    
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, 
{"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
+    
+    // run test w/ condition that has iterators
+    // following should fail w/o iterator
+    client.updateAndFlush(creds, TABLE_TEST, 
Collections.singletonMap(s2bb("00347"), Arrays.asList(newColUpdate("data", 
"count", "1"))));
+    client.updateAndFlush(creds, TABLE_TEST, 
Collections.singletonMap(s2bb("00347"), Arrays.asList(newColUpdate("data", 
"count", "1"))));
+    client.updateAndFlush(creds, TABLE_TEST, 
Collections.singletonMap(s2bb("00347"), Arrays.asList(newColUpdate("data", 
"count", "1"))));
+    
+    updates.clear();
+    updates.put(s2bb("00347"),
+        new ConditionalUpdates(Arrays.asList(newCondition("data", "count", 
"3")), Arrays.asList(newColUpdate("data", "img", "1234567890"))));
+    
+    results = client.updateRowsConditionally(cwid, updates);
+    
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
+    
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, 
{"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "1"}}, TABLE_TEST);
+
+    // following test w/ iterator setup should succeed
+    Condition iterCond = newCondition("data", "count", "3");
+    Map<String,String> props = new HashMap<String,String>();
+    props.put("type", "STRING");
+    props.put("columns", "data:count");
+    IteratorSetting is = new IteratorSetting(1, "sumc", 
SummingCombiner.class.getName(), props);
+    iterCond.setIterators(Arrays.asList(is));
+    
+    updates.clear();
+    updates.put(s2bb("00347"), new ConditionalUpdates(Arrays.asList(iterCond), 
Arrays.asList(newColUpdate("data", "img", "1234567890"))));
+    
+    results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00347")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, 
{"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "1"}, {"00347", "data", "img", 
"1234567890"}}, TABLE_TEST);
+
+    // test a mutation that violated a constraint
+    updates.clear();
+    updates.put(s2bb("00347"),
+        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", 
"1234567890")), Arrays.asList(newColUpdate("data", "count", "A"))));
+    
+    results = client.updateRowsConditionally(cwid, updates);
+    
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.VIOLATED, results.get(s2bb("00347")));
+    
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, 
{"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "1"}, {"00347", "data", "img", 
"1234567890"}}, TABLE_TEST);
+
+    // run test with two conditions
+    // both conditions should fail
+    updates.clear();
+    updates.put(
+        s2bb("00347"),
+        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", 
"565"), newCondition("data", "count", "2")), Arrays.asList(
+            newColUpdate("data", "count", "3"), newColUpdate("data", "img", 
"0987654321"))));
+    
+    results = client.updateRowsConditionally(cwid, updates);
+    
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
+    
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, 
{"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "1"}, {"00347", "data", "img", 
"1234567890"}}, TABLE_TEST);
+    
+    // one condition should fail
+    updates.clear();
+    updates.put(
+        s2bb("00347"),
+        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", 
"1234567890"), newCondition("data", "count", "2")), Arrays.asList(
+            newColUpdate("data", "count", "3"), newColUpdate("data", "img", 
"0987654321"))));
+    
+    results = client.updateRowsConditionally(cwid, updates);
+    
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
+    
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, 
{"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "1"}, {"00347", "data", "img", 
"1234567890"}}, TABLE_TEST);
+    
+    // one condition should fail
+    updates.clear();
+    updates.put(
+        s2bb("00347"),
+        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", 
"565"), newCondition("data", "count", "1")), Arrays.asList(
+            newColUpdate("data", "count", "3"), newColUpdate("data", "img", 
"0987654321"))));
+    
+    results = client.updateRowsConditionally(cwid, updates);
+    
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
+    
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, 
{"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "1"}, {"00347", "data", "img", 
"1234567890"}}, TABLE_TEST);
+    
+    // both conditions should succeed
+    
+    ConditionalStatus result = client.updateRowConditionally(
+        creds,
+        TABLE_TEST,
+        s2bb("00347"),
+        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", 
"1234567890"), newCondition("data", "count", "1")), Arrays.asList(
+            newColUpdate("data", "count", "3"), newColUpdate("data", "img", 
"0987654321"))));
+    
+    assertEquals(ConditionalStatus.ACCEPTED, result);
+    
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, 
{"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "3"}, {"00347", "data", "img", 
"0987654321"}}, TABLE_TEST);
+
+    client.closeConditionalWriter(cwid);
+    try {
+      client.updateRowsConditionally(cwid, updates);
+      fail("conditional writer not closed");
+    } catch (UnknownWriter uk) {}
+
+    // run test with colvis
+    client.createLocalUser(creds, "cwuser", s2bb("bestpasswordever"));
+    client.changeUserAuthorizations(creds, "cwuser", 
Collections.singleton(s2bb("A")));
+    client.grantTablePermission(creds, "cwuser", TABLE_TEST, 
TablePermission.WRITE);
+    client.grantTablePermission(creds, "cwuser", TABLE_TEST, 
TablePermission.READ);
+    
+    ByteBuffer cwuCreds = client.login("cwuser", 
Collections.singletonMap("password", "bestpasswordever"));
+    
+    cwid = client.createConditionalWriter(cwuCreds, TABLE_TEST, new 
ConditionalWriterOptions().setAuthorizations(Collections.singleton(s2bb("A"))));
+    
+    updates.clear();
+    updates.put(s2bb("00348"),
+        new ConditionalUpdates(Arrays.asList(new Condition(new 
Column(s2bb("data"), s2bb("c"), s2bb("A")))), 
Arrays.asList(newColUpdate("data", "seq", "1"),
+            newColUpdate("data", "c", "1").setColVisibility(s2bb("A")))));
+    updates.put(s2bb("00349"),
+        new ConditionalUpdates(Arrays.asList(new Condition(new 
Column(s2bb("data"), s2bb("c"), s2bb("B")))), 
Arrays.asList(newColUpdate("data", "seq", "1"))));
+    
+    results = client.updateRowsConditionally(cwid, updates);
+    
+    assertEquals(2, results.size());
+    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00348")));
+    assertEquals(ConditionalStatus.INVISIBLE_VISIBILITY, 
results.get(s2bb("00349")));
+    
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, 
{"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "3"}, {"00347", "data", "img", 
"0987654321"}, {"00348", "data", "seq", "1"}}, TABLE_TEST);
+
+    updates.clear();
+    
+    updates.clear();
+    updates.put(
+        s2bb("00348"),
+        new ConditionalUpdates(Arrays.asList(new Condition(new 
Column(s2bb("data"), s2bb("c"), s2bb("A"))).setValue(s2bb("0"))), Arrays.asList(
+            newColUpdate("data", "seq", "2"), newColUpdate("data", "c", 
"2").setColVisibility(s2bb("A")))));
+    
+    results = client.updateRowsConditionally(cwid, updates);
+    
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00348")));
+    
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, 
{"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "3"}, {"00347", "data", "img", 
"0987654321"}, {"00348", "data", "seq", "1"}}, TABLE_TEST);
+    
+    updates.clear();
+    updates.put(
+        s2bb("00348"),
+        new ConditionalUpdates(Arrays.asList(new Condition(new 
Column(s2bb("data"), s2bb("c"), s2bb("A"))).setValue(s2bb("1"))), Arrays.asList(
+            newColUpdate("data", "seq", "2"), newColUpdate("data", "c", 
"2").setColVisibility(s2bb("A")))));
+
+    results = client.updateRowsConditionally(cwid, updates);
+    
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00348")));
+    
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, 
{"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "3"}, {"00347", "data", "img", 
"0987654321"}, {"00348", "data", "seq", "2"}}, TABLE_TEST);
+
+    client.closeConditionalWriter(cwid);
+    try {
+      client.updateRowsConditionally(cwid, updates);
+      fail("conditional writer not closed");
+    } catch (UnknownWriter uk) {}
+
+    client.dropLocalUser(creds, "cwuser");
+
+  }
+
+  private void checkKey(String row, String cf, String cq, String val, KeyValue 
keyValue) {
+    assertEquals(row, ByteBufferUtil.toString(keyValue.key.row));
+    assertEquals(cf, ByteBufferUtil.toString(keyValue.key.colFamily));
+    assertEquals(cq, ByteBufferUtil.toString(keyValue.key.colQualifier));
+    assertEquals("", ByteBufferUtil.toString(keyValue.key.colVisibility));
+    assertEquals(val, ByteBufferUtil.toString(keyValue.value));
+  }
+
   // scan !METADATA table for file entries for the given table
   private int countFiles(String table) throws Exception {
     Map<String,String> tableIdMap = client.tableIdMap(creds);

Reply via email to