Skip to content
Browse files

Upgrade thrift version to 0.9.0

Patch by jfarrell; reviewed by tjake for CASSANDRA-3719
  • Loading branch information...
1 parent ec361ab commit b153d45644b1af0e645fcb3cdc1c835949289e41 @tjake tjake committed
Showing with 17,770 additions and 8,212 deletions.
  1. +1 −1 CHANGES.txt
  2. +1 −1 build.xml
  3. +95 −38 interface/thrift/gen-java/org/apache/cassandra/thrift/AuthenticationException.java
  4. +132 −57 interface/thrift/gen-java/org/apache/cassandra/thrift/AuthenticationRequest.java
  5. +95 −38 interface/thrift/gen-java/org/apache/cassandra/thrift/AuthorizationException.java
  6. +11,404 −5,080 interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
  7. +1,105 −646 interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java
  8. +133 −70 interface/thrift/gen-java/org/apache/cassandra/thrift/CfSplit.java
  9. +181 −90 interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
  10. +230 −114 interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnDef.java
  11. +206 −89 interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnOrSuperColumn.java
  12. +124 −52 interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnParent.java
  13. +150 −67 interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnPath.java
  14. +2 −1 interface/thrift/gen-java/org/apache/cassandra/thrift/Compression.java
  15. +2 −1 interface/thrift/gen-java/org/apache/cassandra/thrift/ConsistencyLevel.java
  16. +117 −58 interface/thrift/gen-java/org/apache/cassandra/thrift/CounterColumn.java
  17. +144 −67 interface/thrift/gen-java/org/apache/cassandra/thrift/CounterSuperColumn.java
  18. +218 −113 interface/thrift/gen-java/org/apache/cassandra/thrift/CqlMetadata.java
  19. +241 −127 interface/thrift/gen-java/org/apache/cassandra/thrift/CqlPreparedResult.java
  20. +219 −107 interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java
  21. +2 −1 interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResultType.java
  22. +144 −67 interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java
  23. +169 −77 interface/thrift/gen-java/org/apache/cassandra/thrift/Deletion.java
  24. +154 −64 interface/thrift/gen-java/org/apache/cassandra/thrift/EndpointDetails.java
  25. +167 −88 interface/thrift/gen-java/org/apache/cassandra/thrift/IndexClause.java
  26. +126 −61 interface/thrift/gen-java/org/apache/cassandra/thrift/IndexExpression.java
  27. +2 −1 interface/thrift/gen-java/org/apache/cassandra/thrift/IndexOperator.java
  28. +2 −1 interface/thrift/gen-java/org/apache/cassandra/thrift/IndexType.java
  29. +95 −38 interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
  30. +117 −58 interface/thrift/gen-java/org/apache/cassandra/thrift/KeyCount.java
  31. +269 −139 interface/thrift/gen-java/org/apache/cassandra/thrift/KeyRange.java
  32. +144 −67 interface/thrift/gen-java/org/apache/cassandra/thrift/KeySlice.java
  33. +285 −152 interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java
  34. +144 −57 interface/thrift/gen-java/org/apache/cassandra/thrift/Mutation.java
  35. +79 −25 interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
  36. +79 −25 interface/thrift/gen-java/org/apache/cassandra/thrift/SchemaDisagreementException.java
  37. +171 −73 interface/thrift/gen-java/org/apache/cassandra/thrift/SlicePredicate.java
  38. +153 −87 interface/thrift/gen-java/org/apache/cassandra/thrift/SliceRange.java
  39. +144 −67 interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
  40. +140 −64 interface/thrift/gen-java/org/apache/cassandra/thrift/TimedOutException.java
  41. +280 −143 interface/thrift/gen-java/org/apache/cassandra/thrift/TokenRange.java
  42. +79 −25 interface/thrift/gen-java/org/apache/cassandra/thrift/UnavailableException.java
  43. +12 −2 interface/thrift/gen-java/org/apache/cassandra/thrift/{Constants.java → cassandraConstants.java}
  44. BIN lib/libthrift-0.7.0.jar
  45. BIN lib/libthrift-0.9.0.jar
  46. 0 lib/licenses/{libthrift-0.7.txt → libthrift-0.9.txt}
  47. +4 −4 src/java/org/apache/cassandra/cli/CliMain.java
  48. +2 −2 src/java/org/apache/cassandra/db/SystemTable.java
  49. +4 −4 src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java
  50. +3 −3 src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
Sorry, we could not display the entire diff because it was too big.
View
2 CHANGES.txt
@@ -3,7 +3,7 @@
* add default_tim_to_live (CASSANDRA-3974)
* add memtable_flush_period_in_ms (CASSANDRA-4237)
* replace supercolumns internally by composites (CASSANDRA-3237)
-
+ * upgrade thrift to 0.9.0 (CASSANDRA-3719)
1.2.1
* add inter_dc_tcp_nodelay setting (CASSANDRA-5148)
View
2 build.xml
@@ -356,7 +356,7 @@
<exclusion groupId="org.apache.velocity" artifactId="velocity"/>
</dependency>
- <dependency groupId="org.apache.thrift" artifactId="libthrift" version="0.7.0"/>
+ <dependency groupId="org.apache.thrift" artifactId="libthrift" version="0.9.0"/>
<dependency groupId="com.thoughtworks.paranamer" artifactId="paranamer-ant" version="2.1"/>
<dependency groupId="junit" artifactId="junit" version="4.6" />
View
133 interface/thrift/gen-java/org/apache/cassandra/thrift/AuthenticationException.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * 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.cassandra.thrift;
/*
@@ -27,6 +28,15 @@
import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
@@ -45,11 +55,17 @@
/**
* invalid authentication request (invalid keyspace, user does not exist, or credentials invalid)
*/
-public class AuthenticationException extends Exception implements org.apache.thrift.TBase<AuthenticationException, AuthenticationException._Fields>, java.io.Serializable, Cloneable {
+public class AuthenticationException extends TException implements org.apache.thrift.TBase<AuthenticationException, AuthenticationException._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthenticationException");
private static final org.apache.thrift.protocol.TField WHY_FIELD_DESC = new org.apache.thrift.protocol.TField("why", 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 AuthenticationExceptionStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new AuthenticationExceptionTupleSchemeFactory());
+ }
+
public String why; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -111,7 +127,6 @@ public String getFieldName() {
}
// isset id assignments
-
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);
@@ -271,44 +286,11 @@ public _Fields fieldForId(int fieldId) {
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // WHY
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.why = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.why != null) {
- oprot.writeFieldBegin(WHY_FIELD_DESC);
- oprot.writeString(this.why);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -332,6 +314,7 @@ public void validate() throws org.apache.thrift.TException {
if (why == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'why' was not present! Struct: " + toString());
}
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -350,5 +333,79 @@ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException
}
}
+ private static class AuthenticationExceptionStandardSchemeFactory implements SchemeFactory {
+ public AuthenticationExceptionStandardScheme getScheme() {
+ return new AuthenticationExceptionStandardScheme();
+ }
+ }
+
+ private static class AuthenticationExceptionStandardScheme extends StandardScheme<AuthenticationException> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, AuthenticationException 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: // WHY
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.why = iprot.readString();
+ struct.setWhyIsSet(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, AuthenticationException struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.why != null) {
+ oprot.writeFieldBegin(WHY_FIELD_DESC);
+ oprot.writeString(struct.why);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class AuthenticationExceptionTupleSchemeFactory implements SchemeFactory {
+ public AuthenticationExceptionTupleScheme getScheme() {
+ return new AuthenticationExceptionTupleScheme();
+ }
+ }
+
+ private static class AuthenticationExceptionTupleScheme extends TupleScheme<AuthenticationException> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, AuthenticationException struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeString(struct.why);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, AuthenticationException struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.why = iprot.readString();
+ struct.setWhyIsSet(true);
+ }
+ }
+
}
View
189 interface/thrift/gen-java/org/apache/cassandra/thrift/AuthenticationRequest.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * 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.cassandra.thrift;
/*
@@ -27,6 +28,15 @@
import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
@@ -50,6 +60,12 @@
private static final org.apache.thrift.protocol.TField CREDENTIALS_FIELD_DESC = new org.apache.thrift.protocol.TField("credentials", org.apache.thrift.protocol.TType.MAP, (short)1);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new AuthenticationRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new AuthenticationRequestTupleSchemeFactory());
+ }
+
public Map<String,String> credentials; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -111,7 +127,6 @@ public String getFieldName() {
}
// isset id assignments
-
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);
@@ -296,64 +311,11 @@ public _Fields fieldForId(int fieldId) {
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // CREDENTIALS
- if (field.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map36 = iprot.readMapBegin();
- this.credentials = new HashMap<String,String>(2*_map36.size);
- for (int _i37 = 0; _i37 < _map36.size; ++_i37)
- {
- String _key38; // required
- String _val39; // required
- _key38 = iprot.readString();
- _val39 = iprot.readString();
- this.credentials.put(_key38, _val39);
- }
- iprot.readMapEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.credentials != null) {
- oprot.writeFieldBegin(CREDENTIALS_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.credentials.size()));
- for (Map.Entry<String, String> _iter40 : this.credentials.entrySet())
- {
- oprot.writeString(_iter40.getKey());
- oprot.writeString(_iter40.getValue());
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -377,6 +339,7 @@ public void validate() throws org.apache.thrift.TException {
if (credentials == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'credentials' was not present! Struct: " + toString());
}
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -395,5 +358,117 @@ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException
}
}
+ private static class AuthenticationRequestStandardSchemeFactory implements SchemeFactory {
+ public AuthenticationRequestStandardScheme getScheme() {
+ return new AuthenticationRequestStandardScheme();
+ }
+ }
+
+ private static class AuthenticationRequestStandardScheme extends StandardScheme<AuthenticationRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, AuthenticationRequest 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: // CREDENTIALS
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map72 = iprot.readMapBegin();
+ struct.credentials = new HashMap<String,String>(2*_map72.size);
+ for (int _i73 = 0; _i73 < _map72.size; ++_i73)
+ {
+ String _key74; // required
+ String _val75; // required
+ _key74 = iprot.readString();
+ _val75 = iprot.readString();
+ struct.credentials.put(_key74, _val75);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setCredentialsIsSet(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, AuthenticationRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.credentials != null) {
+ oprot.writeFieldBegin(CREDENTIALS_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.credentials.size()));
+ for (Map.Entry<String, String> _iter76 : struct.credentials.entrySet())
+ {
+ oprot.writeString(_iter76.getKey());
+ oprot.writeString(_iter76.getValue());
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class AuthenticationRequestTupleSchemeFactory implements SchemeFactory {
+ public AuthenticationRequestTupleScheme getScheme() {
+ return new AuthenticationRequestTupleScheme();
+ }
+ }
+
+ private static class AuthenticationRequestTupleScheme extends TupleScheme<AuthenticationRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, AuthenticationRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ {
+ oprot.writeI32(struct.credentials.size());
+ for (Map.Entry<String, String> _iter77 : struct.credentials.entrySet())
+ {
+ oprot.writeString(_iter77.getKey());
+ oprot.writeString(_iter77.getValue());
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, AuthenticationRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ {
+ org.apache.thrift.protocol.TMap _map78 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.credentials = new HashMap<String,String>(2*_map78.size);
+ for (int _i79 = 0; _i79 < _map78.size; ++_i79)
+ {
+ String _key80; // required
+ String _val81; // required
+ _key80 = iprot.readString();
+ _val81 = iprot.readString();
+ struct.credentials.put(_key80, _val81);
+ }
+ }
+ struct.setCredentialsIsSet(true);
+ }
+ }
+
}
View
133 interface/thrift/gen-java/org/apache/cassandra/thrift/AuthorizationException.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * 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.cassandra.thrift;
/*
@@ -27,6 +28,15 @@
import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
@@ -45,11 +55,17 @@
/**
* invalid authorization request (user does not have access to keyspace)
*/
-public class AuthorizationException extends Exception implements org.apache.thrift.TBase<AuthorizationException, AuthorizationException._Fields>, java.io.Serializable, Cloneable {
+public class AuthorizationException extends TException implements org.apache.thrift.TBase<AuthorizationException, AuthorizationException._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthorizationException");
private static final org.apache.thrift.protocol.TField WHY_FIELD_DESC = new org.apache.thrift.protocol.TField("why", 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 AuthorizationExceptionStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new AuthorizationExceptionTupleSchemeFactory());
+ }
+
public String why; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -111,7 +127,6 @@ public String getFieldName() {
}
// isset id assignments
-
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);
@@ -271,44 +286,11 @@ public _Fields fieldForId(int fieldId) {
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // WHY
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.why = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.why != null) {
- oprot.writeFieldBegin(WHY_FIELD_DESC);
- oprot.writeString(this.why);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -332,6 +314,7 @@ public void validate() throws org.apache.thrift.TException {
if (why == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'why' was not present! Struct: " + toString());
}
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -350,5 +333,79 @@ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException
}
}
+ private static class AuthorizationExceptionStandardSchemeFactory implements SchemeFactory {
+ public AuthorizationExceptionStandardScheme getScheme() {
+ return new AuthorizationExceptionStandardScheme();
+ }
+ }
+
+ private static class AuthorizationExceptionStandardScheme extends StandardScheme<AuthorizationException> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, AuthorizationException 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: // WHY
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.why = iprot.readString();
+ struct.setWhyIsSet(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, AuthorizationException struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.why != null) {
+ oprot.writeFieldBegin(WHY_FIELD_DESC);
+ oprot.writeString(struct.why);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class AuthorizationExceptionTupleSchemeFactory implements SchemeFactory {
+ public AuthorizationExceptionTupleScheme getScheme() {
+ return new AuthorizationExceptionTupleScheme();
+ }
+ }
+
+ private static class AuthorizationExceptionTupleScheme extends TupleScheme<AuthorizationException> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, AuthorizationException struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeString(struct.why);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, AuthorizationException struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.why = iprot.readString();
+ struct.setWhyIsSet(true);
+ }
+ }
+
}
View
16,484 interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
11,404 additions, 5,080 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
1,751 interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java
1,105 additions, 646 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
203 interface/thrift/gen-java/org/apache/cassandra/thrift/CfSplit.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * 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.cassandra.thrift;
/*
@@ -27,6 +28,15 @@
import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
@@ -52,6 +62,12 @@
private static final org.apache.thrift.protocol.TField END_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("end_token", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField ROW_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("row_count", org.apache.thrift.protocol.TType.I64, (short)3);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new CfSplitStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new CfSplitTupleSchemeFactory());
+ }
+
public String start_token; // required
public String end_token; // required
public long row_count; // required
@@ -122,8 +138,7 @@ public String getFieldName() {
// isset id assignments
private static final int __ROW_COUNT_ISSET_ID = 0;
- private BitSet __isset_bit_vector = new BitSet(1);
-
+ private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -156,8 +171,7 @@ public CfSplit(
* Performs a deep copy on <i>other</i>.
*/
public CfSplit(CfSplit other) {
- __isset_bit_vector.clear();
- __isset_bit_vector.or(other.__isset_bit_vector);
+ __isset_bitfield = other.__isset_bitfield;
if (other.isSetStart_token()) {
this.start_token = other.start_token;
}
@@ -238,16 +252,16 @@ public CfSplit setRow_count(long row_count) {
}
public void unsetRow_count() {
- __isset_bit_vector.clear(__ROW_COUNT_ISSET_ID);
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ROW_COUNT_ISSET_ID);
}
/** Returns true if field row_count is set (has been assigned a value) and false otherwise */
public boolean isSetRow_count() {
- return __isset_bit_vector.get(__ROW_COUNT_ISSET_ID);
+ return EncodingUtils.testBit(__isset_bitfield, __ROW_COUNT_ISSET_ID);
}
public void setRow_countIsSet(boolean value) {
- __isset_bit_vector.set(__ROW_COUNT_ISSET_ID, value);
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ROW_COUNT_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
@@ -422,70 +436,11 @@ public _Fields fieldForId(int fieldId) {
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // START_TOKEN
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.start_token = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // END_TOKEN
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.end_token = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 3: // ROW_COUNT
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.row_count = iprot.readI64();
- setRow_countIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- if (!isSetRow_count()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'row_count' was not found in serialized data! Struct: " + toString());
- }
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.start_token != null) {
- oprot.writeFieldBegin(START_TOKEN_FIELD_DESC);
- oprot.writeString(this.start_token);
- oprot.writeFieldEnd();
- }
- if (this.end_token != null) {
- oprot.writeFieldBegin(END_TOKEN_FIELD_DESC);
- oprot.writeString(this.end_token);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldBegin(ROW_COUNT_FIELD_DESC);
- oprot.writeI64(this.row_count);
- oprot.writeFieldEnd();
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -525,6 +480,7 @@ public void validate() throws org.apache.thrift.TException {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'end_token' was not present! Struct: " + toString());
}
// alas, we cannot check 'row_count' because it's a primitive and you chose the non-beans generator.
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -538,12 +494,119 @@ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOExcept
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bit_vector = new BitSet(1);
+ __isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
+ private static class CfSplitStandardSchemeFactory implements SchemeFactory {
+ public CfSplitStandardScheme getScheme() {
+ return new CfSplitStandardScheme();
+ }
+ }
+
+ private static class CfSplitStandardScheme extends StandardScheme<CfSplit> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, CfSplit 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: // START_TOKEN
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.start_token = iprot.readString();
+ struct.setStart_tokenIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // END_TOKEN
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.end_token = iprot.readString();
+ struct.setEnd_tokenIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // ROW_COUNT
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.row_count = iprot.readI64();
+ struct.setRow_countIsSet(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
+ if (!struct.isSetRow_count()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'row_count' was not found in serialized data! Struct: " + toString());
+ }
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, CfSplit struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.start_token != null) {
+ oprot.writeFieldBegin(START_TOKEN_FIELD_DESC);
+ oprot.writeString(struct.start_token);
+ oprot.writeFieldEnd();
+ }
+ if (struct.end_token != null) {
+ oprot.writeFieldBegin(END_TOKEN_FIELD_DESC);
+ oprot.writeString(struct.end_token);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(ROW_COUNT_FIELD_DESC);
+ oprot.writeI64(struct.row_count);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class CfSplitTupleSchemeFactory implements SchemeFactory {
+ public CfSplitTupleScheme getScheme() {
+ return new CfSplitTupleScheme();
+ }
+ }
+
+ private static class CfSplitTupleScheme extends TupleScheme<CfSplit> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, CfSplit struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeString(struct.start_token);
+ oprot.writeString(struct.end_token);
+ oprot.writeI64(struct.row_count);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, CfSplit struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.start_token = iprot.readString();
+ struct.setStart_tokenIsSet(true);
+ struct.end_token = iprot.readString();
+ struct.setEnd_tokenIsSet(true);
+ struct.row_count = iprot.readI64();
+ struct.setRow_countIsSet(true);
+ }
+ }
+
}
View
271 interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * 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.cassandra.thrift;
/*
@@ -27,6 +28,15 @@
import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
@@ -57,10 +67,16 @@
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 TTL_FIELD_DESC = new org.apache.thrift.protocol.TField("ttl", org.apache.thrift.protocol.TType.I32, (short)4);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new ColumnStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new ColumnTupleSchemeFactory());
+ }
+
public ByteBuffer name; // required
- public ByteBuffer value; // required
- public long timestamp; // required
- public int ttl; // required
+ public ByteBuffer value; // optional
+ public long timestamp; // optional
+ public int ttl; // 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 {
@@ -132,8 +148,8 @@ public String getFieldName() {
// isset id assignments
private static final int __TIMESTAMP_ISSET_ID = 0;
private static final int __TTL_ISSET_ID = 1;
- private BitSet __isset_bit_vector = new BitSet(2);
-
+ private byte __isset_bitfield = 0;
+ private _Fields optionals[] = {_Fields.VALUE,_Fields.TIMESTAMP,_Fields.TTL};
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);
@@ -163,8 +179,7 @@ public Column(
* Performs a deep copy on <i>other</i>.
*/
public Column(Column other) {
- __isset_bit_vector.clear();
- __isset_bit_vector.or(other.__isset_bit_vector);
+ __isset_bitfield = other.__isset_bitfield;
if (other.isSetName()) {
this.name = org.apache.thrift.TBaseHelper.copyBinary(other.name);
;
@@ -270,16 +285,16 @@ public Column setTimestamp(long timestamp) {
}
public void unsetTimestamp() {
- __isset_bit_vector.clear(__TIMESTAMP_ISSET_ID);
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
}
/** Returns true if field timestamp is set (has been assigned a value) and false otherwise */
public boolean isSetTimestamp() {
- return __isset_bit_vector.get(__TIMESTAMP_ISSET_ID);
+ return EncodingUtils.testBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
}
public void setTimestampIsSet(boolean value) {
- __isset_bit_vector.set(__TIMESTAMP_ISSET_ID, value);
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value);
}
public int getTtl() {
@@ -293,16 +308,16 @@ public Column setTtl(int ttl) {
}
public void unsetTtl() {
- __isset_bit_vector.clear(__TTL_ISSET_ID);
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TTL_ISSET_ID);
}
/** Returns true if field ttl is set (has been assigned a value) and false otherwise */
public boolean isSetTtl() {
- return __isset_bit_vector.get(__TTL_ISSET_ID);
+ return EncodingUtils.testBit(__isset_bitfield, __TTL_ISSET_ID);
}
public void setTtlIsSet(boolean value) {
- __isset_bit_vector.set(__TTL_ISSET_ID, value);
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TTL_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
@@ -514,84 +529,11 @@ public _Fields fieldForId(int fieldId) {
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // NAME
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.name = iprot.readBinary();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // VALUE
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.value = iprot.readBinary();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 3: // TIMESTAMP
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.timestamp = iprot.readI64();
- setTimestampIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 4: // TTL
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.ttl = iprot.readI32();
- setTtlIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.name != null) {
- oprot.writeFieldBegin(NAME_FIELD_DESC);
- oprot.writeBinary(this.name);
- oprot.writeFieldEnd();
- }
- if (this.value != null) {
- if (isSetValue()) {
- oprot.writeFieldBegin(VALUE_FIELD_DESC);
- oprot.writeBinary(this.value);
- oprot.writeFieldEnd();
- }
- }
- if (isSetTimestamp()) {
- oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
- oprot.writeI64(this.timestamp);
- oprot.writeFieldEnd();
- }
- if (isSetTtl()) {
- oprot.writeFieldBegin(TTL_FIELD_DESC);
- oprot.writeI32(this.ttl);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -637,6 +579,7 @@ public void validate() throws org.apache.thrift.TException {
if (name == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' was not present! Struct: " + toString());
}
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -650,12 +593,160 @@ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOExcept
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bit_vector = new BitSet(1);
+ __isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
+ private static class ColumnStandardSchemeFactory implements SchemeFactory {
+ public ColumnStandardScheme getScheme() {
+ return new ColumnStandardScheme();
+ }
+ }
+
+ private static class ColumnStandardScheme extends StandardScheme<Column> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, Column 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: // NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.name = iprot.readBinary();
+ struct.setNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // VALUE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.value = iprot.readBinary();
+ struct.setValueIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // TIMESTAMP
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.timestamp = iprot.readI64();
+ struct.setTimestampIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // TTL
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.ttl = iprot.readI32();
+ struct.setTtlIsSet(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, Column struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.name != null) {
+ oprot.writeFieldBegin(NAME_FIELD_DESC);
+ oprot.writeBinary(struct.name);
+ oprot.writeFieldEnd();
+ }
+ if (struct.value != null) {
+ if (struct.isSetValue()) {
+ oprot.writeFieldBegin(VALUE_FIELD_DESC);
+ oprot.writeBinary(struct.value);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.isSetTimestamp()) {
+ oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
+ oprot.writeI64(struct.timestamp);
+ oprot.writeFieldEnd();
+ }
+ if (struct.isSetTtl()) {
+ oprot.writeFieldBegin(TTL_FIELD_DESC);
+ oprot.writeI32(struct.ttl);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class ColumnTupleSchemeFactory implements SchemeFactory {
+ public ColumnTupleScheme getScheme() {
+ return new ColumnTupleScheme();
+ }
+ }
+
+ private static class ColumnTupleScheme extends TupleScheme<Column> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, Column struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeBinary(struct.name);
+ BitSet optionals = new BitSet();
+ if (struct.isSetValue()) {
+ optionals.set(0);
+ }
+ if (struct.isSetTimestamp()) {
+ optionals.set(1);
+ }
+ if (struct.isSetTtl()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetValue()) {
+ oprot.writeBinary(struct.value);
+ }
+ if (struct.isSetTimestamp()) {
+ oprot.writeI64(struct.timestamp);
+ }
+ if (struct.isSetTtl()) {
+ oprot.writeI32(struct.ttl);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, Column struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.name = iprot.readBinary();
+ struct.setNameIsSet(true);
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct.value = iprot.readBinary();
+ struct.setValueIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.timestamp = iprot.readI64();
+ struct.setTimestampIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.ttl = iprot.readI32();
+ struct.setTtlIsSet(true);
+ }
+ }
+ }
+
}
View
344 interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnDef.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * 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.cassandra.thrift;
/*
@@ -27,6 +28,15 @@
import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
@@ -51,15 +61,21 @@
private static final org.apache.thrift.protocol.TField INDEX_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("index_name", org.apache.thrift.protocol.TType.STRING, (short)4);
private static final org.apache.thrift.protocol.TField INDEX_OPTIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("index_options", org.apache.thrift.protocol.TType.MAP, (short)5);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new ColumnDefStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new ColumnDefTupleSchemeFactory());
+ }
+
public ByteBuffer name; // required
public String validation_class; // required
/**
*
* @see IndexType
*/
- public IndexType index_type; // required
- public String index_name; // required
- public Map<String,String> index_options; // required
+ public IndexType index_type; // optional
+ public String index_name; // optional
+ public Map<String,String> index_options; // 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 {
@@ -136,7 +152,7 @@ public String getFieldName() {
}
// isset id assignments
-
+ private _Fields optionals[] = {_Fields.INDEX_TYPE,_Fields.INDEX_NAME,_Fields.INDEX_OPTIONS};
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);
@@ -610,118 +626,11 @@ public _Fields fieldForId(int fieldId) {
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // NAME
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.name = iprot.readBinary();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // VALIDATION_CLASS
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.validation_class = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 3: // INDEX_TYPE
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.index_type = IndexType.findByValue(iprot.readI32());
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 4: // INDEX_NAME
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.index_name = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 5: // INDEX_OPTIONS
- if (field.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map41 = iprot.readMapBegin();
- this.index_options = new HashMap<String,String>(2*_map41.size);
- for (int _i42 = 0; _i42 < _map41.size; ++_i42)
- {
- String _key43; // required
- String _val44; // required
- _key43 = iprot.readString();
- _val44 = iprot.readString();
- this.index_options.put(_key43, _val44);
- }
- iprot.readMapEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.name != null) {
- oprot.writeFieldBegin(NAME_FIELD_DESC);
- oprot.writeBinary(this.name);
- oprot.writeFieldEnd();
- }
- if (this.validation_class != null) {
- oprot.writeFieldBegin(VALIDATION_CLASS_FIELD_DESC);
- oprot.writeString(this.validation_class);
- oprot.writeFieldEnd();
- }
- if (this.index_type != null) {
- if (isSetIndex_type()) {
- oprot.writeFieldBegin(INDEX_TYPE_FIELD_DESC);
- oprot.writeI32(this.index_type.getValue());
- oprot.writeFieldEnd();
- }
- }
- if (this.index_name != null) {
- if (isSetIndex_name()) {
- oprot.writeFieldBegin(INDEX_NAME_FIELD_DESC);
- oprot.writeString(this.index_name);
- oprot.writeFieldEnd();
- }
- }
- if (this.index_options != null) {
- if (isSetIndex_options()) {
- oprot.writeFieldBegin(INDEX_OPTIONS_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.index_options.size()));
- for (Map.Entry<String, String> _iter45 : this.index_options.entrySet())
- {
- oprot.writeString(_iter45.getKey());
- oprot.writeString(_iter45.getValue());
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -786,6 +695,7 @@ public void validate() throws org.apache.thrift.TException {
if (validation_class == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'validation_class' was not present! Struct: " + toString());
}
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -804,5 +714,211 @@ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException
}
}
+ private static class ColumnDefStandardSchemeFactory implements SchemeFactory {
+ public ColumnDefStandardScheme getScheme() {
+ return new ColumnDefStandardScheme();
+ }
+ }
+
+ private static class ColumnDefStandardScheme extends StandardScheme<ColumnDef> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, ColumnDef 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: // NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.name = iprot.readBinary();
+ struct.setNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // VALIDATION_CLASS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.validation_class = iprot.readString();
+ struct.setValidation_classIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // INDEX_TYPE
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.index_type = IndexType.findByValue(iprot.readI32());
+ struct.setIndex_typeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // INDEX_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.index_name = iprot.readString();
+ struct.setIndex_nameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // INDEX_OPTIONS
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map82 = iprot.readMapBegin();
+ struct.index_options = new HashMap<String,String>(2*_map82.size);
+ for (int _i83 = 0; _i83 < _map82.size; ++_i83)
+ {
+ String _key84; // required
+ String _val85; // required
+ _key84 = iprot.readString();
+ _val85 = iprot.readString();
+ struct.index_options.put(_key84, _val85);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setIndex_optionsIsSet(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, ColumnDef struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.name != null) {
+ oprot.writeFieldBegin(NAME_FIELD_DESC);
+ oprot.writeBinary(struct.name);
+ oprot.writeFieldEnd();
+ }
+ if (struct.validation_class != null) {
+ oprot.writeFieldBegin(VALIDATION_CLASS_FIELD_DESC);
+ oprot.writeString(struct.validation_class);
+ oprot.writeFieldEnd();
+ }
+ if (struct.index_type != null) {
+ if (struct.isSetIndex_type()) {
+ oprot.writeFieldBegin(INDEX_TYPE_FIELD_DESC);
+ oprot.writeI32(struct.index_type.getValue());
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.index_name != null) {
+ if (struct.isSetIndex_name()) {
+ oprot.writeFieldBegin(INDEX_NAME_FIELD_DESC);
+ oprot.writeString(struct.index_name);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.index_options != null) {
+ if (struct.isSetIndex_options()) {
+ oprot.writeFieldBegin(INDEX_OPTIONS_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.index_options.size()));
+ for (Map.Entry<String, String> _iter86 : struct.index_options.entrySet())
+ {
+ oprot.writeString(_iter86.getKey());
+ oprot.writeString(_iter86.getValue());
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class ColumnDefTupleSchemeFactory implements SchemeFactory {
+ public ColumnDefTupleScheme getScheme() {
+ return new ColumnDefTupleScheme();
+ }
+ }
+
+ private static class ColumnDefTupleScheme extends TupleScheme<ColumnDef> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, ColumnDef struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeBinary(struct.name);
+ oprot.writeString(struct.validation_class);
+ BitSet optionals = new BitSet();
+ if (struct.isSetIndex_type()) {
+ optionals.set(0);
+ }
+ if (struct.isSetIndex_name()) {
+ optionals.set(1);
+ }
+ if (struct.isSetIndex_options()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetIndex_type()) {
+ oprot.writeI32(struct.index_type.getValue());
+ }
+ if (struct.isSetIndex_name()) {
+ oprot.writeString(struct.index_name);
+ }
+ if (struct.isSetIndex_options()) {
+ {
+ oprot.writeI32(struct.index_options.size());
+ for (Map.Entry<String, String> _iter87 : struct.index_options.entrySet())
+ {
+ oprot.writeString(_iter87.getKey());
+ oprot.writeString(_iter87.getValue());
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, ColumnDef struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.name = iprot.readBinary();
+ struct.setNameIsSet(true);
+ struct.validation_class = iprot.readString();
+ struct.setValidation_classIsSet(true);
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct.index_type = IndexType.findByValue(iprot.readI32());
+ struct.setIndex_typeIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.index_name = iprot.readString();
+ struct.setIndex_nameIsSet(true);
+ }
+ if (incoming.get(2)) {
+ {
+ org.apache.thrift.protocol.TMap _map88 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.index_options = new HashMap<String,String>(2*_map88.size);
+ for (int _i89 = 0; _i89 < _map88.size; ++_i89)
+ {
+ String _key90; // required
+ String _val91; // required
+ _key90 = iprot.readString();
+ _val91 = iprot.readString();
+ struct.index_options.put(_key90, _val91);
+ }
+ }
+ struct.setIndex_optionsIsSet(true);
+ }
+ }
+ }
+
}
View
295 interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnOrSuperColumn.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * 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.cassandra.thrift;
/*
@@ -27,6 +28,15 @@
import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
@@ -65,10 +75,16 @@
private static final org.apache.thrift.protocol.TField COUNTER_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("counter_column", org.apache.thrift.protocol.TType.STRUCT, (short)3);
private static final org.apache.thrift.protocol.TField COUNTER_SUPER_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("counter_super_column", org.apache.thrift.protocol.TType.STRUCT, (short)4);
- public Column column; // required
- public SuperColumn super_column; // required
- public CounterColumn counter_column; // required
- public CounterSuperColumn counter_super_column; // required
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new ColumnOrSuperColumnStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new ColumnOrSuperColumnTupleSchemeFactory());
+ }
+
+ public Column column; // optional
+ public SuperColumn super_column; // optional
+ public CounterColumn counter_column; // optional
+ public CounterSuperColumn counter_super_column; // 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 {
@@ -138,7 +154,7 @@ public String getFieldName() {
}
// isset id assignments
-
+ private _Fields optionals[] = {_Fields.COLUMN,_Fields.SUPER_COLUMN,_Fields.COUNTER_COLUMN,_Fields.COUNTER_SUPER_COLUMN};
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);
@@ -492,92 +508,11 @@ public _Fields fieldForId(int fieldId) {
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // COLUMN
- if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
- this.column = new Column();
- this.column.read(iprot);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // SUPER_COLUMN
- if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
- this.super_column = new SuperColumn();
- this.super_column.read(iprot);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 3: // COUNTER_COLUMN
- if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
- this.counter_column = new CounterColumn();
- this.counter_column.read(iprot);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 4: // COUNTER_SUPER_COLUMN
- if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
- this.counter_super_column = new CounterSuperColumn();
- this.counter_super_column.read(iprot);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.column != null) {
- if (isSetColumn()) {
- oprot.writeFieldBegin(COLUMN_FIELD_DESC);
- this.column.write(oprot);
- oprot.writeFieldEnd();
- }
- }
- if (this.super_column != null) {
- if (isSetSuper_column()) {
- oprot.writeFieldBegin(SUPER_COLUMN_FIELD_DESC);
- this.super_column.write(oprot);
- oprot.writeFieldEnd();
- }
- }
- if (this.counter_column != null) {
- if (isSetCounter_column()) {
- oprot.writeFieldBegin(COUNTER_COLUMN_FIELD_DESC);
- this.counter_column.write(oprot);
- oprot.writeFieldEnd();
- }
- }
- if (this.counter_super_column != null) {
- if (isSetCounter_super_column()) {
- oprot.writeFieldBegin(COUNTER_SUPER_COLUMN_FIELD_DESC);
- this.counter_super_column.write(oprot);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -630,6 +565,19 @@ public String toString() {
public void validate() throws org.apache.thrift.TException {
// check for required fields
+ // check for sub-struct validity
+ if (column != null) {
+ column.validate();
+ }
+ if (super_column != null) {
+ super_column.validate();
+ }
+ if (counter_column != null) {
+ counter_column.validate();
+ }
+ if (counter_super_column != null) {
+ counter_super_column.validate();
+ }
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -648,5 +596,174 @@ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException
}
}
+ private static class ColumnOrSuperColumnStandardSchemeFactory implements SchemeFactory {
+ public ColumnOrSuperColumnStandardScheme getScheme() {
+ return new ColumnOrSuperColumnStandardScheme();
+ }
+ }
+
+ private static class ColumnOrSuperColumnStandardScheme extends StandardScheme<ColumnOrSuperColumn> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, ColumnOrSuperColumn 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: // COLUMN
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.column = new Column();
+ struct.column.read(iprot);
+ struct.setColumnIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // SUPER_COLUMN
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.super_column = new SuperColumn();
+ struct.super_column.read(iprot);
+ struct.setSuper_columnIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // COUNTER_COLUMN
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.counter_column = new CounterColumn();
+ struct.counter_column.read(iprot);
+ struct.setCounter_columnIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // COUNTER_SUPER_COLUMN
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.counter_super_column = new CounterSuperColumn();
+ struct.counter_super_column.read(iprot);
+ struct.setCounter_super_columnIsSet(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, ColumnOrSuperColumn struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.column != null) {
+ if (struct.isSetColumn()) {
+ oprot.writeFieldBegin(COLUMN_FIELD_DESC);
+ struct.column.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.super_column != null) {
+ if (struct.isSetSuper_column()) {
+ oprot.writeFieldBegin(SUPER_COLUMN_FIELD_DESC);
+ struct.super_column.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.counter_column != null) {
+ if (struct.isSetCounter_column()) {
+ oprot.writeFieldBegin(COUNTER_COLUMN_FIELD_DESC);
+ struct.counter_column.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.counter_super_column != null) {
+ if (struct.isSetCounter_super_column()) {
+ oprot.writeFieldBegin(COUNTER_SUPER_COLUMN_FIELD_DESC);
+ struct.counter_super_column.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class ColumnOrSuperColumnTupleSchemeFactory implements SchemeFactory {
+ public ColumnOrSuperColumnTupleScheme getScheme() {
+ return new ColumnOrSuperColumnTupleScheme();
+ }
+ }
+
+ private static class ColumnOrSuperColumnTupleScheme extends TupleScheme<ColumnOrSuperColumn> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, ColumnOrSuperColumn struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetColumn()) {
+ optionals.set(0);
+ }
+ if (struct.isSetSuper_column()) {
+ optionals.set(1);
+ }
+ if (struct.isSetCounter_column()) {
+ optionals.set(2);
+ }
+ if (struct.isSetCounter_super_column()) {
+ optionals.set(3);
+ }
+ oprot.writeBitSet(optionals, 4);
+ if (struct.isSetColumn()) {
+ struct.column.write(oprot);
+ }
+ if (struct.isSetSuper_column()) {
+ struct.super_column.write(oprot);
+ }
+ if (struct.isSetCounter_column()) {
+ struct.counter_column.write(oprot);
+ }
+ if (struct.isSetCounter_super_column()) {
+ struct.counter_super_column.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, ColumnOrSuperColumn struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(4);
+ if (incoming.get(0)) {
+ struct.column = new Column();
+ struct.column.read(iprot);
+ struct.setColumnIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.super_column = new SuperColumn();
+ struct.super_column.read(iprot);
+ struct.setSuper_columnIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.counter_column = new CounterColumn();
+ struct.counter_column.read(iprot);
+ struct.setCounter_columnIsSet(true);
+ }
+ if (incoming.get(3)) {
+ struct.counter_super_column = new CounterSuperColumn();
+ struct.counter_super_column.read(iprot);
+ struct.setCounter_super_columnIsSet(true);
+ }
+ }
+ }
+
}
View
176 interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnParent.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * 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.cassandra.thrift;
/*
@@ -27,6 +28,15 @@
import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
@@ -54,8 +64,14 @@
private static final org.apache.thrift.protocol.TField COLUMN_FAMILY_FIELD_DESC = new org.apache.thrift.protocol.TField("column_family", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField SUPER_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("super_column", org.apache.thrift.protocol.TType.STRING, (short)4);
+