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 18:29:33 UTC

git commit: Thrift doesn't support null method returns. Wrap with Optionals

Repository: curator
Updated Branches:
  refs/heads/curator-rpc c90430089 -> 6db42c8f6


Thrift doesn't support null method returns. Wrap with Optionals


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/6db42c8f
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/6db42c8f
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/6db42c8f

Branch: refs/heads/curator-rpc
Commit: 6db42c8f66f503905d6c60da6b8d63eb818c24e3
Parents: c904300
Author: randgalt <ra...@apache.org>
Authored: Thu May 29 11:29:24 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 29 11:29:24 2014 -0500

----------------------------------------------------------------------
 .../curator/x/rpc/idl/event/OptionalPath.java   |  20 +
 .../x/rpc/idl/event/OptionalRpcStat.java        |  38 +
 .../projection/CuratorProjectionService.java    |  28 +-
 .../x/rpc/idl/projection/ExistsSpec.java        |  46 +
 curator-x-rpc/src/main/thrift/curator.thrift    |  11 +
 .../curator/generated/CuratorService.java       | 959 +++++++++++++++++++
 .../apache/curator/generated/ExistsSpec.java    | 586 +++++++++++
 .../apache/curator/generated/OptionalStat.java  | 393 ++++++++
 .../org/apache/curator/x/rpc/TestClient.java    |   7 +
 9 files changed, 2086 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/6db42c8f/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
