HBASE-9884 - Add Thrift and REST support for Visibility Labels (Ram)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1546988 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
93bf3fe0a5
commit
5f15ae4ade
|
@ -21,7 +21,9 @@ package org.apache.hadoop.hbase.rest;
|
|||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
|
@ -43,6 +45,7 @@ public class RowSpec {
|
|||
private byte[] endRow = null;
|
||||
private TreeSet<byte[]> columns =
|
||||
new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR);
|
||||
private List<String> labels = new ArrayList<String>();
|
||||
private long startTime = DEFAULT_START_TIMESTAMP;
|
||||
private long endTime = DEFAULT_END_TIMESTAMP;
|
||||
private int maxVersions = 1;
|
||||
|
@ -276,6 +279,13 @@ public class RowSpec {
|
|||
this.maxVersions = maxVersions;
|
||||
}
|
||||
|
||||
public RowSpec(byte[] startRow, byte[] endRow, Collection<byte[]> columns,
|
||||
long startTime, long endTime, int maxVersions, Collection<String> labels) {
|
||||
this(startRow, endRow, columns, startTime, endTime, maxVersions);
|
||||
if(labels != null) {
|
||||
this.labels.addAll(labels);
|
||||
}
|
||||
}
|
||||
public RowSpec(byte[] startRow, byte[] endRow, Collection<byte[]> columns,
|
||||
long startTime, long endTime, int maxVersions) {
|
||||
this.row = startRow;
|
||||
|
@ -311,6 +321,10 @@ public class RowSpec {
|
|||
public boolean hasColumns() {
|
||||
return !columns.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasLabels() {
|
||||
return !labels.isEmpty();
|
||||
}
|
||||
|
||||
public byte[] getRow() {
|
||||
return row;
|
||||
|
@ -335,6 +349,10 @@ public class RowSpec {
|
|||
public byte[][] getColumns() {
|
||||
return columns.toArray(new byte[columns.size()][]);
|
||||
}
|
||||
|
||||
public List<String> getLabels() {
|
||||
return labels;
|
||||
}
|
||||
|
||||
public boolean hasTimestamp() {
|
||||
return (startTime == 0) && (endTime != Long.MAX_VALUE);
|
||||
|
|
|
@ -82,9 +82,14 @@ public class ScannerResource extends ResourceBase {
|
|||
.build();
|
||||
}
|
||||
byte[] endRow = model.hasEndRow() ? model.getEndRow() : null;
|
||||
RowSpec spec = new RowSpec(model.getStartRow(), endRow,
|
||||
model.getColumns(), model.getStartTime(), model.getEndTime(),
|
||||
model.getMaxVersions());
|
||||
RowSpec spec = null;
|
||||
if (model.getLabels() != null) {
|
||||
spec = new RowSpec(model.getStartRow(), endRow, model.getColumns(), model.getStartTime(),
|
||||
model.getEndTime(), model.getMaxVersions(), model.getLabels());
|
||||
} else {
|
||||
spec = new RowSpec(model.getStartRow(), endRow, model.getColumns(), model.getStartTime(),
|
||||
model.getEndTime(), model.getMaxVersions());
|
||||
}
|
||||
try {
|
||||
Filter filter = ScannerResultGenerator.buildFilterFromModel(model);
|
||||
String tableName = tableResource.getName();
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.apache.hadoop.hbase.client.ResultScanner;
|
|||
import org.apache.hadoop.hbase.client.Scan;
|
||||
import org.apache.hadoop.hbase.filter.Filter;
|
||||
import org.apache.hadoop.hbase.rest.model.ScannerModel;
|
||||
import org.apache.hadoop.hbase.security.visibility.Authorizations;
|
||||
import org.apache.hadoop.util.StringUtils;
|
||||
|
||||
@InterfaceAudience.Private
|
||||
|
@ -95,6 +96,9 @@ public class ScannerResultGenerator extends ResultGenerator {
|
|||
if (caching > 0 ) {
|
||||
scan.setCaching(caching);
|
||||
}
|
||||
if(rowspec.hasLabels()) {
|
||||
scan.setAuthorizations(new Authorizations(rowspec.getLabels()));
|
||||
}
|
||||
scanner = table.getScanner(scan);
|
||||
cached = null;
|
||||
id = Long.toString(System.currentTimeMillis()) +
|
||||
|
|
|
@ -35,10 +35,41 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.client.Scan;
|
||||
import org.apache.hadoop.hbase.filter.*;
|
||||
import org.apache.hadoop.hbase.filter.BinaryComparator;
|
||||
import org.apache.hadoop.hbase.filter.BinaryPrefixComparator;
|
||||
import org.apache.hadoop.hbase.filter.BitComparator;
|
||||
import org.apache.hadoop.hbase.filter.ByteArrayComparable;
|
||||
import org.apache.hadoop.hbase.filter.ColumnCountGetFilter;
|
||||
import org.apache.hadoop.hbase.filter.ColumnPaginationFilter;
|
||||
import org.apache.hadoop.hbase.filter.ColumnPrefixFilter;
|
||||
import org.apache.hadoop.hbase.filter.ColumnRangeFilter;
|
||||
import org.apache.hadoop.hbase.filter.CompareFilter;
|
||||
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
||||
import org.apache.hadoop.hbase.filter.DependentColumnFilter;
|
||||
import org.apache.hadoop.hbase.filter.FamilyFilter;
|
||||
import org.apache.hadoop.hbase.filter.Filter;
|
||||
import org.apache.hadoop.hbase.filter.FilterList;
|
||||
import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter;
|
||||
import org.apache.hadoop.hbase.filter.InclusiveStopFilter;
|
||||
import org.apache.hadoop.hbase.filter.KeyOnlyFilter;
|
||||
import org.apache.hadoop.hbase.filter.MultipleColumnPrefixFilter;
|
||||
import org.apache.hadoop.hbase.filter.NullComparator;
|
||||
import org.apache.hadoop.hbase.filter.PageFilter;
|
||||
import org.apache.hadoop.hbase.filter.PrefixFilter;
|
||||
import org.apache.hadoop.hbase.filter.QualifierFilter;
|
||||
import org.apache.hadoop.hbase.filter.RandomRowFilter;
|
||||
import org.apache.hadoop.hbase.filter.RegexStringComparator;
|
||||
import org.apache.hadoop.hbase.filter.RowFilter;
|
||||
import org.apache.hadoop.hbase.filter.SingleColumnValueExcludeFilter;
|
||||
import org.apache.hadoop.hbase.filter.SingleColumnValueFilter;
|
||||
import org.apache.hadoop.hbase.filter.SkipFilter;
|
||||
import org.apache.hadoop.hbase.filter.SubstringComparator;
|
||||
import org.apache.hadoop.hbase.filter.TimestampsFilter;
|
||||
import org.apache.hadoop.hbase.filter.ValueFilter;
|
||||
import org.apache.hadoop.hbase.filter.WhileMatchFilter;
|
||||
import org.apache.hadoop.hbase.rest.ProtobufMessageHandler;
|
||||
import org.apache.hadoop.hbase.rest.protobuf.generated.ScannerMessage.Scanner;
|
||||
import org.apache.hadoop.hbase.security.visibility.Authorizations;
|
||||
import org.apache.hadoop.hbase.util.Base64;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
|
||||
|
@ -83,7 +114,8 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
|
|||
private String filter = null;
|
||||
private int maxVersions = Integer.MAX_VALUE;
|
||||
private int caching = -1;
|
||||
|
||||
private List<String> labels = new ArrayList<String>();
|
||||
|
||||
@XmlRootElement
|
||||
static class FilterModel {
|
||||
|
||||
|
@ -488,6 +520,14 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
|
|||
if (filter != null) {
|
||||
model.setFilter(stringifyFilter(filter));
|
||||
}
|
||||
// Add the visbility labels if found in the attributes
|
||||
Authorizations authorizations = scan.getAuthorizations();
|
||||
if (authorizations != null) {
|
||||
List<String> labels = authorizations.getLabels();
|
||||
for (String label : labels) {
|
||||
model.addLabel(label);
|
||||
}
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
|
@ -554,7 +594,13 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
|
|||
public void addColumn(byte[] column) {
|
||||
columns.add(column);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a visibility label to the scan
|
||||
*/
|
||||
public void addLabel(String label) {
|
||||
labels.add(label);
|
||||
}
|
||||
/**
|
||||
* @return true if a start row was specified
|
||||
*/
|
||||
|
@ -592,6 +638,11 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
|
|||
public List<byte[]> getColumns() {
|
||||
return columns;
|
||||
}
|
||||
|
||||
@XmlElement(name="label")
|
||||
public List<String> getLabels() {
|
||||
return labels;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the number of cells to return in batch
|
||||
|
@ -730,6 +781,10 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
|
|||
if (filter != null) {
|
||||
builder.setFilter(filter);
|
||||
}
|
||||
if (labels != null && labels.size() > 0) {
|
||||
for (String label : labels)
|
||||
builder.addLabels(label);
|
||||
}
|
||||
return builder.build().toByteArray();
|
||||
}
|
||||
|
||||
|
@ -765,6 +820,12 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
|
|||
if (builder.hasFilter()) {
|
||||
filter = builder.getFilter();
|
||||
}
|
||||
if(builder.getLabelsList() != null) {
|
||||
List<String> labels = builder.getLabelsList();
|
||||
for(String label : labels) {
|
||||
addLabel(label);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,26 @@ public final class ScannerMessage {
|
|||
* <code>optional int32 caching = 9;</code>
|
||||
*/
|
||||
int getCaching();
|
||||
|
||||
// repeated string labels = 10;
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
java.util.List<java.lang.String>
|
||||
getLabelsList();
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
int getLabelsCount();
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
java.lang.String getLabels(int index);
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
com.google.protobuf.ByteString
|
||||
getLabelsBytes(int index);
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code org.apache.hadoop.hbase.rest.protobuf.generated.Scanner}
|
||||
|
@ -209,6 +229,14 @@ public final class ScannerMessage {
|
|||
caching_ = input.readInt32();
|
||||
break;
|
||||
}
|
||||
case 82: {
|
||||
if (!((mutable_bitField0_ & 0x00000200) == 0x00000200)) {
|
||||
labels_ = new com.google.protobuf.LazyStringArrayList();
|
||||
mutable_bitField0_ |= 0x00000200;
|
||||
}
|
||||
labels_.add(input.readBytes());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
|
@ -220,6 +248,9 @@ public final class ScannerMessage {
|
|||
if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
columns_ = java.util.Collections.unmodifiableList(columns_);
|
||||
}
|
||||
if (((mutable_bitField0_ & 0x00000200) == 0x00000200)) {
|
||||
labels_ = new com.google.protobuf.UnmodifiableLazyStringList(labels_);
|
||||
}
|
||||
this.unknownFields = unknownFields.build();
|
||||
makeExtensionsImmutable();
|
||||
}
|
||||
|
@ -430,6 +461,36 @@ public final class ScannerMessage {
|
|||
return caching_;
|
||||
}
|
||||
|
||||
// repeated string labels = 10;
|
||||
public static final int LABELS_FIELD_NUMBER = 10;
|
||||
private com.google.protobuf.LazyStringList labels_;
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
public java.util.List<java.lang.String>
|
||||
getLabelsList() {
|
||||
return labels_;
|
||||
}
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
public int getLabelsCount() {
|
||||
return labels_.size();
|
||||
}
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
public java.lang.String getLabels(int index) {
|
||||
return labels_.get(index);
|
||||
}
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
public com.google.protobuf.ByteString
|
||||
getLabelsBytes(int index) {
|
||||
return labels_.getByteString(index);
|
||||
}
|
||||
|
||||
private void initFields() {
|
||||
startRow_ = com.google.protobuf.ByteString.EMPTY;
|
||||
endRow_ = com.google.protobuf.ByteString.EMPTY;
|
||||
|
@ -440,6 +501,7 @@ public final class ScannerMessage {
|
|||
maxVersions_ = 0;
|
||||
filter_ = "";
|
||||
caching_ = 0;
|
||||
labels_ = com.google.protobuf.LazyStringArrayList.EMPTY;
|
||||
}
|
||||
private byte memoizedIsInitialized = -1;
|
||||
public final boolean isInitialized() {
|
||||
|
@ -480,6 +542,9 @@ public final class ScannerMessage {
|
|||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
output.writeInt32(9, caching_);
|
||||
}
|
||||
for (int i = 0; i < labels_.size(); i++) {
|
||||
output.writeBytes(10, labels_.getByteString(i));
|
||||
}
|
||||
getUnknownFields().writeTo(output);
|
||||
}
|
||||
|
||||
|
@ -530,6 +595,15 @@ public final class ScannerMessage {
|
|||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeInt32Size(9, caching_);
|
||||
}
|
||||
{
|
||||
int dataSize = 0;
|
||||
for (int i = 0; i < labels_.size(); i++) {
|
||||
dataSize += com.google.protobuf.CodedOutputStream
|
||||
.computeBytesSizeNoTag(labels_.getByteString(i));
|
||||
}
|
||||
size += dataSize;
|
||||
size += 1 * getLabelsList().size();
|
||||
}
|
||||
size += getUnknownFields().getSerializedSize();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
|
@ -664,6 +738,8 @@ public final class ScannerMessage {
|
|||
bitField0_ = (bitField0_ & ~0x00000080);
|
||||
caching_ = 0;
|
||||
bitField0_ = (bitField0_ & ~0x00000100);
|
||||
labels_ = com.google.protobuf.LazyStringArrayList.EMPTY;
|
||||
bitField0_ = (bitField0_ & ~0x00000200);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -729,6 +805,12 @@ public final class ScannerMessage {
|
|||
to_bitField0_ |= 0x00000080;
|
||||
}
|
||||
result.caching_ = caching_;
|
||||
if (((bitField0_ & 0x00000200) == 0x00000200)) {
|
||||
labels_ = new com.google.protobuf.UnmodifiableLazyStringList(
|
||||
labels_);
|
||||
bitField0_ = (bitField0_ & ~0x00000200);
|
||||
}
|
||||
result.labels_ = labels_;
|
||||
result.bitField0_ = to_bitField0_;
|
||||
onBuilt();
|
||||
return result;
|
||||
|
@ -781,6 +863,16 @@ public final class ScannerMessage {
|
|||
if (other.hasCaching()) {
|
||||
setCaching(other.getCaching());
|
||||
}
|
||||
if (!other.labels_.isEmpty()) {
|
||||
if (labels_.isEmpty()) {
|
||||
labels_ = other.labels_;
|
||||
bitField0_ = (bitField0_ & ~0x00000200);
|
||||
} else {
|
||||
ensureLabelsIsMutable();
|
||||
labels_.addAll(other.labels_);
|
||||
}
|
||||
onChanged();
|
||||
}
|
||||
this.mergeUnknownFields(other.getUnknownFields());
|
||||
return this;
|
||||
}
|
||||
|
@ -1191,6 +1283,99 @@ public final class ScannerMessage {
|
|||
return this;
|
||||
}
|
||||
|
||||
// repeated string labels = 10;
|
||||
private com.google.protobuf.LazyStringList labels_ = com.google.protobuf.LazyStringArrayList.EMPTY;
|
||||
private void ensureLabelsIsMutable() {
|
||||
if (!((bitField0_ & 0x00000200) == 0x00000200)) {
|
||||
labels_ = new com.google.protobuf.LazyStringArrayList(labels_);
|
||||
bitField0_ |= 0x00000200;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
public java.util.List<java.lang.String>
|
||||
getLabelsList() {
|
||||
return java.util.Collections.unmodifiableList(labels_);
|
||||
}
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
public int getLabelsCount() {
|
||||
return labels_.size();
|
||||
}
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
public java.lang.String getLabels(int index) {
|
||||
return labels_.get(index);
|
||||
}
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
public com.google.protobuf.ByteString
|
||||
getLabelsBytes(int index) {
|
||||
return labels_.getByteString(index);
|
||||
}
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
public Builder setLabels(
|
||||
int index, java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
ensureLabelsIsMutable();
|
||||
labels_.set(index, value);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
public Builder addLabels(
|
||||
java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
ensureLabelsIsMutable();
|
||||
labels_.add(value);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
public Builder addAllLabels(
|
||||
java.lang.Iterable<java.lang.String> values) {
|
||||
ensureLabelsIsMutable();
|
||||
super.addAll(values, labels_);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
public Builder clearLabels() {
|
||||
labels_ = com.google.protobuf.LazyStringArrayList.EMPTY;
|
||||
bitField0_ = (bitField0_ & ~0x00000200);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated string labels = 10;</code>
|
||||
*/
|
||||
public Builder addLabelsBytes(
|
||||
com.google.protobuf.ByteString value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
ensureLabelsIsMutable();
|
||||
labels_.add(value);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:org.apache.hadoop.hbase.rest.protobuf.generated.Scanner)
|
||||
}
|
||||
|
||||
|
@ -1217,11 +1402,12 @@ public final class ScannerMessage {
|
|||
static {
|
||||
java.lang.String[] descriptorData = {
|
||||
"\n\024ScannerMessage.proto\022/org.apache.hadoo" +
|
||||
"p.hbase.rest.protobuf.generated\"\245\001\n\007Scan" +
|
||||
"p.hbase.rest.protobuf.generated\"\265\001\n\007Scan" +
|
||||
"ner\022\020\n\010startRow\030\001 \001(\014\022\016\n\006endRow\030\002 \001(\014\022\017\n" +
|
||||
"\007columns\030\003 \003(\014\022\r\n\005batch\030\004 \001(\005\022\021\n\tstartTi" +
|
||||
"me\030\005 \001(\003\022\017\n\007endTime\030\006 \001(\003\022\023\n\013maxVersions" +
|
||||
"\030\007 \001(\005\022\016\n\006filter\030\010 \001(\t\022\017\n\007caching\030\t \001(\005"
|
||||
"\030\007 \001(\005\022\016\n\006filter\030\010 \001(\t\022\017\n\007caching\030\t \001(\005\022" +
|
||||
"\016\n\006labels\030\n \003(\t"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||
|
@ -1233,7 +1419,7 @@ public final class ScannerMessage {
|
|||
internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Scanner_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Scanner_descriptor,
|
||||
new java.lang.String[] { "StartRow", "EndRow", "Columns", "Batch", "StartTime", "EndTime", "MaxVersions", "Filter", "Caching", });
|
||||
new java.lang.String[] { "StartRow", "EndRow", "Columns", "Batch", "StartTime", "EndTime", "MaxVersions", "Filter", "Caching", "Labels", });
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -27,4 +27,5 @@ message Scanner {
|
|||
optional int32 maxVersions = 7;
|
||||
optional string filter = 8;
|
||||
optional int32 caching = 9;
|
||||
repeated string labels = 10;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,237 @@
|
|||
/*
|
||||
* 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.
|
||||
*/package org.apache.hadoop.hbase.rest;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.KeyValue;
|
||||
import org.apache.hadoop.hbase.MediumTests;
|
||||
import org.apache.hadoop.hbase.TableName;
|
||||
import org.apache.hadoop.hbase.client.Durability;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.client.Put;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabelsResponse;
|
||||
import org.apache.hadoop.hbase.rest.client.Client;
|
||||
import org.apache.hadoop.hbase.rest.client.Cluster;
|
||||
import org.apache.hadoop.hbase.rest.client.Response;
|
||||
import org.apache.hadoop.hbase.rest.model.CellModel;
|
||||
import org.apache.hadoop.hbase.rest.model.CellSetModel;
|
||||
import org.apache.hadoop.hbase.rest.model.RowModel;
|
||||
import org.apache.hadoop.hbase.rest.model.ScannerModel;
|
||||
import org.apache.hadoop.hbase.security.User;
|
||||
import org.apache.hadoop.hbase.security.visibility.CellVisibility;
|
||||
import org.apache.hadoop.hbase.security.visibility.ScanLabelGenerator;
|
||||
import org.apache.hadoop.hbase.security.visibility.SimpleScanLabelGenerator;
|
||||
import org.apache.hadoop.hbase.security.visibility.VisibilityClient;
|
||||
import org.apache.hadoop.hbase.security.visibility.VisibilityConstants;
|
||||
import org.apache.hadoop.hbase.security.visibility.VisibilityController;
|
||||
import org.apache.hadoop.hbase.security.visibility.VisibilityUtils;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
@Category(MediumTests.class)
|
||||
public class TestScannersWithLabels {
|
||||
private static final String TABLE = "TestScannersWithLabels";
|
||||
private static final String CFA = "a";
|
||||
private static final String CFB = "b";
|
||||
private static final String COLUMN_1 = CFA + ":1";
|
||||
private static final String COLUMN_2 = CFB + ":2";
|
||||
private final static String TOPSECRET = "topsecret";
|
||||
private final static String PUBLIC = "public";
|
||||
private final static String PRIVATE = "private";
|
||||
private final static String CONFIDENTIAL = "confidential";
|
||||
private final static String SECRET = "secret";
|
||||
private static User SUPERUSER;
|
||||
|
||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||
private static final HBaseRESTTestingUtility REST_TEST_UTIL = new HBaseRESTTestingUtility();
|
||||
private static Client client;
|
||||
private static JAXBContext context;
|
||||
private static Marshaller marshaller;
|
||||
private static Unmarshaller unmarshaller;
|
||||
private static Configuration conf;
|
||||
|
||||
private static int insertData(String tableName, String column, double prob) throws IOException {
|
||||
Random rng = new Random();
|
||||
int count = 0;
|
||||
HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName);
|
||||
byte[] k = new byte[3];
|
||||
byte[][] famAndQf = KeyValue.parseColumn(Bytes.toBytes(column));
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
Put put = new Put(Bytes.toBytes("row" + i));
|
||||
put.setDurability(Durability.SKIP_WAL);
|
||||
put.add(famAndQf[0], famAndQf[1], k);
|
||||
put.setCellVisibility(new CellVisibility("(" + SECRET + "|" + CONFIDENTIAL + ")" + "&" + "!"
|
||||
+ TOPSECRET));
|
||||
table.put(put);
|
||||
count++;
|
||||
}
|
||||
table.flushCommits();
|
||||
return count;
|
||||
}
|
||||
|
||||
private static int countCellSet(CellSetModel model) {
|
||||
int count = 0;
|
||||
Iterator<RowModel> rows = model.getRows().iterator();
|
||||
while (rows.hasNext()) {
|
||||
RowModel row = rows.next();
|
||||
Iterator<CellModel> cells = row.getCells().iterator();
|
||||
while (cells.hasNext()) {
|
||||
cells.next();
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
SUPERUSER = User.createUserForTesting(conf, "admin",
|
||||
new String[] { "supergroup" });
|
||||
conf = TEST_UTIL.getConfiguration();
|
||||
conf.setClass(VisibilityUtils.VISIBILITY_LABEL_GENERATOR_CLASS,
|
||||
SimpleScanLabelGenerator.class, ScanLabelGenerator.class);
|
||||
conf.set("hbase.superuser", SUPERUSER.getShortName());
|
||||
conf.set("hbase.coprocessor.master.classes", VisibilityController.class.getName());
|
||||
conf.set("hbase.coprocessor.region.classes", VisibilityController.class.getName());
|
||||
TEST_UTIL.startMiniCluster(1);
|
||||
// Wait for the labels table to become available
|
||||
TEST_UTIL.waitTableEnabled(VisibilityConstants.LABELS_TABLE_NAME.getName(), 50000);
|
||||
createLabels();
|
||||
setAuths();
|
||||
REST_TEST_UTIL.startServletContainer(conf);
|
||||
client = new Client(new Cluster().add("localhost", REST_TEST_UTIL.getServletPort()));
|
||||
context = JAXBContext.newInstance(CellModel.class, CellSetModel.class, RowModel.class,
|
||||
ScannerModel.class);
|
||||
marshaller = context.createMarshaller();
|
||||
unmarshaller = context.createUnmarshaller();
|
||||
HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
|
||||
if (admin.tableExists(TABLE)) {
|
||||
return;
|
||||
}
|
||||
HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE));
|
||||
htd.addFamily(new HColumnDescriptor(CFA));
|
||||
htd.addFamily(new HColumnDescriptor(CFB));
|
||||
admin.createTable(htd);
|
||||
insertData(TABLE, COLUMN_1, 1.0);
|
||||
insertData(TABLE, COLUMN_2, 0.5);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownAfterClass() throws Exception {
|
||||
REST_TEST_UTIL.shutdownServletContainer();
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
private static void createLabels() throws IOException, InterruptedException {
|
||||
PrivilegedExceptionAction<VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
|
||||
public VisibilityLabelsResponse run() throws Exception {
|
||||
String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
|
||||
try {
|
||||
VisibilityClient.addLabels(conf, labels);
|
||||
} catch (Throwable t) {
|
||||
throw new IOException(t);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
SUPERUSER.runAs(action);
|
||||
}
|
||||
private static void setAuths() throws Exception {
|
||||
String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
|
||||
try {
|
||||
VisibilityClient.setAuths(conf, labels, User.getCurrent().getShortName());
|
||||
} catch (Throwable t) {
|
||||
throw new IOException(t);
|
||||
}
|
||||
}
|
||||
@Test
|
||||
public void testSimpleScannerXMLWithLabelsThatReceivesNoData() throws IOException, JAXBException {
|
||||
final int BATCH_SIZE = 5;
|
||||
// new scanner
|
||||
ScannerModel model = new ScannerModel();
|
||||
model.setBatch(BATCH_SIZE);
|
||||
model.addColumn(Bytes.toBytes(COLUMN_1));
|
||||
model.addLabel(PUBLIC);
|
||||
StringWriter writer = new StringWriter();
|
||||
marshaller.marshal(model, writer);
|
||||
byte[] body = Bytes.toBytes(writer.toString());
|
||||
// recall previous put operation with read-only off
|
||||
conf.set("hbase.rest.readonly", "false");
|
||||
Response response = client.put("/" + TABLE + "/scanner", Constants.MIMETYPE_XML, body);
|
||||
assertEquals(response.getCode(), 201);
|
||||
String scannerURI = response.getLocation();
|
||||
assertNotNull(scannerURI);
|
||||
|
||||
// get a cell set
|
||||
response = client.get(scannerURI, Constants.MIMETYPE_XML);
|
||||
// Respond with 204 as there are no cells to be retrieved
|
||||
assertEquals(response.getCode(), 204);
|
||||
assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleScannerXMLWithLabelsThatReceivesData() throws IOException, JAXBException {
|
||||
// new scanner
|
||||
ScannerModel model = new ScannerModel();
|
||||
model.setBatch(5);
|
||||
model.addColumn(Bytes.toBytes(COLUMN_1));
|
||||
model.addLabel(SECRET);
|
||||
StringWriter writer = new StringWriter();
|
||||
marshaller.marshal(model, writer);
|
||||
byte[] body = Bytes.toBytes(writer.toString());
|
||||
|
||||
// recall previous put operation with read-only off
|
||||
conf.set("hbase.rest.readonly", "false");
|
||||
Response response = client.put("/" + TABLE + "/scanner", Constants.MIMETYPE_XML, body);
|
||||
assertEquals(response.getCode(), 201);
|
||||
String scannerURI = response.getLocation();
|
||||
assertNotNull(scannerURI);
|
||||
|
||||
// get a cell set
|
||||
response = client.get(scannerURI, Constants.MIMETYPE_XML);
|
||||
// Respond with 204 as there are no cells to be retrieved
|
||||
assertEquals(response.getCode(), 200);
|
||||
assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
|
||||
CellSetModel cellSet = (CellSetModel) unmarshaller.unmarshal(new ByteArrayInputStream(response
|
||||
.getBody()));
|
||||
assertEquals(countCellSet(cellSet), 5);
|
||||
}
|
||||
|
||||
}
|
|
@ -19,22 +19,14 @@
|
|||
|
||||
package org.apache.hadoop.hbase.rest.model;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.hadoop.hbase.SmallTests;
|
||||
import org.apache.hadoop.hbase.util.Base64;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
@Category(SmallTests.class)
|
||||
public class TestScannerModel extends TestModelBase<ScannerModel> {
|
||||
private static final String PRIVATE = "private";
|
||||
private static final String PUBLIC = "public";
|
||||
private static final byte[] START_ROW = Bytes.toBytes("abracadabra");
|
||||
private static final byte[] END_ROW = Bytes.toBytes("zzyzx");
|
||||
private static final byte[] COLUMN1 = Bytes.toBytes("column1");
|
||||
|
@ -46,20 +38,20 @@ public class TestScannerModel extends TestModelBase<ScannerModel> {
|
|||
|
||||
public TestScannerModel() throws Exception {
|
||||
super(ScannerModel.class);
|
||||
AS_XML =
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
|
||||
"<Scanner batch=\"100\" caching=\"1000\" endRow=\"enp5eng=\" endTime=\"1245393318192\" " +
|
||||
"maxVersions=\"2147483647\" startRow=\"YWJyYWNhZGFicmE=\" startTime=\"1245219839331\">" +
|
||||
"<column>Y29sdW1uMQ==</column><column>Y29sdW1uMjpmb28=</column></Scanner>";
|
||||
AS_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
|
||||
+ "<Scanner batch=\"100\" caching=\"1000\" endRow=\"enp5eng=\" endTime=\"1245393318192\" "
|
||||
+ "maxVersions=\"2147483647\" startRow=\"YWJyYWNhZGFicmE=\" startTime=\"1245219839331\">"
|
||||
+ "<column>Y29sdW1uMQ==</column><column>Y29sdW1uMjpmb28=</column>"
|
||||
+ "<label>private</label><label>public</label></Scanner>";
|
||||
|
||||
AS_JSON =
|
||||
"{\"batch\":100,\"caching\":1000,\"endRow\":\"enp5eng=\",\"endTime\":1245393318192,"+
|
||||
"\"maxVersions\":2147483647,\"startRow\":\"YWJyYWNhZGFicmE=\",\"startTime\":1245219839331,"+
|
||||
"\"column\":[\"Y29sdW1uMQ==\",\"Y29sdW1uMjpmb28=\"]}";
|
||||
AS_JSON = "{\"batch\":100,\"caching\":1000,\"endRow\":\"enp5eng=\",\"endTime\":1245393318192,"
|
||||
+ "\"maxVersions\":2147483647,\"startRow\":\"YWJyYWNhZGFicmE=\",\"startTime\":1245219839331,"
|
||||
+ "\"column\":[\"Y29sdW1uMQ==\",\"Y29sdW1uMjpmb28=\"],"
|
||||
+"\"labels\":[\"private\",\"public\"]}";
|
||||
|
||||
AS_PB =
|
||||
"CgthYnJhY2FkYWJyYRIFenp5engaB2NvbHVtbjEaC2NvbHVtbjI6Zm9vIGQo47qL554kMLDi57mf" +
|
||||
"JDj/////B0joBw==";
|
||||
// TODO
|
||||
AS_PB = "CgthYnJhY2FkYWJyYRIFenp5engaB2NvbHVtbjEaC2NvbHVtbjI6Zm9vIGQo47qL554kMLDi57mf"
|
||||
+ "JDj/////B0joBw==";
|
||||
}
|
||||
|
||||
protected ScannerModel buildTestModel() {
|
||||
|
@ -72,6 +64,8 @@ public class TestScannerModel extends TestModelBase<ScannerModel> {
|
|||
model.setEndTime(END_TIME);
|
||||
model.setBatch(BATCH);
|
||||
model.setCaching(CACHING);
|
||||
model.addLabel(PRIVATE);
|
||||
model.addLabel(PUBLIC);
|
||||
return model;
|
||||
}
|
||||
|
||||
|
@ -79,7 +73,7 @@ public class TestScannerModel extends TestModelBase<ScannerModel> {
|
|||
assertTrue(Bytes.equals(model.getStartRow(), START_ROW));
|
||||
assertTrue(Bytes.equals(model.getEndRow(), END_ROW));
|
||||
boolean foundCol1 = false, foundCol2 = false;
|
||||
for (byte[] column: model.getColumns()) {
|
||||
for (byte[] column : model.getColumns()) {
|
||||
if (Bytes.equals(column, COLUMN1)) {
|
||||
foundCol1 = true;
|
||||
} else if (Bytes.equals(column, COLUMN2)) {
|
||||
|
@ -92,7 +86,19 @@ public class TestScannerModel extends TestModelBase<ScannerModel> {
|
|||
assertEquals(model.getEndTime(), END_TIME);
|
||||
assertEquals(model.getBatch(), BATCH);
|
||||
assertEquals(model.getCaching(), CACHING);
|
||||
boolean foundLabel1 = false;
|
||||
boolean foundLabel2 = false;
|
||||
if (model.getLabels() != null && model.getLabels().size() > 0) {
|
||||
for (String label : model.getLabels()) {
|
||||
if (label.equals(PRIVATE)) {
|
||||
foundLabel1 = true;
|
||||
} else if (label.equals(PUBLIC)) {
|
||||
foundLabel2 = true;
|
||||
}
|
||||
}
|
||||
assertTrue(foundLabel1);
|
||||
assertTrue(foundLabel2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ import org.apache.hadoop.hbase.client.Result;
|
|||
import org.apache.hadoop.hbase.client.RowMutations;
|
||||
import org.apache.hadoop.hbase.client.Scan;
|
||||
import org.apache.hadoop.hbase.filter.ParseFilter;
|
||||
import org.apache.hadoop.hbase.security.visibility.Authorizations;
|
||||
import org.apache.hadoop.hbase.security.visibility.CellVisibility;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TAppend;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TColumn;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TColumnIncrement;
|
||||
|
@ -101,6 +103,10 @@ public class ThriftUtilities {
|
|||
addAttributes(out,in.getAttributes());
|
||||
}
|
||||
|
||||
if (in.isSetAuthorizations()) {
|
||||
out.setAuthorizations(new Authorizations(in.getAuthorizations().getLabels()));
|
||||
}
|
||||
|
||||
if (!in.isSetColumns()) {
|
||||
return out;
|
||||
}
|
||||
|
@ -155,6 +161,9 @@ public class ThriftUtilities {
|
|||
col.setQualifier(CellUtil.cloneQualifier(kv));
|
||||
col.setTimestamp(kv.getTimestamp());
|
||||
col.setValue(CellUtil.cloneValue(kv));
|
||||
if (kv.getTagsLength() > 0) {
|
||||
col.setTags(CellUtil.getTagArray(kv));
|
||||
}
|
||||
columnValues.add(col);
|
||||
}
|
||||
out.setColumnValues(columnValues);
|
||||
|
@ -212,6 +221,10 @@ public class ThriftUtilities {
|
|||
if (in.isSetAttributes()) {
|
||||
addAttributes(out,in.getAttributes());
|
||||
}
|
||||
|
||||
if (in.getCellVisibility() != null) {
|
||||
out.setCellVisibility(new CellVisibility(in.getCellVisibility().getExpression()));
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
@ -403,6 +416,10 @@ public class ThriftUtilities {
|
|||
if (in.isSetAttributes()) {
|
||||
addAttributes(out,in.getAttributes());
|
||||
}
|
||||
|
||||
if (in.isSetAuthorizations()) {
|
||||
out.setAuthorizations(new Authorizations(in.getAuthorizations().getLabels()));
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
@ -420,6 +437,10 @@ public class ThriftUtilities {
|
|||
if (in.isSetDurability()) {
|
||||
out.setDurability(durabilityFromThrift(in.getDurability()));
|
||||
}
|
||||
|
||||
if(in.getCellVisibility() != null) {
|
||||
out.setCellVisibility(new CellVisibility(in.getCellVisibility().getExpression()));
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
@ -437,6 +458,10 @@ public class ThriftUtilities {
|
|||
if (append.isSetDurability()) {
|
||||
out.setDurability(durabilityFromThrift(append.getDurability()));
|
||||
}
|
||||
|
||||
if(append.getCellVisibility() != null) {
|
||||
out.setCellVisibility(new CellVisibility(append.getCellVisibility().getExpression()));
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)2);
|
||||
private static final org.apache.thrift.protocol.TField ATTRIBUTES_FIELD_DESC = new org.apache.thrift.protocol.TField("attributes", org.apache.thrift.protocol.TType.MAP, (short)3);
|
||||
private static final org.apache.thrift.protocol.TField DURABILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("durability", org.apache.thrift.protocol.TType.I32, (short)4);
|
||||
private static final org.apache.thrift.protocol.TField CELL_VISIBILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("cellVisibility", org.apache.thrift.protocol.TType.STRUCT, (short)5);
|
||||
|
||||
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
|
||||
static {
|
||||
|
@ -52,6 +53,7 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
* @see TDurability
|
||||
*/
|
||||
public TDurability durability; // optional
|
||||
public TCellVisibility cellVisibility; // optional
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
|
@ -62,7 +64,8 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
*
|
||||
* @see TDurability
|
||||
*/
|
||||
DURABILITY((short)4, "durability");
|
||||
DURABILITY((short)4, "durability"),
|
||||
CELL_VISIBILITY((short)5, "cellVisibility");
|
||||
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
|
@ -85,6 +88,8 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
return ATTRIBUTES;
|
||||
case 4: // DURABILITY
|
||||
return DURABILITY;
|
||||
case 5: // CELL_VISIBILITY
|
||||
return CELL_VISIBILITY;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -125,7 +130,7 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
}
|
||||
|
||||
// isset id assignments
|
||||
private _Fields optionals[] = {_Fields.ATTRIBUTES,_Fields.DURABILITY};
|
||||
private _Fields optionals[] = {_Fields.ATTRIBUTES,_Fields.DURABILITY,_Fields.CELL_VISIBILITY};
|
||||
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);
|
||||
|
@ -140,6 +145,8 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))));
|
||||
tmpMap.put(_Fields.DURABILITY, new org.apache.thrift.meta_data.FieldMetaData("durability", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TDurability.class)));
|
||||
tmpMap.put(_Fields.CELL_VISIBILITY, new org.apache.thrift.meta_data.FieldMetaData("cellVisibility", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCellVisibility.class)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAppend.class, metaDataMap);
|
||||
}
|
||||
|
@ -191,6 +198,9 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
if (other.isSetDurability()) {
|
||||
this.durability = other.durability;
|
||||
}
|
||||
if (other.isSetCellVisibility()) {
|
||||
this.cellVisibility = new TCellVisibility(other.cellVisibility);
|
||||
}
|
||||
}
|
||||
|
||||
public TAppend deepCopy() {
|
||||
|
@ -203,6 +213,7 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
this.columns = null;
|
||||
this.attributes = null;
|
||||
this.durability = null;
|
||||
this.cellVisibility = null;
|
||||
}
|
||||
|
||||
public byte[] getRow() {
|
||||
|
@ -345,6 +356,30 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
}
|
||||
}
|
||||
|
||||
public TCellVisibility getCellVisibility() {
|
||||
return this.cellVisibility;
|
||||
}
|
||||
|
||||
public TAppend setCellVisibility(TCellVisibility cellVisibility) {
|
||||
this.cellVisibility = cellVisibility;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetCellVisibility() {
|
||||
this.cellVisibility = null;
|
||||
}
|
||||
|
||||
/** Returns true if field cellVisibility is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetCellVisibility() {
|
||||
return this.cellVisibility != null;
|
||||
}
|
||||
|
||||
public void setCellVisibilityIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.cellVisibility = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, Object value) {
|
||||
switch (field) {
|
||||
case ROW:
|
||||
|
@ -379,6 +414,14 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
}
|
||||
break;
|
||||
|
||||
case CELL_VISIBILITY:
|
||||
if (value == null) {
|
||||
unsetCellVisibility();
|
||||
} else {
|
||||
setCellVisibility((TCellVisibility)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -396,6 +439,9 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
case DURABILITY:
|
||||
return getDurability();
|
||||
|
||||
case CELL_VISIBILITY:
|
||||
return getCellVisibility();
|
||||
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
@ -415,6 +461,8 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
return isSetAttributes();
|
||||
case DURABILITY:
|
||||
return isSetDurability();
|
||||
case CELL_VISIBILITY:
|
||||
return isSetCellVisibility();
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
@ -468,6 +516,15 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_cellVisibility = true && this.isSetCellVisibility();
|
||||
boolean that_present_cellVisibility = true && that.isSetCellVisibility();
|
||||
if (this_present_cellVisibility || that_present_cellVisibility) {
|
||||
if (!(this_present_cellVisibility && that_present_cellVisibility))
|
||||
return false;
|
||||
if (!this.cellVisibility.equals(that.cellVisibility))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -524,6 +581,16 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetCellVisibility()).compareTo(typedOther.isSetCellVisibility());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetCellVisibility()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cellVisibility, typedOther.cellVisibility);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -579,6 +646,16 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
}
|
||||
first = false;
|
||||
}
|
||||
if (isSetCellVisibility()) {
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("cellVisibility:");
|
||||
if (this.cellVisibility == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.cellVisibility);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -592,6 +669,9 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
throw new org.apache.thrift.protocol.TProtocolException("Required field 'columns' was not present! Struct: " + toString());
|
||||
}
|
||||
// check for sub-struct validity
|
||||
if (cellVisibility != null) {
|
||||
cellVisibility.validate();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
|
||||
|
@ -639,14 +719,14 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
case 2: // COLUMNS
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
|
||||
{
|
||||
org.apache.thrift.protocol.TList _list80 = iprot.readListBegin();
|
||||
struct.columns = new ArrayList<TColumnValue>(_list80.size);
|
||||
for (int _i81 = 0; _i81 < _list80.size; ++_i81)
|
||||
org.apache.thrift.protocol.TList _list88 = iprot.readListBegin();
|
||||
struct.columns = new ArrayList<TColumnValue>(_list88.size);
|
||||
for (int _i89 = 0; _i89 < _list88.size; ++_i89)
|
||||
{
|
||||
TColumnValue _elem82; // required
|
||||
_elem82 = new TColumnValue();
|
||||
_elem82.read(iprot);
|
||||
struct.columns.add(_elem82);
|
||||
TColumnValue _elem90; // required
|
||||
_elem90 = new TColumnValue();
|
||||
_elem90.read(iprot);
|
||||
struct.columns.add(_elem90);
|
||||
}
|
||||
iprot.readListEnd();
|
||||
}
|
||||
|
@ -658,15 +738,15 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
case 3: // ATTRIBUTES
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
|
||||
{
|
||||
org.apache.thrift.protocol.TMap _map83 = iprot.readMapBegin();
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map83.size);
|
||||
for (int _i84 = 0; _i84 < _map83.size; ++_i84)
|
||||
org.apache.thrift.protocol.TMap _map91 = iprot.readMapBegin();
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map91.size);
|
||||
for (int _i92 = 0; _i92 < _map91.size; ++_i92)
|
||||
{
|
||||
ByteBuffer _key85; // required
|
||||
ByteBuffer _val86; // required
|
||||
_key85 = iprot.readBinary();
|
||||
_val86 = iprot.readBinary();
|
||||
struct.attributes.put(_key85, _val86);
|
||||
ByteBuffer _key93; // required
|
||||
ByteBuffer _val94; // required
|
||||
_key93 = iprot.readBinary();
|
||||
_val94 = iprot.readBinary();
|
||||
struct.attributes.put(_key93, _val94);
|
||||
}
|
||||
iprot.readMapEnd();
|
||||
}
|
||||
|
@ -683,6 +763,15 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
case 5: // CELL_VISIBILITY
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
|
||||
struct.cellVisibility = new TCellVisibility();
|
||||
struct.cellVisibility.read(iprot);
|
||||
struct.setCellVisibilityIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
|
@ -707,9 +796,9 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
|
||||
{
|
||||
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
|
||||
for (TColumnValue _iter87 : struct.columns)
|
||||
for (TColumnValue _iter95 : struct.columns)
|
||||
{
|
||||
_iter87.write(oprot);
|
||||
_iter95.write(oprot);
|
||||
}
|
||||
oprot.writeListEnd();
|
||||
}
|
||||
|
@ -720,10 +809,10 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC);
|
||||
{
|
||||
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.attributes.size()));
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter88 : struct.attributes.entrySet())
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter96 : struct.attributes.entrySet())
|
||||
{
|
||||
oprot.writeBinary(_iter88.getKey());
|
||||
oprot.writeBinary(_iter88.getValue());
|
||||
oprot.writeBinary(_iter96.getKey());
|
||||
oprot.writeBinary(_iter96.getValue());
|
||||
}
|
||||
oprot.writeMapEnd();
|
||||
}
|
||||
|
@ -737,6 +826,13 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
if (struct.cellVisibility != null) {
|
||||
if (struct.isSetCellVisibility()) {
|
||||
oprot.writeFieldBegin(CELL_VISIBILITY_FIELD_DESC);
|
||||
struct.cellVisibility.write(oprot);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
@ -757,9 +853,9 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
oprot.writeBinary(struct.row);
|
||||
{
|
||||
oprot.writeI32(struct.columns.size());
|
||||
for (TColumnValue _iter89 : struct.columns)
|
||||
for (TColumnValue _iter97 : struct.columns)
|
||||
{
|
||||
_iter89.write(oprot);
|
||||
_iter97.write(oprot);
|
||||
}
|
||||
}
|
||||
BitSet optionals = new BitSet();
|
||||
|
@ -769,20 +865,26 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
if (struct.isSetDurability()) {
|
||||
optionals.set(1);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 2);
|
||||
if (struct.isSetCellVisibility()) {
|
||||
optionals.set(2);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 3);
|
||||
if (struct.isSetAttributes()) {
|
||||
{
|
||||
oprot.writeI32(struct.attributes.size());
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter90 : struct.attributes.entrySet())
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter98 : struct.attributes.entrySet())
|
||||
{
|
||||
oprot.writeBinary(_iter90.getKey());
|
||||
oprot.writeBinary(_iter90.getValue());
|
||||
oprot.writeBinary(_iter98.getKey());
|
||||
oprot.writeBinary(_iter98.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (struct.isSetDurability()) {
|
||||
oprot.writeI32(struct.durability.getValue());
|
||||
}
|
||||
if (struct.isSetCellVisibility()) {
|
||||
struct.cellVisibility.write(oprot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -791,29 +893,29 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
struct.row = iprot.readBinary();
|
||||
struct.setRowIsSet(true);
|
||||
{
|
||||
org.apache.thrift.protocol.TList _list91 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
|
||||
struct.columns = new ArrayList<TColumnValue>(_list91.size);
|
||||
for (int _i92 = 0; _i92 < _list91.size; ++_i92)
|
||||
org.apache.thrift.protocol.TList _list99 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
|
||||
struct.columns = new ArrayList<TColumnValue>(_list99.size);
|
||||
for (int _i100 = 0; _i100 < _list99.size; ++_i100)
|
||||
{
|
||||
TColumnValue _elem93; // required
|
||||
_elem93 = new TColumnValue();
|
||||
_elem93.read(iprot);
|
||||
struct.columns.add(_elem93);
|
||||
TColumnValue _elem101; // required
|
||||
_elem101 = new TColumnValue();
|
||||
_elem101.read(iprot);
|
||||
struct.columns.add(_elem101);
|
||||
}
|
||||
}
|
||||
struct.setColumnsIsSet(true);
|
||||
BitSet incoming = iprot.readBitSet(2);
|
||||
BitSet incoming = iprot.readBitSet(3);
|
||||
if (incoming.get(0)) {
|
||||
{
|
||||
org.apache.thrift.protocol.TMap _map94 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map94.size);
|
||||
for (int _i95 = 0; _i95 < _map94.size; ++_i95)
|
||||
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());
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map102.size);
|
||||
for (int _i103 = 0; _i103 < _map102.size; ++_i103)
|
||||
{
|
||||
ByteBuffer _key96; // required
|
||||
ByteBuffer _val97; // required
|
||||
_key96 = iprot.readBinary();
|
||||
_val97 = iprot.readBinary();
|
||||
struct.attributes.put(_key96, _val97);
|
||||
ByteBuffer _key104; // required
|
||||
ByteBuffer _val105; // required
|
||||
_key104 = iprot.readBinary();
|
||||
_val105 = iprot.readBinary();
|
||||
struct.attributes.put(_key104, _val105);
|
||||
}
|
||||
}
|
||||
struct.setAttributesIsSet(true);
|
||||
|
@ -822,6 +924,11 @@ public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields
|
|||
struct.durability = TDurability.findByValue(iprot.readI32());
|
||||
struct.setDurabilityIsSet(true);
|
||||
}
|
||||
if (incoming.get(2)) {
|
||||
struct.cellVisibility = new TCellVisibility();
|
||||
struct.cellVisibility.read(iprot);
|
||||
struct.setCellVisibilityIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,436 @@
|
|||
/**
|
||||
* 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.hadoop.hbase.thrift2.generated;
|
||||
|
||||
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;
|
||||
|
||||
public class TAuthorization implements org.apache.thrift.TBase<TAuthorization, TAuthorization._Fields>, java.io.Serializable, Cloneable {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAuthorization");
|
||||
|
||||
private static final org.apache.thrift.protocol.TField LABELS_FIELD_DESC = new org.apache.thrift.protocol.TField("labels", org.apache.thrift.protocol.TType.LIST, (short)1);
|
||||
|
||||
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
|
||||
static {
|
||||
schemes.put(StandardScheme.class, new TAuthorizationStandardSchemeFactory());
|
||||
schemes.put(TupleScheme.class, new TAuthorizationTupleSchemeFactory());
|
||||
}
|
||||
|
||||
public List<String> labels; // optional
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
LABELS((short)1, "labels");
|
||||
|
||||
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: // LABELS
|
||||
return LABELS;
|
||||
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 _Fields optionals[] = {_Fields.LABELS};
|
||||
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.LABELS, new org.apache.thrift.meta_data.FieldMetaData("labels", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAuthorization.class, metaDataMap);
|
||||
}
|
||||
|
||||
public TAuthorization() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a deep copy on <i>other</i>.
|
||||
*/
|
||||
public TAuthorization(TAuthorization other) {
|
||||
if (other.isSetLabels()) {
|
||||
List<String> __this__labels = new ArrayList<String>();
|
||||
for (String other_element : other.labels) {
|
||||
__this__labels.add(other_element);
|
||||
}
|
||||
this.labels = __this__labels;
|
||||
}
|
||||
}
|
||||
|
||||
public TAuthorization deepCopy() {
|
||||
return new TAuthorization(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.labels = null;
|
||||
}
|
||||
|
||||
public int getLabelsSize() {
|
||||
return (this.labels == null) ? 0 : this.labels.size();
|
||||
}
|
||||
|
||||
public java.util.Iterator<String> getLabelsIterator() {
|
||||
return (this.labels == null) ? null : this.labels.iterator();
|
||||
}
|
||||
|
||||
public void addToLabels(String elem) {
|
||||
if (this.labels == null) {
|
||||
this.labels = new ArrayList<String>();
|
||||
}
|
||||
this.labels.add(elem);
|
||||
}
|
||||
|
||||
public List<String> getLabels() {
|
||||
return this.labels;
|
||||
}
|
||||
|
||||
public TAuthorization setLabels(List<String> labels) {
|
||||
this.labels = labels;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetLabels() {
|
||||
this.labels = null;
|
||||
}
|
||||
|
||||
/** Returns true if field labels is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetLabels() {
|
||||
return this.labels != null;
|
||||
}
|
||||
|
||||
public void setLabelsIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.labels = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, Object value) {
|
||||
switch (field) {
|
||||
case LABELS:
|
||||
if (value == null) {
|
||||
unsetLabels();
|
||||
} else {
|
||||
setLabels((List<String>)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case LABELS:
|
||||
return getLabels();
|
||||
|
||||
}
|
||||
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 LABELS:
|
||||
return isSetLabels();
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (that instanceof TAuthorization)
|
||||
return this.equals((TAuthorization)that);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(TAuthorization that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
|
||||
boolean this_present_labels = true && this.isSetLabels();
|
||||
boolean that_present_labels = true && that.isSetLabels();
|
||||
if (this_present_labels || that_present_labels) {
|
||||
if (!(this_present_labels && that_present_labels))
|
||||
return false;
|
||||
if (!this.labels.equals(that.labels))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int compareTo(TAuthorization other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
TAuthorization typedOther = (TAuthorization)other;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetLabels()).compareTo(typedOther.isSetLabels());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetLabels()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.labels, typedOther.labels);
|
||||
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("TAuthorization(");
|
||||
boolean first = true;
|
||||
|
||||
if (isSetLabels()) {
|
||||
sb.append("labels:");
|
||||
if (this.labels == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.labels);
|
||||
}
|
||||
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 {
|
||||
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 TAuthorizationStandardSchemeFactory implements SchemeFactory {
|
||||
public TAuthorizationStandardScheme getScheme() {
|
||||
return new TAuthorizationStandardScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class TAuthorizationStandardScheme extends StandardScheme<TAuthorization> {
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot, TAuthorization 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: // LABELS
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
|
||||
{
|
||||
org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
|
||||
struct.labels = new ArrayList<String>(_list8.size);
|
||||
for (int _i9 = 0; _i9 < _list8.size; ++_i9)
|
||||
{
|
||||
String _elem10; // required
|
||||
_elem10 = iprot.readString();
|
||||
struct.labels.add(_elem10);
|
||||
}
|
||||
iprot.readListEnd();
|
||||
}
|
||||
struct.setLabelsIsSet(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, TAuthorization struct) throws org.apache.thrift.TException {
|
||||
struct.validate();
|
||||
|
||||
oprot.writeStructBegin(STRUCT_DESC);
|
||||
if (struct.labels != null) {
|
||||
if (struct.isSetLabels()) {
|
||||
oprot.writeFieldBegin(LABELS_FIELD_DESC);
|
||||
{
|
||||
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.labels.size()));
|
||||
for (String _iter11 : struct.labels)
|
||||
{
|
||||
oprot.writeString(_iter11);
|
||||
}
|
||||
oprot.writeListEnd();
|
||||
}
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class TAuthorizationTupleSchemeFactory implements SchemeFactory {
|
||||
public TAuthorizationTupleScheme getScheme() {
|
||||
return new TAuthorizationTupleScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class TAuthorizationTupleScheme extends TupleScheme<TAuthorization> {
|
||||
|
||||
@Override
|
||||
public void write(org.apache.thrift.protocol.TProtocol prot, TAuthorization struct) throws org.apache.thrift.TException {
|
||||
TTupleProtocol oprot = (TTupleProtocol) prot;
|
||||
BitSet optionals = new BitSet();
|
||||
if (struct.isSetLabels()) {
|
||||
optionals.set(0);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 1);
|
||||
if (struct.isSetLabels()) {
|
||||
{
|
||||
oprot.writeI32(struct.labels.size());
|
||||
for (String _iter12 : struct.labels)
|
||||
{
|
||||
oprot.writeString(_iter12);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(org.apache.thrift.protocol.TProtocol prot, TAuthorization struct) throws org.apache.thrift.TException {
|
||||
TTupleProtocol iprot = (TTupleProtocol) prot;
|
||||
BitSet incoming = iprot.readBitSet(1);
|
||||
if (incoming.get(0)) {
|
||||
{
|
||||
org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
|
||||
struct.labels = new ArrayList<String>(_list13.size);
|
||||
for (int _i14 = 0; _i14 < _list13.size; ++_i14)
|
||||
{
|
||||
String _elem15; // required
|
||||
_elem15 = iprot.readString();
|
||||
struct.labels.add(_elem15);
|
||||
}
|
||||
}
|
||||
struct.setLabelsIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,384 @@
|
|||
/**
|
||||
* 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.hadoop.hbase.thrift2.generated;
|
||||
|
||||
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;
|
||||
|
||||
public class TCellVisibility implements org.apache.thrift.TBase<TCellVisibility, TCellVisibility._Fields>, java.io.Serializable, Cloneable {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCellVisibility");
|
||||
|
||||
private static final org.apache.thrift.protocol.TField EXPRESSION_FIELD_DESC = new org.apache.thrift.protocol.TField("expression", org.apache.thrift.protocol.TType.STRING, (short)1);
|
||||
|
||||
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
|
||||
static {
|
||||
schemes.put(StandardScheme.class, new TCellVisibilityStandardSchemeFactory());
|
||||
schemes.put(TupleScheme.class, new TCellVisibilityTupleSchemeFactory());
|
||||
}
|
||||
|
||||
public String expression; // optional
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
EXPRESSION((short)1, "expression");
|
||||
|
||||
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: // EXPRESSION
|
||||
return EXPRESSION;
|
||||
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 _Fields optionals[] = {_Fields.EXPRESSION};
|
||||
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.EXPRESSION, new org.apache.thrift.meta_data.FieldMetaData("expression", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCellVisibility.class, metaDataMap);
|
||||
}
|
||||
|
||||
public TCellVisibility() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a deep copy on <i>other</i>.
|
||||
*/
|
||||
public TCellVisibility(TCellVisibility other) {
|
||||
if (other.isSetExpression()) {
|
||||
this.expression = other.expression;
|
||||
}
|
||||
}
|
||||
|
||||
public TCellVisibility deepCopy() {
|
||||
return new TCellVisibility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.expression = null;
|
||||
}
|
||||
|
||||
public String getExpression() {
|
||||
return this.expression;
|
||||
}
|
||||
|
||||
public TCellVisibility setExpression(String expression) {
|
||||
this.expression = expression;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetExpression() {
|
||||
this.expression = null;
|
||||
}
|
||||
|
||||
/** Returns true if field expression is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetExpression() {
|
||||
return this.expression != null;
|
||||
}
|
||||
|
||||
public void setExpressionIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.expression = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, Object value) {
|
||||
switch (field) {
|
||||
case EXPRESSION:
|
||||
if (value == null) {
|
||||
unsetExpression();
|
||||
} else {
|
||||
setExpression((String)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case EXPRESSION:
|
||||
return getExpression();
|
||||
|
||||
}
|
||||
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 EXPRESSION:
|
||||
return isSetExpression();
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (that instanceof TCellVisibility)
|
||||
return this.equals((TCellVisibility)that);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(TCellVisibility that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
|
||||
boolean this_present_expression = true && this.isSetExpression();
|
||||
boolean that_present_expression = true && that.isSetExpression();
|
||||
if (this_present_expression || that_present_expression) {
|
||||
if (!(this_present_expression && that_present_expression))
|
||||
return false;
|
||||
if (!this.expression.equals(that.expression))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int compareTo(TCellVisibility other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
TCellVisibility typedOther = (TCellVisibility)other;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetExpression()).compareTo(typedOther.isSetExpression());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetExpression()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.expression, typedOther.expression);
|
||||
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("TCellVisibility(");
|
||||
boolean first = true;
|
||||
|
||||
if (isSetExpression()) {
|
||||
sb.append("expression:");
|
||||
if (this.expression == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.expression);
|
||||
}
|
||||
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 {
|
||||
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 TCellVisibilityStandardSchemeFactory implements SchemeFactory {
|
||||
public TCellVisibilityStandardScheme getScheme() {
|
||||
return new TCellVisibilityStandardScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class TCellVisibilityStandardScheme extends StandardScheme<TCellVisibility> {
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot, TCellVisibility 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: // EXPRESSION
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
|
||||
struct.expression = iprot.readString();
|
||||
struct.setExpressionIsSet(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, TCellVisibility struct) throws org.apache.thrift.TException {
|
||||
struct.validate();
|
||||
|
||||
oprot.writeStructBegin(STRUCT_DESC);
|
||||
if (struct.expression != null) {
|
||||
if (struct.isSetExpression()) {
|
||||
oprot.writeFieldBegin(EXPRESSION_FIELD_DESC);
|
||||
oprot.writeString(struct.expression);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class TCellVisibilityTupleSchemeFactory implements SchemeFactory {
|
||||
public TCellVisibilityTupleScheme getScheme() {
|
||||
return new TCellVisibilityTupleScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class TCellVisibilityTupleScheme extends TupleScheme<TCellVisibility> {
|
||||
|
||||
@Override
|
||||
public void write(org.apache.thrift.protocol.TProtocol prot, TCellVisibility struct) throws org.apache.thrift.TException {
|
||||
TTupleProtocol oprot = (TTupleProtocol) prot;
|
||||
BitSet optionals = new BitSet();
|
||||
if (struct.isSetExpression()) {
|
||||
optionals.set(0);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 1);
|
||||
if (struct.isSetExpression()) {
|
||||
oprot.writeString(struct.expression);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(org.apache.thrift.protocol.TProtocol prot, TCellVisibility struct) throws org.apache.thrift.TException {
|
||||
TTupleProtocol iprot = (TTupleProtocol) prot;
|
||||
BitSet incoming = iprot.readBitSet(1);
|
||||
if (incoming.get(0)) {
|
||||
struct.expression = iprot.readString();
|
||||
struct.setExpressionIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -40,6 +40,7 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
private static final org.apache.thrift.protocol.TField QUALIFIER_FIELD_DESC = new org.apache.thrift.protocol.TField("qualifier", org.apache.thrift.protocol.TType.STRING, (short)2);
|
||||
private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRING, (short)3);
|
||||
private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)4);
|
||||
private static final org.apache.thrift.protocol.TField TAGS_FIELD_DESC = new org.apache.thrift.protocol.TField("tags", org.apache.thrift.protocol.TType.STRING, (short)5);
|
||||
|
||||
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
|
||||
static {
|
||||
|
@ -51,13 +52,15 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
public ByteBuffer qualifier; // required
|
||||
public ByteBuffer value; // required
|
||||
public long timestamp; // optional
|
||||
public ByteBuffer tags; // optional
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
FAMILY((short)1, "family"),
|
||||
QUALIFIER((short)2, "qualifier"),
|
||||
VALUE((short)3, "value"),
|
||||
TIMESTAMP((short)4, "timestamp");
|
||||
TIMESTAMP((short)4, "timestamp"),
|
||||
TAGS((short)5, "tags");
|
||||
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
|
@ -80,6 +83,8 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
return VALUE;
|
||||
case 4: // TIMESTAMP
|
||||
return TIMESTAMP;
|
||||
case 5: // TAGS
|
||||
return TAGS;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -122,7 +127,7 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
// isset id assignments
|
||||
private static final int __TIMESTAMP_ISSET_ID = 0;
|
||||
private byte __isset_bitfield = 0;
|
||||
private _Fields optionals[] = {_Fields.TIMESTAMP};
|
||||
private _Fields optionals[] = {_Fields.TIMESTAMP,_Fields.TAGS};
|
||||
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);
|
||||
|
@ -134,6 +139,8 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
|
||||
tmpMap.put(_Fields.TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("timestamp", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
|
||||
tmpMap.put(_Fields.TAGS, new org.apache.thrift.meta_data.FieldMetaData("tags", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
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(TColumnValue.class, metaDataMap);
|
||||
}
|
||||
|
@ -170,6 +177,10 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
;
|
||||
}
|
||||
this.timestamp = other.timestamp;
|
||||
if (other.isSetTags()) {
|
||||
this.tags = org.apache.thrift.TBaseHelper.copyBinary(other.tags);
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
public TColumnValue deepCopy() {
|
||||
|
@ -183,6 +194,7 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
this.value = null;
|
||||
setTimestampIsSet(false);
|
||||
this.timestamp = 0;
|
||||
this.tags = null;
|
||||
}
|
||||
|
||||
public byte[] getFamily() {
|
||||
|
@ -310,6 +322,40 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value);
|
||||
}
|
||||
|
||||
public byte[] getTags() {
|
||||
setTags(org.apache.thrift.TBaseHelper.rightSize(tags));
|
||||
return tags == null ? null : tags.array();
|
||||
}
|
||||
|
||||
public ByteBuffer bufferForTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public TColumnValue setTags(byte[] tags) {
|
||||
setTags(tags == null ? (ByteBuffer)null : ByteBuffer.wrap(tags));
|
||||
return this;
|
||||
}
|
||||
|
||||
public TColumnValue setTags(ByteBuffer tags) {
|
||||
this.tags = tags;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetTags() {
|
||||
this.tags = null;
|
||||
}
|
||||
|
||||
/** Returns true if field tags is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetTags() {
|
||||
return this.tags != null;
|
||||
}
|
||||
|
||||
public void setTagsIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.tags = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, Object value) {
|
||||
switch (field) {
|
||||
case FAMILY:
|
||||
|
@ -344,6 +390,14 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
}
|
||||
break;
|
||||
|
||||
case TAGS:
|
||||
if (value == null) {
|
||||
unsetTags();
|
||||
} else {
|
||||
setTags((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -361,6 +415,9 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
case TIMESTAMP:
|
||||
return Long.valueOf(getTimestamp());
|
||||
|
||||
case TAGS:
|
||||
return getTags();
|
||||
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
@ -380,6 +437,8 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
return isSetValue();
|
||||
case TIMESTAMP:
|
||||
return isSetTimestamp();
|
||||
case TAGS:
|
||||
return isSetTags();
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
@ -433,6 +492,15 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_tags = true && this.isSetTags();
|
||||
boolean that_present_tags = true && that.isSetTags();
|
||||
if (this_present_tags || that_present_tags) {
|
||||
if (!(this_present_tags && that_present_tags))
|
||||
return false;
|
||||
if (!this.tags.equals(that.tags))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -489,6 +557,16 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetTags()).compareTo(typedOther.isSetTags());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetTags()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tags, typedOther.tags);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -538,6 +616,16 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
sb.append(this.timestamp);
|
||||
first = false;
|
||||
}
|
||||
if (isSetTags()) {
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("tags:");
|
||||
if (this.tags == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
org.apache.thrift.TBaseHelper.toString(this.tags, sb);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -624,6 +712,14 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
case 5: // TAGS
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
|
||||
struct.tags = iprot.readBinary();
|
||||
struct.setTagsIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
|
@ -659,6 +755,13 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
oprot.writeI64(struct.timestamp);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
if (struct.tags != null) {
|
||||
if (struct.isSetTags()) {
|
||||
oprot.writeFieldBegin(TAGS_FIELD_DESC);
|
||||
oprot.writeBinary(struct.tags);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
@ -683,10 +786,16 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
if (struct.isSetTimestamp()) {
|
||||
optionals.set(0);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 1);
|
||||
if (struct.isSetTags()) {
|
||||
optionals.set(1);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 2);
|
||||
if (struct.isSetTimestamp()) {
|
||||
oprot.writeI64(struct.timestamp);
|
||||
}
|
||||
if (struct.isSetTags()) {
|
||||
oprot.writeBinary(struct.tags);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -698,11 +807,15 @@ public class TColumnValue implements org.apache.thrift.TBase<TColumnValue, TColu
|
|||
struct.setQualifierIsSet(true);
|
||||
struct.value = iprot.readBinary();
|
||||
struct.setValueIsSet(true);
|
||||
BitSet incoming = iprot.readBitSet(1);
|
||||
BitSet incoming = iprot.readBitSet(2);
|
||||
if (incoming.get(0)) {
|
||||
struct.timestamp = iprot.readI64();
|
||||
struct.setTimestampIsSet(true);
|
||||
}
|
||||
if (incoming.get(1)) {
|
||||
struct.tags = iprot.readBinary();
|
||||
struct.setTagsIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Autogenerated by Thrift Compiler (0.9.0)
|
||||
* Autogenerated by Thrift Compiler (0.9.1)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
|
@ -15,6 +15,8 @@ import org.apache.thrift.protocol.TTupleProtocol;
|
|||
import org.apache.thrift.protocol.TProtocolException;
|
||||
import org.apache.thrift.EncodingUtils;
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.async.AsyncMethodCallback;
|
||||
import org.apache.thrift.server.AbstractNonblockingServer.*;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
@ -43,7 +45,7 @@ import org.slf4j.LoggerFactory;
|
|||
* If you specify a time range and a timestamp the range is ignored.
|
||||
* Timestamps on TColumns are ignored.
|
||||
*/
|
||||
public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.io.Serializable, Cloneable {
|
||||
public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.io.Serializable, Cloneable, Comparable<TGet> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGet");
|
||||
|
||||
private static final org.apache.thrift.protocol.TField ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("row", org.apache.thrift.protocol.TType.STRING, (short)1);
|
||||
|
@ -53,6 +55,7 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
private static final org.apache.thrift.protocol.TField MAX_VERSIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("maxVersions", org.apache.thrift.protocol.TType.I32, (short)5);
|
||||
private static final org.apache.thrift.protocol.TField FILTER_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("filterString", org.apache.thrift.protocol.TType.STRING, (short)6);
|
||||
private static final org.apache.thrift.protocol.TField ATTRIBUTES_FIELD_DESC = new org.apache.thrift.protocol.TField("attributes", org.apache.thrift.protocol.TType.MAP, (short)7);
|
||||
private static final org.apache.thrift.protocol.TField AUTHORIZATIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizations", org.apache.thrift.protocol.TType.STRUCT, (short)8);
|
||||
|
||||
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
|
||||
static {
|
||||
|
@ -67,6 +70,7 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
public int maxVersions; // optional
|
||||
public ByteBuffer filterString; // optional
|
||||
public Map<ByteBuffer,ByteBuffer> attributes; // optional
|
||||
public TAuthorization authorizations; // optional
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
|
@ -76,7 +80,8 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
TIME_RANGE((short)4, "timeRange"),
|
||||
MAX_VERSIONS((short)5, "maxVersions"),
|
||||
FILTER_STRING((short)6, "filterString"),
|
||||
ATTRIBUTES((short)7, "attributes");
|
||||
ATTRIBUTES((short)7, "attributes"),
|
||||
AUTHORIZATIONS((short)8, "authorizations");
|
||||
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
|
@ -105,6 +110,8 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
return FILTER_STRING;
|
||||
case 7: // ATTRIBUTES
|
||||
return ATTRIBUTES;
|
||||
case 8: // AUTHORIZATIONS
|
||||
return AUTHORIZATIONS;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -148,7 +155,7 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
private static final int __TIMESTAMP_ISSET_ID = 0;
|
||||
private static final int __MAXVERSIONS_ISSET_ID = 1;
|
||||
private byte __isset_bitfield = 0;
|
||||
private _Fields optionals[] = {_Fields.COLUMNS,_Fields.TIMESTAMP,_Fields.TIME_RANGE,_Fields.MAX_VERSIONS,_Fields.FILTER_STRING,_Fields.ATTRIBUTES};
|
||||
private _Fields optionals[] = {_Fields.COLUMNS,_Fields.TIMESTAMP,_Fields.TIME_RANGE,_Fields.MAX_VERSIONS,_Fields.FILTER_STRING,_Fields.ATTRIBUTES,_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);
|
||||
|
@ -169,6 +176,8 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
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 , true),
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))));
|
||||
tmpMap.put(_Fields.AUTHORIZATIONS, new org.apache.thrift.meta_data.FieldMetaData("authorizations", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAuthorization.class)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGet.class, metaDataMap);
|
||||
}
|
||||
|
@ -193,7 +202,7 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
;
|
||||
}
|
||||
if (other.isSetColumns()) {
|
||||
List<TColumn> __this__columns = new ArrayList<TColumn>();
|
||||
List<TColumn> __this__columns = new ArrayList<TColumn>(other.columns.size());
|
||||
for (TColumn other_element : other.columns) {
|
||||
__this__columns.add(new TColumn(other_element));
|
||||
}
|
||||
|
@ -209,22 +218,12 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
;
|
||||
}
|
||||
if (other.isSetAttributes()) {
|
||||
Map<ByteBuffer,ByteBuffer> __this__attributes = new HashMap<ByteBuffer,ByteBuffer>();
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> other_element : other.attributes.entrySet()) {
|
||||
|
||||
ByteBuffer other_element_key = other_element.getKey();
|
||||
ByteBuffer other_element_value = other_element.getValue();
|
||||
|
||||
ByteBuffer __this__attributes_copy_key = org.apache.thrift.TBaseHelper.copyBinary(other_element_key);
|
||||
;
|
||||
|
||||
ByteBuffer __this__attributes_copy_value = org.apache.thrift.TBaseHelper.copyBinary(other_element_value);
|
||||
;
|
||||
|
||||
__this__attributes.put(__this__attributes_copy_key, __this__attributes_copy_value);
|
||||
}
|
||||
Map<ByteBuffer,ByteBuffer> __this__attributes = new HashMap<ByteBuffer,ByteBuffer>(other.attributes);
|
||||
this.attributes = __this__attributes;
|
||||
}
|
||||
if (other.isSetAuthorizations()) {
|
||||
this.authorizations = new TAuthorization(other.authorizations);
|
||||
}
|
||||
}
|
||||
|
||||
public TGet deepCopy() {
|
||||
|
@ -242,6 +241,7 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
this.maxVersions = 0;
|
||||
this.filterString = null;
|
||||
this.attributes = null;
|
||||
this.authorizations = null;
|
||||
}
|
||||
|
||||
public byte[] getRow() {
|
||||
|
@ -456,6 +456,30 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
}
|
||||
}
|
||||
|
||||
public TAuthorization getAuthorizations() {
|
||||
return this.authorizations;
|
||||
}
|
||||
|
||||
public TGet setAuthorizations(TAuthorization 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 ROW:
|
||||
|
@ -514,6 +538,14 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
}
|
||||
break;
|
||||
|
||||
case AUTHORIZATIONS:
|
||||
if (value == null) {
|
||||
unsetAuthorizations();
|
||||
} else {
|
||||
setAuthorizations((TAuthorization)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -540,6 +572,9 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
case ATTRIBUTES:
|
||||
return getAttributes();
|
||||
|
||||
case AUTHORIZATIONS:
|
||||
return getAuthorizations();
|
||||
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
@ -565,6 +600,8 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
return isSetFilterString();
|
||||
case ATTRIBUTES:
|
||||
return isSetAttributes();
|
||||
case AUTHORIZATIONS:
|
||||
return isSetAuthorizations();
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
@ -645,6 +682,15 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -653,80 +699,90 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(TGet other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
TGet typedOther = (TGet)other;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetRow()).compareTo(typedOther.isSetRow());
|
||||
lastComparison = Boolean.valueOf(isSetRow()).compareTo(other.isSetRow());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetRow()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row, typedOther.row);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row, other.row);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetColumns()).compareTo(typedOther.isSetColumns());
|
||||
lastComparison = Boolean.valueOf(isSetColumns()).compareTo(other.isSetColumns());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumns()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, typedOther.columns);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, other.columns);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(typedOther.isSetTimestamp());
|
||||
lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(other.isSetTimestamp());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetTimestamp()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, other.timestamp);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetTimeRange()).compareTo(typedOther.isSetTimeRange());
|
||||
lastComparison = Boolean.valueOf(isSetTimeRange()).compareTo(other.isSetTimeRange());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetTimeRange()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeRange, typedOther.timeRange);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeRange, other.timeRange);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetMaxVersions()).compareTo(typedOther.isSetMaxVersions());
|
||||
lastComparison = Boolean.valueOf(isSetMaxVersions()).compareTo(other.isSetMaxVersions());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetMaxVersions()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxVersions, typedOther.maxVersions);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxVersions, other.maxVersions);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetFilterString()).compareTo(typedOther.isSetFilterString());
|
||||
lastComparison = Boolean.valueOf(isSetFilterString()).compareTo(other.isSetFilterString());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetFilterString()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.filterString, typedOther.filterString);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.filterString, other.filterString);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes());
|
||||
lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(other.isSetAttributes());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetAttributes()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, other.attributes);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetAuthorizations()).compareTo(other.isSetAuthorizations());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetAuthorizations()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizations, other.authorizations);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
@ -810,6 +866,16 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
}
|
||||
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();
|
||||
}
|
||||
|
@ -823,6 +889,9 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
if (timeRange != null) {
|
||||
timeRange.validate();
|
||||
}
|
||||
if (authorizations != null) {
|
||||
authorizations.validate();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
|
||||
|
@ -872,14 +941,14 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
case 2: // COLUMNS
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
|
||||
{
|
||||
org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
|
||||
struct.columns = new ArrayList<TColumn>(_list8.size);
|
||||
for (int _i9 = 0; _i9 < _list8.size; ++_i9)
|
||||
org.apache.thrift.protocol.TList _list16 = iprot.readListBegin();
|
||||
struct.columns = new ArrayList<TColumn>(_list16.size);
|
||||
for (int _i17 = 0; _i17 < _list16.size; ++_i17)
|
||||
{
|
||||
TColumn _elem10; // required
|
||||
_elem10 = new TColumn();
|
||||
_elem10.read(iprot);
|
||||
struct.columns.add(_elem10);
|
||||
TColumn _elem18;
|
||||
_elem18 = new TColumn();
|
||||
_elem18.read(iprot);
|
||||
struct.columns.add(_elem18);
|
||||
}
|
||||
iprot.readListEnd();
|
||||
}
|
||||
|
@ -924,15 +993,15 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
case 7: // ATTRIBUTES
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
|
||||
{
|
||||
org.apache.thrift.protocol.TMap _map11 = iprot.readMapBegin();
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map11.size);
|
||||
for (int _i12 = 0; _i12 < _map11.size; ++_i12)
|
||||
org.apache.thrift.protocol.TMap _map19 = iprot.readMapBegin();
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map19.size);
|
||||
for (int _i20 = 0; _i20 < _map19.size; ++_i20)
|
||||
{
|
||||
ByteBuffer _key13; // required
|
||||
ByteBuffer _val14; // required
|
||||
_key13 = iprot.readBinary();
|
||||
_val14 = iprot.readBinary();
|
||||
struct.attributes.put(_key13, _val14);
|
||||
ByteBuffer _key21;
|
||||
ByteBuffer _val22;
|
||||
_key21 = iprot.readBinary();
|
||||
_val22 = iprot.readBinary();
|
||||
struct.attributes.put(_key21, _val22);
|
||||
}
|
||||
iprot.readMapEnd();
|
||||
}
|
||||
|
@ -941,6 +1010,15 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
case 8: // AUTHORIZATIONS
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
|
||||
struct.authorizations = new TAuthorization();
|
||||
struct.authorizations.read(iprot);
|
||||
struct.setAuthorizationsIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
|
@ -966,9 +1044,9 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
|
||||
{
|
||||
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
|
||||
for (TColumn _iter15 : struct.columns)
|
||||
for (TColumn _iter23 : struct.columns)
|
||||
{
|
||||
_iter15.write(oprot);
|
||||
_iter23.write(oprot);
|
||||
}
|
||||
oprot.writeListEnd();
|
||||
}
|
||||
|
@ -1004,16 +1082,23 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC);
|
||||
{
|
||||
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.attributes.size()));
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter16 : struct.attributes.entrySet())
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter24 : struct.attributes.entrySet())
|
||||
{
|
||||
oprot.writeBinary(_iter16.getKey());
|
||||
oprot.writeBinary(_iter16.getValue());
|
||||
oprot.writeBinary(_iter24.getKey());
|
||||
oprot.writeBinary(_iter24.getValue());
|
||||
}
|
||||
oprot.writeMapEnd();
|
||||
}
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
if (struct.authorizations != null) {
|
||||
if (struct.isSetAuthorizations()) {
|
||||
oprot.writeFieldBegin(AUTHORIZATIONS_FIELD_DESC);
|
||||
struct.authorizations.write(oprot);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
@ -1051,13 +1136,16 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
if (struct.isSetAttributes()) {
|
||||
optionals.set(5);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 6);
|
||||
if (struct.isSetAuthorizations()) {
|
||||
optionals.set(6);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 7);
|
||||
if (struct.isSetColumns()) {
|
||||
{
|
||||
oprot.writeI32(struct.columns.size());
|
||||
for (TColumn _iter17 : struct.columns)
|
||||
for (TColumn _iter25 : struct.columns)
|
||||
{
|
||||
_iter17.write(oprot);
|
||||
_iter25.write(oprot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1076,13 +1164,16 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
if (struct.isSetAttributes()) {
|
||||
{
|
||||
oprot.writeI32(struct.attributes.size());
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter18 : struct.attributes.entrySet())
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter26 : struct.attributes.entrySet())
|
||||
{
|
||||
oprot.writeBinary(_iter18.getKey());
|
||||
oprot.writeBinary(_iter18.getValue());
|
||||
oprot.writeBinary(_iter26.getKey());
|
||||
oprot.writeBinary(_iter26.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (struct.isSetAuthorizations()) {
|
||||
struct.authorizations.write(oprot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1090,17 +1181,17 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
TTupleProtocol iprot = (TTupleProtocol) prot;
|
||||
struct.row = iprot.readBinary();
|
||||
struct.setRowIsSet(true);
|
||||
BitSet incoming = iprot.readBitSet(6);
|
||||
BitSet incoming = iprot.readBitSet(7);
|
||||
if (incoming.get(0)) {
|
||||
{
|
||||
org.apache.thrift.protocol.TList _list19 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
|
||||
struct.columns = new ArrayList<TColumn>(_list19.size);
|
||||
for (int _i20 = 0; _i20 < _list19.size; ++_i20)
|
||||
org.apache.thrift.protocol.TList _list27 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
|
||||
struct.columns = new ArrayList<TColumn>(_list27.size);
|
||||
for (int _i28 = 0; _i28 < _list27.size; ++_i28)
|
||||
{
|
||||
TColumn _elem21; // required
|
||||
_elem21 = new TColumn();
|
||||
_elem21.read(iprot);
|
||||
struct.columns.add(_elem21);
|
||||
TColumn _elem29;
|
||||
_elem29 = new TColumn();
|
||||
_elem29.read(iprot);
|
||||
struct.columns.add(_elem29);
|
||||
}
|
||||
}
|
||||
struct.setColumnsIsSet(true);
|
||||
|
@ -1124,19 +1215,24 @@ public class TGet implements org.apache.thrift.TBase<TGet, TGet._Fields>, java.i
|
|||
}
|
||||
if (incoming.get(5)) {
|
||||
{
|
||||
org.apache.thrift.protocol.TMap _map22 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map22.size);
|
||||
for (int _i23 = 0; _i23 < _map22.size; ++_i23)
|
||||
org.apache.thrift.protocol.TMap _map30 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map30.size);
|
||||
for (int _i31 = 0; _i31 < _map30.size; ++_i31)
|
||||
{
|
||||
ByteBuffer _key24; // required
|
||||
ByteBuffer _val25; // required
|
||||
_key24 = iprot.readBinary();
|
||||
_val25 = iprot.readBinary();
|
||||
struct.attributes.put(_key24, _val25);
|
||||
ByteBuffer _key32;
|
||||
ByteBuffer _val33;
|
||||
_key32 = iprot.readBinary();
|
||||
_val33 = iprot.readBinary();
|
||||
struct.attributes.put(_key32, _val33);
|
||||
}
|
||||
}
|
||||
struct.setAttributesIsSet(true);
|
||||
}
|
||||
if (incoming.get(6)) {
|
||||
struct.authorizations = new TAuthorization();
|
||||
struct.authorizations.read(iprot);
|
||||
struct.setAuthorizationsIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)2);
|
||||
private static final org.apache.thrift.protocol.TField ATTRIBUTES_FIELD_DESC = new org.apache.thrift.protocol.TField("attributes", org.apache.thrift.protocol.TType.MAP, (short)4);
|
||||
private static final org.apache.thrift.protocol.TField DURABILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("durability", org.apache.thrift.protocol.TType.I32, (short)5);
|
||||
private static final org.apache.thrift.protocol.TField CELL_VISIBILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("cellVisibility", org.apache.thrift.protocol.TType.STRUCT, (short)6);
|
||||
|
||||
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
|
||||
static {
|
||||
|
@ -59,6 +60,7 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
* @see TDurability
|
||||
*/
|
||||
public TDurability durability; // optional
|
||||
public TCellVisibility cellVisibility; // optional
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
|
@ -69,7 +71,8 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
*
|
||||
* @see TDurability
|
||||
*/
|
||||
DURABILITY((short)5, "durability");
|
||||
DURABILITY((short)5, "durability"),
|
||||
CELL_VISIBILITY((short)6, "cellVisibility");
|
||||
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
|
@ -92,6 +95,8 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
return ATTRIBUTES;
|
||||
case 5: // DURABILITY
|
||||
return DURABILITY;
|
||||
case 6: // CELL_VISIBILITY
|
||||
return CELL_VISIBILITY;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -132,7 +137,7 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
}
|
||||
|
||||
// isset id assignments
|
||||
private _Fields optionals[] = {_Fields.ATTRIBUTES,_Fields.DURABILITY};
|
||||
private _Fields optionals[] = {_Fields.ATTRIBUTES,_Fields.DURABILITY,_Fields.CELL_VISIBILITY};
|
||||
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);
|
||||
|
@ -147,6 +152,8 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))));
|
||||
tmpMap.put(_Fields.DURABILITY, new org.apache.thrift.meta_data.FieldMetaData("durability", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TDurability.class)));
|
||||
tmpMap.put(_Fields.CELL_VISIBILITY, new org.apache.thrift.meta_data.FieldMetaData("cellVisibility", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCellVisibility.class)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TIncrement.class, metaDataMap);
|
||||
}
|
||||
|
@ -198,6 +205,9 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
if (other.isSetDurability()) {
|
||||
this.durability = other.durability;
|
||||
}
|
||||
if (other.isSetCellVisibility()) {
|
||||
this.cellVisibility = new TCellVisibility(other.cellVisibility);
|
||||
}
|
||||
}
|
||||
|
||||
public TIncrement deepCopy() {
|
||||
|
@ -210,6 +220,7 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
this.columns = null;
|
||||
this.attributes = null;
|
||||
this.durability = null;
|
||||
this.cellVisibility = null;
|
||||
}
|
||||
|
||||
public byte[] getRow() {
|
||||
|
@ -352,6 +363,30 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
}
|
||||
}
|
||||
|
||||
public TCellVisibility getCellVisibility() {
|
||||
return this.cellVisibility;
|
||||
}
|
||||
|
||||
public TIncrement setCellVisibility(TCellVisibility cellVisibility) {
|
||||
this.cellVisibility = cellVisibility;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetCellVisibility() {
|
||||
this.cellVisibility = null;
|
||||
}
|
||||
|
||||
/** Returns true if field cellVisibility is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetCellVisibility() {
|
||||
return this.cellVisibility != null;
|
||||
}
|
||||
|
||||
public void setCellVisibilityIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.cellVisibility = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, Object value) {
|
||||
switch (field) {
|
||||
case ROW:
|
||||
|
@ -386,6 +421,14 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
}
|
||||
break;
|
||||
|
||||
case CELL_VISIBILITY:
|
||||
if (value == null) {
|
||||
unsetCellVisibility();
|
||||
} else {
|
||||
setCellVisibility((TCellVisibility)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -403,6 +446,9 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
case DURABILITY:
|
||||
return getDurability();
|
||||
|
||||
case CELL_VISIBILITY:
|
||||
return getCellVisibility();
|
||||
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
@ -422,6 +468,8 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
return isSetAttributes();
|
||||
case DURABILITY:
|
||||
return isSetDurability();
|
||||
case CELL_VISIBILITY:
|
||||
return isSetCellVisibility();
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
@ -475,6 +523,15 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_cellVisibility = true && this.isSetCellVisibility();
|
||||
boolean that_present_cellVisibility = true && that.isSetCellVisibility();
|
||||
if (this_present_cellVisibility || that_present_cellVisibility) {
|
||||
if (!(this_present_cellVisibility && that_present_cellVisibility))
|
||||
return false;
|
||||
if (!this.cellVisibility.equals(that.cellVisibility))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -531,6 +588,16 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetCellVisibility()).compareTo(typedOther.isSetCellVisibility());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetCellVisibility()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cellVisibility, typedOther.cellVisibility);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -586,6 +653,16 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
}
|
||||
first = false;
|
||||
}
|
||||
if (isSetCellVisibility()) {
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("cellVisibility:");
|
||||
if (this.cellVisibility == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.cellVisibility);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -599,6 +676,9 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
throw new org.apache.thrift.protocol.TProtocolException("Required field 'columns' was not present! Struct: " + toString());
|
||||
}
|
||||
// check for sub-struct validity
|
||||
if (cellVisibility != null) {
|
||||
cellVisibility.validate();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
|
||||
|
@ -646,14 +726,14 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
case 2: // COLUMNS
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
|
||||
{
|
||||
org.apache.thrift.protocol.TList _list62 = iprot.readListBegin();
|
||||
struct.columns = new ArrayList<TColumnIncrement>(_list62.size);
|
||||
for (int _i63 = 0; _i63 < _list62.size; ++_i63)
|
||||
org.apache.thrift.protocol.TList _list70 = iprot.readListBegin();
|
||||
struct.columns = new ArrayList<TColumnIncrement>(_list70.size);
|
||||
for (int _i71 = 0; _i71 < _list70.size; ++_i71)
|
||||
{
|
||||
TColumnIncrement _elem64; // optional
|
||||
_elem64 = new TColumnIncrement();
|
||||
_elem64.read(iprot);
|
||||
struct.columns.add(_elem64);
|
||||
TColumnIncrement _elem72; // required
|
||||
_elem72 = new TColumnIncrement();
|
||||
_elem72.read(iprot);
|
||||
struct.columns.add(_elem72);
|
||||
}
|
||||
iprot.readListEnd();
|
||||
}
|
||||
|
@ -665,15 +745,15 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
case 4: // ATTRIBUTES
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
|
||||
{
|
||||
org.apache.thrift.protocol.TMap _map65 = iprot.readMapBegin();
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map65.size);
|
||||
for (int _i66 = 0; _i66 < _map65.size; ++_i66)
|
||||
org.apache.thrift.protocol.TMap _map73 = iprot.readMapBegin();
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map73.size);
|
||||
for (int _i74 = 0; _i74 < _map73.size; ++_i74)
|
||||
{
|
||||
ByteBuffer _key67; // required
|
||||
ByteBuffer _val68; // required
|
||||
_key67 = iprot.readBinary();
|
||||
_val68 = iprot.readBinary();
|
||||
struct.attributes.put(_key67, _val68);
|
||||
ByteBuffer _key75; // required
|
||||
ByteBuffer _val76; // required
|
||||
_key75 = iprot.readBinary();
|
||||
_val76 = iprot.readBinary();
|
||||
struct.attributes.put(_key75, _val76);
|
||||
}
|
||||
iprot.readMapEnd();
|
||||
}
|
||||
|
@ -690,6 +770,15 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
case 6: // CELL_VISIBILITY
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
|
||||
struct.cellVisibility = new TCellVisibility();
|
||||
struct.cellVisibility.read(iprot);
|
||||
struct.setCellVisibilityIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
|
@ -714,9 +803,9 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
|
||||
{
|
||||
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
|
||||
for (TColumnIncrement _iter69 : struct.columns)
|
||||
for (TColumnIncrement _iter77 : struct.columns)
|
||||
{
|
||||
_iter69.write(oprot);
|
||||
_iter77.write(oprot);
|
||||
}
|
||||
oprot.writeListEnd();
|
||||
}
|
||||
|
@ -727,10 +816,10 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC);
|
||||
{
|
||||
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.attributes.size()));
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter70 : struct.attributes.entrySet())
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter78 : struct.attributes.entrySet())
|
||||
{
|
||||
oprot.writeBinary(_iter70.getKey());
|
||||
oprot.writeBinary(_iter70.getValue());
|
||||
oprot.writeBinary(_iter78.getKey());
|
||||
oprot.writeBinary(_iter78.getValue());
|
||||
}
|
||||
oprot.writeMapEnd();
|
||||
}
|
||||
|
@ -744,6 +833,13 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
if (struct.cellVisibility != null) {
|
||||
if (struct.isSetCellVisibility()) {
|
||||
oprot.writeFieldBegin(CELL_VISIBILITY_FIELD_DESC);
|
||||
struct.cellVisibility.write(oprot);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
@ -764,9 +860,9 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
oprot.writeBinary(struct.row);
|
||||
{
|
||||
oprot.writeI32(struct.columns.size());
|
||||
for (TColumnIncrement _iter71 : struct.columns)
|
||||
for (TColumnIncrement _iter79 : struct.columns)
|
||||
{
|
||||
_iter71.write(oprot);
|
||||
_iter79.write(oprot);
|
||||
}
|
||||
}
|
||||
BitSet optionals = new BitSet();
|
||||
|
@ -776,20 +872,26 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
if (struct.isSetDurability()) {
|
||||
optionals.set(1);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 2);
|
||||
if (struct.isSetCellVisibility()) {
|
||||
optionals.set(2);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 3);
|
||||
if (struct.isSetAttributes()) {
|
||||
{
|
||||
oprot.writeI32(struct.attributes.size());
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter72 : struct.attributes.entrySet())
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter80 : struct.attributes.entrySet())
|
||||
{
|
||||
oprot.writeBinary(_iter72.getKey());
|
||||
oprot.writeBinary(_iter72.getValue());
|
||||
oprot.writeBinary(_iter80.getKey());
|
||||
oprot.writeBinary(_iter80.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (struct.isSetDurability()) {
|
||||
oprot.writeI32(struct.durability.getValue());
|
||||
}
|
||||
if (struct.isSetCellVisibility()) {
|
||||
struct.cellVisibility.write(oprot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -798,29 +900,29 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
struct.row = iprot.readBinary();
|
||||
struct.setRowIsSet(true);
|
||||
{
|
||||
org.apache.thrift.protocol.TList _list73 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
|
||||
struct.columns = new ArrayList<TColumnIncrement>(_list73.size);
|
||||
for (int _i74 = 0; _i74 < _list73.size; ++_i74)
|
||||
org.apache.thrift.protocol.TList _list81 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
|
||||
struct.columns = new ArrayList<TColumnIncrement>(_list81.size);
|
||||
for (int _i82 = 0; _i82 < _list81.size; ++_i82)
|
||||
{
|
||||
TColumnIncrement _elem75; // optional
|
||||
_elem75 = new TColumnIncrement();
|
||||
_elem75.read(iprot);
|
||||
struct.columns.add(_elem75);
|
||||
TColumnIncrement _elem83; // required
|
||||
_elem83 = new TColumnIncrement();
|
||||
_elem83.read(iprot);
|
||||
struct.columns.add(_elem83);
|
||||
}
|
||||
}
|
||||
struct.setColumnsIsSet(true);
|
||||
BitSet incoming = iprot.readBitSet(2);
|
||||
BitSet incoming = iprot.readBitSet(3);
|
||||
if (incoming.get(0)) {
|
||||
{
|
||||
org.apache.thrift.protocol.TMap _map76 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map76.size);
|
||||
for (int _i77 = 0; _i77 < _map76.size; ++_i77)
|
||||
org.apache.thrift.protocol.TMap _map84 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map84.size);
|
||||
for (int _i85 = 0; _i85 < _map84.size; ++_i85)
|
||||
{
|
||||
ByteBuffer _key78; // required
|
||||
ByteBuffer _val79; // required
|
||||
_key78 = iprot.readBinary();
|
||||
_val79 = iprot.readBinary();
|
||||
struct.attributes.put(_key78, _val79);
|
||||
ByteBuffer _key86; // required
|
||||
ByteBuffer _val87; // required
|
||||
_key86 = iprot.readBinary();
|
||||
_val87 = iprot.readBinary();
|
||||
struct.attributes.put(_key86, _val87);
|
||||
}
|
||||
}
|
||||
struct.setAttributesIsSet(true);
|
||||
|
@ -829,6 +931,11 @@ public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncremen
|
|||
struct.durability = TDurability.findByValue(iprot.readI32());
|
||||
struct.setDurabilityIsSet(true);
|
||||
}
|
||||
if (incoming.get(2)) {
|
||||
struct.cellVisibility = new TCellVisibility();
|
||||
struct.cellVisibility.read(iprot);
|
||||
struct.setCellVisibilityIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Autogenerated by Thrift Compiler (0.9.0)
|
||||
* Autogenerated by Thrift Compiler (0.9.1)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
|
@ -15,6 +15,8 @@ import org.apache.thrift.protocol.TTupleProtocol;
|
|||
import org.apache.thrift.protocol.TProtocolException;
|
||||
import org.apache.thrift.EncodingUtils;
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.async.AsyncMethodCallback;
|
||||
import org.apache.thrift.server.AbstractNonblockingServer.*;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
@ -42,7 +44,7 @@ import org.slf4j.LoggerFactory;
|
|||
* by changing the durability. If you don't provide durability, it defaults to
|
||||
* column family's default setting for durability.
|
||||
*/
|
||||
public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.io.Serializable, Cloneable {
|
||||
public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.io.Serializable, Cloneable, Comparable<TPut> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TPut");
|
||||
|
||||
private static final org.apache.thrift.protocol.TField ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("row", org.apache.thrift.protocol.TType.STRING, (short)1);
|
||||
|
@ -50,6 +52,7 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)3);
|
||||
private static final org.apache.thrift.protocol.TField ATTRIBUTES_FIELD_DESC = new org.apache.thrift.protocol.TField("attributes", org.apache.thrift.protocol.TType.MAP, (short)5);
|
||||
private static final org.apache.thrift.protocol.TField DURABILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("durability", org.apache.thrift.protocol.TType.I32, (short)6);
|
||||
private static final org.apache.thrift.protocol.TField CELL_VISIBILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("cellVisibility", org.apache.thrift.protocol.TType.STRUCT, (short)7);
|
||||
|
||||
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
|
||||
static {
|
||||
|
@ -66,6 +69,7 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
* @see TDurability
|
||||
*/
|
||||
public TDurability durability; // optional
|
||||
public TCellVisibility cellVisibility; // optional
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
|
@ -77,7 +81,8 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
*
|
||||
* @see TDurability
|
||||
*/
|
||||
DURABILITY((short)6, "durability");
|
||||
DURABILITY((short)6, "durability"),
|
||||
CELL_VISIBILITY((short)7, "cellVisibility");
|
||||
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
|
@ -102,6 +107,8 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
return ATTRIBUTES;
|
||||
case 6: // DURABILITY
|
||||
return DURABILITY;
|
||||
case 7: // CELL_VISIBILITY
|
||||
return CELL_VISIBILITY;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -144,7 +151,7 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
// isset id assignments
|
||||
private static final int __TIMESTAMP_ISSET_ID = 0;
|
||||
private byte __isset_bitfield = 0;
|
||||
private _Fields optionals[] = {_Fields.TIMESTAMP,_Fields.ATTRIBUTES,_Fields.DURABILITY};
|
||||
private _Fields optionals[] = {_Fields.TIMESTAMP,_Fields.ATTRIBUTES,_Fields.DURABILITY,_Fields.CELL_VISIBILITY};
|
||||
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);
|
||||
|
@ -161,6 +168,8 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))));
|
||||
tmpMap.put(_Fields.DURABILITY, new org.apache.thrift.meta_data.FieldMetaData("durability", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TDurability.class)));
|
||||
tmpMap.put(_Fields.CELL_VISIBILITY, new org.apache.thrift.meta_data.FieldMetaData("cellVisibility", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCellVisibility.class)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TPut.class, metaDataMap);
|
||||
}
|
||||
|
@ -187,7 +196,7 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
;
|
||||
}
|
||||
if (other.isSetColumnValues()) {
|
||||
List<TColumnValue> __this__columnValues = new ArrayList<TColumnValue>();
|
||||
List<TColumnValue> __this__columnValues = new ArrayList<TColumnValue>(other.columnValues.size());
|
||||
for (TColumnValue other_element : other.columnValues) {
|
||||
__this__columnValues.add(new TColumnValue(other_element));
|
||||
}
|
||||
|
@ -195,25 +204,15 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
}
|
||||
this.timestamp = other.timestamp;
|
||||
if (other.isSetAttributes()) {
|
||||
Map<ByteBuffer,ByteBuffer> __this__attributes = new HashMap<ByteBuffer,ByteBuffer>();
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> other_element : other.attributes.entrySet()) {
|
||||
|
||||
ByteBuffer other_element_key = other_element.getKey();
|
||||
ByteBuffer other_element_value = other_element.getValue();
|
||||
|
||||
ByteBuffer __this__attributes_copy_key = org.apache.thrift.TBaseHelper.copyBinary(other_element_key);
|
||||
;
|
||||
|
||||
ByteBuffer __this__attributes_copy_value = org.apache.thrift.TBaseHelper.copyBinary(other_element_value);
|
||||
;
|
||||
|
||||
__this__attributes.put(__this__attributes_copy_key, __this__attributes_copy_value);
|
||||
}
|
||||
Map<ByteBuffer,ByteBuffer> __this__attributes = new HashMap<ByteBuffer,ByteBuffer>(other.attributes);
|
||||
this.attributes = __this__attributes;
|
||||
}
|
||||
if (other.isSetDurability()) {
|
||||
this.durability = other.durability;
|
||||
}
|
||||
if (other.isSetCellVisibility()) {
|
||||
this.cellVisibility = new TCellVisibility(other.cellVisibility);
|
||||
}
|
||||
}
|
||||
|
||||
public TPut deepCopy() {
|
||||
|
@ -228,6 +227,7 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
this.timestamp = 0;
|
||||
this.attributes = null;
|
||||
this.durability = null;
|
||||
this.cellVisibility = null;
|
||||
}
|
||||
|
||||
public byte[] getRow() {
|
||||
|
@ -393,6 +393,30 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
}
|
||||
}
|
||||
|
||||
public TCellVisibility getCellVisibility() {
|
||||
return this.cellVisibility;
|
||||
}
|
||||
|
||||
public TPut setCellVisibility(TCellVisibility cellVisibility) {
|
||||
this.cellVisibility = cellVisibility;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetCellVisibility() {
|
||||
this.cellVisibility = null;
|
||||
}
|
||||
|
||||
/** Returns true if field cellVisibility is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetCellVisibility() {
|
||||
return this.cellVisibility != null;
|
||||
}
|
||||
|
||||
public void setCellVisibilityIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.cellVisibility = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, Object value) {
|
||||
switch (field) {
|
||||
case ROW:
|
||||
|
@ -435,6 +459,14 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
}
|
||||
break;
|
||||
|
||||
case CELL_VISIBILITY:
|
||||
if (value == null) {
|
||||
unsetCellVisibility();
|
||||
} else {
|
||||
setCellVisibility((TCellVisibility)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,6 +487,9 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
case DURABILITY:
|
||||
return getDurability();
|
||||
|
||||
case CELL_VISIBILITY:
|
||||
return getCellVisibility();
|
||||
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
@ -476,6 +511,8 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
return isSetAttributes();
|
||||
case DURABILITY:
|
||||
return isSetDurability();
|
||||
case CELL_VISIBILITY:
|
||||
return isSetCellVisibility();
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
@ -538,6 +575,15 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_cellVisibility = true && this.isSetCellVisibility();
|
||||
boolean that_present_cellVisibility = true && that.isSetCellVisibility();
|
||||
if (this_present_cellVisibility || that_present_cellVisibility) {
|
||||
if (!(this_present_cellVisibility && that_present_cellVisibility))
|
||||
return false;
|
||||
if (!this.cellVisibility.equals(that.cellVisibility))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -546,60 +592,70 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(TPut other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
TPut typedOther = (TPut)other;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetRow()).compareTo(typedOther.isSetRow());
|
||||
lastComparison = Boolean.valueOf(isSetRow()).compareTo(other.isSetRow());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetRow()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row, typedOther.row);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row, other.row);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetColumnValues()).compareTo(typedOther.isSetColumnValues());
|
||||
lastComparison = Boolean.valueOf(isSetColumnValues()).compareTo(other.isSetColumnValues());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumnValues()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columnValues, typedOther.columnValues);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columnValues, other.columnValues);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(typedOther.isSetTimestamp());
|
||||
lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(other.isSetTimestamp());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetTimestamp()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, other.timestamp);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes());
|
||||
lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(other.isSetAttributes());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetAttributes()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, other.attributes);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetDurability()).compareTo(typedOther.isSetDurability());
|
||||
lastComparison = Boolean.valueOf(isSetDurability()).compareTo(other.isSetDurability());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetDurability()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.durability, typedOther.durability);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.durability, other.durability);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetCellVisibility()).compareTo(other.isSetCellVisibility());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetCellVisibility()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cellVisibility, other.cellVisibility);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
@ -665,6 +721,16 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
}
|
||||
first = false;
|
||||
}
|
||||
if (isSetCellVisibility()) {
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("cellVisibility:");
|
||||
if (this.cellVisibility == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.cellVisibility);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -678,6 +744,9 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
throw new org.apache.thrift.protocol.TProtocolException("Required field 'columnValues' was not present! Struct: " + toString());
|
||||
}
|
||||
// check for sub-struct validity
|
||||
if (cellVisibility != null) {
|
||||
cellVisibility.validate();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
|
||||
|
@ -727,14 +796,14 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
case 2: // COLUMN_VALUES
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
|
||||
{
|
||||
org.apache.thrift.protocol.TList _list26 = iprot.readListBegin();
|
||||
struct.columnValues = new ArrayList<TColumnValue>(_list26.size);
|
||||
for (int _i27 = 0; _i27 < _list26.size; ++_i27)
|
||||
org.apache.thrift.protocol.TList _list34 = iprot.readListBegin();
|
||||
struct.columnValues = new ArrayList<TColumnValue>(_list34.size);
|
||||
for (int _i35 = 0; _i35 < _list34.size; ++_i35)
|
||||
{
|
||||
TColumnValue _elem28; // optional
|
||||
_elem28 = new TColumnValue();
|
||||
_elem28.read(iprot);
|
||||
struct.columnValues.add(_elem28);
|
||||
TColumnValue _elem36;
|
||||
_elem36 = new TColumnValue();
|
||||
_elem36.read(iprot);
|
||||
struct.columnValues.add(_elem36);
|
||||
}
|
||||
iprot.readListEnd();
|
||||
}
|
||||
|
@ -754,15 +823,15 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
case 5: // ATTRIBUTES
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
|
||||
{
|
||||
org.apache.thrift.protocol.TMap _map29 = iprot.readMapBegin();
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map29.size);
|
||||
for (int _i30 = 0; _i30 < _map29.size; ++_i30)
|
||||
org.apache.thrift.protocol.TMap _map37 = iprot.readMapBegin();
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map37.size);
|
||||
for (int _i38 = 0; _i38 < _map37.size; ++_i38)
|
||||
{
|
||||
ByteBuffer _key31; // required
|
||||
ByteBuffer _val32; // required
|
||||
_key31 = iprot.readBinary();
|
||||
_val32 = iprot.readBinary();
|
||||
struct.attributes.put(_key31, _val32);
|
||||
ByteBuffer _key39;
|
||||
ByteBuffer _val40;
|
||||
_key39 = iprot.readBinary();
|
||||
_val40 = iprot.readBinary();
|
||||
struct.attributes.put(_key39, _val40);
|
||||
}
|
||||
iprot.readMapEnd();
|
||||
}
|
||||
|
@ -779,6 +848,15 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
case 7: // CELL_VISIBILITY
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
|
||||
struct.cellVisibility = new TCellVisibility();
|
||||
struct.cellVisibility.read(iprot);
|
||||
struct.setCellVisibilityIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
|
@ -803,9 +881,9 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
oprot.writeFieldBegin(COLUMN_VALUES_FIELD_DESC);
|
||||
{
|
||||
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columnValues.size()));
|
||||
for (TColumnValue _iter33 : struct.columnValues)
|
||||
for (TColumnValue _iter41 : struct.columnValues)
|
||||
{
|
||||
_iter33.write(oprot);
|
||||
_iter41.write(oprot);
|
||||
}
|
||||
oprot.writeListEnd();
|
||||
}
|
||||
|
@ -821,10 +899,10 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC);
|
||||
{
|
||||
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.attributes.size()));
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter34 : struct.attributes.entrySet())
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter42 : struct.attributes.entrySet())
|
||||
{
|
||||
oprot.writeBinary(_iter34.getKey());
|
||||
oprot.writeBinary(_iter34.getValue());
|
||||
oprot.writeBinary(_iter42.getKey());
|
||||
oprot.writeBinary(_iter42.getValue());
|
||||
}
|
||||
oprot.writeMapEnd();
|
||||
}
|
||||
|
@ -838,6 +916,13 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
if (struct.cellVisibility != null) {
|
||||
if (struct.isSetCellVisibility()) {
|
||||
oprot.writeFieldBegin(CELL_VISIBILITY_FIELD_DESC);
|
||||
struct.cellVisibility.write(oprot);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
@ -858,9 +943,9 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
oprot.writeBinary(struct.row);
|
||||
{
|
||||
oprot.writeI32(struct.columnValues.size());
|
||||
for (TColumnValue _iter35 : struct.columnValues)
|
||||
for (TColumnValue _iter43 : struct.columnValues)
|
||||
{
|
||||
_iter35.write(oprot);
|
||||
_iter43.write(oprot);
|
||||
}
|
||||
}
|
||||
BitSet optionals = new BitSet();
|
||||
|
@ -873,23 +958,29 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
if (struct.isSetDurability()) {
|
||||
optionals.set(2);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 3);
|
||||
if (struct.isSetCellVisibility()) {
|
||||
optionals.set(3);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 4);
|
||||
if (struct.isSetTimestamp()) {
|
||||
oprot.writeI64(struct.timestamp);
|
||||
}
|
||||
if (struct.isSetAttributes()) {
|
||||
{
|
||||
oprot.writeI32(struct.attributes.size());
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter36 : struct.attributes.entrySet())
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter44 : struct.attributes.entrySet())
|
||||
{
|
||||
oprot.writeBinary(_iter36.getKey());
|
||||
oprot.writeBinary(_iter36.getValue());
|
||||
oprot.writeBinary(_iter44.getKey());
|
||||
oprot.writeBinary(_iter44.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (struct.isSetDurability()) {
|
||||
oprot.writeI32(struct.durability.getValue());
|
||||
}
|
||||
if (struct.isSetCellVisibility()) {
|
||||
struct.cellVisibility.write(oprot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -898,33 +989,33 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
struct.row = iprot.readBinary();
|
||||
struct.setRowIsSet(true);
|
||||
{
|
||||
org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
|
||||
struct.columnValues = new ArrayList<TColumnValue>(_list37.size);
|
||||
for (int _i38 = 0; _i38 < _list37.size; ++_i38)
|
||||
org.apache.thrift.protocol.TList _list45 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
|
||||
struct.columnValues = new ArrayList<TColumnValue>(_list45.size);
|
||||
for (int _i46 = 0; _i46 < _list45.size; ++_i46)
|
||||
{
|
||||
TColumnValue _elem39; // optional
|
||||
_elem39 = new TColumnValue();
|
||||
_elem39.read(iprot);
|
||||
struct.columnValues.add(_elem39);
|
||||
TColumnValue _elem47;
|
||||
_elem47 = new TColumnValue();
|
||||
_elem47.read(iprot);
|
||||
struct.columnValues.add(_elem47);
|
||||
}
|
||||
}
|
||||
struct.setColumnValuesIsSet(true);
|
||||
BitSet incoming = iprot.readBitSet(3);
|
||||
BitSet incoming = iprot.readBitSet(4);
|
||||
if (incoming.get(0)) {
|
||||
struct.timestamp = iprot.readI64();
|
||||
struct.setTimestampIsSet(true);
|
||||
}
|
||||
if (incoming.get(1)) {
|
||||
{
|
||||
org.apache.thrift.protocol.TMap _map40 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map40.size);
|
||||
for (int _i41 = 0; _i41 < _map40.size; ++_i41)
|
||||
org.apache.thrift.protocol.TMap _map48 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map48.size);
|
||||
for (int _i49 = 0; _i49 < _map48.size; ++_i49)
|
||||
{
|
||||
ByteBuffer _key42; // required
|
||||
ByteBuffer _val43; // required
|
||||
_key42 = iprot.readBinary();
|
||||
_val43 = iprot.readBinary();
|
||||
struct.attributes.put(_key42, _val43);
|
||||
ByteBuffer _key50;
|
||||
ByteBuffer _val51;
|
||||
_key50 = iprot.readBinary();
|
||||
_val51 = iprot.readBinary();
|
||||
struct.attributes.put(_key50, _val51);
|
||||
}
|
||||
}
|
||||
struct.setAttributesIsSet(true);
|
||||
|
@ -933,6 +1024,11 @@ public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.i
|
|||
struct.durability = TDurability.findByValue(iprot.readI32());
|
||||
struct.setDurabilityIsSet(true);
|
||||
}
|
||||
if (incoming.get(3)) {
|
||||
struct.cellVisibility = new TCellVisibility();
|
||||
struct.cellVisibility.read(iprot);
|
||||
struct.setCellVisibilityIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Autogenerated by Thrift Compiler (0.9.0)
|
||||
* Autogenerated by Thrift Compiler (0.9.1)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
|
@ -15,6 +15,8 @@ import org.apache.thrift.protocol.TTupleProtocol;
|
|||
import org.apache.thrift.protocol.TProtocolException;
|
||||
import org.apache.thrift.EncodingUtils;
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.async.AsyncMethodCallback;
|
||||
import org.apache.thrift.server.AbstractNonblockingServer.*;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
@ -34,7 +36,7 @@ import org.slf4j.LoggerFactory;
|
|||
* Any timestamps in the columns are ignored, use timeRange to select by timestamp.
|
||||
* Max versions defaults to 1.
|
||||
*/
|
||||
public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, java.io.Serializable, Cloneable {
|
||||
public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, java.io.Serializable, Cloneable, Comparable<TScan> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TScan");
|
||||
|
||||
private static final org.apache.thrift.protocol.TField START_ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("startRow", org.apache.thrift.protocol.TType.STRING, (short)1);
|
||||
|
@ -46,6 +48,7 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
private static final org.apache.thrift.protocol.TField FILTER_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("filterString", org.apache.thrift.protocol.TType.STRING, (short)7);
|
||||
private static final org.apache.thrift.protocol.TField BATCH_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("batchSize", org.apache.thrift.protocol.TType.I32, (short)8);
|
||||
private static final org.apache.thrift.protocol.TField ATTRIBUTES_FIELD_DESC = new org.apache.thrift.protocol.TField("attributes", org.apache.thrift.protocol.TType.MAP, (short)9);
|
||||
private static final org.apache.thrift.protocol.TField AUTHORIZATIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizations", org.apache.thrift.protocol.TType.STRUCT, (short)10);
|
||||
|
||||
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
|
||||
static {
|
||||
|
@ -62,6 +65,7 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
public ByteBuffer filterString; // optional
|
||||
public int batchSize; // optional
|
||||
public Map<ByteBuffer,ByteBuffer> attributes; // optional
|
||||
public TAuthorization authorizations; // optional
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
|
@ -73,7 +77,8 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
TIME_RANGE((short)6, "timeRange"),
|
||||
FILTER_STRING((short)7, "filterString"),
|
||||
BATCH_SIZE((short)8, "batchSize"),
|
||||
ATTRIBUTES((short)9, "attributes");
|
||||
ATTRIBUTES((short)9, "attributes"),
|
||||
AUTHORIZATIONS((short)10, "authorizations");
|
||||
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
|
@ -106,6 +111,8 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
return BATCH_SIZE;
|
||||
case 9: // ATTRIBUTES
|
||||
return ATTRIBUTES;
|
||||
case 10: // AUTHORIZATIONS
|
||||
return AUTHORIZATIONS;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -150,7 +157,7 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
private static final int __MAXVERSIONS_ISSET_ID = 1;
|
||||
private static final int __BATCHSIZE_ISSET_ID = 2;
|
||||
private byte __isset_bitfield = 0;
|
||||
private _Fields optionals[] = {_Fields.START_ROW,_Fields.STOP_ROW,_Fields.COLUMNS,_Fields.CACHING,_Fields.MAX_VERSIONS,_Fields.TIME_RANGE,_Fields.FILTER_STRING,_Fields.BATCH_SIZE,_Fields.ATTRIBUTES};
|
||||
private _Fields optionals[] = {_Fields.START_ROW,_Fields.STOP_ROW,_Fields.COLUMNS,_Fields.CACHING,_Fields.MAX_VERSIONS,_Fields.TIME_RANGE,_Fields.FILTER_STRING,_Fields.BATCH_SIZE,_Fields.ATTRIBUTES,_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);
|
||||
|
@ -175,6 +182,8 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
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 , true),
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))));
|
||||
tmpMap.put(_Fields.AUTHORIZATIONS, new org.apache.thrift.meta_data.FieldMetaData("authorizations", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
||||
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAuthorization.class)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TScan.class, metaDataMap);
|
||||
}
|
||||
|
@ -198,7 +207,7 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
;
|
||||
}
|
||||
if (other.isSetColumns()) {
|
||||
List<TColumn> __this__columns = new ArrayList<TColumn>();
|
||||
List<TColumn> __this__columns = new ArrayList<TColumn>(other.columns.size());
|
||||
for (TColumn other_element : other.columns) {
|
||||
__this__columns.add(new TColumn(other_element));
|
||||
}
|
||||
|
@ -215,22 +224,12 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
}
|
||||
this.batchSize = other.batchSize;
|
||||
if (other.isSetAttributes()) {
|
||||
Map<ByteBuffer,ByteBuffer> __this__attributes = new HashMap<ByteBuffer,ByteBuffer>();
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> other_element : other.attributes.entrySet()) {
|
||||
|
||||
ByteBuffer other_element_key = other_element.getKey();
|
||||
ByteBuffer other_element_value = other_element.getValue();
|
||||
|
||||
ByteBuffer __this__attributes_copy_key = org.apache.thrift.TBaseHelper.copyBinary(other_element_key);
|
||||
;
|
||||
|
||||
ByteBuffer __this__attributes_copy_value = org.apache.thrift.TBaseHelper.copyBinary(other_element_value);
|
||||
;
|
||||
|
||||
__this__attributes.put(__this__attributes_copy_key, __this__attributes_copy_value);
|
||||
}
|
||||
Map<ByteBuffer,ByteBuffer> __this__attributes = new HashMap<ByteBuffer,ByteBuffer>(other.attributes);
|
||||
this.attributes = __this__attributes;
|
||||
}
|
||||
if (other.isSetAuthorizations()) {
|
||||
this.authorizations = new TAuthorization(other.authorizations);
|
||||
}
|
||||
}
|
||||
|
||||
public TScan deepCopy() {
|
||||
|
@ -251,6 +250,7 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
setBatchSizeIsSet(false);
|
||||
this.batchSize = 0;
|
||||
this.attributes = null;
|
||||
this.authorizations = null;
|
||||
}
|
||||
|
||||
public byte[] getStartRow() {
|
||||
|
@ -522,6 +522,30 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
}
|
||||
}
|
||||
|
||||
public TAuthorization getAuthorizations() {
|
||||
return this.authorizations;
|
||||
}
|
||||
|
||||
public TScan setAuthorizations(TAuthorization 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 START_ROW:
|
||||
|
@ -596,6 +620,14 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
}
|
||||
break;
|
||||
|
||||
case AUTHORIZATIONS:
|
||||
if (value == null) {
|
||||
unsetAuthorizations();
|
||||
} else {
|
||||
setAuthorizations((TAuthorization)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -628,6 +660,9 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
case ATTRIBUTES:
|
||||
return getAttributes();
|
||||
|
||||
case AUTHORIZATIONS:
|
||||
return getAuthorizations();
|
||||
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
@ -657,6 +692,8 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
return isSetBatchSize();
|
||||
case ATTRIBUTES:
|
||||
return isSetAttributes();
|
||||
case AUTHORIZATIONS:
|
||||
return isSetAuthorizations();
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
@ -755,6 +792,15 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -763,100 +809,110 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(TScan other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
TScan typedOther = (TScan)other;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetStartRow()).compareTo(typedOther.isSetStartRow());
|
||||
lastComparison = Boolean.valueOf(isSetStartRow()).compareTo(other.isSetStartRow());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetStartRow()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startRow, typedOther.startRow);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startRow, other.startRow);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetStopRow()).compareTo(typedOther.isSetStopRow());
|
||||
lastComparison = Boolean.valueOf(isSetStopRow()).compareTo(other.isSetStopRow());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetStopRow()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stopRow, typedOther.stopRow);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stopRow, other.stopRow);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetColumns()).compareTo(typedOther.isSetColumns());
|
||||
lastComparison = Boolean.valueOf(isSetColumns()).compareTo(other.isSetColumns());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumns()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, typedOther.columns);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, other.columns);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetCaching()).compareTo(typedOther.isSetCaching());
|
||||
lastComparison = Boolean.valueOf(isSetCaching()).compareTo(other.isSetCaching());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetCaching()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.caching, typedOther.caching);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.caching, other.caching);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetMaxVersions()).compareTo(typedOther.isSetMaxVersions());
|
||||
lastComparison = Boolean.valueOf(isSetMaxVersions()).compareTo(other.isSetMaxVersions());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetMaxVersions()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxVersions, typedOther.maxVersions);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maxVersions, other.maxVersions);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetTimeRange()).compareTo(typedOther.isSetTimeRange());
|
||||
lastComparison = Boolean.valueOf(isSetTimeRange()).compareTo(other.isSetTimeRange());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetTimeRange()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeRange, typedOther.timeRange);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeRange, other.timeRange);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetFilterString()).compareTo(typedOther.isSetFilterString());
|
||||
lastComparison = Boolean.valueOf(isSetFilterString()).compareTo(other.isSetFilterString());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetFilterString()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.filterString, typedOther.filterString);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.filterString, other.filterString);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetBatchSize()).compareTo(typedOther.isSetBatchSize());
|
||||
lastComparison = Boolean.valueOf(isSetBatchSize()).compareTo(other.isSetBatchSize());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetBatchSize()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.batchSize, typedOther.batchSize);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.batchSize, other.batchSize);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes());
|
||||
lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(other.isSetAttributes());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetAttributes()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes);
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, other.attributes);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetAuthorizations()).compareTo(other.isSetAuthorizations());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetAuthorizations()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizations, other.authorizations);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
|
@ -958,6 +1014,16 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
}
|
||||
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();
|
||||
}
|
||||
|
@ -968,6 +1034,9 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
if (timeRange != null) {
|
||||
timeRange.validate();
|
||||
}
|
||||
if (authorizations != null) {
|
||||
authorizations.validate();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
|
||||
|
@ -1025,14 +1094,14 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
case 3: // COLUMNS
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
|
||||
{
|
||||
org.apache.thrift.protocol.TList _list80 = iprot.readListBegin();
|
||||
struct.columns = new ArrayList<TColumn>(_list80.size);
|
||||
for (int _i81 = 0; _i81 < _list80.size; ++_i81)
|
||||
org.apache.thrift.protocol.TList _list88 = iprot.readListBegin();
|
||||
struct.columns = new ArrayList<TColumn>(_list88.size);
|
||||
for (int _i89 = 0; _i89 < _list88.size; ++_i89)
|
||||
{
|
||||
TColumn _elem82; // required
|
||||
_elem82 = new TColumn();
|
||||
_elem82.read(iprot);
|
||||
struct.columns.add(_elem82);
|
||||
TColumn _elem90;
|
||||
_elem90 = new TColumn();
|
||||
_elem90.read(iprot);
|
||||
struct.columns.add(_elem90);
|
||||
}
|
||||
iprot.readListEnd();
|
||||
}
|
||||
|
@ -1085,15 +1154,15 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
case 9: // ATTRIBUTES
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
|
||||
{
|
||||
org.apache.thrift.protocol.TMap _map83 = iprot.readMapBegin();
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map83.size);
|
||||
for (int _i84 = 0; _i84 < _map83.size; ++_i84)
|
||||
org.apache.thrift.protocol.TMap _map91 = iprot.readMapBegin();
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map91.size);
|
||||
for (int _i92 = 0; _i92 < _map91.size; ++_i92)
|
||||
{
|
||||
ByteBuffer _key85; // required
|
||||
ByteBuffer _val86; // required
|
||||
_key85 = iprot.readBinary();
|
||||
_val86 = iprot.readBinary();
|
||||
struct.attributes.put(_key85, _val86);
|
||||
ByteBuffer _key93;
|
||||
ByteBuffer _val94;
|
||||
_key93 = iprot.readBinary();
|
||||
_val94 = iprot.readBinary();
|
||||
struct.attributes.put(_key93, _val94);
|
||||
}
|
||||
iprot.readMapEnd();
|
||||
}
|
||||
|
@ -1102,6 +1171,15 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
case 10: // AUTHORIZATIONS
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
|
||||
struct.authorizations = new TAuthorization();
|
||||
struct.authorizations.read(iprot);
|
||||
struct.setAuthorizationsIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
|
@ -1136,9 +1214,9 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
|
||||
{
|
||||
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
|
||||
for (TColumn _iter87 : struct.columns)
|
||||
for (TColumn _iter95 : struct.columns)
|
||||
{
|
||||
_iter87.write(oprot);
|
||||
_iter95.write(oprot);
|
||||
}
|
||||
oprot.writeListEnd();
|
||||
}
|
||||
|
@ -1179,16 +1257,23 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC);
|
||||
{
|
||||
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.attributes.size()));
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter88 : struct.attributes.entrySet())
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter96 : struct.attributes.entrySet())
|
||||
{
|
||||
oprot.writeBinary(_iter88.getKey());
|
||||
oprot.writeBinary(_iter88.getValue());
|
||||
oprot.writeBinary(_iter96.getKey());
|
||||
oprot.writeBinary(_iter96.getValue());
|
||||
}
|
||||
oprot.writeMapEnd();
|
||||
}
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
if (struct.authorizations != null) {
|
||||
if (struct.isSetAuthorizations()) {
|
||||
oprot.writeFieldBegin(AUTHORIZATIONS_FIELD_DESC);
|
||||
struct.authorizations.write(oprot);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
@ -1234,7 +1319,10 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
if (struct.isSetAttributes()) {
|
||||
optionals.set(8);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 9);
|
||||
if (struct.isSetAuthorizations()) {
|
||||
optionals.set(9);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 10);
|
||||
if (struct.isSetStartRow()) {
|
||||
oprot.writeBinary(struct.startRow);
|
||||
}
|
||||
|
@ -1244,9 +1332,9 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
if (struct.isSetColumns()) {
|
||||
{
|
||||
oprot.writeI32(struct.columns.size());
|
||||
for (TColumn _iter89 : struct.columns)
|
||||
for (TColumn _iter97 : struct.columns)
|
||||
{
|
||||
_iter89.write(oprot);
|
||||
_iter97.write(oprot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1268,19 +1356,22 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
if (struct.isSetAttributes()) {
|
||||
{
|
||||
oprot.writeI32(struct.attributes.size());
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter90 : struct.attributes.entrySet())
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> _iter98 : struct.attributes.entrySet())
|
||||
{
|
||||
oprot.writeBinary(_iter90.getKey());
|
||||
oprot.writeBinary(_iter90.getValue());
|
||||
oprot.writeBinary(_iter98.getKey());
|
||||
oprot.writeBinary(_iter98.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (struct.isSetAuthorizations()) {
|
||||
struct.authorizations.write(oprot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(org.apache.thrift.protocol.TProtocol prot, TScan struct) throws org.apache.thrift.TException {
|
||||
TTupleProtocol iprot = (TTupleProtocol) prot;
|
||||
BitSet incoming = iprot.readBitSet(9);
|
||||
BitSet incoming = iprot.readBitSet(10);
|
||||
if (incoming.get(0)) {
|
||||
struct.startRow = iprot.readBinary();
|
||||
struct.setStartRowIsSet(true);
|
||||
|
@ -1291,14 +1382,14 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
}
|
||||
if (incoming.get(2)) {
|
||||
{
|
||||
org.apache.thrift.protocol.TList _list91 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
|
||||
struct.columns = new ArrayList<TColumn>(_list91.size);
|
||||
for (int _i92 = 0; _i92 < _list91.size; ++_i92)
|
||||
org.apache.thrift.protocol.TList _list99 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
|
||||
struct.columns = new ArrayList<TColumn>(_list99.size);
|
||||
for (int _i100 = 0; _i100 < _list99.size; ++_i100)
|
||||
{
|
||||
TColumn _elem93; // required
|
||||
_elem93 = new TColumn();
|
||||
_elem93.read(iprot);
|
||||
struct.columns.add(_elem93);
|
||||
TColumn _elem101;
|
||||
_elem101 = new TColumn();
|
||||
_elem101.read(iprot);
|
||||
struct.columns.add(_elem101);
|
||||
}
|
||||
}
|
||||
struct.setColumnsIsSet(true);
|
||||
|
@ -1326,19 +1417,24 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
|
|||
}
|
||||
if (incoming.get(8)) {
|
||||
{
|
||||
org.apache.thrift.protocol.TMap _map94 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map94.size);
|
||||
for (int _i95 = 0; _i95 < _map94.size; ++_i95)
|
||||
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());
|
||||
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map102.size);
|
||||
for (int _i103 = 0; _i103 < _map102.size; ++_i103)
|
||||
{
|
||||
ByteBuffer _key96; // required
|
||||
ByteBuffer _val97; // required
|
||||
_key96 = iprot.readBinary();
|
||||
_val97 = iprot.readBinary();
|
||||
struct.attributes.put(_key96, _val97);
|
||||
ByteBuffer _key104;
|
||||
ByteBuffer _val105;
|
||||
_key104 = iprot.readBinary();
|
||||
_val105 = iprot.readBinary();
|
||||
struct.attributes.put(_key104, _val105);
|
||||
}
|
||||
}
|
||||
struct.setAttributesIsSet(true);
|
||||
}
|
||||
if (incoming.get(9)) {
|
||||
struct.authorizations = new TAuthorization();
|
||||
struct.authorizations.read(iprot);
|
||||
struct.setAuthorizationsIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@ struct TColumnValue {
|
|||
1: required binary family,
|
||||
2: required binary qualifier,
|
||||
3: required binary value,
|
||||
4: optional i64 timestamp
|
||||
4: optional i64 timestamp,
|
||||
5: optional binary tags
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +92,13 @@ enum TDurability {
|
|||
SYNC_WAL = 3,
|
||||
FSYNC_WAL = 4
|
||||
}
|
||||
struct TAuthorization {
|
||||
1: optional list<string> labels
|
||||
}
|
||||
|
||||
struct TCellVisibility {
|
||||
1: optional string expression
|
||||
}
|
||||
/**
|
||||
* Used to perform Get operations on a single row.
|
||||
*
|
||||
|
@ -115,6 +122,7 @@ struct TGet {
|
|||
5: optional i32 maxVersions,
|
||||
6: optional binary filterString,
|
||||
7: optional map<binary, binary> attributes
|
||||
8: optional TAuthorization authorizations
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,7 +142,8 @@ struct TPut {
|
|||
2: required list<TColumnValue> columnValues
|
||||
3: optional i64 timestamp,
|
||||
5: optional map<binary, binary> attributes,
|
||||
6: optional TDurability durability
|
||||
6: optional TDurability durability,
|
||||
7: optional TCellVisibility cellVisibility
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -185,6 +194,7 @@ struct TIncrement {
|
|||
2: required list<TColumnIncrement> columns,
|
||||
4: optional map<binary, binary> attributes,
|
||||
5: optional TDurability durability
|
||||
6: optional TCellVisibility cellVisibility
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -195,6 +205,7 @@ struct TAppend {
|
|||
2: required list<TColumnValue> columns,
|
||||
3: optional map<binary, binary> attributes,
|
||||
4: optional TDurability durability
|
||||
5: optional TCellVisibility cellVisibility
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -211,6 +222,7 @@ struct TScan {
|
|||
7: optional binary filterString,
|
||||
8: optional i32 batchSize,
|
||||
9: optional map<binary, binary> attributes
|
||||
10: optional TAuthorization authorizations
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,458 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.hadoop.hbase.thrift2;
|
||||
|
||||
import static java.nio.ByteBuffer.wrap;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.MediumTests;
|
||||
import org.apache.hadoop.hbase.TableName;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabelsResponse;
|
||||
import org.apache.hadoop.hbase.security.User;
|
||||
import org.apache.hadoop.hbase.security.visibility.ScanLabelGenerator;
|
||||
import org.apache.hadoop.hbase.security.visibility.SimpleScanLabelGenerator;
|
||||
import org.apache.hadoop.hbase.security.visibility.VisibilityClient;
|
||||
import org.apache.hadoop.hbase.security.visibility.VisibilityConstants;
|
||||
import org.apache.hadoop.hbase.security.visibility.VisibilityController;
|
||||
import org.apache.hadoop.hbase.security.visibility.VisibilityUtils;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TAppend;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TAuthorization;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TCellVisibility;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TColumn;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TColumnIncrement;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TColumnValue;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TGet;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TIllegalArgument;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TIncrement;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TPut;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TResult;
|
||||
import org.apache.hadoop.hbase.thrift2.generated.TScan;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
@Category(MediumTests.class)
|
||||
public class TestThriftHBaseServiceHandlerWithLabels {
|
||||
|
||||
public static final Log LOG = LogFactory
|
||||
.getLog(TestThriftHBaseServiceHandlerWithLabels.class);
|
||||
private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
|
||||
|
||||
// Static names for tables, columns, rows, and values
|
||||
private static byte[] tableAname = Bytes.toBytes("tableA");
|
||||
private static byte[] familyAname = Bytes.toBytes("familyA");
|
||||
private static byte[] familyBname = Bytes.toBytes("familyB");
|
||||
private static byte[] qualifierAname = Bytes.toBytes("qualifierA");
|
||||
private static byte[] qualifierBname = Bytes.toBytes("qualifierB");
|
||||
private static byte[] valueAname = Bytes.toBytes("valueA");
|
||||
private static byte[] valueBname = Bytes.toBytes("valueB");
|
||||
private static HColumnDescriptor[] families = new HColumnDescriptor[] {
|
||||
new HColumnDescriptor(familyAname).setMaxVersions(3),
|
||||
new HColumnDescriptor(familyBname).setMaxVersions(2) };
|
||||
|
||||
private final static String TOPSECRET = "topsecret";
|
||||
private final static String PUBLIC = "public";
|
||||
private final static String PRIVATE = "private";
|
||||
private final static String CONFIDENTIAL = "confidential";
|
||||
private final static String SECRET = "secret";
|
||||
private static User SUPERUSER;
|
||||
|
||||
private static Configuration conf;
|
||||
|
||||
public void assertTColumnValuesEqual(List<TColumnValue> columnValuesA,
|
||||
List<TColumnValue> columnValuesB) {
|
||||
assertEquals(columnValuesA.size(), columnValuesB.size());
|
||||
Comparator<TColumnValue> comparator = new Comparator<TColumnValue>() {
|
||||
@Override
|
||||
public int compare(TColumnValue o1, TColumnValue o2) {
|
||||
return Bytes.compareTo(Bytes.add(o1.getFamily(), o1.getQualifier()),
|
||||
Bytes.add(o2.getFamily(), o2.getQualifier()));
|
||||
}
|
||||
};
|
||||
Collections.sort(columnValuesA, comparator);
|
||||
Collections.sort(columnValuesB, comparator);
|
||||
|
||||
for (int i = 0; i < columnValuesA.size(); i++) {
|
||||
TColumnValue a = columnValuesA.get(i);
|
||||
TColumnValue b = columnValuesB.get(i);
|
||||
assertArrayEquals(a.getFamily(), b.getFamily());
|
||||
assertArrayEquals(a.getQualifier(), b.getQualifier());
|
||||
assertArrayEquals(a.getValue(), b.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
SUPERUSER = User.createUserForTesting(conf, "admin",
|
||||
new String[] { "supergroup" });
|
||||
conf = UTIL.getConfiguration();
|
||||
conf.setClass(VisibilityUtils.VISIBILITY_LABEL_GENERATOR_CLASS,
|
||||
SimpleScanLabelGenerator.class, ScanLabelGenerator.class);
|
||||
conf.set("hbase.superuser", SUPERUSER.getShortName());
|
||||
conf.set("hbase.coprocessor.master.classes",
|
||||
VisibilityController.class.getName());
|
||||
conf.set("hbase.coprocessor.region.classes",
|
||||
VisibilityController.class.getName());
|
||||
UTIL.startMiniCluster(1);
|
||||
// Wait for the labels table to become available
|
||||
UTIL.waitTableEnabled(VisibilityConstants.LABELS_TABLE_NAME.getName(), 50000);
|
||||
createLabels();
|
||||
HBaseAdmin admin = new HBaseAdmin(UTIL.getConfiguration());
|
||||
HTableDescriptor tableDescriptor = new HTableDescriptor(
|
||||
TableName.valueOf(tableAname));
|
||||
for (HColumnDescriptor family : families) {
|
||||
tableDescriptor.addFamily(family);
|
||||
}
|
||||
admin.createTable(tableDescriptor);
|
||||
setAuths();
|
||||
}
|
||||
|
||||
private static void createLabels() throws IOException, InterruptedException {
|
||||
PrivilegedExceptionAction<VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsResponse>() {
|
||||
public VisibilityLabelsResponse run() throws Exception {
|
||||
String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
|
||||
try {
|
||||
VisibilityClient.addLabels(conf, labels);
|
||||
} catch (Throwable t) {
|
||||
throw new IOException(t);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
SUPERUSER.runAs(action);
|
||||
}
|
||||
|
||||
private static void setAuths() throws IOException {
|
||||
String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET };
|
||||
try {
|
||||
VisibilityClient.setAuths(conf, labels, User.getCurrent().getShortName());
|
||||
} catch (Throwable t) {
|
||||
throw new IOException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() throws Exception {
|
||||
UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setup() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
private ThriftHBaseServiceHandler createHandler() {
|
||||
return new ThriftHBaseServiceHandler(UTIL.getConfiguration());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScanWithVisibilityLabels() throws Exception {
|
||||
ThriftHBaseServiceHandler handler = createHandler();
|
||||
ByteBuffer table = wrap(tableAname);
|
||||
|
||||
// insert data
|
||||
TColumnValue columnValue = new TColumnValue(wrap(familyAname),
|
||||
wrap(qualifierAname), wrap(valueAname));
|
||||
List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
|
||||
columnValues.add(columnValue);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
TPut put = new TPut(wrap(("testScan" + i).getBytes()), columnValues);
|
||||
if (i == 5) {
|
||||
put.setCellVisibility(new TCellVisibility().setExpression(PUBLIC));
|
||||
} else {
|
||||
put.setCellVisibility(new TCellVisibility().setExpression("(" + SECRET
|
||||
+ "|" + CONFIDENTIAL + ")" + "&" + "!" + TOPSECRET));
|
||||
}
|
||||
handler.put(table, put);
|
||||
}
|
||||
|
||||
// create scan instance
|
||||
TScan scan = new TScan();
|
||||
List<TColumn> columns = new ArrayList<TColumn>();
|
||||
TColumn column = new TColumn();
|
||||
column.setFamily(familyAname);
|
||||
column.setQualifier(qualifierAname);
|
||||
columns.add(column);
|
||||
scan.setColumns(columns);
|
||||
scan.setStartRow("testScan".getBytes());
|
||||
scan.setStopRow("testScan\uffff".getBytes());
|
||||
|
||||
TAuthorization tauth = new TAuthorization();
|
||||
List<String> labels = new ArrayList<String>();
|
||||
labels.add(SECRET);
|
||||
labels.add(PRIVATE);
|
||||
tauth.setLabels(labels);
|
||||
scan.setAuthorizations(tauth);
|
||||
// get scanner and rows
|
||||
int scanId = handler.openScanner(table, scan);
|
||||
List<TResult> results = handler.getScannerRows(scanId, 10);
|
||||
assertEquals(9, results.size());
|
||||
Assert.assertFalse(Bytes.equals(results.get(5).getRow(),
|
||||
("testScan" + 5).getBytes()));
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (i < 5) {
|
||||
assertArrayEquals(("testScan" + i).getBytes(), results.get(i).getRow());
|
||||
} else if (i == 5) {
|
||||
continue;
|
||||
} else {
|
||||
assertArrayEquals(("testScan" + (i + 1)).getBytes(), results.get(i)
|
||||
.getRow());
|
||||
}
|
||||
}
|
||||
|
||||
// check that we are at the end of the scan
|
||||
results = handler.getScannerRows(scanId, 9);
|
||||
assertEquals(0, results.size());
|
||||
|
||||
// close scanner and check that it was indeed closed
|
||||
handler.closeScanner(scanId);
|
||||
try {
|
||||
handler.getScannerRows(scanId, 9);
|
||||
fail("Scanner id should be invalid");
|
||||
} catch (TIllegalArgument e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetScannerResultsWithAuthorizations() throws Exception {
|
||||
ThriftHBaseServiceHandler handler = createHandler();
|
||||
ByteBuffer table = wrap(tableAname);
|
||||
|
||||
// insert data
|
||||
TColumnValue columnValue = new TColumnValue(wrap(familyAname),
|
||||
wrap(qualifierAname), wrap(valueAname));
|
||||
List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
|
||||
columnValues.add(columnValue);
|
||||
for (int i = 0; i < 20; i++) {
|
||||
TPut put = new TPut(
|
||||
wrap(("testGetScannerResults" + pad(i, (byte) 2)).getBytes()),
|
||||
columnValues);
|
||||
if (i == 3) {
|
||||
put.setCellVisibility(new TCellVisibility().setExpression(PUBLIC));
|
||||
} else {
|
||||
put.setCellVisibility(new TCellVisibility().setExpression("(" + SECRET
|
||||
+ "|" + CONFIDENTIAL + ")" + "&" + "!" + TOPSECRET));
|
||||
}
|
||||
handler.put(table, put);
|
||||
}
|
||||
|
||||
// create scan instance
|
||||
TScan scan = new TScan();
|
||||
List<TColumn> columns = new ArrayList<TColumn>();
|
||||
TColumn column = new TColumn();
|
||||
column.setFamily(familyAname);
|
||||
column.setQualifier(qualifierAname);
|
||||
columns.add(column);
|
||||
scan.setColumns(columns);
|
||||
scan.setStartRow("testGetScannerResults".getBytes());
|
||||
|
||||
// get 5 rows and check the returned results
|
||||
scan.setStopRow("testGetScannerResults05".getBytes());
|
||||
TAuthorization tauth = new TAuthorization();
|
||||
List<String> labels = new ArrayList<String>();
|
||||
labels.add(SECRET);
|
||||
labels.add(PRIVATE);
|
||||
tauth.setLabels(labels);
|
||||
scan.setAuthorizations(tauth);
|
||||
List<TResult> results = handler.getScannerResults(table, scan, 5);
|
||||
assertEquals(4, results.size());
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (i < 3) {
|
||||
assertArrayEquals(
|
||||
("testGetScannerResults" + pad(i, (byte) 2)).getBytes(),
|
||||
results.get(i).getRow());
|
||||
} else if (i == 3) {
|
||||
continue;
|
||||
} else {
|
||||
assertArrayEquals(
|
||||
("testGetScannerResults" + pad(i + 1, (byte) 2)).getBytes(), results
|
||||
.get(i).getRow());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetsWithLabels() throws Exception {
|
||||
ThriftHBaseServiceHandler handler = createHandler();
|
||||
byte[] rowName = "testPutGet".getBytes();
|
||||
ByteBuffer table = wrap(tableAname);
|
||||
|
||||
List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
|
||||
columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname),
|
||||
wrap(valueAname)));
|
||||
columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname),
|
||||
wrap(valueBname)));
|
||||
TPut put = new TPut(wrap(rowName), columnValues);
|
||||
|
||||
put.setColumnValues(columnValues);
|
||||
put.setCellVisibility(new TCellVisibility().setExpression("(" + SECRET + "|"
|
||||
+ CONFIDENTIAL + ")" + "&" + "!" + TOPSECRET));
|
||||
handler.put(table, put);
|
||||
TGet get = new TGet(wrap(rowName));
|
||||
TAuthorization tauth = new TAuthorization();
|
||||
List<String> labels = new ArrayList<String>();
|
||||
labels.add(SECRET);
|
||||
labels.add(PRIVATE);
|
||||
tauth.setLabels(labels);
|
||||
get.setAuthorizations(tauth);
|
||||
TResult result = handler.get(table, get);
|
||||
assertArrayEquals(rowName, result.getRow());
|
||||
List<TColumnValue> returnedColumnValues = result.getColumnValues();
|
||||
assertTColumnValuesEqual(columnValues, returnedColumnValues);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncrementWithTags() throws Exception {
|
||||
ThriftHBaseServiceHandler handler = createHandler();
|
||||
byte[] rowName = "testIncrementWithTags".getBytes();
|
||||
ByteBuffer table = wrap(tableAname);
|
||||
|
||||
List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
|
||||
columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname),
|
||||
wrap(Bytes.toBytes(1L))));
|
||||
TPut put = new TPut(wrap(rowName), columnValues);
|
||||
put.setColumnValues(columnValues);
|
||||
put.setCellVisibility(new TCellVisibility().setExpression(PRIVATE));
|
||||
handler.put(table, put);
|
||||
|
||||
List<TColumnIncrement> incrementColumns = new ArrayList<TColumnIncrement>();
|
||||
incrementColumns.add(new TColumnIncrement(wrap(familyAname),
|
||||
wrap(qualifierAname)));
|
||||
TIncrement increment = new TIncrement(wrap(rowName), incrementColumns);
|
||||
increment.setCellVisibility(new TCellVisibility().setExpression(SECRET));
|
||||
handler.increment(table, increment);
|
||||
|
||||
TGet get = new TGet(wrap(rowName));
|
||||
TAuthorization tauth = new TAuthorization();
|
||||
List<String> labels = new ArrayList<String>();
|
||||
labels.add(SECRET);
|
||||
tauth.setLabels(labels);
|
||||
get.setAuthorizations(tauth);
|
||||
TResult result = handler.get(table, get);
|
||||
|
||||
assertArrayEquals(rowName, result.getRow());
|
||||
assertEquals(1, result.getColumnValuesSize());
|
||||
TColumnValue columnValue = result.getColumnValues().get(0);
|
||||
assertArrayEquals(Bytes.toBytes(2L), columnValue.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncrementWithTagsWithNotMatchLabels() throws Exception {
|
||||
ThriftHBaseServiceHandler handler = createHandler();
|
||||
byte[] rowName = "testIncrementWithTagsWithNotMatchLabels".getBytes();
|
||||
ByteBuffer table = wrap(tableAname);
|
||||
|
||||
List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
|
||||
columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname),
|
||||
wrap(Bytes.toBytes(1L))));
|
||||
TPut put = new TPut(wrap(rowName), columnValues);
|
||||
put.setColumnValues(columnValues);
|
||||
put.setCellVisibility(new TCellVisibility().setExpression(PRIVATE));
|
||||
handler.put(table, put);
|
||||
|
||||
List<TColumnIncrement> incrementColumns = new ArrayList<TColumnIncrement>();
|
||||
incrementColumns.add(new TColumnIncrement(wrap(familyAname),
|
||||
wrap(qualifierAname)));
|
||||
TIncrement increment = new TIncrement(wrap(rowName), incrementColumns);
|
||||
increment.setCellVisibility(new TCellVisibility().setExpression(SECRET));
|
||||
handler.increment(table, increment);
|
||||
|
||||
TGet get = new TGet(wrap(rowName));
|
||||
TAuthorization tauth = new TAuthorization();
|
||||
List<String> labels = new ArrayList<String>();
|
||||
labels.add(PUBLIC);
|
||||
tauth.setLabels(labels);
|
||||
get.setAuthorizations(tauth);
|
||||
TResult result = handler.get(table, get);
|
||||
assertNull(result.getRow());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAppend() throws Exception {
|
||||
ThriftHBaseServiceHandler handler = createHandler();
|
||||
byte[] rowName = "testAppend".getBytes();
|
||||
ByteBuffer table = wrap(tableAname);
|
||||
byte[] v1 = Bytes.toBytes(1L);
|
||||
byte[] v2 = Bytes.toBytes(5L);
|
||||
List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
|
||||
columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname),
|
||||
wrap(Bytes.toBytes(1L))));
|
||||
TPut put = new TPut(wrap(rowName), columnValues);
|
||||
put.setColumnValues(columnValues);
|
||||
put.setCellVisibility(new TCellVisibility().setExpression(PRIVATE));
|
||||
handler.put(table, put);
|
||||
|
||||
List<TColumnValue> appendColumns = new ArrayList<TColumnValue>();
|
||||
appendColumns.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname),
|
||||
wrap(v2)));
|
||||
TAppend append = new TAppend(wrap(rowName), appendColumns);
|
||||
append.setCellVisibility(new TCellVisibility().setExpression(SECRET));
|
||||
handler.append(table, append);
|
||||
|
||||
TGet get = new TGet(wrap(rowName));
|
||||
TAuthorization tauth = new TAuthorization();
|
||||
List<String> labels = new ArrayList<String>();
|
||||
labels.add(SECRET);
|
||||
tauth.setLabels(labels);
|
||||
get.setAuthorizations(tauth);
|
||||
TResult result = handler.get(table, get);
|
||||
|
||||
assertArrayEquals(rowName, result.getRow());
|
||||
assertEquals(1, result.getColumnValuesSize());
|
||||
TColumnValue columnValue = result.getColumnValues().get(0);
|
||||
assertArrayEquals(Bytes.add(v1, v2), columnValue.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Padding numbers to make comparison of sort order easier in a for loop
|
||||
*
|
||||
* @param n
|
||||
* The number to pad.
|
||||
* @param pad
|
||||
* The length to pad up to.
|
||||
* @return The padded number as a string.
|
||||
*/
|
||||
private String pad(int n, byte pad) {
|
||||
String res = Integer.toString(n);
|
||||
while (res.length() < pad)
|
||||
res = "0" + res;
|
||||
return res;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue