@Override public void read(org.apache.thrift.protocol.TProtocol prot, TRowMutations struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; struct.row = iprot.readBinary(); struct.setRowIsSet(true); { org.apache.thrift.protocol.TList _list139 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.mutations = new java.util.ArrayList<TMutation>(_list139.size); @org.apache.thrift.annotation.Nullable TMutation _elem140; for (int _i141 = 0; _i141 < _list139.size; ++_i141) { _elem140 = new TMutation(); _elem140.read(iprot); struct.mutations.add(_elem140); } } struct.setMutationsIsSet(true); } }
public boolean equals(java.lang.Object other) { if (other instanceof TMutation) { return equals((TMutation)other); } else { return false; } }
public TDelete getDeleteSingle() { if (getSetField() == _Fields.DELETE_SINGLE) { return (TDelete)getFieldValue(); } else { throw new java.lang.RuntimeException("Cannot get field 'deleteSingle' because union is currently set to " + getFieldDesc(getSetField()).name); } }
public static TMutation deleteSingle(TDelete value) { TMutation x = new TMutation(); x.setDeleteSingle(value); return x; }
@Override public int compareTo(TMutation other) { int lastComparison = org.apache.thrift.TBaseHelper.compareTo(getSetField(), other.getSetField()); if (lastComparison == 0) { return org.apache.thrift.TBaseHelper.compareTo(getFieldValue(), other.getFieldValue()); } return lastComparison; }
public static TRowMutations rowMutationsFromHBase(RowMutations in) { TRowMutations tRowMutations = new TRowMutations(); tRowMutations.setRow(in.getRow()); for (Mutation mutation : in.getMutations()) { TMutation tMutation = new TMutation(); if (mutation instanceof Put) { tMutation.setPut(ThriftUtilities.putFromHBase((Put)mutation)); } else if (mutation instanceof Delete) { tMutation.setDeleteSingle(ThriftUtilities.deleteFromHBase((Delete)mutation)); } else { throw new IllegalArgumentException( "Only Put and Delete is supported in mutateRow, but muation=" + mutation); } tRowMutations.addToMutations(tMutation); } return tRowMutations; }
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); } }
public TMutation deepCopy() { return new TMutation(this); }
@Test public void testMutateRowWithReadOnly() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); byte[] rowName = Bytes.toBytes("testMutateRow"); ByteBuffer table = wrap(tableAname); List<TColumnValue> columnValuesA = new ArrayList<>(1); TColumnValue columnValueA = new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)); columnValuesA.add(columnValueA); TPut putA = new TPut(wrap(rowName), columnValuesA); putA.setColumnValues(columnValuesA); TDelete delete = new TDelete(wrap(rowName)); List<TMutation> mutations = new ArrayList<>(2); TMutation mutationA = TMutation.put(putA); mutations.add(mutationA); TMutation mutationB = TMutation.deleteSingle(delete); mutations.add(mutationB); TRowMutations tRowMutations = new TRowMutations(wrap(rowName),mutations); boolean exceptionCaught = false; try { handler.mutateRow(table,tRowMutations); } catch (TIOError e) { exceptionCaught = true; assertTrue(e.getCause() instanceof DoNotRetryIOException); assertEquals("Thrift Server is in Read-only mode.", e.getMessage()); } finally { assertTrue(exceptionCaught); } }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }
public boolean equals(TMutation other) { return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue()); }
public static TMutation deleteSingle(TDelete value) { TMutation x = new TMutation(); x.setDeleteSingle(value); return x; }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TRowMutations struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; oprot.writeBinary(struct.row); { oprot.writeI32(struct.mutations.size()); for (TMutation _iter138 : struct.mutations) { _iter138.write(oprot); } } }
/** * Performs a deep copy on <i>other</i>. */ public TRowMutations(TRowMutations other) { if (other.isSetRow()) { this.row = org.apache.thrift.TBaseHelper.copyBinary(other.row); } if (other.isSetMutations()) { java.util.List<TMutation> __this__mutations = new java.util.ArrayList<TMutation>(other.mutations.size()); for (TMutation other_element : other.mutations) { __this__mutations.add(new TMutation(other_element)); } this.mutations = __this__mutations; } }
TMutation mutationA = TMutation.put(putB); mutations.add(mutationA); TMutation mutationB = TMutation.deleteSingle(delete); mutations.add(mutationB);
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }
public TPut getPut() { if (getSetField() == _Fields.PUT) { return (TPut)getFieldValue(); } else { throw new java.lang.RuntimeException("Cannot get field 'put' because union is currently set to " + getFieldDesc(getSetField()).name); } }
@Override public int hashCode() { java.util.List<java.lang.Object> list = new java.util.ArrayList<java.lang.Object>(); list.add(this.getClass().getName()); org.apache.thrift.TFieldIdEnum setField = getSetField(); if (setField != null) { list.add(setField.getThriftFieldId()); java.lang.Object value = getFieldValue(); if (value instanceof org.apache.thrift.TEnum) { list.add(((org.apache.thrift.TEnum)getFieldValue()).getValue()); } else { list.add(value); } } return list.hashCode(); } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {