You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2014/05/29 22:54:22 UTC
[1/7] some more leader methods - start of path children cache
Repository: curator
Updated Branches:
refs/heads/curator-rpc 1f11d3899 -> 6f9a9ab4f
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/test/java/org/apache/curator/generated/LeaderProjection.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/LeaderProjection.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/LeaderProjection.java
new file mode 100644
index 0000000..69c18bd
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/LeaderProjection.java
@@ -0,0 +1,393 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.curator.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 org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+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 LeaderProjection implements org.apache.thrift.TBase<LeaderProjection, LeaderProjection._Fields>, java.io.Serializable, Cloneable, Comparable<LeaderProjection> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("LeaderProjection");
+
+ private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new LeaderProjectionStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new LeaderProjectionTupleSchemeFactory());
+ }
+
+ public GenericProjection projection; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROJECTION((short)1, "projection");
+
+ 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: // PROJECTION
+ return PROJECTION;
+ 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
+ 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.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, GenericProjection.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(LeaderProjection.class, metaDataMap);
+ }
+
+ public LeaderProjection() {
+ }
+
+ public LeaderProjection(
+ GenericProjection projection)
+ {
+ this();
+ this.projection = projection;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public LeaderProjection(LeaderProjection other) {
+ if (other.isSetProjection()) {
+ this.projection = new GenericProjection(other.projection);
+ }
+ }
+
+ public LeaderProjection deepCopy() {
+ return new LeaderProjection(this);
+ }
+
+ @Override
+ public void clear() {
+ this.projection = null;
+ }
+
+ public GenericProjection getProjection() {
+ return this.projection;
+ }
+
+ public LeaderProjection setProjection(GenericProjection projection) {
+ this.projection = projection;
+ return this;
+ }
+
+ public void unsetProjection() {
+ this.projection = null;
+ }
+
+ /** Returns true if field projection is set (has been assigned a value) and false otherwise */
+ public boolean isSetProjection() {
+ return this.projection != null;
+ }
+
+ public void setProjectionIsSet(boolean value) {
+ if (!value) {
+ this.projection = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROJECTION:
+ if (value == null) {
+ unsetProjection();
+ } else {
+ setProjection((GenericProjection)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROJECTION:
+ return getProjection();
+
+ }
+ 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 PROJECTION:
+ return isSetProjection();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof LeaderProjection)
+ return this.equals((LeaderProjection)that);
+ return false;
+ }
+
+ public boolean equals(LeaderProjection that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_projection = true && this.isSetProjection();
+ boolean that_present_projection = true && that.isSetProjection();
+ if (this_present_projection || that_present_projection) {
+ if (!(this_present_projection && that_present_projection))
+ return false;
+ if (!this.projection.equals(that.projection))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(LeaderProjection other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProjection()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
+ 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("LeaderProjection(");
+ boolean first = true;
+
+ sb.append("projection:");
+ if (this.projection == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.projection);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (projection != null) {
+ projection.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ 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 LeaderProjectionStandardSchemeFactory implements SchemeFactory {
+ public LeaderProjectionStandardScheme getScheme() {
+ return new LeaderProjectionStandardScheme();
+ }
+ }
+
+ private static class LeaderProjectionStandardScheme extends StandardScheme<LeaderProjection> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, LeaderProjection 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: // PROJECTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.projection = new GenericProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(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, LeaderProjection struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.projection != null) {
+ oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
+ struct.projection.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class LeaderProjectionTupleSchemeFactory implements SchemeFactory {
+ public LeaderProjectionTupleScheme getScheme() {
+ return new LeaderProjectionTupleScheme();
+ }
+ }
+
+ private static class LeaderProjectionTupleScheme extends TupleScheme<LeaderProjection> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, LeaderProjection struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetProjection()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetProjection()) {
+ struct.projection.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, LeaderProjection struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.projection = new GenericProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/test/java/org/apache/curator/generated/LeaderResult.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/LeaderResult.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/LeaderResult.java
index 939ba50..83c3dc8 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/LeaderResult.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/LeaderResult.java
@@ -44,7 +44,7 @@ public class LeaderResult implements org.apache.thrift.TBase<LeaderResult, Leade
schemes.put(TupleScheme.class, new LeaderResultTupleSchemeFactory());
}
- public GenericProjection projection; // required
+ public LeaderProjection projection; // required
public boolean hasLeadership; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -115,7 +115,7 @@ public class LeaderResult implements org.apache.thrift.TBase<LeaderResult, Leade
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, GenericProjection.class)));
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, LeaderProjection.class)));
tmpMap.put(_Fields.HAS_LEADERSHIP, new org.apache.thrift.meta_data.FieldMetaData("hasLeadership", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
@@ -126,7 +126,7 @@ public class LeaderResult implements org.apache.thrift.TBase<LeaderResult, Leade
}
public LeaderResult(
- GenericProjection projection,
+ LeaderProjection projection,
boolean hasLeadership)
{
this();
@@ -141,7 +141,7 @@ public class LeaderResult implements org.apache.thrift.TBase<LeaderResult, Leade
public LeaderResult(LeaderResult other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetProjection()) {
- this.projection = new GenericProjection(other.projection);
+ this.projection = new LeaderProjection(other.projection);
}
this.hasLeadership = other.hasLeadership;
}
@@ -157,11 +157,11 @@ public class LeaderResult implements org.apache.thrift.TBase<LeaderResult, Leade
this.hasLeadership = false;
}
- public GenericProjection getProjection() {
+ public LeaderProjection getProjection() {
return this.projection;
}
- public LeaderResult setProjection(GenericProjection projection) {
+ public LeaderResult setProjection(LeaderProjection projection) {
this.projection = projection;
return this;
}
@@ -210,7 +210,7 @@ public class LeaderResult implements org.apache.thrift.TBase<LeaderResult, Leade
if (value == null) {
unsetProjection();
} else {
- setProjection((GenericProjection)value);
+ setProjection((LeaderProjection)value);
}
break;
@@ -400,7 +400,7 @@ public class LeaderResult implements org.apache.thrift.TBase<LeaderResult, Leade
switch (schemeField.id) {
case 1: // PROJECTION
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.projection = new GenericProjection();
+ struct.projection = new LeaderProjection();
struct.projection.read(iprot);
struct.setProjectionIsSet(true);
} else {
@@ -476,7 +476,7 @@ public class LeaderResult implements org.apache.thrift.TBase<LeaderResult, Leade
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
- struct.projection = new GenericProjection();
+ struct.projection = new LeaderProjection();
struct.projection.read(iprot);
struct.setProjectionIsSet(true);
}
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/test/java/org/apache/curator/generated/Participant.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/Participant.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/Participant.java
new file mode 100644
index 0000000..d93b645
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/Participant.java
@@ -0,0 +1,486 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.curator.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 org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+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 Participant implements org.apache.thrift.TBase<Participant, Participant._Fields>, java.io.Serializable, Cloneable, Comparable<Participant> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Participant");
+
+ private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField IS_LEADER_FIELD_DESC = new org.apache.thrift.protocol.TField("isLeader", org.apache.thrift.protocol.TType.BOOL, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new ParticipantStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new ParticipantTupleSchemeFactory());
+ }
+
+ public String id; // required
+ public boolean isLeader; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ ID((short)1, "id"),
+ IS_LEADER((short)2, "isLeader");
+
+ 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: // ID
+ return ID;
+ case 2: // IS_LEADER
+ return IS_LEADER;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __ISLEADER_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.IS_LEADER, new org.apache.thrift.meta_data.FieldMetaData("isLeader", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Participant.class, metaDataMap);
+ }
+
+ public Participant() {
+ }
+
+ public Participant(
+ String id,
+ boolean isLeader)
+ {
+ this();
+ this.id = id;
+ this.isLeader = isLeader;
+ setIsLeaderIsSet(true);
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public Participant(Participant other) {
+ __isset_bitfield = other.__isset_bitfield;
+ if (other.isSetId()) {
+ this.id = other.id;
+ }
+ this.isLeader = other.isLeader;
+ }
+
+ public Participant deepCopy() {
+ return new Participant(this);
+ }
+
+ @Override
+ public void clear() {
+ this.id = null;
+ setIsLeaderIsSet(false);
+ this.isLeader = false;
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public Participant setId(String id) {
+ this.id = id;
+ return this;
+ }
+
+ public void unsetId() {
+ this.id = null;
+ }
+
+ /** Returns true if field id is set (has been assigned a value) and false otherwise */
+ public boolean isSetId() {
+ return this.id != null;
+ }
+
+ public void setIdIsSet(boolean value) {
+ if (!value) {
+ this.id = null;
+ }
+ }
+
+ public boolean isIsLeader() {
+ return this.isLeader;
+ }
+
+ public Participant setIsLeader(boolean isLeader) {
+ this.isLeader = isLeader;
+ setIsLeaderIsSet(true);
+ return this;
+ }
+
+ public void unsetIsLeader() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISLEADER_ISSET_ID);
+ }
+
+ /** Returns true if field isLeader is set (has been assigned a value) and false otherwise */
+ public boolean isSetIsLeader() {
+ return EncodingUtils.testBit(__isset_bitfield, __ISLEADER_ISSET_ID);
+ }
+
+ public void setIsLeaderIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISLEADER_ISSET_ID, value);
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case ID:
+ if (value == null) {
+ unsetId();
+ } else {
+ setId((String)value);
+ }
+ break;
+
+ case IS_LEADER:
+ if (value == null) {
+ unsetIsLeader();
+ } else {
+ setIsLeader((Boolean)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case ID:
+ return getId();
+
+ case IS_LEADER:
+ return Boolean.valueOf(isIsLeader());
+
+ }
+ 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 ID:
+ return isSetId();
+ case IS_LEADER:
+ return isSetIsLeader();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof Participant)
+ return this.equals((Participant)that);
+ return false;
+ }
+
+ public boolean equals(Participant that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_id = true && this.isSetId();
+ boolean that_present_id = true && that.isSetId();
+ if (this_present_id || that_present_id) {
+ if (!(this_present_id && that_present_id))
+ return false;
+ if (!this.id.equals(that.id))
+ return false;
+ }
+
+ boolean this_present_isLeader = true;
+ boolean that_present_isLeader = true;
+ if (this_present_isLeader || that_present_isLeader) {
+ if (!(this_present_isLeader && that_present_isLeader))
+ return false;
+ if (this.isLeader != that.isLeader)
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(Participant other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetId()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetIsLeader()).compareTo(other.isSetIsLeader());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetIsLeader()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isLeader, other.isLeader);
+ 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("Participant(");
+ boolean first = true;
+
+ sb.append("id:");
+ if (this.id == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.id);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("isLeader:");
+ sb.append(this.isLeader);
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bitfield = 0;
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class ParticipantStandardSchemeFactory implements SchemeFactory {
+ public ParticipantStandardScheme getScheme() {
+ return new ParticipantStandardScheme();
+ }
+ }
+
+ private static class ParticipantStandardScheme extends StandardScheme<Participant> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, Participant 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: // ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.id = iprot.readString();
+ struct.setIdIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // IS_LEADER
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.isLeader = iprot.readBool();
+ struct.setIsLeaderIsSet(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, Participant struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.id != null) {
+ oprot.writeFieldBegin(ID_FIELD_DESC);
+ oprot.writeString(struct.id);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(IS_LEADER_FIELD_DESC);
+ oprot.writeBool(struct.isLeader);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class ParticipantTupleSchemeFactory implements SchemeFactory {
+ public ParticipantTupleScheme getScheme() {
+ return new ParticipantTupleScheme();
+ }
+ }
+
+ private static class ParticipantTupleScheme extends TupleScheme<Participant> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, Participant struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetId()) {
+ optionals.set(0);
+ }
+ if (struct.isSetIsLeader()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetId()) {
+ oprot.writeString(struct.id);
+ }
+ if (struct.isSetIsLeader()) {
+ oprot.writeBool(struct.isLeader);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, Participant struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.id = iprot.readString();
+ struct.setIdIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.isLeader = iprot.readBool();
+ struct.setIsLeaderIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheProjection.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheProjection.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheProjection.java
new file mode 100644
index 0000000..dbef1cb
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheProjection.java
@@ -0,0 +1,393 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.curator.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 org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+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 PathChildrenCacheProjection implements org.apache.thrift.TBase<PathChildrenCacheProjection, PathChildrenCacheProjection._Fields>, java.io.Serializable, Cloneable, Comparable<PathChildrenCacheProjection> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PathChildrenCacheProjection");
+
+ private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new PathChildrenCacheProjectionStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new PathChildrenCacheProjectionTupleSchemeFactory());
+ }
+
+ public GenericProjection projection; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROJECTION((short)1, "projection");
+
+ 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: // PROJECTION
+ return PROJECTION;
+ 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
+ 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.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, GenericProjection.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PathChildrenCacheProjection.class, metaDataMap);
+ }
+
+ public PathChildrenCacheProjection() {
+ }
+
+ public PathChildrenCacheProjection(
+ GenericProjection projection)
+ {
+ this();
+ this.projection = projection;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public PathChildrenCacheProjection(PathChildrenCacheProjection other) {
+ if (other.isSetProjection()) {
+ this.projection = new GenericProjection(other.projection);
+ }
+ }
+
+ public PathChildrenCacheProjection deepCopy() {
+ return new PathChildrenCacheProjection(this);
+ }
+
+ @Override
+ public void clear() {
+ this.projection = null;
+ }
+
+ public GenericProjection getProjection() {
+ return this.projection;
+ }
+
+ public PathChildrenCacheProjection setProjection(GenericProjection projection) {
+ this.projection = projection;
+ return this;
+ }
+
+ public void unsetProjection() {
+ this.projection = null;
+ }
+
+ /** Returns true if field projection is set (has been assigned a value) and false otherwise */
+ public boolean isSetProjection() {
+ return this.projection != null;
+ }
+
+ public void setProjectionIsSet(boolean value) {
+ if (!value) {
+ this.projection = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROJECTION:
+ if (value == null) {
+ unsetProjection();
+ } else {
+ setProjection((GenericProjection)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROJECTION:
+ return getProjection();
+
+ }
+ 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 PROJECTION:
+ return isSetProjection();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof PathChildrenCacheProjection)
+ return this.equals((PathChildrenCacheProjection)that);
+ return false;
+ }
+
+ public boolean equals(PathChildrenCacheProjection that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_projection = true && this.isSetProjection();
+ boolean that_present_projection = true && that.isSetProjection();
+ if (this_present_projection || that_present_projection) {
+ if (!(this_present_projection && that_present_projection))
+ return false;
+ if (!this.projection.equals(that.projection))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(PathChildrenCacheProjection other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProjection()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
+ 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("PathChildrenCacheProjection(");
+ boolean first = true;
+
+ sb.append("projection:");
+ if (this.projection == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.projection);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (projection != null) {
+ projection.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ 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 PathChildrenCacheProjectionStandardSchemeFactory implements SchemeFactory {
+ public PathChildrenCacheProjectionStandardScheme getScheme() {
+ return new PathChildrenCacheProjectionStandardScheme();
+ }
+ }
+
+ private static class PathChildrenCacheProjectionStandardScheme extends StandardScheme<PathChildrenCacheProjection> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, PathChildrenCacheProjection 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: // PROJECTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.projection = new GenericProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(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, PathChildrenCacheProjection struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.projection != null) {
+ oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
+ struct.projection.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class PathChildrenCacheProjectionTupleSchemeFactory implements SchemeFactory {
+ public PathChildrenCacheProjectionTupleScheme getScheme() {
+ return new PathChildrenCacheProjectionTupleScheme();
+ }
+ }
+
+ private static class PathChildrenCacheProjectionTupleScheme extends TupleScheme<PathChildrenCacheProjection> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, PathChildrenCacheProjection struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetProjection()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetProjection()) {
+ struct.projection.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, PathChildrenCacheProjection struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.projection = new GenericProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheStartMode.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheStartMode.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheStartMode.java
new file mode 100644
index 0000000..757200c
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheStartMode.java
@@ -0,0 +1,48 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.curator.generated;
+
+
+import java.util.Map;
+import java.util.HashMap;
+import org.apache.thrift.TEnum;
+
+public enum PathChildrenCacheStartMode implements org.apache.thrift.TEnum {
+ NORMAL(0),
+ BUILD_INITIAL_CACHE(1),
+ POST_INITIALIZED_EVENT(2);
+
+ private final int value;
+
+ private PathChildrenCacheStartMode(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Get the integer value of this enum value, as defined in the Thrift IDL.
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * Find a the enum type by its integer value, as defined in the Thrift IDL.
+ * @return null if the value is not found.
+ */
+ public static PathChildrenCacheStartMode findByValue(int value) {
+ switch (value) {
+ case 0:
+ return NORMAL;
+ case 1:
+ return BUILD_INITIAL_CACHE;
+ case 2:
+ return POST_INITIALIZED_EVENT;
+ default:
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/test/java/org/apache/curator/generated/id.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/id.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/id.java
index 4cad71f..247de18 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/id.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/id.java
@@ -32,16 +32,16 @@ import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class id implements org.apache.thrift.TBase<id, id._Fields>, java.io.Serializable, Cloneable, Comparable<id> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("id");
+public class Id implements org.apache.thrift.TBase<Id, Id._Fields>, java.io.Serializable, Cloneable, Comparable<Id> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Id");
private static final org.apache.thrift.protocol.TField SCHEME_FIELD_DESC = new org.apache.thrift.protocol.TField("scheme", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
- schemes.put(StandardScheme.class, new idStandardSchemeFactory());
- schemes.put(TupleScheme.class, new idTupleSchemeFactory());
+ schemes.put(StandardScheme.class, new IdStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new IdTupleSchemeFactory());
}
public String scheme; // required
@@ -117,13 +117,13 @@ public class id implements org.apache.thrift.TBase<id, id._Fields>, java.io.Seri
tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(id.class, metaDataMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Id.class, metaDataMap);
}
- public id() {
+ public Id() {
}
- public id(
+ public Id(
String scheme,
String id)
{
@@ -135,7 +135,7 @@ public class id implements org.apache.thrift.TBase<id, id._Fields>, java.io.Seri
/**
* Performs a deep copy on <i>other</i>.
*/
- public id(id other) {
+ public Id(Id other) {
if (other.isSetScheme()) {
this.scheme = other.scheme;
}
@@ -144,8 +144,8 @@ public class id implements org.apache.thrift.TBase<id, id._Fields>, java.io.Seri
}
}
- public id deepCopy() {
- return new id(this);
+ public Id deepCopy() {
+ return new Id(this);
}
@Override
@@ -158,7 +158,7 @@ public class id implements org.apache.thrift.TBase<id, id._Fields>, java.io.Seri
return this.scheme;
}
- public id setScheme(String scheme) {
+ public Id setScheme(String scheme) {
this.scheme = scheme;
return this;
}
@@ -182,7 +182,7 @@ public class id implements org.apache.thrift.TBase<id, id._Fields>, java.io.Seri
return this.id;
}
- public id setId(String id) {
+ public Id setId(String id) {
this.id = id;
return this;
}
@@ -254,12 +254,12 @@ public class id implements org.apache.thrift.TBase<id, id._Fields>, java.io.Seri
public boolean equals(Object that) {
if (that == null)
return false;
- if (that instanceof id)
- return this.equals((id)that);
+ if (that instanceof Id)
+ return this.equals((Id)that);
return false;
}
- public boolean equals(id that) {
+ public boolean equals(Id that) {
if (that == null)
return false;
@@ -290,7 +290,7 @@ public class id implements org.apache.thrift.TBase<id, id._Fields>, java.io.Seri
}
@Override
- public int compareTo(id other) {
+ public int compareTo(Id other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
@@ -334,7 +334,7 @@ public class id implements org.apache.thrift.TBase<id, id._Fields>, java.io.Seri
@Override
public String toString() {
- StringBuilder sb = new StringBuilder("id(");
+ StringBuilder sb = new StringBuilder("Id(");
boolean first = true;
sb.append("scheme:");
@@ -377,15 +377,15 @@ public class id implements org.apache.thrift.TBase<id, id._Fields>, java.io.Seri
}
}
- private static class idStandardSchemeFactory implements SchemeFactory {
- public idStandardScheme getScheme() {
- return new idStandardScheme();
+ private static class IdStandardSchemeFactory implements SchemeFactory {
+ public IdStandardScheme getScheme() {
+ return new IdStandardScheme();
}
}
- private static class idStandardScheme extends StandardScheme<id> {
+ private static class IdStandardScheme extends StandardScheme<Id> {
- public void read(org.apache.thrift.protocol.TProtocol iprot, id struct) throws org.apache.thrift.TException {
+ public void read(org.apache.thrift.protocol.TProtocol iprot, Id struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
@@ -422,7 +422,7 @@ public class id implements org.apache.thrift.TBase<id, id._Fields>, java.io.Seri
struct.validate();
}
- public void write(org.apache.thrift.protocol.TProtocol oprot, id struct) throws org.apache.thrift.TException {
+ public void write(org.apache.thrift.protocol.TProtocol oprot, Id struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
@@ -442,16 +442,16 @@ public class id implements org.apache.thrift.TBase<id, id._Fields>, java.io.Seri
}
- private static class idTupleSchemeFactory implements SchemeFactory {
- public idTupleScheme getScheme() {
- return new idTupleScheme();
+ private static class IdTupleSchemeFactory implements SchemeFactory {
+ public IdTupleScheme getScheme() {
+ return new IdTupleScheme();
}
}
- private static class idTupleScheme extends TupleScheme<id> {
+ private static class IdTupleScheme extends TupleScheme<Id> {
@Override
- public void write(org.apache.thrift.protocol.TProtocol prot, id struct) throws org.apache.thrift.TException {
+ public void write(org.apache.thrift.protocol.TProtocol prot, Id struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetScheme()) {
@@ -470,7 +470,7 @@ public class id implements org.apache.thrift.TBase<id, id._Fields>, java.io.Seri
}
@Override
- public void read(org.apache.thrift.protocol.TProtocol prot, id struct) throws org.apache.thrift.TException {
+ public void read(org.apache.thrift.protocol.TProtocol prot, Id struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
[3/7] git commit: some more leader methods - start of path children
cache
Posted by ra...@apache.org.
some more leader methods - start of path children cache
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/41ac42bb
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/41ac42bb
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/41ac42bb
Branch: refs/heads/curator-rpc
Commit: 41ac42bb67cd9e3196ec2f0873a4efe595c6ed41
Parents: 1f11d38
Author: randgalt <ra...@apache.org>
Authored: Thu May 29 14:55:50 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 29 14:55:50 2014 -0500
----------------------------------------------------------------------
.../curator/x/rpc/idl/event/LeaderEvent.java | 2 +-
.../curator/x/rpc/idl/event/LeaderResult.java | 8 +-
.../x/rpc/idl/event/OptionalChildrenList.java | 2 +-
.../curator/x/rpc/idl/event/OptionalPath.java | 2 +-
.../apache/curator/x/rpc/idl/event/RpcId.java | 2 +-
.../curator/x/rpc/idl/event/RpcParticipant.java | 24 +
.../projection/CuratorProjectionService.java | 108 +-
.../x/rpc/idl/projection/LeaderProjection.java | 20 +
.../projection/PathChildrenCacheProjection.java | 20 +
.../projection/PathChildrenCacheStartMode.java | 8 +
curator-x-rpc/src/main/thrift/curator.thrift | 26 +-
.../java/org/apache/curator/generated/Acl.java | 18 +-
.../curator/generated/CuratorService.java | 4190 ++++++++++++++++--
.../curator/generated/LeaderProjection.java | 393 ++
.../apache/curator/generated/LeaderResult.java | 18 +-
.../apache/curator/generated/Participant.java | 486 ++
.../generated/PathChildrenCacheProjection.java | 393 ++
.../generated/PathChildrenCacheStartMode.java | 48 +
.../java/org/apache/curator/generated/id.java | 58 +-
19 files changed, 5291 insertions(+), 535 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderEvent.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderEvent.java
index bd86dce..677c401 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderEvent.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderEvent.java
@@ -3,7 +3,7 @@ package org.apache.curator.x.rpc.idl.event;
import com.facebook.swift.codec.ThriftField;
import com.facebook.swift.codec.ThriftStruct;
-@ThriftStruct("LeaderEvent")
+@ThriftStruct
public class LeaderEvent
{
@ThriftField(1)
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderResult.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderResult.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderResult.java
index 7a67b62..8666105 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderResult.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/LeaderResult.java
@@ -2,13 +2,13 @@ package org.apache.curator.x.rpc.idl.event;
import com.facebook.swift.codec.ThriftField;
import com.facebook.swift.codec.ThriftStruct;
-import org.apache.curator.x.rpc.idl.projection.GenericProjection;
+import org.apache.curator.x.rpc.idl.projection.LeaderProjection;
-@ThriftStruct("LeaderResult")
+@ThriftStruct
public class LeaderResult
{
@ThriftField(1)
- public GenericProjection projection;
+ public LeaderProjection projection;
@ThriftField(2)
public boolean hasLeadership;
@@ -17,7 +17,7 @@ public class LeaderResult
{
}
- public LeaderResult(GenericProjection projection, boolean hasLeadership)
+ public LeaderResult(LeaderProjection projection, boolean hasLeadership)
{
this.projection = projection;
this.hasLeadership = hasLeadership;
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalChildrenList.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalChildrenList.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalChildrenList.java
index 229c7bc..0f0a928 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalChildrenList.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalChildrenList.java
@@ -4,7 +4,7 @@ import com.facebook.swift.codec.ThriftField;
import com.facebook.swift.codec.ThriftStruct;
import java.util.List;
-@ThriftStruct("OptionalChildrenList")
+@ThriftStruct
public class OptionalChildrenList
{
@ThriftField(1)
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalPath.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalPath.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalPath.java
index ba17a33..947dd75 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalPath.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalPath.java
@@ -3,7 +3,7 @@ package org.apache.curator.x.rpc.idl.event;
import com.facebook.swift.codec.ThriftField;
import com.facebook.swift.codec.ThriftStruct;
-@ThriftStruct("OptionalPath")
+@ThriftStruct
public class OptionalPath
{
@ThriftField(1)
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcId.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcId.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcId.java
index 8c360d6..a86556a 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcId.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcId.java
@@ -21,7 +21,7 @@ package org.apache.curator.x.rpc.idl.event;
import com.facebook.swift.codec.ThriftField;
import com.facebook.swift.codec.ThriftStruct;
-@ThriftStruct("id")
+@ThriftStruct("Id")
public class RpcId
{
@ThriftField(1)
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcParticipant.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcParticipant.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcParticipant.java
new file mode 100644
index 0000000..05a5d85
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcParticipant.java
@@ -0,0 +1,24 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct("Participant")
+public class RpcParticipant
+{
+ @ThriftField(1)
+ public String id;
+
+ @ThriftField(2)
+ public boolean isLeader;
+
+ public RpcParticipant()
+ {
+ }
+
+ public RpcParticipant(String id, boolean isLeader)
+ {
+ this.id = id;
+ this.isLeader = isLeader;
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
index 97f3a27..03d0c9f 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
@@ -21,13 +21,21 @@ package org.apache.curator.x.rpc.idl.projection;
import com.facebook.swift.service.ThriftMethod;
import com.facebook.swift.service.ThriftService;
+import com.google.common.base.Function;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.api.*;
+import org.apache.curator.framework.recipes.cache.PathChildrenCache;
+import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent;
+import org.apache.curator.framework.recipes.cache.PathChildrenCacheListener;
import org.apache.curator.framework.recipes.leader.LeaderLatch;
import org.apache.curator.framework.recipes.leader.LeaderLatchListener;
+import org.apache.curator.framework.recipes.leader.Participant;
import org.apache.curator.framework.recipes.locks.InterProcessSemaphoreMutex;
import org.apache.curator.framework.state.ConnectionState;
import org.apache.curator.framework.state.ConnectionStateListener;
+import org.apache.curator.utils.ThreadUtils;
import org.apache.curator.x.rpc.connections.Closer;
import org.apache.curator.x.rpc.connections.ConnectionManager;
import org.apache.curator.x.rpc.connections.CuratorEntry;
@@ -39,11 +47,13 @@ import org.apache.curator.x.rpc.idl.event.OptionalChildrenList;
import org.apache.curator.x.rpc.idl.event.OptionalPath;
import org.apache.curator.x.rpc.idl.event.OptionalRpcStat;
import org.apache.curator.x.rpc.idl.event.RpcCuratorEvent;
+import org.apache.curator.x.rpc.idl.event.RpcParticipant;
import org.apache.curator.x.rpc.idl.event.RpcStat;
import org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
+import java.util.Collection;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -336,7 +346,97 @@ public class CuratorProjectionService
}
GenericProjection leaderProjection = new GenericProjection(id);
- return new LeaderResult(leaderProjection, leaderLatch.hasLeadership());
+ return new LeaderResult(new LeaderProjection(leaderProjection), leaderLatch.hasLeadership());
+ }
+
+ @ThriftMethod
+ public List<RpcParticipant> getLeaderParticipants(CuratorProjection projection, LeaderProjection leaderProjection) throws Exception
+ {
+ CuratorEntry entry = getEntry(projection);
+
+ LeaderLatch leaderLatch = getThis(entry, leaderProjection.projection.id, LeaderLatch.class);
+ Collection<Participant> participants = leaderLatch.getParticipants();
+ return Lists.transform
+ (
+ Lists.newArrayList(participants),
+ new Function<Participant, RpcParticipant>()
+ {
+ @Override
+ public RpcParticipant apply(Participant participant)
+ {
+ return new RpcParticipant(participant.getId(), participant.isLeader());
+ }
+ }
+ );
+ }
+
+ @ThriftMethod
+ public boolean isLeader(CuratorProjection projection, LeaderProjection leaderProjection) throws Exception
+ {
+ CuratorEntry entry = getEntry(projection);
+
+ LeaderLatch leaderLatch = getThis(entry, leaderProjection.projection.id, LeaderLatch.class);
+ return leaderLatch.hasLeadership();
+ }
+
+ @ThriftMethod
+ public PathChildrenCacheProjection startPathChildrenCache(final CuratorProjection projection, final String path, boolean cacheData, boolean dataIsCompressed, PathChildrenCacheStartMode startMode) throws Exception
+ {
+ CuratorEntry entry = getEntry(projection);
+
+ PathChildrenCache cache = new PathChildrenCache(entry.getClient(), path, cacheData, dataIsCompressed, ThreadUtils.newThreadFactory("PathChildrenCacheResource-%d"));
+ PathChildrenCache.StartMode actualStartMode = PathChildrenCache.StartMode.NORMAL;
+ switch ( startMode )
+ {
+ case NORMAL:
+ {
+ actualStartMode = PathChildrenCache.StartMode.NORMAL;
+ break;
+ }
+
+ case BUILD_INITIAL_CACHE:
+ {
+ actualStartMode = PathChildrenCache.StartMode.BUILD_INITIAL_CACHE;
+ break;
+ }
+
+ case POST_INITIALIZED_EVENT:
+ {
+ actualStartMode = PathChildrenCache.StartMode.POST_INITIALIZED_EVENT;
+ break;
+ }
+ }
+ cache.start(actualStartMode);
+
+ Closer<PathChildrenCache> closer = new Closer<PathChildrenCache>()
+ {
+ @Override
+ public void close(PathChildrenCache cache)
+ {
+ try
+ {
+ cache.close();
+ }
+ catch ( IOException e )
+ {
+ log.error("Could not close left-over PathChildrenCache for path: " + path, e);
+ }
+ }
+ };
+ final String id = CuratorEntry.newId();
+ entry.addThing(id, cache, closer);
+
+ PathChildrenCacheListener listener = new PathChildrenCacheListener()
+ {
+ @Override
+ public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) throws Exception
+ {
+ // TODO
+ }
+ };
+ cache.getListenable().addListener(listener);
+
+ return new PathChildrenCacheProjection(new GenericProjection(id));
}
public void addEvent(CuratorProjection projection, RpcCuratorEvent event)
@@ -394,4 +494,10 @@ public class CuratorProjectionService
throw new Exception("That operation is not available"); // TODO
}
+ private <T> T getThis(CuratorEntry entry, String id, Class<T> clazz)
+ {
+ T thing = entry.getThing(id, clazz);
+ Preconditions.checkNotNull(thing, "No item of type " + clazz.getSimpleName() + " found with id " + id);
+ return thing;
+ }
}
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/LeaderProjection.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/LeaderProjection.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/LeaderProjection.java
new file mode 100644
index 0000000..51fb56f
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/LeaderProjection.java
@@ -0,0 +1,20 @@
+package org.apache.curator.x.rpc.idl.projection;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct
+public class LeaderProjection
+{
+ @ThriftField(1)
+ public GenericProjection projection;
+
+ public LeaderProjection()
+ {
+ }
+
+ public LeaderProjection(GenericProjection projection)
+ {
+ this.projection = projection;
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/PathChildrenCacheProjection.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/PathChildrenCacheProjection.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/PathChildrenCacheProjection.java
new file mode 100644
index 0000000..666f43c
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/PathChildrenCacheProjection.java
@@ -0,0 +1,20 @@
+package org.apache.curator.x.rpc.idl.projection;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct
+public class PathChildrenCacheProjection
+{
+ @ThriftField(1)
+ public GenericProjection projection;
+
+ public PathChildrenCacheProjection()
+ {
+ }
+
+ public PathChildrenCacheProjection(GenericProjection projection)
+ {
+ this.projection = projection;
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/PathChildrenCacheStartMode.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/PathChildrenCacheStartMode.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/PathChildrenCacheStartMode.java
new file mode 100644
index 0000000..bf695ba
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/PathChildrenCacheStartMode.java
@@ -0,0 +1,8 @@
+package org.apache.curator.x.rpc.idl.projection;
+
+public enum PathChildrenCacheStartMode
+{
+ NORMAL,
+ BUILD_INITIAL_CACHE,
+ POST_INITIALIZED_EVENT
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/main/thrift/curator.thrift
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/thrift/curator.thrift b/curator-x-rpc/src/main/thrift/curator.thrift
index ec52895..9ab4e62 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -7,6 +7,10 @@ enum CreateMode {
PERSISTENT, PERSISTENT_SEQUENTIAL, EPHEMERAL, EPHEMERAL_SEQUENTIAL
}
+enum PathChildrenCacheStartMode {
+ NORMAL, BUILD_INITIAL_CACHE, POST_INITIALIZED_EVENT
+}
+
enum CuratorEventType {
PING, CREATE, DELETE, EXISTS, GET_DATA, SET_DATA, CHILDREN, SYNC, GET_ACL, SET_ACL, WATCHED, CLOSING, CONNECTION_CONNECTED, CONNECTION_SUSPENDED, CONNECTION_RECONNECTED, CONNECTION_LOST, CONNECTION_READ_ONLY, LEADER
}
@@ -56,6 +60,14 @@ struct GetDataSpec {
4: bool decompressed;
}
+struct LeaderProjection {
+ 1: GenericProjection projection;
+}
+
+struct PathChildrenCacheProjection {
+ 1: GenericProjection projection;
+}
+
struct Version {
1: i32 version;
}
@@ -67,7 +79,7 @@ struct LeaderEvent {
}
struct LeaderResult {
- 1: GenericProjection projection;
+ 1: LeaderProjection projection;
2: bool hasLeadership;
}
@@ -79,11 +91,16 @@ struct OptionalPath {
1: string path;
}
-struct id {
+struct Id {
1: string scheme;
2: string id;
}
+struct Participant {
+ 1: string id;
+ 2: bool isLeader;
+}
+
struct Stat {
1: i64 czxid;
2: i64 mzxid;
@@ -127,7 +144,7 @@ struct OptionalStat {
struct Acl {
1: i32 perms;
- 2: id id;
+ 2: Id id;
}
struct CuratorEvent {
@@ -153,9 +170,12 @@ service CuratorService {
OptionalStat exists(1: CuratorProjection projection, 2: ExistsSpec spec);
OptionalChildrenList getChildren(1: CuratorProjection projection, 2: GetChildrenSpec spec);
binary getData(1: CuratorProjection projection, 2: GetDataSpec spec);
+ list<Participant> getLeaderParticipants(1: CuratorProjection projection, 2: LeaderProjection leaderProjection);
+ bool isLeader(1: CuratorProjection projection, 2: LeaderProjection leaderProjection);
CuratorProjection newCuratorProjection(1: string connectionName);
Stat setData(1: CuratorProjection projection, 2: SetDataSpec spec);
LeaderResult startLeaderSelector(1: CuratorProjection projection, 2: string path, 3: string participantId, 4: i32 waitForLeadershipMs);
+ PathChildrenCacheProjection startPathChildrenCache(1: CuratorProjection projection, 2: string path, 3: bool cacheData, 4: bool dataIsCompressed, 5: PathChildrenCacheStartMode startMode);
}
service EventService {
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/test/java/org/apache/curator/generated/Acl.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/Acl.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/Acl.java
index 3dd4cb5..a31e11e 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/Acl.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/Acl.java
@@ -45,7 +45,7 @@ public class Acl implements org.apache.thrift.TBase<Acl, Acl._Fields>, java.io.S
}
public int perms; // required
- public id id; // required
+ public Id id; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -117,7 +117,7 @@ public class Acl implements org.apache.thrift.TBase<Acl, Acl._Fields>, java.io.S
tmpMap.put(_Fields.PERMS, new org.apache.thrift.meta_data.FieldMetaData("perms", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, id.class)));
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Id.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Acl.class, metaDataMap);
}
@@ -127,7 +127,7 @@ public class Acl implements org.apache.thrift.TBase<Acl, Acl._Fields>, java.io.S
public Acl(
int perms,
- id id)
+ Id id)
{
this();
this.perms = perms;
@@ -142,7 +142,7 @@ public class Acl implements org.apache.thrift.TBase<Acl, Acl._Fields>, java.io.S
__isset_bitfield = other.__isset_bitfield;
this.perms = other.perms;
if (other.isSetId()) {
- this.id = new id(other.id);
+ this.id = new Id(other.id);
}
}
@@ -180,11 +180,11 @@ public class Acl implements org.apache.thrift.TBase<Acl, Acl._Fields>, java.io.S
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERMS_ISSET_ID, value);
}
- public id getId() {
+ public Id getId() {
return this.id;
}
- public Acl setId(id id) {
+ public Acl setId(Id id) {
this.id = id;
return this;
}
@@ -218,7 +218,7 @@ public class Acl implements org.apache.thrift.TBase<Acl, Acl._Fields>, java.io.S
if (value == null) {
unsetId();
} else {
- setId((id)value);
+ setId((Id)value);
}
break;
@@ -408,7 +408,7 @@ public class Acl implements org.apache.thrift.TBase<Acl, Acl._Fields>, java.io.S
break;
case 2: // ID
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.id = new id();
+ struct.id = new Id();
struct.id.read(iprot);
struct.setIdIsSet(true);
} else {
@@ -480,7 +480,7 @@ public class Acl implements org.apache.thrift.TBase<Acl, Acl._Fields>, java.io.S
struct.setPermsIsSet(true);
}
if (incoming.get(1)) {
- struct.id = new id();
+ struct.id = new Id();
struct.id.read(iprot);
struct.setIdIsSet(true);
}
[5/7] git commit: path children cache wip
Posted by ra...@apache.org.
path children cache wip
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/4c626a7a
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/4c626a7a
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/4c626a7a
Branch: refs/heads/curator-rpc
Commit: 4c626a7a700d6b9b49552509737e1c1e05ce2215
Parents: 0f52fa2
Author: randgalt <ra...@apache.org>
Authored: Thu May 29 15:44:33 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 29 15:44:33 2014 -0500
----------------------------------------------------------------------
.../x/rpc/idl/event/RpcCuratorEvent.java | 24 ++++
.../x/rpc/idl/event/RpcCuratorEventType.java | 3 +-
.../idl/event/RpcPathChildrenCacheEvent.java | 11 +-
.../projection/CuratorProjectionService.java | 11 +-
curator-x-rpc/src/main/thrift/curator.thrift | 14 ++-
.../apache/curator/generated/CuratorEvent.java | 113 ++++++++++++++++-
.../curator/generated/CuratorEventType.java | 5 +-
.../generated/PathChildrenCacheEvent.java | 126 +++++++++++++++++--
.../org/apache/curator/x/rpc/TestClient.java | 3 +-
9 files changed, 276 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/4c626a7a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java
index 92be564..aacf076 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java
@@ -67,6 +67,9 @@ public class RpcCuratorEvent
@ThriftField(12)
public LeaderEvent leaderEvent;
+ @ThriftField(13)
+ public RpcPathChildrenCacheEvent childrenCacheEvent;
+
public RpcCuratorEvent()
{
this.type = RpcCuratorEventType.PING;
@@ -80,6 +83,23 @@ public class RpcCuratorEvent
this.aclList = null;
this.watchedEvent = null;
this.leaderEvent = null;
+ this.childrenCacheEvent = null;
+ }
+
+ public RpcCuratorEvent(RpcPathChildrenCacheEvent childrenCacheEvent)
+ {
+ this.type = RpcCuratorEventType.PATH_CHILDREN_CACHE;
+ this.resultCode = 0;
+ this.path = null;
+ this.context = null;
+ this.stat = null;
+ this.data = null;
+ this.name = null;
+ this.children = null;
+ this.aclList = null;
+ this.watchedEvent = null;
+ this.leaderEvent = null;
+ this.childrenCacheEvent = childrenCacheEvent;
}
public RpcCuratorEvent(CuratorEvent event)
@@ -95,6 +115,7 @@ public class RpcCuratorEvent
this.aclList = toRpcAclList(event.getACLList());
this.watchedEvent = toRpcWatchedEvent(event.getWatchedEvent());
this.leaderEvent = null;
+ this.childrenCacheEvent = null;
}
public RpcCuratorEvent(ConnectionState newState)
@@ -110,6 +131,7 @@ public class RpcCuratorEvent
this.aclList = null;
this.watchedEvent = null;
this.leaderEvent = null;
+ this.childrenCacheEvent = null;
}
public RpcCuratorEvent(WatchedEvent event)
@@ -125,6 +147,7 @@ public class RpcCuratorEvent
this.aclList = null;
this.watchedEvent = new RpcWatchedEvent(RpcKeeperState.valueOf(event.getState().name()), RpcEventType.valueOf(event.getType().name()), event.getPath());
this.leaderEvent = null;
+ this.childrenCacheEvent = null;
}
public RpcCuratorEvent(LeaderEvent event)
@@ -140,6 +163,7 @@ public class RpcCuratorEvent
this.aclList = null;
this.watchedEvent = null;
this.leaderEvent = event;
+ this.childrenCacheEvent = null;
}
public static RpcStat toRpcStat(Stat stat)
http://git-wip-us.apache.org/repos/asf/curator/blob/4c626a7a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEventType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEventType.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEventType.java
index 1102740..eee5929 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEventType.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEventType.java
@@ -40,5 +40,6 @@ public enum RpcCuratorEventType
CONNECTION_RECONNECTED,
CONNECTION_LOST,
CONNECTION_READ_ONLY,
- LEADER
+ LEADER,
+ PATH_CHILDREN_CACHE
}
http://git-wip-us.apache.org/repos/asf/curator/blob/4c626a7a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEvent.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEvent.java
index 0213559..9321157 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEvent.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEvent.java
@@ -8,23 +8,28 @@ import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent;
public class RpcPathChildrenCacheEvent
{
@ThriftField(1)
- public RpcPathChildrenCacheEventType type;
+ public String cachedPath;
@ThriftField(2)
+ public RpcPathChildrenCacheEventType type;
+
+ @ThriftField(3)
public RpcChildData data;
public RpcPathChildrenCacheEvent()
{
}
- public RpcPathChildrenCacheEvent(PathChildrenCacheEvent event)
+ public RpcPathChildrenCacheEvent(String cachedPath, PathChildrenCacheEvent event)
{
+ this.cachedPath = cachedPath;
type = RpcPathChildrenCacheEventType.valueOf(event.getType().name());
data = (event.getData() != null) ? new RpcChildData(event.getData().getPath(), RpcCuratorEvent.toRpcStat(event.getData().getStat()), event.getData().getData()) : null;
}
- public RpcPathChildrenCacheEvent(RpcPathChildrenCacheEventType type, RpcChildData data)
+ public RpcPathChildrenCacheEvent(String cachedPath, RpcPathChildrenCacheEventType type, RpcChildData data)
{
+ this.cachedPath = cachedPath;
this.type = type;
this.data = data;
}
http://git-wip-us.apache.org/repos/asf/curator/blob/4c626a7a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
index fd7384e..1084507 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
@@ -48,6 +48,7 @@ import org.apache.curator.x.rpc.idl.event.OptionalPath;
import org.apache.curator.x.rpc.idl.event.OptionalRpcStat;
import org.apache.curator.x.rpc.idl.event.RpcCuratorEvent;
import org.apache.curator.x.rpc.idl.event.RpcParticipant;
+import org.apache.curator.x.rpc.idl.event.RpcPathChildrenCacheEvent;
import org.apache.curator.x.rpc.idl.event.RpcStat;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.data.Stat;
@@ -274,7 +275,7 @@ public class CuratorProjectionService
InterProcessSemaphoreMutex lock = new InterProcessSemaphoreMutex(entry.getClient(), path);
if ( !lock.acquire(maxWaitMs, TimeUnit.MILLISECONDS) )
{
- return null; // TODO
+ return new GenericProjection();
}
Closer<InterProcessSemaphoreMutex> closer = new Closer<InterProcessSemaphoreMutex>()
@@ -379,9 +380,9 @@ public class CuratorProjectionService
@ThriftMethod
public PathChildrenCacheProjection startPathChildrenCache(final CuratorProjection projection, final String path, boolean cacheData, boolean dataIsCompressed, PathChildrenCacheStartMode startMode) throws Exception
{
- CuratorEntry entry = getEntry(projection);
+ final CuratorEntry entry = getEntry(projection);
- PathChildrenCache cache = new PathChildrenCache(entry.getClient(), path, cacheData, dataIsCompressed, ThreadUtils.newThreadFactory("PathChildrenCacheResource-%d"));
+ PathChildrenCache cache = new PathChildrenCache(entry.getClient(), path, cacheData, dataIsCompressed, ThreadUtils.newThreadFactory("PathChildrenCacheResource"));
cache.start(PathChildrenCache.StartMode.valueOf(startMode.name()));
Closer<PathChildrenCache> closer = new Closer<PathChildrenCache>()
@@ -407,7 +408,7 @@ public class CuratorProjectionService
@Override
public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) throws Exception
{
- // TODO
+ entry.addEvent(new RpcCuratorEvent(new RpcPathChildrenCacheEvent(path, event)));
}
};
cache.getListenable().addListener(listener);
@@ -440,7 +441,7 @@ public class CuratorProjectionService
{
return clazz.cast(createBuilder);
}
- throw new Exception("That operation is not available"); // TODO
+ throw new Exception("That operation is not available");
}
private <T> T getThis(CuratorEntry entry, String id, Class<T> clazz)
http://git-wip-us.apache.org/repos/asf/curator/blob/4c626a7a/curator-x-rpc/src/main/thrift/curator.thrift
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/thrift/curator.thrift b/curator-x-rpc/src/main/thrift/curator.thrift
index c553c1f..765b93c 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -12,7 +12,7 @@ enum CreateMode {
}
enum CuratorEventType {
- PING, CREATE, DELETE, EXISTS, GET_DATA, SET_DATA, CHILDREN, SYNC, GET_ACL, SET_ACL, WATCHED, CLOSING, CONNECTION_CONNECTED, CONNECTION_SUSPENDED, CONNECTION_RECONNECTED, CONNECTION_LOST, CONNECTION_READ_ONLY, LEADER
+ PING, CREATE, DELETE, EXISTS, GET_DATA, SET_DATA, CHILDREN, SYNC, GET_ACL, SET_ACL, WATCHED, CLOSING, CONNECTION_CONNECTED, CONNECTION_SUSPENDED, CONNECTION_RECONNECTED, CONNECTION_LOST, CONNECTION_READ_ONLY, LEADER, PATH_CHILDREN_CACHE
}
enum EventType {
@@ -157,6 +157,12 @@ struct ChildData {
3: binary data;
}
+struct PathChildrenCacheEvent {
+ 1: string cachedPath;
+ 2: PathChildrenCacheEventType type;
+ 3: ChildData data;
+}
+
struct CuratorEvent {
2: CuratorEventType type;
3: i32 resultCode;
@@ -169,11 +175,7 @@ struct CuratorEvent {
10: list<Acl> aclList;
11: WatchedEvent watchedEvent;
12: LeaderEvent leaderEvent;
-}
-
-struct PathChildrenCacheEvent {
- 1: PathChildrenCacheEventType type;
- 2: ChildData data;
+ 13: PathChildrenCacheEvent childrenCacheEvent;
}
service CuratorService {
http://git-wip-us.apache.org/repos/asf/curator/blob/4c626a7a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEvent.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEvent.java
index 847e89e..23ecbf4 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEvent.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEvent.java
@@ -46,6 +46,7 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
private static final org.apache.thrift.protocol.TField ACL_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("aclList", org.apache.thrift.protocol.TType.LIST, (short)10);
private static final org.apache.thrift.protocol.TField WATCHED_EVENT_FIELD_DESC = new org.apache.thrift.protocol.TField("watchedEvent", org.apache.thrift.protocol.TType.STRUCT, (short)11);
private static final org.apache.thrift.protocol.TField LEADER_EVENT_FIELD_DESC = new org.apache.thrift.protocol.TField("leaderEvent", org.apache.thrift.protocol.TType.STRUCT, (short)12);
+ private static final org.apache.thrift.protocol.TField CHILDREN_CACHE_EVENT_FIELD_DESC = new org.apache.thrift.protocol.TField("childrenCacheEvent", org.apache.thrift.protocol.TType.STRUCT, (short)13);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -68,6 +69,7 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
public List<Acl> aclList; // required
public WatchedEvent watchedEvent; // required
public LeaderEvent leaderEvent; // required
+ public PathChildrenCacheEvent childrenCacheEvent; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -85,7 +87,8 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
CHILDREN((short)9, "children"),
ACL_LIST((short)10, "aclList"),
WATCHED_EVENT((short)11, "watchedEvent"),
- LEADER_EVENT((short)12, "leaderEvent");
+ LEADER_EVENT((short)12, "leaderEvent"),
+ CHILDREN_CACHE_EVENT((short)13, "childrenCacheEvent");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -122,6 +125,8 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
return WATCHED_EVENT;
case 12: // LEADER_EVENT
return LEADER_EVENT;
+ case 13: // CHILDREN_CACHE_EVENT
+ return CHILDREN_CACHE_EVENT;
default:
return null;
}
@@ -191,6 +196,8 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, WatchedEvent.class)));
tmpMap.put(_Fields.LEADER_EVENT, new org.apache.thrift.meta_data.FieldMetaData("leaderEvent", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, LeaderEvent.class)));
+ tmpMap.put(_Fields.CHILDREN_CACHE_EVENT, new org.apache.thrift.meta_data.FieldMetaData("childrenCacheEvent", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, PathChildrenCacheEvent.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CuratorEvent.class, metaDataMap);
}
@@ -209,7 +216,8 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
List<String> children,
List<Acl> aclList,
WatchedEvent watchedEvent,
- LeaderEvent leaderEvent)
+ LeaderEvent leaderEvent,
+ PathChildrenCacheEvent childrenCacheEvent)
{
this();
this.type = type;
@@ -224,6 +232,7 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
this.aclList = aclList;
this.watchedEvent = watchedEvent;
this.leaderEvent = leaderEvent;
+ this.childrenCacheEvent = childrenCacheEvent;
}
/**
@@ -268,6 +277,9 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
if (other.isSetLeaderEvent()) {
this.leaderEvent = new LeaderEvent(other.leaderEvent);
}
+ if (other.isSetChildrenCacheEvent()) {
+ this.childrenCacheEvent = new PathChildrenCacheEvent(other.childrenCacheEvent);
+ }
}
public CuratorEvent deepCopy() {
@@ -288,6 +300,7 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
this.aclList = null;
this.watchedEvent = null;
this.leaderEvent = null;
+ this.childrenCacheEvent = null;
}
/**
@@ -601,6 +614,30 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
}
}
+ public PathChildrenCacheEvent getChildrenCacheEvent() {
+ return this.childrenCacheEvent;
+ }
+
+ public CuratorEvent setChildrenCacheEvent(PathChildrenCacheEvent childrenCacheEvent) {
+ this.childrenCacheEvent = childrenCacheEvent;
+ return this;
+ }
+
+ public void unsetChildrenCacheEvent() {
+ this.childrenCacheEvent = null;
+ }
+
+ /** Returns true if field childrenCacheEvent is set (has been assigned a value) and false otherwise */
+ public boolean isSetChildrenCacheEvent() {
+ return this.childrenCacheEvent != null;
+ }
+
+ public void setChildrenCacheEventIsSet(boolean value) {
+ if (!value) {
+ this.childrenCacheEvent = null;
+ }
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case TYPE:
@@ -691,6 +728,14 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
}
break;
+ case CHILDREN_CACHE_EVENT:
+ if (value == null) {
+ unsetChildrenCacheEvent();
+ } else {
+ setChildrenCacheEvent((PathChildrenCacheEvent)value);
+ }
+ break;
+
}
}
@@ -729,6 +774,9 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
case LEADER_EVENT:
return getLeaderEvent();
+ case CHILDREN_CACHE_EVENT:
+ return getChildrenCacheEvent();
+
}
throw new IllegalStateException();
}
@@ -762,6 +810,8 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
return isSetWatchedEvent();
case LEADER_EVENT:
return isSetLeaderEvent();
+ case CHILDREN_CACHE_EVENT:
+ return isSetChildrenCacheEvent();
}
throw new IllegalStateException();
}
@@ -878,6 +928,15 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
return false;
}
+ boolean this_present_childrenCacheEvent = true && this.isSetChildrenCacheEvent();
+ boolean that_present_childrenCacheEvent = true && that.isSetChildrenCacheEvent();
+ if (this_present_childrenCacheEvent || that_present_childrenCacheEvent) {
+ if (!(this_present_childrenCacheEvent && that_present_childrenCacheEvent))
+ return false;
+ if (!this.childrenCacheEvent.equals(that.childrenCacheEvent))
+ return false;
+ }
+
return true;
}
@@ -1004,6 +1063,16 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetChildrenCacheEvent()).compareTo(other.isSetChildrenCacheEvent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetChildrenCacheEvent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.childrenCacheEvent, other.childrenCacheEvent);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -1107,6 +1176,14 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
sb.append(this.leaderEvent);
}
first = false;
+ if (!first) sb.append(", ");
+ sb.append("childrenCacheEvent:");
+ if (this.childrenCacheEvent == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.childrenCacheEvent);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -1123,6 +1200,9 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
if (leaderEvent != null) {
leaderEvent.validate();
}
+ if (childrenCacheEvent != null) {
+ childrenCacheEvent.validate();
+ }
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -1273,6 +1353,15 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 13: // CHILDREN_CACHE_EVENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.childrenCacheEvent = new PathChildrenCacheEvent();
+ struct.childrenCacheEvent.read(iprot);
+ struct.setChildrenCacheEventIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -1355,6 +1444,11 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
struct.leaderEvent.write(oprot);
oprot.writeFieldEnd();
}
+ if (struct.childrenCacheEvent != null) {
+ oprot.writeFieldBegin(CHILDREN_CACHE_EVENT_FIELD_DESC);
+ struct.childrenCacheEvent.write(oprot);
+ oprot.writeFieldEnd();
+ }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -1406,7 +1500,10 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
if (struct.isSetLeaderEvent()) {
optionals.set(10);
}
- oprot.writeBitSet(optionals, 11);
+ if (struct.isSetChildrenCacheEvent()) {
+ optionals.set(11);
+ }
+ oprot.writeBitSet(optionals, 12);
if (struct.isSetType()) {
oprot.writeI32(struct.type.getValue());
}
@@ -1452,12 +1549,15 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
if (struct.isSetLeaderEvent()) {
struct.leaderEvent.write(oprot);
}
+ if (struct.isSetChildrenCacheEvent()) {
+ struct.childrenCacheEvent.write(oprot);
+ }
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, CuratorEvent struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(11);
+ BitSet incoming = iprot.readBitSet(12);
if (incoming.get(0)) {
struct.type = CuratorEventType.findByValue(iprot.readI32());
struct.setTypeIsSet(true);
@@ -1524,6 +1624,11 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
struct.leaderEvent.read(iprot);
struct.setLeaderEventIsSet(true);
}
+ if (incoming.get(11)) {
+ struct.childrenCacheEvent = new PathChildrenCacheEvent();
+ struct.childrenCacheEvent.read(iprot);
+ struct.setChildrenCacheEventIsSet(true);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/curator/blob/4c626a7a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEventType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEventType.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEventType.java
index 4e6fad1..46c57ae 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEventType.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEventType.java
@@ -29,7 +29,8 @@ public enum CuratorEventType implements org.apache.thrift.TEnum {
CONNECTION_RECONNECTED(14),
CONNECTION_LOST(15),
CONNECTION_READ_ONLY(16),
- LEADER(17);
+ LEADER(17),
+ PATH_CHILDREN_CACHE(18);
private final int value;
@@ -86,6 +87,8 @@ public enum CuratorEventType implements org.apache.thrift.TEnum {
return CONNECTION_READ_ONLY;
case 17:
return LEADER;
+ case 18:
+ return PATH_CHILDREN_CACHE;
default:
return null;
}
http://git-wip-us.apache.org/repos/asf/curator/blob/4c626a7a/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheEvent.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheEvent.java
index efa8aed..0532592 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheEvent.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheEvent.java
@@ -35,8 +35,9 @@ import org.slf4j.LoggerFactory;
public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChildrenCacheEvent, PathChildrenCacheEvent._Fields>, java.io.Serializable, Cloneable, Comparable<PathChildrenCacheEvent> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PathChildrenCacheEvent");
- private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final org.apache.thrift.protocol.TField DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("data", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+ private static final org.apache.thrift.protocol.TField CACHED_PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("cachedPath", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)2);
+ private static final org.apache.thrift.protocol.TField DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("data", org.apache.thrift.protocol.TType.STRUCT, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -44,6 +45,7 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
schemes.put(TupleScheme.class, new PathChildrenCacheEventTupleSchemeFactory());
}
+ public String cachedPath; // required
/**
*
* @see PathChildrenCacheEventType
@@ -53,12 +55,13 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ CACHED_PATH((short)1, "cachedPath"),
/**
*
* @see PathChildrenCacheEventType
*/
- TYPE((short)1, "type"),
- DATA((short)2, "data");
+ TYPE((short)2, "type"),
+ DATA((short)3, "data");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -73,9 +76,11 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
- case 1: // TYPE
+ case 1: // CACHED_PATH
+ return CACHED_PATH;
+ case 2: // TYPE
return TYPE;
- case 2: // DATA
+ case 3: // DATA
return DATA;
default:
return null;
@@ -120,6 +125,8 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
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.CACHED_PATH, new org.apache.thrift.meta_data.FieldMetaData("cachedPath", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, PathChildrenCacheEventType.class)));
tmpMap.put(_Fields.DATA, new org.apache.thrift.meta_data.FieldMetaData("data", org.apache.thrift.TFieldRequirementType.DEFAULT,
@@ -132,10 +139,12 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
}
public PathChildrenCacheEvent(
+ String cachedPath,
PathChildrenCacheEventType type,
ChildData data)
{
this();
+ this.cachedPath = cachedPath;
this.type = type;
this.data = data;
}
@@ -144,6 +153,9 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
* Performs a deep copy on <i>other</i>.
*/
public PathChildrenCacheEvent(PathChildrenCacheEvent other) {
+ if (other.isSetCachedPath()) {
+ this.cachedPath = other.cachedPath;
+ }
if (other.isSetType()) {
this.type = other.type;
}
@@ -158,10 +170,35 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
@Override
public void clear() {
+ this.cachedPath = null;
this.type = null;
this.data = null;
}
+ public String getCachedPath() {
+ return this.cachedPath;
+ }
+
+ public PathChildrenCacheEvent setCachedPath(String cachedPath) {
+ this.cachedPath = cachedPath;
+ return this;
+ }
+
+ public void unsetCachedPath() {
+ this.cachedPath = null;
+ }
+
+ /** Returns true if field cachedPath is set (has been assigned a value) and false otherwise */
+ public boolean isSetCachedPath() {
+ return this.cachedPath != null;
+ }
+
+ public void setCachedPathIsSet(boolean value) {
+ if (!value) {
+ this.cachedPath = null;
+ }
+ }
+
/**
*
* @see PathChildrenCacheEventType
@@ -220,6 +257,14 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
public void setFieldValue(_Fields field, Object value) {
switch (field) {
+ case CACHED_PATH:
+ if (value == null) {
+ unsetCachedPath();
+ } else {
+ setCachedPath((String)value);
+ }
+ break;
+
case TYPE:
if (value == null) {
unsetType();
@@ -241,6 +286,9 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
public Object getFieldValue(_Fields field) {
switch (field) {
+ case CACHED_PATH:
+ return getCachedPath();
+
case TYPE:
return getType();
@@ -258,6 +306,8 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
}
switch (field) {
+ case CACHED_PATH:
+ return isSetCachedPath();
case TYPE:
return isSetType();
case DATA:
@@ -279,6 +329,15 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
if (that == null)
return false;
+ boolean this_present_cachedPath = true && this.isSetCachedPath();
+ boolean that_present_cachedPath = true && that.isSetCachedPath();
+ if (this_present_cachedPath || that_present_cachedPath) {
+ if (!(this_present_cachedPath && that_present_cachedPath))
+ return false;
+ if (!this.cachedPath.equals(that.cachedPath))
+ return false;
+ }
+
boolean this_present_type = true && this.isSetType();
boolean that_present_type = true && that.isSetType();
if (this_present_type || that_present_type) {
@@ -313,6 +372,16 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
int lastComparison = 0;
+ lastComparison = Boolean.valueOf(isSetCachedPath()).compareTo(other.isSetCachedPath());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetCachedPath()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cachedPath, other.cachedPath);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType());
if (lastComparison != 0) {
return lastComparison;
@@ -353,6 +422,14 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
StringBuilder sb = new StringBuilder("PathChildrenCacheEvent(");
boolean first = true;
+ sb.append("cachedPath:");
+ if (this.cachedPath == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.cachedPath);
+ }
+ first = false;
+ if (!first) sb.append(", ");
sb.append("type:");
if (this.type == null) {
sb.append("null");
@@ -414,7 +491,15 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
break;
}
switch (schemeField.id) {
- case 1: // TYPE
+ case 1: // CACHED_PATH
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.cachedPath = iprot.readString();
+ struct.setCachedPathIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.type = PathChildrenCacheEventType.findByValue(iprot.readI32());
struct.setTypeIsSet(true);
@@ -422,7 +507,7 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
- case 2: // DATA
+ case 3: // DATA
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.data = new ChildData();
struct.data.read(iprot);
@@ -446,6 +531,11 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.cachedPath != null) {
+ oprot.writeFieldBegin(CACHED_PATH_FIELD_DESC);
+ oprot.writeString(struct.cachedPath);
+ oprot.writeFieldEnd();
+ }
if (struct.type != null) {
oprot.writeFieldBegin(TYPE_FIELD_DESC);
oprot.writeI32(struct.type.getValue());
@@ -474,13 +564,19 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
public void write(org.apache.thrift.protocol.TProtocol prot, PathChildrenCacheEvent struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
- if (struct.isSetType()) {
+ if (struct.isSetCachedPath()) {
optionals.set(0);
}
- if (struct.isSetData()) {
+ if (struct.isSetType()) {
optionals.set(1);
}
- oprot.writeBitSet(optionals, 2);
+ if (struct.isSetData()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetCachedPath()) {
+ oprot.writeString(struct.cachedPath);
+ }
if (struct.isSetType()) {
oprot.writeI32(struct.type.getValue());
}
@@ -492,12 +588,16 @@ public class PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChild
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, PathChildrenCacheEvent struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(2);
+ BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
+ struct.cachedPath = iprot.readString();
+ struct.setCachedPathIsSet(true);
+ }
+ if (incoming.get(1)) {
struct.type = PathChildrenCacheEventType.findByValue(iprot.readI32());
struct.setTypeIsSet(true);
}
- if (incoming.get(1)) {
+ if (incoming.get(2)) {
struct.data = new ChildData();
struct.data.read(iprot);
struct.setDataIsSet(true);
http://git-wip-us.apache.org/repos/asf/curator/blob/4c626a7a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
index 02c8ccb..fe14504 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
@@ -70,11 +70,12 @@ public class TestClient
CreateSpec createSpec = new CreateSpec();
createSpec.path = "/a/b/c";
createSpec.creatingParentsIfNeeded = true;
- createSpec.asyncContext = "foo";
createSpec.data = ByteBuffer.wrap("hey".getBytes());
OptionalPath path = client.createNode(curatorProjection, createSpec);
System.out.println("Path: " + path);
+ PathChildrenCacheProjection pathChildrenCacheProjection = client.startPathChildrenCache(curatorProjection, "/a/b", true, false, PathChildrenCacheStartMode.BUILD_INITIAL_CACHE);
+
GetChildrenSpec getChildrenSpec = new GetChildrenSpec();
getChildrenSpec.path = "/a";
OptionalChildrenList children = client.getChildren(curatorProjection, getChildrenSpec);
[6/7] Finished path children cache
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/curator/blob/6f9a9ab4/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java
index aab8a8d..8936004 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java
@@ -54,6 +54,10 @@ public class CuratorService {
public List<Participant> getLeaderParticipants(CuratorProjection projection, LeaderProjection leaderProjection) throws org.apache.thrift.TException;
+ public List<ChildData> getPathChildrenCacheData(CuratorProjection projection, PathChildrenCacheProjection cacheProjection) throws org.apache.thrift.TException;
+
+ public ChildData getPathChildrenCacheDataForPath(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, String path) throws org.apache.thrift.TException;
+
public boolean isLeader(CuratorProjection projection, LeaderProjection leaderProjection) throws org.apache.thrift.TException;
public CuratorProjection newCuratorProjection(String connectionName) throws org.apache.thrift.TException;
@@ -86,6 +90,10 @@ public class CuratorService {
public void getLeaderParticipants(CuratorProjection projection, LeaderProjection leaderProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void getPathChildrenCacheData(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void getPathChildrenCacheDataForPath(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, String path, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
public void isLeader(CuratorProjection projection, LeaderProjection leaderProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void newCuratorProjection(String connectionName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
@@ -328,6 +336,55 @@ public class CuratorService {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getLeaderParticipants failed: unknown result");
}
+ public List<ChildData> getPathChildrenCacheData(CuratorProjection projection, PathChildrenCacheProjection cacheProjection) throws org.apache.thrift.TException
+ {
+ send_getPathChildrenCacheData(projection, cacheProjection);
+ return recv_getPathChildrenCacheData();
+ }
+
+ public void send_getPathChildrenCacheData(CuratorProjection projection, PathChildrenCacheProjection cacheProjection) throws org.apache.thrift.TException
+ {
+ getPathChildrenCacheData_args args = new getPathChildrenCacheData_args();
+ args.setProjection(projection);
+ args.setCacheProjection(cacheProjection);
+ sendBase("getPathChildrenCacheData", args);
+ }
+
+ public List<ChildData> recv_getPathChildrenCacheData() throws org.apache.thrift.TException
+ {
+ getPathChildrenCacheData_result result = new getPathChildrenCacheData_result();
+ receiveBase(result, "getPathChildrenCacheData");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPathChildrenCacheData failed: unknown result");
+ }
+
+ public ChildData getPathChildrenCacheDataForPath(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, String path) throws org.apache.thrift.TException
+ {
+ send_getPathChildrenCacheDataForPath(projection, cacheProjection, path);
+ return recv_getPathChildrenCacheDataForPath();
+ }
+
+ public void send_getPathChildrenCacheDataForPath(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, String path) throws org.apache.thrift.TException
+ {
+ getPathChildrenCacheDataForPath_args args = new getPathChildrenCacheDataForPath_args();
+ args.setProjection(projection);
+ args.setCacheProjection(cacheProjection);
+ args.setPath(path);
+ sendBase("getPathChildrenCacheDataForPath", args);
+ }
+
+ public ChildData recv_getPathChildrenCacheDataForPath() throws org.apache.thrift.TException
+ {
+ getPathChildrenCacheDataForPath_result result = new getPathChildrenCacheDataForPath_result();
+ receiveBase(result, "getPathChildrenCacheDataForPath");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPathChildrenCacheDataForPath failed: unknown result");
+ }
+
public boolean isLeader(CuratorProjection projection, LeaderProjection leaderProjection) throws org.apache.thrift.TException
{
send_isLeader(projection, leaderProjection);
@@ -785,6 +842,79 @@ public class CuratorService {
}
}
+ public void getPathChildrenCacheData(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ getPathChildrenCacheData_call method_call = new getPathChildrenCacheData_call(projection, cacheProjection, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class getPathChildrenCacheData_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private CuratorProjection projection;
+ private PathChildrenCacheProjection cacheProjection;
+ public getPathChildrenCacheData_call(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.projection = projection;
+ this.cacheProjection = cacheProjection;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getPathChildrenCacheData", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ getPathChildrenCacheData_args args = new getPathChildrenCacheData_args();
+ args.setProjection(projection);
+ args.setCacheProjection(cacheProjection);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public List<ChildData> getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_getPathChildrenCacheData();
+ }
+ }
+
+ public void getPathChildrenCacheDataForPath(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, String path, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ getPathChildrenCacheDataForPath_call method_call = new getPathChildrenCacheDataForPath_call(projection, cacheProjection, path, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class getPathChildrenCacheDataForPath_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private CuratorProjection projection;
+ private PathChildrenCacheProjection cacheProjection;
+ private String path;
+ public getPathChildrenCacheDataForPath_call(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, String path, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.projection = projection;
+ this.cacheProjection = cacheProjection;
+ this.path = path;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getPathChildrenCacheDataForPath", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ getPathChildrenCacheDataForPath_args args = new getPathChildrenCacheDataForPath_args();
+ args.setProjection(projection);
+ args.setCacheProjection(cacheProjection);
+ args.setPath(path);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public ChildData getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_getPathChildrenCacheDataForPath();
+ }
+ }
+
public void isLeader(CuratorProjection projection, LeaderProjection leaderProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
isLeader_call method_call = new isLeader_call(projection, leaderProjection, resultHandler, this, ___protocolFactory, ___transport);
@@ -994,6 +1124,8 @@ public class CuratorService {
processMap.put("getChildren", new getChildren());
processMap.put("getData", new getData());
processMap.put("getLeaderParticipants", new getLeaderParticipants());
+ processMap.put("getPathChildrenCacheData", new getPathChildrenCacheData());
+ processMap.put("getPathChildrenCacheDataForPath", new getPathChildrenCacheDataForPath());
processMap.put("isLeader", new isLeader());
processMap.put("newCuratorProjection", new newCuratorProjection());
processMap.put("setData", new setData());
@@ -1183,6 +1315,46 @@ public class CuratorService {
}
}
+ public static class getPathChildrenCacheData<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getPathChildrenCacheData_args> {
+ public getPathChildrenCacheData() {
+ super("getPathChildrenCacheData");
+ }
+
+ public getPathChildrenCacheData_args getEmptyArgsInstance() {
+ return new getPathChildrenCacheData_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public getPathChildrenCacheData_result getResult(I iface, getPathChildrenCacheData_args args) throws org.apache.thrift.TException {
+ getPathChildrenCacheData_result result = new getPathChildrenCacheData_result();
+ result.success = iface.getPathChildrenCacheData(args.projection, args.cacheProjection);
+ return result;
+ }
+ }
+
+ public static class getPathChildrenCacheDataForPath<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getPathChildrenCacheDataForPath_args> {
+ public getPathChildrenCacheDataForPath() {
+ super("getPathChildrenCacheDataForPath");
+ }
+
+ public getPathChildrenCacheDataForPath_args getEmptyArgsInstance() {
+ return new getPathChildrenCacheDataForPath_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public getPathChildrenCacheDataForPath_result getResult(I iface, getPathChildrenCacheDataForPath_args args) throws org.apache.thrift.TException {
+ getPathChildrenCacheDataForPath_result result = new getPathChildrenCacheDataForPath_result();
+ result.success = iface.getPathChildrenCacheDataForPath(args.projection, args.cacheProjection, args.path);
+ return result;
+ }
+ }
+
public static class isLeader<I extends Iface> extends org.apache.thrift.ProcessFunction<I, isLeader_args> {
public isLeader() {
super("isLeader");
@@ -1306,6 +1478,8 @@ public class CuratorService {
processMap.put("getChildren", new getChildren());
processMap.put("getData", new getData());
processMap.put("getLeaderParticipants", new getLeaderParticipants());
+ processMap.put("getPathChildrenCacheData", new getPathChildrenCacheData());
+ processMap.put("getPathChildrenCacheDataForPath", new getPathChildrenCacheDataForPath());
processMap.put("isLeader", new isLeader());
processMap.put("newCuratorProjection", new newCuratorProjection());
processMap.put("setData", new setData());
@@ -1772,6 +1946,108 @@ public class CuratorService {
}
}
+ public static class getPathChildrenCacheData<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getPathChildrenCacheData_args, List<ChildData>> {
+ public getPathChildrenCacheData() {
+ super("getPathChildrenCacheData");
+ }
+
+ public getPathChildrenCacheData_args getEmptyArgsInstance() {
+ return new getPathChildrenCacheData_args();
+ }
+
+ public AsyncMethodCallback<List<ChildData>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<List<ChildData>>() {
+ public void onComplete(List<ChildData> o) {
+ getPathChildrenCacheData_result result = new getPathChildrenCacheData_result();
+ result.success = o;
+ try {
+ fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+ return;
+ } catch (Exception e) {
+ LOGGER.error("Exception writing to internal frame buffer", e);
+ }
+ fb.close();
+ }
+ public void onError(Exception e) {
+ byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+ org.apache.thrift.TBase msg;
+ getPathChildrenCacheData_result result = new getPathChildrenCacheData_result();
+ {
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+ }
+ try {
+ fcall.sendResponse(fb,msg,msgType,seqid);
+ return;
+ } catch (Exception ex) {
+ LOGGER.error("Exception writing to internal frame buffer", ex);
+ }
+ fb.close();
+ }
+ };
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public void start(I iface, getPathChildrenCacheData_args args, org.apache.thrift.async.AsyncMethodCallback<List<ChildData>> resultHandler) throws TException {
+ iface.getPathChildrenCacheData(args.projection, args.cacheProjection,resultHandler);
+ }
+ }
+
+ public static class getPathChildrenCacheDataForPath<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getPathChildrenCacheDataForPath_args, ChildData> {
+ public getPathChildrenCacheDataForPath() {
+ super("getPathChildrenCacheDataForPath");
+ }
+
+ public getPathChildrenCacheDataForPath_args getEmptyArgsInstance() {
+ return new getPathChildrenCacheDataForPath_args();
+ }
+
+ public AsyncMethodCallback<ChildData> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<ChildData>() {
+ public void onComplete(ChildData o) {
+ getPathChildrenCacheDataForPath_result result = new getPathChildrenCacheDataForPath_result();
+ result.success = o;
+ try {
+ fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+ return;
+ } catch (Exception e) {
+ LOGGER.error("Exception writing to internal frame buffer", e);
+ }
+ fb.close();
+ }
+ public void onError(Exception e) {
+ byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+ org.apache.thrift.TBase msg;
+ getPathChildrenCacheDataForPath_result result = new getPathChildrenCacheDataForPath_result();
+ {
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+ }
+ try {
+ fcall.sendResponse(fb,msg,msgType,seqid);
+ return;
+ } catch (Exception ex) {
+ LOGGER.error("Exception writing to internal frame buffer", ex);
+ }
+ fb.close();
+ }
+ };
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public void start(I iface, getPathChildrenCacheDataForPath_args args, org.apache.thrift.async.AsyncMethodCallback<ChildData> resultHandler) throws TException {
+ iface.getPathChildrenCacheDataForPath(args.projection, args.cacheProjection, args.path,resultHandler);
+ }
+ }
+
public static class isLeader<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, isLeader_args, Boolean> {
public isLeader() {
super("isLeader");
@@ -9249,6 +9525,1801 @@ public class CuratorService {
}
+ public static class getPathChildrenCacheData_args implements org.apache.thrift.TBase<getPathChildrenCacheData_args, getPathChildrenCacheData_args._Fields>, java.io.Serializable, Cloneable, Comparable<getPathChildrenCacheData_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPathChildrenCacheData_args");
+
+ private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+ private static final org.apache.thrift.protocol.TField CACHE_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("cacheProjection", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new getPathChildrenCacheData_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new getPathChildrenCacheData_argsTupleSchemeFactory());
+ }
+
+ public CuratorProjection projection; // required
+ public PathChildrenCacheProjection cacheProjection; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROJECTION((short)1, "projection"),
+ CACHE_PROJECTION((short)2, "cacheProjection");
+
+ 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: // PROJECTION
+ return PROJECTION;
+ case 2: // CACHE_PROJECTION
+ return CACHE_PROJECTION;
+ 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
+ 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.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
+ tmpMap.put(_Fields.CACHE_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("cacheProjection", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, PathChildrenCacheProjection.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPathChildrenCacheData_args.class, metaDataMap);
+ }
+
+ public getPathChildrenCacheData_args() {
+ }
+
+ public getPathChildrenCacheData_args(
+ CuratorProjection projection,
+ PathChildrenCacheProjection cacheProjection)
+ {
+ this();
+ this.projection = projection;
+ this.cacheProjection = cacheProjection;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public getPathChildrenCacheData_args(getPathChildrenCacheData_args other) {
+ if (other.isSetProjection()) {
+ this.projection = new CuratorProjection(other.projection);
+ }
+ if (other.isSetCacheProjection()) {
+ this.cacheProjection = new PathChildrenCacheProjection(other.cacheProjection);
+ }
+ }
+
+ public getPathChildrenCacheData_args deepCopy() {
+ return new getPathChildrenCacheData_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.projection = null;
+ this.cacheProjection = null;
+ }
+
+ public CuratorProjection getProjection() {
+ return this.projection;
+ }
+
+ public getPathChildrenCacheData_args setProjection(CuratorProjection projection) {
+ this.projection = projection;
+ return this;
+ }
+
+ public void unsetProjection() {
+ this.projection = null;
+ }
+
+ /** Returns true if field projection is set (has been assigned a value) and false otherwise */
+ public boolean isSetProjection() {
+ return this.projection != null;
+ }
+
+ public void setProjectionIsSet(boolean value) {
+ if (!value) {
+ this.projection = null;
+ }
+ }
+
+ public PathChildrenCacheProjection getCacheProjection() {
+ return this.cacheProjection;
+ }
+
+ public getPathChildrenCacheData_args setCacheProjection(PathChildrenCacheProjection cacheProjection) {
+ this.cacheProjection = cacheProjection;
+ return this;
+ }
+
+ public void unsetCacheProjection() {
+ this.cacheProjection = null;
+ }
+
+ /** Returns true if field cacheProjection is set (has been assigned a value) and false otherwise */
+ public boolean isSetCacheProjection() {
+ return this.cacheProjection != null;
+ }
+
+ public void setCacheProjectionIsSet(boolean value) {
+ if (!value) {
+ this.cacheProjection = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROJECTION:
+ if (value == null) {
+ unsetProjection();
+ } else {
+ setProjection((CuratorProjection)value);
+ }
+ break;
+
+ case CACHE_PROJECTION:
+ if (value == null) {
+ unsetCacheProjection();
+ } else {
+ setCacheProjection((PathChildrenCacheProjection)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROJECTION:
+ return getProjection();
+
+ case CACHE_PROJECTION:
+ return getCacheProjection();
+
+ }
+ 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 PROJECTION:
+ return isSetProjection();
+ case CACHE_PROJECTION:
+ return isSetCacheProjection();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof getPathChildrenCacheData_args)
+ return this.equals((getPathChildrenCacheData_args)that);
+ return false;
+ }
+
+ public boolean equals(getPathChildrenCacheData_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_projection = true && this.isSetProjection();
+ boolean that_present_projection = true && that.isSetProjection();
+ if (this_present_projection || that_present_projection) {
+ if (!(this_present_projection && that_present_projection))
+ return false;
+ if (!this.projection.equals(that.projection))
+ return false;
+ }
+
+ boolean this_present_cacheProjection = true && this.isSetCacheProjection();
+ boolean that_present_cacheProjection = true && that.isSetCacheProjection();
+ if (this_present_cacheProjection || that_present_cacheProjection) {
+ if (!(this_present_cacheProjection && that_present_cacheProjection))
+ return false;
+ if (!this.cacheProjection.equals(that.cacheProjection))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(getPathChildrenCacheData_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProjection()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetCacheProjection()).compareTo(other.isSetCacheProjection());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetCacheProjection()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cacheProjection, other.cacheProjection);
+ 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("getPathChildrenCacheData_args(");
+ boolean first = true;
+
+ sb.append("projection:");
+ if (this.projection == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.projection);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("cacheProjection:");
+ if (this.cacheProjection == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.cacheProjection);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (projection != null) {
+ projection.validate();
+ }
+ if (cacheProjection != null) {
+ cacheProjection.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ 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 getPathChildrenCacheData_argsStandardSchemeFactory implements SchemeFactory {
+ public getPathChildrenCacheData_argsStandardScheme getScheme() {
+ return new getPathChildrenCacheData_argsStandardScheme();
+ }
+ }
+
+ private static class getPathChildrenCacheData_argsStandardScheme extends StandardScheme<getPathChildrenCacheData_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, getPathChildrenCacheData_args 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: // PROJECTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.projection = new CuratorProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // CACHE_PROJECTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.cacheProjection = new PathChildrenCacheProjection();
+ struct.cacheProjection.read(iprot);
+ struct.setCacheProjectionIsSet(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, getPathChildrenCacheData_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.projection != null) {
+ oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
+ struct.projection.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.cacheProjection != null) {
+ oprot.writeFieldBegin(CACHE_PROJECTION_FIELD_DESC);
+ struct.cacheProjection.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class getPathChildrenCacheData_argsTupleSchemeFactory implements SchemeFactory {
+ public getPathChildrenCacheData_argsTupleScheme getScheme() {
+ return new getPathChildrenCacheData_argsTupleScheme();
+ }
+ }
+
+ private static class getPathChildrenCacheData_argsTupleScheme extends TupleScheme<getPathChildrenCacheData_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, getPathChildrenCacheData_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetProjection()) {
+ optionals.set(0);
+ }
+ if (struct.isSetCacheProjection()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetProjection()) {
+ struct.projection.write(oprot);
+ }
+ if (struct.isSetCacheProjection()) {
+ struct.cacheProjection.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, getPathChildrenCacheData_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.projection = new CuratorProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.cacheProjection = new PathChildrenCacheProjection();
+ struct.cacheProjection.read(iprot);
+ struct.setCacheProjectionIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class getPathChildrenCacheData_result implements org.apache.thrift.TBase<getPathChildrenCacheData_result, getPathChildrenCacheData_result._Fields>, java.io.Serializable, Cloneable, Comparable<getPathChildrenCacheData_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPathChildrenCacheData_result");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new getPathChildrenCacheData_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new getPathChildrenCacheData_resultTupleSchemeFactory());
+ }
+
+ public List<ChildData> success; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ SUCCESS((short)0, "success");
+
+ 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 0: // SUCCESS
+ return SUCCESS;
+ 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
+ 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ChildData.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPathChildrenCacheData_result.class, metaDataMap);
+ }
+
+ public getPathChildrenCacheData_result() {
+ }
+
+ public getPathChildrenCacheData_result(
+ List<ChildData> success)
+ {
+ this();
+ this.success = success;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public getPathChildrenCacheData_result(getPathChildrenCacheData_result other) {
+ if (other.isSetSuccess()) {
+ List<ChildData> __this__success = new ArrayList<ChildData>(other.success.size());
+ for (ChildData other_element : other.success) {
+ __this__success.add(new ChildData(other_element));
+ }
+ this.success = __this__success;
+ }
+ }
+
+ public getPathChildrenCacheData_result deepCopy() {
+ return new getPathChildrenCacheData_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ }
+
+ public int getSuccessSize() {
+ return (this.success == null) ? 0 : this.success.size();
+ }
+
+ public java.util.Iterator<ChildData> getSuccessIterator() {
+ return (this.success == null) ? null : this.success.iterator();
+ }
+
+ public void addToSuccess(ChildData elem) {
+ if (this.success == null) {
+ this.success = new ArrayList<ChildData>();
+ }
+ this.success.add(elem);
+ }
+
+ public List<ChildData> getSuccess() {
+ return this.success;
+ }
+
+ public getPathChildrenCacheData_result setSuccess(List<ChildData> success) {
+ this.success = success;
+ return this;
+ }
+
+ public void unsetSuccess() {
+ this.success = null;
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return this.success != null;
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ if (!value) {
+ this.success = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((List<ChildData>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return getSuccess();
+
+ }
+ 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 SUCCESS:
+ return isSetSuccess();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof getPathChildrenCacheData_result)
+ return this.equals((getPathChildrenCacheData_result)that);
+ return false;
+ }
+
+ public boolean equals(getPathChildrenCacheData_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true && this.isSetSuccess();
+ boolean that_present_success = true && that.isSetSuccess();
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(getPathChildrenCacheData_result other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+ 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("getPathChildrenCacheData_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ if (this.success == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.success);
+ }
+ 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 getPathChildrenCacheData_resultStandardSchemeFactory implements SchemeFactory {
+ public getPathChildrenCacheData_resultStandardScheme getScheme() {
+ return new getPathChildrenCacheData_resultStandardScheme();
+ }
+ }
+
+ private static class getPathChildrenCacheData_resultStandardScheme extends StandardScheme<getPathChildrenCacheData_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, getPathChildrenCacheData_result 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 0: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list32 = iprot.readListBegin();
+ struct.success = new ArrayList<ChildData>(_list32.size);
+ for (int _i33 = 0; _i33 < _list32.size; ++_i33)
+ {
+ ChildData _elem34;
+ _elem34 = new ChildData();
+ _elem34.read(iprot);
+ struct.success.add(_elem34);
+ }
+ iprot.readListEnd();
+ }
+ struct.setSuccessIsSet(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, getPathChildrenCacheData_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.success != null) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size()));
+ for (ChildData _iter35 : struct.success)
+ {
+ _iter35.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class getPathChildrenCacheData_resultTupleSchemeFactory implements SchemeFactory {
+ public getPathChildrenCacheData_resultTupleScheme getScheme() {
+ return new getPathChildrenCacheData_resultTupleScheme();
+ }
+ }
+
+ private static class getPathChildrenCacheData_resultTupleScheme extends TupleScheme<getPathChildrenCacheData_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, getPathChildrenCacheData_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetSuccess()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetSuccess()) {
+ {
+ oprot.writeI32(struct.success.size());
+ for (ChildData _iter36 : struct.success)
+ {
+ _iter36.write(oprot);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, getPathChildrenCacheData_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.success = new ArrayList<ChildData>(_list37.size);
+ for (int _i38 = 0; _i38 < _list37.size; ++_i38)
+ {
+ ChildData _elem39;
+ _elem39 = new ChildData();
+ _elem39.read(iprot);
+ struct.success.add(_elem39);
+ }
+ }
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class getPathChildrenCacheDataForPath_args implements org.apache.thrift.TBase<getPathChildrenCacheDataForPath_args, getPathChildrenCacheDataForPath_args._Fields>, java.io.Serializable, Cloneable, Comparable<getPathChildrenCacheDataForPath_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPathChildrenCacheDataForPath_args");
+
+ private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+ private static final org.apache.thrift.protocol.TField CACHE_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("cacheProjection", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+ private static final org.apache.thrift.protocol.TField PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("path", org.apache.thrift.protocol.TType.STRING, (short)3);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new getPathChildrenCacheDataForPath_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new getPathChildrenCacheDataForPath_argsTupleSchemeFactory());
+ }
+
+ public CuratorProjection projection; // required
+ public PathChildrenCacheProjection cacheProjection; // required
+ public String path; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROJECTION((short)1, "projection"),
+ CACHE_PROJECTION((short)2, "cacheProjection"),
+ PATH((short)3, "path");
+
+ 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: // PROJECTION
+ return PROJECTION;
+ case 2: // CACHE_PROJECTION
+ return CACHE_PROJECTION;
+ case 3: // PATH
+ return PATH;
+ 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
+ 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.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
+ tmpMap.put(_Fields.CACHE_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("cacheProjection", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, PathChildrenCacheProjection.class)));
+ tmpMap.put(_Fields.PATH, new org.apache.thrift.meta_data.FieldMetaData("path", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPathChildrenCacheDataForPath_args.class, metaDataMap);
+ }
+
+ public getPathChildrenCacheDataForPath_args() {
+ }
+
+ public getPathChildrenCacheDataForPath_args(
+ CuratorProjection projection,
+ PathChildrenCacheProjection cacheProjection,
+ String path)
+ {
+ this();
+ this.projection = projection;
+ this.cacheProjection = cacheProjection;
+ this.path = path;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public getPathChildrenCacheDataForPath_args(getPathChildrenCacheDataForPath_args other) {
+ if (other.isSetProjection()) {
+ this.projection = new CuratorProjection(other.projection);
+ }
+ if (other.isSetCacheProjection()) {
+ this.cacheProjection = new PathChildrenCacheProjection(other.cacheProjection);
+ }
+ if (other.isSetPath()) {
+ this.path = other.path;
+ }
+ }
+
+ public getPathChildrenCacheDataForPath_args deepCopy() {
+ return new getPathChildrenCacheDataForPath_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.projection = null;
+ this.cacheProjection = null;
+ this.path = null;
+ }
+
+ public CuratorProjection getProjection() {
+ return this.projection;
+ }
+
+ public getPathChildrenCacheDataForPath_args setProjection(CuratorProjection projection) {
+ this.projection = projection;
+ return this;
+ }
+
+ public void unsetProjection() {
+ this.projection = null;
+ }
+
+ /** Returns true if field projection is set (has been assigned a value) and false otherwise */
+ public boolean isSetProjection() {
+ return this.projection != null;
+ }
+
+ public void setProjectionIsSet(boolean value) {
+ if (!value) {
+ this.projection = null;
+ }
+ }
+
+ public PathChildrenCacheProjection getCacheProjection() {
+ return this.cacheProjection;
+ }
+
+ public getPathChildrenCacheDataForPath_args setCacheProjection(PathChildrenCacheProjection cacheProjection) {
+ this.cacheProjection = cacheProjection;
+ return this;
+ }
+
+ public void unsetCacheProjection() {
+ this.cacheProjection = null;
+ }
+
+ /** Returns true if field cacheProjection is set (has been assigned a value) and false otherwise */
+ public boolean isSetCacheProjection() {
+ return this.cacheProjection != null;
+ }
+
+ public void setCacheProjectionIsSet(boolean value) {
+ if (!value) {
+ this.cacheProjection = null;
+ }
+ }
+
+ public String getPath() {
+ return this.path;
+ }
+
+ public getPathChildrenCacheDataForPath_args setPath(String path) {
+ this.path = path;
+ return this;
+ }
+
+ public void unsetPath() {
+ this.path = null;
+ }
+
+ /** Returns true if field path is set (has been assigned a value) and false otherwise */
+ public boolean isSetPath() {
+ return this.path != null;
+ }
+
+ public void setPathIsSet(boolean value) {
+ if (!value) {
+ this.path = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROJECTION:
+ if (value == null) {
+ unsetProjection();
+ } else {
+ setProjection((CuratorProjection)value);
+ }
+ break;
+
+ case CACHE_PROJECTION:
+ if (value == null) {
+ unsetCacheProjection();
+ } else {
+ setCacheProjection((PathChildrenCacheProjection)value);
+ }
+ break;
+
+ case PATH:
+ if (value == null) {
+ unsetPath();
+ } else {
+ setPath((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROJECTION:
+ return getProjection();
+
+ case CACHE_PROJECTION:
+ return getCacheProjection();
+
+ case PATH:
+ return getPath();
+
+ }
+ 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 PROJECTION:
+ return isSetProjection();
+ case CACHE_PROJECTION:
+ return isSetCacheProjection();
+ case PATH:
+ return isSetPath();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof getPathChildrenCacheDataForPath_args)
+ return this.equals((getPathChildrenCacheDataForPath_args)that);
+ return false;
+ }
+
+ public boolean equals(getPathChildrenCacheDataForPath_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_projection = true && this.isSetProjection();
+ boolean that_present_projection = true && that.isSetProjection();
+ if (this_present_projection || that_present_projection) {
+ if (!(this_present_projection && that_present_projection))
+ return false;
+ if (!this.projection.equals(that.projection))
+ return false;
+ }
+
+ boolean this_present_cacheProjection = true && this.isSetCacheProjection();
+ boolean that_present_cacheProjection = true && that.isSetCacheProjection();
+ if (this_present_cacheProjection || that_present_cacheProjection) {
+ if (!(this_present_cacheProjection && that_present_cacheProjection))
+ return false;
+ if (!this.cacheProjection.equals(that.cacheProjection))
+ return false;
+ }
+
+ boolean this_present_path = true && this.isSetPath();
+ boolean that_present_path = true && that.isSetPath();
+ if (this_present_path || that_present_path) {
+ if (!(this_present_path && that_present_path))
+ return false;
+ if (!this.path.equals(that.path))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(getPathChildrenCacheDataForPath_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProjection()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetCacheProjection()).compareTo(other.isSetCacheProjection());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetCacheProjection()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cacheProjection, other.cacheProjection);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPath()).compareTo(other.isSetPath());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPath()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.path, other.path);
+ 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("getPathChildrenCacheDataForPath_args(");
+ boolean first = true;
+
+ sb.append("projection:");
+ if (this.projection == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.projection);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("cacheProjection:");
+ if (this.cacheProjection == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.cacheProjection);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("path:");
+ if (this.path == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.path);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (projection != null) {
+ projection.validate();
+ }
+ if (cacheProjection != null) {
+ cacheProjection.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ 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 getPathChildrenCacheDataForPath_argsStandardSchemeFactory implements SchemeFactory {
+ public getPathChildrenCacheDataForPath_argsStandardScheme getScheme() {
+ return new getPathChildrenCacheDataForPath_argsStandardScheme();
+ }
+ }
+
+ private static class getPathChildrenCacheDataForPath_argsStandardScheme extends StandardScheme<getPathChildrenCacheDataForPath_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, getPathChildrenCacheDataForPath_args 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: // PROJECTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.projection = new CuratorProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // CACHE_PROJECTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.cacheProjection = new PathChildrenCacheProjection();
+ struct.cacheProjection.read(iprot);
+ struct.setCacheProjectionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // PATH
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.path = iprot.readString();
+ struct.setPathIsSet(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, getPathChildrenCacheDataForPath_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.projection != null) {
+ oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
+ struct.projection.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.cacheProjection != null) {
+ oprot.writeFieldBegin(CACHE_PROJECTION_FIELD_DESC);
+ struct.cacheProjection.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.path != null) {
+ oprot.writeFieldBegin(PATH_FIELD_DESC);
+ oprot.writeString(struct.path);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class getPathChildrenCacheDataForPath_argsTupleSchemeFactory implements SchemeFactory {
+ public getPathChildrenCacheDataForPath_argsTupleScheme getScheme() {
+ return new getPathChildrenCacheDataForPath_argsTupleScheme();
+ }
+ }
+
+ private static class getPathChildrenCacheDataForPath_argsTupleScheme extends TupleScheme<getPathChildrenCacheDataForPath_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, getPathChildrenCacheDataForPath_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetProjection()) {
+ optionals.set(0);
+ }
+ if (struct.isSetCacheProjection()) {
+ optionals.set(1);
+ }
+ if (struct.isSetPath()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetProjection()) {
+ struct.projection.write(oprot);
+ }
+ if (struct.isSetCacheProjection()) {
+ struct.cacheProjection.write(oprot);
+ }
+ if (struct.isSetPath()) {
+ oprot.writeString(struct.path);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, getPathChildrenCacheDataForPath_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct.projection = new CuratorProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.cacheProjection = new PathChildrenCacheProjection();
+ struct.cacheProjection.read(iprot);
+ struct.setCacheProjectionIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.path = iprot.readString();
+ struct.setPathIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class getPathChildrenCacheDataForPath_result implements org.apache.thrift.TBase<getPathChildrenCacheDataForPath_result, getPathChildrenCacheDataForPath_result._Fields>, java.io.Serializable, Cloneable, Comparable<getPathChildrenCacheDataForPath_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPathChildrenCacheDataForPath_result");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new getPathChildrenCacheDataForPath_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new getPathChildrenCacheDataForPath_resultTupleSchemeFactory());
+ }
+
+ public ChildData success; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ SUCCESS((short)0, "success");
+
+ 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 0: // SUCCESS
+ return SUCCESS;
+ 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
+ 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ChildData.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPathChildrenCacheDataForPath_result.class, metaDataMap);
+ }
+
+ public getPathChildrenCacheDataForPath_result() {
+ }
+
+ public getPathChildrenCacheDataForPath_result(
+ ChildData success)
+ {
+ this();
+ this.success = success;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public getPathChildrenCacheDataForPath_result(getPathChildrenCacheDataForPath_result other) {
+ if (other.isSetSuccess()) {
+ this.success = new ChildData(other.success);
+ }
+ }
+
+ public getPathChildrenCacheDataForPath_result deepCopy() {
+ return new getPathChildrenCacheDataForPath_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ }
+
+ public ChildData getSuccess() {
+ return this.success;
+ }
+
+ public getPathChildrenCacheDataForPath_result setSuccess(ChildData success) {
+ this.success = success;
+ return this;
+ }
+
+ public void unsetSuccess() {
+ this.success = null;
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return this.success != null;
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ if (!value) {
+ this.success = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((ChildData)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return getSuccess();
+
+ }
+ 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 SUCCESS:
+ return isSetSuccess();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof getPathChildrenCacheDataForPath_result)
+ return this.equals((getPathChildrenCacheDataForPath_result)that);
+ return false;
+ }
+
+ public boolean equals(getPathChildrenCacheDataForPath_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true && this.isSetSuccess();
+ boolean that_present_success = true && that.isSetSuccess();
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(getPathChildrenCacheDataForPath_result other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+ 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("getPathChildrenCacheDataForPath_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ if (this.success == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.success);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (success != null) {
+ success.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ 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 getPathChildrenCacheDataForPath_resultStandardSchemeFactory implements SchemeFactory {
+ public getPathChildrenCacheDataForPath_resultStandardScheme getScheme() {
+ return new getPathChildrenCacheDataForPath_resultStandardScheme();
+ }
+ }
+
+ private static class getPathChildrenCacheDataForPath_resultStandardScheme extends StandardScheme<getPathChildrenCacheDataForPath_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, getPathChildrenCacheDataForPath_result 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 0: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.success = new ChildData();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(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, getPathChildrenCacheDataForPath_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.success != null) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ struct.success.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class getPathChildrenCacheDataForPath_resultTupleSchemeFactory implements SchemeFactory {
+ public getPathChildrenCacheDataForPath_resultTupleScheme getScheme() {
+ return new getPathChildrenCacheDataForPath_resultTupleScheme();
+ }
+ }
+
+ private static class getPathChildrenCacheDataForPath_resultTupleScheme extends TupleScheme<getPathChildrenCacheDataForPath_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, getPathChildrenCacheDataForPath_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetSuccess()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetSuccess()) {
+ struct.success.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, getPathChildrenCacheDataForPath_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.success = new ChildData();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
+ }
+
public static class isLeader_args implements org.apache.thrift.TBase<isLeader_args, isLeader_args._Fields>, java.io.Serializable, Cloneable, Comparable<isLeader_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("isLeader_args");
http://git-wip-us.apache.org/repos/asf/curator/blob/6f9a9ab4/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
index fe14504..a1c07bd 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
@@ -76,11 +76,17 @@ public class TestClient
PathChildrenCacheProjection pathChildrenCacheProjection = client.startPathChildrenCache(curatorProjection, "/a/b", true, false, PathChildrenCacheStartMode.BUILD_INITIAL_CACHE);
+ List<ChildData> pathChildrenCacheData = client.getPathChildrenCacheData(curatorProjection, pathChildrenCacheProjection);
+ System.out.println("Child data: " + pathChildrenCacheData);
+
GetChildrenSpec getChildrenSpec = new GetChildrenSpec();
getChildrenSpec.path = "/a";
OptionalChildrenList children = client.getChildren(curatorProjection, getChildrenSpec);
System.out.println("Children: " + children);
+ ChildData pathChildrenCacheDataForPath = client.getPathChildrenCacheDataForPath(curatorProjection, pathChildrenCacheProjection, "/a/b/c");
+ System.out.println(pathChildrenCacheDataForPath);
+
GenericProjection lockId = client.acquireLock(curatorProjection, "/mylock", 1000);
client.closeGenericProjection(curatorProjection, lockId);
@@ -110,5 +116,8 @@ public class TestClient
System.out.println("isLeader: " + isLeader);
client.closeGenericProjection(curatorProjection, leader.projection.projection);
+
+ pathChildrenCacheData = client.getPathChildrenCacheData(curatorProjection, pathChildrenCacheProjection);
+ System.out.println("Child data: " + pathChildrenCacheData);
}
}
[2/7] some more leader methods - start of path children cache
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/curator/blob/41ac42bb/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java
index 38a29cc..aab8a8d 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java
@@ -52,12 +52,18 @@ public class CuratorService {
public ByteBuffer getData(CuratorProjection projection, GetDataSpec spec) throws org.apache.thrift.TException;
+ public List<Participant> getLeaderParticipants(CuratorProjection projection, LeaderProjection leaderProjection) throws org.apache.thrift.TException;
+
+ public boolean isLeader(CuratorProjection projection, LeaderProjection leaderProjection) throws org.apache.thrift.TException;
+
public CuratorProjection newCuratorProjection(String connectionName) throws org.apache.thrift.TException;
public Stat setData(CuratorProjection projection, SetDataSpec spec) throws org.apache.thrift.TException;
public LeaderResult startLeaderSelector(CuratorProjection projection, String path, String participantId, int waitForLeadershipMs) throws org.apache.thrift.TException;
+ public PathChildrenCacheProjection startPathChildrenCache(CuratorProjection projection, String path, boolean cacheData, boolean dataIsCompressed, PathChildrenCacheStartMode startMode) throws org.apache.thrift.TException;
+
}
public interface AsyncIface {
@@ -78,12 +84,18 @@ public class CuratorService {
public void getData(CuratorProjection projection, GetDataSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void getLeaderParticipants(CuratorProjection projection, LeaderProjection leaderProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void isLeader(CuratorProjection projection, LeaderProjection leaderProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
public void newCuratorProjection(String connectionName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void setData(CuratorProjection projection, SetDataSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void startLeaderSelector(CuratorProjection projection, String path, String participantId, int waitForLeadershipMs, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void startPathChildrenCache(CuratorProjection projection, String path, boolean cacheData, boolean dataIsCompressed, PathChildrenCacheStartMode startMode, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
}
public static class Client extends org.apache.thrift.TServiceClient implements Iface {
@@ -292,6 +304,54 @@ public class CuratorService {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getData failed: unknown result");
}
+ public List<Participant> getLeaderParticipants(CuratorProjection projection, LeaderProjection leaderProjection) throws org.apache.thrift.TException
+ {
+ send_getLeaderParticipants(projection, leaderProjection);
+ return recv_getLeaderParticipants();
+ }
+
+ public void send_getLeaderParticipants(CuratorProjection projection, LeaderProjection leaderProjection) throws org.apache.thrift.TException
+ {
+ getLeaderParticipants_args args = new getLeaderParticipants_args();
+ args.setProjection(projection);
+ args.setLeaderProjection(leaderProjection);
+ sendBase("getLeaderParticipants", args);
+ }
+
+ public List<Participant> recv_getLeaderParticipants() throws org.apache.thrift.TException
+ {
+ getLeaderParticipants_result result = new getLeaderParticipants_result();
+ receiveBase(result, "getLeaderParticipants");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getLeaderParticipants failed: unknown result");
+ }
+
+ public boolean isLeader(CuratorProjection projection, LeaderProjection leaderProjection) throws org.apache.thrift.TException
+ {
+ send_isLeader(projection, leaderProjection);
+ return recv_isLeader();
+ }
+
+ public void send_isLeader(CuratorProjection projection, LeaderProjection leaderProjection) throws org.apache.thrift.TException
+ {
+ isLeader_args args = new isLeader_args();
+ args.setProjection(projection);
+ args.setLeaderProjection(leaderProjection);
+ sendBase("isLeader", args);
+ }
+
+ public boolean recv_isLeader() throws org.apache.thrift.TException
+ {
+ isLeader_result result = new isLeader_result();
+ receiveBase(result, "isLeader");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "isLeader failed: unknown result");
+ }
+
public CuratorProjection newCuratorProjection(String connectionName) throws org.apache.thrift.TException
{
send_newCuratorProjection(connectionName);
@@ -365,6 +425,33 @@ public class CuratorService {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "startLeaderSelector failed: unknown result");
}
+ public PathChildrenCacheProjection startPathChildrenCache(CuratorProjection projection, String path, boolean cacheData, boolean dataIsCompressed, PathChildrenCacheStartMode startMode) throws org.apache.thrift.TException
+ {
+ send_startPathChildrenCache(projection, path, cacheData, dataIsCompressed, startMode);
+ return recv_startPathChildrenCache();
+ }
+
+ public void send_startPathChildrenCache(CuratorProjection projection, String path, boolean cacheData, boolean dataIsCompressed, PathChildrenCacheStartMode startMode) throws org.apache.thrift.TException
+ {
+ startPathChildrenCache_args args = new startPathChildrenCache_args();
+ args.setProjection(projection);
+ args.setPath(path);
+ args.setCacheData(cacheData);
+ args.setDataIsCompressed(dataIsCompressed);
+ args.setStartMode(startMode);
+ sendBase("startPathChildrenCache", args);
+ }
+
+ public PathChildrenCacheProjection recv_startPathChildrenCache() throws org.apache.thrift.TException
+ {
+ startPathChildrenCache_result result = new startPathChildrenCache_result();
+ receiveBase(result, "startPathChildrenCache");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "startPathChildrenCache failed: unknown result");
+ }
+
}
public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
@@ -663,6 +750,76 @@ public class CuratorService {
}
}
+ public void getLeaderParticipants(CuratorProjection projection, LeaderProjection leaderProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ getLeaderParticipants_call method_call = new getLeaderParticipants_call(projection, leaderProjection, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class getLeaderParticipants_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private CuratorProjection projection;
+ private LeaderProjection leaderProjection;
+ public getLeaderParticipants_call(CuratorProjection projection, LeaderProjection leaderProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.projection = projection;
+ this.leaderProjection = leaderProjection;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getLeaderParticipants", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ getLeaderParticipants_args args = new getLeaderParticipants_args();
+ args.setProjection(projection);
+ args.setLeaderProjection(leaderProjection);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public List<Participant> getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_getLeaderParticipants();
+ }
+ }
+
+ public void isLeader(CuratorProjection projection, LeaderProjection leaderProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ isLeader_call method_call = new isLeader_call(projection, leaderProjection, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class isLeader_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private CuratorProjection projection;
+ private LeaderProjection leaderProjection;
+ public isLeader_call(CuratorProjection projection, LeaderProjection leaderProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.projection = projection;
+ this.leaderProjection = leaderProjection;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("isLeader", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ isLeader_args args = new isLeader_args();
+ args.setProjection(projection);
+ args.setLeaderProjection(leaderProjection);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public boolean getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_isLeader();
+ }
+ }
+
public void newCuratorProjection(String connectionName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
newCuratorProjection_call method_call = new newCuratorProjection_call(connectionName, resultHandler, this, ___protocolFactory, ___transport);
@@ -771,6 +928,50 @@ public class CuratorService {
}
}
+ public void startPathChildrenCache(CuratorProjection projection, String path, boolean cacheData, boolean dataIsCompressed, PathChildrenCacheStartMode startMode, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ startPathChildrenCache_call method_call = new startPathChildrenCache_call(projection, path, cacheData, dataIsCompressed, startMode, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class startPathChildrenCache_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private CuratorProjection projection;
+ private String path;
+ private boolean cacheData;
+ private boolean dataIsCompressed;
+ private PathChildrenCacheStartMode startMode;
+ public startPathChildrenCache_call(CuratorProjection projection, String path, boolean cacheData, boolean dataIsCompressed, PathChildrenCacheStartMode startMode, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.projection = projection;
+ this.path = path;
+ this.cacheData = cacheData;
+ this.dataIsCompressed = dataIsCompressed;
+ this.startMode = startMode;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("startPathChildrenCache", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ startPathChildrenCache_args args = new startPathChildrenCache_args();
+ args.setProjection(projection);
+ args.setPath(path);
+ args.setCacheData(cacheData);
+ args.setDataIsCompressed(dataIsCompressed);
+ args.setStartMode(startMode);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public PathChildrenCacheProjection getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_startPathChildrenCache();
+ }
+ }
+
}
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
@@ -792,9 +993,12 @@ public class CuratorService {
processMap.put("exists", new exists());
processMap.put("getChildren", new getChildren());
processMap.put("getData", new getData());
+ processMap.put("getLeaderParticipants", new getLeaderParticipants());
+ processMap.put("isLeader", new isLeader());
processMap.put("newCuratorProjection", new newCuratorProjection());
processMap.put("setData", new setData());
processMap.put("startLeaderSelector", new startLeaderSelector());
+ processMap.put("startPathChildrenCache", new startPathChildrenCache());
return processMap;
}
@@ -959,6 +1163,47 @@ public class CuratorService {
}
}
+ public static class getLeaderParticipants<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getLeaderParticipants_args> {
+ public getLeaderParticipants() {
+ super("getLeaderParticipants");
+ }
+
+ public getLeaderParticipants_args getEmptyArgsInstance() {
+ return new getLeaderParticipants_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public getLeaderParticipants_result getResult(I iface, getLeaderParticipants_args args) throws org.apache.thrift.TException {
+ getLeaderParticipants_result result = new getLeaderParticipants_result();
+ result.success = iface.getLeaderParticipants(args.projection, args.leaderProjection);
+ return result;
+ }
+ }
+
+ public static class isLeader<I extends Iface> extends org.apache.thrift.ProcessFunction<I, isLeader_args> {
+ public isLeader() {
+ super("isLeader");
+ }
+
+ public isLeader_args getEmptyArgsInstance() {
+ return new isLeader_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public isLeader_result getResult(I iface, isLeader_args args) throws org.apache.thrift.TException {
+ isLeader_result result = new isLeader_result();
+ result.success = iface.isLeader(args.projection, args.leaderProjection);
+ result.setSuccessIsSet(true);
+ return result;
+ }
+ }
+
public static class newCuratorProjection<I extends Iface> extends org.apache.thrift.ProcessFunction<I, newCuratorProjection_args> {
public newCuratorProjection() {
super("newCuratorProjection");
@@ -1019,6 +1264,26 @@ public class CuratorService {
}
}
+ public static class startPathChildrenCache<I extends Iface> extends org.apache.thrift.ProcessFunction<I, startPathChildrenCache_args> {
+ public startPathChildrenCache() {
+ super("startPathChildrenCache");
+ }
+
+ public startPathChildrenCache_args getEmptyArgsInstance() {
+ return new startPathChildrenCache_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public startPathChildrenCache_result getResult(I iface, startPathChildrenCache_args args) throws org.apache.thrift.TException {
+ startPathChildrenCache_result result = new startPathChildrenCache_result();
+ result.success = iface.startPathChildrenCache(args.projection, args.path, args.cacheData, args.dataIsCompressed, args.startMode);
+ return result;
+ }
+ }
+
}
public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
@@ -1040,9 +1305,12 @@ public class CuratorService {
processMap.put("exists", new exists());
processMap.put("getChildren", new getChildren());
processMap.put("getData", new getData());
+ processMap.put("getLeaderParticipants", new getLeaderParticipants());
+ processMap.put("isLeader", new isLeader());
processMap.put("newCuratorProjection", new newCuratorProjection());
processMap.put("setData", new setData());
processMap.put("startLeaderSelector", new startLeaderSelector());
+ processMap.put("startPathChildrenCache", new startPathChildrenCache());
return processMap;
}
@@ -1453,6 +1721,109 @@ public class CuratorService {
}
}
+ public static class getLeaderParticipants<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getLeaderParticipants_args, List<Participant>> {
+ public getLeaderParticipants() {
+ super("getLeaderParticipants");
+ }
+
+ public getLeaderParticipants_args getEmptyArgsInstance() {
+ return new getLeaderParticipants_args();
+ }
+
+ public AsyncMethodCallback<List<Participant>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<List<Participant>>() {
+ public void onComplete(List<Participant> o) {
+ getLeaderParticipants_result result = new getLeaderParticipants_result();
+ result.success = o;
+ try {
+ fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+ return;
+ } catch (Exception e) {
+ LOGGER.error("Exception writing to internal frame buffer", e);
+ }
+ fb.close();
+ }
+ public void onError(Exception e) {
+ byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+ org.apache.thrift.TBase msg;
+ getLeaderParticipants_result result = new getLeaderParticipants_result();
+ {
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+ }
+ try {
+ fcall.sendResponse(fb,msg,msgType,seqid);
+ return;
+ } catch (Exception ex) {
+ LOGGER.error("Exception writing to internal frame buffer", ex);
+ }
+ fb.close();
+ }
+ };
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public void start(I iface, getLeaderParticipants_args args, org.apache.thrift.async.AsyncMethodCallback<List<Participant>> resultHandler) throws TException {
+ iface.getLeaderParticipants(args.projection, args.leaderProjection,resultHandler);
+ }
+ }
+
+ public static class isLeader<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, isLeader_args, Boolean> {
+ public isLeader() {
+ super("isLeader");
+ }
+
+ public isLeader_args getEmptyArgsInstance() {
+ return new isLeader_args();
+ }
+
+ public AsyncMethodCallback<Boolean> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<Boolean>() {
+ public void onComplete(Boolean o) {
+ isLeader_result result = new isLeader_result();
+ result.success = o;
+ result.setSuccessIsSet(true);
+ try {
+ fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+ return;
+ } catch (Exception e) {
+ LOGGER.error("Exception writing to internal frame buffer", e);
+ }
+ fb.close();
+ }
+ public void onError(Exception e) {
+ byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+ org.apache.thrift.TBase msg;
+ isLeader_result result = new isLeader_result();
+ {
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+ }
+ try {
+ fcall.sendResponse(fb,msg,msgType,seqid);
+ return;
+ } catch (Exception ex) {
+ LOGGER.error("Exception writing to internal frame buffer", ex);
+ }
+ fb.close();
+ }
+ };
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public void start(I iface, isLeader_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException {
+ iface.isLeader(args.projection, args.leaderProjection,resultHandler);
+ }
+ }
+
public static class newCuratorProjection<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, newCuratorProjection_args, CuratorProjection> {
public newCuratorProjection() {
super("newCuratorProjection");
@@ -1606,20 +1977,71 @@ public class CuratorService {
}
}
- }
-
- public static class acquireLock_args implements org.apache.thrift.TBase<acquireLock_args, acquireLock_args._Fields>, java.io.Serializable, Cloneable, Comparable<acquireLock_args> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("acquireLock_args");
-
- private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
- private static final org.apache.thrift.protocol.TField PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("path", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField MAX_WAIT_MS_FIELD_DESC = new org.apache.thrift.protocol.TField("maxWaitMs", org.apache.thrift.protocol.TType.I32, (short)3);
+ public static class startPathChildrenCache<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, startPathChildrenCache_args, PathChildrenCacheProjection> {
+ public startPathChildrenCache() {
+ super("startPathChildrenCache");
+ }
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new acquireLock_argsStandardSchemeFactory());
- schemes.put(TupleScheme.class, new acquireLock_argsTupleSchemeFactory());
- }
+ public startPathChildrenCache_args getEmptyArgsInstance() {
+ return new startPathChildrenCache_args();
+ }
+
+ public AsyncMethodCallback<PathChildrenCacheProjection> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<PathChildrenCacheProjection>() {
+ public void onComplete(PathChildrenCacheProjection o) {
+ startPathChildrenCache_result result = new startPathChildrenCache_result();
+ result.success = o;
+ try {
+ fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+ return;
+ } catch (Exception e) {
+ LOGGER.error("Exception writing to internal frame buffer", e);
+ }
+ fb.close();
+ }
+ public void onError(Exception e) {
+ byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+ org.apache.thrift.TBase msg;
+ startPathChildrenCache_result result = new startPathChildrenCache_result();
+ {
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+ }
+ try {
+ fcall.sendResponse(fb,msg,msgType,seqid);
+ return;
+ } catch (Exception ex) {
+ LOGGER.error("Exception writing to internal frame buffer", ex);
+ }
+ fb.close();
+ }
+ };
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public void start(I iface, startPathChildrenCache_args args, org.apache.thrift.async.AsyncMethodCallback<PathChildrenCacheProjection> resultHandler) throws TException {
+ iface.startPathChildrenCache(args.projection, args.path, args.cacheData, args.dataIsCompressed, args.startMode,resultHandler);
+ }
+ }
+
+ }
+
+ public static class acquireLock_args implements org.apache.thrift.TBase<acquireLock_args, acquireLock_args._Fields>, java.io.Serializable, Cloneable, Comparable<acquireLock_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("acquireLock_args");
+
+ private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+ private static final org.apache.thrift.protocol.TField PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("path", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField MAX_WAIT_MS_FIELD_DESC = new org.apache.thrift.protocol.TField("maxWaitMs", org.apache.thrift.protocol.TType.I32, (short)3);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new acquireLock_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new acquireLock_argsTupleSchemeFactory());
+ }
public CuratorProjection projection; // required
public String path; // required
@@ -7955,22 +8377,25 @@ public class CuratorService {
}
- public static class newCuratorProjection_args implements org.apache.thrift.TBase<newCuratorProjection_args, newCuratorProjection_args._Fields>, java.io.Serializable, Cloneable, Comparable<newCuratorProjection_args> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("newCuratorProjection_args");
+ public static class getLeaderParticipants_args implements org.apache.thrift.TBase<getLeaderParticipants_args, getLeaderParticipants_args._Fields>, java.io.Serializable, Cloneable, Comparable<getLeaderParticipants_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getLeaderParticipants_args");
- private static final org.apache.thrift.protocol.TField CONNECTION_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("connectionName", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+ private static final org.apache.thrift.protocol.TField LEADER_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("leaderProjection", org.apache.thrift.protocol.TType.STRUCT, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
- schemes.put(StandardScheme.class, new newCuratorProjection_argsStandardSchemeFactory());
- schemes.put(TupleScheme.class, new newCuratorProjection_argsTupleSchemeFactory());
+ schemes.put(StandardScheme.class, new getLeaderParticipants_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new getLeaderParticipants_argsTupleSchemeFactory());
}
- public String connectionName; // required
+ public CuratorProjection projection; // required
+ public LeaderProjection leaderProjection; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- CONNECTION_NAME((short)1, "connectionName");
+ PROJECTION((short)1, "projection"),
+ LEADER_PROJECTION((short)2, "leaderProjection");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -7985,8 +8410,10 @@ public class CuratorService {
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
- case 1: // CONNECTION_NAME
- return CONNECTION_NAME;
+ case 1: // PROJECTION
+ return PROJECTION;
+ case 2: // LEADER_PROJECTION
+ return LEADER_PROJECTION;
default:
return null;
}
@@ -8030,71 +8457,111 @@ public class CuratorService {
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.CONNECTION_NAME, new org.apache.thrift.meta_data.FieldMetaData("connectionName", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
+ tmpMap.put(_Fields.LEADER_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("leaderProjection", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, LeaderProjection.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(newCuratorProjection_args.class, metaDataMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getLeaderParticipants_args.class, metaDataMap);
}
- public newCuratorProjection_args() {
+ public getLeaderParticipants_args() {
}
- public newCuratorProjection_args(
- String connectionName)
+ public getLeaderParticipants_args(
+ CuratorProjection projection,
+ LeaderProjection leaderProjection)
{
this();
- this.connectionName = connectionName;
+ this.projection = projection;
+ this.leaderProjection = leaderProjection;
}
/**
* Performs a deep copy on <i>other</i>.
*/
- public newCuratorProjection_args(newCuratorProjection_args other) {
- if (other.isSetConnectionName()) {
- this.connectionName = other.connectionName;
+ public getLeaderParticipants_args(getLeaderParticipants_args other) {
+ if (other.isSetProjection()) {
+ this.projection = new CuratorProjection(other.projection);
+ }
+ if (other.isSetLeaderProjection()) {
+ this.leaderProjection = new LeaderProjection(other.leaderProjection);
}
}
- public newCuratorProjection_args deepCopy() {
- return new newCuratorProjection_args(this);
+ public getLeaderParticipants_args deepCopy() {
+ return new getLeaderParticipants_args(this);
}
@Override
public void clear() {
- this.connectionName = null;
+ this.projection = null;
+ this.leaderProjection = null;
}
- public String getConnectionName() {
- return this.connectionName;
+ public CuratorProjection getProjection() {
+ return this.projection;
}
- public newCuratorProjection_args setConnectionName(String connectionName) {
- this.connectionName = connectionName;
+ public getLeaderParticipants_args setProjection(CuratorProjection projection) {
+ this.projection = projection;
return this;
}
- public void unsetConnectionName() {
- this.connectionName = null;
+ public void unsetProjection() {
+ this.projection = null;
}
- /** Returns true if field connectionName is set (has been assigned a value) and false otherwise */
- public boolean isSetConnectionName() {
- return this.connectionName != null;
+ /** Returns true if field projection is set (has been assigned a value) and false otherwise */
+ public boolean isSetProjection() {
+ return this.projection != null;
}
- public void setConnectionNameIsSet(boolean value) {
+ public void setProjectionIsSet(boolean value) {
if (!value) {
- this.connectionName = null;
+ this.projection = null;
+ }
+ }
+
+ public LeaderProjection getLeaderProjection() {
+ return this.leaderProjection;
+ }
+
+ public getLeaderParticipants_args setLeaderProjection(LeaderProjection leaderProjection) {
+ this.leaderProjection = leaderProjection;
+ return this;
+ }
+
+ public void unsetLeaderProjection() {
+ this.leaderProjection = null;
+ }
+
+ /** Returns true if field leaderProjection is set (has been assigned a value) and false otherwise */
+ public boolean isSetLeaderProjection() {
+ return this.leaderProjection != null;
+ }
+
+ public void setLeaderProjectionIsSet(boolean value) {
+ if (!value) {
+ this.leaderProjection = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
- case CONNECTION_NAME:
+ case PROJECTION:
if (value == null) {
- unsetConnectionName();
+ unsetProjection();
} else {
- setConnectionName((String)value);
+ setProjection((CuratorProjection)value);
+ }
+ break;
+
+ case LEADER_PROJECTION:
+ if (value == null) {
+ unsetLeaderProjection();
+ } else {
+ setLeaderProjection((LeaderProjection)value);
}
break;
@@ -8103,8 +8570,11 @@ public class CuratorService {
public Object getFieldValue(_Fields field) {
switch (field) {
- case CONNECTION_NAME:
- return getConnectionName();
+ case PROJECTION:
+ return getProjection();
+
+ case LEADER_PROJECTION:
+ return getLeaderProjection();
}
throw new IllegalStateException();
@@ -8117,8 +8587,10 @@ public class CuratorService {
}
switch (field) {
- case CONNECTION_NAME:
- return isSetConnectionName();
+ case PROJECTION:
+ return isSetProjection();
+ case LEADER_PROJECTION:
+ return isSetLeaderProjection();
}
throw new IllegalStateException();
}
@@ -8127,21 +8599,30 @@ public class CuratorService {
public boolean equals(Object that) {
if (that == null)
return false;
- if (that instanceof newCuratorProjection_args)
- return this.equals((newCuratorProjection_args)that);
+ if (that instanceof getLeaderParticipants_args)
+ return this.equals((getLeaderParticipants_args)that);
return false;
}
- public boolean equals(newCuratorProjection_args that) {
+ public boolean equals(getLeaderParticipants_args that) {
if (that == null)
return false;
- boolean this_present_connectionName = true && this.isSetConnectionName();
- boolean that_present_connectionName = true && that.isSetConnectionName();
- if (this_present_connectionName || that_present_connectionName) {
- if (!(this_present_connectionName && that_present_connectionName))
+ boolean this_present_projection = true && this.isSetProjection();
+ boolean that_present_projection = true && that.isSetProjection();
+ if (this_present_projection || that_present_projection) {
+ if (!(this_present_projection && that_present_projection))
return false;
- if (!this.connectionName.equals(that.connectionName))
+ if (!this.projection.equals(that.projection))
+ return false;
+ }
+
+ boolean this_present_leaderProjection = true && this.isSetLeaderProjection();
+ boolean that_present_leaderProjection = true && that.isSetLeaderProjection();
+ if (this_present_leaderProjection || that_present_leaderProjection) {
+ if (!(this_present_leaderProjection && that_present_leaderProjection))
+ return false;
+ if (!this.leaderProjection.equals(that.leaderProjection))
return false;
}
@@ -8154,19 +8635,29 @@ public class CuratorService {
}
@Override
- public int compareTo(newCuratorProjection_args other) {
+ public int compareTo(getLeaderParticipants_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
- lastComparison = Boolean.valueOf(isSetConnectionName()).compareTo(other.isSetConnectionName());
+ lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetConnectionName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.connectionName, other.connectionName);
+ if (isSetProjection()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetLeaderProjection()).compareTo(other.isSetLeaderProjection());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetLeaderProjection()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.leaderProjection, other.leaderProjection);
if (lastComparison != 0) {
return lastComparison;
}
@@ -8188,14 +8679,22 @@ public class CuratorService {
@Override
public String toString() {
- StringBuilder sb = new StringBuilder("newCuratorProjection_args(");
+ StringBuilder sb = new StringBuilder("getLeaderParticipants_args(");
boolean first = true;
- sb.append("connectionName:");
- if (this.connectionName == null) {
+ sb.append("projection:");
+ if (this.projection == null) {
sb.append("null");
} else {
- sb.append(this.connectionName);
+ sb.append(this.projection);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("leaderProjection:");
+ if (this.leaderProjection == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.leaderProjection);
}
first = false;
sb.append(")");
@@ -8205,6 +8704,12 @@ public class CuratorService {
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
+ if (projection != null) {
+ projection.validate();
+ }
+ if (leaderProjection != null) {
+ leaderProjection.validate();
+ }
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -8223,15 +8728,15 @@ public class CuratorService {
}
}
- private static class newCuratorProjection_argsStandardSchemeFactory implements SchemeFactory {
- public newCuratorProjection_argsStandardScheme getScheme() {
- return new newCuratorProjection_argsStandardScheme();
+ private static class getLeaderParticipants_argsStandardSchemeFactory implements SchemeFactory {
+ public getLeaderParticipants_argsStandardScheme getScheme() {
+ return new getLeaderParticipants_argsStandardScheme();
}
}
- private static class newCuratorProjection_argsStandardScheme extends StandardScheme<newCuratorProjection_args> {
+ private static class getLeaderParticipants_argsStandardScheme extends StandardScheme<getLeaderParticipants_args> {
- public void read(org.apache.thrift.protocol.TProtocol iprot, newCuratorProjection_args struct) throws org.apache.thrift.TException {
+ public void read(org.apache.thrift.protocol.TProtocol iprot, getLeaderParticipants_args struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
@@ -8241,10 +8746,20 @@ public class CuratorService {
break;
}
switch (schemeField.id) {
- case 1: // CONNECTION_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.connectionName = iprot.readString();
- struct.setConnectionNameIsSet(true);
+ case 1: // PROJECTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.projection = new CuratorProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // LEADER_PROJECTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.leaderProjection = new LeaderProjection();
+ struct.leaderProjection.read(iprot);
+ struct.setLeaderProjectionIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -8260,13 +8775,18 @@ public class CuratorService {
struct.validate();
}
- public void write(org.apache.thrift.protocol.TProtocol oprot, newCuratorProjection_args struct) throws org.apache.thrift.TException {
+ public void write(org.apache.thrift.protocol.TProtocol oprot, getLeaderParticipants_args struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
- if (struct.connectionName != null) {
- oprot.writeFieldBegin(CONNECTION_NAME_FIELD_DESC);
- oprot.writeString(struct.connectionName);
+ if (struct.projection != null) {
+ oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
+ struct.projection.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.leaderProjection != null) {
+ oprot.writeFieldBegin(LEADER_PROJECTION_FIELD_DESC);
+ struct.leaderProjection.write(oprot);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
@@ -8275,52 +8795,64 @@ public class CuratorService {
}
- private static class newCuratorProjection_argsTupleSchemeFactory implements SchemeFactory {
- public newCuratorProjection_argsTupleScheme getScheme() {
- return new newCuratorProjection_argsTupleScheme();
+ private static class getLeaderParticipants_argsTupleSchemeFactory implements SchemeFactory {
+ public getLeaderParticipants_argsTupleScheme getScheme() {
+ return new getLeaderParticipants_argsTupleScheme();
}
}
- private static class newCuratorProjection_argsTupleScheme extends TupleScheme<newCuratorProjection_args> {
+ private static class getLeaderParticipants_argsTupleScheme extends TupleScheme<getLeaderParticipants_args> {
@Override
- public void write(org.apache.thrift.protocol.TProtocol prot, newCuratorProjection_args struct) throws org.apache.thrift.TException {
+ public void write(org.apache.thrift.protocol.TProtocol prot, getLeaderParticipants_args struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
- if (struct.isSetConnectionName()) {
+ if (struct.isSetProjection()) {
optionals.set(0);
}
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetConnectionName()) {
- oprot.writeString(struct.connectionName);
+ if (struct.isSetLeaderProjection()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetProjection()) {
+ struct.projection.write(oprot);
+ }
+ if (struct.isSetLeaderProjection()) {
+ struct.leaderProjection.write(oprot);
}
}
@Override
- public void read(org.apache.thrift.protocol.TProtocol prot, newCuratorProjection_args struct) throws org.apache.thrift.TException {
+ public void read(org.apache.thrift.protocol.TProtocol prot, getLeaderParticipants_args struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
+ BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
- struct.connectionName = iprot.readString();
- struct.setConnectionNameIsSet(true);
+ struct.projection = new CuratorProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.leaderProjection = new LeaderProjection();
+ struct.leaderProjection.read(iprot);
+ struct.setLeaderProjectionIsSet(true);
}
}
}
}
- public static class newCuratorProjection_result implements org.apache.thrift.TBase<newCuratorProjection_result, newCuratorProjection_result._Fields>, java.io.Serializable, Cloneable, Comparable<newCuratorProjection_result> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("newCuratorProjection_result");
+ public static class getLeaderParticipants_result implements org.apache.thrift.TBase<getLeaderParticipants_result, getLeaderParticipants_result._Fields>, java.io.Serializable, Cloneable, Comparable<getLeaderParticipants_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getLeaderParticipants_result");
- private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
- schemes.put(StandardScheme.class, new newCuratorProjection_resultStandardSchemeFactory());
- schemes.put(TupleScheme.class, new newCuratorProjection_resultTupleSchemeFactory());
+ schemes.put(StandardScheme.class, new getLeaderParticipants_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new getLeaderParticipants_resultTupleSchemeFactory());
}
- public CuratorProjection success; // required
+ public List<Participant> success; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -8385,16 +8917,17 @@ public class CuratorService {
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Participant.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(newCuratorProjection_result.class, metaDataMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getLeaderParticipants_result.class, metaDataMap);
}
- public newCuratorProjection_result() {
+ public getLeaderParticipants_result() {
}
- public newCuratorProjection_result(
- CuratorProjection success)
+ public getLeaderParticipants_result(
+ List<Participant> success)
{
this();
this.success = success;
@@ -8403,14 +8936,18 @@ public class CuratorService {
/**
* Performs a deep copy on <i>other</i>.
*/
- public newCuratorProjection_result(newCuratorProjection_result other) {
+ public getLeaderParticipants_result(getLeaderParticipants_result other) {
if (other.isSetSuccess()) {
- this.success = new CuratorProjection(other.success);
+ List<Participant> __this__success = new ArrayList<Participant>(other.success.size());
+ for (Participant other_element : other.success) {
+ __this__success.add(new Participant(other_element));
+ }
+ this.success = __this__success;
}
}
- public newCuratorProjection_result deepCopy() {
- return new newCuratorProjection_result(this);
+ public getLeaderParticipants_result deepCopy() {
+ return new getLeaderParticipants_result(this);
}
@Override
@@ -8418,11 +8955,26 @@ public class CuratorService {
this.success = null;
}
- public CuratorProjection getSuccess() {
+ public int getSuccessSize() {
+ return (this.success == null) ? 0 : this.success.size();
+ }
+
+ public java.util.Iterator<Participant> getSuccessIterator() {
+ return (this.success == null) ? null : this.success.iterator();
+ }
+
+ public void addToSuccess(Participant elem) {
+ if (this.success == null) {
+ this.success = new ArrayList<Participant>();
+ }
+ this.success.add(elem);
+ }
+
+ public List<Participant> getSuccess() {
return this.success;
}
- public newCuratorProjection_result setSuccess(CuratorProjection success) {
+ public getLeaderParticipants_result setSuccess(List<Participant> success) {
this.success = success;
return this;
}
@@ -8448,7 +9000,7 @@ public class CuratorService {
if (value == null) {
unsetSuccess();
} else {
- setSuccess((CuratorProjection)value);
+ setSuccess((List<Participant>)value);
}
break;
@@ -8481,12 +9033,12 @@ public class CuratorService {
public boolean equals(Object that) {
if (that == null)
return false;
- if (that instanceof newCuratorProjection_result)
- return this.equals((newCuratorProjection_result)that);
+ if (that instanceof getLeaderParticipants_result)
+ return this.equals((getLeaderParticipants_result)that);
return false;
}
- public boolean equals(newCuratorProjection_result that) {
+ public boolean equals(getLeaderParticipants_result that) {
if (that == null)
return false;
@@ -8508,7 +9060,7 @@ public class CuratorService {
}
@Override
- public int compareTo(newCuratorProjection_result other) {
+ public int compareTo(getLeaderParticipants_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
@@ -8542,7 +9094,7 @@ public class CuratorService {
@Override
public String toString() {
- StringBuilder sb = new StringBuilder("newCuratorProjection_result(");
+ StringBuilder sb = new StringBuilder("getLeaderParticipants_result(");
boolean first = true;
sb.append("success:");
@@ -8559,9 +9111,6 @@ public class CuratorService {
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
- if (success != null) {
- success.validate();
- }
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -8580,15 +9129,15 @@ public class CuratorService {
}
}
- private static class newCuratorProjection_resultStandardSchemeFactory implements SchemeFactory {
- public newCuratorProjection_resultStandardScheme getScheme() {
- return new newCuratorProjection_resultStandardScheme();
+ private static class getLeaderParticipants_resultStandardSchemeFactory implements SchemeFactory {
+ public getLeaderParticipants_resultStandardScheme getScheme() {
+ return new getLeaderParticipants_resultStandardScheme();
}
}
- private static class newCuratorProjection_resultStandardScheme extends StandardScheme<newCuratorProjection_result> {
+ private static class getLeaderParticipants_resultStandardScheme extends StandardScheme<getLeaderParticipants_result> {
- public void read(org.apache.thrift.protocol.TProtocol iprot, newCuratorProjection_result struct) throws org.apache.thrift.TException {
+ public void read(org.apache.thrift.protocol.TProtocol iprot, getLeaderParticipants_result struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
@@ -8599,9 +9148,19 @@ public class CuratorService {
}
switch (schemeField.id) {
case 0: // SUCCESS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.success = new CuratorProjection();
- struct.success.read(iprot);
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list24 = iprot.readListBegin();
+ struct.success = new ArrayList<Participant>(_list24.size);
+ for (int _i25 = 0; _i25 < _list24.size; ++_i25)
+ {
+ Participant _elem26;
+ _elem26 = new Participant();
+ _elem26.read(iprot);
+ struct.success.add(_elem26);
+ }
+ iprot.readListEnd();
+ }
struct.setSuccessIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
@@ -8618,13 +9177,20 @@ public class CuratorService {
struct.validate();
}
- public void write(org.apache.thrift.protocol.TProtocol oprot, newCuratorProjection_result struct) throws org.apache.thrift.TException {
+ public void write(org.apache.thrift.protocol.TProtocol oprot, getLeaderParticipants_result struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.success != null) {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- struct.success.write(oprot);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size()));
+ for (Participant _iter27 : struct.success)
+ {
+ _iter27.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
@@ -8633,16 +9199,16 @@ public class CuratorService {
}
- private static class newCuratorProjection_resultTupleSchemeFactory implements SchemeFactory {
- public newCuratorProjection_resultTupleScheme getScheme() {
- return new newCuratorProjection_resultTupleScheme();
+ private static class getLeaderParticipants_resultTupleSchemeFactory implements SchemeFactory {
+ public getLeaderParticipants_resultTupleScheme getScheme() {
+ return new getLeaderParticipants_resultTupleScheme();
}
}
- private static class newCuratorProjection_resultTupleScheme extends TupleScheme<newCuratorProjection_result> {
+ private static class getLeaderParticipants_resultTupleScheme extends TupleScheme<getLeaderParticipants_result> {
@Override
- public void write(org.apache.thrift.protocol.TProtocol prot, newCuratorProjection_result struct) throws org.apache.thrift.TException {
+ public void write(org.apache.thrift.protocol.TProtocol prot, getLeaderParticipants_result struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetSuccess()) {
@@ -8650,17 +9216,32 @@ public class CuratorService {
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetSuccess()) {
- struct.success.write(oprot);
+ {
+ oprot.writeI32(struct.success.size());
+ for (Participant _iter28 : struct.success)
+ {
+ _iter28.write(oprot);
+ }
+ }
}
}
@Override
- public void read(org.apache.thrift.protocol.TProtocol prot, newCuratorProjection_result struct) throws org.apache.thrift.TException {
+ public void read(org.apache.thrift.protocol.TProtocol prot, getLeaderParticipants_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
- struct.success = new CuratorProjection();
- struct.success.read(iprot);
+ {
+ org.apache.thrift.protocol.TList _list29 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.success = new ArrayList<Participant>(_list29.size);
+ for (int _i30 = 0; _i30 < _list29.size; ++_i30)
+ {
+ Participant _elem31;
+ _elem31 = new Participant();
+ _elem31.read(iprot);
+ struct.success.add(_elem31);
+ }
+ }
struct.setSuccessIsSet(true);
}
}
@@ -8668,25 +9249,25 @@ public class CuratorService {
}
- public static class setData_args implements org.apache.thrift.TBase<setData_args, setData_args._Fields>, java.io.Serializable, Cloneable, Comparable<setData_args> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("setData_args");
+ public static class isLeader_args implements org.apache.thrift.TBase<isLeader_args, isLeader_args._Fields>, java.io.Serializable, Cloneable, Comparable<isLeader_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("isLeader_args");
private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
- private static final org.apache.thrift.protocol.TField SPEC_FIELD_DESC = new org.apache.thrift.protocol.TField("spec", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+ private static final org.apache.thrift.protocol.TField LEADER_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("leaderProjection", org.apache.thrift.protocol.TType.STRUCT, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
- schemes.put(StandardScheme.class, new setData_argsStandardSchemeFactory());
- schemes.put(TupleScheme.class, new setData_argsTupleSchemeFactory());
+ schemes.put(StandardScheme.class, new isLeader_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new isLeader_argsTupleSchemeFactory());
}
public CuratorProjection projection; // required
- public SetDataSpec spec; // required
+ public LeaderProjection leaderProjection; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
PROJECTION((short)1, "projection"),
- SPEC((short)2, "spec");
+ LEADER_PROJECTION((short)2, "leaderProjection");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -8703,8 +9284,8 @@ public class CuratorService {
switch(fieldId) {
case 1: // PROJECTION
return PROJECTION;
- case 2: // SPEC
- return SPEC;
+ case 2: // LEADER_PROJECTION
+ return LEADER_PROJECTION;
default:
return null;
}
@@ -8750,51 +9331,51 @@ public class CuratorService {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
- tmpMap.put(_Fields.SPEC, new org.apache.thrift.meta_data.FieldMetaData("spec", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SetDataSpec.class)));
+ tmpMap.put(_Fields.LEADER_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("leaderProjection", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, LeaderProjection.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(setData_args.class, metaDataMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isLeader_args.class, metaDataMap);
}
- public setData_args() {
+ public isLeader_args() {
}
- public setData_args(
+ public isLeader_args(
CuratorProjection projection,
- SetDataSpec spec)
+ LeaderProjection leaderProjection)
{
this();
this.projection = projection;
- this.spec = spec;
+ this.leaderProjection = leaderProjection;
}
/**
* Performs a deep copy on <i>other</i>.
*/
- public setData_args(setData_args other) {
+ public isLeader_args(isLeader_args other) {
if (other.isSetProjection()) {
this.projection = new CuratorProjection(other.projection);
}
- if (other.isSetSpec()) {
- this.spec = new SetDataSpec(other.spec);
+ if (other.isSetLeaderProjection()) {
+ this.leaderProjection = new LeaderProjection(other.leaderProjection);
}
}
- public setData_args deepCopy() {
- return new setData_args(this);
+ public isLeader_args deepCopy() {
+ return new isLeader_args(this);
}
@Override
public void clear() {
this.projection = null;
- this.spec = null;
+ this.leaderProjection = null;
}
public CuratorProjection getProjection() {
return this.projection;
}
- public setData_args setProjection(CuratorProjection projection) {
+ public isLeader_args setProjection(CuratorProjection projection) {
this.projection = projection;
return this;
}
@@ -8814,27 +9395,27 @@ public class CuratorService {
}
}
- public SetDataSpec getSpec() {
- return this.spec;
+ public LeaderProjection getLeaderProjection() {
+ return this.leaderProjection;
}
- public setData_args setSpec(SetDataSpec spec) {
- this.spec = spec;
+ public isLeader_args setLeaderProjection(LeaderProjection leaderProjection) {
+ this.leaderProjection = leaderProjection;
return this;
}
- public void unsetSpec() {
- this.spec = null;
+ public void unsetLeaderProjection() {
+ this.leaderProjection = null;
}
- /** Returns true if field spec is set (has been assigned a value) and false otherwise */
- public boolean isSetSpec() {
- return this.spec != null;
+ /** Returns true if field leaderProjection is set (has been assigned a value) and false otherwise */
+ public boolean isSetLeaderProjection() {
+ return this.leaderProjection != null;
}
- public void setSpecIsSet(boolean value) {
+ public void setLeaderProjectionIsSet(boolean value) {
if (!value) {
- this.spec = null;
+ this.leaderProjection = null;
}
}
@@ -8848,11 +9429,11 @@ public class CuratorService {
}
break;
- case SPEC:
+ case LEADER_PROJECTION:
if (value == null) {
- unsetSpec();
+ unsetLeaderProjection();
} else {
- setSpec((SetDataSpec)value);
+ setLeaderProjection((LeaderProjection)value);
}
break;
@@ -8864,8 +9445,8 @@ public class CuratorService {
case PROJECTION:
return getProjection();
- case SPEC:
- return getSpec();
+ case LEADER_PROJECTION:
+ return getLeaderProjection();
}
throw new IllegalStateException();
@@ -8880,8 +9461,8 @@ public class CuratorService {
switch (field) {
case PROJECTION:
return isSetProjection();
- case SPEC:
- return isSetSpec();
+ case LEADER_PROJECTION:
+ return isSetLeaderProjection();
}
throw new IllegalStateException();
}
@@ -8890,12 +9471,12 @@ public class CuratorService {
public boolean equals(Object that) {
if (that == null)
return false;
- if (that instanceof setData_args)
- return this.equals((setData_args)that);
+ if (that instanceof isLeader_args)
+ return this.equals((isLeader_args)that);
return false;
}
- public boolean equals(setData_args that) {
+ public boolean equals(isLeader_args that) {
if (that == null)
return false;
@@ -8908,12 +9489,12 @@ public class CuratorService {
return false;
}
- boolean this_present_spec = true && this.isSetSpec();
- boolean that_present_spec = true && that.isSetSpec();
- if (this_present_spec || that_present_spec) {
- if (!(this_present_spec && that_present_spec))
+ boolean this_present_leaderProjection = true && this.isSetLeaderProjection();
+ boolean that_present_leaderProjection = true && that.isSetLeaderProjection();
+ if (this_present_leaderProjection || that_present_leaderProjection) {
+ if (!(this_present_leaderProjection && that_present_leaderProjection))
return false;
- if (!this.spec.equals(that.spec))
+ if (!this.leaderProjection.equals(that.leaderProjection))
return false;
}
@@ -8926,7 +9507,7 @@ public class CuratorService {
}
@Override
- public int compareTo(setData_args other) {
+ public int compareTo(isLeader_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
@@ -8943,12 +9524,12 @@ public class CuratorService {
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetSpec()).compareTo(other.isSetSpec());
+ lastComparison = Boolean.valueOf(isSetLeaderProjection()).compareTo(other.isSetLeaderProjection());
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetSpec()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.spec, other.spec);
+ if (isSetLeaderProjection()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.leaderProjection, other.leaderProjection);
if (lastComparison != 0) {
return lastComparison;
}
@@ -8970,7 +9551,7 @@ public class CuratorService {
@Override
public String toString() {
- StringBuilder sb = new StringBuilder("setData_args(");
+ StringBuilder sb = new StringBuilder("isLeader_args(");
boolean first = true;
sb.append("projection:");
@@ -8981,11 +9562,11 @@ public class CuratorService {
}
first = false;
if (!first) sb.append(", ");
- sb.append("spec:");
- if (this.spec == null) {
+ sb.append("leaderProjection:");
+ if (this.leaderProjection == null) {
sb.append("null");
} else {
- sb.append(this.spec);
+ sb.append(this.leaderProjection);
}
first = false;
sb.append(")");
@@ -8998,8 +9579,8 @@ public class CuratorService {
if (projection != null) {
projection.validate();
}
- if (spec != null) {
- spec.validate();
+ if (leaderProjection != null) {
+ leaderProjection.validate();
}
}
@@ -9019,15 +9600,15 @@ public class CuratorService {
}
}
- private static class setData_argsStandardSchemeFactory implements SchemeFactory {
- public setData_argsStandardScheme getScheme() {
- return new setData_argsStandardScheme();
+ private static class isLeader_argsStandardSchemeFactory implements SchemeFactory {
+ public isLeader_argsStandardScheme getScheme() {
+ return new isLeader_argsStandardScheme();
}
}
- private static class setData_argsStandardScheme extends StandardScheme<setData_args> {
+ private static class isLeader_argsStandardScheme extends StandardScheme<isLeader_args> {
- public void read(org.apache.thrift.protocol.TProtocol iprot, setData_args struct) throws org.apache.thrift.TException {
+ public void read(org.apache.thrift.protocol.TProtocol iprot, isLeader_args struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
@@ -9046,11 +9627,11 @@ public class CuratorService {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
- case 2: // SPEC
+ case 2: // LEADER_PROJECTION
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.spec = new SetDataSpec();
- struct.spec.read(iprot);
- struct.setSpecIsSet(true);
+ struct.leaderProjection = new LeaderProjection();
+ struct.leaderProjection.read(iprot);
+ struct.setLeaderProjectionIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -9066,7 +9647,7 @@ public class CuratorService {
struct.validate();
}
- public void write(org.apache.thrift.protocol.TProtocol oprot, setData_args struct) throws org.apache.thrift.TException {
+ public void write(org.apache.thrift.protocol.TProtocol oprot, isLeader_args struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
@@ -9075,9 +9656,9 @@ public class CuratorService {
struct.projection.write(oprot);
oprot.writeFieldEnd();
}
- if (struct.spec != null) {
- oprot.writeFieldBegin(SPEC_FIELD_DESC);
- struct.spec.write(oprot);
+ if (struct.leaderProjection != null) {
+ oprot.writeFieldBegin(LEADER_PROJECTION_FIELD_DESC);
+ struct.leaderProjection.write(oprot);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
@@ -9086,35 +9667,35 @@ public class CuratorService {
}
- private static class setData_argsTupleSchemeFactory implements SchemeFactory {
- public setData_argsTupleScheme getScheme() {
- return new setData_argsTupleScheme();
+ private static class isLeader_argsTupleSchemeFactory implements SchemeFactory {
+ public isLeader_argsTupleScheme getScheme() {
+ return new isLeader_argsTupleScheme();
}
}
- private static class setData_argsTupleScheme extends TupleScheme<setData_args> {
+ private static class isLeader_argsTupleScheme extends TupleScheme<isLeader_args> {
@Override
- public void write(org.apache.thrift.protocol.TProtocol prot, setData_args struct) throws org.apache.thrift.TException {
+ public void write(org.apache.thrift.protocol.TProtocol prot, isLeader_args struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetProjection()) {
optionals.set(0);
}
- if (struct.isSetSpec()) {
+ if (struct.isSetLeaderProjection()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetProjection()) {
struct.projection.write(oprot);
}
- if (struct.isSetSpec()) {
- struct.spec.write(oprot);
+ if (struct.isSetLeaderProjection()) {
+ struct.leaderProjection.write(oprot);
}
}
@Override
- public void read(org.apache.thrift.protocol.TProtocol prot, setData_args struct) throws org.apache.thrift.TException {
+ public void read(org.apache.thrift.protocol.TProtocol prot, isLeader_args struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
@@ -9123,27 +9704,27 @@ public class CuratorService {
struct.setProjectionIsSet(true);
}
if (incoming.get(1)) {
- struct.spec = new SetDataSpec();
- struct.spec.read(iprot);
- struct.setSpecIsSet(true);
+ struct.leaderProjection = new LeaderProjection();
+ struct.leaderProjection.read(iprot);
+ struct.setLeaderProjectionIsSet(true);
}
}
}
}
- public static class setData_result implements org.apache.thrift.TBase<setData_result, setData_result._Fields>, java.io.Serializable, Cloneable, Comparable<setData_result> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("setData_result");
+ public static class isLeader_result implements org.apache.thrift.TBase<isLeader_result, isLeader_result._Fields>, java.io.Serializable, Cloneable, Comparable<isLeader_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("isLeader_result");
- private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
- schemes.put(StandardScheme.class, new setData_resultStandardSchemeFactory());
- schemes.put(TupleScheme.class, new setData_resultTupleSchemeFactory());
+ schemes.put(StandardScheme.class, new isLeader_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new isLeader_resultTupleSchemeFactory());
}
- public Stat success; // required
+ public boolean success; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -9204,65 +9785,67 @@ public class CuratorService {
}
// isset id assignments
+ private static final int __SUCCESS_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Stat.class)));
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(setData_result.class, metaDataMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isLeader_result.class, metaDataMap);
}
- public setData_result() {
+ public isLeader_result() {
}
- public setData_result(
- Stat success)
+ public isLeader_result(
+ boolean success)
{
this();
this.success = success;
+ setSuccessIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
- public setData_result(setData_result other) {
- if (other.isSetSuccess()) {
- this.success = new Stat(other.success);
- }
+ public isLeader_result(isLeader_result other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.success = other.success;
}
- public setData_result deepCopy() {
- return new setData_result(this);
+ public isLeader_result deepCopy() {
+ return new isLeader_result(this);
}
@Override
public void clear() {
- this.success = null;
+ setSuccessIsSet(false);
+ this.success = false;
}
- public Stat getSuccess() {
+ public boolean isSuccess() {
return this.success;
}
- public setData_result setSuccess(Stat success) {
+ public isLeader_result setSuccess(boolean success) {
this.success = success;
+ setSuccessIsSet(true);
return this;
}
public void unsetSuccess() {
- this.success = null;
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
}
/** Returns true if field success is set (has been assigned a value) and false otherwise */
public boolean isSetSuccess() {
- return this.success != null;
+ return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
}
public void setSuccessIsSet(boolean value) {
- if (!value) {
- this.success = null;
- }
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
@@ -9271,7 +9854,7 @@ public class CuratorService {
if (value == null) {
unsetSuccess();
} else {
- setSuccess((Stat)value);
+ setSuccess((Boolean)value);
}
break;
@@ -9281,7 +9864,7 @@ public class CuratorService {
public Object getFieldValue(_Fields field) {
switch (field) {
case SUCCESS:
- return getSuccess();
+ return Boolean.valueOf(isSuccess());
}
throw new IllegalStateException();
@@ -9304,21 +9887,21 @@ public class CuratorService {
public boolean equals(Object that) {
if (that == null)
return false;
- if (that instanceof setData_result)
- return this.equals((setData_result)that);
+ if (that instanceof isLeader_result)
+ return this.equals((isLeader_result)that);
return false;
}
- public boolean equals(setData_result that) {
+ public boolean equals(isLeader_result that) {
if (that == null)
return false;
- boolean this_present_success = true && this.isSetSuccess();
- boolean that_present_success = true && that.isSetSuccess();
+ boolean this_present_success = true;
+ boolean that_present_success = true;
if (this_present_success || that_present_success) {
if (!(this_present_success && that_present_success))
return false;
- if (!this.success.equals(that.success))
+ if (this.success != that.success)
return false;
}
@@ -9331,7 +9914,7 @@ public class CuratorService {
}
@Override
- public int compareTo(setData_result other) {
+ public int compareTo(isLeader_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
@@ -9365,15 +9948,11 @@ public class CuratorService {
@Override
public String toString() {
- StringBuilder sb = new StringBuilder("setData_result(");
+ StringBuilder sb = new StringBuilder("isLeader_result(");
boolean first = true;
sb.append("success:");
- if (this.success == null) {
- sb.append("null");
- } else {
- sb.append(this.success);
- }
+ sb.append(this.success);
first = false;
sb.append(")");
return sb.toString();
@@ -9382,9 +9961,6 @@ public class CuratorService {
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
- if (success != null) {
- success.validate();
- }
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -9397,21 +9973,23 @@ public class CuratorService {
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
- private static class setData_resultStandardSchemeFactory implements SchemeFactory {
- public setData_resultStandardScheme getScheme() {
- return new setData_resultStandardScheme();
+ private static class isLeader_resultStandardSchemeFactory implements SchemeFactory {
+ public isLeader_resultStandardScheme getScheme() {
+ return new isLeader_resultStandardScheme();
}
}
- private static class setData_resultStandardScheme extends StandardScheme<setData_result> {
+ private static class isLeader_resultStandardScheme extends StandardScheme<isLeader_result> {
- public void read(org.apache.thrift.protocol.TProtocol iprot, setData_result struct) throws org.apache.thrift.TException {
+ public void read(org.apache.thrift.protocol.TProtocol iprot, isLeader_result struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
@@ -9422,9 +10000,8 @@ public class CuratorService {
}
switch (schemeField.id) {
case 0: // SUCCESS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.success = new Stat();
- struct.success.read(iprot);
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.success = iprot.readBool();
struct.setSuccessIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
@@ -9441,13 +10018,13 @@ public class CuratorService {
struct.validate();
}
- public void write(org.apache.thrift.protocol.TProtocol oprot, setData_result struct) throws org.apache.thrift.TException {
+ public void write(org.apache.thrift.protocol.TProtocol oprot, isLeader_result struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
- if (struct.success != null) {
+ if (struct.isSetSuccess()) {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- struct.success.write(oprot);
+ oprot.writeBool(struct.success);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
@@ -9456,16 +10033,16 @@ public class CuratorService {
}
- private static class setData_resultTupleSchemeFactory implements SchemeFactory {
- public setData_resultTupleScheme getScheme() {
- return new setData_resultTupleScheme();
+ private static class isLeader_resultTupleSchemeFactory implements SchemeFactory {
+ public isLeader_resultTupleScheme getScheme() {
+ return new isLeader_resultTupleScheme();
}
}
- private static class setData_resultTupleScheme extends TupleScheme<setData_result> {
+ private static class isLeader_resultTupleScheme extends TupleScheme<isLeader_result> {
@Override
- public void write(org.apache.thrift.protocol.TProtocol prot, setData_result struct) throws org.apache.thrift.TException {
+ public void write(org.apache.thrift.protocol.TProtocol prot, isLeader_result struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetSuccess()) {
@@ -9473,17 +10050,16 @@ public class CuratorService {
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetSuccess()) {
- struct.success.write(oprot);
+ oprot.write
<TRUNCATED>
[4/7] git commit: refactoring
Posted by ra...@apache.org.
refactoring
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/0f52fa24
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/0f52fa24
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/0f52fa24
Branch: refs/heads/curator-rpc
Commit: 0f52fa24f08bd5d55dab5a8278b3bb38a479cdb4
Parents: 41ac42b
Author: randgalt <ra...@apache.org>
Authored: Thu May 29 15:31:41 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 29 15:31:41 2014 -0500
----------------------------------------------------------------------
.../curator/x/rpc/idl/event/RpcChildData.java | 28 +
.../x/rpc/idl/event/RpcCuratorEvent.java | 201 +-----
.../idl/event/RpcPathChildrenCacheEvent.java | 31 +
.../event/RpcPathChildrenCacheEventType.java | 15 +
.../apache/curator/x/rpc/idl/event/RpcStat.java | 17 +
.../x/rpc/idl/event/RpcWatchedEvent.java | 8 +
.../x/rpc/idl/projection/CreateMode.java | 27 -
.../x/rpc/idl/projection/CreateSpec.java | 5 +-
.../projection/CuratorProjectionService.java | 61 +-
.../x/rpc/idl/projection/RpcCreateMode.java | 30 +
curator-x-rpc/src/main/thrift/curator.thrift | 39 +-
.../org/apache/curator/generated/ChildData.java | 604 +++++++++++++++++++
.../generated/PathChildrenCacheEvent.java | 509 ++++++++++++++++
.../generated/PathChildrenCacheEventType.java | 60 ++
.../org/apache/curator/x/rpc/TestClient.java | 13 +-
.../org/apache/curator/x/rpc/TestServer.java | 3 +
16 files changed, 1353 insertions(+), 298 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcChildData.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcChildData.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcChildData.java
new file mode 100644
index 0000000..4c7827b
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcChildData.java
@@ -0,0 +1,28 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct("ChildData")
+public class RpcChildData
+{
+ @ThriftField(1)
+ public String path;
+
+ @ThriftField(2)
+ public RpcStat stat;
+
+ @ThriftField(3)
+ public byte[] data;
+
+ public RpcChildData()
+ {
+ }
+
+ public RpcChildData(String path, RpcStat stat, byte[] data)
+ {
+ this.path = path;
+ this.stat = stat;
+ this.data = data;
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java
index 7835b39..92be564 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java
@@ -23,10 +23,8 @@ import com.facebook.swift.codec.ThriftStruct;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import org.apache.curator.framework.api.CuratorEvent;
-import org.apache.curator.framework.api.CuratorEventType;
import org.apache.curator.framework.state.ConnectionState;
import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Stat;
import javax.annotation.Nullable;
@@ -86,7 +84,7 @@ public class RpcCuratorEvent
public RpcCuratorEvent(CuratorEvent event)
{
- this.type = toRpcCuratorEventType(event.getType());
+ this.type = RpcCuratorEventType.valueOf(event.getType().name());
this.resultCode = event.getResultCode();
this.path = event.getPath();
this.context = (event.getContext() != null) ? String.valueOf(event.getContext()) : null;
@@ -101,7 +99,7 @@ public class RpcCuratorEvent
public RpcCuratorEvent(ConnectionState newState)
{
- this.type = toRpcCuratorEventType(newState);
+ this.type = RpcCuratorEventType.valueOf(newState.name());
this.resultCode = 0;
this.path = null;
this.context = null;
@@ -125,7 +123,7 @@ public class RpcCuratorEvent
this.name = null;
this.children = null;
this.aclList = null;
- this.watchedEvent = new RpcWatchedEvent(toRpcKeeperState(event.getState()), toRpcEventType(event.getType()), event.getPath());
+ this.watchedEvent = new RpcWatchedEvent(RpcKeeperState.valueOf(event.getState().name()), RpcEventType.valueOf(event.getType().name()), event.getPath());
this.leaderEvent = null;
}
@@ -144,119 +142,11 @@ public class RpcCuratorEvent
this.leaderEvent = event;
}
- private RpcCuratorEventType toRpcCuratorEventType(ConnectionState state)
- {
- switch ( state )
- {
- case CONNECTED:
- {
- return RpcCuratorEventType.CONNECTION_CONNECTED;
- }
-
- case SUSPENDED:
- {
- return RpcCuratorEventType.CONNECTION_SUSPENDED;
- }
-
- case RECONNECTED:
- {
- return RpcCuratorEventType.CONNECTION_RECONNECTED;
- }
-
- case LOST:
- {
- return RpcCuratorEventType.CONNECTION_LOST;
- }
-
- case READ_ONLY:
- {
- return RpcCuratorEventType.CONNECTION_READ_ONLY;
- }
- }
- throw new IllegalStateException("Unknown state: " + state);
- }
-
- private RpcCuratorEventType toRpcCuratorEventType(CuratorEventType eventType)
- {
- switch ( eventType )
- {
- case CREATE:
- {
- return RpcCuratorEventType.CREATE;
- }
-
- case DELETE:
- {
- return RpcCuratorEventType.DELETE;
- }
-
- case EXISTS:
- {
- return RpcCuratorEventType.EXISTS;
- }
-
- case GET_DATA:
- {
- return RpcCuratorEventType.GET_DATA;
- }
-
- case SET_DATA:
- {
- return RpcCuratorEventType.SET_DATA;
- }
-
- case CHILDREN:
- {
- return RpcCuratorEventType.CHILDREN;
- }
-
- case SYNC:
- {
- return RpcCuratorEventType.SYNC;
- }
-
- case GET_ACL:
- {
- return RpcCuratorEventType.GET_ACL;
- }
-
- case SET_ACL:
- {
- return RpcCuratorEventType.SET_ACL;
- }
-
- case WATCHED:
- {
- return RpcCuratorEventType.WATCHED;
- }
-
- case CLOSING:
- {
- return RpcCuratorEventType.CLOSING;
- }
- }
-
- throw new IllegalStateException("Unknown type: " + eventType);
- }
-
public static RpcStat toRpcStat(Stat stat)
{
if ( stat != null )
{
- return new RpcStat
- (
- stat.getCzxid(),
- stat.getMzxid(),
- stat.getCtime(),
- stat.getMtime(),
- stat.getVersion(),
- stat.getCversion(),
- stat.getAversion(),
- stat.getEphemeralOwner(),
- stat.getDataLength(),
- stat.getNumChildren(),
- stat.getPzxid()
- );
+ return new RpcStat(stat);
}
return null;
}
@@ -287,89 +177,8 @@ public class RpcCuratorEvent
{
if ( watchedEvent != null )
{
- RpcKeeperState keeperState = toRpcKeeperState(watchedEvent.getState());
- RpcEventType eventType = toRpcEventType(watchedEvent.getType());
- return new RpcWatchedEvent(keeperState, eventType, watchedEvent.getPath());
+ return new RpcWatchedEvent(watchedEvent);
}
return null;
}
-
- private RpcEventType toRpcEventType(Watcher.Event.EventType type)
- {
- switch ( type )
- {
- case None:
- {
- return RpcEventType.None;
- }
-
- case NodeCreated:
- {
- return RpcEventType.NodeCreated;
- }
-
- case NodeDeleted:
- {
- return RpcEventType.NodeDeleted;
- }
-
- case NodeDataChanged:
- {
- return RpcEventType.NodeDataChanged;
- }
-
- case NodeChildrenChanged:
- {
- return RpcEventType.NodeChildrenChanged;
- }
- }
- throw new IllegalStateException("Unknown type: " + type);
- }
-
- private RpcKeeperState toRpcKeeperState(Watcher.Event.KeeperState state)
- {
- switch ( state )
- {
- case Unknown:
- {
- return RpcKeeperState.Unknown;
- }
-
- case Disconnected:
- {
- return RpcKeeperState.Disconnected;
- }
-
- case NoSyncConnected:
- {
- return RpcKeeperState.NoSyncConnected;
- }
-
- case SyncConnected:
- {
- return RpcKeeperState.SyncConnected;
- }
-
- case AuthFailed:
- {
- return RpcKeeperState.AuthFailed;
- }
-
- case ConnectedReadOnly:
- {
- return RpcKeeperState.ConnectedReadOnly;
- }
-
- case SaslAuthenticated:
- {
- return RpcKeeperState.SaslAuthenticated;
- }
-
- case Expired:
- {
- return RpcKeeperState.Expired;
- }
- }
- throw new IllegalStateException("Unknown state: " + state);
- }
}
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEvent.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEvent.java
new file mode 100644
index 0000000..0213559
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEvent.java
@@ -0,0 +1,31 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent;
+
+@ThriftStruct("PathChildrenCacheEvent")
+public class RpcPathChildrenCacheEvent
+{
+ @ThriftField(1)
+ public RpcPathChildrenCacheEventType type;
+
+ @ThriftField(2)
+ public RpcChildData data;
+
+ public RpcPathChildrenCacheEvent()
+ {
+ }
+
+ public RpcPathChildrenCacheEvent(PathChildrenCacheEvent event)
+ {
+ type = RpcPathChildrenCacheEventType.valueOf(event.getType().name());
+ data = (event.getData() != null) ? new RpcChildData(event.getData().getPath(), RpcCuratorEvent.toRpcStat(event.getData().getStat()), event.getData().getData()) : null;
+ }
+
+ public RpcPathChildrenCacheEvent(RpcPathChildrenCacheEventType type, RpcChildData data)
+ {
+ this.type = type;
+ this.data = data;
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEventType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEventType.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEventType.java
new file mode 100644
index 0000000..4ec5541
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEventType.java
@@ -0,0 +1,15 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftEnum;
+
+@ThriftEnum("PathChildrenCacheEventType")
+public enum RpcPathChildrenCacheEventType
+{
+ CHILD_ADDED,
+ CHILD_UPDATED,
+ CHILD_REMOVED,
+ CONNECTION_SUSPENDED,
+ CONNECTION_RECONNECTED,
+ CONNECTION_LOST,
+ INITIALIZED
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcStat.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcStat.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcStat.java
index e5fd919..f5d2300 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcStat.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcStat.java
@@ -16,10 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.curator.x.rpc.idl.event;
import com.facebook.swift.codec.ThriftField;
import com.facebook.swift.codec.ThriftStruct;
+import org.apache.zookeeper.data.Stat;
@ThriftStruct("Stat")
public class RpcStat
@@ -61,6 +63,21 @@ public class RpcStat
{
}
+ public RpcStat(Stat stat)
+ {
+ czxid = stat.getCzxid();
+ mzxid = stat.getMzxid();
+ ctime = stat.getCtime();
+ mtime = stat.getMtime();
+ version = stat.getVersion();
+ cversion = stat.getCversion();
+ aversion = stat.getAversion();
+ ephemeralOwner = stat.getEphemeralOwner();
+ dataLength = stat.getDataLength();
+ numChildren = stat.getNumChildren();
+ pzxid = stat.getPzxid();
+ }
+
public RpcStat(long czxid, long mzxid, long ctime, long mtime, int version, int cversion, int aversion, long ephemeralOwner, int dataLength, int numChildren, long pzxid)
{
this.czxid = czxid;
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcWatchedEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcWatchedEvent.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcWatchedEvent.java
index de696b9..11856b3 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcWatchedEvent.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcWatchedEvent.java
@@ -20,6 +20,7 @@ package org.apache.curator.x.rpc.idl.event;
import com.facebook.swift.codec.ThriftField;
import com.facebook.swift.codec.ThriftStruct;
+import org.apache.zookeeper.WatchedEvent;
@ThriftStruct("WatchedEvent")
public class RpcWatchedEvent
@@ -37,6 +38,13 @@ public class RpcWatchedEvent
{
}
+ public RpcWatchedEvent(WatchedEvent watchedEvent)
+ {
+ keeperState = RpcKeeperState.valueOf(watchedEvent.getState().name());
+ eventType = RpcEventType.valueOf(watchedEvent.getType().name());
+ path = watchedEvent.getPath();
+ }
+
public RpcWatchedEvent(RpcKeeperState keeperState, RpcEventType eventType, String path)
{
this.keeperState = keeperState;
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CreateMode.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CreateMode.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CreateMode.java
deleted file mode 100644
index d53cf8d..0000000
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CreateMode.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * 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.curator.x.rpc.idl.projection;
-
-public enum CreateMode
-{
- PERSISTENT,
- PERSISTENT_SEQUENTIAL,
- EPHEMERAL,
- EPHEMERAL_SEQUENTIAL
-}
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CreateSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CreateSpec.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CreateSpec.java
index 71bfb1e..7f156b4 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CreateSpec.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CreateSpec.java
@@ -20,7 +20,6 @@ package org.apache.curator.x.rpc.idl.projection;
import com.facebook.swift.codec.ThriftField;
import com.facebook.swift.codec.ThriftStruct;
-import org.apache.curator.framework.api.CreateBuilder;
@ThriftStruct
public class CreateSpec
@@ -32,7 +31,7 @@ public class CreateSpec
public byte[] data;
@ThriftField(3)
- public CreateMode mode;
+ public RpcCreateMode mode;
@ThriftField(4)
public String asyncContext;
@@ -50,7 +49,7 @@ public class CreateSpec
{
}
- public CreateSpec(String path, byte[] data, CreateMode mode, String asyncContext, boolean compressed, boolean creatingParentsIfNeeded, boolean withProtection)
+ public CreateSpec(String path, byte[] data, RpcCreateMode mode, String asyncContext, boolean compressed, boolean creatingParentsIfNeeded, boolean withProtection)
{
this.path = path;
this.data = data;
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
index 03d0c9f..fd7384e 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
@@ -49,6 +49,7 @@ import org.apache.curator.x.rpc.idl.event.OptionalRpcStat;
import org.apache.curator.x.rpc.idl.event.RpcCuratorEvent;
import org.apache.curator.x.rpc.idl.event.RpcParticipant;
import org.apache.curator.x.rpc.idl.event.RpcStat;
+import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -121,7 +122,7 @@ public class CuratorProjectionService
}
if ( spec.mode != null )
{
- builder = castBuilder(builder, CreateModable.class).withMode(getRealMode(spec.mode));
+ builder = castBuilder(builder, CreateModable.class).withMode(CreateMode.valueOf(spec.mode.name()));
}
if ( spec.asyncContext != null )
@@ -356,18 +357,14 @@ public class CuratorProjectionService
LeaderLatch leaderLatch = getThis(entry, leaderProjection.projection.id, LeaderLatch.class);
Collection<Participant> participants = leaderLatch.getParticipants();
- return Lists.transform
- (
- Lists.newArrayList(participants),
- new Function<Participant, RpcParticipant>()
+ return Lists.transform(Lists.newArrayList(participants), new Function<Participant, RpcParticipant>()
{
@Override
public RpcParticipant apply(Participant participant)
{
return new RpcParticipant(participant.getId(), participant.isLeader());
}
- }
- );
+ });
}
@ThriftMethod
@@ -385,28 +382,7 @@ public class CuratorProjectionService
CuratorEntry entry = getEntry(projection);
PathChildrenCache cache = new PathChildrenCache(entry.getClient(), path, cacheData, dataIsCompressed, ThreadUtils.newThreadFactory("PathChildrenCacheResource-%d"));
- PathChildrenCache.StartMode actualStartMode = PathChildrenCache.StartMode.NORMAL;
- switch ( startMode )
- {
- case NORMAL:
- {
- actualStartMode = PathChildrenCache.StartMode.NORMAL;
- break;
- }
-
- case BUILD_INITIAL_CACHE:
- {
- actualStartMode = PathChildrenCache.StartMode.BUILD_INITIAL_CACHE;
- break;
- }
-
- case POST_INITIALIZED_EVENT:
- {
- actualStartMode = PathChildrenCache.StartMode.POST_INITIALIZED_EVENT;
- break;
- }
- }
- cache.start(actualStartMode);
+ cache.start(PathChildrenCache.StartMode.valueOf(startMode.name()));
Closer<PathChildrenCache> closer = new Closer<PathChildrenCache>()
{
@@ -448,33 +424,6 @@ public class CuratorProjectionService
}
}
- private org.apache.zookeeper.CreateMode getRealMode(CreateMode mode)
- {
- switch ( mode )
- {
- case PERSISTENT:
- {
- return org.apache.zookeeper.CreateMode.PERSISTENT;
- }
-
- case PERSISTENT_SEQUENTIAL:
- {
- return org.apache.zookeeper.CreateMode.PERSISTENT_SEQUENTIAL;
- }
-
- case EPHEMERAL:
- {
- return org.apache.zookeeper.CreateMode.EPHEMERAL;
- }
-
- case EPHEMERAL_SEQUENTIAL:
- {
- return org.apache.zookeeper.CreateMode.EPHEMERAL_SEQUENTIAL;
- }
- }
- throw new UnsupportedOperationException("Bad mode: " + mode.toString());
- }
-
private CuratorEntry getEntry(CuratorProjection projection) throws Exception
{
CuratorEntry entry = connectionManager.get(projection.id);
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/RpcCreateMode.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/RpcCreateMode.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/RpcCreateMode.java
new file mode 100644
index 0000000..3ef6b45
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/RpcCreateMode.java
@@ -0,0 +1,30 @@
+/**
+ * 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.curator.x.rpc.idl.projection;
+
+import com.facebook.swift.codec.ThriftEnum;
+
+@ThriftEnum("CreateMode")
+public enum RpcCreateMode
+{
+ PERSISTENT,
+ PERSISTENT_SEQUENTIAL,
+ EPHEMERAL,
+ EPHEMERAL_SEQUENTIAL
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/main/thrift/curator.thrift
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/thrift/curator.thrift b/curator-x-rpc/src/main/thrift/curator.thrift
index 9ab4e62..c553c1f 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -3,14 +3,14 @@ namespace cpp org.apache.curator.generated
namespace java org.apache.curator.generated
-enum CreateMode {
- PERSISTENT, PERSISTENT_SEQUENTIAL, EPHEMERAL, EPHEMERAL_SEQUENTIAL
-}
-
enum PathChildrenCacheStartMode {
NORMAL, BUILD_INITIAL_CACHE, POST_INITIALIZED_EVENT
}
+enum CreateMode {
+ PERSISTENT, PERSISTENT_SEQUENTIAL, EPHEMERAL, EPHEMERAL_SEQUENTIAL
+}
+
enum CuratorEventType {
PING, CREATE, DELETE, EXISTS, GET_DATA, SET_DATA, CHILDREN, SYNC, GET_ACL, SET_ACL, WATCHED, CLOSING, CONNECTION_CONNECTED, CONNECTION_SUSPENDED, CONNECTION_RECONNECTED, CONNECTION_LOST, CONNECTION_READ_ONLY, LEADER
}
@@ -23,14 +23,8 @@ enum KeeperState {
Unknown, Disconnected, NoSyncConnected, SyncConnected, AuthFailed, ConnectedReadOnly, SaslAuthenticated, Expired
}
-struct CreateSpec {
- 1: string path;
- 2: binary data;
- 3: CreateMode mode;
- 4: string asyncContext;
- 5: bool compressed;
- 6: bool creatingParentsIfNeeded;
- 7: bool withProtection;
+enum PathChildrenCacheEventType {
+ CHILD_ADDED, CHILD_UPDATED, CHILD_REMOVED, CONNECTION_SUSPENDED, CONNECTION_RECONNECTED, CONNECTION_LOST, INITIALIZED
}
struct CuratorProjection {
@@ -121,6 +115,16 @@ struct WatchedEvent {
3: string path;
}
+struct CreateSpec {
+ 1: string path;
+ 2: binary data;
+ 3: CreateMode mode;
+ 4: string asyncContext;
+ 5: bool compressed;
+ 6: bool creatingParentsIfNeeded;
+ 7: bool withProtection;
+}
+
struct DeleteSpec {
1: string path;
2: bool guaranteed;
@@ -147,6 +151,12 @@ struct Acl {
2: Id id;
}
+struct ChildData {
+ 1: string path;
+ 2: Stat stat;
+ 3: binary data;
+}
+
struct CuratorEvent {
2: CuratorEventType type;
3: i32 resultCode;
@@ -161,6 +171,11 @@ struct CuratorEvent {
12: LeaderEvent leaderEvent;
}
+struct PathChildrenCacheEvent {
+ 1: PathChildrenCacheEventType type;
+ 2: ChildData data;
+}
+
service CuratorService {
GenericProjection acquireLock(1: CuratorProjection projection, 2: string path, 3: i32 maxWaitMs);
void closeCuratorProjection(1: CuratorProjection projection);
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/test/java/org/apache/curator/generated/ChildData.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/ChildData.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/ChildData.java
new file mode 100644
index 0000000..368fda9
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/ChildData.java
@@ -0,0 +1,604 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.curator.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 org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+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 ChildData implements org.apache.thrift.TBase<ChildData, ChildData._Fields>, java.io.Serializable, Cloneable, Comparable<ChildData> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ChildData");
+
+ private static final org.apache.thrift.protocol.TField PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("path", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField STAT_FIELD_DESC = new org.apache.thrift.protocol.TField("stat", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+ private static final org.apache.thrift.protocol.TField DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("data", org.apache.thrift.protocol.TType.STRING, (short)3);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new ChildDataStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new ChildDataTupleSchemeFactory());
+ }
+
+ public String path; // required
+ public Stat stat; // required
+ public ByteBuffer data; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PATH((short)1, "path"),
+ STAT((short)2, "stat"),
+ DATA((short)3, "data");
+
+ 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: // PATH
+ return PATH;
+ case 2: // STAT
+ return STAT;
+ case 3: // DATA
+ return DATA;
+ 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
+ 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.PATH, new org.apache.thrift.meta_data.FieldMetaData("path", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.STAT, new org.apache.thrift.meta_data.FieldMetaData("stat", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Stat.class)));
+ tmpMap.put(_Fields.DATA, new org.apache.thrift.meta_data.FieldMetaData("data", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ 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(ChildData.class, metaDataMap);
+ }
+
+ public ChildData() {
+ }
+
+ public ChildData(
+ String path,
+ Stat stat,
+ ByteBuffer data)
+ {
+ this();
+ this.path = path;
+ this.stat = stat;
+ this.data = data;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public ChildData(ChildData other) {
+ if (other.isSetPath()) {
+ this.path = other.path;
+ }
+ if (other.isSetStat()) {
+ this.stat = new Stat(other.stat);
+ }
+ if (other.isSetData()) {
+ this.data = org.apache.thrift.TBaseHelper.copyBinary(other.data);
+;
+ }
+ }
+
+ public ChildData deepCopy() {
+ return new ChildData(this);
+ }
+
+ @Override
+ public void clear() {
+ this.path = null;
+ this.stat = null;
+ this.data = null;
+ }
+
+ public String getPath() {
+ return this.path;
+ }
+
+ public ChildData setPath(String path) {
+ this.path = path;
+ return this;
+ }
+
+ public void unsetPath() {
+ this.path = null;
+ }
+
+ /** Returns true if field path is set (has been assigned a value) and false otherwise */
+ public boolean isSetPath() {
+ return this.path != null;
+ }
+
+ public void setPathIsSet(boolean value) {
+ if (!value) {
+ this.path = null;
+ }
+ }
+
+ public Stat getStat() {
+ return this.stat;
+ }
+
+ public ChildData setStat(Stat stat) {
+ this.stat = stat;
+ return this;
+ }
+
+ public void unsetStat() {
+ this.stat = null;
+ }
+
+ /** Returns true if field stat is set (has been assigned a value) and false otherwise */
+ public boolean isSetStat() {
+ return this.stat != null;
+ }
+
+ public void setStatIsSet(boolean value) {
+ if (!value) {
+ this.stat = null;
+ }
+ }
+
+ public byte[] getData() {
+ setData(org.apache.thrift.TBaseHelper.rightSize(data));
+ return data == null ? null : data.array();
+ }
+
+ public ByteBuffer bufferForData() {
+ return data;
+ }
+
+ public ChildData setData(byte[] data) {
+ setData(data == null ? (ByteBuffer)null : ByteBuffer.wrap(data));
+ return this;
+ }
+
+ public ChildData setData(ByteBuffer data) {
+ this.data = data;
+ return this;
+ }
+
+ public void unsetData() {
+ this.data = null;
+ }
+
+ /** Returns true if field data is set (has been assigned a value) and false otherwise */
+ public boolean isSetData() {
+ return this.data != null;
+ }
+
+ public void setDataIsSet(boolean value) {
+ if (!value) {
+ this.data = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PATH:
+ if (value == null) {
+ unsetPath();
+ } else {
+ setPath((String)value);
+ }
+ break;
+
+ case STAT:
+ if (value == null) {
+ unsetStat();
+ } else {
+ setStat((Stat)value);
+ }
+ break;
+
+ case DATA:
+ if (value == null) {
+ unsetData();
+ } else {
+ setData((ByteBuffer)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PATH:
+ return getPath();
+
+ case STAT:
+ return getStat();
+
+ case DATA:
+ return getData();
+
+ }
+ 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 PATH:
+ return isSetPath();
+ case STAT:
+ return isSetStat();
+ case DATA:
+ return isSetData();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof ChildData)
+ return this.equals((ChildData)that);
+ return false;
+ }
+
+ public boolean equals(ChildData that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_path = true && this.isSetPath();
+ boolean that_present_path = true && that.isSetPath();
+ if (this_present_path || that_present_path) {
+ if (!(this_present_path && that_present_path))
+ return false;
+ if (!this.path.equals(that.path))
+ return false;
+ }
+
+ boolean this_present_stat = true && this.isSetStat();
+ boolean that_present_stat = true && that.isSetStat();
+ if (this_present_stat || that_present_stat) {
+ if (!(this_present_stat && that_present_stat))
+ return false;
+ if (!this.stat.equals(that.stat))
+ return false;
+ }
+
+ boolean this_present_data = true && this.isSetData();
+ boolean that_present_data = true && that.isSetData();
+ if (this_present_data || that_present_data) {
+ if (!(this_present_data && that_present_data))
+ return false;
+ if (!this.data.equals(that.data))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(ChildData other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetPath()).compareTo(other.isSetPath());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPath()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.path, other.path);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetStat()).compareTo(other.isSetStat());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetStat()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stat, other.stat);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetData()).compareTo(other.isSetData());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetData()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data, other.data);
+ 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("ChildData(");
+ boolean first = true;
+
+ sb.append("path:");
+ if (this.path == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.path);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("stat:");
+ if (this.stat == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.stat);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("data:");
+ if (this.data == null) {
+ sb.append("null");
+ } else {
+ org.apache.thrift.TBaseHelper.toString(this.data, sb);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (stat != null) {
+ stat.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ 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 ChildDataStandardSchemeFactory implements SchemeFactory {
+ public ChildDataStandardScheme getScheme() {
+ return new ChildDataStandardScheme();
+ }
+ }
+
+ private static class ChildDataStandardScheme extends StandardScheme<ChildData> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, ChildData 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: // PATH
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.path = iprot.readString();
+ struct.setPathIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // STAT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.stat = new Stat();
+ struct.stat.read(iprot);
+ struct.setStatIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // DATA
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.data = iprot.readBinary();
+ struct.setDataIsSet(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, ChildData struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.path != null) {
+ oprot.writeFieldBegin(PATH_FIELD_DESC);
+ oprot.writeString(struct.path);
+ oprot.writeFieldEnd();
+ }
+ if (struct.stat != null) {
+ oprot.writeFieldBegin(STAT_FIELD_DESC);
+ struct.stat.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.data != null) {
+ oprot.writeFieldBegin(DATA_FIELD_DESC);
+ oprot.writeBinary(struct.data);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class ChildDataTupleSchemeFactory implements SchemeFactory {
+ public ChildDataTupleScheme getScheme() {
+ return new ChildDataTupleScheme();
+ }
+ }
+
+ private static class ChildDataTupleScheme extends TupleScheme<ChildData> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, ChildData struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetPath()) {
+ optionals.set(0);
+ }
+ if (struct.isSetStat()) {
+ optionals.set(1);
+ }
+ if (struct.isSetData()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetPath()) {
+ oprot.writeString(struct.path);
+ }
+ if (struct.isSetStat()) {
+ struct.stat.write(oprot);
+ }
+ if (struct.isSetData()) {
+ oprot.writeBinary(struct.data);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, ChildData struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct.path = iprot.readString();
+ struct.setPathIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.stat = new Stat();
+ struct.stat.read(iprot);
+ struct.setStatIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.data = iprot.readBinary();
+ struct.setDataIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheEvent.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheEvent.java
new file mode 100644
index 0000000..efa8aed
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheEvent.java
@@ -0,0 +1,509 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.curator.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 org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+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 PathChildrenCacheEvent implements org.apache.thrift.TBase<PathChildrenCacheEvent, PathChildrenCacheEvent._Fields>, java.io.Serializable, Cloneable, Comparable<PathChildrenCacheEvent> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PathChildrenCacheEvent");
+
+ private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("data", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new PathChildrenCacheEventStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new PathChildrenCacheEventTupleSchemeFactory());
+ }
+
+ /**
+ *
+ * @see PathChildrenCacheEventType
+ */
+ public PathChildrenCacheEventType type; // required
+ public ChildData data; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ /**
+ *
+ * @see PathChildrenCacheEventType
+ */
+ TYPE((short)1, "type"),
+ DATA((short)2, "data");
+
+ 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: // TYPE
+ return TYPE;
+ case 2: // DATA
+ return DATA;
+ 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
+ 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.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, PathChildrenCacheEventType.class)));
+ tmpMap.put(_Fields.DATA, new org.apache.thrift.meta_data.FieldMetaData("data", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ChildData.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PathChildrenCacheEvent.class, metaDataMap);
+ }
+
+ public PathChildrenCacheEvent() {
+ }
+
+ public PathChildrenCacheEvent(
+ PathChildrenCacheEventType type,
+ ChildData data)
+ {
+ this();
+ this.type = type;
+ this.data = data;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public PathChildrenCacheEvent(PathChildrenCacheEvent other) {
+ if (other.isSetType()) {
+ this.type = other.type;
+ }
+ if (other.isSetData()) {
+ this.data = new ChildData(other.data);
+ }
+ }
+
+ public PathChildrenCacheEvent deepCopy() {
+ return new PathChildrenCacheEvent(this);
+ }
+
+ @Override
+ public void clear() {
+ this.type = null;
+ this.data = null;
+ }
+
+ /**
+ *
+ * @see PathChildrenCacheEventType
+ */
+ public PathChildrenCacheEventType getType() {
+ return this.type;
+ }
+
+ /**
+ *
+ * @see PathChildrenCacheEventType
+ */
+ public PathChildrenCacheEvent setType(PathChildrenCacheEventType type) {
+ this.type = type;
+ return this;
+ }
+
+ public void unsetType() {
+ this.type = null;
+ }
+
+ /** Returns true if field type is set (has been assigned a value) and false otherwise */
+ public boolean isSetType() {
+ return this.type != null;
+ }
+
+ public void setTypeIsSet(boolean value) {
+ if (!value) {
+ this.type = null;
+ }
+ }
+
+ public ChildData getData() {
+ return this.data;
+ }
+
+ public PathChildrenCacheEvent setData(ChildData data) {
+ this.data = data;
+ return this;
+ }
+
+ public void unsetData() {
+ this.data = null;
+ }
+
+ /** Returns true if field data is set (has been assigned a value) and false otherwise */
+ public boolean isSetData() {
+ return this.data != null;
+ }
+
+ public void setDataIsSet(boolean value) {
+ if (!value) {
+ this.data = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case TYPE:
+ if (value == null) {
+ unsetType();
+ } else {
+ setType((PathChildrenCacheEventType)value);
+ }
+ break;
+
+ case DATA:
+ if (value == null) {
+ unsetData();
+ } else {
+ setData((ChildData)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case TYPE:
+ return getType();
+
+ case DATA:
+ return getData();
+
+ }
+ 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 TYPE:
+ return isSetType();
+ case DATA:
+ return isSetData();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof PathChildrenCacheEvent)
+ return this.equals((PathChildrenCacheEvent)that);
+ return false;
+ }
+
+ public boolean equals(PathChildrenCacheEvent that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_type = true && this.isSetType();
+ boolean that_present_type = true && that.isSetType();
+ if (this_present_type || that_present_type) {
+ if (!(this_present_type && that_present_type))
+ return false;
+ if (!this.type.equals(that.type))
+ return false;
+ }
+
+ boolean this_present_data = true && this.isSetData();
+ boolean that_present_data = true && that.isSetData();
+ if (this_present_data || that_present_data) {
+ if (!(this_present_data && that_present_data))
+ return false;
+ if (!this.data.equals(that.data))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(PathChildrenCacheEvent other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetType()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetData()).compareTo(other.isSetData());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetData()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data, other.data);
+ 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("PathChildrenCacheEvent(");
+ boolean first = true;
+
+ sb.append("type:");
+ if (this.type == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.type);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("data:");
+ if (this.data == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.data);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (data != null) {
+ data.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ 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 PathChildrenCacheEventStandardSchemeFactory implements SchemeFactory {
+ public PathChildrenCacheEventStandardScheme getScheme() {
+ return new PathChildrenCacheEventStandardScheme();
+ }
+ }
+
+ private static class PathChildrenCacheEventStandardScheme extends StandardScheme<PathChildrenCacheEvent> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, PathChildrenCacheEvent 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: // TYPE
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.type = PathChildrenCacheEventType.findByValue(iprot.readI32());
+ struct.setTypeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // DATA
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.data = new ChildData();
+ struct.data.read(iprot);
+ struct.setDataIsSet(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, PathChildrenCacheEvent struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.type != null) {
+ oprot.writeFieldBegin(TYPE_FIELD_DESC);
+ oprot.writeI32(struct.type.getValue());
+ oprot.writeFieldEnd();
+ }
+ if (struct.data != null) {
+ oprot.writeFieldBegin(DATA_FIELD_DESC);
+ struct.data.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class PathChildrenCacheEventTupleSchemeFactory implements SchemeFactory {
+ public PathChildrenCacheEventTupleScheme getScheme() {
+ return new PathChildrenCacheEventTupleScheme();
+ }
+ }
+
+ private static class PathChildrenCacheEventTupleScheme extends TupleScheme<PathChildrenCacheEvent> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, PathChildrenCacheEvent struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetType()) {
+ optionals.set(0);
+ }
+ if (struct.isSetData()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetType()) {
+ oprot.writeI32(struct.type.getValue());
+ }
+ if (struct.isSetData()) {
+ struct.data.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, PathChildrenCacheEvent struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.type = PathChildrenCacheEventType.findByValue(iprot.readI32());
+ struct.setTypeIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.data = new ChildData();
+ struct.data.read(iprot);
+ struct.setDataIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheEventType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheEventType.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheEventType.java
new file mode 100644
index 0000000..ad10558
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/PathChildrenCacheEventType.java
@@ -0,0 +1,60 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.curator.generated;
+
+
+import java.util.Map;
+import java.util.HashMap;
+import org.apache.thrift.TEnum;
+
+public enum PathChildrenCacheEventType implements org.apache.thrift.TEnum {
+ CHILD_ADDED(0),
+ CHILD_UPDATED(1),
+ CHILD_REMOVED(2),
+ CONNECTION_SUSPENDED(3),
+ CONNECTION_RECONNECTED(4),
+ CONNECTION_LOST(5),
+ INITIALIZED(6);
+
+ private final int value;
+
+ private PathChildrenCacheEventType(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Get the integer value of this enum value, as defined in the Thrift IDL.
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * Find a the enum type by its integer value, as defined in the Thrift IDL.
+ * @return null if the value is not found.
+ */
+ public static PathChildrenCacheEventType findByValue(int value) {
+ switch (value) {
+ case 0:
+ return CHILD_ADDED;
+ case 1:
+ return CHILD_UPDATED;
+ case 2:
+ return CHILD_REMOVED;
+ case 3:
+ return CONNECTION_SUSPENDED;
+ case 4:
+ return CONNECTION_RECONNECTED;
+ case 5:
+ return CONNECTION_LOST;
+ case 6:
+ return INITIALIZED;
+ default:
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
index b1366a6..02c8ccb 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
@@ -19,20 +19,18 @@
package org.apache.curator.x.rpc;
import org.apache.curator.generated.*;
-import org.apache.curator.test.TestingServer;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import java.nio.ByteBuffer;
+import java.util.List;
import java.util.concurrent.Executors;
public class TestClient
{
public static void main(String[] args) throws Exception
{
- new TestingServer(2181);
-
TSocket clientTransport = new TSocket("localhost", 8899);
clientTransport.open();
TProtocol clientProtocol = new TBinaryProtocol(clientTransport);
@@ -103,6 +101,13 @@ public class TestClient
LeaderResult leader = client.startLeaderSelector(curatorProjection, "/leader", "me", 10000);
System.out.println("Has Leader: " + leader.hasLeadership);
- client.closeGenericProjection(curatorProjection, leader.projection);
+
+ List<Participant> leaderParticipants = client.getLeaderParticipants(curatorProjection, leader.projection);
+ System.out.println("Participants: " + leaderParticipants);
+
+ boolean isLeader = client.isLeader(curatorProjection, leader.projection);
+ System.out.println("isLeader: " + isLeader);
+
+ client.closeGenericProjection(curatorProjection, leader.projection.projection);
}
}
http://git-wip-us.apache.org/repos/asf/curator/blob/0f52fa24/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestServer.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestServer.java b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestServer.java
index 9472dd8..f64d383 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestServer.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestServer.java
@@ -1,12 +1,15 @@
package org.apache.curator.x.rpc;
import com.google.common.io.Resources;
+import org.apache.curator.test.TestingServer;
import java.nio.charset.Charset;
public class TestServer
{
public static void main(String[] args) throws Exception
{
+ new TestingServer(2181);
+
String configurationSource = Resources.toString(Resources.getResource("configuration/test.json"), Charset.defaultCharset());
CuratorProjectionServer.main(new String[]{configurationSource});
}
[7/7] git commit: Finished path children cache
Posted by ra...@apache.org.
Finished path children cache
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/6f9a9ab4
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/6f9a9ab4
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/6f9a9ab4
Branch: refs/heads/curator-rpc
Commit: 6f9a9ab4ff218fb4aa8e961239bee45fe647f416
Parents: 4c626a7
Author: randgalt <ra...@apache.org>
Authored: Thu May 29 15:54:10 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 29 15:54:10 2014 -0500
----------------------------------------------------------------------
.../curator/x/rpc/idl/event/RpcChildData.java | 11 +
.../idl/event/RpcPathChildrenCacheEvent.java | 2 +-
.../projection/CuratorProjectionService.java | 46 +-
curator-x-rpc/src/main/thrift/curator.thrift | 2 +
.../curator/generated/CuratorService.java | 2071 ++++++++++++++++++
.../org/apache/curator/x/rpc/TestClient.java | 9 +
6 files changed, 2128 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/6f9a9ab4/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcChildData.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcChildData.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcChildData.java
index 4c7827b..e490493 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcChildData.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcChildData.java
@@ -2,6 +2,7 @@ package org.apache.curator.x.rpc.idl.event;
import com.facebook.swift.codec.ThriftField;
import com.facebook.swift.codec.ThriftStruct;
+import org.apache.curator.framework.recipes.cache.ChildData;
@ThriftStruct("ChildData")
public class RpcChildData
@@ -19,6 +20,16 @@ public class RpcChildData
{
}
+ public RpcChildData(ChildData data)
+ {
+ if ( data != null )
+ {
+ this.path = data.getPath();
+ this.stat = RpcCuratorEvent.toRpcStat(data.getStat());
+ this.data = data.getData();
+ }
+ }
+
public RpcChildData(String path, RpcStat stat, byte[] data)
{
this.path = path;
http://git-wip-us.apache.org/repos/asf/curator/blob/6f9a9ab4/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEvent.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEvent.java
index 9321157..59be6e2 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEvent.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcPathChildrenCacheEvent.java
@@ -24,7 +24,7 @@ public class RpcPathChildrenCacheEvent
{
this.cachedPath = cachedPath;
type = RpcPathChildrenCacheEventType.valueOf(event.getType().name());
- data = (event.getData() != null) ? new RpcChildData(event.getData().getPath(), RpcCuratorEvent.toRpcStat(event.getData().getStat()), event.getData().getData()) : null;
+ data = (event.getData() != null) ? new RpcChildData(event.getData()) : null;
}
public RpcPathChildrenCacheEvent(String cachedPath, RpcPathChildrenCacheEventType type, RpcChildData data)
http://git-wip-us.apache.org/repos/asf/curator/blob/6f9a9ab4/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
index 1084507..8b41353 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
@@ -26,6 +26,7 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.api.*;
+import org.apache.curator.framework.recipes.cache.ChildData;
import org.apache.curator.framework.recipes.cache.PathChildrenCache;
import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent;
import org.apache.curator.framework.recipes.cache.PathChildrenCacheListener;
@@ -41,15 +42,7 @@ import org.apache.curator.x.rpc.connections.ConnectionManager;
import org.apache.curator.x.rpc.connections.CuratorEntry;
import org.apache.curator.x.rpc.details.RpcBackgroundCallback;
import org.apache.curator.x.rpc.details.RpcWatcher;
-import org.apache.curator.x.rpc.idl.event.LeaderEvent;
-import org.apache.curator.x.rpc.idl.event.LeaderResult;
-import org.apache.curator.x.rpc.idl.event.OptionalChildrenList;
-import org.apache.curator.x.rpc.idl.event.OptionalPath;
-import org.apache.curator.x.rpc.idl.event.OptionalRpcStat;
-import org.apache.curator.x.rpc.idl.event.RpcCuratorEvent;
-import org.apache.curator.x.rpc.idl.event.RpcParticipant;
-import org.apache.curator.x.rpc.idl.event.RpcPathChildrenCacheEvent;
-import org.apache.curator.x.rpc.idl.event.RpcStat;
+import org.apache.curator.x.rpc.idl.event.*;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
@@ -356,7 +349,7 @@ public class CuratorProjectionService
{
CuratorEntry entry = getEntry(projection);
- LeaderLatch leaderLatch = getThis(entry, leaderProjection.projection.id, LeaderLatch.class);
+ LeaderLatch leaderLatch = getThing(entry, leaderProjection.projection.id, LeaderLatch.class);
Collection<Participant> participants = leaderLatch.getParticipants();
return Lists.transform(Lists.newArrayList(participants), new Function<Participant, RpcParticipant>()
{
@@ -373,7 +366,7 @@ public class CuratorProjectionService
{
CuratorEntry entry = getEntry(projection);
- LeaderLatch leaderLatch = getThis(entry, leaderProjection.projection.id, LeaderLatch.class);
+ LeaderLatch leaderLatch = getThing(entry, leaderProjection.projection.id, LeaderLatch.class);
return leaderLatch.hasLeadership();
}
@@ -416,6 +409,35 @@ public class CuratorProjectionService
return new PathChildrenCacheProjection(new GenericProjection(id));
}
+ @ThriftMethod
+ public List<RpcChildData> getPathChildrenCacheData(CuratorProjection projection, PathChildrenCacheProjection cacheProjection) throws Exception
+ {
+ CuratorEntry entry = getEntry(projection);
+
+ PathChildrenCache pathChildrenCache = getThing(entry, cacheProjection.projection.id, PathChildrenCache.class);
+ return Lists.transform
+ (
+ pathChildrenCache.getCurrentData(),
+ new Function<ChildData, RpcChildData>()
+ {
+ @Override
+ public RpcChildData apply(ChildData childData)
+ {
+ return new RpcChildData(childData);
+ }
+ }
+ );
+ }
+
+ @ThriftMethod
+ public RpcChildData getPathChildrenCacheDataForPath(CuratorProjection projection, PathChildrenCacheProjection cacheProjection, String path) throws Exception
+ {
+ CuratorEntry entry = getEntry(projection);
+
+ PathChildrenCache pathChildrenCache = getThing(entry, cacheProjection.projection.id, PathChildrenCache.class);
+ return new RpcChildData(pathChildrenCache.getCurrentData(path));
+ }
+
public void addEvent(CuratorProjection projection, RpcCuratorEvent event)
{
CuratorEntry entry = connectionManager.get(projection.id);
@@ -444,7 +466,7 @@ public class CuratorProjectionService
throw new Exception("That operation is not available");
}
- private <T> T getThis(CuratorEntry entry, String id, Class<T> clazz)
+ private <T> T getThing(CuratorEntry entry, String id, Class<T> clazz)
{
T thing = entry.getThing(id, clazz);
Preconditions.checkNotNull(thing, "No item of type " + clazz.getSimpleName() + " found with id " + id);
http://git-wip-us.apache.org/repos/asf/curator/blob/6f9a9ab4/curator-x-rpc/src/main/thrift/curator.thrift
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/thrift/curator.thrift b/curator-x-rpc/src/main/thrift/curator.thrift
index 765b93c..2b5e115 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -188,6 +188,8 @@ service CuratorService {
OptionalChildrenList getChildren(1: CuratorProjection projection, 2: GetChildrenSpec spec);
binary getData(1: CuratorProjection projection, 2: GetDataSpec spec);
list<Participant> getLeaderParticipants(1: CuratorProjection projection, 2: LeaderProjection leaderProjection);
+ list<ChildData> getPathChildrenCacheData(1: CuratorProjection projection, 2: PathChildrenCacheProjection cacheProjection);
+ ChildData getPathChildrenCacheDataForPath(1: CuratorProjection projection, 2: PathChildrenCacheProjection cacheProjection, 3: string path);
bool isLeader(1: CuratorProjection projection, 2: LeaderProjection leaderProjection);
CuratorProjection newCuratorProjection(1: string connectionName);
Stat setData(1: CuratorProjection projection, 2: SetDataSpec spec);