new file mode 100644
index 0000000..947dd75
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalPath.java
@@ -0,0 +1,20 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct
+public class OptionalPath
+{
+    @ThriftField(1)
+    public String path;
+
+    public OptionalPath()
+    {
+    }
+
+    public OptionalPath(String path)
+    {
+        this.path = path;
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/6db42c8f/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalRpcStat.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalRpcStat.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalRpcStat.java
new file mode 100644
index 0000000..5db40ce
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalRpcStat.java
@@ -0,0 +1,38 @@
+/**
+ * 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.event;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct("OptionalStat")
+public class OptionalRpcStat
+{
+    @ThriftField(1)
+    public RpcStat stat;
+
+    public OptionalRpcStat()
+    {
+    }
+
+    public OptionalRpcStat(RpcStat stat)
+    {
+        this.stat = stat;
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/6db42c8f/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 321e4b4..c2a8c94 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
@@ -31,6 +31,8 @@ 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.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.RpcStat;
 import org.apache.zookeeper.data.Stat;
@@ -84,7 +86,7 @@ public class CuratorProjectionService
     }
 
     @ThriftMethod
-    public String createNode(CuratorProjection projection, CreateSpec spec) throws Exception
+    public OptionalPath createNode(CuratorProjection projection, CreateSpec spec) throws Exception
     {
         CuratorFramework client = getEntry(projection).getClient();
 
@@ -112,7 +114,8 @@ public class CuratorProjectionService
             builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback, spec.asyncContext);
         }
 
-        return String.valueOf(castBuilder(builder, PathAndBytesable.class).forPath(spec.path, spec.data));
+        Object path = castBuilder(builder, PathAndBytesable.class).forPath(spec.path, spec.data);
+        return new OptionalPath((path != null) ? String.valueOf(path) : null);
     }
 
     @ThriftMethod
@@ -198,6 +201,27 @@ public class CuratorProjectionService
     }
 
     @ThriftMethod
+    public OptionalRpcStat exists(CuratorProjection projection, ExistsSpec spec) throws Exception
+    {
+        CuratorFramework client = getEntry(projection).getClient();
+
+        Object builder = client.checkExists();
+        if ( spec.watched )
+        {
+            builder = castBuilder(builder, Watchable.class).usingWatcher(new RpcWatcher(this, projection));
+        }
+
+        if ( spec.asyncContext != null )
+        {
+            BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
+            castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
+        }
+
+        Stat stat = (Stat)castBuilder(builder, Pathable.class).forPath(spec.path);
+        return new OptionalRpcStat((stat != null) ? RpcCuratorEvent.toRpcStat(stat) : null);
+    }
+
+    @ThriftMethod
     public boolean closeGenericProjection(CuratorProjection curatorProjection, GenericProjection genericProjection) throws Exception
     {
         CuratorEntry entry = getEntry(curatorProjection);

http://git-wip-us.apache.org/repos/asf/curator/blob/6db42c8f/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/ExistsSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/ExistsSpec.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/ExistsSpec.java
new file mode 100644
index 0000000..dff67e4
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/ExistsSpec.java
@@ -0,0 +1,46 @@
+/**
+ * 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.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct
+public class ExistsSpec
+{
+    @ThriftField(1)
+    public String path;
+
+    @ThriftField(2)
+    public boolean watched;
+
+    @ThriftField(3)
+    public String asyncContext;
+
+    public ExistsSpec()
+    {
+    }
+
+    public ExistsSpec(String path, boolean watched, String asyncContext)
+    {
+        this.path = path;
+        this.watched = watched;
+        this.asyncContext = asyncContext;
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/6db42c8f/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 82b8d42..a078568 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -33,6 +33,12 @@ struct CuratorProjection {
   1: string id;
 }
 
+struct ExistsSpec {
+  1: string path;
+  2: bool watched;
+  3: string asyncContext;
+}
+
 struct GenericProjection {
   1: string id;
 }
@@ -90,6 +96,10 @@ struct SetDataSpec {
   6: binary data;
 }
 
+struct OptionalStat {
+  1: Stat stat;
+}
+
 struct Acl {
   1: i32 perms;
   2: id id;
@@ -114,6 +124,7 @@ service CuratorService {
   bool closeGenericProjection(1: CuratorProjection curatorProjection, 2: GenericProjection genericProjection);
   string createNode(1: CuratorProjection projection, 2: CreateSpec spec);
   void deleteNode(1: CuratorProjection projection, 2: DeleteSpec spec);
+  OptionalStat exists(1: CuratorProjection projection, 2: ExistsSpec spec);
   binary getData(1: CuratorProjection projection, 2: GetDataSpec spec);
   CuratorProjection newCuratorProjection(1: string connectionName);
   Stat setData(1: CuratorProjection projection, 2: SetDataSpec spec);

http://git-wip-us.apache.org/repos/asf/curator/blob/6db42c8f/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 57cd2f1..b0f8031 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
@@ -46,6 +46,8 @@ public class CuratorService {
 
     public void deleteNode(CuratorProjection projection, DeleteSpec spec) throws org.apache.thrift.TException;
 
+    public OptionalStat exists(CuratorProjection projection, ExistsSpec spec) throws org.apache.thrift.TException;
+
     public ByteBuffer getData(CuratorProjection projection, GetDataSpec spec) throws org.apache.thrift.TException;
 
     public CuratorProjection newCuratorProjection(String connectionName) throws org.apache.thrift.TException;
@@ -66,6 +68,8 @@ public class CuratorService {
 
     public void deleteNode(CuratorProjection projection, DeleteSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
 
+    public void exists(CuratorProjection projection, ExistsSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
     public void getData(CuratorProjection projection, GetDataSpec spec, 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;
@@ -208,6 +212,30 @@ public class CuratorService {
       return;
     }
 
+    public OptionalStat exists(CuratorProjection projection, ExistsSpec spec) throws org.apache.thrift.TException
+    {
+      send_exists(projection, spec);
+      return recv_exists();
+    }
+
+    public void send_exists(CuratorProjection projection, ExistsSpec spec) throws org.apache.thrift.TException
+    {
+      exists_args args = new exists_args();
+      args.setProjection(projection);
+      args.setSpec(spec);
+      sendBase("exists", args);
+    }
+
+    public OptionalStat recv_exists() throws org.apache.thrift.TException
+    {
+      exists_result result = new exists_result();
+      receiveBase(result, "exists");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "exists failed: unknown result");
+    }
+
     public ByteBuffer getData(CuratorProjection projection, GetDataSpec spec) throws org.apache.thrift.TException
     {
       send_getData(projection, spec);
@@ -472,6 +500,41 @@ public class CuratorService {
       }
     }
 
+    public void exists(CuratorProjection projection, ExistsSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      exists_call method_call = new exists_call(projection, spec, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class exists_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private CuratorProjection projection;
+      private ExistsSpec spec;
+      public exists_call(CuratorProjection projection, ExistsSpec spec, 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.spec = spec;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("exists", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        exists_args args = new exists_args();
+        args.setProjection(projection);
+        args.setSpec(spec);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public OptionalStat 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_exists();
+      }
+    }
+
     public void getData(CuratorProjection projection, GetDataSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
       checkReady();
       getData_call method_call = new getData_call(projection, spec, resultHandler, this, ___protocolFactory, ___transport);
@@ -592,6 +655,7 @@ public class CuratorService {
       processMap.put("closeGenericProjection", new closeGenericProjection());
       processMap.put("createNode", new createNode());
       processMap.put("deleteNode", new deleteNode());
+      processMap.put("exists", new exists());
       processMap.put("getData", new getData());
       processMap.put("newCuratorProjection", new newCuratorProjection());
       processMap.put("setData", new setData());
@@ -699,6 +763,26 @@ public class CuratorService {
       }
     }
 
+    public static class exists<I extends Iface> extends org.apache.thrift.ProcessFunction<I, exists_args> {
+      public exists() {
+        super("exists");
+      }
+
+      public exists_args getEmptyArgsInstance() {
+        return new exists_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public exists_result getResult(I iface, exists_args args) throws org.apache.thrift.TException {
+        exists_result result = new exists_result();
+        result.success = iface.exists(args.projection, args.spec);
+        return result;
+      }
+    }
+
     public static class getData<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getData_args> {
       public getData() {
         super("getData");
@@ -777,6 +861,7 @@ public class CuratorService {
       processMap.put("closeGenericProjection", new closeGenericProjection());
       processMap.put("createNode", new createNode());
       processMap.put("deleteNode", new deleteNode());
+      processMap.put("exists", new exists());
       processMap.put("getData", new getData());
       processMap.put("newCuratorProjection", new newCuratorProjection());
       processMap.put("setData", new setData());
@@ -1037,6 +1122,57 @@ public class CuratorService {
       }
     }
 
+    public static class exists<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, exists_args, OptionalStat> {
+      public exists() {
+        super("exists");
+      }
+
+      public exists_args getEmptyArgsInstance() {
+        return new exists_args();
+      }
+
+      public AsyncMethodCallback<OptionalStat> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<OptionalStat>() { 
+          public void onComplete(OptionalStat o) {
+            exists_result result = new exists_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;
+            exists_result result = new exists_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, exists_args args, org.apache.thrift.async.AsyncMethodCallback<OptionalStat> resultHandler) throws TException {
+        iface.exists(args.projection, args.spec,resultHandler);
+      }
+    }
+
     public static class getData<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getData_args, ByteBuffer> {
       public getData() {
         super("getData");
@@ -5059,6 +5195,829 @@ public class CuratorService {
 
   }
 
+  public static class exists_args implements org.apache.thrift.TBase<exists_args, exists_args._Fields>, java.io.Serializable, Cloneable, Comparable<exists_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("exists_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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new exists_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new exists_argsTupleSchemeFactory());
+    }
+
+    public CuratorProjection projection; // required
+    public ExistsSpec spec; // 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");
+
+      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: // SPEC
+            return SPEC;
+          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.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, ExistsSpec.class)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(exists_args.class, metaDataMap);
+    }
+
+    public exists_args() {
+    }
+
+    public exists_args(
+      CuratorProjection projection,
+      ExistsSpec spec)
+    {
+      this();
+      this.projection = projection;
+      this.spec = spec;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public exists_args(exists_args other) {
+      if (other.isSetProjection()) {
+        this.projection = new CuratorProjection(other.projection);
+      }
+      if (other.isSetSpec()) {
+        this.spec = new ExistsSpec(other.spec);
+      }
+    }
+
+    public exists_args deepCopy() {
+      return new exists_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.projection = null;
+      this.spec = null;
+    }
+
+    public CuratorProjection getProjection() {
+      return this.projection;
+    }
+
+    public exists_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 ExistsSpec getSpec() {
+      return this.spec;
+    }
+
+    public exists_args setSpec(ExistsSpec spec) {
+      this.spec = spec;
+      return this;
+    }
+
+    public void unsetSpec() {
+      this.spec = null;
+    }
+
+    /** Returns true if field spec is set (has been assigned a value) and false otherwise */
+    public boolean isSetSpec() {
+      return this.spec != null;
+    }
+
+    public void setSpecIsSet(boolean value) {
+      if (!value) {
+        this.spec = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case PROJECTION:
+        if (value == null) {
+          unsetProjection();
+        } else {
+          setProjection((CuratorProjection)value);
+        }
+        break;
+
+      case SPEC:
+        if (value == null) {
+          unsetSpec();
+        } else {
+          setSpec((ExistsSpec)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case PROJECTION:
+        return getProjection();
+
+      case SPEC:
+        return getSpec();
+
+      }
+      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 SPEC:
+        return isSetSpec();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof exists_args)
+        return this.equals((exists_args)that);
+      return false;
+    }
+
+    public boolean equals(exists_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_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))
+          return false;
+        if (!this.spec.equals(that.spec))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(exists_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(isSetSpec()).compareTo(other.isSetSpec());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSpec()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.spec, other.spec);
+        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("exists_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("spec:");
+      if (this.spec == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.spec);
+      }
+      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 (spec != null) {
+        spec.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 exists_argsStandardSchemeFactory implements SchemeFactory {
+      public exists_argsStandardScheme getScheme() {
+        return new exists_argsStandardScheme();
+      }
+    }
+
+    private static class exists_argsStandardScheme extends StandardScheme<exists_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, exists_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: // SPEC
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.spec = new ExistsSpec();
+                struct.spec.read(iprot);
+                struct.setSpecIsSet(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, exists_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.spec != null) {
+          oprot.writeFieldBegin(SPEC_FIELD_DESC);
+          struct.spec.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class exists_argsTupleSchemeFactory implements SchemeFactory {
+      public exists_argsTupleScheme getScheme() {
+        return new exists_argsTupleScheme();
+      }
+    }
+
+    private static class exists_argsTupleScheme extends TupleScheme<exists_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, exists_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetProjection()) {
+          optionals.set(0);
+        }
+        if (struct.isSetSpec()) {
+          optionals.set(1);
+        }
+        oprot.writeBitSet(optionals, 2);
+        if (struct.isSetProjection()) {
+          struct.projection.write(oprot);
+        }
+        if (struct.isSetSpec()) {
+          struct.spec.write(oprot);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, exists_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.spec = new ExistsSpec();
+          struct.spec.read(iprot);
+          struct.setSpecIsSet(true);
+        }
+      }
+    }
+
+  }
+
+  public static class exists_result implements org.apache.thrift.TBase<exists_result, exists_result._Fields>, java.io.Serializable, Cloneable, Comparable<exists_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("exists_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 exists_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new exists_resultTupleSchemeFactory());
+    }
+
+    public OptionalStat 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, OptionalStat.class)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(exists_result.class, metaDataMap);
+    }
+
+    public exists_result() {
+    }
+
+    public exists_result(
+      OptionalStat success)
+    {
+      this();
+      this.success = success;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public exists_result(exists_result other) {
+      if (other.isSetSuccess()) {
+        this.success = new OptionalStat(other.success);
+      }
+    }
+
+    public exists_result deepCopy() {
+      return new exists_result(this);
+    }
+
+    @Override
+    public void clear() {
+      this.success = null;
+    }
+
+    public OptionalStat getSuccess() {
+      return this.success;
+    }
+
+    public exists_result setSuccess(OptionalStat 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((OptionalStat)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 exists_result)
+        return this.equals((exists_result)that);
+      return false;
+    }
+
+    public boolean equals(exists_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(exists_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("exists_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 exists_resultStandardSchemeFactory implements SchemeFactory {
+      public exists_resultStandardScheme getScheme() {
+        return new exists_resultStandardScheme();
+      }
+    }
+
+    private static class exists_resultStandardScheme extends StandardScheme<exists_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, exists_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 OptionalStat();
+                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, exists_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 exists_resultTupleSchemeFactory implements SchemeFactory {
+      public exists_resultTupleScheme getScheme() {
+        return new exists_resultTupleScheme();
+      }
+    }
+
+    private static class exists_resultTupleScheme extends TupleScheme<exists_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, exists_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, exists_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          struct.success = new OptionalStat();
+          struct.success.read(iprot);
+          struct.setSuccessIsSet(true);
+        }
+      }
+    }
+
+  }
+
   public static class getData_args implements org.apache.thrift.TBase<getData_args, getData_args._Fields>, java.io.Serializable, Cloneable, Comparable<getData_args>   {
     private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getData_args");
 

http://git-wip-us.apache.org/repos/asf/curator/blob/6db42c8f/curator-x-rpc/src/test/java/org/apache/curator/generated/ExistsSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/ExistsSpec.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/ExistsSpec.java
new file mode 100644
index 0000000..e06749e
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/ExistsSpec.java
@@ -0,0 +1,586 @@
+/**
+ * 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 ExistsSpec implements org.apache.thrift.TBase<ExistsSpec, ExistsSpec._Fields>, java.io.Serializable, Cloneable, Comparable<ExistsSpec> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ExistsSpec");
+
+  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 WATCHED_FIELD_DESC = new org.apache.thrift.protocol.TField("watched", org.apache.thrift.protocol.TType.BOOL, (short)2);
+  private static final org.apache.thrift.protocol.TField ASYNC_CONTEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("asyncContext", 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 ExistsSpecStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new ExistsSpecTupleSchemeFactory());
+  }
+
+  public String path; // required
+  public boolean watched; // required
+  public String asyncContext; // 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"),
+    WATCHED((short)2, "watched"),
+    ASYNC_CONTEXT((short)3, "asyncContext");
+
+    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: // WATCHED
+          return WATCHED;
+        case 3: // ASYNC_CONTEXT
+          return ASYNC_CONTEXT;
+        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 __WATCHED_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.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.WATCHED, new org.apache.thrift.meta_data.FieldMetaData("watched", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+    tmpMap.put(_Fields.ASYNC_CONTEXT, new org.apache.thrift.meta_data.FieldMetaData("asyncContext", 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(ExistsSpec.class, metaDataMap);
+  }
+
+  public ExistsSpec() {
+  }
+
+  public ExistsSpec(
+    String path,
+    boolean watched,
+    String asyncContext)
+  {
+    this();
+    this.path = path;
+    this.watched = watched;
+    setWatchedIsSet(true);
+    this.asyncContext = asyncContext;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public ExistsSpec(ExistsSpec other) {
+    __isset_bitfield = other.__isset_bitfield;
+    if (other.isSetPath()) {
+      this.path = other.path;
+    }
+    this.watched = other.watched;
+    if (other.isSetAsyncContext()) {
+      this.asyncContext = other.asyncContext;
+    }
+  }
+
+  public ExistsSpec deepCopy() {
+    return new ExistsSpec(this);
+  }
+
+  @Override
+  public void clear() {
+    this.path = null;
+    setWatchedIsSet(false);
+    this.watched = false;
+    this.asyncContext = null;
+  }
+
+  public String getPath() {
+    return this.path;
+  }
+
+  public ExistsSpec 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 boolean isWatched() {
+    return this.watched;
+  }
+
+  public ExistsSpec setWatched(boolean watched) {
+    this.watched = watched;
+    setWatchedIsSet(true);
+    return this;
+  }
+
+  public void unsetWatched() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WATCHED_ISSET_ID);
+  }
+
+  /** Returns true if field watched is set (has been assigned a value) and false otherwise */
+  public boolean isSetWatched() {
+    return EncodingUtils.testBit(__isset_bitfield, __WATCHED_ISSET_ID);
+  }
+
+  public void setWatchedIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WATCHED_ISSET_ID, value);
+  }
+
+  public String getAsyncContext() {
+    return this.asyncContext;
+  }
+
+  public ExistsSpec setAsyncContext(String asyncContext) {
+    this.asyncContext = asyncContext;
+    return this;
+  }
+
+  public void unsetAsyncContext() {
+    this.asyncContext = null;
+  }
+
+  /** Returns true if field asyncContext is set (has been assigned a value) and false otherwise */
+  public boolean isSetAsyncContext() {
+    return this.asyncContext != null;
+  }
+
+  public void setAsyncContextIsSet(boolean value) {
+    if (!value) {
+      this.asyncContext = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case PATH:
+      if (value == null) {
+        unsetPath();
+      } else {
+        setPath((String)value);
+      }
+      break;
+
+    case WATCHED:
+      if (value == null) {
+        unsetWatched();
+      } else {
+        setWatched((Boolean)value);
+      }
+      break;
+
+    case ASYNC_CONTEXT:
+      if (value == null) {
+        unsetAsyncContext();
+      } else {
+        setAsyncContext((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case PATH:
+      return getPath();
+
+    case WATCHED:
+      return Boolean.valueOf(isWatched());
+
+    case ASYNC_CONTEXT:
+      return getAsyncContext();
+
+    }
+    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 WATCHED:
+      return isSetWatched();
+    case ASYNC_CONTEXT:
+      return isSetAsyncContext();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof ExistsSpec)
+      return this.equals((ExistsSpec)that);
+    return false;
+  }
+
+  public boolean equals(ExistsSpec 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_watched = true;
+    boolean that_present_watched = true;
+    if (this_present_watched || that_present_watched) {
+      if (!(this_present_watched && that_present_watched))
+        return false;
+      if (this.watched != that.watched)
+        return false;
+    }
+
+    boolean this_present_asyncContext = true && this.isSetAsyncContext();
+    boolean that_present_asyncContext = true && that.isSetAsyncContext();
+    if (this_present_asyncContext || that_present_asyncContext) {
+      if (!(this_present_asyncContext && that_present_asyncContext))
+        return false;
+      if (!this.asyncContext.equals(that.asyncContext))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(ExistsSpec 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(isSetWatched()).compareTo(other.isSetWatched());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetWatched()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.watched, other.watched);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetAsyncContext()).compareTo(other.isSetAsyncContext());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetAsyncContext()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.asyncContext, other.asyncContext);
+      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("ExistsSpec(");
+    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("watched:");
+    sb.append(this.watched);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("asyncContext:");
+    if (this.asyncContext == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.asyncContext);
+    }
+    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 ExistsSpecStandardSchemeFactory implements SchemeFactory {
+    public ExistsSpecStandardScheme getScheme() {
+      return new ExistsSpecStandardScheme();
+    }
+  }
+
+  private static class ExistsSpecStandardScheme extends StandardScheme<ExistsSpec> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, ExistsSpec 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: // WATCHED
+            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+              struct.watched = iprot.readBool();
+              struct.setWatchedIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // ASYNC_CONTEXT
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.asyncContext = iprot.readString();
+              struct.setAsyncContextIsSet(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, ExistsSpec 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();
+      }
+      oprot.writeFieldBegin(WATCHED_FIELD_DESC);
+      oprot.writeBool(struct.watched);
+      oprot.writeFieldEnd();
+      if (struct.asyncContext != null) {
+        oprot.writeFieldBegin(ASYNC_CONTEXT_FIELD_DESC);
+        oprot.writeString(struct.asyncContext);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class ExistsSpecTupleSchemeFactory implements SchemeFactory {
+    public ExistsSpecTupleScheme getScheme() {
+      return new ExistsSpecTupleScheme();
+    }
+  }
+
+  private static class ExistsSpecTupleScheme extends TupleScheme<ExistsSpec> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, ExistsSpec struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetPath()) {
+        optionals.set(0);
+      }
+      if (struct.isSetWatched()) {
+        optionals.set(1);
+      }
+      if (struct.isSetAsyncContext()) {
+        optionals.set(2);
+      }
+      oprot.writeBitSet(optionals, 3);
+      if (struct.isSetPath()) {
+        oprot.writeString(struct.path);
+      }
+      if (struct.isSetWatched()) {
+        oprot.writeBool(struct.watched);
+      }
+      if (struct.isSetAsyncContext()) {
+        oprot.writeString(struct.asyncContext);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, ExistsSpec 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.watched = iprot.readBool();
+        struct.setWatchedIsSet(true);
+      }
+      if (incoming.get(2)) {
+        struct.asyncContext = iprot.readString();
+        struct.setAsyncContextIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/curator/blob/6db42c8f/curator-x-rpc/src/test/java/org/apache/curator/generated/OptionalStat.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/OptionalStat.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/OptionalStat.java
new file mode 100644
index 0000000..c06929a
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/OptionalStat.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 OptionalStat implements org.apache.thrift.TBase<OptionalStat, OptionalStat._Fields>, java.io.Serializable, Cloneable, Comparable<OptionalStat> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("OptionalStat");
+
+  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)1);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new OptionalStatStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new OptionalStatTupleSchemeFactory());
+  }
+
+  public Stat stat; // 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 {
+    STAT((short)1, "stat");
+
+    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: // STAT
+          return STAT;
+        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.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)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(OptionalStat.class, metaDataMap);
+  }
+
+  public OptionalStat() {
+  }
+
+  public OptionalStat(
+    Stat stat)
+  {
+    this();
+    this.stat = stat;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public OptionalStat(OptionalStat other) {
+    if (other.isSetStat()) {
+      this.stat = new Stat(other.stat);
+    }
+  }
+
+  public OptionalStat deepCopy() {
+    return new OptionalStat(this);
+  }
+
+  @Override
+  public void clear() {
+    this.stat = null;
+  }
+
+  public Stat getStat() {
+    return this.stat;
+  }
+
+  public OptionalStat 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 void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case STAT:
+      if (value == null) {
+        unsetStat();
+      } else {
+        setStat((Stat)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case STAT:
+      return getStat();
+
+    }
+    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 STAT:
+      return isSetStat();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof OptionalStat)
+      return this.equals((OptionalStat)that);
+    return false;
+  }
+
+  public boolean equals(OptionalStat that) {
+    if (that == null)
+      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;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(OptionalStat other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    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;
+      }
+    }
+    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("OptionalStat(");
+    boolean first = true;
+
+    sb.append("stat:");
+    if (this.stat == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.stat);
+    }
+    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 OptionalStatStandardSchemeFactory implements SchemeFactory {
+    public OptionalStatStandardScheme getScheme() {
+      return new OptionalStatStandardScheme();
+    }
+  }
+
+  private static class OptionalStatStandardScheme extends StandardScheme<OptionalStat> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, OptionalStat 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: // 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;
+          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, OptionalStat struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.stat != null) {
+        oprot.writeFieldBegin(STAT_FIELD_DESC);
+        struct.stat.write(oprot);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class OptionalStatTupleSchemeFactory implements SchemeFactory {
+    public OptionalStatTupleScheme getScheme() {
+      return new OptionalStatTupleScheme();
+    }
+  }
+
+  private static class OptionalStatTupleScheme extends TupleScheme<OptionalStat> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, OptionalStat struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetStat()) {
+        optionals.set(0);
+      }
+      oprot.writeBitSet(optionals, 1);
+      if (struct.isSetStat()) {
+        struct.stat.write(oprot);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, OptionalStat struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(1);
+      if (incoming.get(0)) {
+        struct.stat = new Stat();
+        struct.stat.read(iprot);
+        struct.setStatIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/curator/blob/6db42c8f/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 fd3b0fb..a2291e7 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
@@ -24,6 +24,7 @@ import org.apache.curator.generated.CuratorProjection;
 import org.apache.curator.generated.CuratorService;
 import org.apache.curator.generated.DeleteSpec;
 import org.apache.curator.generated.EventService;
+import org.apache.curator.generated.ExistsSpec;
 import org.apache.curator.generated.GenericProjection;
 import org.apache.curator.generated.GetDataSpec;
 import org.apache.curator.test.TestingServer;
@@ -93,8 +94,14 @@ public class TestClient
         ByteBuffer data = client.getData(curatorProjection, getDataSpec);
         System.out.println("getData: " + new String(data.array()));
 
+        ExistsSpec existsSpec = new ExistsSpec();
+        existsSpec.path = "/a/b/c";
+        System.out.println("exists: " + client.exists(curatorProjection, existsSpec));
+
         DeleteSpec deleteSpec = new DeleteSpec();
         deleteSpec.path = "/a/b/c";
         client.deleteNode(curatorProjection, deleteSpec);
+
+        System.out.println("exists: " + client.exists(curatorProjection, existsSpec));
     }
 }