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/27 15:57:23 UTC

[01/14] git commit: wip

Repository: curator
Updated Branches:
  refs/heads/curator-rpc [created] abf5fddae


wip


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

Branch: refs/heads/curator-rpc
Commit: b949f57b49600f53aa63d1f9fdad8a71e7d7a4df
Parents: cab78e6
Author: randgalt <ra...@apache.org>
Authored: Sun May 25 23:04:50 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Sun May 25 23:04:50 2014 -0500

----------------------------------------------------------------------
 curator-x-rpc/pom.xml                           | 24 +++++++++++++
 .../curator/x/rpc/CuratorProjectionServer.java  | 20 +++++++++++
 .../curator/x/rpc/idl/CuratorProjection.java    | 23 +++++++++++++
 .../x/rpc/idl/CuratorProjectionService.java     | 36 ++++++++++++++++++++
 .../x/rpc/idl/CuratorProjectionSpec.java        |  8 +++++
 curator-x-rpc/src/main/scripts/generate.sh      | 25 ++++++++++++++
 curator-x-rpc/src/main/thrift/curator.thrift    | 16 +++++++++
 pom.xml                                         | 14 ++++++++
 8 files changed, 166 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/b949f57b/curator-x-rpc/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-rpc/pom.xml b/curator-x-rpc/pom.xml
new file mode 100644
index 0000000..42de982
--- /dev/null
+++ b/curator-x-rpc/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>apache-curator</artifactId>
+        <groupId>org.apache.curator</groupId>
+        <version>2.5.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>curator-x-rpc</artifactId>
+    <version>2.5.1-SNAPSHOT</version>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.facebook.swift</groupId>
+            <artifactId>swift-service</artifactId>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/curator/blob/b949f57b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
new file mode 100644
index 0000000..22a5e3a
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
@@ -0,0 +1,20 @@
+package org.apache.curator.x.rpc;
+
+import com.facebook.swift.codec.ThriftCodecManager;
+import com.facebook.swift.service.ThriftEventHandler;
+import com.facebook.swift.service.ThriftServer;
+import com.facebook.swift.service.ThriftServerConfig;
+import com.facebook.swift.service.ThriftServiceProcessor;
+import com.google.common.collect.Lists;
+import org.apache.curator.x.rpc.idl.CuratorProjectionService;
+
+public class CuratorProjectionServer
+{
+    public static void main(String[] args)
+    {
+        CuratorProjectionService projectionService = new CuratorProjectionService();
+        ThriftServiceProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), Lists.<ThriftEventHandler>newArrayList(), projectionService);
+        ThriftServer server = new ThriftServer(processor, new ThriftServerConfig().setPort(8899));  // TODO
+        server.start();
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/b949f57b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjection.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjection.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjection.java
new file mode 100644
index 0000000..85864c5
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjection.java
@@ -0,0 +1,23 @@
+package org.apache.curator.x.rpc.idl;
+
+import com.facebook.swift.codec.ThriftConstructor;
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct
+public class CuratorProjection
+{
+    private final String id;
+
+    @ThriftConstructor
+    public CuratorProjection(String id)
+    {
+        this.id = id;
+    }
+
+    @ThriftField(1)
+    public String getId()
+    {
+        return id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/b949f57b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionService.java
new file mode 100644
index 0000000..dd5bf33
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionService.java
@@ -0,0 +1,36 @@
+package org.apache.curator.x.rpc.idl;
+
+import com.facebook.swift.service.ThriftMethod;
+import com.facebook.swift.service.ThriftService;
+import com.google.common.collect.Maps;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.retry.RetryOneTime;
+import java.util.Map;
+import java.util.UUID;
+
+@ThriftService("curator")
+public class CuratorProjectionService
+{
+    private final Map<String, CuratorFramework> projections = Maps.newConcurrentMap();
+
+    @ThriftMethod
+    public CuratorProjection newCuratorProjection(CuratorProjectionSpec spec)
+    {
+        CuratorFramework client = CuratorFrameworkFactory.newClient("localhost:2181", new RetryOneTime(1));
+        String id = UUID.randomUUID().toString();
+        client.start();
+        projections.put(id, client);
+        return new CuratorProjection(id);
+    }
+
+    @ThriftMethod
+    public void closeCuratorProjection(CuratorProjection projection)
+    {
+        CuratorFramework client = projections.remove(projection.getId());
+        if ( client != null )
+        {
+            client.close();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/b949f57b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionSpec.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionSpec.java
new file mode 100644
index 0000000..cf45632
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionSpec.java
@@ -0,0 +1,8 @@
+package org.apache.curator.x.rpc.idl;
+
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct
+public class CuratorProjectionSpec
+{
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/b949f57b/curator-x-rpc/src/main/scripts/generate.sh
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/scripts/generate.sh b/curator-x-rpc/src/main/scripts/generate.sh
new file mode 100755
index 0000000..ae3d575
--- /dev/null
+++ b/curator-x-rpc/src/main/scripts/generate.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+if (( $# != 1 )); then
+    echo "missing argument: path to swift2thrift-generator-cli-N.N.N-standalone.jar"
+    exit
+fi
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+BASE_DIR="$( cd "$DIR/../../../.." && pwd )"
+
+RPC_PATH="$BASE_DIR/curator-x-rpc/target/classes"
+CLASSES=""
+for f in `ls -m1 $RPC_PATH/org/apache/curator/x/rpc/idl/*.class | xargs -n 1 basename | sed s/\.[^\.]*$//`; do CLASSES="$CLASSES $f"; done;
+
+THRIFT_DIR="$BASE_DIR/curator-x-rpc/src/main/thrift"
+
+PATHS="$1"
+PATHS="$PATHS:$BASE_DIR/curator-client/target/classes"
+PATHS="$PATHS:$BASE_DIR/curator-framework/target/classes"
+PATHS="$PATHS:$BASE_DIR/curator-recipes/target/classes"
+PATHS="$PATHS:$RPC_PATH"
+
+PACKAGE="org.apache.curator.x.rpc.idl"
+
+java -cp $PATHS com.facebook.swift.generator.swift2thrift.Main -namespace cpp org.apache.curator -out "$THRIFT_DIR/curator.thrift" -package $PACKAGE $CLASSES

http://git-wip-us.apache.org/repos/asf/curator/blob/b949f57b/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
new file mode 100644
index 0000000..754002f
--- /dev/null
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -0,0 +1,16 @@
+namespace java.swift org.apache.curator.x.rpc.idl
+namespace cpp org.apache.curator
+
+
+
+struct CuratorProjection {
+  1: string id;
+}
+
+struct CuratorProjectionSpec {
+}
+
+service curator {
+  void closeCuratorProjection(1: CuratorProjection projection);
+  CuratorProjection newCuratorProjection(1: CuratorProjectionSpec spec);
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/b949f57b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 78dd849..d9675c7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -84,6 +84,7 @@
         <zookeeper-version>3.4.6</zookeeper-version>
         <guava-version>16.0.1</guava-version>
         <testng-version>6.8.8</testng-version>
+        <swift-version>0.12.0</swift-version>
 
         <!-- OSGi Properties -->
         <osgi.export.package />
@@ -253,6 +254,7 @@
         <module>curator-examples</module>
         <module>curator-x-discovery</module>
         <module>curator-x-discovery-server</module>
+        <module>curator-x-rpc</module>
     </modules>
 
     <dependencyManagement>
@@ -412,6 +414,18 @@
                 <artifactId>testng</artifactId>
                 <version>${testng-version}</version>
             </dependency>
+
+            <dependency>
+                <groupId>com.facebook.swift</groupId>
+                <artifactId>swift-codec</artifactId>
+                <version>${swift-version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.facebook.swift</groupId>
+                <artifactId>swift-service</artifactId>
+                <version>${swift-version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 


[12/14] git commit: wip

Posted by ra...@apache.org.
wip


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

Branch: refs/heads/curator-rpc
Commit: c8d49ae877c0ea95302c1339563293f31c1fd5db
Parents: 7c99ddb
Author: randgalt <ra...@apache.org>
Authored: Mon May 26 18:02:05 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon May 26 18:02:05 2014 -0500

----------------------------------------------------------------------
 curator-x-rpc/pom.xml                           |   6 +
 .../curator/x/rpc/CuratorProjectionServer.java  |   5 +-
 .../org/apache/curator/x/rpc/RpcManager.java    |   9 +
 .../curator/x/rpc/idl/event/EventService.java   |  36 +++-
 .../x/rpc/idl/event/RpcCuratorEvent.java        |  60 +++++-
 .../x/rpc/idl/event/RpcCuratorEventType.java    |   8 +-
 .../x/rpc/idl/projection/CreateSpec.java        |   4 +-
 .../projection/CuratorProjectionService.java    |  29 ++-
 curator-x-rpc/src/main/thrift/curator.thrift    |   6 +-
 .../apache/curator/generated/CreateSpec.java    |  37 ++--
 .../curator/generated/CuratorEventType.java     |  60 +++---
 .../apache/curator/generated/EventService.java  | 188 +++++++++++++++++--
 .../org/apache/curator/x/rpc/TestClient.java    |  29 ++-
 13 files changed, 410 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/c8d49ae8/curator-x-rpc/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-rpc/pom.xml b/curator-x-rpc/pom.xml
index 42de982..cf2442c 100644
--- a/curator-x-rpc/pom.xml
+++ b/curator-x-rpc/pom.xml
@@ -20,5 +20,11 @@
             <groupId>com.facebook.swift</groupId>
             <artifactId>swift-service</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-test</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/curator/blob/c8d49ae8/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
index 6fcc6d7..f5d5649 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
@@ -31,8 +31,9 @@ public class CuratorProjectionServer
 {
     public static void main(String[] args)
     {
-        EventService eventService = new EventService();
-        CuratorProjectionService projectionService = new CuratorProjectionService(eventService);
+        RpcManager rpcManager = new RpcManager();
+        EventService eventService = new EventService(rpcManager, 5000); // TODO
+        CuratorProjectionService projectionService = new CuratorProjectionService(rpcManager, eventService);
         ThriftServiceProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), Lists.<ThriftEventHandler>newArrayList(), projectionService, eventService);
         ThriftServer server = new ThriftServer(processor, new ThriftServerConfig().setPort(8899));  // TODO
         server.start();

http://git-wip-us.apache.org/repos/asf/curator/blob/c8d49ae8/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
index 783297d..bdc5138 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
@@ -2,6 +2,7 @@ package org.apache.curator.x.rpc;
 
 import com.google.common.collect.Maps;
 import org.apache.curator.framework.CuratorFramework;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicLong;
 
@@ -56,4 +57,12 @@ public class RpcManager
         CuratorEntry entry = projections.remove(id);
         return (entry != null) ? entry.client : null;
     }
+
+    public void touch(List<String> ids)
+    {
+        for ( String id : ids )
+        {
+            getClient(id);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/c8d49ae8/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
index 206a347..3b7cde9 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
@@ -2,13 +2,28 @@ package org.apache.curator.x.rpc.idl.event;
 
 import com.facebook.swift.service.ThriftMethod;
 import com.facebook.swift.service.ThriftService;
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Queues;
+import org.apache.curator.x.rpc.RpcManager;
+import org.apache.curator.x.rpc.idl.projection.CuratorProjection;
+import javax.annotation.Nullable;
+import java.util.List;
 import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
 
 @ThriftService("EventService")
 public class EventService
 {
     private final BlockingQueue<RpcCuratorEvent> events = Queues.newLinkedBlockingQueue();
+    private final RpcManager rpcManager;
+    private final int pingTimeMs;
+
+    public EventService(RpcManager rpcManager, int pingTimeMs)
+    {
+        this.rpcManager = rpcManager;
+        this.pingTimeMs = pingTimeMs;
+    }
 
     public void addEvent(RpcCuratorEvent event)
     {
@@ -16,8 +31,25 @@ public class EventService
     }
 
     @ThriftMethod
-    public RpcCuratorEvent getNextEvent() throws InterruptedException
+    public RpcCuratorEvent getNextEvent(List<CuratorProjection> projections) throws InterruptedException
     {
-        return events.take();
+        if ( projections != null )
+        {
+            List<String> ids = Lists.transform
+            (
+                projections,
+                new Function<CuratorProjection, String>()
+                {
+                    @Override
+                    public String apply(CuratorProjection projection)
+                    {
+                        return projection.id;
+                    }
+                }
+            );
+            rpcManager.touch(ids);
+        }
+        RpcCuratorEvent event = events.poll(pingTimeMs, TimeUnit.MILLISECONDS);
+        return (event != null) ? event : new RpcCuratorEvent();
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/c8d49ae8/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 6896e89..38a5ec3 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
@@ -24,6 +24,7 @@ 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.curator.x.rpc.idl.projection.CuratorProjection;
 import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
@@ -71,7 +72,17 @@ public class RpcCuratorEvent
 
     public RpcCuratorEvent()
     {
-        throw new UnsupportedOperationException();
+        this.projection = null;
+        this.type = RpcCuratorEventType.PING;
+        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;
     }
 
     public RpcCuratorEvent(CuratorProjection projection, CuratorEvent event)
@@ -89,6 +100,53 @@ public class RpcCuratorEvent
         this.watchedEvent = toRpcWatchedEvent(event.getWatchedEvent());
     }
 
+    public RpcCuratorEvent(CuratorProjection projection, ConnectionState newState)
+    {
+        this.projection = projection;
+        this.type = toRpcCuratorEventType(newState);
+        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;
+    }
+
+    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 )

http://git-wip-us.apache.org/repos/asf/curator/blob/c8d49ae8/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 f08aa4a..f8d6468 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
@@ -23,6 +23,7 @@ import com.facebook.swift.codec.ThriftEnum;
 @ThriftEnum("CuratorEventType")
 public enum RpcCuratorEventType
 {
+    PING,
     CREATE,
     DELETE,
     EXISTS,
@@ -33,5 +34,10 @@ public enum RpcCuratorEventType
     GET_ACL,
     SET_ACL,
     WATCHED,
-    CLOSING
+    CLOSING,
+    CONNECTION_CONNECTED,
+    CONNECTION_SUSPENDED,
+    CONNECTION_RECONNECTED,
+    CONNECTION_LOST,
+    CONNECTION_READ_ONLY
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/c8d49ae8/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 8e7acf7..d451b26 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
@@ -28,7 +28,7 @@ public class CreateSpec
     public String path;
 
     @ThriftField(2)
-    public String data;
+    public byte[] data;
 
     @ThriftField(3)
     public CreateMode mode;
@@ -49,7 +49,7 @@ public class CreateSpec
     {
     }
 
-    public CreateSpec(String path, String data, CreateMode mode, boolean doAsync, boolean compressed, boolean creatingParentsIfNeeded, boolean withProtection)
+    public CreateSpec(String path, byte[] data, CreateMode mode, boolean doAsync, boolean compressed, boolean creatingParentsIfNeeded, boolean withProtection)
     {
         this.path = path;
         this.data = data;

http://git-wip-us.apache.org/repos/asf/curator/blob/c8d49ae8/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 34eff59..bca32d9 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
@@ -1,3 +1,4 @@
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -29,6 +30,8 @@ import org.apache.curator.framework.api.CreateBuilder;
 import org.apache.curator.framework.api.CreateModable;
 import org.apache.curator.framework.api.CuratorEvent;
 import org.apache.curator.framework.api.PathAndBytesable;
+import org.apache.curator.framework.state.ConnectionState;
+import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.x.rpc.RpcManager;
 import org.apache.curator.x.rpc.idl.event.EventService;
@@ -38,11 +41,12 @@ import java.util.UUID;
 @ThriftService("CuratorService")
 public class CuratorProjectionService
 {
-    private final RpcManager rpcManager = new RpcManager();
+    private final RpcManager rpcManager;
     private final EventService eventService;
 
-    public CuratorProjectionService(EventService eventService)
+    public CuratorProjectionService(RpcManager rpcManager, EventService eventService)
     {
+        this.rpcManager = rpcManager;
         this.eventService = eventService;
     }
 
@@ -53,7 +57,19 @@ public class CuratorProjectionService
         String id = UUID.randomUUID().toString();
         client.start();
         rpcManager.add(id, client);
-        return new CuratorProjection(id);
+        final CuratorProjection projection = new CuratorProjection(id);
+
+        ConnectionStateListener listener = new ConnectionStateListener()
+        {
+            @Override
+            public void stateChanged(CuratorFramework client, ConnectionState newState)
+            {
+                eventService.addEvent(new RpcCuratorEvent(projection, newState));
+            }
+        };
+        client.getConnectionStateListenable().addListener(listener);
+
+        return projection;
     }
 
     @ThriftMethod
@@ -84,7 +100,10 @@ public class CuratorProjectionService
         {
             builder = castBuilder(builder, CreateBuilder.class).withProtection();
         }
-        builder = castBuilder(builder, CreateModable.class).withMode(getRealMode(createSpec.mode));
+        if ( createSpec.mode != null )
+        {
+            builder = castBuilder(builder, CreateModable.class).withMode(getRealMode(createSpec.mode));
+        }
 
         if ( createSpec.doAsync )
         {
@@ -99,7 +118,7 @@ public class CuratorProjectionService
             builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
         }
 
-        return String.valueOf(castBuilder(builder, PathAndBytesable.class).forPath(createSpec.path, createSpec.data.getBytes()));
+        return String.valueOf(castBuilder(builder, PathAndBytesable.class).forPath(createSpec.path, createSpec.data));
     }
 
     private org.apache.zookeeper.CreateMode getRealMode(CreateMode mode)

http://git-wip-us.apache.org/repos/asf/curator/blob/c8d49ae8/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 b9d5beb..100f456 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -8,7 +8,7 @@ enum CreateMode {
 }
 
 enum CuratorEventType {
-  CREATE, DELETE, EXISTS, GET_DATA, SET_DATA, CHILDREN, SYNC, GET_ACL, SET_ACL, WATCHED, CLOSING
+  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
 }
 
 enum EventType {
@@ -21,7 +21,7 @@ enum KeeperState {
 
 struct CreateSpec {
   1: string path;
-  2: string data;
+  2: binary data;
   3: CreateMode mode;
   4: bool doAsync;
   5: bool compressed;
@@ -87,5 +87,5 @@ service CuratorService {
 }
 
 service EventService {
-  CuratorEvent getNextEvent();
+  CuratorEvent getNextEvent(1: list<CuratorProjection> projections);
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/c8d49ae8/curator-x-rpc/src/test/java/org/apache/curator/generated/CreateSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/CreateSpec.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/CreateSpec.java
index 67437d3..4488285 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/CreateSpec.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CreateSpec.java
@@ -50,7 +50,7 @@ public class CreateSpec implements org.apache.thrift.TBase<CreateSpec, CreateSpe
   }
 
   public String path; // required
-  public String data; // required
+  public ByteBuffer data; // required
   /**
    * 
    * @see CreateMode
@@ -153,7 +153,7 @@ public class CreateSpec implements org.apache.thrift.TBase<CreateSpec, CreateSpe
     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.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)));
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
     tmpMap.put(_Fields.MODE, new org.apache.thrift.meta_data.FieldMetaData("mode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
         new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, CreateMode.class)));
     tmpMap.put(_Fields.DO_ASYNC, new org.apache.thrift.meta_data.FieldMetaData("doAsync", org.apache.thrift.TFieldRequirementType.DEFAULT, 
@@ -173,7 +173,7 @@ public class CreateSpec implements org.apache.thrift.TBase<CreateSpec, CreateSpe
 
   public CreateSpec(
     String path,
-    String data,
+    ByteBuffer data,
     CreateMode mode,
     boolean doAsync,
     boolean compressed,
@@ -203,7 +203,8 @@ public class CreateSpec implements org.apache.thrift.TBase<CreateSpec, CreateSpe
       this.path = other.path;
     }
     if (other.isSetData()) {
-      this.data = other.data;
+      this.data = org.apache.thrift.TBaseHelper.copyBinary(other.data);
+;
     }
     if (other.isSetMode()) {
       this.mode = other.mode;
@@ -257,11 +258,21 @@ public class CreateSpec implements org.apache.thrift.TBase<CreateSpec, CreateSpe
     }
   }
 
-  public String getData() {
-    return this.data;
+  public byte[] getData() {
+    setData(org.apache.thrift.TBaseHelper.rightSize(data));
+    return data == null ? null : data.array();
+  }
+
+  public ByteBuffer bufferForData() {
+    return data;
+  }
+
+  public CreateSpec setData(byte[] data) {
+    setData(data == null ? (ByteBuffer)null : ByteBuffer.wrap(data));
+    return this;
   }
 
-  public CreateSpec setData(String data) {
+  public CreateSpec setData(ByteBuffer data) {
     this.data = data;
     return this;
   }
@@ -419,7 +430,7 @@ public class CreateSpec implements org.apache.thrift.TBase<CreateSpec, CreateSpe
       if (value == null) {
         unsetData();
       } else {
-        setData((String)value);
+        setData((ByteBuffer)value);
       }
       break;
 
@@ -712,7 +723,7 @@ public class CreateSpec implements org.apache.thrift.TBase<CreateSpec, CreateSpe
     if (this.data == null) {
       sb.append("null");
     } else {
-      sb.append(this.data);
+      org.apache.thrift.TBaseHelper.toString(this.data, sb);
     }
     first = false;
     if (!first) sb.append(", ");
@@ -794,7 +805,7 @@ public class CreateSpec implements org.apache.thrift.TBase<CreateSpec, CreateSpe
             break;
           case 2: // DATA
             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.data = iprot.readString();
+              struct.data = iprot.readBinary();
               struct.setDataIsSet(true);
             } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
@@ -862,7 +873,7 @@ public class CreateSpec implements org.apache.thrift.TBase<CreateSpec, CreateSpe
       }
       if (struct.data != null) {
         oprot.writeFieldBegin(DATA_FIELD_DESC);
-        oprot.writeString(struct.data);
+        oprot.writeBinary(struct.data);
         oprot.writeFieldEnd();
       }
       if (struct.mode != null) {
@@ -926,7 +937,7 @@ public class CreateSpec implements org.apache.thrift.TBase<CreateSpec, CreateSpe
         oprot.writeString(struct.path);
       }
       if (struct.isSetData()) {
-        oprot.writeString(struct.data);
+        oprot.writeBinary(struct.data);
       }
       if (struct.isSetMode()) {
         oprot.writeI32(struct.mode.getValue());
@@ -954,7 +965,7 @@ public class CreateSpec implements org.apache.thrift.TBase<CreateSpec, CreateSpe
         struct.setPathIsSet(true);
       }
       if (incoming.get(1)) {
-        struct.data = iprot.readString();
+        struct.data = iprot.readBinary();
         struct.setDataIsSet(true);
       }
       if (incoming.get(2)) {

http://git-wip-us.apache.org/repos/asf/curator/blob/c8d49ae8/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 60350fc..ce31158 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
@@ -12,17 +12,23 @@ import java.util.HashMap;
 import org.apache.thrift.TEnum;
 
 public enum CuratorEventType implements org.apache.thrift.TEnum {
-  CREATE(0),
-  DELETE(1),
-  EXISTS(2),
-  GET_DATA(3),
-  SET_DATA(4),
-  CHILDREN(5),
-  SYNC(6),
-  GET_ACL(7),
-  SET_ACL(8),
-  WATCHED(9),
-  CLOSING(10);
+  PING(0),
+  CREATE(1),
+  DELETE(2),
+  EXISTS(3),
+  GET_DATA(4),
+  SET_DATA(5),
+  CHILDREN(6),
+  SYNC(7),
+  GET_ACL(8),
+  SET_ACL(9),
+  WATCHED(10),
+  CLOSING(11),
+  CONNECTION_CONNECTED(12),
+  CONNECTION_SUSPENDED(13),
+  CONNECTION_RECONNECTED(14),
+  CONNECTION_LOST(15),
+  CONNECTION_READ_ONLY(16);
 
   private final int value;
 
@@ -44,27 +50,39 @@ public enum CuratorEventType implements org.apache.thrift.TEnum {
   public static CuratorEventType findByValue(int value) { 
     switch (value) {
       case 0:
-        return CREATE;
+        return PING;
       case 1:
-        return DELETE;
+        return CREATE;
       case 2:
-        return EXISTS;
+        return DELETE;
       case 3:
-        return GET_DATA;
+        return EXISTS;
       case 4:
-        return SET_DATA;
+        return GET_DATA;
       case 5:
-        return CHILDREN;
+        return SET_DATA;
       case 6:
-        return SYNC;
+        return CHILDREN;
       case 7:
-        return GET_ACL;
+        return SYNC;
       case 8:
-        return SET_ACL;
+        return GET_ACL;
       case 9:
-        return WATCHED;
+        return SET_ACL;
       case 10:
+        return WATCHED;
+      case 11:
         return CLOSING;
+      case 12:
+        return CONNECTION_CONNECTED;
+      case 13:
+        return CONNECTION_SUSPENDED;
+      case 14:
+        return CONNECTION_RECONNECTED;
+      case 15:
+        return CONNECTION_LOST;
+      case 16:
+        return CONNECTION_READ_ONLY;
       default:
         return null;
     }

http://git-wip-us.apache.org/repos/asf/curator/blob/c8d49ae8/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
index 7c8e294..7b41888 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
@@ -36,13 +36,13 @@ public class EventService {
 
   public interface Iface {
 
-    public CuratorEvent getNextEvent() throws org.apache.thrift.TException;
+    public CuratorEvent getNextEvent(List<CuratorProjection> projections) throws org.apache.thrift.TException;
 
   }
 
   public interface AsyncIface {
 
-    public void getNextEvent(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+    public void getNextEvent(List<CuratorProjection> projections, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
 
   }
 
@@ -66,15 +66,16 @@ public class EventService {
       super(iprot, oprot);
     }
 
-    public CuratorEvent getNextEvent() throws org.apache.thrift.TException
+    public CuratorEvent getNextEvent(List<CuratorProjection> projections) throws org.apache.thrift.TException
     {
-      send_getNextEvent();
+      send_getNextEvent(projections);
       return recv_getNextEvent();
     }
 
-    public void send_getNextEvent() throws org.apache.thrift.TException
+    public void send_getNextEvent(List<CuratorProjection> projections) throws org.apache.thrift.TException
     {
       getNextEvent_args args = new getNextEvent_args();
+      args.setProjections(projections);
       sendBase("getNextEvent", args);
     }
 
@@ -106,21 +107,24 @@ public class EventService {
       super(protocolFactory, clientManager, transport);
     }
 
-    public void getNextEvent(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+    public void getNextEvent(List<CuratorProjection> projections, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
       checkReady();
-      getNextEvent_call method_call = new getNextEvent_call(resultHandler, this, ___protocolFactory, ___transport);
+      getNextEvent_call method_call = new getNextEvent_call(projections, resultHandler, this, ___protocolFactory, ___transport);
       this.___currentMethod = method_call;
       ___manager.call(method_call);
     }
 
     public static class getNextEvent_call extends org.apache.thrift.async.TAsyncMethodCall {
-      public getNextEvent_call(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 {
+      private List<CuratorProjection> projections;
+      public getNextEvent_call(List<CuratorProjection> projections, 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.projections = projections;
       }
 
       public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
         prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getNextEvent", org.apache.thrift.protocol.TMessageType.CALL, 0));
         getNextEvent_args args = new getNextEvent_args();
+        args.setProjections(projections);
         args.write(prot);
         prot.writeMessageEnd();
       }
@@ -167,7 +171,7 @@ public class EventService {
 
       public getNextEvent_result getResult(I iface, getNextEvent_args args) throws org.apache.thrift.TException {
         getNextEvent_result result = new getNextEvent_result();
-        result.success = iface.getNextEvent();
+        result.success = iface.getNextEvent(args.projections);
         return result;
       }
     }
@@ -236,7 +240,7 @@ public class EventService {
       }
 
       public void start(I iface, getNextEvent_args args, org.apache.thrift.async.AsyncMethodCallback<CuratorEvent> resultHandler) throws TException {
-        iface.getNextEvent(resultHandler);
+        iface.getNextEvent(args.projections,resultHandler);
       }
     }
 
@@ -245,6 +249,7 @@ public class EventService {
   public static class getNextEvent_args implements org.apache.thrift.TBase<getNextEvent_args, getNextEvent_args._Fields>, java.io.Serializable, Cloneable, Comparable<getNextEvent_args>   {
     private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getNextEvent_args");
 
+    private static final org.apache.thrift.protocol.TField PROJECTIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("projections", org.apache.thrift.protocol.TType.LIST, (short)1);
 
     private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
     static {
@@ -252,10 +257,11 @@ public class EventService {
       schemes.put(TupleScheme.class, new getNextEvent_argsTupleSchemeFactory());
     }
 
+    public List<CuratorProjection> projections; // 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 {
-;
+      PROJECTIONS((short)1, "projections");
 
       private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -270,6 +276,8 @@ public class EventService {
        */
       public static _Fields findByThriftId(int fieldId) {
         switch(fieldId) {
+          case 1: // PROJECTIONS
+            return PROJECTIONS;
           default:
             return null;
         }
@@ -308,9 +316,14 @@ public class EventService {
         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.PROJECTIONS, new org.apache.thrift.meta_data.FieldMetaData("projections", 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, CuratorProjection.class))));
       metaDataMap = Collections.unmodifiableMap(tmpMap);
       org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getNextEvent_args.class, metaDataMap);
     }
@@ -318,10 +331,24 @@ public class EventService {
     public getNextEvent_args() {
     }
 
+    public getNextEvent_args(
+      List<CuratorProjection> projections)
+    {
+      this();
+      this.projections = projections;
+    }
+
     /**
      * Performs a deep copy on <i>other</i>.
      */
     public getNextEvent_args(getNextEvent_args other) {
+      if (other.isSetProjections()) {
+        List<CuratorProjection> __this__projections = new ArrayList<CuratorProjection>(other.projections.size());
+        for (CuratorProjection other_element : other.projections) {
+          __this__projections.add(new CuratorProjection(other_element));
+        }
+        this.projections = __this__projections;
+      }
     }
 
     public getNextEvent_args deepCopy() {
@@ -330,15 +357,66 @@ public class EventService {
 
     @Override
     public void clear() {
+      this.projections = null;
+    }
+
+    public int getProjectionsSize() {
+      return (this.projections == null) ? 0 : this.projections.size();
+    }
+
+    public java.util.Iterator<CuratorProjection> getProjectionsIterator() {
+      return (this.projections == null) ? null : this.projections.iterator();
+    }
+
+    public void addToProjections(CuratorProjection elem) {
+      if (this.projections == null) {
+        this.projections = new ArrayList<CuratorProjection>();
+      }
+      this.projections.add(elem);
+    }
+
+    public List<CuratorProjection> getProjections() {
+      return this.projections;
+    }
+
+    public getNextEvent_args setProjections(List<CuratorProjection> projections) {
+      this.projections = projections;
+      return this;
+    }
+
+    public void unsetProjections() {
+      this.projections = null;
+    }
+
+    /** Returns true if field projections is set (has been assigned a value) and false otherwise */
+    public boolean isSetProjections() {
+      return this.projections != null;
+    }
+
+    public void setProjectionsIsSet(boolean value) {
+      if (!value) {
+        this.projections = null;
+      }
     }
 
     public void setFieldValue(_Fields field, Object value) {
       switch (field) {
+      case PROJECTIONS:
+        if (value == null) {
+          unsetProjections();
+        } else {
+          setProjections((List<CuratorProjection>)value);
+        }
+        break;
+
       }
     }
 
     public Object getFieldValue(_Fields field) {
       switch (field) {
+      case PROJECTIONS:
+        return getProjections();
+
       }
       throw new IllegalStateException();
     }
@@ -350,6 +428,8 @@ public class EventService {
       }
 
       switch (field) {
+      case PROJECTIONS:
+        return isSetProjections();
       }
       throw new IllegalStateException();
     }
@@ -367,6 +447,15 @@ public class EventService {
       if (that == null)
         return false;
 
+      boolean this_present_projections = true && this.isSetProjections();
+      boolean that_present_projections = true && that.isSetProjections();
+      if (this_present_projections || that_present_projections) {
+        if (!(this_present_projections && that_present_projections))
+          return false;
+        if (!this.projections.equals(that.projections))
+          return false;
+      }
+
       return true;
     }
 
@@ -383,6 +472,16 @@ public class EventService {
 
       int lastComparison = 0;
 
+      lastComparison = Boolean.valueOf(isSetProjections()).compareTo(other.isSetProjections());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetProjections()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projections, other.projections);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
       return 0;
     }
 
@@ -403,6 +502,13 @@ public class EventService {
       StringBuilder sb = new StringBuilder("getNextEvent_args(");
       boolean first = true;
 
+      sb.append("projections:");
+      if (this.projections == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.projections);
+      }
+      first = false;
       sb.append(")");
       return sb.toString();
     }
@@ -446,6 +552,25 @@ public class EventService {
             break;
           }
           switch (schemeField.id) {
+            case 1: // PROJECTIONS
+              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+                {
+                  org.apache.thrift.protocol.TList _list16 = iprot.readListBegin();
+                  struct.projections = new ArrayList<CuratorProjection>(_list16.size);
+                  for (int _i17 = 0; _i17 < _list16.size; ++_i17)
+                  {
+                    CuratorProjection _elem18;
+                    _elem18 = new CuratorProjection();
+                    _elem18.read(iprot);
+                    struct.projections.add(_elem18);
+                  }
+                  iprot.readListEnd();
+                }
+                struct.setProjectionsIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
             default:
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
           }
@@ -461,6 +586,18 @@ public class EventService {
         struct.validate();
 
         oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.projections != null) {
+          oprot.writeFieldBegin(PROJECTIONS_FIELD_DESC);
+          {
+            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.projections.size()));
+            for (CuratorProjection _iter19 : struct.projections)
+            {
+              _iter19.write(oprot);
+            }
+            oprot.writeListEnd();
+          }
+          oprot.writeFieldEnd();
+        }
         oprot.writeFieldStop();
         oprot.writeStructEnd();
       }
@@ -478,11 +615,40 @@ public class EventService {
       @Override
       public void write(org.apache.thrift.protocol.TProtocol prot, getNextEvent_args struct) throws org.apache.thrift.TException {
         TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetProjections()) {
+          optionals.set(0);
+        }
+        oprot.writeBitSet(optionals, 1);
+        if (struct.isSetProjections()) {
+          {
+            oprot.writeI32(struct.projections.size());
+            for (CuratorProjection _iter20 : struct.projections)
+            {
+              _iter20.write(oprot);
+            }
+          }
+        }
       }
 
       @Override
       public void read(org.apache.thrift.protocol.TProtocol prot, getNextEvent_args struct) throws org.apache.thrift.TException {
         TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          {
+            org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+            struct.projections = new ArrayList<CuratorProjection>(_list21.size);
+            for (int _i22 = 0; _i22 < _list21.size; ++_i22)
+            {
+              CuratorProjection _elem23;
+              _elem23 = new CuratorProjection();
+              _elem23.read(iprot);
+              struct.projections.add(_elem23);
+            }
+          }
+          struct.setProjectionsIsSet(true);
+        }
       }
     }
 

http://git-wip-us.apache.org/repos/asf/curator/blob/c8d49ae8/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 e479031..79cea30 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
@@ -18,21 +18,26 @@
  */
 package org.apache.curator.x.rpc;
 
+import org.apache.curator.generated.CreateSpec;
 import org.apache.curator.generated.CuratorEvent;
 import org.apache.curator.generated.CuratorProjection;
 import org.apache.curator.generated.CuratorProjectionSpec;
 import org.apache.curator.generated.CuratorService;
 import org.apache.curator.generated.EventService;
+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.util.Arrays;
 import java.util.concurrent.Executors;
 
 public class TestClient
 {
-    public static void main(String[] args) throws TException
+    public static void main(String[] args) throws Exception
     {
+        new TestingServer(2181);
+
         TSocket clientTransport = new TSocket("localhost", 8899);
         clientTransport.open();
         TProtocol clientProtocol = new TBinaryProtocol(clientTransport);
@@ -43,24 +48,36 @@ public class TestClient
         TProtocol eventProtocol = new TBinaryProtocol(eventTransport);
         final EventService.Client serviceClient = new EventService.Client(eventProtocol);
 
+        final CuratorProjection curatorProjection = client.newCuratorProjection(new CuratorProjectionSpec());
+
         Executors.newSingleThreadExecutor().submit
-        (new Runnable()
+        (
+            new Runnable()
             {
                 @Override
                 public void run()
                 {
                     try
                     {
-                        CuratorEvent nextEvent = serviceClient.getNextEvent();
-                        System.out.println(nextEvent.type);
+                        //noinspection InfiniteLoopStatement
+                        for(;;)
+                        {
+                            CuratorEvent nextEvent = serviceClient.getNextEvent(Arrays.asList(curatorProjection));
+                            System.out.println(nextEvent.type);
+                        }
                     }
                     catch ( TException e )
                     {
                         e.printStackTrace();
                     }
                 }
-            });
+            }
+        );
 
-        CuratorProjection curatorProjection = client.newCuratorProjection(new CuratorProjectionSpec());
+        CreateSpec createSpec = new CreateSpec();
+        createSpec.path = "/a/b/c";
+        createSpec.creatingParentsIfNeeded = true;
+        String path = client.create(curatorProjection, createSpec);
+        System.out.println(path);
     }
 }


[06/14] wip

Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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
new file mode 100644
index 0000000..a6c758b
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorService.java
@@ -0,0 +1,3387 @@
+/**
+ * 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 CuratorService {
+
+  public interface Iface {
+
+    public void closeCuratorProjection(CuratorProjection projection) throws org.apache.thrift.TException;
+
+    public String create(CuratorProjection projection, CreateSpec createSpec) throws org.apache.thrift.TException;
+
+    public CuratorEvent getNextEvent() throws org.apache.thrift.TException;
+
+    public CuratorProjection newCuratorProjection(CuratorProjectionSpec spec) throws org.apache.thrift.TException;
+
+  }
+
+  public interface AsyncIface {
+
+    public void closeCuratorProjection(CuratorProjection projection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void create(CuratorProjection projection, CreateSpec createSpec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void getNextEvent(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+    public void newCuratorProjection(CuratorProjectionSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+  }
+
+  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
+    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
+      public Factory() {}
+      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
+        return new Client(prot);
+      }
+      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+        return new Client(iprot, oprot);
+      }
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol prot)
+    {
+      super(prot, prot);
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+      super(iprot, oprot);
+    }
+
+    public void closeCuratorProjection(CuratorProjection projection) throws org.apache.thrift.TException
+    {
+      send_closeCuratorProjection(projection);
+      recv_closeCuratorProjection();
+    }
+
+    public void send_closeCuratorProjection(CuratorProjection projection) throws org.apache.thrift.TException
+    {
+      closeCuratorProjection_args args = new closeCuratorProjection_args();
+      args.setProjection(projection);
+      sendBase("closeCuratorProjection", args);
+    }
+
+    public void recv_closeCuratorProjection() throws org.apache.thrift.TException
+    {
+      closeCuratorProjection_result result = new closeCuratorProjection_result();
+      receiveBase(result, "closeCuratorProjection");
+      return;
+    }
+
+    public String create(CuratorProjection projection, CreateSpec createSpec) throws org.apache.thrift.TException
+    {
+      send_create(projection, createSpec);
+      return recv_create();
+    }
+
+    public void send_create(CuratorProjection projection, CreateSpec createSpec) throws org.apache.thrift.TException
+    {
+      create_args args = new create_args();
+      args.setProjection(projection);
+      args.setCreateSpec(createSpec);
+      sendBase("create", args);
+    }
+
+    public String recv_create() throws org.apache.thrift.TException
+    {
+      create_result result = new create_result();
+      receiveBase(result, "create");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "create failed: unknown result");
+    }
+
+    public CuratorEvent getNextEvent() throws org.apache.thrift.TException
+    {
+      send_getNextEvent();
+      return recv_getNextEvent();
+    }
+
+    public void send_getNextEvent() throws org.apache.thrift.TException
+    {
+      getNextEvent_args args = new getNextEvent_args();
+      sendBase("getNextEvent", args);
+    }
+
+    public CuratorEvent recv_getNextEvent() throws org.apache.thrift.TException
+    {
+      getNextEvent_result result = new getNextEvent_result();
+      receiveBase(result, "getNextEvent");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getNextEvent failed: unknown result");
+    }
+
+    public CuratorProjection newCuratorProjection(CuratorProjectionSpec spec) throws org.apache.thrift.TException
+    {
+      send_newCuratorProjection(spec);
+      return recv_newCuratorProjection();
+    }
+
+    public void send_newCuratorProjection(CuratorProjectionSpec spec) throws org.apache.thrift.TException
+    {
+      newCuratorProjection_args args = new newCuratorProjection_args();
+      args.setSpec(spec);
+      sendBase("newCuratorProjection", args);
+    }
+
+    public CuratorProjection recv_newCuratorProjection() throws org.apache.thrift.TException
+    {
+      newCuratorProjection_result result = new newCuratorProjection_result();
+      receiveBase(result, "newCuratorProjection");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "newCuratorProjection 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> {
+      private org.apache.thrift.async.TAsyncClientManager clientManager;
+      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
+      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
+        this.clientManager = clientManager;
+        this.protocolFactory = protocolFactory;
+      }
+      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
+        return new AsyncClient(protocolFactory, clientManager, transport);
+      }
+    }
+
+    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
+      super(protocolFactory, clientManager, transport);
+    }
+
+    public void closeCuratorProjection(CuratorProjection projection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      closeCuratorProjection_call method_call = new closeCuratorProjection_call(projection, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class closeCuratorProjection_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private CuratorProjection projection;
+      public closeCuratorProjection_call(CuratorProjection projection, 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;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("closeCuratorProjection", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        closeCuratorProjection_args args = new closeCuratorProjection_args();
+        args.setProjection(projection);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public void 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);
+        (new Client(prot)).recv_closeCuratorProjection();
+      }
+    }
+
+    public void create(CuratorProjection projection, CreateSpec createSpec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      create_call method_call = new create_call(projection, createSpec, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class create_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private CuratorProjection projection;
+      private CreateSpec createSpec;
+      public create_call(CuratorProjection projection, CreateSpec createSpec, 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.createSpec = createSpec;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("create", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        create_args args = new create_args();
+        args.setProjection(projection);
+        args.setCreateSpec(createSpec);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public String 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_create();
+      }
+    }
+
+    public void getNextEvent(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      getNextEvent_call method_call = new getNextEvent_call(resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getNextEvent_call extends org.apache.thrift.async.TAsyncMethodCall {
+      public getNextEvent_call(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);
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getNextEvent", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getNextEvent_args args = new getNextEvent_args();
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public CuratorEvent 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_getNextEvent();
+      }
+    }
+
+    public void newCuratorProjection(CuratorProjectionSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      newCuratorProjection_call method_call = new newCuratorProjection_call(spec, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class newCuratorProjection_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private CuratorProjectionSpec spec;
+      public newCuratorProjection_call(CuratorProjectionSpec 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.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("newCuratorProjection", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        newCuratorProjection_args args = new newCuratorProjection_args();
+        args.setSpec(spec);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public CuratorProjection 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_newCuratorProjection();
+      }
+    }
+
+  }
+
+  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
+    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
+    public Processor(I iface) {
+      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
+    }
+
+    protected Processor(I iface, Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends Iface> Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> getProcessMap(Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
+      processMap.put("closeCuratorProjection", new closeCuratorProjection());
+      processMap.put("create", new create());
+      processMap.put("getNextEvent", new getNextEvent());
+      processMap.put("newCuratorProjection", new newCuratorProjection());
+      return processMap;
+    }
+
+    public static class closeCuratorProjection<I extends Iface> extends org.apache.thrift.ProcessFunction<I, closeCuratorProjection_args> {
+      public closeCuratorProjection() {
+        super("closeCuratorProjection");
+      }
+
+      public closeCuratorProjection_args getEmptyArgsInstance() {
+        return new closeCuratorProjection_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public closeCuratorProjection_result getResult(I iface, closeCuratorProjection_args args) throws org.apache.thrift.TException {
+        closeCuratorProjection_result result = new closeCuratorProjection_result();
+        iface.closeCuratorProjection(args.projection);
+        return result;
+      }
+    }
+
+    public static class create<I extends Iface> extends org.apache.thrift.ProcessFunction<I, create_args> {
+      public create() {
+        super("create");
+      }
+
+      public create_args getEmptyArgsInstance() {
+        return new create_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public create_result getResult(I iface, create_args args) throws org.apache.thrift.TException {
+        create_result result = new create_result();
+        result.success = iface.create(args.projection, args.createSpec);
+        return result;
+      }
+    }
+
+    public static class getNextEvent<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getNextEvent_args> {
+      public getNextEvent() {
+        super("getNextEvent");
+      }
+
+      public getNextEvent_args getEmptyArgsInstance() {
+        return new getNextEvent_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public getNextEvent_result getResult(I iface, getNextEvent_args args) throws org.apache.thrift.TException {
+        getNextEvent_result result = new getNextEvent_result();
+        result.success = iface.getNextEvent();
+        return result;
+      }
+    }
+
+    public static class newCuratorProjection<I extends Iface> extends org.apache.thrift.ProcessFunction<I, newCuratorProjection_args> {
+      public newCuratorProjection() {
+        super("newCuratorProjection");
+      }
+
+      public newCuratorProjection_args getEmptyArgsInstance() {
+        return new newCuratorProjection_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public newCuratorProjection_result getResult(I iface, newCuratorProjection_args args) throws org.apache.thrift.TException {
+        newCuratorProjection_result result = new newCuratorProjection_result();
+        result.success = iface.newCuratorProjection(args.spec);
+        return result;
+      }
+    }
+
+  }
+
+  public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
+    private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
+    public AsyncProcessor(I iface) {
+      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
+    }
+
+    protected AsyncProcessor(I iface, Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends AsyncIface> Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
+      processMap.put("closeCuratorProjection", new closeCuratorProjection());
+      processMap.put("create", new create());
+      processMap.put("getNextEvent", new getNextEvent());
+      processMap.put("newCuratorProjection", new newCuratorProjection());
+      return processMap;
+    }
+
+    public static class closeCuratorProjection<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, closeCuratorProjection_args, Void> {
+      public closeCuratorProjection() {
+        super("closeCuratorProjection");
+      }
+
+      public closeCuratorProjection_args getEmptyArgsInstance() {
+        return new closeCuratorProjection_args();
+      }
+
+      public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<Void>() { 
+          public void onComplete(Void o) {
+            closeCuratorProjection_result result = new closeCuratorProjection_result();
+            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;
+            closeCuratorProjection_result result = new closeCuratorProjection_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, closeCuratorProjection_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
+        iface.closeCuratorProjection(args.projection,resultHandler);
+      }
+    }
+
+    public static class create<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, create_args, String> {
+      public create() {
+        super("create");
+      }
+
+      public create_args getEmptyArgsInstance() {
+        return new create_args();
+      }
+
+      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<String>() { 
+          public void onComplete(String o) {
+            create_result result = new create_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;
+            create_result result = new create_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, create_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
+        iface.create(args.projection, args.createSpec,resultHandler);
+      }
+    }
+
+    public static class getNextEvent<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getNextEvent_args, CuratorEvent> {
+      public getNextEvent() {
+        super("getNextEvent");
+      }
+
+      public getNextEvent_args getEmptyArgsInstance() {
+        return new getNextEvent_args();
+      }
+
+      public AsyncMethodCallback<CuratorEvent> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<CuratorEvent>() { 
+          public void onComplete(CuratorEvent o) {
+            getNextEvent_result result = new getNextEvent_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;
+            getNextEvent_result result = new getNextEvent_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, getNextEvent_args args, org.apache.thrift.async.AsyncMethodCallback<CuratorEvent> resultHandler) throws TException {
+        iface.getNextEvent(resultHandler);
+      }
+    }
+
+    public static class newCuratorProjection<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, newCuratorProjection_args, CuratorProjection> {
+      public newCuratorProjection() {
+        super("newCuratorProjection");
+      }
+
+      public newCuratorProjection_args getEmptyArgsInstance() {
+        return new newCuratorProjection_args();
+      }
+
+      public AsyncMethodCallback<CuratorProjection> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<CuratorProjection>() { 
+          public void onComplete(CuratorProjection o) {
+            newCuratorProjection_result result = new newCuratorProjection_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;
+            newCuratorProjection_result result = new newCuratorProjection_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, newCuratorProjection_args args, org.apache.thrift.async.AsyncMethodCallback<CuratorProjection> resultHandler) throws TException {
+        iface.newCuratorProjection(args.spec,resultHandler);
+      }
+    }
+
+  }
+
+  public static class closeCuratorProjection_args implements org.apache.thrift.TBase<closeCuratorProjection_args, closeCuratorProjection_args._Fields>, java.io.Serializable, Cloneable, Comparable<closeCuratorProjection_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("closeCuratorProjection_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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new closeCuratorProjection_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new closeCuratorProjection_argsTupleSchemeFactory());
+    }
+
+    public CuratorProjection 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, CuratorProjection.class)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(closeCuratorProjection_args.class, metaDataMap);
+    }
+
+    public closeCuratorProjection_args() {
+    }
+
+    public closeCuratorProjection_args(
+      CuratorProjection projection)
+    {
+      this();
+      this.projection = projection;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public closeCuratorProjection_args(closeCuratorProjection_args other) {
+      if (other.isSetProjection()) {
+        this.projection = new CuratorProjection(other.projection);
+      }
+    }
+
+    public closeCuratorProjection_args deepCopy() {
+      return new closeCuratorProjection_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.projection = null;
+    }
+
+    public CuratorProjection getProjection() {
+      return this.projection;
+    }
+
+    public closeCuratorProjection_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 void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case PROJECTION:
+        if (value == null) {
+          unsetProjection();
+        } else {
+          setProjection((CuratorProjection)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 closeCuratorProjection_args)
+        return this.equals((closeCuratorProjection_args)that);
+      return false;
+    }
+
+    public boolean equals(closeCuratorProjection_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;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(closeCuratorProjection_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;
+        }
+      }
+      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("closeCuratorProjection_args(");
+      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 closeCuratorProjection_argsStandardSchemeFactory implements SchemeFactory {
+      public closeCuratorProjection_argsStandardScheme getScheme() {
+        return new closeCuratorProjection_argsStandardScheme();
+      }
+    }
+
+    private static class closeCuratorProjection_argsStandardScheme extends StandardScheme<closeCuratorProjection_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, closeCuratorProjection_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;
+            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, closeCuratorProjection_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();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class closeCuratorProjection_argsTupleSchemeFactory implements SchemeFactory {
+      public closeCuratorProjection_argsTupleScheme getScheme() {
+        return new closeCuratorProjection_argsTupleScheme();
+      }
+    }
+
+    private static class closeCuratorProjection_argsTupleScheme extends TupleScheme<closeCuratorProjection_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, closeCuratorProjection_args 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, closeCuratorProjection_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          struct.projection = new CuratorProjection();
+          struct.projection.read(iprot);
+          struct.setProjectionIsSet(true);
+        }
+      }
+    }
+
+  }
+
+  public static class closeCuratorProjection_result implements org.apache.thrift.TBase<closeCuratorProjection_result, closeCuratorProjection_result._Fields>, java.io.Serializable, Cloneable, Comparable<closeCuratorProjection_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("closeCuratorProjection_result");
+
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new closeCuratorProjection_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new closeCuratorProjection_resultTupleSchemeFactory());
+    }
+
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+;
+
+      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) {
+          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;
+      }
+    }
+    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);
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(closeCuratorProjection_result.class, metaDataMap);
+    }
+
+    public closeCuratorProjection_result() {
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public closeCuratorProjection_result(closeCuratorProjection_result other) {
+    }
+
+    public closeCuratorProjection_result deepCopy() {
+      return new closeCuratorProjection_result(this);
+    }
+
+    @Override
+    public void clear() {
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      }
+      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) {
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof closeCuratorProjection_result)
+        return this.equals((closeCuratorProjection_result)that);
+      return false;
+    }
+
+    public boolean equals(closeCuratorProjection_result that) {
+      if (that == null)
+        return false;
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(closeCuratorProjection_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      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("closeCuratorProjection_result(");
+      boolean first = true;
+
+      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 closeCuratorProjection_resultStandardSchemeFactory implements SchemeFactory {
+      public closeCuratorProjection_resultStandardScheme getScheme() {
+        return new closeCuratorProjection_resultStandardScheme();
+      }
+    }
+
+    private static class closeCuratorProjection_resultStandardScheme extends StandardScheme<closeCuratorProjection_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, closeCuratorProjection_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) {
+            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, closeCuratorProjection_result struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class closeCuratorProjection_resultTupleSchemeFactory implements SchemeFactory {
+      public closeCuratorProjection_resultTupleScheme getScheme() {
+        return new closeCuratorProjection_resultTupleScheme();
+      }
+    }
+
+    private static class closeCuratorProjection_resultTupleScheme extends TupleScheme<closeCuratorProjection_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, closeCuratorProjection_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, closeCuratorProjection_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+      }
+    }
+
+  }
+
+  public static class create_args implements org.apache.thrift.TBase<create_args, create_args._Fields>, java.io.Serializable, Cloneable, Comparable<create_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("create_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 CREATE_SPEC_FIELD_DESC = new org.apache.thrift.protocol.TField("createSpec", 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 create_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new create_argsTupleSchemeFactory());
+    }
+
+    public CuratorProjection projection; // required
+    public CreateSpec createSpec; // 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"),
+      CREATE_SPEC((short)2, "createSpec");
+
+      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: // CREATE_SPEC
+            return CREATE_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.CREATE_SPEC, new org.apache.thrift.meta_data.FieldMetaData("createSpec", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CreateSpec.class)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(create_args.class, metaDataMap);
+    }
+
+    public create_args() {
+    }
+
+    public create_args(
+      CuratorProjection projection,
+      CreateSpec createSpec)
+    {
+      this();
+      this.projection = projection;
+      this.createSpec = createSpec;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public create_args(create_args other) {
+      if (other.isSetProjection()) {
+        this.projection = new CuratorProjection(other.projection);
+      }
+      if (other.isSetCreateSpec()) {
+        this.createSpec = new CreateSpec(other.createSpec);
+      }
+    }
+
+    public create_args deepCopy() {
+      return new create_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.projection = null;
+      this.createSpec = null;
+    }
+
+    public CuratorProjection getProjection() {
+      return this.projection;
+    }
+
+    public create_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 CreateSpec getCreateSpec() {
+      return this.createSpec;
+    }
+
+    public create_args setCreateSpec(CreateSpec createSpec) {
+      this.createSpec = createSpec;
+      return this;
+    }
+
+    public void unsetCreateSpec() {
+      this.createSpec = null;
+    }
+
+    /** Returns true if field createSpec is set (has been assigned a value) and false otherwise */
+    public boolean isSetCreateSpec() {
+      return this.createSpec != null;
+    }
+
+    public void setCreateSpecIsSet(boolean value) {
+      if (!value) {
+        this.createSpec = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case PROJECTION:
+        if (value == null) {
+          unsetProjection();
+        } else {
+          setProjection((CuratorProjection)value);
+        }
+        break;
+
+      case CREATE_SPEC:
+        if (value == null) {
+          unsetCreateSpec();
+        } else {
+          setCreateSpec((CreateSpec)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case PROJECTION:
+        return getProjection();
+
+      case CREATE_SPEC:
+        return getCreateSpec();
+
+      }
+      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 CREATE_SPEC:
+        return isSetCreateSpec();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof create_args)
+        return this.equals((create_args)that);
+      return false;
+    }
+
+    public boolean equals(create_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_createSpec = true && this.isSetCreateSpec();
+      boolean that_present_createSpec = true && that.isSetCreateSpec();
+      if (this_present_createSpec || that_present_createSpec) {
+        if (!(this_present_createSpec && that_present_createSpec))
+          return false;
+        if (!this.createSpec.equals(that.createSpec))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(create_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(isSetCreateSpec()).compareTo(other.isSetCreateSpec());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetCreateSpec()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createSpec, other.createSpec);
+        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("create_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("createSpec:");
+      if (this.createSpec == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.createSpec);
+      }
+      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 (createSpec != null) {
+        createSpec.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 create_argsStandardSchemeFactory implements SchemeFactory {
+      public create_argsStandardScheme getScheme() {
+        return new create_argsStandardScheme();
+      }
+    }
+
+    private static class create_argsStandardScheme extends StandardScheme<create_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, create_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: // CREATE_SPEC
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.createSpec = new CreateSpec();
+                struct.createSpec.read(iprot);
+                struct.setCreateSpecIsSet(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, create_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.createSpec != null) {
+          oprot.writeFieldBegin(CREATE_SPEC_FIELD_DESC);
+          struct.createSpec.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class create_argsTupleSchemeFactory implements SchemeFactory {
+      public create_argsTupleScheme getScheme() {
+        return new create_argsTupleScheme();
+      }
+    }
+
+    private static class create_argsTupleScheme extends TupleScheme<create_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, create_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetProjection()) {
+          optionals.set(0);
+        }
+        if (struct.isSetCreateSpec()) {
+          optionals.set(1);
+        }
+        oprot.writeBitSet(optionals, 2);
+        if (struct.isSetProjection()) {
+          struct.projection.write(oprot);
+        }
+        if (struct.isSetCreateSpec()) {
+          struct.createSpec.write(oprot);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, create_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.createSpec = new CreateSpec();
+          struct.createSpec.read(iprot);
+          struct.setCreateSpecIsSet(true);
+        }
+      }
+    }
+
+  }
+
+  public static class create_result implements org.apache.thrift.TBase<create_result, create_result._Fields>, java.io.Serializable, Cloneable, Comparable<create_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("create_result");
+
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new create_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new create_resultTupleSchemeFactory());
+    }
+
+    public String 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.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(create_result.class, metaDataMap);
+    }
+
+    public create_result() {
+    }
+
+    public create_result(
+      String success)
+    {
+      this();
+      this.success = success;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public create_result(create_result other) {
+      if (other.isSetSuccess()) {
+        this.success = other.success;
+      }
+    }
+
+    public create_result deepCopy() {
+      return new create_result(this);
+    }
+
+    @Override
+    public void clear() {
+      this.success = null;
+    }
+
+    public String getSuccess() {
+      return this.success;
+    }
+
+    public create_result setSuccess(String 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((String)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 create_result)
+        return this.equals((create_result)that);
+      return false;
+    }
+
+    public boolean equals(create_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(create_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("create_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 create_resultStandardSchemeFactory implements SchemeFactory {
+      public create_resultStandardScheme getScheme() {
+        return new create_resultStandardScheme();
+      }
+    }
+
+    private static class create_resultStandardScheme extends StandardScheme<create_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, create_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.STRING) {
+                struct.success = iprot.readString();
+                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, create_result struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.success != null) {
+          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+          oprot.writeString(struct.success);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class create_resultTupleSchemeFactory implements SchemeFactory {
+      public create_resultTupleScheme getScheme() {
+        return new create_resultTupleScheme();
+      }
+    }
+
+    private static class create_resultTupleScheme extends TupleScheme<create_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, create_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.writeString(struct.success);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, create_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          struct.success = iprot.readString();
+          struct.setSuccessIsSet(true);
+        }
+      }
+    }
+
+  }
+
+  public static class getNextEvent_args implements org.apache.thrift.TBase<getNextEvent_args, getNextEvent_args._Fields>, java.io.Serializable, Cloneable, Comparable<getNextEvent_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getNextEvent_args");
+
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new getNextEvent_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new getNextEvent_argsTupleSchemeFactory());
+    }
+
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+;
+
+      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) {
+          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;
+      }
+    }
+    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);
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getNextEvent_args.class, metaDataMap);
+    }
+
+    public getNextEvent_args() {
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getNextEvent_args(getNextEvent_args other) {
+    }
+
+    public getNextEvent_args deepCopy() {
+      return new getNextEvent_args(this);
+    }
+
+    @Override
+    public void clear() {
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      }
+      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) {
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getNextEvent_args)
+        return this.equals((getNextEvent_args)that);
+      return false;
+    }
+
+    public boolean equals(getNextEvent_args that) {
+      if (that == null)
+        return false;
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(getNextEvent_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      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("getNextEvent_args(");
+      boolean first = true;
+
+      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 getNextEvent_argsStandardSchemeFactory implements SchemeFactory {
+      public getNextEvent_argsStandardScheme getScheme() {
+        return new getNextEvent_argsStandardScheme();
+      }
+    }
+
+    private static class getNextEvent_argsStandardScheme extends StandardScheme<getNextEvent_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getNextEvent_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) {
+            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, getNextEvent_args struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getNextEvent_argsTupleSchemeFactory implements SchemeFactory {
+      public getNextEvent_argsTupleScheme getScheme() {
+        return new getNextEvent_argsTupleScheme();
+      }
+    }
+
+    private static class getNextEvent_argsTupleScheme extends TupleScheme<getNextEvent_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getNextEvent_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getNextEvent_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+      }
+    }
+
+  }
+
+  public static class getNextEvent_result implements org.apache.thrift.TBase<getNextEvent_result, getNextEvent_result._Fields>, java.io.Serializable, Cloneable, Comparable<getNextEvent_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getNextEvent_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 getNextEvent_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new getNextEvent_resultTupleSchemeFactory());
+    }
+
+    public CuratorEvent 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, CuratorEvent.class)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getNextEvent_result.class, metaDataMap);
+    }
+
+    public getNextEvent_result() {
+    }
+
+    public getNextEvent_result(
+      CuratorEvent success)
+    {
+      this();
+      this.success = success;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getNextEvent_result(getNextEvent_result other) {
+      if (other.isSetSuccess()) {
+        this.success = new CuratorEvent(other.success);
+      }
+    }
+
+    public getNextEvent_result deepCopy() {
+      return new getNextEvent_result(this);
+    }
+
+    @Override
+    public void clear() {
+     

<TRUNCATED>

[13/14] git commit: wip

Posted by ra...@apache.org.
wip


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

Branch: refs/heads/curator-rpc
Commit: 099df94a1453db319b2a5fe4eaa7ff4a5dadf518
Parents: c8d49ae
Author: randgalt <ra...@apache.org>
Authored: Mon May 26 20:11:27 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon May 26 20:11:27 2014 -0500

----------------------------------------------------------------------
 .../org/apache/curator/x/rpc/CuratorEntry.java  |  72 +++++++
 .../curator/x/rpc/CuratorProjectionServer.java  |   2 +-
 .../org/apache/curator/x/rpc/RpcManager.java    |  53 +----
 .../curator/x/rpc/idl/event/EventService.java   |  36 +---
 .../x/rpc/idl/event/RpcCuratorEvent.java        |  11 +-
 .../projection/CuratorProjectionService.java    |  31 +--
 curator-x-rpc/src/main/thrift/curator.thrift    |   3 +-
 .../apache/curator/generated/CuratorEvent.java  | 147 ++------------
 .../apache/curator/generated/EventService.java  | 193 +++++++------------
 .../org/apache/curator/x/rpc/TestClient.java    |   3 +-
 10 files changed, 202 insertions(+), 349 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/099df94a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorEntry.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorEntry.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorEntry.java
new file mode 100644
index 0000000..61f97f3
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorEntry.java
@@ -0,0 +1,72 @@
+package org.apache.curator.x.rpc;
+
+import com.google.common.collect.Queues;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.x.rpc.idl.event.RpcCuratorEvent;
+import java.io.Closeable;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
+
+public class CuratorEntry implements Closeable
+{
+    private final CuratorFramework client;
+    private final AtomicLong lastAccessEpoch = new AtomicLong(0);
+    private final BlockingQueue<RpcCuratorEvent> events = Queues.newLinkedBlockingQueue();
+    private final AtomicReference<State> state = new AtomicReference<State>(State.OPEN);
+
+    private enum State
+    {
+        OPEN,
+        CLOSED
+    }
+
+    public CuratorEntry(CuratorFramework client)
+    {
+        this.client = client;
+        updateLastAccess();
+    }
+
+    @Override
+    public void close()
+    {
+        if ( state.compareAndSet(State.OPEN, State.CLOSED) )
+        {
+            client.close();
+            events.clear();
+        }
+    }
+
+    public RpcCuratorEvent pollForEvent(int maxWaitMs) throws InterruptedException
+    {
+        if ( state.get() == State.OPEN )
+        {
+            return events.poll(maxWaitMs, TimeUnit.MILLISECONDS);
+        }
+        return null;
+    }
+
+    public void addEvent(RpcCuratorEvent event)
+    {
+        if ( state.get() == State.OPEN )
+        {
+            events.offer(event);
+        }
+    }
+
+    public void updateLastAccess()
+    {
+        lastAccessEpoch.set(System.currentTimeMillis());
+    }
+
+    public CuratorFramework getClient()
+    {
+        return (state.get() == State.OPEN) ? client : null;
+    }
+
+    public long getLastAccessEpoch()
+    {
+        return lastAccessEpoch.get();
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/099df94a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
index f5d5649..6f94902 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
@@ -33,7 +33,7 @@ public class CuratorProjectionServer
     {
         RpcManager rpcManager = new RpcManager();
         EventService eventService = new EventService(rpcManager, 5000); // TODO
-        CuratorProjectionService projectionService = new CuratorProjectionService(rpcManager, eventService);
+        CuratorProjectionService projectionService = new CuratorProjectionService(rpcManager);
         ThriftServiceProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), Lists.<ThriftEventHandler>newArrayList(), projectionService, eventService);
         ThriftServer server = new ThriftServer(processor, new ThriftServerConfig().setPort(8899));  // TODO
         server.start();

http://git-wip-us.apache.org/repos/asf/curator/blob/099df94a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
index bdc5138..dcfa2a0 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
@@ -2,67 +2,26 @@ package org.apache.curator.x.rpc;
 
 import com.google.common.collect.Maps;
 import org.apache.curator.framework.CuratorFramework;
-import java.util.List;
 import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
 
 public class RpcManager
 {
     private final Map<String, CuratorEntry> projections = Maps.newConcurrentMap();
 
-    private static class CuratorEntry
-    {
-        private final CuratorFramework client;
-        private final AtomicLong lastAccessEpoch = new AtomicLong(0);
-
-        private CuratorEntry(CuratorFramework client)
-        {
-            this.client = client;
-            updateLastAccess();
-        }
-
-        void updateLastAccess()
-        {
-            lastAccessEpoch.set(System.currentTimeMillis());
-        }
-    }
-
     public void add(String id, CuratorFramework client)
     {
         projections.put(id, new CuratorEntry(client));
     }
 
-    public void updateLastAccess(String id)
-    {
-        CuratorEntry entry = projections.get(id);
-        if ( entry != null )
-        {
-            entry.updateLastAccess();
-        }
-    }
-
-    public CuratorFramework getClient(String id)
-    {
-        CuratorEntry entry = projections.get(id);
-        if ( entry != null )
-        {
-            entry.updateLastAccess();
-            return entry.client;
-        }
-        return null;
-    }
-
-    public CuratorFramework removeClient(String id)
+    public CuratorEntry get(String id)
     {
-        CuratorEntry entry = projections.remove(id);
-        return (entry != null) ? entry.client : null;
+        CuratorEntry curatorEntry = projections.get(id);
+        curatorEntry.updateLastAccess();
+        return curatorEntry;
     }
 
-    public void touch(List<String> ids)
+    public CuratorEntry remove(String id)
     {
-        for ( String id : ids )
-        {
-            getClient(id);
-        }
+        return projections.remove(id);
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/099df94a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
index 3b7cde9..939eaeb 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
@@ -2,20 +2,13 @@ package org.apache.curator.x.rpc.idl.event;
 
 import com.facebook.swift.service.ThriftMethod;
 import com.facebook.swift.service.ThriftService;
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Queues;
+import org.apache.curator.x.rpc.CuratorEntry;
 import org.apache.curator.x.rpc.RpcManager;
 import org.apache.curator.x.rpc.idl.projection.CuratorProjection;
-import javax.annotation.Nullable;
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.TimeUnit;
 
 @ThriftService("EventService")
 public class EventService
 {
-    private final BlockingQueue<RpcCuratorEvent> events = Queues.newLinkedBlockingQueue();
     private final RpcManager rpcManager;
     private final int pingTimeMs;
 
@@ -25,31 +18,16 @@ public class EventService
         this.pingTimeMs = pingTimeMs;
     }
 
-    public void addEvent(RpcCuratorEvent event)
-    {
-        events.offer(event);
-    }
-
     @ThriftMethod
-    public RpcCuratorEvent getNextEvent(List<CuratorProjection> projections) throws InterruptedException
+    public RpcCuratorEvent getNextEvent(CuratorProjection projection) throws InterruptedException
     {
-        if ( projections != null )
+        CuratorEntry entry = rpcManager.get(projection.id);
+        if ( entry == null )
         {
-            List<String> ids = Lists.transform
-            (
-                projections,
-                new Function<CuratorProjection, String>()
-                {
-                    @Override
-                    public String apply(CuratorProjection projection)
-                    {
-                        return projection.id;
-                    }
-                }
-            );
-            rpcManager.touch(ids);
+            // TODO
+            return null;
         }
-        RpcCuratorEvent event = events.poll(pingTimeMs, TimeUnit.MILLISECONDS);
+        RpcCuratorEvent event = entry.pollForEvent(pingTimeMs);
         return (event != null) ? event : new RpcCuratorEvent();
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/099df94a/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 38a5ec3..c6802e4 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
@@ -25,7 +25,6 @@ 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.curator.x.rpc.idl.projection.CuratorProjection;
 import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.data.ACL;
@@ -37,9 +36,6 @@ import java.util.List;
 @ThriftStruct("CuratorEvent")
 public class RpcCuratorEvent
 {
-    @ThriftField(1)
-    public CuratorProjection projection;
-
     @ThriftField(2)
     public RpcCuratorEventType type;
 
@@ -72,7 +68,6 @@ public class RpcCuratorEvent
 
     public RpcCuratorEvent()
     {
-        this.projection = null;
         this.type = RpcCuratorEventType.PING;
         this.resultCode = 0;
         this.path = null;
@@ -85,9 +80,8 @@ public class RpcCuratorEvent
         this.watchedEvent = null;
     }
 
-    public RpcCuratorEvent(CuratorProjection projection, CuratorEvent event)
+    public RpcCuratorEvent(CuratorEvent event)
     {
-        this.projection = projection;
         this.type = toRpcCuratorEventType(event.getType());
         this.resultCode = event.getResultCode();
         this.path = event.getPath();
@@ -100,9 +94,8 @@ public class RpcCuratorEvent
         this.watchedEvent = toRpcWatchedEvent(event.getWatchedEvent());
     }
 
-    public RpcCuratorEvent(CuratorProjection projection, ConnectionState newState)
+    public RpcCuratorEvent(ConnectionState newState)
     {
-        this.projection = projection;
         this.type = toRpcCuratorEventType(newState);
         this.resultCode = 0;
         this.path = null;

http://git-wip-us.apache.org/repos/asf/curator/blob/099df94a/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 bca32d9..81f8838 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
@@ -33,8 +33,8 @@ import org.apache.curator.framework.api.PathAndBytesable;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.x.rpc.CuratorEntry;
 import org.apache.curator.x.rpc.RpcManager;
-import org.apache.curator.x.rpc.idl.event.EventService;
 import org.apache.curator.x.rpc.idl.event.RpcCuratorEvent;
 import java.util.UUID;
 
@@ -42,12 +42,10 @@ import java.util.UUID;
 public class CuratorProjectionService
 {
     private final RpcManager rpcManager;
-    private final EventService eventService;
 
-    public CuratorProjectionService(RpcManager rpcManager, EventService eventService)
+    public CuratorProjectionService(RpcManager rpcManager)
     {
         this.rpcManager = rpcManager;
-        this.eventService = eventService;
     }
 
     @ThriftMethod
@@ -64,7 +62,7 @@ public class CuratorProjectionService
             @Override
             public void stateChanged(CuratorFramework client, ConnectionState newState)
             {
-                eventService.addEvent(new RpcCuratorEvent(projection, newState));
+                addEvent(projection, new RpcCuratorEvent(newState));
             }
         };
         client.getConnectionStateListenable().addListener(listener);
@@ -72,13 +70,22 @@ public class CuratorProjectionService
         return projection;
     }
 
+    private void addEvent(CuratorProjection projection, RpcCuratorEvent event)
+    {
+        CuratorEntry entry = rpcManager.get(projection.id);
+        if ( entry != null )
+        {
+            entry.addEvent(event);
+        }
+    }
+
     @ThriftMethod
     public void closeCuratorProjection(CuratorProjection projection)
     {
-        CuratorFramework client = rpcManager.removeClient(projection.id);
-        if ( client != null )
+        CuratorEntry entry = rpcManager.remove(projection.id);
+        if ( entry != null )
         {
-            client.close();
+            entry.close();
         }
     }
 
@@ -112,7 +119,7 @@ public class CuratorProjectionService
                 @Override
                 public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
                 {
-                    eventService.addEvent(new RpcCuratorEvent(projection, event));
+                    addEvent(projection, new RpcCuratorEvent(event));
                 }
             };
             builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
@@ -150,12 +157,12 @@ public class CuratorProjectionService
 
     private CuratorFramework getClient(CuratorProjection projection) throws Exception
     {
-        CuratorFramework client = rpcManager.getClient(projection.id);
-        if ( client == null )
+        CuratorEntry entry = rpcManager.get(projection.id);
+        if ( entry == null )
         {
             throw new Exception("No client found with id: " + projection.id);
         }
-        return client;
+        return entry.getClient();
     }
 
     private static <T> T castBuilder(Object createBuilder, Class<T> clazz) throws Exception

http://git-wip-us.apache.org/repos/asf/curator/blob/099df94a/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 100f456..eac5649 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -67,7 +67,6 @@ struct Acl {
 }
 
 struct CuratorEvent {
-  1: CuratorProjection projection;
   2: CuratorEventType type;
   3: i32 resultCode;
   4: string path;
@@ -87,5 +86,5 @@ service CuratorService {
 }
 
 service EventService {
-  CuratorEvent getNextEvent(1: list<CuratorProjection> projections);
+  CuratorEvent getNextEvent(1: CuratorProjection projection);
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/099df94a/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 41e57dc..8674d26 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
@@ -35,7 +35,6 @@ import org.slf4j.LoggerFactory;
 public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, CuratorEvent._Fields>, java.io.Serializable, Cloneable, Comparable<CuratorEvent> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CuratorEvent");
 
-  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 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 RESULT_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("resultCode", org.apache.thrift.protocol.TType.I32, (short)3);
   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)4);
@@ -53,7 +52,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
     schemes.put(TupleScheme.class, new CuratorEventTupleSchemeFactory());
   }
 
-  public CuratorProjection projection; // required
   /**
    * 
    * @see CuratorEventType
@@ -71,7 +69,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
 
   /** 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"),
     /**
      * 
      * @see CuratorEventType
@@ -100,8 +97,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
      */
     public static _Fields findByThriftId(int fieldId) {
       switch(fieldId) {
-        case 1: // PROJECTION
-          return PROJECTION;
         case 2: // TYPE
           return TYPE;
         case 3: // RESULT_CODE
@@ -167,8 +162,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
   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.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, CuratorEventType.class)));
     tmpMap.put(_Fields.RESULT_CODE, new org.apache.thrift.meta_data.FieldMetaData("resultCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
@@ -199,7 +192,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
   }
 
   public CuratorEvent(
-    CuratorProjection projection,
     CuratorEventType type,
     int resultCode,
     String path,
@@ -212,7 +204,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
     WatchedEvent watchedEvent)
   {
     this();
-    this.projection = projection;
     this.type = type;
     this.resultCode = resultCode;
     setResultCodeIsSet(true);
@@ -231,9 +222,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
    */
   public CuratorEvent(CuratorEvent other) {
     __isset_bitfield = other.__isset_bitfield;
-    if (other.isSetProjection()) {
-      this.projection = new CuratorProjection(other.projection);
-    }
     if (other.isSetType()) {
       this.type = other.type;
     }
@@ -276,7 +264,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
 
   @Override
   public void clear() {
-    this.projection = null;
     this.type = null;
     setResultCodeIsSet(false);
     this.resultCode = 0;
@@ -290,30 +277,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
     this.watchedEvent = null;
   }
 
-  public CuratorProjection getProjection() {
-    return this.projection;
-  }
-
-  public CuratorEvent 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;
-    }
-  }
-
   /**
    * 
    * @see CuratorEventType
@@ -603,14 +566,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
 
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
-    case PROJECTION:
-      if (value == null) {
-        unsetProjection();
-      } else {
-        setProjection((CuratorProjection)value);
-      }
-      break;
-
     case TYPE:
       if (value == null) {
         unsetType();
@@ -696,9 +651,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
 
   public Object getFieldValue(_Fields field) {
     switch (field) {
-    case PROJECTION:
-      return getProjection();
-
     case TYPE:
       return getType();
 
@@ -740,8 +692,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
     }
 
     switch (field) {
-    case PROJECTION:
-      return isSetProjection();
     case TYPE:
       return isSetType();
     case RESULT_CODE:
@@ -779,15 +729,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
     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_type = true && this.isSetType();
     boolean that_present_type = true && that.isSetType();
     if (this_present_type || that_present_type) {
@@ -894,16 +835,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
 
     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(isSetType()).compareTo(other.isSetType());
     if (lastComparison != 0) {
       return lastComparison;
@@ -1024,14 +955,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
     StringBuilder sb = new StringBuilder("CuratorEvent(");
     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("type:");
     if (this.type == null) {
       sb.append("null");
@@ -1114,9 +1037,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
   public void validate() throws org.apache.thrift.TException {
     // check for required fields
     // check for sub-struct validity
-    if (projection != null) {
-      projection.validate();
-    }
     if (stat != null) {
       stat.validate();
     }
@@ -1161,15 +1081,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
           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: // TYPE
             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
               struct.type = CuratorEventType.findByValue(iprot.readI32());
@@ -1288,11 +1199,6 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
       struct.validate();
 
       oprot.writeStructBegin(STRUCT_DESC);
-      if (struct.projection != null) {
-        oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
-        struct.projection.write(oprot);
-        oprot.writeFieldEnd();
-      }
       if (struct.type != null) {
         oprot.writeFieldBegin(TYPE_FIELD_DESC);
         oprot.writeI32(struct.type.getValue());
@@ -1373,43 +1279,37 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
     public void write(org.apache.thrift.protocol.TProtocol prot, CuratorEvent struct) throws org.apache.thrift.TException {
       TTupleProtocol oprot = (TTupleProtocol) prot;
       BitSet optionals = new BitSet();
-      if (struct.isSetProjection()) {
-        optionals.set(0);
-      }
       if (struct.isSetType()) {
-        optionals.set(1);
+        optionals.set(0);
       }
       if (struct.isSetResultCode()) {
-        optionals.set(2);
+        optionals.set(1);
       }
       if (struct.isSetPath()) {
-        optionals.set(3);
+        optionals.set(2);
       }
       if (struct.isSetContext()) {
-        optionals.set(4);
+        optionals.set(3);
       }
       if (struct.isSetStat()) {
-        optionals.set(5);
+        optionals.set(4);
       }
       if (struct.isSetData()) {
-        optionals.set(6);
+        optionals.set(5);
       }
       if (struct.isSetName()) {
-        optionals.set(7);
+        optionals.set(6);
       }
       if (struct.isSetChildren()) {
-        optionals.set(8);
+        optionals.set(7);
       }
       if (struct.isSetAclList()) {
-        optionals.set(9);
+        optionals.set(8);
       }
       if (struct.isSetWatchedEvent()) {
-        optionals.set(10);
-      }
-      oprot.writeBitSet(optionals, 11);
-      if (struct.isSetProjection()) {
-        struct.projection.write(oprot);
+        optionals.set(9);
       }
+      oprot.writeBitSet(optionals, 10);
       if (struct.isSetType()) {
         oprot.writeI32(struct.type.getValue());
       }
@@ -1457,42 +1357,37 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
     @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(10);
       if (incoming.get(0)) {
-        struct.projection = new CuratorProjection();
-        struct.projection.read(iprot);
-        struct.setProjectionIsSet(true);
-      }
-      if (incoming.get(1)) {
         struct.type = CuratorEventType.findByValue(iprot.readI32());
         struct.setTypeIsSet(true);
       }
-      if (incoming.get(2)) {
+      if (incoming.get(1)) {
         struct.resultCode = iprot.readI32();
         struct.setResultCodeIsSet(true);
       }
-      if (incoming.get(3)) {
+      if (incoming.get(2)) {
         struct.path = iprot.readString();
         struct.setPathIsSet(true);
       }
-      if (incoming.get(4)) {
+      if (incoming.get(3)) {
         struct.context = iprot.readString();
         struct.setContextIsSet(true);
       }
-      if (incoming.get(5)) {
+      if (incoming.get(4)) {
         struct.stat = new Stat();
         struct.stat.read(iprot);
         struct.setStatIsSet(true);
       }
-      if (incoming.get(6)) {
+      if (incoming.get(5)) {
         struct.data = iprot.readBinary();
         struct.setDataIsSet(true);
       }
-      if (incoming.get(7)) {
+      if (incoming.get(6)) {
         struct.name = iprot.readString();
         struct.setNameIsSet(true);
       }
-      if (incoming.get(8)) {
+      if (incoming.get(7)) {
         {
           org.apache.thrift.protocol.TList _list10 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
           struct.children = new ArrayList<String>(_list10.size);
@@ -1505,7 +1400,7 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
         }
         struct.setChildrenIsSet(true);
       }
-      if (incoming.get(9)) {
+      if (incoming.get(8)) {
         {
           org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
           struct.aclList = new ArrayList<Acl>(_list13.size);
@@ -1519,7 +1414,7 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
         }
         struct.setAclListIsSet(true);
       }
-      if (incoming.get(10)) {
+      if (incoming.get(9)) {
         struct.watchedEvent = new WatchedEvent();
         struct.watchedEvent.read(iprot);
         struct.setWatchedEventIsSet(true);

http://git-wip-us.apache.org/repos/asf/curator/blob/099df94a/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
index 7b41888..3f9f332 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
@@ -36,13 +36,13 @@ public class EventService {
 
   public interface Iface {
 
-    public CuratorEvent getNextEvent(List<CuratorProjection> projections) throws org.apache.thrift.TException;
+    public CuratorEvent getNextEvent(CuratorProjection projection) throws org.apache.thrift.TException;
 
   }
 
   public interface AsyncIface {
 
-    public void getNextEvent(List<CuratorProjection> projections, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+    public void getNextEvent(CuratorProjection projection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
 
   }
 
@@ -66,16 +66,16 @@ public class EventService {
       super(iprot, oprot);
     }
 
-    public CuratorEvent getNextEvent(List<CuratorProjection> projections) throws org.apache.thrift.TException
+    public CuratorEvent getNextEvent(CuratorProjection projection) throws org.apache.thrift.TException
     {
-      send_getNextEvent(projections);
+      send_getNextEvent(projection);
       return recv_getNextEvent();
     }
 
-    public void send_getNextEvent(List<CuratorProjection> projections) throws org.apache.thrift.TException
+    public void send_getNextEvent(CuratorProjection projection) throws org.apache.thrift.TException
     {
       getNextEvent_args args = new getNextEvent_args();
-      args.setProjections(projections);
+      args.setProjection(projection);
       sendBase("getNextEvent", args);
     }
 
@@ -107,24 +107,24 @@ public class EventService {
       super(protocolFactory, clientManager, transport);
     }
 
-    public void getNextEvent(List<CuratorProjection> projections, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+    public void getNextEvent(CuratorProjection projection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
       checkReady();
-      getNextEvent_call method_call = new getNextEvent_call(projections, resultHandler, this, ___protocolFactory, ___transport);
+      getNextEvent_call method_call = new getNextEvent_call(projection, resultHandler, this, ___protocolFactory, ___transport);
       this.___currentMethod = method_call;
       ___manager.call(method_call);
     }
 
     public static class getNextEvent_call extends org.apache.thrift.async.TAsyncMethodCall {
-      private List<CuratorProjection> projections;
-      public getNextEvent_call(List<CuratorProjection> projections, 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 {
+      private CuratorProjection projection;
+      public getNextEvent_call(CuratorProjection projection, 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.projections = projections;
+        this.projection = projection;
       }
 
       public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
         prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getNextEvent", org.apache.thrift.protocol.TMessageType.CALL, 0));
         getNextEvent_args args = new getNextEvent_args();
-        args.setProjections(projections);
+        args.setProjection(projection);
         args.write(prot);
         prot.writeMessageEnd();
       }
@@ -171,7 +171,7 @@ public class EventService {
 
       public getNextEvent_result getResult(I iface, getNextEvent_args args) throws org.apache.thrift.TException {
         getNextEvent_result result = new getNextEvent_result();
-        result.success = iface.getNextEvent(args.projections);
+        result.success = iface.getNextEvent(args.projection);
         return result;
       }
     }
@@ -240,7 +240,7 @@ public class EventService {
       }
 
       public void start(I iface, getNextEvent_args args, org.apache.thrift.async.AsyncMethodCallback<CuratorEvent> resultHandler) throws TException {
-        iface.getNextEvent(args.projections,resultHandler);
+        iface.getNextEvent(args.projection,resultHandler);
       }
     }
 
@@ -249,7 +249,7 @@ public class EventService {
   public static class getNextEvent_args implements org.apache.thrift.TBase<getNextEvent_args, getNextEvent_args._Fields>, java.io.Serializable, Cloneable, Comparable<getNextEvent_args>   {
     private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getNextEvent_args");
 
-    private static final org.apache.thrift.protocol.TField PROJECTIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("projections", org.apache.thrift.protocol.TType.LIST, (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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
     static {
@@ -257,11 +257,11 @@ public class EventService {
       schemes.put(TupleScheme.class, new getNextEvent_argsTupleSchemeFactory());
     }
 
-    public List<CuratorProjection> projections; // required
+    public CuratorProjection 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 {
-      PROJECTIONS((short)1, "projections");
+      PROJECTION((short)1, "projection");
 
       private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -276,8 +276,8 @@ public class EventService {
        */
       public static _Fields findByThriftId(int fieldId) {
         switch(fieldId) {
-          case 1: // PROJECTIONS
-            return PROJECTIONS;
+          case 1: // PROJECTION
+            return PROJECTION;
           default:
             return null;
         }
@@ -321,9 +321,8 @@ public class EventService {
     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.PROJECTIONS, new org.apache.thrift.meta_data.FieldMetaData("projections", 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, CuratorProjection.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)));
       metaDataMap = Collections.unmodifiableMap(tmpMap);
       org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getNextEvent_args.class, metaDataMap);
     }
@@ -332,22 +331,18 @@ public class EventService {
     }
 
     public getNextEvent_args(
-      List<CuratorProjection> projections)
+      CuratorProjection projection)
     {
       this();
-      this.projections = projections;
+      this.projection = projection;
     }
 
     /**
      * Performs a deep copy on <i>other</i>.
      */
     public getNextEvent_args(getNextEvent_args other) {
-      if (other.isSetProjections()) {
-        List<CuratorProjection> __this__projections = new ArrayList<CuratorProjection>(other.projections.size());
-        for (CuratorProjection other_element : other.projections) {
-          __this__projections.add(new CuratorProjection(other_element));
-        }
-        this.projections = __this__projections;
+      if (other.isSetProjection()) {
+        this.projection = new CuratorProjection(other.projection);
       }
     }
 
@@ -357,55 +352,40 @@ public class EventService {
 
     @Override
     public void clear() {
-      this.projections = null;
-    }
-
-    public int getProjectionsSize() {
-      return (this.projections == null) ? 0 : this.projections.size();
-    }
-
-    public java.util.Iterator<CuratorProjection> getProjectionsIterator() {
-      return (this.projections == null) ? null : this.projections.iterator();
+      this.projection = null;
     }
 
-    public void addToProjections(CuratorProjection elem) {
-      if (this.projections == null) {
-        this.projections = new ArrayList<CuratorProjection>();
-      }
-      this.projections.add(elem);
-    }
-
-    public List<CuratorProjection> getProjections() {
-      return this.projections;
+    public CuratorProjection getProjection() {
+      return this.projection;
     }
 
-    public getNextEvent_args setProjections(List<CuratorProjection> projections) {
-      this.projections = projections;
+    public getNextEvent_args setProjection(CuratorProjection projection) {
+      this.projection = projection;
       return this;
     }
 
-    public void unsetProjections() {
-      this.projections = null;
+    public void unsetProjection() {
+      this.projection = null;
     }
 
-    /** Returns true if field projections is set (has been assigned a value) and false otherwise */
-    public boolean isSetProjections() {
-      return this.projections != 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 setProjectionsIsSet(boolean value) {
+    public void setProjectionIsSet(boolean value) {
       if (!value) {
-        this.projections = null;
+        this.projection = null;
       }
     }
 
     public void setFieldValue(_Fields field, Object value) {
       switch (field) {
-      case PROJECTIONS:
+      case PROJECTION:
         if (value == null) {
-          unsetProjections();
+          unsetProjection();
         } else {
-          setProjections((List<CuratorProjection>)value);
+          setProjection((CuratorProjection)value);
         }
         break;
 
@@ -414,8 +394,8 @@ public class EventService {
 
     public Object getFieldValue(_Fields field) {
       switch (field) {
-      case PROJECTIONS:
-        return getProjections();
+      case PROJECTION:
+        return getProjection();
 
       }
       throw new IllegalStateException();
@@ -428,8 +408,8 @@ public class EventService {
       }
 
       switch (field) {
-      case PROJECTIONS:
-        return isSetProjections();
+      case PROJECTION:
+        return isSetProjection();
       }
       throw new IllegalStateException();
     }
@@ -447,12 +427,12 @@ public class EventService {
       if (that == null)
         return false;
 
-      boolean this_present_projections = true && this.isSetProjections();
-      boolean that_present_projections = true && that.isSetProjections();
-      if (this_present_projections || that_present_projections) {
-        if (!(this_present_projections && that_present_projections))
+      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.projections.equals(that.projections))
+        if (!this.projection.equals(that.projection))
           return false;
       }
 
@@ -472,12 +452,12 @@ public class EventService {
 
       int lastComparison = 0;
 
-      lastComparison = Boolean.valueOf(isSetProjections()).compareTo(other.isSetProjections());
+      lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
       if (lastComparison != 0) {
         return lastComparison;
       }
-      if (isSetProjections()) {
-        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projections, other.projections);
+      if (isSetProjection()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
         if (lastComparison != 0) {
           return lastComparison;
         }
@@ -502,11 +482,11 @@ public class EventService {
       StringBuilder sb = new StringBuilder("getNextEvent_args(");
       boolean first = true;
 
-      sb.append("projections:");
-      if (this.projections == null) {
+      sb.append("projection:");
+      if (this.projection == null) {
         sb.append("null");
       } else {
-        sb.append(this.projections);
+        sb.append(this.projection);
       }
       first = false;
       sb.append(")");
@@ -516,6 +496,9 @@ public class EventService {
     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 {
@@ -552,21 +535,11 @@ public class EventService {
             break;
           }
           switch (schemeField.id) {
-            case 1: // PROJECTIONS
-              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
-                {
-                  org.apache.thrift.protocol.TList _list16 = iprot.readListBegin();
-                  struct.projections = new ArrayList<CuratorProjection>(_list16.size);
-                  for (int _i17 = 0; _i17 < _list16.size; ++_i17)
-                  {
-                    CuratorProjection _elem18;
-                    _elem18 = new CuratorProjection();
-                    _elem18.read(iprot);
-                    struct.projections.add(_elem18);
-                  }
-                  iprot.readListEnd();
-                }
-                struct.setProjectionsIsSet(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);
               }
@@ -586,16 +559,9 @@ public class EventService {
         struct.validate();
 
         oprot.writeStructBegin(STRUCT_DESC);
-        if (struct.projections != null) {
-          oprot.writeFieldBegin(PROJECTIONS_FIELD_DESC);
-          {
-            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.projections.size()));
-            for (CuratorProjection _iter19 : struct.projections)
-            {
-              _iter19.write(oprot);
-            }
-            oprot.writeListEnd();
-          }
+        if (struct.projection != null) {
+          oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
+          struct.projection.write(oprot);
           oprot.writeFieldEnd();
         }
         oprot.writeFieldStop();
@@ -616,18 +582,12 @@ public class EventService {
       public void write(org.apache.thrift.protocol.TProtocol prot, getNextEvent_args struct) throws org.apache.thrift.TException {
         TTupleProtocol oprot = (TTupleProtocol) prot;
         BitSet optionals = new BitSet();
-        if (struct.isSetProjections()) {
+        if (struct.isSetProjection()) {
           optionals.set(0);
         }
         oprot.writeBitSet(optionals, 1);
-        if (struct.isSetProjections()) {
-          {
-            oprot.writeI32(struct.projections.size());
-            for (CuratorProjection _iter20 : struct.projections)
-            {
-              _iter20.write(oprot);
-            }
-          }
+        if (struct.isSetProjection()) {
+          struct.projection.write(oprot);
         }
       }
 
@@ -636,18 +596,9 @@ public class EventService {
         TTupleProtocol iprot = (TTupleProtocol) prot;
         BitSet incoming = iprot.readBitSet(1);
         if (incoming.get(0)) {
-          {
-            org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
-            struct.projections = new ArrayList<CuratorProjection>(_list21.size);
-            for (int _i22 = 0; _i22 < _list21.size; ++_i22)
-            {
-              CuratorProjection _elem23;
-              _elem23 = new CuratorProjection();
-              _elem23.read(iprot);
-              struct.projections.add(_elem23);
-            }
-          }
-          struct.setProjectionsIsSet(true);
+          struct.projection = new CuratorProjection();
+          struct.projection.read(iprot);
+          struct.setProjectionIsSet(true);
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/curator/blob/099df94a/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 79cea30..dd1561a 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
@@ -29,7 +29,6 @@ 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.util.Arrays;
 import java.util.concurrent.Executors;
 
 public class TestClient
@@ -62,7 +61,7 @@ public class TestClient
                         //noinspection InfiniteLoopStatement
                         for(;;)
                         {
-                            CuratorEvent nextEvent = serviceClient.getNextEvent(Arrays.asList(curatorProjection));
+                            CuratorEvent nextEvent = serviceClient.getNextEvent(curatorProjection);
                             System.out.println(nextEvent.type);
                         }
                     }


[10/14] git commit: wip

Posted by ra...@apache.org.
wip


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

Branch: refs/heads/curator-rpc
Commit: 16836aa8874fd654a5bc66adad81dc2b6749899c
Parents: 5fe11f8
Author: randgalt <ra...@apache.org>
Authored: Mon May 26 09:20:32 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon May 26 09:20:32 2014 -0500

----------------------------------------------------------------------
 .../curator/x/rpc/CuratorProjectionServer.java  |   6 +-
 .../curator/x/rpc/idl/event/EventService.java   |  24 +
 .../projection/CuratorProjectionService.java    |  88 +-
 curator-x-rpc/src/main/thrift/curator.thrift    |   5 +-
 .../curator/generated/CuratorService.java       | 733 ----------------
 .../apache/curator/generated/EventService.java  | 850 +++++++++++++++++++
 .../org/apache/curator/x/rpc/TestClient.java    |  44 +-
 7 files changed, 991 insertions(+), 759 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/16836aa8/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
index 70e6d6a..6fcc6d7 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
@@ -24,14 +24,16 @@ import com.facebook.swift.service.ThriftServer;
 import com.facebook.swift.service.ThriftServerConfig;
 import com.facebook.swift.service.ThriftServiceProcessor;
 import com.google.common.collect.Lists;
+import org.apache.curator.x.rpc.idl.event.EventService;
 import org.apache.curator.x.rpc.idl.projection.CuratorProjectionService;
 
 public class CuratorProjectionServer
 {
     public static void main(String[] args)
     {
-        CuratorProjectionService projectionService = new CuratorProjectionService();
-        ThriftServiceProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), Lists.<ThriftEventHandler>newArrayList(), projectionService);
+        EventService eventService = new EventService();
+        CuratorProjectionService projectionService = new CuratorProjectionService(eventService);
+        ThriftServiceProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), Lists.<ThriftEventHandler>newArrayList(), projectionService, eventService);
         ThriftServer server = new ThriftServer(processor, new ThriftServerConfig().setPort(8899));  // TODO
         server.start();
     }

http://git-wip-us.apache.org/repos/asf/curator/blob/16836aa8/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
new file mode 100644
index 0000000..c79fa20
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
@@ -0,0 +1,24 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.service.ThriftMethod;
+import com.facebook.swift.service.ThriftService;
+import com.google.common.collect.Queues;
+import java.util.concurrent.BlockingQueue;
+
+@ThriftService("EventService")
+public class EventService
+{
+    private final BlockingQueue<RpcCuratorEvent> events = Queues.newLinkedBlockingQueue();
+
+    public void addEvent(RpcCuratorEvent event)
+    {
+        events.offer(event);
+    }
+
+    @ThriftMethod
+    public RpcCuratorEvent getNextEvent() throws InterruptedException
+    {
+        System.out.println(Thread.currentThread() + "getNextEvent");
+        return events.take();
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/16836aa8/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 cf5e861..f6e4757 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,7 +21,6 @@ package org.apache.curator.x.rpc.idl.projection;
 import com.facebook.swift.service.ThriftMethod;
 import com.facebook.swift.service.ThriftService;
 import com.google.common.collect.Maps;
-import com.google.common.collect.Queues;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.api.BackgroundCallback;
@@ -30,22 +29,97 @@ import org.apache.curator.framework.api.Compressible;
 import org.apache.curator.framework.api.CreateBuilder;
 import org.apache.curator.framework.api.CreateModable;
 import org.apache.curator.framework.api.CuratorEvent;
+import org.apache.curator.framework.api.CuratorEventType;
 import org.apache.curator.framework.api.PathAndBytesable;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.x.rpc.idl.event.EventService;
 import org.apache.curator.x.rpc.idl.event.RpcCuratorEvent;
+import org.apache.zookeeper.WatchedEvent;
+import org.apache.zookeeper.data.ACL;
+import org.apache.zookeeper.data.Stat;
+import java.util.List;
 import java.util.Map;
 import java.util.UUID;
-import java.util.concurrent.BlockingQueue;
 
 @ThriftService("CuratorService")
 public class CuratorProjectionService
 {
     private final Map<String, CuratorFramework> projections = Maps.newConcurrentMap();
-    private final BlockingQueue<RpcCuratorEvent> events = Queues.newLinkedBlockingQueue();
+    private final EventService eventService;
+
+    public CuratorProjectionService(EventService eventService)
+    {
+        this.eventService = eventService;
+    }
 
     @ThriftMethod
     public CuratorProjection newCuratorProjection(CuratorProjectionSpec spec)   // TODO
     {
+        System.out.println(Thread.currentThread() + "newCuratorProjection");
+
+        eventService.addEvent(new RpcCuratorEvent(null, new CuratorEvent()
+        {
+            @Override
+            public CuratorEventType getType()
+            {
+                return CuratorEventType.CHILDREN;
+            }
+
+            @Override
+            public int getResultCode()
+            {
+                return 1;
+            }
+
+            @Override
+            public String getPath()
+            {
+                return null;
+            }
+
+            @Override
+            public Object getContext()
+            {
+                return null;
+            }
+
+            @Override
+            public Stat getStat()
+            {
+                return null;
+            }
+
+            @Override
+            public byte[] getData()
+            {
+                return new byte[0];
+            }
+
+            @Override
+            public String getName()
+            {
+                return null;
+            }
+
+            @Override
+            public List<String> getChildren()
+            {
+                return null;
+            }
+
+            @Override
+            public List<ACL> getACLList()
+            {
+                return null;
+            }
+
+            @Override
+            public WatchedEvent getWatchedEvent()
+            {
+                return null;
+            }
+        }));
+
         CuratorFramework client = CuratorFrameworkFactory.newClient("localhost:2181", new RetryOneTime(1));
         String id = UUID.randomUUID().toString();
         client.start();
@@ -90,7 +164,7 @@ public class CuratorProjectionService
                 @Override
                 public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
                 {
-                    events.offer(new RpcCuratorEvent(projection, event));
+                    eventService.addEvent(new RpcCuratorEvent(projection, event));
                 }
             };
             builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
@@ -99,12 +173,6 @@ public class CuratorProjectionService
         return String.valueOf(castBuilder(builder, PathAndBytesable.class).forPath(createSpec.path, createSpec.data.getBytes()));
     }
 
-    @ThriftMethod
-    public RpcCuratorEvent getNextEvent() throws InterruptedException
-    {
-        return events.take();
-    }
-
     private org.apache.zookeeper.CreateMode getRealMode(CreateMode mode)
     {
         switch ( mode )

http://git-wip-us.apache.org/repos/asf/curator/blob/16836aa8/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 9d578e7..b9d5beb 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -83,6 +83,9 @@ struct CuratorEvent {
 service CuratorService {
   void closeCuratorProjection(1: CuratorProjection projection);
   string create(1: CuratorProjection projection, 2: CreateSpec createSpec);
-  CuratorEvent getNextEvent();
   CuratorProjection newCuratorProjection(1: CuratorProjectionSpec spec);
 }
+
+service EventService {
+  CuratorEvent getNextEvent();
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/16836aa8/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 a6c758b..a9da429 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
@@ -40,8 +40,6 @@ public class CuratorService {
 
     public String create(CuratorProjection projection, CreateSpec createSpec) throws org.apache.thrift.TException;
 
-    public CuratorEvent getNextEvent() throws org.apache.thrift.TException;
-
     public CuratorProjection newCuratorProjection(CuratorProjectionSpec spec) throws org.apache.thrift.TException;
 
   }
@@ -52,8 +50,6 @@ public class CuratorService {
 
     public void create(CuratorProjection projection, CreateSpec createSpec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
 
-    public void getNextEvent(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
-
     public void newCuratorProjection(CuratorProjectionSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
 
   }
@@ -122,28 +118,6 @@ public class CuratorService {
       throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "create failed: unknown result");
     }
 
-    public CuratorEvent getNextEvent() throws org.apache.thrift.TException
-    {
-      send_getNextEvent();
-      return recv_getNextEvent();
-    }
-
-    public void send_getNextEvent() throws org.apache.thrift.TException
-    {
-      getNextEvent_args args = new getNextEvent_args();
-      sendBase("getNextEvent", args);
-    }
-
-    public CuratorEvent recv_getNextEvent() throws org.apache.thrift.TException
-    {
-      getNextEvent_result result = new getNextEvent_result();
-      receiveBase(result, "getNextEvent");
-      if (result.isSetSuccess()) {
-        return result.success;
-      }
-      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getNextEvent failed: unknown result");
-    }
-
     public CuratorProjection newCuratorProjection(CuratorProjectionSpec spec) throws org.apache.thrift.TException
     {
       send_newCuratorProjection(spec);
@@ -252,35 +226,6 @@ public class CuratorService {
       }
     }
 
-    public void getNextEvent(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
-      checkReady();
-      getNextEvent_call method_call = new getNextEvent_call(resultHandler, this, ___protocolFactory, ___transport);
-      this.___currentMethod = method_call;
-      ___manager.call(method_call);
-    }
-
-    public static class getNextEvent_call extends org.apache.thrift.async.TAsyncMethodCall {
-      public getNextEvent_call(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);
-      }
-
-      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
-        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getNextEvent", org.apache.thrift.protocol.TMessageType.CALL, 0));
-        getNextEvent_args args = new getNextEvent_args();
-        args.write(prot);
-        prot.writeMessageEnd();
-      }
-
-      public CuratorEvent 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_getNextEvent();
-      }
-    }
-
     public void newCuratorProjection(CuratorProjectionSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
       checkReady();
       newCuratorProjection_call method_call = new newCuratorProjection_call(spec, resultHandler, this, ___protocolFactory, ___transport);
@@ -328,7 +273,6 @@ public class CuratorService {
     private static <I extends Iface> Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> getProcessMap(Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
       processMap.put("closeCuratorProjection", new closeCuratorProjection());
       processMap.put("create", new create());
-      processMap.put("getNextEvent", new getNextEvent());
       processMap.put("newCuratorProjection", new newCuratorProjection());
       return processMap;
     }
@@ -373,26 +317,6 @@ public class CuratorService {
       }
     }
 
-    public static class getNextEvent<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getNextEvent_args> {
-      public getNextEvent() {
-        super("getNextEvent");
-      }
-
-      public getNextEvent_args getEmptyArgsInstance() {
-        return new getNextEvent_args();
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public getNextEvent_result getResult(I iface, getNextEvent_args args) throws org.apache.thrift.TException {
-        getNextEvent_result result = new getNextEvent_result();
-        result.success = iface.getNextEvent();
-        return result;
-      }
-    }
-
     public static class newCuratorProjection<I extends Iface> extends org.apache.thrift.ProcessFunction<I, newCuratorProjection_args> {
       public newCuratorProjection() {
         super("newCuratorProjection");
@@ -428,7 +352,6 @@ public class CuratorService {
     private static <I extends AsyncIface> Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
       processMap.put("closeCuratorProjection", new closeCuratorProjection());
       processMap.put("create", new create());
-      processMap.put("getNextEvent", new getNextEvent());
       processMap.put("newCuratorProjection", new newCuratorProjection());
       return processMap;
     }
@@ -534,57 +457,6 @@ public class CuratorService {
       }
     }
 
-    public static class getNextEvent<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getNextEvent_args, CuratorEvent> {
-      public getNextEvent() {
-        super("getNextEvent");
-      }
-
-      public getNextEvent_args getEmptyArgsInstance() {
-        return new getNextEvent_args();
-      }
-
-      public AsyncMethodCallback<CuratorEvent> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
-        final org.apache.thrift.AsyncProcessFunction fcall = this;
-        return new AsyncMethodCallback<CuratorEvent>() { 
-          public void onComplete(CuratorEvent o) {
-            getNextEvent_result result = new getNextEvent_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;
-            getNextEvent_result result = new getNextEvent_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, getNextEvent_args args, org.apache.thrift.async.AsyncMethodCallback<CuratorEvent> resultHandler) throws TException {
-        iface.getNextEvent(resultHandler);
-      }
-    }
-
     public static class newCuratorProjection<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, newCuratorProjection_args, CuratorProjection> {
       public newCuratorProjection() {
         super("newCuratorProjection");
@@ -2061,611 +1933,6 @@ public class CuratorService {
 
   }
 
-  public static class getNextEvent_args implements org.apache.thrift.TBase<getNextEvent_args, getNextEvent_args._Fields>, java.io.Serializable, Cloneable, Comparable<getNextEvent_args>   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getNextEvent_args");
-
-
-    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-    static {
-      schemes.put(StandardScheme.class, new getNextEvent_argsStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new getNextEvent_argsTupleSchemeFactory());
-    }
-
-
-    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-;
-
-      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) {
-          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;
-      }
-    }
-    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);
-      metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getNextEvent_args.class, metaDataMap);
-    }
-
-    public getNextEvent_args() {
-    }
-
-    /**
-     * Performs a deep copy on <i>other</i>.
-     */
-    public getNextEvent_args(getNextEvent_args other) {
-    }
-
-    public getNextEvent_args deepCopy() {
-      return new getNextEvent_args(this);
-    }
-
-    @Override
-    public void clear() {
-    }
-
-    public void setFieldValue(_Fields field, Object value) {
-      switch (field) {
-      }
-    }
-
-    public Object getFieldValue(_Fields field) {
-      switch (field) {
-      }
-      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) {
-      }
-      throw new IllegalStateException();
-    }
-
-    @Override
-    public boolean equals(Object that) {
-      if (that == null)
-        return false;
-      if (that instanceof getNextEvent_args)
-        return this.equals((getNextEvent_args)that);
-      return false;
-    }
-
-    public boolean equals(getNextEvent_args that) {
-      if (that == null)
-        return false;
-
-      return true;
-    }
-
-    @Override
-    public int hashCode() {
-      return 0;
-    }
-
-    @Override
-    public int compareTo(getNextEvent_args other) {
-      if (!getClass().equals(other.getClass())) {
-        return getClass().getName().compareTo(other.getClass().getName());
-      }
-
-      int lastComparison = 0;
-
-      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("getNextEvent_args(");
-      boolean first = true;
-
-      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 getNextEvent_argsStandardSchemeFactory implements SchemeFactory {
-      public getNextEvent_argsStandardScheme getScheme() {
-        return new getNextEvent_argsStandardScheme();
-      }
-    }
-
-    private static class getNextEvent_argsStandardScheme extends StandardScheme<getNextEvent_args> {
-
-      public void read(org.apache.thrift.protocol.TProtocol iprot, getNextEvent_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) {
-            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, getNextEvent_args struct) throws org.apache.thrift.TException {
-        struct.validate();
-
-        oprot.writeStructBegin(STRUCT_DESC);
-        oprot.writeFieldStop();
-        oprot.writeStructEnd();
-      }
-
-    }
-
-    private static class getNextEvent_argsTupleSchemeFactory implements SchemeFactory {
-      public getNextEvent_argsTupleScheme getScheme() {
-        return new getNextEvent_argsTupleScheme();
-      }
-    }
-
-    private static class getNextEvent_argsTupleScheme extends TupleScheme<getNextEvent_args> {
-
-      @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, getNextEvent_args struct) throws org.apache.thrift.TException {
-        TTupleProtocol oprot = (TTupleProtocol) prot;
-      }
-
-      @Override
-      public void read(org.apache.thrift.protocol.TProtocol prot, getNextEvent_args struct) throws org.apache.thrift.TException {
-        TTupleProtocol iprot = (TTupleProtocol) prot;
-      }
-    }
-
-  }
-
-  public static class getNextEvent_result implements org.apache.thrift.TBase<getNextEvent_result, getNextEvent_result._Fields>, java.io.Serializable, Cloneable, Comparable<getNextEvent_result>   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getNextEvent_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 getNextEvent_resultStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new getNextEvent_resultTupleSchemeFactory());
-    }
-
-    public CuratorEvent 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, CuratorEvent.class)));
-      metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getNextEvent_result.class, metaDataMap);
-    }
-
-    public getNextEvent_result() {
-    }
-
-    public getNextEvent_result(
-      CuratorEvent success)
-    {
-      this();
-      this.success = success;
-    }
-
-    /**
-     * Performs a deep copy on <i>other</i>.
-     */
-    public getNextEvent_result(getNextEvent_result other) {
-      if (other.isSetSuccess()) {
-        this.success = new CuratorEvent(other.success);
-      }
-    }
-
-    public getNextEvent_result deepCopy() {
-      return new getNextEvent_result(this);
-    }
-
-    @Override
-    public void clear() {
-      this.success = null;
-    }
-
-    public CuratorEvent getSuccess() {
-      return this.success;
-    }
-
-    public getNextEvent_result setSuccess(CuratorEvent 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((CuratorEvent)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 getNextEvent_result)
-        return this.equals((getNextEvent_result)that);
-      return false;
-    }
-
-    public boolean equals(getNextEvent_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(getNextEvent_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("getNextEvent_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 getNextEvent_resultStandardSchemeFactory implements SchemeFactory {
-      public getNextEvent_resultStandardScheme getScheme() {
-        return new getNextEvent_resultStandardScheme();
-      }
-    }
-
-    private static class getNextEvent_resultStandardScheme extends StandardScheme<getNextEvent_result> {
-
-      public void read(org.apache.thrift.protocol.TProtocol iprot, getNextEvent_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 CuratorEvent();
-                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, getNextEvent_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 getNextEvent_resultTupleSchemeFactory implements SchemeFactory {
-      public getNextEvent_resultTupleScheme getScheme() {
-        return new getNextEvent_resultTupleScheme();
-      }
-    }
-
-    private static class getNextEvent_resultTupleScheme extends TupleScheme<getNextEvent_result> {
-
-      @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, getNextEvent_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, getNextEvent_result struct) throws org.apache.thrift.TException {
-        TTupleProtocol iprot = (TTupleProtocol) prot;
-        BitSet incoming = iprot.readBitSet(1);
-        if (incoming.get(0)) {
-          struct.success = new CuratorEvent();
-          struct.success.read(iprot);
-          struct.setSuccessIsSet(true);
-        }
-      }
-    }
-
-  }
-
   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");
 

http://git-wip-us.apache.org/repos/asf/curator/blob/16836aa8/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
new file mode 100644
index 0000000..7c8e294
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/EventService.java
@@ -0,0 +1,850 @@
+/**
+ * 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 EventService {
+
+  public interface Iface {
+
+    public CuratorEvent getNextEvent() throws org.apache.thrift.TException;
+
+  }
+
+  public interface AsyncIface {
+
+    public void getNextEvent(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+  }
+
+  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
+    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
+      public Factory() {}
+      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
+        return new Client(prot);
+      }
+      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+        return new Client(iprot, oprot);
+      }
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol prot)
+    {
+      super(prot, prot);
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+      super(iprot, oprot);
+    }
+
+    public CuratorEvent getNextEvent() throws org.apache.thrift.TException
+    {
+      send_getNextEvent();
+      return recv_getNextEvent();
+    }
+
+    public void send_getNextEvent() throws org.apache.thrift.TException
+    {
+      getNextEvent_args args = new getNextEvent_args();
+      sendBase("getNextEvent", args);
+    }
+
+    public CuratorEvent recv_getNextEvent() throws org.apache.thrift.TException
+    {
+      getNextEvent_result result = new getNextEvent_result();
+      receiveBase(result, "getNextEvent");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getNextEvent 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> {
+      private org.apache.thrift.async.TAsyncClientManager clientManager;
+      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
+      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
+        this.clientManager = clientManager;
+        this.protocolFactory = protocolFactory;
+      }
+      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
+        return new AsyncClient(protocolFactory, clientManager, transport);
+      }
+    }
+
+    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
+      super(protocolFactory, clientManager, transport);
+    }
+
+    public void getNextEvent(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      getNextEvent_call method_call = new getNextEvent_call(resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getNextEvent_call extends org.apache.thrift.async.TAsyncMethodCall {
+      public getNextEvent_call(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);
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getNextEvent", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getNextEvent_args args = new getNextEvent_args();
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public CuratorEvent 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_getNextEvent();
+      }
+    }
+
+  }
+
+  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
+    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
+    public Processor(I iface) {
+      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
+    }
+
+    protected Processor(I iface, Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends Iface> Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> getProcessMap(Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
+      processMap.put("getNextEvent", new getNextEvent());
+      return processMap;
+    }
+
+    public static class getNextEvent<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getNextEvent_args> {
+      public getNextEvent() {
+        super("getNextEvent");
+      }
+
+      public getNextEvent_args getEmptyArgsInstance() {
+        return new getNextEvent_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public getNextEvent_result getResult(I iface, getNextEvent_args args) throws org.apache.thrift.TException {
+        getNextEvent_result result = new getNextEvent_result();
+        result.success = iface.getNextEvent();
+        return result;
+      }
+    }
+
+  }
+
+  public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
+    private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
+    public AsyncProcessor(I iface) {
+      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
+    }
+
+    protected AsyncProcessor(I iface, Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends AsyncIface> Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
+      processMap.put("getNextEvent", new getNextEvent());
+      return processMap;
+    }
+
+    public static class getNextEvent<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getNextEvent_args, CuratorEvent> {
+      public getNextEvent() {
+        super("getNextEvent");
+      }
+
+      public getNextEvent_args getEmptyArgsInstance() {
+        return new getNextEvent_args();
+      }
+
+      public AsyncMethodCallback<CuratorEvent> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<CuratorEvent>() { 
+          public void onComplete(CuratorEvent o) {
+            getNextEvent_result result = new getNextEvent_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;
+            getNextEvent_result result = new getNextEvent_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, getNextEvent_args args, org.apache.thrift.async.AsyncMethodCallback<CuratorEvent> resultHandler) throws TException {
+        iface.getNextEvent(resultHandler);
+      }
+    }
+
+  }
+
+  public static class getNextEvent_args implements org.apache.thrift.TBase<getNextEvent_args, getNextEvent_args._Fields>, java.io.Serializable, Cloneable, Comparable<getNextEvent_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getNextEvent_args");
+
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new getNextEvent_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new getNextEvent_argsTupleSchemeFactory());
+    }
+
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+;
+
+      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) {
+          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;
+      }
+    }
+    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);
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getNextEvent_args.class, metaDataMap);
+    }
+
+    public getNextEvent_args() {
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getNextEvent_args(getNextEvent_args other) {
+    }
+
+    public getNextEvent_args deepCopy() {
+      return new getNextEvent_args(this);
+    }
+
+    @Override
+    public void clear() {
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      }
+      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) {
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getNextEvent_args)
+        return this.equals((getNextEvent_args)that);
+      return false;
+    }
+
+    public boolean equals(getNextEvent_args that) {
+      if (that == null)
+        return false;
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(getNextEvent_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      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("getNextEvent_args(");
+      boolean first = true;
+
+      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 getNextEvent_argsStandardSchemeFactory implements SchemeFactory {
+      public getNextEvent_argsStandardScheme getScheme() {
+        return new getNextEvent_argsStandardScheme();
+      }
+    }
+
+    private static class getNextEvent_argsStandardScheme extends StandardScheme<getNextEvent_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getNextEvent_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) {
+            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, getNextEvent_args struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getNextEvent_argsTupleSchemeFactory implements SchemeFactory {
+      public getNextEvent_argsTupleScheme getScheme() {
+        return new getNextEvent_argsTupleScheme();
+      }
+    }
+
+    private static class getNextEvent_argsTupleScheme extends TupleScheme<getNextEvent_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getNextEvent_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getNextEvent_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+      }
+    }
+
+  }
+
+  public static class getNextEvent_result implements org.apache.thrift.TBase<getNextEvent_result, getNextEvent_result._Fields>, java.io.Serializable, Cloneable, Comparable<getNextEvent_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getNextEvent_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 getNextEvent_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new getNextEvent_resultTupleSchemeFactory());
+    }
+
+    public CuratorEvent 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, CuratorEvent.class)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getNextEvent_result.class, metaDataMap);
+    }
+
+    public getNextEvent_result() {
+    }
+
+    public getNextEvent_result(
+      CuratorEvent success)
+    {
+      this();
+      this.success = success;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getNextEvent_result(getNextEvent_result other) {
+      if (other.isSetSuccess()) {
+        this.success = new CuratorEvent(other.success);
+      }
+    }
+
+    public getNextEvent_result deepCopy() {
+      return new getNextEvent_result(this);
+    }
+
+    @Override
+    public void clear() {
+      this.success = null;
+    }
+
+    public CuratorEvent getSuccess() {
+      return this.success;
+    }
+
+    public getNextEvent_result setSuccess(CuratorEvent 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((CuratorEvent)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 getNextEvent_result)
+        return this.equals((getNextEvent_result)that);
+      return false;
+    }
+
+    public boolean equals(getNextEvent_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(getNextEvent_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("getNextEvent_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 getNextEvent_resultStandardSchemeFactory implements SchemeFactory {
+      public getNextEvent_resultStandardScheme getScheme() {
+        return new getNextEvent_resultStandardScheme();
+      }
+    }
+
+    private static class getNextEvent_resultStandardScheme extends StandardScheme<getNextEvent_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getNextEvent_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 CuratorEvent();
+                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, getNextEvent_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 getNextEvent_resultTupleSchemeFactory implements SchemeFactory {
+      public getNextEvent_resultTupleScheme getScheme() {
+        return new getNextEvent_resultTupleScheme();
+      }
+    }
+
+    private static class getNextEvent_resultTupleScheme extends TupleScheme<getNextEvent_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getNextEvent_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, getNextEvent_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          struct.success = new CuratorEvent();
+          struct.success.read(iprot);
+          struct.setSuccessIsSet(true);
+        }
+      }
+    }
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/16836aa8/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 84d88c6..e479031 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
@@ -18,31 +18,49 @@
  */
 package org.apache.curator.x.rpc;
 
-import org.apache.curator.generated.CreateSpec;
+import org.apache.curator.generated.CuratorEvent;
 import org.apache.curator.generated.CuratorProjection;
 import org.apache.curator.generated.CuratorProjectionSpec;
 import org.apache.curator.generated.CuratorService;
+import org.apache.curator.generated.EventService;
 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.util.concurrent.Executors;
 
 public class TestClient
 {
     public static void main(String[] args) throws TException
     {
-        TSocket transport = new TSocket("localhost", 8899);
-        transport.open();
-        TProtocol protocol = new TBinaryProtocol(transport);
-        CuratorService.Client client = new CuratorService.Client(protocol);
-        CuratorProjection curatorProjection = client.newCuratorProjection(new CuratorProjectionSpec());
-        System.out.println(curatorProjection);
+        TSocket clientTransport = new TSocket("localhost", 8899);
+        clientTransport.open();
+        TProtocol clientProtocol = new TBinaryProtocol(clientTransport);
+        final CuratorService.Client client = new CuratorService.Client(clientProtocol);
+
+        TSocket eventTransport = new TSocket("localhost", 8899);
+        eventTransport.open();
+        TProtocol eventProtocol = new TBinaryProtocol(eventTransport);
+        final EventService.Client serviceClient = new EventService.Client(eventProtocol);
 
-        CreateSpec createSpec = new CreateSpec();
-        createSpec.setPath("/a/b/c");
-        createSpec.setCreatingParentsIfNeeded(true);
-        createSpec.setData("");
-        String s = client.create(curatorProjection, createSpec);
-        System.out.println(s);
+        Executors.newSingleThreadExecutor().submit
+        (new Runnable()
+            {
+                @Override
+                public void run()
+                {
+                    try
+                    {
+                        CuratorEvent nextEvent = serviceClient.getNextEvent();
+                        System.out.println(nextEvent.type);
+                    }
+                    catch ( TException e )
+                    {
+                        e.printStackTrace();
+                    }
+                }
+            });
+
+        CuratorProjection curatorProjection = client.newCuratorProjection(new CuratorProjectionSpec());
     }
 }


[14/14] git commit: wip

Posted by ra...@apache.org.
wip


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

Branch: refs/heads/curator-rpc
Commit: abf5fddae35e62b93256c2e473df8b79b3b76969
Parents: 099df94
Author: randgalt <ra...@apache.org>
Authored: Mon May 26 20:29:20 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon May 26 20:29:20 2014 -0500

----------------------------------------------------------------------
 .../org/apache/curator/x/rpc/CuratorEntry.java  | 13 -----
 .../curator/x/rpc/CuratorProjectionServer.java  |  3 +-
 .../org/apache/curator/x/rpc/RpcManager.java    | 57 ++++++++++++++++----
 3 files changed, 50 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/abf5fdda/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorEntry.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorEntry.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorEntry.java
index 61f97f3..f1b50a0 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorEntry.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorEntry.java
@@ -6,13 +6,11 @@ import org.apache.curator.x.rpc.idl.event.RpcCuratorEvent;
 import java.io.Closeable;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
 
 public class CuratorEntry implements Closeable
 {
     private final CuratorFramework client;
-    private final AtomicLong lastAccessEpoch = new AtomicLong(0);
     private final BlockingQueue<RpcCuratorEvent> events = Queues.newLinkedBlockingQueue();
     private final AtomicReference<State> state = new AtomicReference<State>(State.OPEN);
 
@@ -25,7 +23,6 @@ public class CuratorEntry implements Closeable
     public CuratorEntry(CuratorFramework client)
     {
         this.client = client;
-        updateLastAccess();
     }
 
     @Override
@@ -55,18 +52,8 @@ public class CuratorEntry implements Closeable
         }
     }
 
-    public void updateLastAccess()
-    {
-        lastAccessEpoch.set(System.currentTimeMillis());
-    }
-
     public CuratorFramework getClient()
     {
         return (state.get() == State.OPEN) ? client : null;
     }
-
-    public long getLastAccessEpoch()
-    {
-        return lastAccessEpoch.get();
-    }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/abf5fdda/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
index 6f94902..75c304b 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
@@ -26,12 +26,13 @@ import com.facebook.swift.service.ThriftServiceProcessor;
 import com.google.common.collect.Lists;
 import org.apache.curator.x.rpc.idl.event.EventService;
 import org.apache.curator.x.rpc.idl.projection.CuratorProjectionService;
+import java.util.concurrent.TimeUnit;
 
 public class CuratorProjectionServer
 {
     public static void main(String[] args)
     {
-        RpcManager rpcManager = new RpcManager();
+        RpcManager rpcManager = new RpcManager(TimeUnit.SECONDS.toMillis(10));   // TODO
         EventService eventService = new EventService(rpcManager, 5000); // TODO
         CuratorProjectionService projectionService = new CuratorProjectionService(rpcManager);
         ThriftServiceProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), Lists.<ThriftEventHandler>newArrayList(), projectionService, eventService);

http://git-wip-us.apache.org/repos/asf/curator/blob/abf5fdda/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
index dcfa2a0..e238aa6 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
@@ -1,27 +1,66 @@
 package org.apache.curator.x.rpc;
 
-import com.google.common.collect.Maps;
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.RemovalListener;
+import com.google.common.cache.RemovalNotification;
 import org.apache.curator.framework.CuratorFramework;
-import java.util.Map;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.io.Closeable;
+import java.util.concurrent.TimeUnit;
 
-public class RpcManager
+public class RpcManager implements Closeable
 {
-    private final Map<String, CuratorEntry> projections = Maps.newConcurrentMap();
+    private final Logger log = LoggerFactory.getLogger(getClass());
+    private final Cache<String, CuratorEntry> cache;
+
+    public RpcManager(long expirationMs)
+    {
+        RemovalListener<String, CuratorEntry> listener = new RemovalListener<String, CuratorEntry>()
+        {
+            @SuppressWarnings("NullableProblems")
+            @Override
+            public void onRemoval(RemovalNotification<String, CuratorEntry> notification)
+            {
+                if ( notification != null )
+                {
+                    log.debug(String.format("Entry being removed. id (%s), reason (%s)", notification.getKey(), notification.getCause()));
+
+                    CuratorEntry entry = notification.getValue();
+                    if ( entry != null )
+                    {
+                        entry.close();
+                    }
+                }
+            }
+        };
+        cache = CacheBuilder
+            .newBuilder()
+            .expireAfterAccess(expirationMs, TimeUnit.MILLISECONDS)
+            .removalListener(listener)
+            .build();
+    }
+
+    @Override
+    public void close()
+    {
+        cache.invalidateAll();
+        cache.cleanUp();
+    }
 
     public void add(String id, CuratorFramework client)
     {
-        projections.put(id, new CuratorEntry(client));
+        cache.put(id, new CuratorEntry(client));
     }
 
     public CuratorEntry get(String id)
     {
-        CuratorEntry curatorEntry = projections.get(id);
-        curatorEntry.updateLastAccess();
-        return curatorEntry;
+        return cache.getIfPresent(id);
     }
 
     public CuratorEntry remove(String id)
     {
-        return projections.remove(id);
+        return cache.asMap().remove(id);
     }
 }


[05/14] wip

Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/test/java/org/apache/curator/generated/EventType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/EventType.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/EventType.java
new file mode 100644
index 0000000..dced909
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/EventType.java
@@ -0,0 +1,54 @@
+/**
+ * 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 EventType implements org.apache.thrift.TEnum {
+  None(0),
+  NodeCreated(1),
+  NodeDeleted(2),
+  NodeDataChanged(3),
+  NodeChildrenChanged(4);
+
+  private final int value;
+
+  private EventType(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 EventType findByValue(int value) { 
+    switch (value) {
+      case 0:
+        return None;
+      case 1:
+        return NodeCreated;
+      case 2:
+        return NodeDeleted;
+      case 3:
+        return NodeDataChanged;
+      case 4:
+        return NodeChildrenChanged;
+      default:
+        return null;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/test/java/org/apache/curator/generated/KeeperState.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/KeeperState.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/KeeperState.java
new file mode 100644
index 0000000..cd945ee
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/KeeperState.java
@@ -0,0 +1,63 @@
+/**
+ * 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 KeeperState implements org.apache.thrift.TEnum {
+  Unknown(0),
+  Disconnected(1),
+  NoSyncConnected(2),
+  SyncConnected(3),
+  AuthFailed(4),
+  ConnectedReadOnly(5),
+  SaslAuthenticated(6),
+  Expired(7);
+
+  private final int value;
+
+  private KeeperState(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 KeeperState findByValue(int value) { 
+    switch (value) {
+      case 0:
+        return Unknown;
+      case 1:
+        return Disconnected;
+      case 2:
+        return NoSyncConnected;
+      case 3:
+        return SyncConnected;
+      case 4:
+        return AuthFailed;
+      case 5:
+        return ConnectedReadOnly;
+      case 6:
+        return SaslAuthenticated;
+      case 7:
+        return Expired;
+      default:
+        return null;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/test/java/org/apache/curator/generated/Stat.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/Stat.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/Stat.java
new file mode 100644
index 0000000..e8475c0
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/Stat.java
@@ -0,0 +1,1326 @@
+/**
+ * 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 Stat implements org.apache.thrift.TBase<Stat, Stat._Fields>, java.io.Serializable, Cloneable, Comparable<Stat> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Stat");
+
+  private static final org.apache.thrift.protocol.TField CZXID_FIELD_DESC = new org.apache.thrift.protocol.TField("czxid", org.apache.thrift.protocol.TType.I64, (short)1);
+  private static final org.apache.thrift.protocol.TField MZXID_FIELD_DESC = new org.apache.thrift.protocol.TField("mzxid", org.apache.thrift.protocol.TType.I64, (short)2);
+  private static final org.apache.thrift.protocol.TField CTIME_FIELD_DESC = new org.apache.thrift.protocol.TField("ctime", org.apache.thrift.protocol.TType.I64, (short)3);
+  private static final org.apache.thrift.protocol.TField MTIME_FIELD_DESC = new org.apache.thrift.protocol.TField("mtime", org.apache.thrift.protocol.TType.I64, (short)4);
+  private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.I32, (short)5);
+  private static final org.apache.thrift.protocol.TField CVERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("cversion", org.apache.thrift.protocol.TType.I32, (short)6);
+  private static final org.apache.thrift.protocol.TField AVERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("aversion", org.apache.thrift.protocol.TType.I32, (short)7);
+  private static final org.apache.thrift.protocol.TField EPHEMERAL_OWNER_FIELD_DESC = new org.apache.thrift.protocol.TField("ephemeralOwner", org.apache.thrift.protocol.TType.I64, (short)8);
+  private static final org.apache.thrift.protocol.TField DATA_LENGTH_FIELD_DESC = new org.apache.thrift.protocol.TField("dataLength", org.apache.thrift.protocol.TType.I32, (short)9);
+  private static final org.apache.thrift.protocol.TField NUM_CHILDREN_FIELD_DESC = new org.apache.thrift.protocol.TField("numChildren", org.apache.thrift.protocol.TType.I32, (short)10);
+  private static final org.apache.thrift.protocol.TField PZXID_FIELD_DESC = new org.apache.thrift.protocol.TField("pzxid", org.apache.thrift.protocol.TType.I64, (short)11);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new StatStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new StatTupleSchemeFactory());
+  }
+
+  public long czxid; // required
+  public long mzxid; // required
+  public long ctime; // required
+  public long mtime; // required
+  public int version; // required
+  public int cversion; // required
+  public int aversion; // required
+  public long ephemeralOwner; // required
+  public int dataLength; // required
+  public int numChildren; // required
+  public long pzxid; // 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 {
+    CZXID((short)1, "czxid"),
+    MZXID((short)2, "mzxid"),
+    CTIME((short)3, "ctime"),
+    MTIME((short)4, "mtime"),
+    VERSION((short)5, "version"),
+    CVERSION((short)6, "cversion"),
+    AVERSION((short)7, "aversion"),
+    EPHEMERAL_OWNER((short)8, "ephemeralOwner"),
+    DATA_LENGTH((short)9, "dataLength"),
+    NUM_CHILDREN((short)10, "numChildren"),
+    PZXID((short)11, "pzxid");
+
+    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: // CZXID
+          return CZXID;
+        case 2: // MZXID
+          return MZXID;
+        case 3: // CTIME
+          return CTIME;
+        case 4: // MTIME
+          return MTIME;
+        case 5: // VERSION
+          return VERSION;
+        case 6: // CVERSION
+          return CVERSION;
+        case 7: // AVERSION
+          return AVERSION;
+        case 8: // EPHEMERAL_OWNER
+          return EPHEMERAL_OWNER;
+        case 9: // DATA_LENGTH
+          return DATA_LENGTH;
+        case 10: // NUM_CHILDREN
+          return NUM_CHILDREN;
+        case 11: // PZXID
+          return PZXID;
+        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 __CZXID_ISSET_ID = 0;
+  private static final int __MZXID_ISSET_ID = 1;
+  private static final int __CTIME_ISSET_ID = 2;
+  private static final int __MTIME_ISSET_ID = 3;
+  private static final int __VERSION_ISSET_ID = 4;
+  private static final int __CVERSION_ISSET_ID = 5;
+  private static final int __AVERSION_ISSET_ID = 6;
+  private static final int __EPHEMERALOWNER_ISSET_ID = 7;
+  private static final int __DATALENGTH_ISSET_ID = 8;
+  private static final int __NUMCHILDREN_ISSET_ID = 9;
+  private static final int __PZXID_ISSET_ID = 10;
+  private short __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.CZXID, new org.apache.thrift.meta_data.FieldMetaData("czxid", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.MZXID, new org.apache.thrift.meta_data.FieldMetaData("mzxid", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.CTIME, new org.apache.thrift.meta_data.FieldMetaData("ctime", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.MTIME, new org.apache.thrift.meta_data.FieldMetaData("mtime", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+    tmpMap.put(_Fields.CVERSION, new org.apache.thrift.meta_data.FieldMetaData("cversion", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+    tmpMap.put(_Fields.AVERSION, new org.apache.thrift.meta_data.FieldMetaData("aversion", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+    tmpMap.put(_Fields.EPHEMERAL_OWNER, new org.apache.thrift.meta_data.FieldMetaData("ephemeralOwner", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.DATA_LENGTH, new org.apache.thrift.meta_data.FieldMetaData("dataLength", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+    tmpMap.put(_Fields.NUM_CHILDREN, new org.apache.thrift.meta_data.FieldMetaData("numChildren", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+    tmpMap.put(_Fields.PZXID, new org.apache.thrift.meta_data.FieldMetaData("pzxid", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Stat.class, metaDataMap);
+  }
+
+  public Stat() {
+  }
+
+  public Stat(
+    long czxid,
+    long mzxid,
+    long ctime,
+    long mtime,
+    int version,
+    int cversion,
+    int aversion,
+    long ephemeralOwner,
+    int dataLength,
+    int numChildren,
+    long pzxid)
+  {
+    this();
+    this.czxid = czxid;
+    setCzxidIsSet(true);
+    this.mzxid = mzxid;
+    setMzxidIsSet(true);
+    this.ctime = ctime;
+    setCtimeIsSet(true);
+    this.mtime = mtime;
+    setMtimeIsSet(true);
+    this.version = version;
+    setVersionIsSet(true);
+    this.cversion = cversion;
+    setCversionIsSet(true);
+    this.aversion = aversion;
+    setAversionIsSet(true);
+    this.ephemeralOwner = ephemeralOwner;
+    setEphemeralOwnerIsSet(true);
+    this.dataLength = dataLength;
+    setDataLengthIsSet(true);
+    this.numChildren = numChildren;
+    setNumChildrenIsSet(true);
+    this.pzxid = pzxid;
+    setPzxidIsSet(true);
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public Stat(Stat other) {
+    __isset_bitfield = other.__isset_bitfield;
+    this.czxid = other.czxid;
+    this.mzxid = other.mzxid;
+    this.ctime = other.ctime;
+    this.mtime = other.mtime;
+    this.version = other.version;
+    this.cversion = other.cversion;
+    this.aversion = other.aversion;
+    this.ephemeralOwner = other.ephemeralOwner;
+    this.dataLength = other.dataLength;
+    this.numChildren = other.numChildren;
+    this.pzxid = other.pzxid;
+  }
+
+  public Stat deepCopy() {
+    return new Stat(this);
+  }
+
+  @Override
+  public void clear() {
+    setCzxidIsSet(false);
+    this.czxid = 0;
+    setMzxidIsSet(false);
+    this.mzxid = 0;
+    setCtimeIsSet(false);
+    this.ctime = 0;
+    setMtimeIsSet(false);
+    this.mtime = 0;
+    setVersionIsSet(false);
+    this.version = 0;
+    setCversionIsSet(false);
+    this.cversion = 0;
+    setAversionIsSet(false);
+    this.aversion = 0;
+    setEphemeralOwnerIsSet(false);
+    this.ephemeralOwner = 0;
+    setDataLengthIsSet(false);
+    this.dataLength = 0;
+    setNumChildrenIsSet(false);
+    this.numChildren = 0;
+    setPzxidIsSet(false);
+    this.pzxid = 0;
+  }
+
+  public long getCzxid() {
+    return this.czxid;
+  }
+
+  public Stat setCzxid(long czxid) {
+    this.czxid = czxid;
+    setCzxidIsSet(true);
+    return this;
+  }
+
+  public void unsetCzxid() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CZXID_ISSET_ID);
+  }
+
+  /** Returns true if field czxid is set (has been assigned a value) and false otherwise */
+  public boolean isSetCzxid() {
+    return EncodingUtils.testBit(__isset_bitfield, __CZXID_ISSET_ID);
+  }
+
+  public void setCzxidIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CZXID_ISSET_ID, value);
+  }
+
+  public long getMzxid() {
+    return this.mzxid;
+  }
+
+  public Stat setMzxid(long mzxid) {
+    this.mzxid = mzxid;
+    setMzxidIsSet(true);
+    return this;
+  }
+
+  public void unsetMzxid() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MZXID_ISSET_ID);
+  }
+
+  /** Returns true if field mzxid is set (has been assigned a value) and false otherwise */
+  public boolean isSetMzxid() {
+    return EncodingUtils.testBit(__isset_bitfield, __MZXID_ISSET_ID);
+  }
+
+  public void setMzxidIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MZXID_ISSET_ID, value);
+  }
+
+  public long getCtime() {
+    return this.ctime;
+  }
+
+  public Stat setCtime(long ctime) {
+    this.ctime = ctime;
+    setCtimeIsSet(true);
+    return this;
+  }
+
+  public void unsetCtime() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CTIME_ISSET_ID);
+  }
+
+  /** Returns true if field ctime is set (has been assigned a value) and false otherwise */
+  public boolean isSetCtime() {
+    return EncodingUtils.testBit(__isset_bitfield, __CTIME_ISSET_ID);
+  }
+
+  public void setCtimeIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CTIME_ISSET_ID, value);
+  }
+
+  public long getMtime() {
+    return this.mtime;
+  }
+
+  public Stat setMtime(long mtime) {
+    this.mtime = mtime;
+    setMtimeIsSet(true);
+    return this;
+  }
+
+  public void unsetMtime() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MTIME_ISSET_ID);
+  }
+
+  /** Returns true if field mtime is set (has been assigned a value) and false otherwise */
+  public boolean isSetMtime() {
+    return EncodingUtils.testBit(__isset_bitfield, __MTIME_ISSET_ID);
+  }
+
+  public void setMtimeIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MTIME_ISSET_ID, value);
+  }
+
+  public int getVersion() {
+    return this.version;
+  }
+
+  public Stat setVersion(int version) {
+    this.version = version;
+    setVersionIsSet(true);
+    return this;
+  }
+
+  public void unsetVersion() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VERSION_ISSET_ID);
+  }
+
+  /** Returns true if field version is set (has been assigned a value) and false otherwise */
+  public boolean isSetVersion() {
+    return EncodingUtils.testBit(__isset_bitfield, __VERSION_ISSET_ID);
+  }
+
+  public void setVersionIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VERSION_ISSET_ID, value);
+  }
+
+  public int getCversion() {
+    return this.cversion;
+  }
+
+  public Stat setCversion(int cversion) {
+    this.cversion = cversion;
+    setCversionIsSet(true);
+    return this;
+  }
+
+  public void unsetCversion() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CVERSION_ISSET_ID);
+  }
+
+  /** Returns true if field cversion is set (has been assigned a value) and false otherwise */
+  public boolean isSetCversion() {
+    return EncodingUtils.testBit(__isset_bitfield, __CVERSION_ISSET_ID);
+  }
+
+  public void setCversionIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CVERSION_ISSET_ID, value);
+  }
+
+  public int getAversion() {
+    return this.aversion;
+  }
+
+  public Stat setAversion(int aversion) {
+    this.aversion = aversion;
+    setAversionIsSet(true);
+    return this;
+  }
+
+  public void unsetAversion() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AVERSION_ISSET_ID);
+  }
+
+  /** Returns true if field aversion is set (has been assigned a value) and false otherwise */
+  public boolean isSetAversion() {
+    return EncodingUtils.testBit(__isset_bitfield, __AVERSION_ISSET_ID);
+  }
+
+  public void setAversionIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AVERSION_ISSET_ID, value);
+  }
+
+  public long getEphemeralOwner() {
+    return this.ephemeralOwner;
+  }
+
+  public Stat setEphemeralOwner(long ephemeralOwner) {
+    this.ephemeralOwner = ephemeralOwner;
+    setEphemeralOwnerIsSet(true);
+    return this;
+  }
+
+  public void unsetEphemeralOwner() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __EPHEMERALOWNER_ISSET_ID);
+  }
+
+  /** Returns true if field ephemeralOwner is set (has been assigned a value) and false otherwise */
+  public boolean isSetEphemeralOwner() {
+    return EncodingUtils.testBit(__isset_bitfield, __EPHEMERALOWNER_ISSET_ID);
+  }
+
+  public void setEphemeralOwnerIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __EPHEMERALOWNER_ISSET_ID, value);
+  }
+
+  public int getDataLength() {
+    return this.dataLength;
+  }
+
+  public Stat setDataLength(int dataLength) {
+    this.dataLength = dataLength;
+    setDataLengthIsSet(true);
+    return this;
+  }
+
+  public void unsetDataLength() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DATALENGTH_ISSET_ID);
+  }
+
+  /** Returns true if field dataLength is set (has been assigned a value) and false otherwise */
+  public boolean isSetDataLength() {
+    return EncodingUtils.testBit(__isset_bitfield, __DATALENGTH_ISSET_ID);
+  }
+
+  public void setDataLengthIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DATALENGTH_ISSET_ID, value);
+  }
+
+  public int getNumChildren() {
+    return this.numChildren;
+  }
+
+  public Stat setNumChildren(int numChildren) {
+    this.numChildren = numChildren;
+    setNumChildrenIsSet(true);
+    return this;
+  }
+
+  public void unsetNumChildren() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUMCHILDREN_ISSET_ID);
+  }
+
+  /** Returns true if field numChildren is set (has been assigned a value) and false otherwise */
+  public boolean isSetNumChildren() {
+    return EncodingUtils.testBit(__isset_bitfield, __NUMCHILDREN_ISSET_ID);
+  }
+
+  public void setNumChildrenIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUMCHILDREN_ISSET_ID, value);
+  }
+
+  public long getPzxid() {
+    return this.pzxid;
+  }
+
+  public Stat setPzxid(long pzxid) {
+    this.pzxid = pzxid;
+    setPzxidIsSet(true);
+    return this;
+  }
+
+  public void unsetPzxid() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PZXID_ISSET_ID);
+  }
+
+  /** Returns true if field pzxid is set (has been assigned a value) and false otherwise */
+  public boolean isSetPzxid() {
+    return EncodingUtils.testBit(__isset_bitfield, __PZXID_ISSET_ID);
+  }
+
+  public void setPzxidIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PZXID_ISSET_ID, value);
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case CZXID:
+      if (value == null) {
+        unsetCzxid();
+      } else {
+        setCzxid((Long)value);
+      }
+      break;
+
+    case MZXID:
+      if (value == null) {
+        unsetMzxid();
+      } else {
+        setMzxid((Long)value);
+      }
+      break;
+
+    case CTIME:
+      if (value == null) {
+        unsetCtime();
+      } else {
+        setCtime((Long)value);
+      }
+      break;
+
+    case MTIME:
+      if (value == null) {
+        unsetMtime();
+      } else {
+        setMtime((Long)value);
+      }
+      break;
+
+    case VERSION:
+      if (value == null) {
+        unsetVersion();
+      } else {
+        setVersion((Integer)value);
+      }
+      break;
+
+    case CVERSION:
+      if (value == null) {
+        unsetCversion();
+      } else {
+        setCversion((Integer)value);
+      }
+      break;
+
+    case AVERSION:
+      if (value == null) {
+        unsetAversion();
+      } else {
+        setAversion((Integer)value);
+      }
+      break;
+
+    case EPHEMERAL_OWNER:
+      if (value == null) {
+        unsetEphemeralOwner();
+      } else {
+        setEphemeralOwner((Long)value);
+      }
+      break;
+
+    case DATA_LENGTH:
+      if (value == null) {
+        unsetDataLength();
+      } else {
+        setDataLength((Integer)value);
+      }
+      break;
+
+    case NUM_CHILDREN:
+      if (value == null) {
+        unsetNumChildren();
+      } else {
+        setNumChildren((Integer)value);
+      }
+      break;
+
+    case PZXID:
+      if (value == null) {
+        unsetPzxid();
+      } else {
+        setPzxid((Long)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case CZXID:
+      return Long.valueOf(getCzxid());
+
+    case MZXID:
+      return Long.valueOf(getMzxid());
+
+    case CTIME:
+      return Long.valueOf(getCtime());
+
+    case MTIME:
+      return Long.valueOf(getMtime());
+
+    case VERSION:
+      return Integer.valueOf(getVersion());
+
+    case CVERSION:
+      return Integer.valueOf(getCversion());
+
+    case AVERSION:
+      return Integer.valueOf(getAversion());
+
+    case EPHEMERAL_OWNER:
+      return Long.valueOf(getEphemeralOwner());
+
+    case DATA_LENGTH:
+      return Integer.valueOf(getDataLength());
+
+    case NUM_CHILDREN:
+      return Integer.valueOf(getNumChildren());
+
+    case PZXID:
+      return Long.valueOf(getPzxid());
+
+    }
+    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 CZXID:
+      return isSetCzxid();
+    case MZXID:
+      return isSetMzxid();
+    case CTIME:
+      return isSetCtime();
+    case MTIME:
+      return isSetMtime();
+    case VERSION:
+      return isSetVersion();
+    case CVERSION:
+      return isSetCversion();
+    case AVERSION:
+      return isSetAversion();
+    case EPHEMERAL_OWNER:
+      return isSetEphemeralOwner();
+    case DATA_LENGTH:
+      return isSetDataLength();
+    case NUM_CHILDREN:
+      return isSetNumChildren();
+    case PZXID:
+      return isSetPzxid();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof Stat)
+      return this.equals((Stat)that);
+    return false;
+  }
+
+  public boolean equals(Stat that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_czxid = true;
+    boolean that_present_czxid = true;
+    if (this_present_czxid || that_present_czxid) {
+      if (!(this_present_czxid && that_present_czxid))
+        return false;
+      if (this.czxid != that.czxid)
+        return false;
+    }
+
+    boolean this_present_mzxid = true;
+    boolean that_present_mzxid = true;
+    if (this_present_mzxid || that_present_mzxid) {
+      if (!(this_present_mzxid && that_present_mzxid))
+        return false;
+      if (this.mzxid != that.mzxid)
+        return false;
+    }
+
+    boolean this_present_ctime = true;
+    boolean that_present_ctime = true;
+    if (this_present_ctime || that_present_ctime) {
+      if (!(this_present_ctime && that_present_ctime))
+        return false;
+      if (this.ctime != that.ctime)
+        return false;
+    }
+
+    boolean this_present_mtime = true;
+    boolean that_present_mtime = true;
+    if (this_present_mtime || that_present_mtime) {
+      if (!(this_present_mtime && that_present_mtime))
+        return false;
+      if (this.mtime != that.mtime)
+        return false;
+    }
+
+    boolean this_present_version = true;
+    boolean that_present_version = true;
+    if (this_present_version || that_present_version) {
+      if (!(this_present_version && that_present_version))
+        return false;
+      if (this.version != that.version)
+        return false;
+    }
+
+    boolean this_present_cversion = true;
+    boolean that_present_cversion = true;
+    if (this_present_cversion || that_present_cversion) {
+      if (!(this_present_cversion && that_present_cversion))
+        return false;
+      if (this.cversion != that.cversion)
+        return false;
+    }
+
+    boolean this_present_aversion = true;
+    boolean that_present_aversion = true;
+    if (this_present_aversion || that_present_aversion) {
+      if (!(this_present_aversion && that_present_aversion))
+        return false;
+      if (this.aversion != that.aversion)
+        return false;
+    }
+
+    boolean this_present_ephemeralOwner = true;
+    boolean that_present_ephemeralOwner = true;
+    if (this_present_ephemeralOwner || that_present_ephemeralOwner) {
+      if (!(this_present_ephemeralOwner && that_present_ephemeralOwner))
+        return false;
+      if (this.ephemeralOwner != that.ephemeralOwner)
+        return false;
+    }
+
+    boolean this_present_dataLength = true;
+    boolean that_present_dataLength = true;
+    if (this_present_dataLength || that_present_dataLength) {
+      if (!(this_present_dataLength && that_present_dataLength))
+        return false;
+      if (this.dataLength != that.dataLength)
+        return false;
+    }
+
+    boolean this_present_numChildren = true;
+    boolean that_present_numChildren = true;
+    if (this_present_numChildren || that_present_numChildren) {
+      if (!(this_present_numChildren && that_present_numChildren))
+        return false;
+      if (this.numChildren != that.numChildren)
+        return false;
+    }
+
+    boolean this_present_pzxid = true;
+    boolean that_present_pzxid = true;
+    if (this_present_pzxid || that_present_pzxid) {
+      if (!(this_present_pzxid && that_present_pzxid))
+        return false;
+      if (this.pzxid != that.pzxid)
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(Stat other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetCzxid()).compareTo(other.isSetCzxid());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetCzxid()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.czxid, other.czxid);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetMzxid()).compareTo(other.isSetMzxid());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetMzxid()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mzxid, other.mzxid);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetCtime()).compareTo(other.isSetCtime());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetCtime()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ctime, other.ctime);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetMtime()).compareTo(other.isSetMtime());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetMtime()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mtime, other.mtime);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetVersion()).compareTo(other.isSetVersion());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetVersion()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, other.version);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetCversion()).compareTo(other.isSetCversion());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetCversion()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cversion, other.cversion);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetAversion()).compareTo(other.isSetAversion());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetAversion()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.aversion, other.aversion);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetEphemeralOwner()).compareTo(other.isSetEphemeralOwner());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetEphemeralOwner()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ephemeralOwner, other.ephemeralOwner);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetDataLength()).compareTo(other.isSetDataLength());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetDataLength()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataLength, other.dataLength);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetNumChildren()).compareTo(other.isSetNumChildren());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetNumChildren()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numChildren, other.numChildren);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPzxid()).compareTo(other.isSetPzxid());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPzxid()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pzxid, other.pzxid);
+      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("Stat(");
+    boolean first = true;
+
+    sb.append("czxid:");
+    sb.append(this.czxid);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("mzxid:");
+    sb.append(this.mzxid);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("ctime:");
+    sb.append(this.ctime);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("mtime:");
+    sb.append(this.mtime);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("version:");
+    sb.append(this.version);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("cversion:");
+    sb.append(this.cversion);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("aversion:");
+    sb.append(this.aversion);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("ephemeralOwner:");
+    sb.append(this.ephemeralOwner);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("dataLength:");
+    sb.append(this.dataLength);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("numChildren:");
+    sb.append(this.numChildren);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("pzxid:");
+    sb.append(this.pzxid);
+    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 StatStandardSchemeFactory implements SchemeFactory {
+    public StatStandardScheme getScheme() {
+      return new StatStandardScheme();
+    }
+  }
+
+  private static class StatStandardScheme extends StandardScheme<Stat> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, Stat 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: // CZXID
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.czxid = iprot.readI64();
+              struct.setCzxidIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // MZXID
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.mzxid = iprot.readI64();
+              struct.setMzxidIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // CTIME
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.ctime = iprot.readI64();
+              struct.setCtimeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 4: // MTIME
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.mtime = iprot.readI64();
+              struct.setMtimeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 5: // VERSION
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.version = iprot.readI32();
+              struct.setVersionIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 6: // CVERSION
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.cversion = iprot.readI32();
+              struct.setCversionIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 7: // AVERSION
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.aversion = iprot.readI32();
+              struct.setAversionIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 8: // EPHEMERAL_OWNER
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.ephemeralOwner = iprot.readI64();
+              struct.setEphemeralOwnerIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 9: // DATA_LENGTH
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.dataLength = iprot.readI32();
+              struct.setDataLengthIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 10: // NUM_CHILDREN
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.numChildren = iprot.readI32();
+              struct.setNumChildrenIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 11: // PZXID
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.pzxid = iprot.readI64();
+              struct.setPzxidIsSet(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, Stat struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      oprot.writeFieldBegin(CZXID_FIELD_DESC);
+      oprot.writeI64(struct.czxid);
+      oprot.writeFieldEnd();
+      oprot.writeFieldBegin(MZXID_FIELD_DESC);
+      oprot.writeI64(struct.mzxid);
+      oprot.writeFieldEnd();
+      oprot.writeFieldBegin(CTIME_FIELD_DESC);
+      oprot.writeI64(struct.ctime);
+      oprot.writeFieldEnd();
+      oprot.writeFieldBegin(MTIME_FIELD_DESC);
+      oprot.writeI64(struct.mtime);
+      oprot.writeFieldEnd();
+      oprot.writeFieldBegin(VERSION_FIELD_DESC);
+      oprot.writeI32(struct.version);
+      oprot.writeFieldEnd();
+      oprot.writeFieldBegin(CVERSION_FIELD_DESC);
+      oprot.writeI32(struct.cversion);
+      oprot.writeFieldEnd();
+      oprot.writeFieldBegin(AVERSION_FIELD_DESC);
+      oprot.writeI32(struct.aversion);
+      oprot.writeFieldEnd();
+      oprot.writeFieldBegin(EPHEMERAL_OWNER_FIELD_DESC);
+      oprot.writeI64(struct.ephemeralOwner);
+      oprot.writeFieldEnd();
+      oprot.writeFieldBegin(DATA_LENGTH_FIELD_DESC);
+      oprot.writeI32(struct.dataLength);
+      oprot.writeFieldEnd();
+      oprot.writeFieldBegin(NUM_CHILDREN_FIELD_DESC);
+      oprot.writeI32(struct.numChildren);
+      oprot.writeFieldEnd();
+      oprot.writeFieldBegin(PZXID_FIELD_DESC);
+      oprot.writeI64(struct.pzxid);
+      oprot.writeFieldEnd();
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class StatTupleSchemeFactory implements SchemeFactory {
+    public StatTupleScheme getScheme() {
+      return new StatTupleScheme();
+    }
+  }
+
+  private static class StatTupleScheme extends TupleScheme<Stat> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, Stat struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetCzxid()) {
+        optionals.set(0);
+      }
+      if (struct.isSetMzxid()) {
+        optionals.set(1);
+      }
+      if (struct.isSetCtime()) {
+        optionals.set(2);
+      }
+      if (struct.isSetMtime()) {
+        optionals.set(3);
+      }
+      if (struct.isSetVersion()) {
+        optionals.set(4);
+      }
+      if (struct.isSetCversion()) {
+        optionals.set(5);
+      }
+      if (struct.isSetAversion()) {
+        optionals.set(6);
+      }
+      if (struct.isSetEphemeralOwner()) {
+        optionals.set(7);
+      }
+      if (struct.isSetDataLength()) {
+        optionals.set(8);
+      }
+      if (struct.isSetNumChildren()) {
+        optionals.set(9);
+      }
+      if (struct.isSetPzxid()) {
+        optionals.set(10);
+      }
+      oprot.writeBitSet(optionals, 11);
+      if (struct.isSetCzxid()) {
+        oprot.writeI64(struct.czxid);
+      }
+      if (struct.isSetMzxid()) {
+        oprot.writeI64(struct.mzxid);
+      }
+      if (struct.isSetCtime()) {
+        oprot.writeI64(struct.ctime);
+      }
+      if (struct.isSetMtime()) {
+        oprot.writeI64(struct.mtime);
+      }
+      if (struct.isSetVersion()) {
+        oprot.writeI32(struct.version);
+      }
+      if (struct.isSetCversion()) {
+        oprot.writeI32(struct.cversion);
+      }
+      if (struct.isSetAversion()) {
+        oprot.writeI32(struct.aversion);
+      }
+      if (struct.isSetEphemeralOwner()) {
+        oprot.writeI64(struct.ephemeralOwner);
+      }
+      if (struct.isSetDataLength()) {
+        oprot.writeI32(struct.dataLength);
+      }
+      if (struct.isSetNumChildren()) {
+        oprot.writeI32(struct.numChildren);
+      }
+      if (struct.isSetPzxid()) {
+        oprot.writeI64(struct.pzxid);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, Stat struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(11);
+      if (incoming.get(0)) {
+        struct.czxid = iprot.readI64();
+        struct.setCzxidIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.mzxid = iprot.readI64();
+        struct.setMzxidIsSet(true);
+      }
+      if (incoming.get(2)) {
+        struct.ctime = iprot.readI64();
+        struct.setCtimeIsSet(true);
+      }
+      if (incoming.get(3)) {
+        struct.mtime = iprot.readI64();
+        struct.setMtimeIsSet(true);
+      }
+      if (incoming.get(4)) {
+        struct.version = iprot.readI32();
+        struct.setVersionIsSet(true);
+      }
+      if (incoming.get(5)) {
+        struct.cversion = iprot.readI32();
+        struct.setCversionIsSet(true);
+      }
+      if (incoming.get(6)) {
+        struct.aversion = iprot.readI32();
+        struct.setAversionIsSet(true);
+      }
+      if (incoming.get(7)) {
+        struct.ephemeralOwner = iprot.readI64();
+        struct.setEphemeralOwnerIsSet(true);
+      }
+      if (incoming.get(8)) {
+        struct.dataLength = iprot.readI32();
+        struct.setDataLengthIsSet(true);
+      }
+      if (incoming.get(9)) {
+        struct.numChildren = iprot.readI32();
+        struct.setNumChildrenIsSet(true);
+      }
+      if (incoming.get(10)) {
+        struct.pzxid = iprot.readI64();
+        struct.setPzxidIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/test/java/org/apache/curator/generated/WatchedEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/WatchedEvent.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/WatchedEvent.java
new file mode 100644
index 0000000..025db2e
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/WatchedEvent.java
@@ -0,0 +1,620 @@
+/**
+ * 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 WatchedEvent implements org.apache.thrift.TBase<WatchedEvent, WatchedEvent._Fields>, java.io.Serializable, Cloneable, Comparable<WatchedEvent> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("WatchedEvent");
+
+  private static final org.apache.thrift.protocol.TField KEEPER_STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("keeperState", org.apache.thrift.protocol.TType.I32, (short)1);
+  private static final org.apache.thrift.protocol.TField EVENT_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("eventType", org.apache.thrift.protocol.TType.I32, (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 WatchedEventStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new WatchedEventTupleSchemeFactory());
+  }
+
+  /**
+   * 
+   * @see KeeperState
+   */
+  public KeeperState keeperState; // required
+  /**
+   * 
+   * @see EventType
+   */
+  public EventType eventType; // 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 {
+    /**
+     * 
+     * @see KeeperState
+     */
+    KEEPER_STATE((short)1, "keeperState"),
+    /**
+     * 
+     * @see EventType
+     */
+    EVENT_TYPE((short)2, "eventType"),
+    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: // KEEPER_STATE
+          return KEEPER_STATE;
+        case 2: // EVENT_TYPE
+          return EVENT_TYPE;
+        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.KEEPER_STATE, new org.apache.thrift.meta_data.FieldMetaData("keeperState", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, KeeperState.class)));
+    tmpMap.put(_Fields.EVENT_TYPE, new org.apache.thrift.meta_data.FieldMetaData("eventType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, EventType.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(WatchedEvent.class, metaDataMap);
+  }
+
+  public WatchedEvent() {
+  }
+
+  public WatchedEvent(
+    KeeperState keeperState,
+    EventType eventType,
+    String path)
+  {
+    this();
+    this.keeperState = keeperState;
+    this.eventType = eventType;
+    this.path = path;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public WatchedEvent(WatchedEvent other) {
+    if (other.isSetKeeperState()) {
+      this.keeperState = other.keeperState;
+    }
+    if (other.isSetEventType()) {
+      this.eventType = other.eventType;
+    }
+    if (other.isSetPath()) {
+      this.path = other.path;
+    }
+  }
+
+  public WatchedEvent deepCopy() {
+    return new WatchedEvent(this);
+  }
+
+  @Override
+  public void clear() {
+    this.keeperState = null;
+    this.eventType = null;
+    this.path = null;
+  }
+
+  /**
+   * 
+   * @see KeeperState
+   */
+  public KeeperState getKeeperState() {
+    return this.keeperState;
+  }
+
+  /**
+   * 
+   * @see KeeperState
+   */
+  public WatchedEvent setKeeperState(KeeperState keeperState) {
+    this.keeperState = keeperState;
+    return this;
+  }
+
+  public void unsetKeeperState() {
+    this.keeperState = null;
+  }
+
+  /** Returns true if field keeperState is set (has been assigned a value) and false otherwise */
+  public boolean isSetKeeperState() {
+    return this.keeperState != null;
+  }
+
+  public void setKeeperStateIsSet(boolean value) {
+    if (!value) {
+      this.keeperState = null;
+    }
+  }
+
+  /**
+   * 
+   * @see EventType
+   */
+  public EventType getEventType() {
+    return this.eventType;
+  }
+
+  /**
+   * 
+   * @see EventType
+   */
+  public WatchedEvent setEventType(EventType eventType) {
+    this.eventType = eventType;
+    return this;
+  }
+
+  public void unsetEventType() {
+    this.eventType = null;
+  }
+
+  /** Returns true if field eventType is set (has been assigned a value) and false otherwise */
+  public boolean isSetEventType() {
+    return this.eventType != null;
+  }
+
+  public void setEventTypeIsSet(boolean value) {
+    if (!value) {
+      this.eventType = null;
+    }
+  }
+
+  public String getPath() {
+    return this.path;
+  }
+
+  public WatchedEvent 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 KEEPER_STATE:
+      if (value == null) {
+        unsetKeeperState();
+      } else {
+        setKeeperState((KeeperState)value);
+      }
+      break;
+
+    case EVENT_TYPE:
+      if (value == null) {
+        unsetEventType();
+      } else {
+        setEventType((EventType)value);
+      }
+      break;
+
+    case PATH:
+      if (value == null) {
+        unsetPath();
+      } else {
+        setPath((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case KEEPER_STATE:
+      return getKeeperState();
+
+    case EVENT_TYPE:
+      return getEventType();
+
+    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 KEEPER_STATE:
+      return isSetKeeperState();
+    case EVENT_TYPE:
+      return isSetEventType();
+    case PATH:
+      return isSetPath();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof WatchedEvent)
+      return this.equals((WatchedEvent)that);
+    return false;
+  }
+
+  public boolean equals(WatchedEvent that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_keeperState = true && this.isSetKeeperState();
+    boolean that_present_keeperState = true && that.isSetKeeperState();
+    if (this_present_keeperState || that_present_keeperState) {
+      if (!(this_present_keeperState && that_present_keeperState))
+        return false;
+      if (!this.keeperState.equals(that.keeperState))
+        return false;
+    }
+
+    boolean this_present_eventType = true && this.isSetEventType();
+    boolean that_present_eventType = true && that.isSetEventType();
+    if (this_present_eventType || that_present_eventType) {
+      if (!(this_present_eventType && that_present_eventType))
+        return false;
+      if (!this.eventType.equals(that.eventType))
+        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(WatchedEvent other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetKeeperState()).compareTo(other.isSetKeeperState());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetKeeperState()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.keeperState, other.keeperState);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetEventType()).compareTo(other.isSetEventType());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetEventType()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.eventType, other.eventType);
+      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("WatchedEvent(");
+    boolean first = true;
+
+    sb.append("keeperState:");
+    if (this.keeperState == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.keeperState);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("eventType:");
+    if (this.eventType == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.eventType);
+    }
+    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
+  }
+
+  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 WatchedEventStandardSchemeFactory implements SchemeFactory {
+    public WatchedEventStandardScheme getScheme() {
+      return new WatchedEventStandardScheme();
+    }
+  }
+
+  private static class WatchedEventStandardScheme extends StandardScheme<WatchedEvent> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, WatchedEvent 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: // KEEPER_STATE
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.keeperState = KeeperState.findByValue(iprot.readI32());
+              struct.setKeeperStateIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // EVENT_TYPE
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.eventType = EventType.findByValue(iprot.readI32());
+              struct.setEventTypeIsSet(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, WatchedEvent struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.keeperState != null) {
+        oprot.writeFieldBegin(KEEPER_STATE_FIELD_DESC);
+        oprot.writeI32(struct.keeperState.getValue());
+        oprot.writeFieldEnd();
+      }
+      if (struct.eventType != null) {
+        oprot.writeFieldBegin(EVENT_TYPE_FIELD_DESC);
+        oprot.writeI32(struct.eventType.getValue());
+        oprot.writeFieldEnd();
+      }
+      if (struct.path != null) {
+        oprot.writeFieldBegin(PATH_FIELD_DESC);
+        oprot.writeString(struct.path);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class WatchedEventTupleSchemeFactory implements SchemeFactory {
+    public WatchedEventTupleScheme getScheme() {
+      return new WatchedEventTupleScheme();
+    }
+  }
+
+  private static class WatchedEventTupleScheme extends TupleScheme<WatchedEvent> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, WatchedEvent struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetKeeperState()) {
+        optionals.set(0);
+      }
+      if (struct.isSetEventType()) {
+        optionals.set(1);
+      }
+      if (struct.isSetPath()) {
+        optionals.set(2);
+      }
+      oprot.writeBitSet(optionals, 3);
+      if (struct.isSetKeeperState()) {
+        oprot.writeI32(struct.keeperState.getValue());
+      }
+      if (struct.isSetEventType()) {
+        oprot.writeI32(struct.eventType.getValue());
+      }
+      if (struct.isSetPath()) {
+        oprot.writeString(struct.path);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, WatchedEvent struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(3);
+      if (incoming.get(0)) {
+        struct.keeperState = KeeperState.findByValue(iprot.readI32());
+        struct.setKeeperStateIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.eventType = EventType.findByValue(iprot.readI32());
+        struct.setEventTypeIsSet(true);
+      }
+      if (incoming.get(2)) {
+        struct.path = iprot.readString();
+        struct.setPathIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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
new file mode 100644
index 0000000..4cad71f
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/id.java
@@ -0,0 +1,488 @@
+/**
+ * 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 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());
+  }
+
+  public String scheme; // required
+  public String 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 {
+    SCHEME((short)1, "scheme"),
+    ID((short)2, "id");
+
+    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: // SCHEME
+          return SCHEME;
+        case 2: // ID
+          return ID;
+        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.SCHEME, new org.apache.thrift.meta_data.FieldMetaData("scheme", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    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);
+  }
+
+  public id() {
+  }
+
+  public id(
+    String scheme,
+    String id)
+  {
+    this();
+    this.scheme = scheme;
+    this.id = id;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public id(id other) {
+    if (other.isSetScheme()) {
+      this.scheme = other.scheme;
+    }
+    if (other.isSetId()) {
+      this.id = other.id;
+    }
+  }
+
+  public id deepCopy() {
+    return new id(this);
+  }
+
+  @Override
+  public void clear() {
+    this.scheme = null;
+    this.id = null;
+  }
+
+  public String getScheme() {
+    return this.scheme;
+  }
+
+  public id setScheme(String scheme) {
+    this.scheme = scheme;
+    return this;
+  }
+
+  public void unsetScheme() {
+    this.scheme = null;
+  }
+
+  /** Returns true if field scheme is set (has been assigned a value) and false otherwise */
+  public boolean isSetScheme() {
+    return this.scheme != null;
+  }
+
+  public void setSchemeIsSet(boolean value) {
+    if (!value) {
+      this.scheme = null;
+    }
+  }
+
+  public String getId() {
+    return this.id;
+  }
+
+  public id 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 void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case SCHEME:
+      if (value == null) {
+        unsetScheme();
+      } else {
+        setScheme((String)value);
+      }
+      break;
+
+    case ID:
+      if (value == null) {
+        unsetId();
+      } else {
+        setId((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case SCHEME:
+      return getScheme();
+
+    case ID:
+      return getId();
+
+    }
+    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 SCHEME:
+      return isSetScheme();
+    case ID:
+      return isSetId();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof id)
+      return this.equals((id)that);
+    return false;
+  }
+
+  public boolean equals(id that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_scheme = true && this.isSetScheme();
+    boolean that_present_scheme = true && that.isSetScheme();
+    if (this_present_scheme || that_present_scheme) {
+      if (!(this_present_scheme && that_present_scheme))
+        return false;
+      if (!this.scheme.equals(that.scheme))
+        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;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(id other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetScheme()).compareTo(other.isSetScheme());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetScheme()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.scheme, other.scheme);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    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;
+      }
+    }
+    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("id(");
+    boolean first = true;
+
+    sb.append("scheme:");
+    if (this.scheme == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.scheme);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("id:");
+    if (this.id == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.id);
+    }
+    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 idStandardSchemeFactory implements SchemeFactory {
+    public idStandardScheme getScheme() {
+      return new idStandardScheme();
+    }
+  }
+
+  private static class idStandardScheme extends StandardScheme<id> {
+
+    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)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // SCHEME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.scheme = iprot.readString();
+              struct.setSchemeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // 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;
+          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, id struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.scheme != null) {
+        oprot.writeFieldBegin(SCHEME_FIELD_DESC);
+        oprot.writeString(struct.scheme);
+        oprot.writeFieldEnd();
+      }
+      if (struct.id != null) {
+        oprot.writeFieldBegin(ID_FIELD_DESC);
+        oprot.writeString(struct.id);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class idTupleSchemeFactory implements SchemeFactory {
+    public idTupleScheme getScheme() {
+      return new idTupleScheme();
+    }
+  }
+
+  private static class idTupleScheme extends TupleScheme<id> {
+
+    @Override
+    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()) {
+        optionals.set(0);
+      }
+      if (struct.isSetId()) {
+        optionals.set(1);
+      }
+      oprot.writeBitSet(optionals, 2);
+      if (struct.isSetScheme()) {
+        oprot.writeString(struct.scheme);
+      }
+      if (struct.isSetId()) {
+        oprot.writeString(struct.id);
+      }
+    }
+
+    @Override
+    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)) {
+        struct.scheme = iprot.readString();
+        struct.setSchemeIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.id = iprot.readString();
+        struct.setIdIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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
new file mode 100644
index 0000000..84d88c6
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/TestClient.java
@@ -0,0 +1,48 @@
+/**
+ * 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;
+
+import org.apache.curator.generated.CreateSpec;
+import org.apache.curator.generated.CuratorProjection;
+import org.apache.curator.generated.CuratorProjectionSpec;
+import org.apache.curator.generated.CuratorService;
+import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.transport.TSocket;
+
+public class TestClient
+{
+    public static void main(String[] args) throws TException
+    {
+        TSocket transport = new TSocket("localhost", 8899);
+        transport.open();
+        TProtocol protocol = new TBinaryProtocol(transport);
+        CuratorService.Client client = new CuratorService.Client(protocol);
+        CuratorProjection curatorProjection = client.newCuratorProjection(new CuratorProjectionSpec());
+        System.out.println(curatorProjection);
+
+        CreateSpec createSpec = new CreateSpec();
+        createSpec.setPath("/a/b/c");
+        createSpec.setCreatingParentsIfNeeded(true);
+        createSpec.setData("");
+        String s = client.create(curatorProjection, createSpec);
+        System.out.println(s);
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d9675c7..51f050a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -687,6 +687,7 @@
                         <exclude>**/README</exclude>
                         <exclude>**/CHANGES</exclude>
                         <exclude>**/RELEASE-NOTES</exclude>
+                        <exclude>**/generated/**</exclude>
                     </excludes>
                     <strictCheck>true</strictCheck>
                 </configuration>
@@ -728,6 +729,7 @@
                         <exclude>**/README</exclude>
                         <exclude>**/CHANGES</exclude>
                         <exclude>**/RELEASE-NOTES</exclude>
+                        <exclude>**/generated/**</exclude>
                     </excludes>
                 </configuration>
             </plugin>


[07/14] wip

Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorProjection.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorProjection.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorProjection.java
new file mode 100644
index 0000000..a2b18e3
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorProjection.java
@@ -0,0 +1,388 @@
+/**
+ * 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 CuratorProjection implements org.apache.thrift.TBase<CuratorProjection, CuratorProjection._Fields>, java.io.Serializable, Cloneable, Comparable<CuratorProjection> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CuratorProjection");
+
+  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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new CuratorProjectionStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new CuratorProjectionTupleSchemeFactory());
+  }
+
+  public String 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 {
+    ID((short)1, "id");
+
+    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;
+        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.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(CuratorProjection.class, metaDataMap);
+  }
+
+  public CuratorProjection() {
+  }
+
+  public CuratorProjection(
+    String id)
+  {
+    this();
+    this.id = id;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public CuratorProjection(CuratorProjection other) {
+    if (other.isSetId()) {
+      this.id = other.id;
+    }
+  }
+
+  public CuratorProjection deepCopy() {
+    return new CuratorProjection(this);
+  }
+
+  @Override
+  public void clear() {
+    this.id = null;
+  }
+
+  public String getId() {
+    return this.id;
+  }
+
+  public CuratorProjection 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 void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case ID:
+      if (value == null) {
+        unsetId();
+      } else {
+        setId((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case ID:
+      return getId();
+
+    }
+    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();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof CuratorProjection)
+      return this.equals((CuratorProjection)that);
+    return false;
+  }
+
+  public boolean equals(CuratorProjection 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;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(CuratorProjection 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;
+      }
+    }
+    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("CuratorProjection(");
+    boolean first = true;
+
+    sb.append("id:");
+    if (this.id == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.id);
+    }
+    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 CuratorProjectionStandardSchemeFactory implements SchemeFactory {
+    public CuratorProjectionStandardScheme getScheme() {
+      return new CuratorProjectionStandardScheme();
+    }
+  }
+
+  private static class CuratorProjectionStandardScheme extends StandardScheme<CuratorProjection> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, CuratorProjection 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;
+          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, CuratorProjection 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.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class CuratorProjectionTupleSchemeFactory implements SchemeFactory {
+    public CuratorProjectionTupleScheme getScheme() {
+      return new CuratorProjectionTupleScheme();
+    }
+  }
+
+  private static class CuratorProjectionTupleScheme extends TupleScheme<CuratorProjection> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, CuratorProjection struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetId()) {
+        optionals.set(0);
+      }
+      oprot.writeBitSet(optionals, 1);
+      if (struct.isSetId()) {
+        oprot.writeString(struct.id);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, CuratorProjection struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(1);
+      if (incoming.get(0)) {
+        struct.id = iprot.readString();
+        struct.setIdIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorProjectionSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorProjectionSpec.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorProjectionSpec.java
new file mode 100644
index 0000000..1171cc9
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorProjectionSpec.java
@@ -0,0 +1,280 @@
+/**
+ * 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 CuratorProjectionSpec implements org.apache.thrift.TBase<CuratorProjectionSpec, CuratorProjectionSpec._Fields>, java.io.Serializable, Cloneable, Comparable<CuratorProjectionSpec> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CuratorProjectionSpec");
+
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new CuratorProjectionSpecStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new CuratorProjectionSpecTupleSchemeFactory());
+  }
+
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+;
+
+    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) {
+        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;
+    }
+  }
+  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);
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CuratorProjectionSpec.class, metaDataMap);
+  }
+
+  public CuratorProjectionSpec() {
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public CuratorProjectionSpec(CuratorProjectionSpec other) {
+  }
+
+  public CuratorProjectionSpec deepCopy() {
+    return new CuratorProjectionSpec(this);
+  }
+
+  @Override
+  public void clear() {
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    }
+    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) {
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof CuratorProjectionSpec)
+      return this.equals((CuratorProjectionSpec)that);
+    return false;
+  }
+
+  public boolean equals(CuratorProjectionSpec that) {
+    if (that == null)
+      return false;
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(CuratorProjectionSpec other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    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("CuratorProjectionSpec(");
+    boolean first = true;
+
+    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 CuratorProjectionSpecStandardSchemeFactory implements SchemeFactory {
+    public CuratorProjectionSpecStandardScheme getScheme() {
+      return new CuratorProjectionSpecStandardScheme();
+    }
+  }
+
+  private static class CuratorProjectionSpecStandardScheme extends StandardScheme<CuratorProjectionSpec> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, CuratorProjectionSpec 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) {
+          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, CuratorProjectionSpec struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class CuratorProjectionSpecTupleSchemeFactory implements SchemeFactory {
+    public CuratorProjectionSpecTupleScheme getScheme() {
+      return new CuratorProjectionSpecTupleScheme();
+    }
+  }
+
+  private static class CuratorProjectionSpecTupleScheme extends TupleScheme<CuratorProjectionSpec> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, CuratorProjectionSpec struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, CuratorProjectionSpec struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+    }
+  }
+
+}
+


[11/14] git commit: wip

Posted by ra...@apache.org.
wip


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

Branch: refs/heads/curator-rpc
Commit: 7c99ddbf25b456afc990a43098851ce8174c8fdd
Parents: 16836aa
Author: randgalt <ra...@apache.org>
Authored: Mon May 26 15:59:37 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon May 26 15:59:37 2014 -0500

----------------------------------------------------------------------
 .../org/apache/curator/x/rpc/RpcManager.java    | 59 ++++++++++++++
 .../curator/x/rpc/idl/event/EventService.java   |  1 -
 .../projection/CuratorProjectionService.java    | 81 ++------------------
 3 files changed, 64 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/7c99ddbf/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
new file mode 100644
index 0000000..783297d
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/RpcManager.java
@@ -0,0 +1,59 @@
+package org.apache.curator.x.rpc;
+
+import com.google.common.collect.Maps;
+import org.apache.curator.framework.CuratorFramework;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+
+public class RpcManager
+{
+    private final Map<String, CuratorEntry> projections = Maps.newConcurrentMap();
+
+    private static class CuratorEntry
+    {
+        private final CuratorFramework client;
+        private final AtomicLong lastAccessEpoch = new AtomicLong(0);
+
+        private CuratorEntry(CuratorFramework client)
+        {
+            this.client = client;
+            updateLastAccess();
+        }
+
+        void updateLastAccess()
+        {
+            lastAccessEpoch.set(System.currentTimeMillis());
+        }
+    }
+
+    public void add(String id, CuratorFramework client)
+    {
+        projections.put(id, new CuratorEntry(client));
+    }
+
+    public void updateLastAccess(String id)
+    {
+        CuratorEntry entry = projections.get(id);
+        if ( entry != null )
+        {
+            entry.updateLastAccess();
+        }
+    }
+
+    public CuratorFramework getClient(String id)
+    {
+        CuratorEntry entry = projections.get(id);
+        if ( entry != null )
+        {
+            entry.updateLastAccess();
+            return entry.client;
+        }
+        return null;
+    }
+
+    public CuratorFramework removeClient(String id)
+    {
+        CuratorEntry entry = projections.remove(id);
+        return (entry != null) ? entry.client : null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/7c99ddbf/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
index c79fa20..206a347 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/EventService.java
@@ -18,7 +18,6 @@ public class EventService
     @ThriftMethod
     public RpcCuratorEvent getNextEvent() throws InterruptedException
     {
-        System.out.println(Thread.currentThread() + "getNextEvent");
         return events.take();
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/7c99ddbf/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 f6e4757..34eff59 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
@@ -20,7 +20,6 @@ package org.apache.curator.x.rpc.idl.projection;
 
 import com.facebook.swift.service.ThriftMethod;
 import com.facebook.swift.service.ThriftService;
-import com.google.common.collect.Maps;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.api.BackgroundCallback;
@@ -29,22 +28,17 @@ import org.apache.curator.framework.api.Compressible;
 import org.apache.curator.framework.api.CreateBuilder;
 import org.apache.curator.framework.api.CreateModable;
 import org.apache.curator.framework.api.CuratorEvent;
-import org.apache.curator.framework.api.CuratorEventType;
 import org.apache.curator.framework.api.PathAndBytesable;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.x.rpc.RpcManager;
 import org.apache.curator.x.rpc.idl.event.EventService;
 import org.apache.curator.x.rpc.idl.event.RpcCuratorEvent;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.data.ACL;
-import org.apache.zookeeper.data.Stat;
-import java.util.List;
-import java.util.Map;
 import java.util.UUID;
 
 @ThriftService("CuratorService")
 public class CuratorProjectionService
 {
-    private final Map<String, CuratorFramework> projections = Maps.newConcurrentMap();
+    private final RpcManager rpcManager = new RpcManager();
     private final EventService eventService;
 
     public CuratorProjectionService(EventService eventService)
@@ -55,82 +49,17 @@ public class CuratorProjectionService
     @ThriftMethod
     public CuratorProjection newCuratorProjection(CuratorProjectionSpec spec)   // TODO
     {
-        System.out.println(Thread.currentThread() + "newCuratorProjection");
-
-        eventService.addEvent(new RpcCuratorEvent(null, new CuratorEvent()
-        {
-            @Override
-            public CuratorEventType getType()
-            {
-                return CuratorEventType.CHILDREN;
-            }
-
-            @Override
-            public int getResultCode()
-            {
-                return 1;
-            }
-
-            @Override
-            public String getPath()
-            {
-                return null;
-            }
-
-            @Override
-            public Object getContext()
-            {
-                return null;
-            }
-
-            @Override
-            public Stat getStat()
-            {
-                return null;
-            }
-
-            @Override
-            public byte[] getData()
-            {
-                return new byte[0];
-            }
-
-            @Override
-            public String getName()
-            {
-                return null;
-            }
-
-            @Override
-            public List<String> getChildren()
-            {
-                return null;
-            }
-
-            @Override
-            public List<ACL> getACLList()
-            {
-                return null;
-            }
-
-            @Override
-            public WatchedEvent getWatchedEvent()
-            {
-                return null;
-            }
-        }));
-
         CuratorFramework client = CuratorFrameworkFactory.newClient("localhost:2181", new RetryOneTime(1));
         String id = UUID.randomUUID().toString();
         client.start();
-        projections.put(id, client);
+        rpcManager.add(id, client);
         return new CuratorProjection(id);
     }
 
     @ThriftMethod
     public void closeCuratorProjection(CuratorProjection projection)
     {
-        CuratorFramework client = projections.remove(projection.id);
+        CuratorFramework client = rpcManager.removeClient(projection.id);
         if ( client != null )
         {
             client.close();
@@ -202,7 +131,7 @@ public class CuratorProjectionService
 
     private CuratorFramework getClient(CuratorProjection projection) throws Exception
     {
-        CuratorFramework client = projections.get(projection.id);
+        CuratorFramework client = rpcManager.getClient(projection.id);
         if ( client == null )
         {
             throw new Exception("No client found with id: " + projection.id);


[03/14] git commit: wip

Posted by ra...@apache.org.
wip


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

Branch: refs/heads/curator-rpc
Commit: f103e02dcc906f9d0387a1e720fa20f8aa479904
Parents: 10e52ad
Author: randgalt <ra...@apache.org>
Authored: Mon May 26 01:14:22 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon May 26 01:14:22 2014 -0500

----------------------------------------------------------------------
 .../curator/x/rpc/CuratorProjectionServer.java  |   6 +-
 .../apache/curator/x/rpc/idl/CreateMode.java    |   9 -
 .../apache/curator/x/rpc/idl/CreateSpec.java    | 105 -------
 .../curator/x/rpc/idl/CuratorProjection.java    |  23 --
 .../x/rpc/idl/CuratorProjectionService.java     | 154 ----------
 .../x/rpc/idl/CuratorProjectionSpec.java        |   8 -
 .../x/rpc/idl/event/CuratorEventService.java    |  23 ++
 .../x/rpc/idl/event/CuratorRpcEvent.java        | 279 +++++++++++++++++++
 .../x/rpc/idl/event/CuratorRpcEventType.java    |  19 ++
 .../apache/curator/x/rpc/idl/event/RpcAcl.java  |  43 +++
 .../curator/x/rpc/idl/event/RpcEventType.java   |  13 +
 .../apache/curator/x/rpc/idl/event/RpcId.java   |  43 +++
 .../curator/x/rpc/idl/event/RpcKeeperState.java |  16 ++
 .../apache/curator/x/rpc/idl/event/RpcStat.java | 160 +++++++++++
 .../x/rpc/idl/event/RpcWatchedEvent.java        |  56 ++++
 .../x/rpc/idl/projection/CreateMode.java        |   9 +
 .../x/rpc/idl/projection/CreateSpec.java        | 105 +++++++
 .../x/rpc/idl/projection/CuratorProjection.java |  23 ++
 .../projection/CuratorProjectionService.java    | 133 +++++++++
 .../idl/projection/CuratorProjectionSpec.java   |   8 +
 curator-x-rpc/src/main/scripts/generate.sh      |  21 +-
 .../src/main/thrift/curator-event.thrift        |  64 +++++
 curator-x-rpc/src/main/thrift/curator.thrift    |   5 +-
 23 files changed, 1017 insertions(+), 308 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
index 22a5e3a..489d5a6 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
@@ -6,13 +6,15 @@ import com.facebook.swift.service.ThriftServer;
 import com.facebook.swift.service.ThriftServerConfig;
 import com.facebook.swift.service.ThriftServiceProcessor;
 import com.google.common.collect.Lists;
-import org.apache.curator.x.rpc.idl.CuratorProjectionService;
+import org.apache.curator.x.rpc.idl.event.CuratorEventService;
+import org.apache.curator.x.rpc.idl.projection.CuratorProjectionService;
 
 public class CuratorProjectionServer
 {
     public static void main(String[] args)
     {
-        CuratorProjectionService projectionService = new CuratorProjectionService();
+        CuratorEventService eventService = new CuratorEventService();
+        CuratorProjectionService projectionService = new CuratorProjectionService(eventService);
         ThriftServiceProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), Lists.<ThriftEventHandler>newArrayList(), projectionService);
         ThriftServer server = new ThriftServer(processor, new ThriftServerConfig().setPort(8899));  // TODO
         server.start();

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateMode.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateMode.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateMode.java
deleted file mode 100644
index f35e32b..0000000
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateMode.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.apache.curator.x.rpc.idl;
-
-public enum CreateMode
-{
-    PERSISTENT,
-    PERSISTENT_SEQUENTIAL,
-    EPHEMERAL,
-    EPHEMERAL_SEQUENTIAL
-}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateSpec.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateSpec.java
deleted file mode 100644
index f401fb5..0000000
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateSpec.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.apache.curator.x.rpc.idl;
-
-import com.facebook.swift.codec.ThriftField;
-import com.facebook.swift.codec.ThriftStruct;
-
-@ThriftStruct
-public class CreateSpec
-{
-    private String path;
-    private String data;
-    private CreateMode mode;
-    private boolean async;
-    private String asyncId;
-    private boolean compressed;
-    private boolean creatingParentsIfNeeded;
-    private boolean withProtection;
-
-    @ThriftField(1)
-    public String getPath()
-    {
-        return path;
-    }
-
-    @ThriftField(2)
-    public String getAsyncId()
-    {
-        return asyncId;
-    }
-
-    public void setAsyncId(String asyncId)
-    {
-        this.asyncId = asyncId;
-    }
-
-    public void setPath(String path)
-    {
-        this.path = path;
-    }
-
-    @ThriftField(3)
-    public String getData()
-    {
-        return data;
-    }
-
-    public void setData(String data)
-    {
-        this.data = data;
-    }
-
-    @ThriftField(4)
-    public CreateMode getMode()
-    {
-        return mode;
-    }
-
-    public void setMode(CreateMode mode)
-    {
-        this.mode = mode;
-    }
-
-    @ThriftField(5)
-    public boolean isAsync()
-    {
-        return async;
-    }
-
-    public void setAsync(boolean async)
-    {
-        this.async = async;
-    }
-
-    @ThriftField(6)
-    public boolean isCompressed()
-    {
-        return compressed;
-    }
-
-    public void setCompressed(boolean compressed)
-    {
-        this.compressed = compressed;
-    }
-
-    @ThriftField(7)
-    public boolean isCreatingParentsIfNeeded()
-    {
-        return creatingParentsIfNeeded;
-    }
-
-    public void setCreatingParentsIfNeeded(boolean creatingParentsIfNeeded)
-    {
-        this.creatingParentsIfNeeded = creatingParentsIfNeeded;
-    }
-
-    @ThriftField(8)
-    public boolean isWithProtection()
-    {
-        return withProtection;
-    }
-
-    public void setWithProtection(boolean withProtection)
-    {
-        this.withProtection = withProtection;
-    }
-}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjection.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjection.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjection.java
deleted file mode 100644
index 85864c5..0000000
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjection.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.apache.curator.x.rpc.idl;
-
-import com.facebook.swift.codec.ThriftConstructor;
-import com.facebook.swift.codec.ThriftField;
-import com.facebook.swift.codec.ThriftStruct;
-
-@ThriftStruct
-public class CuratorProjection
-{
-    private final String id;
-
-    @ThriftConstructor
-    public CuratorProjection(String id)
-    {
-        this.id = id;
-    }
-
-    @ThriftField(1)
-    public String getId()
-    {
-        return id;
-    }
-}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionService.java
deleted file mode 100644
index 8acfd0f..0000000
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionService.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.curator.x.rpc.idl;
-
-import com.facebook.swift.service.ThriftMethod;
-import com.facebook.swift.service.ThriftService;
-import com.google.common.collect.Maps;
-import org.apache.curator.framework.CuratorFramework;
-import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.api.Compressible;
-import org.apache.curator.framework.api.CreateBuilder;
-import org.apache.curator.framework.api.CreateModable;
-import org.apache.curator.framework.api.PathAndBytesable;
-import org.apache.curator.retry.RetryOneTime;
-import java.util.Map;
-import java.util.UUID;
-
-@ThriftService("curator")
-public class CuratorProjectionService
-{
-    private final Map<String, CuratorFramework> projections = Maps.newConcurrentMap();
-
-    @ThriftMethod
-    public CuratorProjection newCuratorProjection(CuratorProjectionSpec spec)
-    {
-        CuratorFramework client = CuratorFrameworkFactory.newClient("localhost:2181", new RetryOneTime(1));
-        String id = UUID.randomUUID().toString();
-        client.start();
-        projections.put(id, client);
-        return new CuratorProjection(id);
-    }
-
-    @ThriftMethod
-    public void closeCuratorProjection(CuratorProjection projection)
-    {
-        CuratorFramework client = projections.remove(projection.getId());
-        if ( client != null )
-        {
-            client.close();
-        }
-    }
-
-    //@ThriftMethod
-    public String create(CuratorProjection projection, CreateSpec createSpec) throws Exception
-    {
-        CuratorFramework client = getClient(projection);
-
-        Object builder = client.create();
-        if ( createSpec.isCreatingParentsIfNeeded() )
-        {
-            builder = castBuilder(builder, CreateBuilder.class).creatingParentsIfNeeded();
-        }
-        if ( createSpec.isCompressed() )
-        {
-            builder = castBuilder(builder, Compressible.class).compressed();
-        }
-        if ( createSpec.isWithProtection() )
-        {
-            builder = castBuilder(builder, CreateBuilder.class).withProtection();
-        }
-        builder = castBuilder(builder, CreateModable.class).withMode(getRealMode(createSpec.getMode()));
-
-        if ( createSpec.isAsync() )
-        {
-/*
-TODO
-            BackgroundCallback backgroundCallback = new RestBackgroundCallback(context, Constants.CLIENT_CREATE_ASYNC, createSpec.getAsyncId())
-            {
-                @Override
-                public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
-                {
-                    if ( event.getResultCode() == 0 )
-                    {
-                        checkEphemeralCreate(createSpec, id, event.getName());
-                    }
-                    super.processResult(client, event);
-                }
-
-                @Override
-                protected String getMessage(CuratorEvent event)
-                {
-                    PathAndId pathAndId = new PathAndId(String.valueOf(event.getName()), id);
-                    try
-                    {
-                        return context.getWriter().writeValueAsString(pathAndId);
-                    }
-                    catch ( IOException e )
-                    {
-                        log.error("Could not serialize PathAndId", e);
-                    }
-                    return "{}";
-                }
-
-                @Override
-                protected String getDetails(CuratorEvent event)
-                {
-                    if ( event.getResultCode() != 0 )
-                    {
-                        return super.getDetails(event);
-                    }
-                    return id;
-                }
-            };
-            builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
-*/
-        }
-
-        return String.valueOf(castBuilder(builder, PathAndBytesable.class).forPath(createSpec.getPath(), createSpec.getData().getBytes()));
-    }
-
-    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 CuratorFramework getClient(CuratorProjection projection) throws Exception
-    {
-        CuratorFramework client = projections.get(projection.getId());
-        if ( client == null )
-        {
-            throw new Exception("No client found with id: " + projection.getId());
-        }
-        return client;
-    }
-
-    private static <T> T castBuilder(Object createBuilder, Class<T> clazz) throws Exception
-    {
-        if ( clazz.isAssignableFrom(createBuilder.getClass()) )
-        {
-            return clazz.cast(createBuilder);
-        }
-        throw new Exception("That operation is not available"); // TODO
-    }
-}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionSpec.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionSpec.java
deleted file mode 100644
index cf45632..0000000
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionSpec.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.apache.curator.x.rpc.idl;
-
-import com.facebook.swift.codec.ThriftStruct;
-
-@ThriftStruct
-public class CuratorProjectionSpec
-{
-}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorEventService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorEventService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorEventService.java
new file mode 100644
index 0000000..844de0d
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorEventService.java
@@ -0,0 +1,23 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.service.ThriftMethod;
+import com.facebook.swift.service.ThriftService;
+import com.google.common.collect.Queues;
+import java.util.concurrent.BlockingQueue;
+
+@ThriftService("CuratorEventService")
+public class CuratorEventService
+{
+    private final BlockingQueue<CuratorRpcEvent> events = Queues.newLinkedBlockingQueue();
+
+    @ThriftMethod
+    public CuratorRpcEvent getNextEvent() throws InterruptedException
+    {
+        return events.take();
+    }
+
+    public void addEvent(CuratorRpcEvent event)
+    {
+        events.offer(event);
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEvent.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEvent.java
new file mode 100644
index 0000000..db2b278
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEvent.java
@@ -0,0 +1,279 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftField;
+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.x.rpc.idl.projection.CuratorProjection;
+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;
+import java.util.List;
+
+@SuppressWarnings("deprecation")
+@ThriftStruct("CuratorEvent")
+public class CuratorRpcEvent
+{
+    private final CuratorProjection projection;
+    private final CuratorEvent event;
+
+    public CuratorRpcEvent()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public CuratorRpcEvent(CuratorProjection projection, CuratorEvent event)
+    {
+        this.projection = projection;
+        this.event = event;
+    }
+
+    @ThriftField(1)
+    public CuratorProjection getProjection()
+    {
+        return projection;
+    }
+
+    @ThriftField(2)
+    public CuratorRpcEventType getType()
+    {
+        switch ( event.getType() )
+        {
+            case CREATE:
+            {
+                return CuratorRpcEventType.CREATE;
+            }
+
+            case DELETE:
+            {
+                return CuratorRpcEventType.DELETE;
+            }
+
+            case EXISTS:
+            {
+                return CuratorRpcEventType.EXISTS;
+            }
+
+            case GET_DATA:
+            {
+                return CuratorRpcEventType.GET_DATA;
+            }
+
+            case SET_DATA:
+            {
+                return CuratorRpcEventType.SET_DATA;
+            }
+
+            case CHILDREN:
+            {
+                return CuratorRpcEventType.CHILDREN;
+            }
+
+            case SYNC:
+            {
+                return CuratorRpcEventType.SYNC;
+            }
+
+            case GET_ACL:
+            {
+                return CuratorRpcEventType.GET_ACL;
+            }
+
+            case SET_ACL:
+            {
+                return CuratorRpcEventType.SET_ACL;
+            }
+
+            case WATCHED:
+            {
+                return CuratorRpcEventType.WATCHED;
+            }
+
+            case CLOSING:
+            {
+                return CuratorRpcEventType.CLOSING;
+            }
+        }
+
+        throw new IllegalStateException("Unknown type: " + event.getType());
+    }
+
+    @ThriftField(3)
+    public int getResultCode()
+    {
+        return event.getResultCode();
+    }
+
+    @ThriftField(4)
+    public String getPath()
+    {
+        return event.getPath();
+    }
+
+    @ThriftField(5)
+    public String getContext()
+    {
+        return String.valueOf(event.getContext());
+    }
+
+    @ThriftField(6)
+    public RpcStat getStat()
+    {
+        Stat stat = event.getStat();
+        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 null;
+    }
+
+    @ThriftField(7)
+    public byte[] getData()
+    {
+        return event.getData();
+    }
+
+    @ThriftField(8)
+    public String getName()
+    {
+        return event.getPath();
+    }
+
+    @ThriftField(9)
+    public List<String> getChildren()
+    {
+        return event.getChildren();
+    }
+
+    @ThriftField(10)
+    public List<RpcAcl> getACLList()
+    {
+        List<ACL> aclList = event.getACLList();
+        if ( aclList != null )
+        {
+            return Lists.transform
+            (
+                aclList,
+                new Function<ACL, RpcAcl>()
+                {
+                    @Nullable
+                    @Override
+                    public RpcAcl apply(ACL acl)
+                    {
+                        RpcId id = new RpcId(acl.getId().getScheme(), acl.getId().getId());
+                        return new RpcAcl(acl.getPerms(), id);
+                    }
+                }
+            );
+        }
+        return null;
+    }
+
+    @ThriftField(11)
+    public RpcWatchedEvent getWatchedEvent()
+    {
+        WatchedEvent watchedEvent = event.getWatchedEvent();
+        if ( watchedEvent != null )
+        {
+            RpcKeeperState keeperState = toRpcKeeperState(watchedEvent.getState());
+            RpcEventType eventType = toRpcEventType(watchedEvent.getType());
+            return new RpcWatchedEvent(keeperState, eventType, watchedEvent.getPath());
+        }
+        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/f103e02d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEventType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEventType.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEventType.java
new file mode 100644
index 0000000..b905075
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEventType.java
@@ -0,0 +1,19 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftEnum;
+
+@ThriftEnum("CuratorEventType")
+public enum CuratorRpcEventType
+{
+    CREATE,
+    DELETE,
+    EXISTS,
+    GET_DATA,
+    SET_DATA,
+    CHILDREN,
+    SYNC,
+    GET_ACL,
+    SET_ACL,
+    WATCHED,
+    CLOSING
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcAcl.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcAcl.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcAcl.java
new file mode 100644
index 0000000..54daa11
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcAcl.java
@@ -0,0 +1,43 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct("Acl")
+public class RpcAcl
+{
+    private int perms;
+    private RpcId id;
+
+    public RpcAcl()
+    {
+    }
+
+    public RpcAcl(int perms, RpcId id)
+    {
+        this.perms = perms;
+        this.id = id;
+    }
+
+    @ThriftField(1)
+    public int getPerms()
+    {
+        return perms;
+    }
+
+    public void setPerms(int perms)
+    {
+        this.perms = perms;
+    }
+
+    @ThriftField(2)
+    public RpcId getId()
+    {
+        return id;
+    }
+
+    public void setId(RpcId id)
+    {
+        this.id = id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcEventType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcEventType.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcEventType.java
new file mode 100644
index 0000000..8328940
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcEventType.java
@@ -0,0 +1,13 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftEnum;
+
+@ThriftEnum("EventType")
+public enum RpcEventType
+{
+    None,
+    NodeCreated,
+    NodeDeleted,
+    NodeDataChanged,
+    NodeChildrenChanged
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/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
new file mode 100644
index 0000000..858dea1
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcId.java
@@ -0,0 +1,43 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct("id")
+public class RpcId
+{
+    private String scheme;
+    private String id;
+
+    public RpcId()
+    {
+    }
+
+    public RpcId(String scheme, String id)
+    {
+        this.scheme = scheme;
+        this.id = id;
+    }
+
+    @ThriftField(1)
+    public String getScheme()
+    {
+        return scheme;
+    }
+
+    public void setScheme(String scheme)
+    {
+        this.scheme = scheme;
+    }
+
+    @ThriftField(2)
+    public String getId()
+    {
+        return id;
+    }
+
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcKeeperState.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcKeeperState.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcKeeperState.java
new file mode 100644
index 0000000..e5881a8
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcKeeperState.java
@@ -0,0 +1,16 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftEnum;
+
+@ThriftEnum("KeeperState")
+public enum RpcKeeperState
+{
+    Unknown,
+    Disconnected,
+    NoSyncConnected,
+    SyncConnected,
+    AuthFailed,
+    ConnectedReadOnly,
+    SaslAuthenticated,
+    Expired
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/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
new file mode 100644
index 0000000..382c45a
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcStat.java
@@ -0,0 +1,160 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct("Stat")
+public class RpcStat
+{
+    private long czxid;
+    private long mzxid;
+    private long ctime;
+    private long mtime;
+    private int version;
+    private int cversion;
+    private int aversion;
+    private long ephemeralOwner;
+    private int dataLength;
+    private int numChildren;
+    private long pzxid;
+
+    public RpcStat()
+    {
+    }
+
+    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;
+        this.mzxid = mzxid;
+        this.ctime = ctime;
+        this.mtime = mtime;
+        this.version = version;
+        this.cversion = cversion;
+        this.aversion = aversion;
+        this.ephemeralOwner = ephemeralOwner;
+        this.dataLength = dataLength;
+        this.numChildren = numChildren;
+        this.pzxid = pzxid;
+    }
+
+    @ThriftField(1)
+    public long getCzxid()
+    {
+        return czxid;
+    }
+
+    public void setCzxid(long czxid)
+    {
+        this.czxid = czxid;
+    }
+
+    @ThriftField(2)
+    public long getMzxid()
+    {
+        return mzxid;
+    }
+
+    public void setMzxid(long mzxid)
+    {
+        this.mzxid = mzxid;
+    }
+
+    @ThriftField(3)
+    public long getCtime()
+    {
+        return ctime;
+    }
+
+    public void setCtime(long ctime)
+    {
+        this.ctime = ctime;
+    }
+
+    @ThriftField(4)
+    public long getMtime()
+    {
+        return mtime;
+    }
+
+    public void setMtime(long mtime)
+    {
+        this.mtime = mtime;
+    }
+
+    @ThriftField(5)
+    public int getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion(int version)
+    {
+        this.version = version;
+    }
+
+    @ThriftField(6)
+    public int getCversion()
+    {
+        return cversion;
+    }
+
+    public void setCversion(int cversion)
+    {
+        this.cversion = cversion;
+    }
+
+    @ThriftField(7)
+    public int getAversion()
+    {
+        return aversion;
+    }
+
+    public void setAversion(int aversion)
+    {
+        this.aversion = aversion;
+    }
+
+    @ThriftField(8)
+    public long getEphemeralOwner()
+    {
+        return ephemeralOwner;
+    }
+
+    public void setEphemeralOwner(long ephemeralOwner)
+    {
+        this.ephemeralOwner = ephemeralOwner;
+    }
+
+    @ThriftField(9)
+    public int getDataLength()
+    {
+        return dataLength;
+    }
+
+    public void setDataLength(int dataLength)
+    {
+        this.dataLength = dataLength;
+    }
+
+    @ThriftField(10)
+    public int getNumChildren()
+    {
+        return numChildren;
+    }
+
+    public void setNumChildren(int numChildren)
+    {
+        this.numChildren = numChildren;
+    }
+
+    @ThriftField(11)
+    public long getPzxid()
+    {
+        return pzxid;
+    }
+
+    public void setPzxid(long pzxid)
+    {
+        this.pzxid = pzxid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/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
new file mode 100644
index 0000000..69187dc
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcWatchedEvent.java
@@ -0,0 +1,56 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct("WatchedEvent")
+public class RpcWatchedEvent
+{
+    private RpcKeeperState keeperState;
+    private RpcEventType eventType;
+    private String path;
+
+    public RpcWatchedEvent()
+    {
+    }
+
+    public RpcWatchedEvent(RpcKeeperState keeperState, RpcEventType eventType, String path)
+    {
+        this.keeperState = keeperState;
+        this.eventType = eventType;
+        this.path = path;
+    }
+
+    @ThriftField(1)
+    public RpcKeeperState getKeeperState()
+    {
+        return keeperState;
+    }
+
+    public void setKeeperState(RpcKeeperState keeperState)
+    {
+        this.keeperState = keeperState;
+    }
+
+    @ThriftField(2)
+    public RpcEventType getEventType()
+    {
+        return eventType;
+    }
+
+    public void setEventType(RpcEventType eventType)
+    {
+        this.eventType = eventType;
+    }
+
+    @ThriftField(3)
+    public String getPath()
+    {
+        return path;
+    }
+
+    public void setPath(String path)
+    {
+        this.path = path;
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/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
new file mode 100644
index 0000000..ea4ff84
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CreateMode.java
@@ -0,0 +1,9 @@
+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/f103e02d/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
new file mode 100644
index 0000000..9019671
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CreateSpec.java
@@ -0,0 +1,105 @@
+package org.apache.curator.x.rpc.idl.projection;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct
+public class CreateSpec
+{
+    private String path;
+    private String data;
+    private CreateMode mode;
+    private boolean async;
+    private String asyncId;
+    private boolean compressed;
+    private boolean creatingParentsIfNeeded;
+    private boolean withProtection;
+
+    @ThriftField(1)
+    public String getPath()
+    {
+        return path;
+    }
+
+    @ThriftField(2)
+    public String getAsyncId()
+    {
+        return asyncId;
+    }
+
+    public void setAsyncId(String asyncId)
+    {
+        this.asyncId = asyncId;
+    }
+
+    public void setPath(String path)
+    {
+        this.path = path;
+    }
+
+    @ThriftField(3)
+    public String getData()
+    {
+        return data;
+    }
+
+    public void setData(String data)
+    {
+        this.data = data;
+    }
+
+    @ThriftField(4)
+    public CreateMode getMode()
+    {
+        return mode;
+    }
+
+    public void setMode(CreateMode mode)
+    {
+        this.mode = mode;
+    }
+
+    @ThriftField(5)
+    public boolean isAsync()
+    {
+        return async;
+    }
+
+    public void setAsync(boolean async)
+    {
+        this.async = async;
+    }
+
+    @ThriftField(6)
+    public boolean isCompressed()
+    {
+        return compressed;
+    }
+
+    public void setCompressed(boolean compressed)
+    {
+        this.compressed = compressed;
+    }
+
+    @ThriftField(7)
+    public boolean isCreatingParentsIfNeeded()
+    {
+        return creatingParentsIfNeeded;
+    }
+
+    public void setCreatingParentsIfNeeded(boolean creatingParentsIfNeeded)
+    {
+        this.creatingParentsIfNeeded = creatingParentsIfNeeded;
+    }
+
+    @ThriftField(8)
+    public boolean isWithProtection()
+    {
+        return withProtection;
+    }
+
+    public void setWithProtection(boolean withProtection)
+    {
+        this.withProtection = withProtection;
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjection.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjection.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjection.java
new file mode 100644
index 0000000..053d825
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjection.java
@@ -0,0 +1,23 @@
+package org.apache.curator.x.rpc.idl.projection;
+
+import com.facebook.swift.codec.ThriftConstructor;
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct
+public class CuratorProjection
+{
+    private final String id;
+
+    @ThriftConstructor
+    public CuratorProjection(String id)
+    {
+        this.id = id;
+    }
+
+    @ThriftField(1)
+    public String getId()
+    {
+        return id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/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
new file mode 100644
index 0000000..aeb52c8
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
@@ -0,0 +1,133 @@
+package org.apache.curator.x.rpc.idl.projection;
+
+import com.facebook.swift.service.ThriftMethod;
+import com.facebook.swift.service.ThriftService;
+import com.google.common.collect.Maps;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.framework.api.BackgroundCallback;
+import org.apache.curator.framework.api.Backgroundable;
+import org.apache.curator.framework.api.Compressible;
+import org.apache.curator.framework.api.CreateBuilder;
+import org.apache.curator.framework.api.CreateModable;
+import org.apache.curator.framework.api.CuratorEvent;
+import org.apache.curator.framework.api.PathAndBytesable;
+import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.x.rpc.idl.event.CuratorEventService;
+import org.apache.curator.x.rpc.idl.event.CuratorRpcEvent;
+import java.util.Map;
+import java.util.UUID;
+
+@ThriftService("CuratorService")
+public class CuratorProjectionService
+{
+    private final Map<String, CuratorFramework> projections = Maps.newConcurrentMap();
+    private final CuratorEventService eventService;
+
+    public CuratorProjectionService(CuratorEventService eventService)
+    {
+        this.eventService = eventService;
+    }
+
+    @ThriftMethod
+    public CuratorProjection newCuratorProjection(CuratorProjectionSpec spec)
+    {
+        CuratorFramework client = CuratorFrameworkFactory.newClient("localhost:2181", new RetryOneTime(1));
+        String id = UUID.randomUUID().toString();
+        client.start();
+        projections.put(id, client);
+        return new CuratorProjection(id);
+    }
+
+    @ThriftMethod
+    public void closeCuratorProjection(CuratorProjection projection)
+    {
+        CuratorFramework client = projections.remove(projection.getId());
+        if ( client != null )
+        {
+            client.close();
+        }
+    }
+
+    @ThriftMethod
+    public String create(final CuratorProjection projection, CreateSpec createSpec) throws Exception
+    {
+        CuratorFramework client = getClient(projection);
+
+        Object builder = client.create();
+        if ( createSpec.isCreatingParentsIfNeeded() )
+        {
+            builder = castBuilder(builder, CreateBuilder.class).creatingParentsIfNeeded();
+        }
+        if ( createSpec.isCompressed() )
+        {
+            builder = castBuilder(builder, Compressible.class).compressed();
+        }
+        if ( createSpec.isWithProtection() )
+        {
+            builder = castBuilder(builder, CreateBuilder.class).withProtection();
+        }
+        builder = castBuilder(builder, CreateModable.class).withMode(getRealMode(createSpec.getMode()));
+
+        if ( createSpec.isAsync() )
+        {
+            BackgroundCallback backgroundCallback = new BackgroundCallback()
+            {
+                @Override
+                public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
+                {
+                    eventService.addEvent(new CuratorRpcEvent(projection, event));
+                }
+            };
+            builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
+        }
+
+        return String.valueOf(castBuilder(builder, PathAndBytesable.class).forPath(createSpec.getPath(), createSpec.getData().getBytes()));
+    }
+
+    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 CuratorFramework getClient(CuratorProjection projection) throws Exception
+    {
+        CuratorFramework client = projections.get(projection.getId());
+        if ( client == null )
+        {
+            throw new Exception("No client found with id: " + projection.getId());
+        }
+        return client;
+    }
+
+    private static <T> T castBuilder(Object createBuilder, Class<T> clazz) throws Exception
+    {
+        if ( clazz.isAssignableFrom(createBuilder.getClass()) )
+        {
+            return clazz.cast(createBuilder);
+        }
+        throw new Exception("That operation is not available"); // TODO
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionSpec.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionSpec.java
new file mode 100644
index 0000000..abec7f7
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionSpec.java
@@ -0,0 +1,8 @@
+package org.apache.curator.x.rpc.idl.projection;
+
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct
+public class CuratorProjectionSpec
+{
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/scripts/generate.sh
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/scripts/generate.sh b/curator-x-rpc/src/main/scripts/generate.sh
index b094336..9fdc4c6 100755
--- a/curator-x-rpc/src/main/scripts/generate.sh
+++ b/curator-x-rpc/src/main/scripts/generate.sh
@@ -9,11 +9,20 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 BASE_DIR="$( cd "$DIR/../../../.." && pwd )"
 
 RPC_PATH="$BASE_DIR/curator-x-rpc/target/classes"
-CLASSES=""
-for f in `ls -m1 $RPC_PATH/org/apache/curator/x/rpc/idl/*.class | xargs -n 1 basename | sed s/\.[^\.]*$//`;
+
+PROJECTION_CLASSES=""
+for f in `ls -m1 $RPC_PATH/org/apache/curator/x/rpc/idl/projection/*.class | xargs -n 1 basename | sed s/\.[^\.]*$//`;
+    do
+        if [[ $f != *[\$]* ]]; then
+            PROJECTION_CLASSES="$PROJECTION_CLASSES $f";
+        fi;
+done;
+
+EVENT_CLASSES=""
+for f in `ls -m1 $RPC_PATH/org/apache/curator/x/rpc/idl/event/*.class | xargs -n 1 basename | sed s/\.[^\.]*$//`;
     do
         if [[ $f != *[\$]* ]]; then
-            CLASSES="$CLASSES $f";
+            EVENT_CLASSES="$EVENT_CLASSES $f";
         fi;
 done;
 
@@ -25,6 +34,8 @@ PATHS="$PATHS:$BASE_DIR/curator-framework/target/classes"
 PATHS="$PATHS:$BASE_DIR/curator-recipes/target/classes"
 PATHS="$PATHS:$RPC_PATH"
 
-PACKAGE="org.apache.curator.x.rpc.idl"
+PROJECTION_PACKAGE="org.apache.curator.x.rpc.idl.projection"
+EVENT_PACKAGE="org.apache.curator.x.rpc.idl.event"
 
-java -cp $PATHS com.facebook.swift.generator.swift2thrift.Main -namespace cpp org.apache.curator -out "$THRIFT_DIR/curator.thrift" -package $PACKAGE $CLASSES
+java -cp $PATHS com.facebook.swift.generator.swift2thrift.Main -namespace cpp org.apache.curator -out "$THRIFT_DIR/curator.thrift" -package $PROJECTION_PACKAGE $PROJECTION_CLASSES
+java -cp $PATHS com.facebook.swift.generator.swift2thrift.Main -map org.apache.curator.x.rpc.idl.projection.CuratorProjection "curator.thrift" -namespace cpp org.apache.curator -out "$THRIFT_DIR/curator-event.thrift" -package $EVENT_PACKAGE $EVENT_CLASSES

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/curator-x-rpc/src/main/thrift/curator-event.thrift
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/thrift/curator-event.thrift b/curator-x-rpc/src/main/thrift/curator-event.thrift
new file mode 100644
index 0000000..9c407eb
--- /dev/null
+++ b/curator-x-rpc/src/main/thrift/curator-event.thrift
@@ -0,0 +1,64 @@
+namespace java.swift org.apache.curator.x.rpc.idl.event
+namespace cpp org.apache.curator
+
+include "curator.thrift"
+
+enum CuratorEventType {
+  CREATE, DELETE, EXISTS, GET_DATA, SET_DATA, CHILDREN, SYNC, GET_ACL, SET_ACL, WATCHED, CLOSING
+}
+
+enum EventType {
+  None, NodeCreated, NodeDeleted, NodeDataChanged, NodeChildrenChanged
+}
+
+enum KeeperState {
+  Unknown, Disconnected, NoSyncConnected, SyncConnected, AuthFailed, ConnectedReadOnly, SaslAuthenticated, Expired
+}
+
+struct id {
+  1: string scheme;
+  2: string id;
+}
+
+struct Stat {
+  1: i64 czxid;
+  2: i64 mzxid;
+  3: i64 ctime;
+  4: i64 mtime;
+  5: i32 version;
+  6: i32 cversion;
+  7: i32 aversion;
+  8: i64 ephemeralOwner;
+  9: i32 dataLength;
+  10: i32 numChildren;
+  11: i64 pzxid;
+}
+
+struct WatchedEvent {
+  1: KeeperState keeperState;
+  2: EventType eventType;
+  3: string path;
+}
+
+struct Acl {
+  1: i32 perms;
+  2: id id;
+}
+
+struct CuratorEvent {
+  1: curator.CuratorProjection projection;
+  2: CuratorEventType type;
+  3: i32 resultCode;
+  4: string path;
+  5: string context;
+  6: Stat stat;
+  7: binary data;
+  8: string name;
+  9: list<string> children;
+  10: list<Acl> aCLList;
+  11: WatchedEvent watchedEvent;
+}
+
+service CuratorEventService {
+  CuratorEvent getNextEvent();
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/f103e02d/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 5662949..7973580 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -1,4 +1,4 @@
-namespace java.swift org.apache.curator.x.rpc.idl
+namespace java.swift org.apache.curator.x.rpc.idl.projection
 namespace cpp org.apache.curator
 
 
@@ -24,7 +24,8 @@ struct CuratorProjection {
 struct CuratorProjectionSpec {
 }
 
-service curator {
+service CuratorService {
   void closeCuratorProjection(1: CuratorProjection projection);
+  string create(1: CuratorProjection projection, 2: CreateSpec createSpec);
   CuratorProjection newCuratorProjection(1: CuratorProjectionSpec spec);
 }


[04/14] git commit: wip

Posted by ra...@apache.org.
wip


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

Branch: refs/heads/curator-rpc
Commit: cd3dbdcbe5f17c8db51d75e3d33f492b6e56dc14
Parents: f103e02
Author: randgalt <ra...@apache.org>
Authored: Mon May 26 02:02:16 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon May 26 02:02:16 2014 -0500

----------------------------------------------------------------------
 .../curator/x/rpc/CuratorProjectionServer.java  |   4 +-
 .../x/rpc/idl/event/CuratorEventService.java    |  23 --
 .../x/rpc/idl/event/CuratorRpcEvent.java        | 279 -------------------
 .../x/rpc/idl/event/CuratorRpcEventType.java    |  19 --
 .../x/rpc/idl/event/RpcCuratorEvent.java        | 279 +++++++++++++++++++
 .../x/rpc/idl/event/RpcCuratorEventType.java    |  19 ++
 .../projection/CuratorProjectionService.java    |  22 +-
 curator-x-rpc/src/main/scripts/generate.sh      |   8 +-
 .../src/main/thrift/curator-event.thrift        |  64 -----
 curator-x-rpc/src/main/thrift/curator.thrift    |  59 +++-
 10 files changed, 375 insertions(+), 401 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/cd3dbdcb/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
index 489d5a6..cd35f42 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
@@ -6,15 +6,13 @@ import com.facebook.swift.service.ThriftServer;
 import com.facebook.swift.service.ThriftServerConfig;
 import com.facebook.swift.service.ThriftServiceProcessor;
 import com.google.common.collect.Lists;
-import org.apache.curator.x.rpc.idl.event.CuratorEventService;
 import org.apache.curator.x.rpc.idl.projection.CuratorProjectionService;
 
 public class CuratorProjectionServer
 {
     public static void main(String[] args)
     {
-        CuratorEventService eventService = new CuratorEventService();
-        CuratorProjectionService projectionService = new CuratorProjectionService(eventService);
+        CuratorProjectionService projectionService = new CuratorProjectionService();
         ThriftServiceProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), Lists.<ThriftEventHandler>newArrayList(), projectionService);
         ThriftServer server = new ThriftServer(processor, new ThriftServerConfig().setPort(8899));  // TODO
         server.start();

http://git-wip-us.apache.org/repos/asf/curator/blob/cd3dbdcb/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorEventService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorEventService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorEventService.java
deleted file mode 100644
index 844de0d..0000000
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorEventService.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.apache.curator.x.rpc.idl.event;
-
-import com.facebook.swift.service.ThriftMethod;
-import com.facebook.swift.service.ThriftService;
-import com.google.common.collect.Queues;
-import java.util.concurrent.BlockingQueue;
-
-@ThriftService("CuratorEventService")
-public class CuratorEventService
-{
-    private final BlockingQueue<CuratorRpcEvent> events = Queues.newLinkedBlockingQueue();
-
-    @ThriftMethod
-    public CuratorRpcEvent getNextEvent() throws InterruptedException
-    {
-        return events.take();
-    }
-
-    public void addEvent(CuratorRpcEvent event)
-    {
-        events.offer(event);
-    }
-}

http://git-wip-us.apache.org/repos/asf/curator/blob/cd3dbdcb/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEvent.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEvent.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEvent.java
deleted file mode 100644
index db2b278..0000000
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEvent.java
+++ /dev/null
@@ -1,279 +0,0 @@
-package org.apache.curator.x.rpc.idl.event;
-
-import com.facebook.swift.codec.ThriftField;
-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.x.rpc.idl.projection.CuratorProjection;
-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;
-import java.util.List;
-
-@SuppressWarnings("deprecation")
-@ThriftStruct("CuratorEvent")
-public class CuratorRpcEvent
-{
-    private final CuratorProjection projection;
-    private final CuratorEvent event;
-
-    public CuratorRpcEvent()
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public CuratorRpcEvent(CuratorProjection projection, CuratorEvent event)
-    {
-        this.projection = projection;
-        this.event = event;
-    }
-
-    @ThriftField(1)
-    public CuratorProjection getProjection()
-    {
-        return projection;
-    }
-
-    @ThriftField(2)
-    public CuratorRpcEventType getType()
-    {
-        switch ( event.getType() )
-        {
-            case CREATE:
-            {
-                return CuratorRpcEventType.CREATE;
-            }
-
-            case DELETE:
-            {
-                return CuratorRpcEventType.DELETE;
-            }
-
-            case EXISTS:
-            {
-                return CuratorRpcEventType.EXISTS;
-            }
-
-            case GET_DATA:
-            {
-                return CuratorRpcEventType.GET_DATA;
-            }
-
-            case SET_DATA:
-            {
-                return CuratorRpcEventType.SET_DATA;
-            }
-
-            case CHILDREN:
-            {
-                return CuratorRpcEventType.CHILDREN;
-            }
-
-            case SYNC:
-            {
-                return CuratorRpcEventType.SYNC;
-            }
-
-            case GET_ACL:
-            {
-                return CuratorRpcEventType.GET_ACL;
-            }
-
-            case SET_ACL:
-            {
-                return CuratorRpcEventType.SET_ACL;
-            }
-
-            case WATCHED:
-            {
-                return CuratorRpcEventType.WATCHED;
-            }
-
-            case CLOSING:
-            {
-                return CuratorRpcEventType.CLOSING;
-            }
-        }
-
-        throw new IllegalStateException("Unknown type: " + event.getType());
-    }
-
-    @ThriftField(3)
-    public int getResultCode()
-    {
-        return event.getResultCode();
-    }
-
-    @ThriftField(4)
-    public String getPath()
-    {
-        return event.getPath();
-    }
-
-    @ThriftField(5)
-    public String getContext()
-    {
-        return String.valueOf(event.getContext());
-    }
-
-    @ThriftField(6)
-    public RpcStat getStat()
-    {
-        Stat stat = event.getStat();
-        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 null;
-    }
-
-    @ThriftField(7)
-    public byte[] getData()
-    {
-        return event.getData();
-    }
-
-    @ThriftField(8)
-    public String getName()
-    {
-        return event.getPath();
-    }
-
-    @ThriftField(9)
-    public List<String> getChildren()
-    {
-        return event.getChildren();
-    }
-
-    @ThriftField(10)
-    public List<RpcAcl> getACLList()
-    {
-        List<ACL> aclList = event.getACLList();
-        if ( aclList != null )
-        {
-            return Lists.transform
-            (
-                aclList,
-                new Function<ACL, RpcAcl>()
-                {
-                    @Nullable
-                    @Override
-                    public RpcAcl apply(ACL acl)
-                    {
-                        RpcId id = new RpcId(acl.getId().getScheme(), acl.getId().getId());
-                        return new RpcAcl(acl.getPerms(), id);
-                    }
-                }
-            );
-        }
-        return null;
-    }
-
-    @ThriftField(11)
-    public RpcWatchedEvent getWatchedEvent()
-    {
-        WatchedEvent watchedEvent = event.getWatchedEvent();
-        if ( watchedEvent != null )
-        {
-            RpcKeeperState keeperState = toRpcKeeperState(watchedEvent.getState());
-            RpcEventType eventType = toRpcEventType(watchedEvent.getType());
-            return new RpcWatchedEvent(keeperState, eventType, watchedEvent.getPath());
-        }
-        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/cd3dbdcb/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEventType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEventType.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEventType.java
deleted file mode 100644
index b905075..0000000
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/CuratorRpcEventType.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.apache.curator.x.rpc.idl.event;
-
-import com.facebook.swift.codec.ThriftEnum;
-
-@ThriftEnum("CuratorEventType")
-public enum CuratorRpcEventType
-{
-    CREATE,
-    DELETE,
-    EXISTS,
-    GET_DATA,
-    SET_DATA,
-    CHILDREN,
-    SYNC,
-    GET_ACL,
-    SET_ACL,
-    WATCHED,
-    CLOSING
-}

http://git-wip-us.apache.org/repos/asf/curator/blob/cd3dbdcb/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
new file mode 100644
index 0000000..cfc8bbd
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEvent.java
@@ -0,0 +1,279 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftField;
+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.x.rpc.idl.projection.CuratorProjection;
+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;
+import java.util.List;
+
+@SuppressWarnings("deprecation")
+@ThriftStruct("CuratorEvent")
+public class RpcCuratorEvent
+{
+    private final CuratorProjection projection;
+    private final CuratorEvent event;
+
+    public RpcCuratorEvent()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public RpcCuratorEvent(CuratorProjection projection, CuratorEvent event)
+    {
+        this.projection = projection;
+        this.event = event;
+    }
+
+    @ThriftField(1)
+    public CuratorProjection getProjection()
+    {
+        return projection;
+    }
+
+    @ThriftField(2)
+    public RpcCuratorEventType getType()
+    {
+        switch ( event.getType() )
+        {
+            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: " + event.getType());
+    }
+
+    @ThriftField(3)
+    public int getResultCode()
+    {
+        return event.getResultCode();
+    }
+
+    @ThriftField(4)
+    public String getPath()
+    {
+        return event.getPath();
+    }
+
+    @ThriftField(5)
+    public String getContext()
+    {
+        return String.valueOf(event.getContext());
+    }
+
+    @ThriftField(6)
+    public RpcStat getStat()
+    {
+        Stat stat = event.getStat();
+        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 null;
+    }
+
+    @ThriftField(7)
+    public byte[] getData()
+    {
+        return event.getData();
+    }
+
+    @ThriftField(8)
+    public String getName()
+    {
+        return event.getPath();
+    }
+
+    @ThriftField(9)
+    public List<String> getChildren()
+    {
+        return event.getChildren();
+    }
+
+    @ThriftField(10)
+    public List<RpcAcl> getACLList()
+    {
+        List<ACL> aclList = event.getACLList();
+        if ( aclList != null )
+        {
+            return Lists.transform
+            (
+                aclList,
+                new Function<ACL, RpcAcl>()
+                {
+                    @Nullable
+                    @Override
+                    public RpcAcl apply(ACL acl)
+                    {
+                        RpcId id = new RpcId(acl.getId().getScheme(), acl.getId().getId());
+                        return new RpcAcl(acl.getPerms(), id);
+                    }
+                }
+            );
+        }
+        return null;
+    }
+
+    @ThriftField(11)
+    public RpcWatchedEvent getWatchedEvent()
+    {
+        WatchedEvent watchedEvent = event.getWatchedEvent();
+        if ( watchedEvent != null )
+        {
+            RpcKeeperState keeperState = toRpcKeeperState(watchedEvent.getState());
+            RpcEventType eventType = toRpcEventType(watchedEvent.getType());
+            return new RpcWatchedEvent(keeperState, eventType, watchedEvent.getPath());
+        }
+        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/cd3dbdcb/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
new file mode 100644
index 0000000..3c23a69
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcCuratorEventType.java
@@ -0,0 +1,19 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftEnum;
+
+@ThriftEnum("CuratorEventType")
+public enum RpcCuratorEventType
+{
+    CREATE,
+    DELETE,
+    EXISTS,
+    GET_DATA,
+    SET_DATA,
+    CHILDREN,
+    SYNC,
+    GET_ACL,
+    SET_ACL,
+    WATCHED,
+    CLOSING
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/cd3dbdcb/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 aeb52c8..1846d31 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
@@ -3,6 +3,7 @@ package org.apache.curator.x.rpc.idl.projection;
 import com.facebook.swift.service.ThriftMethod;
 import com.facebook.swift.service.ThriftService;
 import com.google.common.collect.Maps;
+import com.google.common.collect.Queues;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.api.BackgroundCallback;
@@ -13,24 +14,19 @@ import org.apache.curator.framework.api.CreateModable;
 import org.apache.curator.framework.api.CuratorEvent;
 import org.apache.curator.framework.api.PathAndBytesable;
 import org.apache.curator.retry.RetryOneTime;
-import org.apache.curator.x.rpc.idl.event.CuratorEventService;
-import org.apache.curator.x.rpc.idl.event.CuratorRpcEvent;
+import org.apache.curator.x.rpc.idl.event.RpcCuratorEvent;
 import java.util.Map;
 import java.util.UUID;
+import java.util.concurrent.BlockingQueue;
 
 @ThriftService("CuratorService")
 public class CuratorProjectionService
 {
     private final Map<String, CuratorFramework> projections = Maps.newConcurrentMap();
-    private final CuratorEventService eventService;
-
-    public CuratorProjectionService(CuratorEventService eventService)
-    {
-        this.eventService = eventService;
-    }
+    private final BlockingQueue<RpcCuratorEvent> events = Queues.newLinkedBlockingQueue();
 
     @ThriftMethod
-    public CuratorProjection newCuratorProjection(CuratorProjectionSpec spec)
+    public CuratorProjection newCuratorProjection(CuratorProjectionSpec spec)   // TODO
     {
         CuratorFramework client = CuratorFrameworkFactory.newClient("localhost:2181", new RetryOneTime(1));
         String id = UUID.randomUUID().toString();
@@ -76,7 +72,7 @@ public class CuratorProjectionService
                 @Override
                 public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
                 {
-                    eventService.addEvent(new CuratorRpcEvent(projection, event));
+                    events.offer(new RpcCuratorEvent(projection, event));
                 }
             };
             builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
@@ -85,6 +81,12 @@ public class CuratorProjectionService
         return String.valueOf(castBuilder(builder, PathAndBytesable.class).forPath(createSpec.getPath(), createSpec.getData().getBytes()));
     }
 
+    @ThriftMethod
+    public RpcCuratorEvent getNextEvent() throws InterruptedException
+    {
+        return events.take();
+    }
+
     private org.apache.zookeeper.CreateMode getRealMode(CreateMode mode)
     {
         switch ( mode )

http://git-wip-us.apache.org/repos/asf/curator/blob/cd3dbdcb/curator-x-rpc/src/main/scripts/generate.sh
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/scripts/generate.sh b/curator-x-rpc/src/main/scripts/generate.sh
index 9fdc4c6..10288d5 100755
--- a/curator-x-rpc/src/main/scripts/generate.sh
+++ b/curator-x-rpc/src/main/scripts/generate.sh
@@ -10,11 +10,14 @@ BASE_DIR="$( cd "$DIR/../../../.." && pwd )"
 
 RPC_PATH="$BASE_DIR/curator-x-rpc/target/classes"
 
+CLASSES=""
+
 PROJECTION_CLASSES=""
 for f in `ls -m1 $RPC_PATH/org/apache/curator/x/rpc/idl/projection/*.class | xargs -n 1 basename | sed s/\.[^\.]*$//`;
     do
         if [[ $f != *[\$]* ]]; then
             PROJECTION_CLASSES="$PROJECTION_CLASSES $f";
+            CLASSES="$CLASSES org.apache.curator.x.rpc.idl.projection.$f";
         fi;
 done;
 
@@ -23,6 +26,7 @@ for f in `ls -m1 $RPC_PATH/org/apache/curator/x/rpc/idl/event/*.class | xargs -n
     do
         if [[ $f != *[\$]* ]]; then
             EVENT_CLASSES="$EVENT_CLASSES $f";
+            CLASSES="$CLASSES org.apache.curator.x.rpc.idl.event.$f";
         fi;
 done;
 
@@ -34,8 +38,8 @@ PATHS="$PATHS:$BASE_DIR/curator-framework/target/classes"
 PATHS="$PATHS:$BASE_DIR/curator-recipes/target/classes"
 PATHS="$PATHS:$RPC_PATH"
 
+PACKAGE="org.apache.curator.x.rpc.idl"
 PROJECTION_PACKAGE="org.apache.curator.x.rpc.idl.projection"
 EVENT_PACKAGE="org.apache.curator.x.rpc.idl.event"
 
-java -cp $PATHS com.facebook.swift.generator.swift2thrift.Main -namespace cpp org.apache.curator -out "$THRIFT_DIR/curator.thrift" -package $PROJECTION_PACKAGE $PROJECTION_CLASSES
-java -cp $PATHS com.facebook.swift.generator.swift2thrift.Main -map org.apache.curator.x.rpc.idl.projection.CuratorProjection "curator.thrift" -namespace cpp org.apache.curator -out "$THRIFT_DIR/curator-event.thrift" -package $EVENT_PACKAGE $EVENT_CLASSES
+java -cp $PATHS com.facebook.swift.generator.swift2thrift.Main -allow_multiple_packages org.apache.curator -namespace cpp org.apache.curator -out "$THRIFT_DIR/curator.thrift" $CLASSES

http://git-wip-us.apache.org/repos/asf/curator/blob/cd3dbdcb/curator-x-rpc/src/main/thrift/curator-event.thrift
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/thrift/curator-event.thrift b/curator-x-rpc/src/main/thrift/curator-event.thrift
deleted file mode 100644
index 9c407eb..0000000
--- a/curator-x-rpc/src/main/thrift/curator-event.thrift
+++ /dev/null
@@ -1,64 +0,0 @@
-namespace java.swift org.apache.curator.x.rpc.idl.event
-namespace cpp org.apache.curator
-
-include "curator.thrift"
-
-enum CuratorEventType {
-  CREATE, DELETE, EXISTS, GET_DATA, SET_DATA, CHILDREN, SYNC, GET_ACL, SET_ACL, WATCHED, CLOSING
-}
-
-enum EventType {
-  None, NodeCreated, NodeDeleted, NodeDataChanged, NodeChildrenChanged
-}
-
-enum KeeperState {
-  Unknown, Disconnected, NoSyncConnected, SyncConnected, AuthFailed, ConnectedReadOnly, SaslAuthenticated, Expired
-}
-
-struct id {
-  1: string scheme;
-  2: string id;
-}
-
-struct Stat {
-  1: i64 czxid;
-  2: i64 mzxid;
-  3: i64 ctime;
-  4: i64 mtime;
-  5: i32 version;
-  6: i32 cversion;
-  7: i32 aversion;
-  8: i64 ephemeralOwner;
-  9: i32 dataLength;
-  10: i32 numChildren;
-  11: i64 pzxid;
-}
-
-struct WatchedEvent {
-  1: KeeperState keeperState;
-  2: EventType eventType;
-  3: string path;
-}
-
-struct Acl {
-  1: i32 perms;
-  2: id id;
-}
-
-struct CuratorEvent {
-  1: curator.CuratorProjection projection;
-  2: CuratorEventType type;
-  3: i32 resultCode;
-  4: string path;
-  5: string context;
-  6: Stat stat;
-  7: binary data;
-  8: string name;
-  9: list<string> children;
-  10: list<Acl> aCLList;
-  11: WatchedEvent watchedEvent;
-}
-
-service CuratorEventService {
-  CuratorEvent getNextEvent();
-}

http://git-wip-us.apache.org/repos/asf/curator/blob/cd3dbdcb/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 7973580..8b7ffc3 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -1,4 +1,4 @@
-namespace java.swift org.apache.curator.x.rpc.idl.projection
+namespace java.swift org.apache.curator
 namespace cpp org.apache.curator
 
 
@@ -6,6 +6,18 @@ enum CreateMode {
   PERSISTENT, PERSISTENT_SEQUENTIAL, EPHEMERAL, EPHEMERAL_SEQUENTIAL
 }
 
+enum CuratorEventType {
+  CREATE, DELETE, EXISTS, GET_DATA, SET_DATA, CHILDREN, SYNC, GET_ACL, SET_ACL, WATCHED, CLOSING
+}
+
+enum EventType {
+  None, NodeCreated, NodeDeleted, NodeDataChanged, NodeChildrenChanged
+}
+
+enum KeeperState {
+  Unknown, Disconnected, NoSyncConnected, SyncConnected, AuthFailed, ConnectedReadOnly, SaslAuthenticated, Expired
+}
+
 struct CreateSpec {
   1: string path;
   2: string asyncId;
@@ -24,8 +36,53 @@ struct CuratorProjection {
 struct CuratorProjectionSpec {
 }
 
+struct id {
+  1: string scheme;
+  2: string id;
+}
+
+struct Stat {
+  1: i64 czxid;
+  2: i64 mzxid;
+  3: i64 ctime;
+  4: i64 mtime;
+  5: i32 version;
+  6: i32 cversion;
+  7: i32 aversion;
+  8: i64 ephemeralOwner;
+  9: i32 dataLength;
+  10: i32 numChildren;
+  11: i64 pzxid;
+}
+
+struct WatchedEvent {
+  1: KeeperState keeperState;
+  2: EventType eventType;
+  3: string path;
+}
+
+struct Acl {
+  1: i32 perms;
+  2: id id;
+}
+
+struct CuratorEvent {
+  1: CuratorProjection projection;
+  2: CuratorEventType type;
+  3: i32 resultCode;
+  4: string path;
+  5: string context;
+  6: Stat stat;
+  7: binary data;
+  8: string name;
+  9: list<string> children;
+  10: list<Acl> aCLList;
+  11: WatchedEvent watchedEvent;
+}
+
 service CuratorService {
   void closeCuratorProjection(1: CuratorProjection projection);
   string create(1: CuratorProjection projection, 2: CreateSpec createSpec);
+  CuratorEvent getNextEvent();
   CuratorProjection newCuratorProjection(1: CuratorProjectionSpec spec);
 }


[09/14] git commit: wip

Posted by ra...@apache.org.
wip


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

Branch: refs/heads/curator-rpc
Commit: 5fe11f80549c298538970cb786b88656767c7569
Parents: cd3dbdc
Author: randgalt <ra...@apache.org>
Authored: Mon May 26 02:53:40 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon May 26 02:53:40 2014 -0500

----------------------------------------------------------------------
 .../curator/x/rpc/CuratorProjectionServer.java  |   18 +
 .../apache/curator/x/rpc/idl/event/RpcAcl.java  |   47 +-
 .../x/rpc/idl/event/RpcCuratorEvent.java        |  125 +-
 .../x/rpc/idl/event/RpcCuratorEventType.java    |   18 +
 .../curator/x/rpc/idl/event/RpcEventType.java   |   18 +
 .../apache/curator/x/rpc/idl/event/RpcId.java   |   47 +-
 .../curator/x/rpc/idl/event/RpcKeeperState.java |   18 +
 .../apache/curator/x/rpc/idl/event/RpcStat.java |  166 +-
 .../x/rpc/idl/event/RpcWatchedEvent.java        |   62 +-
 .../x/rpc/idl/projection/CreateMode.java        |   18 +
 .../x/rpc/idl/projection/CreateSpec.java        |  109 +-
 .../x/rpc/idl/projection/CuratorProjection.java |   30 +-
 .../projection/CuratorProjectionService.java    |   36 +-
 .../idl/projection/CuratorProjectionSpec.java   |   18 +
 curator-x-rpc/src/main/scripts/generate-java.sh |   28 +
 curator-x-rpc/src/main/scripts/generate.sh      |   26 +-
 curator-x-rpc/src/main/thrift/curator.thrift    |   18 +-
 .../java/org/apache/curator/generated/Acl.java  |  491 +++
 .../apache/curator/generated/CreateMode.java    |   51 +
 .../apache/curator/generated/CreateSpec.java    |  984 +++++
 .../apache/curator/generated/CuratorEvent.java  | 1531 ++++++++
 .../curator/generated/CuratorEventType.java     |   72 +
 .../curator/generated/CuratorProjection.java    |  388 ++
 .../generated/CuratorProjectionSpec.java        |  280 ++
 .../curator/generated/CuratorService.java       | 3387 ++++++++++++++++++
 .../org/apache/curator/generated/EventType.java |   54 +
 .../apache/curator/generated/KeeperState.java   |   63 +
 .../java/org/apache/curator/generated/Stat.java | 1326 +++++++
 .../apache/curator/generated/WatchedEvent.java  |  620 ++++
 .../java/org/apache/curator/generated/id.java   |  488 +++
 .../org/apache/curator/x/rpc/TestClient.java    |   48 +
 pom.xml                                         |    2 +
 32 files changed, 10219 insertions(+), 368 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
index cd35f42..70e6d6a 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/CuratorProjectionServer.java
@@ -1,3 +1,21 @@
+/**
+ * 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;
 
 import com.facebook.swift.codec.ThriftCodecManager;

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcAcl.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcAcl.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcAcl.java
index 54daa11..b2f1512 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcAcl.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcAcl.java
@@ -1,3 +1,21 @@
+/**
+ * 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;
@@ -6,8 +24,11 @@ import com.facebook.swift.codec.ThriftStruct;
 @ThriftStruct("Acl")
 public class RpcAcl
 {
-    private int perms;
-    private RpcId id;
+    @ThriftField(1)
+    public int perms;
+
+    @ThriftField(2)
+    public RpcId id;
 
     public RpcAcl()
     {
@@ -18,26 +39,4 @@ public class RpcAcl
         this.perms = perms;
         this.id = id;
     }
-
-    @ThriftField(1)
-    public int getPerms()
-    {
-        return perms;
-    }
-
-    public void setPerms(int perms)
-    {
-        this.perms = perms;
-    }
-
-    @ThriftField(2)
-    public RpcId getId()
-    {
-        return id;
-    }
-
-    public void setId(RpcId id)
-    {
-        this.id = id;
-    }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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 cfc8bbd..6896e89 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
@@ -1,3 +1,21 @@
+/**
+ * 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;
@@ -5,6 +23,7 @@ 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.x.rpc.idl.projection.CuratorProjection;
 import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
@@ -17,8 +36,38 @@ import java.util.List;
 @ThriftStruct("CuratorEvent")
 public class RpcCuratorEvent
 {
-    private final CuratorProjection projection;
-    private final CuratorEvent event;
+    @ThriftField(1)
+    public CuratorProjection projection;
+
+    @ThriftField(2)
+    public RpcCuratorEventType type;
+
+    @ThriftField(3)
+    public int resultCode;
+
+    @ThriftField(4)
+    public String path;
+
+    @ThriftField(5)
+    public String context;
+
+    @ThriftField(6)
+    public RpcStat stat;
+
+    @ThriftField(7)
+    public byte[] data;
+
+    @ThriftField(8)
+    public String name;
+
+    @ThriftField(9)
+    public List<String> children;
+
+    @ThriftField(10)
+    public List<RpcAcl> aclList;
+
+    @ThriftField(11)
+    public RpcWatchedEvent watchedEvent;
 
     public RpcCuratorEvent()
     {
@@ -28,19 +77,21 @@ public class RpcCuratorEvent
     public RpcCuratorEvent(CuratorProjection projection, CuratorEvent event)
     {
         this.projection = projection;
-        this.event = event;
+        this.type = toRpcCuratorEventType(event.getType());
+        this.resultCode = event.getResultCode();
+        this.path = event.getPath();
+        this.context = (event.getContext() != null) ? String.valueOf(event.getContext()) : null;
+        this.stat = toRpcStat(event.getStat());
+        this.data = event.getData();
+        this.name = event.getName();
+        this.children = event.getChildren();
+        this.aclList = toRpcAclList(event.getACLList());
+        this.watchedEvent = toRpcWatchedEvent(event.getWatchedEvent());
     }
 
-    @ThriftField(1)
-    public CuratorProjection getProjection()
-    {
-        return projection;
-    }
-
-    @ThriftField(2)
-    public RpcCuratorEventType getType()
+    private RpcCuratorEventType toRpcCuratorEventType(CuratorEventType eventType)
     {
-        switch ( event.getType() )
+        switch ( eventType )
         {
             case CREATE:
             {
@@ -98,31 +149,11 @@ public class RpcCuratorEvent
             }
         }
 
-        throw new IllegalStateException("Unknown type: " + event.getType());
+        throw new IllegalStateException("Unknown type: " + eventType);
     }
 
-    @ThriftField(3)
-    public int getResultCode()
+    private RpcStat toRpcStat(Stat stat)
     {
-        return event.getResultCode();
-    }
-
-    @ThriftField(4)
-    public String getPath()
-    {
-        return event.getPath();
-    }
-
-    @ThriftField(5)
-    public String getContext()
-    {
-        return String.valueOf(event.getContext());
-    }
-
-    @ThriftField(6)
-    public RpcStat getStat()
-    {
-        Stat stat = event.getStat();
         if ( stat != null )
         {
             return new RpcStat
@@ -143,28 +174,8 @@ public class RpcCuratorEvent
         return null;
     }
 
-    @ThriftField(7)
-    public byte[] getData()
-    {
-        return event.getData();
-    }
-
-    @ThriftField(8)
-    public String getName()
+    private List<RpcAcl> toRpcAclList(List<ACL> aclList)
     {
-        return event.getPath();
-    }
-
-    @ThriftField(9)
-    public List<String> getChildren()
-    {
-        return event.getChildren();
-    }
-
-    @ThriftField(10)
-    public List<RpcAcl> getACLList()
-    {
-        List<ACL> aclList = event.getACLList();
         if ( aclList != null )
         {
             return Lists.transform
@@ -185,10 +196,8 @@ public class RpcCuratorEvent
         return null;
     }
 
-    @ThriftField(11)
-    public RpcWatchedEvent getWatchedEvent()
+    private RpcWatchedEvent toRpcWatchedEvent(WatchedEvent watchedEvent)
     {
-        WatchedEvent watchedEvent = event.getWatchedEvent();
         if ( watchedEvent != null )
         {
             RpcKeeperState keeperState = toRpcKeeperState(watchedEvent.getState());

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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 3c23a69..f08aa4a 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
@@ -1,3 +1,21 @@
+/**
+ * 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.ThriftEnum;

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcEventType.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcEventType.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcEventType.java
index 8328940..b7b5fa3 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcEventType.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcEventType.java
@@ -1,3 +1,21 @@
+/**
+ * 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.ThriftEnum;

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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 858dea1..8c360d6 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
@@ -1,3 +1,21 @@
+/**
+ * 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;
@@ -6,8 +24,11 @@ import com.facebook.swift.codec.ThriftStruct;
 @ThriftStruct("id")
 public class RpcId
 {
-    private String scheme;
-    private String id;
+    @ThriftField(1)
+    public String scheme;
+
+    @ThriftField(2)
+    public String id;
 
     public RpcId()
     {
@@ -18,26 +39,4 @@ public class RpcId
         this.scheme = scheme;
         this.id = id;
     }
-
-    @ThriftField(1)
-    public String getScheme()
-    {
-        return scheme;
-    }
-
-    public void setScheme(String scheme)
-    {
-        this.scheme = scheme;
-    }
-
-    @ThriftField(2)
-    public String getId()
-    {
-        return id;
-    }
-
-    public void setId(String id)
-    {
-        this.id = id;
-    }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcKeeperState.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcKeeperState.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcKeeperState.java
index e5881a8..7d17366 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcKeeperState.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/RpcKeeperState.java
@@ -1,3 +1,21 @@
+/**
+ * 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.ThriftEnum;

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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 382c45a..e5fd919 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
@@ -1,3 +1,21 @@
+/**
+ * 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;
@@ -6,155 +24,55 @@ import com.facebook.swift.codec.ThriftStruct;
 @ThriftStruct("Stat")
 public class RpcStat
 {
-    private long czxid;
-    private long mzxid;
-    private long ctime;
-    private long mtime;
-    private int version;
-    private int cversion;
-    private int aversion;
-    private long ephemeralOwner;
-    private int dataLength;
-    private int numChildren;
-    private long pzxid;
-
-    public RpcStat()
-    {
-    }
-
-    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;
-        this.mzxid = mzxid;
-        this.ctime = ctime;
-        this.mtime = mtime;
-        this.version = version;
-        this.cversion = cversion;
-        this.aversion = aversion;
-        this.ephemeralOwner = ephemeralOwner;
-        this.dataLength = dataLength;
-        this.numChildren = numChildren;
-        this.pzxid = pzxid;
-    }
-
     @ThriftField(1)
-    public long getCzxid()
-    {
-        return czxid;
-    }
-
-    public void setCzxid(long czxid)
-    {
-        this.czxid = czxid;
-    }
+    public long czxid;
 
     @ThriftField(2)
-    public long getMzxid()
-    {
-        return mzxid;
-    }
-
-    public void setMzxid(long mzxid)
-    {
-        this.mzxid = mzxid;
-    }
+    public long mzxid;
 
     @ThriftField(3)
-    public long getCtime()
-    {
-        return ctime;
-    }
-
-    public void setCtime(long ctime)
-    {
-        this.ctime = ctime;
-    }
+    public long ctime;
 
     @ThriftField(4)
-    public long getMtime()
-    {
-        return mtime;
-    }
-
-    public void setMtime(long mtime)
-    {
-        this.mtime = mtime;
-    }
+    public long mtime;
 
     @ThriftField(5)
-    public int getVersion()
-    {
-        return version;
-    }
-
-    public void setVersion(int version)
-    {
-        this.version = version;
-    }
+    public int version;
 
     @ThriftField(6)
-    public int getCversion()
-    {
-        return cversion;
-    }
-
-    public void setCversion(int cversion)
-    {
-        this.cversion = cversion;
-    }
+    public int cversion;
 
     @ThriftField(7)
-    public int getAversion()
-    {
-        return aversion;
-    }
-
-    public void setAversion(int aversion)
-    {
-        this.aversion = aversion;
-    }
+    public int aversion;
 
     @ThriftField(8)
-    public long getEphemeralOwner()
-    {
-        return ephemeralOwner;
-    }
-
-    public void setEphemeralOwner(long ephemeralOwner)
-    {
-        this.ephemeralOwner = ephemeralOwner;
-    }
+    public long ephemeralOwner;
 
     @ThriftField(9)
-    public int getDataLength()
-    {
-        return dataLength;
-    }
-
-    public void setDataLength(int dataLength)
-    {
-        this.dataLength = dataLength;
-    }
+    public int dataLength;
 
     @ThriftField(10)
-    public int getNumChildren()
-    {
-        return numChildren;
-    }
-
-    public void setNumChildren(int numChildren)
-    {
-        this.numChildren = numChildren;
-    }
+    public int numChildren;
 
     @ThriftField(11)
-    public long getPzxid()
+    public long pzxid;
+
+    public RpcStat()
     {
-        return pzxid;
     }
 
-    public void setPzxid(long pzxid)
+    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;
+        this.mzxid = mzxid;
+        this.ctime = ctime;
+        this.mtime = mtime;
+        this.version = version;
+        this.cversion = cversion;
+        this.aversion = aversion;
+        this.ephemeralOwner = ephemeralOwner;
+        this.dataLength = dataLength;
+        this.numChildren = numChildren;
         this.pzxid = pzxid;
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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 69187dc..de696b9 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
@@ -1,3 +1,21 @@
+/**
+ * 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;
@@ -6,51 +24,23 @@ import com.facebook.swift.codec.ThriftStruct;
 @ThriftStruct("WatchedEvent")
 public class RpcWatchedEvent
 {
-    private RpcKeeperState keeperState;
-    private RpcEventType eventType;
-    private String path;
-
-    public RpcWatchedEvent()
-    {
-    }
-
-    public RpcWatchedEvent(RpcKeeperState keeperState, RpcEventType eventType, String path)
-    {
-        this.keeperState = keeperState;
-        this.eventType = eventType;
-        this.path = path;
-    }
-
     @ThriftField(1)
-    public RpcKeeperState getKeeperState()
-    {
-        return keeperState;
-    }
-
-    public void setKeeperState(RpcKeeperState keeperState)
-    {
-        this.keeperState = keeperState;
-    }
+    public RpcKeeperState keeperState;
 
     @ThriftField(2)
-    public RpcEventType getEventType()
-    {
-        return eventType;
-    }
-
-    public void setEventType(RpcEventType eventType)
-    {
-        this.eventType = eventType;
-    }
+    public RpcEventType eventType;
 
     @ThriftField(3)
-    public String getPath()
+    public String path;
+
+    public RpcWatchedEvent()
     {
-        return path;
     }
 
-    public void setPath(String path)
+    public RpcWatchedEvent(RpcKeeperState keeperState, RpcEventType eventType, String path)
     {
+        this.keeperState = keeperState;
+        this.eventType = eventType;
         this.path = path;
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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
index ea4ff84..d53cf8d 100644
--- 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
@@ -1,3 +1,21 @@
+/**
+ * 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

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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 9019671..8e7acf7 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
@@ -1,3 +1,21 @@
+/**
+ * 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;
@@ -6,100 +24,39 @@ import com.facebook.swift.codec.ThriftStruct;
 @ThriftStruct
 public class CreateSpec
 {
-    private String path;
-    private String data;
-    private CreateMode mode;
-    private boolean async;
-    private String asyncId;
-    private boolean compressed;
-    private boolean creatingParentsIfNeeded;
-    private boolean withProtection;
-
     @ThriftField(1)
-    public String getPath()
-    {
-        return path;
-    }
+    public String path;
 
     @ThriftField(2)
-    public String getAsyncId()
-    {
-        return asyncId;
-    }
-
-    public void setAsyncId(String asyncId)
-    {
-        this.asyncId = asyncId;
-    }
-
-    public void setPath(String path)
-    {
-        this.path = path;
-    }
+    public String data;
 
     @ThriftField(3)
-    public String getData()
-    {
-        return data;
-    }
-
-    public void setData(String data)
-    {
-        this.data = data;
-    }
+    public CreateMode mode;
 
     @ThriftField(4)
-    public CreateMode getMode()
-    {
-        return mode;
-    }
-
-    public void setMode(CreateMode mode)
-    {
-        this.mode = mode;
-    }
+    public boolean doAsync;
 
     @ThriftField(5)
-    public boolean isAsync()
-    {
-        return async;
-    }
-
-    public void setAsync(boolean async)
-    {
-        this.async = async;
-    }
+    public boolean compressed;
 
     @ThriftField(6)
-    public boolean isCompressed()
-    {
-        return compressed;
-    }
-
-    public void setCompressed(boolean compressed)
-    {
-        this.compressed = compressed;
-    }
+    public boolean creatingParentsIfNeeded;
 
     @ThriftField(7)
-    public boolean isCreatingParentsIfNeeded()
-    {
-        return creatingParentsIfNeeded;
-    }
-
-    public void setCreatingParentsIfNeeded(boolean creatingParentsIfNeeded)
-    {
-        this.creatingParentsIfNeeded = creatingParentsIfNeeded;
-    }
+    public boolean withProtection;
 
-    @ThriftField(8)
-    public boolean isWithProtection()
+    public CreateSpec()
     {
-        return withProtection;
     }
 
-    public void setWithProtection(boolean withProtection)
+    public CreateSpec(String path, String data, CreateMode mode, boolean doAsync, boolean compressed, boolean creatingParentsIfNeeded, boolean withProtection)
     {
+        this.path = path;
+        this.data = data;
+        this.mode = mode;
+        this.doAsync = doAsync;
+        this.compressed = compressed;
+        this.creatingParentsIfNeeded = creatingParentsIfNeeded;
         this.withProtection = withProtection;
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjection.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjection.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjection.java
index 053d825..8ca3847 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjection.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjection.java
@@ -1,3 +1,21 @@
+/**
+ * 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.ThriftConstructor;
@@ -7,17 +25,15 @@ import com.facebook.swift.codec.ThriftStruct;
 @ThriftStruct
 public class CuratorProjection
 {
-    private final String id;
+    @ThriftField(1)
+    public String id;
 
-    @ThriftConstructor
-    public CuratorProjection(String id)
+    public CuratorProjection()
     {
-        this.id = id;
     }
 
-    @ThriftField(1)
-    public String getId()
+    public CuratorProjection(String id)
     {
-        return id;
+        this.id = id;
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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 1846d31..cf5e861 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
@@ -1,3 +1,21 @@
+/**
+ * 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.service.ThriftMethod;
@@ -38,7 +56,7 @@ public class CuratorProjectionService
     @ThriftMethod
     public void closeCuratorProjection(CuratorProjection projection)
     {
-        CuratorFramework client = projections.remove(projection.getId());
+        CuratorFramework client = projections.remove(projection.id);
         if ( client != null )
         {
             client.close();
@@ -51,21 +69,21 @@ public class CuratorProjectionService
         CuratorFramework client = getClient(projection);
 
         Object builder = client.create();
-        if ( createSpec.isCreatingParentsIfNeeded() )
+        if ( createSpec.creatingParentsIfNeeded )
         {
             builder = castBuilder(builder, CreateBuilder.class).creatingParentsIfNeeded();
         }
-        if ( createSpec.isCompressed() )
+        if ( createSpec.compressed )
         {
             builder = castBuilder(builder, Compressible.class).compressed();
         }
-        if ( createSpec.isWithProtection() )
+        if ( createSpec.withProtection )
         {
             builder = castBuilder(builder, CreateBuilder.class).withProtection();
         }
-        builder = castBuilder(builder, CreateModable.class).withMode(getRealMode(createSpec.getMode()));
+        builder = castBuilder(builder, CreateModable.class).withMode(getRealMode(createSpec.mode));
 
-        if ( createSpec.isAsync() )
+        if ( createSpec.doAsync )
         {
             BackgroundCallback backgroundCallback = new BackgroundCallback()
             {
@@ -78,7 +96,7 @@ public class CuratorProjectionService
             builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
         }
 
-        return String.valueOf(castBuilder(builder, PathAndBytesable.class).forPath(createSpec.getPath(), createSpec.getData().getBytes()));
+        return String.valueOf(castBuilder(builder, PathAndBytesable.class).forPath(createSpec.path, createSpec.data.getBytes()));
     }
 
     @ThriftMethod
@@ -116,10 +134,10 @@ public class CuratorProjectionService
 
     private CuratorFramework getClient(CuratorProjection projection) throws Exception
     {
-        CuratorFramework client = projections.get(projection.getId());
+        CuratorFramework client = projections.get(projection.id);
         if ( client == null )
         {
-            throw new Exception("No client found with id: " + projection.getId());
+            throw new Exception("No client found with id: " + projection.id);
         }
         return client;
     }

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionSpec.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionSpec.java
index abec7f7..b79990c 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionSpec.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionSpec.java
@@ -1,3 +1,21 @@
+/**
+ * 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.ThriftStruct;

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/main/scripts/generate-java.sh
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/scripts/generate-java.sh b/curator-x-rpc/src/main/scripts/generate-java.sh
new file mode 100755
index 0000000..b667fb1
--- /dev/null
+++ b/curator-x-rpc/src/main/scripts/generate-java.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+# 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.
+#
+
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+BASE_DIR="$( cd "$DIR/../../../.." && pwd )"
+TARGET_DIR="$BASE_DIR/curator-x-rpc/src/test/java"
+
+rm "$TARGET_DIR/org/apache/curator/generated/"*
+
+thrift -gen java -out "$TARGET_DIR" "$BASE_DIR/curator-x-rpc/src/main/thrift/curator.thrift"

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/main/scripts/generate.sh
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/scripts/generate.sh b/curator-x-rpc/src/main/scripts/generate.sh
index 10288d5..5fab478 100755
--- a/curator-x-rpc/src/main/scripts/generate.sh
+++ b/curator-x-rpc/src/main/scripts/generate.sh
@@ -1,4 +1,23 @@
 #!/bin/bash
+#
+# 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.
+#
+
 
 if (( $# != 2 )); then
     echo "usage:\ngenerate.sh <path to swift2thrift-generator-cli-N.N.N-standalone.jar> <path to zookeeper-N.N.N.jar>"
@@ -42,4 +61,9 @@ PACKAGE="org.apache.curator.x.rpc.idl"
 PROJECTION_PACKAGE="org.apache.curator.x.rpc.idl.projection"
 EVENT_PACKAGE="org.apache.curator.x.rpc.idl.event"
 
-java -cp $PATHS com.facebook.swift.generator.swift2thrift.Main -allow_multiple_packages org.apache.curator -namespace cpp org.apache.curator -out "$THRIFT_DIR/curator.thrift" $CLASSES
+java -cp $PATHS com.facebook.swift.generator.swift2thrift.Main \
+    -allow_multiple_packages org.apache.curator \
+    -namespace cpp org.apache.curator.generated \
+    -namespace java org.apache.curator.generated \
+    -out "$THRIFT_DIR/curator.thrift" \
+    $CLASSES

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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 8b7ffc3..9d578e7 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -1,5 +1,6 @@
 namespace java.swift org.apache.curator
-namespace cpp org.apache.curator
+namespace cpp org.apache.curator.generated
+namespace java org.apache.curator.generated
 
 
 enum CreateMode {
@@ -20,13 +21,12 @@ enum KeeperState {
 
 struct CreateSpec {
   1: string path;
-  2: string asyncId;
-  3: string data;
-  4: CreateMode mode;
-  5: bool async;
-  6: bool compressed;
-  7: bool creatingParentsIfNeeded;
-  8: bool withProtection;
+  2: string data;
+  3: CreateMode mode;
+  4: bool doAsync;
+  5: bool compressed;
+  6: bool creatingParentsIfNeeded;
+  7: bool withProtection;
 }
 
 struct CuratorProjection {
@@ -76,7 +76,7 @@ struct CuratorEvent {
   7: binary data;
   8: string name;
   9: list<string> children;
-  10: list<Acl> aCLList;
+  10: list<Acl> aclList;
   11: WatchedEvent watchedEvent;
 }
 

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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
new file mode 100644
index 0000000..3dd4cb5
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/Acl.java
@@ -0,0 +1,491 @@
+/**
+ * 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 Acl implements org.apache.thrift.TBase<Acl, Acl._Fields>, java.io.Serializable, Cloneable, Comparable<Acl> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Acl");
+
+  private static final org.apache.thrift.protocol.TField PERMS_FIELD_DESC = new org.apache.thrift.protocol.TField("perms", org.apache.thrift.protocol.TType.I32, (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.STRUCT, (short)2);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new AclStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new AclTupleSchemeFactory());
+  }
+
+  public int perms; // 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 {
+    PERMS((short)1, "perms"),
+    ID((short)2, "id");
+
+    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: // PERMS
+          return PERMS;
+        case 2: // ID
+          return ID;
+        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 __PERMS_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.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)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Acl.class, metaDataMap);
+  }
+
+  public Acl() {
+  }
+
+  public Acl(
+    int perms,
+    id id)
+  {
+    this();
+    this.perms = perms;
+    setPermsIsSet(true);
+    this.id = id;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public Acl(Acl other) {
+    __isset_bitfield = other.__isset_bitfield;
+    this.perms = other.perms;
+    if (other.isSetId()) {
+      this.id = new id(other.id);
+    }
+  }
+
+  public Acl deepCopy() {
+    return new Acl(this);
+  }
+
+  @Override
+  public void clear() {
+    setPermsIsSet(false);
+    this.perms = 0;
+    this.id = null;
+  }
+
+  public int getPerms() {
+    return this.perms;
+  }
+
+  public Acl setPerms(int perms) {
+    this.perms = perms;
+    setPermsIsSet(true);
+    return this;
+  }
+
+  public void unsetPerms() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERMS_ISSET_ID);
+  }
+
+  /** Returns true if field perms is set (has been assigned a value) and false otherwise */
+  public boolean isSetPerms() {
+    return EncodingUtils.testBit(__isset_bitfield, __PERMS_ISSET_ID);
+  }
+
+  public void setPermsIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERMS_ISSET_ID, value);
+  }
+
+  public id getId() {
+    return this.id;
+  }
+
+  public Acl setId(id 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 void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case PERMS:
+      if (value == null) {
+        unsetPerms();
+      } else {
+        setPerms((Integer)value);
+      }
+      break;
+
+    case ID:
+      if (value == null) {
+        unsetId();
+      } else {
+        setId((id)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case PERMS:
+      return Integer.valueOf(getPerms());
+
+    case ID:
+      return getId();
+
+    }
+    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 PERMS:
+      return isSetPerms();
+    case ID:
+      return isSetId();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof Acl)
+      return this.equals((Acl)that);
+    return false;
+  }
+
+  public boolean equals(Acl that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_perms = true;
+    boolean that_present_perms = true;
+    if (this_present_perms || that_present_perms) {
+      if (!(this_present_perms && that_present_perms))
+        return false;
+      if (this.perms != that.perms)
+        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;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(Acl other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetPerms()).compareTo(other.isSetPerms());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPerms()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.perms, other.perms);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    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;
+      }
+    }
+    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("Acl(");
+    boolean first = true;
+
+    sb.append("perms:");
+    sb.append(this.perms);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("id:");
+    if (this.id == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.id);
+    }
+    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 (id != null) {
+      id.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 {
+      // 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 AclStandardSchemeFactory implements SchemeFactory {
+    public AclStandardScheme getScheme() {
+      return new AclStandardScheme();
+    }
+  }
+
+  private static class AclStandardScheme extends StandardScheme<Acl> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, Acl 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: // PERMS
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.perms = iprot.readI32();
+              struct.setPermsIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // ID
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+              struct.id = new id();
+              struct.id.read(iprot);
+              struct.setIdIsSet(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, Acl struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      oprot.writeFieldBegin(PERMS_FIELD_DESC);
+      oprot.writeI32(struct.perms);
+      oprot.writeFieldEnd();
+      if (struct.id != null) {
+        oprot.writeFieldBegin(ID_FIELD_DESC);
+        struct.id.write(oprot);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class AclTupleSchemeFactory implements SchemeFactory {
+    public AclTupleScheme getScheme() {
+      return new AclTupleScheme();
+    }
+  }
+
+  private static class AclTupleScheme extends TupleScheme<Acl> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, Acl struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetPerms()) {
+        optionals.set(0);
+      }
+      if (struct.isSetId()) {
+        optionals.set(1);
+      }
+      oprot.writeBitSet(optionals, 2);
+      if (struct.isSetPerms()) {
+        oprot.writeI32(struct.perms);
+      }
+      if (struct.isSetId()) {
+        struct.id.write(oprot);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, Acl struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(2);
+      if (incoming.get(0)) {
+        struct.perms = iprot.readI32();
+        struct.setPermsIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.id = new id();
+        struct.id.read(iprot);
+        struct.setIdIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/test/java/org/apache/curator/generated/CreateMode.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/CreateMode.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/CreateMode.java
new file mode 100644
index 0000000..1d19620
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CreateMode.java
@@ -0,0 +1,51 @@
+/**
+ * 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 CreateMode implements org.apache.thrift.TEnum {
+  PERSISTENT(0),
+  PERSISTENT_SEQUENTIAL(1),
+  EPHEMERAL(2),
+  EPHEMERAL_SEQUENTIAL(3);
+
+  private final int value;
+
+  private CreateMode(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 CreateMode findByValue(int value) { 
+    switch (value) {
+      case 0:
+        return PERSISTENT;
+      case 1:
+        return PERSISTENT_SEQUENTIAL;
+      case 2:
+        return EPHEMERAL;
+      case 3:
+        return EPHEMERAL_SEQUENTIAL;
+      default:
+        return null;
+    }
+  }
+}


[02/14] git commit: wip

Posted by ra...@apache.org.
wip


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

Branch: refs/heads/curator-rpc
Commit: 10e52ad0051f839e0349d728b22254a42e91924e
Parents: b949f57
Author: randgalt <ra...@apache.org>
Authored: Mon May 26 00:05:49 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon May 26 00:05:49 2014 -0500

----------------------------------------------------------------------
 .../apache/curator/x/rpc/idl/CreateMode.java    |   9 ++
 .../apache/curator/x/rpc/idl/CreateSpec.java    | 105 +++++++++++++++++
 .../x/rpc/idl/CuratorProjectionService.java     | 118 +++++++++++++++++++
 curator-x-rpc/src/main/scripts/generate.sh      |  13 +-
 curator-x-rpc/src/main/thrift/curator.thrift    |  14 +++
 5 files changed, 255 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/10e52ad0/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateMode.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateMode.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateMode.java
new file mode 100644
index 0000000..f35e32b
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateMode.java
@@ -0,0 +1,9 @@
+package org.apache.curator.x.rpc.idl;
+
+public enum CreateMode
+{
+    PERSISTENT,
+    PERSISTENT_SEQUENTIAL,
+    EPHEMERAL,
+    EPHEMERAL_SEQUENTIAL
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/10e52ad0/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateSpec.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateSpec.java
new file mode 100644
index 0000000..f401fb5
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CreateSpec.java
@@ -0,0 +1,105 @@
+package org.apache.curator.x.rpc.idl;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct
+public class CreateSpec
+{
+    private String path;
+    private String data;
+    private CreateMode mode;
+    private boolean async;
+    private String asyncId;
+    private boolean compressed;
+    private boolean creatingParentsIfNeeded;
+    private boolean withProtection;
+
+    @ThriftField(1)
+    public String getPath()
+    {
+        return path;
+    }
+
+    @ThriftField(2)
+    public String getAsyncId()
+    {
+        return asyncId;
+    }
+
+    public void setAsyncId(String asyncId)
+    {
+        this.asyncId = asyncId;
+    }
+
+    public void setPath(String path)
+    {
+        this.path = path;
+    }
+
+    @ThriftField(3)
+    public String getData()
+    {
+        return data;
+    }
+
+    public void setData(String data)
+    {
+        this.data = data;
+    }
+
+    @ThriftField(4)
+    public CreateMode getMode()
+    {
+        return mode;
+    }
+
+    public void setMode(CreateMode mode)
+    {
+        this.mode = mode;
+    }
+
+    @ThriftField(5)
+    public boolean isAsync()
+    {
+        return async;
+    }
+
+    public void setAsync(boolean async)
+    {
+        this.async = async;
+    }
+
+    @ThriftField(6)
+    public boolean isCompressed()
+    {
+        return compressed;
+    }
+
+    public void setCompressed(boolean compressed)
+    {
+        this.compressed = compressed;
+    }
+
+    @ThriftField(7)
+    public boolean isCreatingParentsIfNeeded()
+    {
+        return creatingParentsIfNeeded;
+    }
+
+    public void setCreatingParentsIfNeeded(boolean creatingParentsIfNeeded)
+    {
+        this.creatingParentsIfNeeded = creatingParentsIfNeeded;
+    }
+
+    @ThriftField(8)
+    public boolean isWithProtection()
+    {
+        return withProtection;
+    }
+
+    public void setWithProtection(boolean withProtection)
+    {
+        this.withProtection = withProtection;
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/10e52ad0/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionService.java
index dd5bf33..8acfd0f 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/CuratorProjectionService.java
@@ -5,6 +5,10 @@ import com.facebook.swift.service.ThriftService;
 import com.google.common.collect.Maps;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.framework.api.Compressible;
+import org.apache.curator.framework.api.CreateBuilder;
+import org.apache.curator.framework.api.CreateModable;
+import org.apache.curator.framework.api.PathAndBytesable;
 import org.apache.curator.retry.RetryOneTime;
 import java.util.Map;
 import java.util.UUID;
@@ -33,4 +37,118 @@ public class CuratorProjectionService
             client.close();
         }
     }
+
+    //@ThriftMethod
+    public String create(CuratorProjection projection, CreateSpec createSpec) throws Exception
+    {
+        CuratorFramework client = getClient(projection);
+
+        Object builder = client.create();
+        if ( createSpec.isCreatingParentsIfNeeded() )
+        {
+            builder = castBuilder(builder, CreateBuilder.class).creatingParentsIfNeeded();
+        }
+        if ( createSpec.isCompressed() )
+        {
+            builder = castBuilder(builder, Compressible.class).compressed();
+        }
+        if ( createSpec.isWithProtection() )
+        {
+            builder = castBuilder(builder, CreateBuilder.class).withProtection();
+        }
+        builder = castBuilder(builder, CreateModable.class).withMode(getRealMode(createSpec.getMode()));
+
+        if ( createSpec.isAsync() )
+        {
+/*
+TODO
+            BackgroundCallback backgroundCallback = new RestBackgroundCallback(context, Constants.CLIENT_CREATE_ASYNC, createSpec.getAsyncId())
+            {
+                @Override
+                public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
+                {
+                    if ( event.getResultCode() == 0 )
+                    {
+                        checkEphemeralCreate(createSpec, id, event.getName());
+                    }
+                    super.processResult(client, event);
+                }
+
+                @Override
+                protected String getMessage(CuratorEvent event)
+                {
+                    PathAndId pathAndId = new PathAndId(String.valueOf(event.getName()), id);
+                    try
+                    {
+                        return context.getWriter().writeValueAsString(pathAndId);
+                    }
+                    catch ( IOException e )
+                    {
+                        log.error("Could not serialize PathAndId", e);
+                    }
+                    return "{}";
+                }
+
+                @Override
+                protected String getDetails(CuratorEvent event)
+                {
+                    if ( event.getResultCode() != 0 )
+                    {
+                        return super.getDetails(event);
+                    }
+                    return id;
+                }
+            };
+            builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
+*/
+        }
+
+        return String.valueOf(castBuilder(builder, PathAndBytesable.class).forPath(createSpec.getPath(), createSpec.getData().getBytes()));
+    }
+
+    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 CuratorFramework getClient(CuratorProjection projection) throws Exception
+    {
+        CuratorFramework client = projections.get(projection.getId());
+        if ( client == null )
+        {
+            throw new Exception("No client found with id: " + projection.getId());
+        }
+        return client;
+    }
+
+    private static <T> T castBuilder(Object createBuilder, Class<T> clazz) throws Exception
+    {
+        if ( clazz.isAssignableFrom(createBuilder.getClass()) )
+        {
+            return clazz.cast(createBuilder);
+        }
+        throw new Exception("That operation is not available"); // TODO
+    }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/10e52ad0/curator-x-rpc/src/main/scripts/generate.sh
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/scripts/generate.sh b/curator-x-rpc/src/main/scripts/generate.sh
index ae3d575..b094336 100755
--- a/curator-x-rpc/src/main/scripts/generate.sh
+++ b/curator-x-rpc/src/main/scripts/generate.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
-if (( $# != 1 )); then
-    echo "missing argument: path to swift2thrift-generator-cli-N.N.N-standalone.jar"
+if (( $# != 2 )); then
+    echo "usage:\ngenerate.sh <path to swift2thrift-generator-cli-N.N.N-standalone.jar> <path to zookeeper-N.N.N.jar>"
     exit
 fi
 
@@ -10,11 +10,16 @@ BASE_DIR="$( cd "$DIR/../../../.." && pwd )"
 
 RPC_PATH="$BASE_DIR/curator-x-rpc/target/classes"
 CLASSES=""
-for f in `ls -m1 $RPC_PATH/org/apache/curator/x/rpc/idl/*.class | xargs -n 1 basename | sed s/\.[^\.]*$//`; do CLASSES="$CLASSES $f"; done;
+for f in `ls -m1 $RPC_PATH/org/apache/curator/x/rpc/idl/*.class | xargs -n 1 basename | sed s/\.[^\.]*$//`;
+    do
+        if [[ $f != *[\$]* ]]; then
+            CLASSES="$CLASSES $f";
+        fi;
+done;
 
 THRIFT_DIR="$BASE_DIR/curator-x-rpc/src/main/thrift"
 
-PATHS="$1"
+PATHS="$1:$2"
 PATHS="$PATHS:$BASE_DIR/curator-client/target/classes"
 PATHS="$PATHS:$BASE_DIR/curator-framework/target/classes"
 PATHS="$PATHS:$BASE_DIR/curator-recipes/target/classes"

http://git-wip-us.apache.org/repos/asf/curator/blob/10e52ad0/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 754002f..5662949 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -2,6 +2,20 @@ namespace java.swift org.apache.curator.x.rpc.idl
 namespace cpp org.apache.curator
 
 
+enum CreateMode {
+  PERSISTENT, PERSISTENT_SEQUENTIAL, EPHEMERAL, EPHEMERAL_SEQUENTIAL
+}
+
+struct CreateSpec {
+  1: string path;
+  2: string asyncId;
+  3: string data;
+  4: CreateMode mode;
+  5: bool async;
+  6: bool compressed;
+  7: bool creatingParentsIfNeeded;
+  8: bool withProtection;
+}
 
 struct CuratorProjection {
   1: string id;


[08/14] wip

Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/curator-x-rpc/src/test/java/org/apache/curator/generated/CreateSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/CreateSpec.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/CreateSpec.java
new file mode 100644
index 0000000..67437d3
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CreateSpec.java
@@ -0,0 +1,984 @@
+/**
+ * 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 CreateSpec implements org.apache.thrift.TBase<CreateSpec, CreateSpec._Fields>, java.io.Serializable, Cloneable, Comparable<CreateSpec> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CreateSpec");
+
+  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 DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("data", org.apache.thrift.protocol.TType.STRING, (short)2);
+  private static final org.apache.thrift.protocol.TField MODE_FIELD_DESC = new org.apache.thrift.protocol.TField("mode", org.apache.thrift.protocol.TType.I32, (short)3);
+  private static final org.apache.thrift.protocol.TField DO_ASYNC_FIELD_DESC = new org.apache.thrift.protocol.TField("doAsync", org.apache.thrift.protocol.TType.BOOL, (short)4);
+  private static final org.apache.thrift.protocol.TField COMPRESSED_FIELD_DESC = new org.apache.thrift.protocol.TField("compressed", org.apache.thrift.protocol.TType.BOOL, (short)5);
+  private static final org.apache.thrift.protocol.TField CREATING_PARENTS_IF_NEEDED_FIELD_DESC = new org.apache.thrift.protocol.TField("creatingParentsIfNeeded", org.apache.thrift.protocol.TType.BOOL, (short)6);
+  private static final org.apache.thrift.protocol.TField WITH_PROTECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("withProtection", org.apache.thrift.protocol.TType.BOOL, (short)7);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new CreateSpecStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new CreateSpecTupleSchemeFactory());
+  }
+
+  public String path; // required
+  public String data; // required
+  /**
+   * 
+   * @see CreateMode
+   */
+  public CreateMode mode; // required
+  public boolean doAsync; // required
+  public boolean compressed; // required
+  public boolean creatingParentsIfNeeded; // required
+  public boolean withProtection; // 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"),
+    DATA((short)2, "data"),
+    /**
+     * 
+     * @see CreateMode
+     */
+    MODE((short)3, "mode"),
+    DO_ASYNC((short)4, "doAsync"),
+    COMPRESSED((short)5, "compressed"),
+    CREATING_PARENTS_IF_NEEDED((short)6, "creatingParentsIfNeeded"),
+    WITH_PROTECTION((short)7, "withProtection");
+
+    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: // DATA
+          return DATA;
+        case 3: // MODE
+          return MODE;
+        case 4: // DO_ASYNC
+          return DO_ASYNC;
+        case 5: // COMPRESSED
+          return COMPRESSED;
+        case 6: // CREATING_PARENTS_IF_NEEDED
+          return CREATING_PARENTS_IF_NEEDED;
+        case 7: // WITH_PROTECTION
+          return WITH_PROTECTION;
+        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 __DOASYNC_ISSET_ID = 0;
+  private static final int __COMPRESSED_ISSET_ID = 1;
+  private static final int __CREATINGPARENTSIFNEEDED_ISSET_ID = 2;
+  private static final int __WITHPROTECTION_ISSET_ID = 3;
+  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.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)));
+    tmpMap.put(_Fields.MODE, new org.apache.thrift.meta_data.FieldMetaData("mode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, CreateMode.class)));
+    tmpMap.put(_Fields.DO_ASYNC, new org.apache.thrift.meta_data.FieldMetaData("doAsync", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+    tmpMap.put(_Fields.COMPRESSED, new org.apache.thrift.meta_data.FieldMetaData("compressed", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+    tmpMap.put(_Fields.CREATING_PARENTS_IF_NEEDED, new org.apache.thrift.meta_data.FieldMetaData("creatingParentsIfNeeded", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+    tmpMap.put(_Fields.WITH_PROTECTION, new org.apache.thrift.meta_data.FieldMetaData("withProtection", 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(CreateSpec.class, metaDataMap);
+  }
+
+  public CreateSpec() {
+  }
+
+  public CreateSpec(
+    String path,
+    String data,
+    CreateMode mode,
+    boolean doAsync,
+    boolean compressed,
+    boolean creatingParentsIfNeeded,
+    boolean withProtection)
+  {
+    this();
+    this.path = path;
+    this.data = data;
+    this.mode = mode;
+    this.doAsync = doAsync;
+    setDoAsyncIsSet(true);
+    this.compressed = compressed;
+    setCompressedIsSet(true);
+    this.creatingParentsIfNeeded = creatingParentsIfNeeded;
+    setCreatingParentsIfNeededIsSet(true);
+    this.withProtection = withProtection;
+    setWithProtectionIsSet(true);
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public CreateSpec(CreateSpec other) {
+    __isset_bitfield = other.__isset_bitfield;
+    if (other.isSetPath()) {
+      this.path = other.path;
+    }
+    if (other.isSetData()) {
+      this.data = other.data;
+    }
+    if (other.isSetMode()) {
+      this.mode = other.mode;
+    }
+    this.doAsync = other.doAsync;
+    this.compressed = other.compressed;
+    this.creatingParentsIfNeeded = other.creatingParentsIfNeeded;
+    this.withProtection = other.withProtection;
+  }
+
+  public CreateSpec deepCopy() {
+    return new CreateSpec(this);
+  }
+
+  @Override
+  public void clear() {
+    this.path = null;
+    this.data = null;
+    this.mode = null;
+    setDoAsyncIsSet(false);
+    this.doAsync = false;
+    setCompressedIsSet(false);
+    this.compressed = false;
+    setCreatingParentsIfNeededIsSet(false);
+    this.creatingParentsIfNeeded = false;
+    setWithProtectionIsSet(false);
+    this.withProtection = false;
+  }
+
+  public String getPath() {
+    return this.path;
+  }
+
+  public CreateSpec 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 String getData() {
+    return this.data;
+  }
+
+  public CreateSpec setData(String 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;
+    }
+  }
+
+  /**
+   * 
+   * @see CreateMode
+   */
+  public CreateMode getMode() {
+    return this.mode;
+  }
+
+  /**
+   * 
+   * @see CreateMode
+   */
+  public CreateSpec setMode(CreateMode mode) {
+    this.mode = mode;
+    return this;
+  }
+
+  public void unsetMode() {
+    this.mode = null;
+  }
+
+  /** Returns true if field mode is set (has been assigned a value) and false otherwise */
+  public boolean isSetMode() {
+    return this.mode != null;
+  }
+
+  public void setModeIsSet(boolean value) {
+    if (!value) {
+      this.mode = null;
+    }
+  }
+
+  public boolean isDoAsync() {
+    return this.doAsync;
+  }
+
+  public CreateSpec setDoAsync(boolean doAsync) {
+    this.doAsync = doAsync;
+    setDoAsyncIsSet(true);
+    return this;
+  }
+
+  public void unsetDoAsync() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DOASYNC_ISSET_ID);
+  }
+
+  /** Returns true if field doAsync is set (has been assigned a value) and false otherwise */
+  public boolean isSetDoAsync() {
+    return EncodingUtils.testBit(__isset_bitfield, __DOASYNC_ISSET_ID);
+  }
+
+  public void setDoAsyncIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DOASYNC_ISSET_ID, value);
+  }
+
+  public boolean isCompressed() {
+    return this.compressed;
+  }
+
+  public CreateSpec setCompressed(boolean compressed) {
+    this.compressed = compressed;
+    setCompressedIsSet(true);
+    return this;
+  }
+
+  public void unsetCompressed() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __COMPRESSED_ISSET_ID);
+  }
+
+  /** Returns true if field compressed is set (has been assigned a value) and false otherwise */
+  public boolean isSetCompressed() {
+    return EncodingUtils.testBit(__isset_bitfield, __COMPRESSED_ISSET_ID);
+  }
+
+  public void setCompressedIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __COMPRESSED_ISSET_ID, value);
+  }
+
+  public boolean isCreatingParentsIfNeeded() {
+    return this.creatingParentsIfNeeded;
+  }
+
+  public CreateSpec setCreatingParentsIfNeeded(boolean creatingParentsIfNeeded) {
+    this.creatingParentsIfNeeded = creatingParentsIfNeeded;
+    setCreatingParentsIfNeededIsSet(true);
+    return this;
+  }
+
+  public void unsetCreatingParentsIfNeeded() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CREATINGPARENTSIFNEEDED_ISSET_ID);
+  }
+
+  /** Returns true if field creatingParentsIfNeeded is set (has been assigned a value) and false otherwise */
+  public boolean isSetCreatingParentsIfNeeded() {
+    return EncodingUtils.testBit(__isset_bitfield, __CREATINGPARENTSIFNEEDED_ISSET_ID);
+  }
+
+  public void setCreatingParentsIfNeededIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CREATINGPARENTSIFNEEDED_ISSET_ID, value);
+  }
+
+  public boolean isWithProtection() {
+    return this.withProtection;
+  }
+
+  public CreateSpec setWithProtection(boolean withProtection) {
+    this.withProtection = withProtection;
+    setWithProtectionIsSet(true);
+    return this;
+  }
+
+  public void unsetWithProtection() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WITHPROTECTION_ISSET_ID);
+  }
+
+  /** Returns true if field withProtection is set (has been assigned a value) and false otherwise */
+  public boolean isSetWithProtection() {
+    return EncodingUtils.testBit(__isset_bitfield, __WITHPROTECTION_ISSET_ID);
+  }
+
+  public void setWithProtectionIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WITHPROTECTION_ISSET_ID, value);
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case PATH:
+      if (value == null) {
+        unsetPath();
+      } else {
+        setPath((String)value);
+      }
+      break;
+
+    case DATA:
+      if (value == null) {
+        unsetData();
+      } else {
+        setData((String)value);
+      }
+      break;
+
+    case MODE:
+      if (value == null) {
+        unsetMode();
+      } else {
+        setMode((CreateMode)value);
+      }
+      break;
+
+    case DO_ASYNC:
+      if (value == null) {
+        unsetDoAsync();
+      } else {
+        setDoAsync((Boolean)value);
+      }
+      break;
+
+    case COMPRESSED:
+      if (value == null) {
+        unsetCompressed();
+      } else {
+        setCompressed((Boolean)value);
+      }
+      break;
+
+    case CREATING_PARENTS_IF_NEEDED:
+      if (value == null) {
+        unsetCreatingParentsIfNeeded();
+      } else {
+        setCreatingParentsIfNeeded((Boolean)value);
+      }
+      break;
+
+    case WITH_PROTECTION:
+      if (value == null) {
+        unsetWithProtection();
+      } else {
+        setWithProtection((Boolean)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case PATH:
+      return getPath();
+
+    case DATA:
+      return getData();
+
+    case MODE:
+      return getMode();
+
+    case DO_ASYNC:
+      return Boolean.valueOf(isDoAsync());
+
+    case COMPRESSED:
+      return Boolean.valueOf(isCompressed());
+
+    case CREATING_PARENTS_IF_NEEDED:
+      return Boolean.valueOf(isCreatingParentsIfNeeded());
+
+    case WITH_PROTECTION:
+      return Boolean.valueOf(isWithProtection());
+
+    }
+    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 DATA:
+      return isSetData();
+    case MODE:
+      return isSetMode();
+    case DO_ASYNC:
+      return isSetDoAsync();
+    case COMPRESSED:
+      return isSetCompressed();
+    case CREATING_PARENTS_IF_NEEDED:
+      return isSetCreatingParentsIfNeeded();
+    case WITH_PROTECTION:
+      return isSetWithProtection();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof CreateSpec)
+      return this.equals((CreateSpec)that);
+    return false;
+  }
+
+  public boolean equals(CreateSpec 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_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;
+    }
+
+    boolean this_present_mode = true && this.isSetMode();
+    boolean that_present_mode = true && that.isSetMode();
+    if (this_present_mode || that_present_mode) {
+      if (!(this_present_mode && that_present_mode))
+        return false;
+      if (!this.mode.equals(that.mode))
+        return false;
+    }
+
+    boolean this_present_doAsync = true;
+    boolean that_present_doAsync = true;
+    if (this_present_doAsync || that_present_doAsync) {
+      if (!(this_present_doAsync && that_present_doAsync))
+        return false;
+      if (this.doAsync != that.doAsync)
+        return false;
+    }
+
+    boolean this_present_compressed = true;
+    boolean that_present_compressed = true;
+    if (this_present_compressed || that_present_compressed) {
+      if (!(this_present_compressed && that_present_compressed))
+        return false;
+      if (this.compressed != that.compressed)
+        return false;
+    }
+
+    boolean this_present_creatingParentsIfNeeded = true;
+    boolean that_present_creatingParentsIfNeeded = true;
+    if (this_present_creatingParentsIfNeeded || that_present_creatingParentsIfNeeded) {
+      if (!(this_present_creatingParentsIfNeeded && that_present_creatingParentsIfNeeded))
+        return false;
+      if (this.creatingParentsIfNeeded != that.creatingParentsIfNeeded)
+        return false;
+    }
+
+    boolean this_present_withProtection = true;
+    boolean that_present_withProtection = true;
+    if (this_present_withProtection || that_present_withProtection) {
+      if (!(this_present_withProtection && that_present_withProtection))
+        return false;
+      if (this.withProtection != that.withProtection)
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(CreateSpec 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(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;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetMode()).compareTo(other.isSetMode());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetMode()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mode, other.mode);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetDoAsync()).compareTo(other.isSetDoAsync());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetDoAsync()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.doAsync, other.doAsync);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetCompressed()).compareTo(other.isSetCompressed());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetCompressed()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.compressed, other.compressed);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetCreatingParentsIfNeeded()).compareTo(other.isSetCreatingParentsIfNeeded());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetCreatingParentsIfNeeded()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.creatingParentsIfNeeded, other.creatingParentsIfNeeded);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetWithProtection()).compareTo(other.isSetWithProtection());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetWithProtection()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.withProtection, other.withProtection);
+      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("CreateSpec(");
+    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("data:");
+    if (this.data == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.data);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("mode:");
+    if (this.mode == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.mode);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("doAsync:");
+    sb.append(this.doAsync);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("compressed:");
+    sb.append(this.compressed);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("creatingParentsIfNeeded:");
+    sb.append(this.creatingParentsIfNeeded);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("withProtection:");
+    sb.append(this.withProtection);
+    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 CreateSpecStandardSchemeFactory implements SchemeFactory {
+    public CreateSpecStandardScheme getScheme() {
+      return new CreateSpecStandardScheme();
+    }
+  }
+
+  private static class CreateSpecStandardScheme extends StandardScheme<CreateSpec> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, CreateSpec 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: // DATA
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.data = iprot.readString();
+              struct.setDataIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // MODE
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.mode = CreateMode.findByValue(iprot.readI32());
+              struct.setModeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 4: // DO_ASYNC
+            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+              struct.doAsync = iprot.readBool();
+              struct.setDoAsyncIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 5: // COMPRESSED
+            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+              struct.compressed = iprot.readBool();
+              struct.setCompressedIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 6: // CREATING_PARENTS_IF_NEEDED
+            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+              struct.creatingParentsIfNeeded = iprot.readBool();
+              struct.setCreatingParentsIfNeededIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 7: // WITH_PROTECTION
+            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+              struct.withProtection = iprot.readBool();
+              struct.setWithProtectionIsSet(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, CreateSpec 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.data != null) {
+        oprot.writeFieldBegin(DATA_FIELD_DESC);
+        oprot.writeString(struct.data);
+        oprot.writeFieldEnd();
+      }
+      if (struct.mode != null) {
+        oprot.writeFieldBegin(MODE_FIELD_DESC);
+        oprot.writeI32(struct.mode.getValue());
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldBegin(DO_ASYNC_FIELD_DESC);
+      oprot.writeBool(struct.doAsync);
+      oprot.writeFieldEnd();
+      oprot.writeFieldBegin(COMPRESSED_FIELD_DESC);
+      oprot.writeBool(struct.compressed);
+      oprot.writeFieldEnd();
+      oprot.writeFieldBegin(CREATING_PARENTS_IF_NEEDED_FIELD_DESC);
+      oprot.writeBool(struct.creatingParentsIfNeeded);
+      oprot.writeFieldEnd();
+      oprot.writeFieldBegin(WITH_PROTECTION_FIELD_DESC);
+      oprot.writeBool(struct.withProtection);
+      oprot.writeFieldEnd();
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class CreateSpecTupleSchemeFactory implements SchemeFactory {
+    public CreateSpecTupleScheme getScheme() {
+      return new CreateSpecTupleScheme();
+    }
+  }
+
+  private static class CreateSpecTupleScheme extends TupleScheme<CreateSpec> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, CreateSpec struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetPath()) {
+        optionals.set(0);
+      }
+      if (struct.isSetData()) {
+        optionals.set(1);
+      }
+      if (struct.isSetMode()) {
+        optionals.set(2);
+      }
+      if (struct.isSetDoAsync()) {
+        optionals.set(3);
+      }
+      if (struct.isSetCompressed()) {
+        optionals.set(4);
+      }
+      if (struct.isSetCreatingParentsIfNeeded()) {
+        optionals.set(5);
+      }
+      if (struct.isSetWithProtection()) {
+        optionals.set(6);
+      }
+      oprot.writeBitSet(optionals, 7);
+      if (struct.isSetPath()) {
+        oprot.writeString(struct.path);
+      }
+      if (struct.isSetData()) {
+        oprot.writeString(struct.data);
+      }
+      if (struct.isSetMode()) {
+        oprot.writeI32(struct.mode.getValue());
+      }
+      if (struct.isSetDoAsync()) {
+        oprot.writeBool(struct.doAsync);
+      }
+      if (struct.isSetCompressed()) {
+        oprot.writeBool(struct.compressed);
+      }
+      if (struct.isSetCreatingParentsIfNeeded()) {
+        oprot.writeBool(struct.creatingParentsIfNeeded);
+      }
+      if (struct.isSetWithProtection()) {
+        oprot.writeBool(struct.withProtection);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, CreateSpec struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(7);
+      if (incoming.get(0)) {
+        struct.path = iprot.readString();
+        struct.setPathIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.data = iprot.readString();
+        struct.setDataIsSet(true);
+      }
+      if (incoming.get(2)) {
+        struct.mode = CreateMode.findByValue(iprot.readI32());
+        struct.setModeIsSet(true);
+      }
+      if (incoming.get(3)) {
+        struct.doAsync = iprot.readBool();
+        struct.setDoAsyncIsSet(true);
+      }
+      if (incoming.get(4)) {
+        struct.compressed = iprot.readBool();
+        struct.setCompressedIsSet(true);
+      }
+      if (incoming.get(5)) {
+        struct.creatingParentsIfNeeded = iprot.readBool();
+        struct.setCreatingParentsIfNeededIsSet(true);
+      }
+      if (incoming.get(6)) {
+        struct.withProtection = iprot.readBool();
+        struct.setWithProtectionIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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
new file mode 100644
index 0000000..41e57dc
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEvent.java
@@ -0,0 +1,1531 @@
+/**
+ * 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 CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, CuratorEvent._Fields>, java.io.Serializable, Cloneable, Comparable<CuratorEvent> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CuratorEvent");
+
+  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 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 RESULT_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("resultCode", org.apache.thrift.protocol.TType.I32, (short)3);
+  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)4);
+  private static final org.apache.thrift.protocol.TField CONTEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("context", org.apache.thrift.protocol.TType.STRING, (short)5);
+  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)6);
+  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)7);
+  private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)8);
+  private static final org.apache.thrift.protocol.TField CHILDREN_FIELD_DESC = new org.apache.thrift.protocol.TField("children", org.apache.thrift.protocol.TType.LIST, (short)9);
+  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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new CuratorEventStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new CuratorEventTupleSchemeFactory());
+  }
+
+  public CuratorProjection projection; // required
+  /**
+   * 
+   * @see CuratorEventType
+   */
+  public CuratorEventType type; // required
+  public int resultCode; // required
+  public String path; // required
+  public String context; // required
+  public Stat stat; // required
+  public ByteBuffer data; // required
+  public String name; // required
+  public List<String> children; // required
+  public List<Acl> aclList; // required
+  public WatchedEvent watchedEvent; // 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"),
+    /**
+     * 
+     * @see CuratorEventType
+     */
+    TYPE((short)2, "type"),
+    RESULT_CODE((short)3, "resultCode"),
+    PATH((short)4, "path"),
+    CONTEXT((short)5, "context"),
+    STAT((short)6, "stat"),
+    DATA((short)7, "data"),
+    NAME((short)8, "name"),
+    CHILDREN((short)9, "children"),
+    ACL_LIST((short)10, "aclList"),
+    WATCHED_EVENT((short)11, "watchedEvent");
+
+    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: // TYPE
+          return TYPE;
+        case 3: // RESULT_CODE
+          return RESULT_CODE;
+        case 4: // PATH
+          return PATH;
+        case 5: // CONTEXT
+          return CONTEXT;
+        case 6: // STAT
+          return STAT;
+        case 7: // DATA
+          return DATA;
+        case 8: // NAME
+          return NAME;
+        case 9: // CHILDREN
+          return CHILDREN;
+        case 10: // ACL_LIST
+          return ACL_LIST;
+        case 11: // WATCHED_EVENT
+          return WATCHED_EVENT;
+        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 __RESULTCODE_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.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.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, CuratorEventType.class)));
+    tmpMap.put(_Fields.RESULT_CODE, new org.apache.thrift.meta_data.FieldMetaData("resultCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+    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.CONTEXT, new org.apache.thrift.meta_data.FieldMetaData("context", 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)));
+    tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.CHILDREN, new org.apache.thrift.meta_data.FieldMetaData("children", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+    tmpMap.put(_Fields.ACL_LIST, new org.apache.thrift.meta_data.FieldMetaData("aclList", 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, Acl.class))));
+    tmpMap.put(_Fields.WATCHED_EVENT, new org.apache.thrift.meta_data.FieldMetaData("watchedEvent", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, WatchedEvent.class)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CuratorEvent.class, metaDataMap);
+  }
+
+  public CuratorEvent() {
+  }
+
+  public CuratorEvent(
+    CuratorProjection projection,
+    CuratorEventType type,
+    int resultCode,
+    String path,
+    String context,
+    Stat stat,
+    ByteBuffer data,
+    String name,
+    List<String> children,
+    List<Acl> aclList,
+    WatchedEvent watchedEvent)
+  {
+    this();
+    this.projection = projection;
+    this.type = type;
+    this.resultCode = resultCode;
+    setResultCodeIsSet(true);
+    this.path = path;
+    this.context = context;
+    this.stat = stat;
+    this.data = data;
+    this.name = name;
+    this.children = children;
+    this.aclList = aclList;
+    this.watchedEvent = watchedEvent;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public CuratorEvent(CuratorEvent other) {
+    __isset_bitfield = other.__isset_bitfield;
+    if (other.isSetProjection()) {
+      this.projection = new CuratorProjection(other.projection);
+    }
+    if (other.isSetType()) {
+      this.type = other.type;
+    }
+    this.resultCode = other.resultCode;
+    if (other.isSetPath()) {
+      this.path = other.path;
+    }
+    if (other.isSetContext()) {
+      this.context = other.context;
+    }
+    if (other.isSetStat()) {
+      this.stat = new Stat(other.stat);
+    }
+    if (other.isSetData()) {
+      this.data = org.apache.thrift.TBaseHelper.copyBinary(other.data);
+;
+    }
+    if (other.isSetName()) {
+      this.name = other.name;
+    }
+    if (other.isSetChildren()) {
+      List<String> __this__children = new ArrayList<String>(other.children);
+      this.children = __this__children;
+    }
+    if (other.isSetAclList()) {
+      List<Acl> __this__aclList = new ArrayList<Acl>(other.aclList.size());
+      for (Acl other_element : other.aclList) {
+        __this__aclList.add(new Acl(other_element));
+      }
+      this.aclList = __this__aclList;
+    }
+    if (other.isSetWatchedEvent()) {
+      this.watchedEvent = new WatchedEvent(other.watchedEvent);
+    }
+  }
+
+  public CuratorEvent deepCopy() {
+    return new CuratorEvent(this);
+  }
+
+  @Override
+  public void clear() {
+    this.projection = null;
+    this.type = null;
+    setResultCodeIsSet(false);
+    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;
+  }
+
+  public CuratorProjection getProjection() {
+    return this.projection;
+  }
+
+  public CuratorEvent 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;
+    }
+  }
+
+  /**
+   * 
+   * @see CuratorEventType
+   */
+  public CuratorEventType getType() {
+    return this.type;
+  }
+
+  /**
+   * 
+   * @see CuratorEventType
+   */
+  public CuratorEvent setType(CuratorEventType 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 int getResultCode() {
+    return this.resultCode;
+  }
+
+  public CuratorEvent setResultCode(int resultCode) {
+    this.resultCode = resultCode;
+    setResultCodeIsSet(true);
+    return this;
+  }
+
+  public void unsetResultCode() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __RESULTCODE_ISSET_ID);
+  }
+
+  /** Returns true if field resultCode is set (has been assigned a value) and false otherwise */
+  public boolean isSetResultCode() {
+    return EncodingUtils.testBit(__isset_bitfield, __RESULTCODE_ISSET_ID);
+  }
+
+  public void setResultCodeIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __RESULTCODE_ISSET_ID, value);
+  }
+
+  public String getPath() {
+    return this.path;
+  }
+
+  public CuratorEvent 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 String getContext() {
+    return this.context;
+  }
+
+  public CuratorEvent setContext(String context) {
+    this.context = context;
+    return this;
+  }
+
+  public void unsetContext() {
+    this.context = null;
+  }
+
+  /** Returns true if field context is set (has been assigned a value) and false otherwise */
+  public boolean isSetContext() {
+    return this.context != null;
+  }
+
+  public void setContextIsSet(boolean value) {
+    if (!value) {
+      this.context = null;
+    }
+  }
+
+  public Stat getStat() {
+    return this.stat;
+  }
+
+  public CuratorEvent 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 CuratorEvent setData(byte[] data) {
+    setData(data == null ? (ByteBuffer)null : ByteBuffer.wrap(data));
+    return this;
+  }
+
+  public CuratorEvent 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 String getName() {
+    return this.name;
+  }
+
+  public CuratorEvent setName(String name) {
+    this.name = name;
+    return this;
+  }
+
+  public void unsetName() {
+    this.name = null;
+  }
+
+  /** Returns true if field name is set (has been assigned a value) and false otherwise */
+  public boolean isSetName() {
+    return this.name != null;
+  }
+
+  public void setNameIsSet(boolean value) {
+    if (!value) {
+      this.name = null;
+    }
+  }
+
+  public int getChildrenSize() {
+    return (this.children == null) ? 0 : this.children.size();
+  }
+
+  public java.util.Iterator<String> getChildrenIterator() {
+    return (this.children == null) ? null : this.children.iterator();
+  }
+
+  public void addToChildren(String elem) {
+    if (this.children == null) {
+      this.children = new ArrayList<String>();
+    }
+    this.children.add(elem);
+  }
+
+  public List<String> getChildren() {
+    return this.children;
+  }
+
+  public CuratorEvent setChildren(List<String> children) {
+    this.children = children;
+    return this;
+  }
+
+  public void unsetChildren() {
+    this.children = null;
+  }
+
+  /** Returns true if field children is set (has been assigned a value) and false otherwise */
+  public boolean isSetChildren() {
+    return this.children != null;
+  }
+
+  public void setChildrenIsSet(boolean value) {
+    if (!value) {
+      this.children = null;
+    }
+  }
+
+  public int getAclListSize() {
+    return (this.aclList == null) ? 0 : this.aclList.size();
+  }
+
+  public java.util.Iterator<Acl> getAclListIterator() {
+    return (this.aclList == null) ? null : this.aclList.iterator();
+  }
+
+  public void addToAclList(Acl elem) {
+    if (this.aclList == null) {
+      this.aclList = new ArrayList<Acl>();
+    }
+    this.aclList.add(elem);
+  }
+
+  public List<Acl> getAclList() {
+    return this.aclList;
+  }
+
+  public CuratorEvent setAclList(List<Acl> aclList) {
+    this.aclList = aclList;
+    return this;
+  }
+
+  public void unsetAclList() {
+    this.aclList = null;
+  }
+
+  /** Returns true if field aclList is set (has been assigned a value) and false otherwise */
+  public boolean isSetAclList() {
+    return this.aclList != null;
+  }
+
+  public void setAclListIsSet(boolean value) {
+    if (!value) {
+      this.aclList = null;
+    }
+  }
+
+  public WatchedEvent getWatchedEvent() {
+    return this.watchedEvent;
+  }
+
+  public CuratorEvent setWatchedEvent(WatchedEvent watchedEvent) {
+    this.watchedEvent = watchedEvent;
+    return this;
+  }
+
+  public void unsetWatchedEvent() {
+    this.watchedEvent = null;
+  }
+
+  /** Returns true if field watchedEvent is set (has been assigned a value) and false otherwise */
+  public boolean isSetWatchedEvent() {
+    return this.watchedEvent != null;
+  }
+
+  public void setWatchedEventIsSet(boolean value) {
+    if (!value) {
+      this.watchedEvent = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case PROJECTION:
+      if (value == null) {
+        unsetProjection();
+      } else {
+        setProjection((CuratorProjection)value);
+      }
+      break;
+
+    case TYPE:
+      if (value == null) {
+        unsetType();
+      } else {
+        setType((CuratorEventType)value);
+      }
+      break;
+
+    case RESULT_CODE:
+      if (value == null) {
+        unsetResultCode();
+      } else {
+        setResultCode((Integer)value);
+      }
+      break;
+
+    case PATH:
+      if (value == null) {
+        unsetPath();
+      } else {
+        setPath((String)value);
+      }
+      break;
+
+    case CONTEXT:
+      if (value == null) {
+        unsetContext();
+      } else {
+        setContext((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;
+
+    case NAME:
+      if (value == null) {
+        unsetName();
+      } else {
+        setName((String)value);
+      }
+      break;
+
+    case CHILDREN:
+      if (value == null) {
+        unsetChildren();
+      } else {
+        setChildren((List<String>)value);
+      }
+      break;
+
+    case ACL_LIST:
+      if (value == null) {
+        unsetAclList();
+      } else {
+        setAclList((List<Acl>)value);
+      }
+      break;
+
+    case WATCHED_EVENT:
+      if (value == null) {
+        unsetWatchedEvent();
+      } else {
+        setWatchedEvent((WatchedEvent)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case PROJECTION:
+      return getProjection();
+
+    case TYPE:
+      return getType();
+
+    case RESULT_CODE:
+      return Integer.valueOf(getResultCode());
+
+    case PATH:
+      return getPath();
+
+    case CONTEXT:
+      return getContext();
+
+    case STAT:
+      return getStat();
+
+    case DATA:
+      return getData();
+
+    case NAME:
+      return getName();
+
+    case CHILDREN:
+      return getChildren();
+
+    case ACL_LIST:
+      return getAclList();
+
+    case WATCHED_EVENT:
+      return getWatchedEvent();
+
+    }
+    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 TYPE:
+      return isSetType();
+    case RESULT_CODE:
+      return isSetResultCode();
+    case PATH:
+      return isSetPath();
+    case CONTEXT:
+      return isSetContext();
+    case STAT:
+      return isSetStat();
+    case DATA:
+      return isSetData();
+    case NAME:
+      return isSetName();
+    case CHILDREN:
+      return isSetChildren();
+    case ACL_LIST:
+      return isSetAclList();
+    case WATCHED_EVENT:
+      return isSetWatchedEvent();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof CuratorEvent)
+      return this.equals((CuratorEvent)that);
+    return false;
+  }
+
+  public boolean equals(CuratorEvent 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_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_resultCode = true;
+    boolean that_present_resultCode = true;
+    if (this_present_resultCode || that_present_resultCode) {
+      if (!(this_present_resultCode && that_present_resultCode))
+        return false;
+      if (this.resultCode != that.resultCode)
+        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_context = true && this.isSetContext();
+    boolean that_present_context = true && that.isSetContext();
+    if (this_present_context || that_present_context) {
+      if (!(this_present_context && that_present_context))
+        return false;
+      if (!this.context.equals(that.context))
+        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;
+    }
+
+    boolean this_present_name = true && this.isSetName();
+    boolean that_present_name = true && that.isSetName();
+    if (this_present_name || that_present_name) {
+      if (!(this_present_name && that_present_name))
+        return false;
+      if (!this.name.equals(that.name))
+        return false;
+    }
+
+    boolean this_present_children = true && this.isSetChildren();
+    boolean that_present_children = true && that.isSetChildren();
+    if (this_present_children || that_present_children) {
+      if (!(this_present_children && that_present_children))
+        return false;
+      if (!this.children.equals(that.children))
+        return false;
+    }
+
+    boolean this_present_aclList = true && this.isSetAclList();
+    boolean that_present_aclList = true && that.isSetAclList();
+    if (this_present_aclList || that_present_aclList) {
+      if (!(this_present_aclList && that_present_aclList))
+        return false;
+      if (!this.aclList.equals(that.aclList))
+        return false;
+    }
+
+    boolean this_present_watchedEvent = true && this.isSetWatchedEvent();
+    boolean that_present_watchedEvent = true && that.isSetWatchedEvent();
+    if (this_present_watchedEvent || that_present_watchedEvent) {
+      if (!(this_present_watchedEvent && that_present_watchedEvent))
+        return false;
+      if (!this.watchedEvent.equals(that.watchedEvent))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(CuratorEvent 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(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(isSetResultCode()).compareTo(other.isSetResultCode());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetResultCode()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resultCode, other.resultCode);
+      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;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetContext()).compareTo(other.isSetContext());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetContext()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.context, other.context);
+      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;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetName()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetChildren()).compareTo(other.isSetChildren());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetChildren()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.children, other.children);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetAclList()).compareTo(other.isSetAclList());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetAclList()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.aclList, other.aclList);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetWatchedEvent()).compareTo(other.isSetWatchedEvent());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetWatchedEvent()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.watchedEvent, other.watchedEvent);
+      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("CuratorEvent(");
+    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("type:");
+    if (this.type == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.type);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("resultCode:");
+    sb.append(this.resultCode);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("path:");
+    if (this.path == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.path);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("context:");
+    if (this.context == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.context);
+    }
+    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;
+    if (!first) sb.append(", ");
+    sb.append("name:");
+    if (this.name == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.name);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("children:");
+    if (this.children == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.children);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("aclList:");
+    if (this.aclList == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.aclList);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("watchedEvent:");
+    if (this.watchedEvent == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.watchedEvent);
+    }
+    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 (stat != null) {
+      stat.validate();
+    }
+    if (watchedEvent != null) {
+      watchedEvent.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 {
+      // 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 CuratorEventStandardSchemeFactory implements SchemeFactory {
+    public CuratorEventStandardScheme getScheme() {
+      return new CuratorEventStandardScheme();
+    }
+  }
+
+  private static class CuratorEventStandardScheme extends StandardScheme<CuratorEvent> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, CuratorEvent 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: // TYPE
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.type = CuratorEventType.findByValue(iprot.readI32());
+              struct.setTypeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // RESULT_CODE
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.resultCode = iprot.readI32();
+              struct.setResultCodeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 4: // 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 5: // CONTEXT
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.context = iprot.readString();
+              struct.setContextIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 6: // 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 7: // 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;
+          case 8: // NAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.name = iprot.readString();
+              struct.setNameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 9: // CHILDREN
+            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+              {
+                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
+                struct.children = new ArrayList<String>(_list0.size);
+                for (int _i1 = 0; _i1 < _list0.size; ++_i1)
+                {
+                  String _elem2;
+                  _elem2 = iprot.readString();
+                  struct.children.add(_elem2);
+                }
+                iprot.readListEnd();
+              }
+              struct.setChildrenIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 10: // ACL_LIST
+            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+              {
+                org.apache.thrift.protocol.TList _list3 = iprot.readListBegin();
+                struct.aclList = new ArrayList<Acl>(_list3.size);
+                for (int _i4 = 0; _i4 < _list3.size; ++_i4)
+                {
+                  Acl _elem5;
+                  _elem5 = new Acl();
+                  _elem5.read(iprot);
+                  struct.aclList.add(_elem5);
+                }
+                iprot.readListEnd();
+              }
+              struct.setAclListIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 11: // WATCHED_EVENT
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+              struct.watchedEvent = new WatchedEvent();
+              struct.watchedEvent.read(iprot);
+              struct.setWatchedEventIsSet(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, CuratorEvent 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.type != null) {
+        oprot.writeFieldBegin(TYPE_FIELD_DESC);
+        oprot.writeI32(struct.type.getValue());
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldBegin(RESULT_CODE_FIELD_DESC);
+      oprot.writeI32(struct.resultCode);
+      oprot.writeFieldEnd();
+      if (struct.path != null) {
+        oprot.writeFieldBegin(PATH_FIELD_DESC);
+        oprot.writeString(struct.path);
+        oprot.writeFieldEnd();
+      }
+      if (struct.context != null) {
+        oprot.writeFieldBegin(CONTEXT_FIELD_DESC);
+        oprot.writeString(struct.context);
+        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();
+      }
+      if (struct.name != null) {
+        oprot.writeFieldBegin(NAME_FIELD_DESC);
+        oprot.writeString(struct.name);
+        oprot.writeFieldEnd();
+      }
+      if (struct.children != null) {
+        oprot.writeFieldBegin(CHILDREN_FIELD_DESC);
+        {
+          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.children.size()));
+          for (String _iter6 : struct.children)
+          {
+            oprot.writeString(_iter6);
+          }
+          oprot.writeListEnd();
+        }
+        oprot.writeFieldEnd();
+      }
+      if (struct.aclList != null) {
+        oprot.writeFieldBegin(ACL_LIST_FIELD_DESC);
+        {
+          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.aclList.size()));
+          for (Acl _iter7 : struct.aclList)
+          {
+            _iter7.write(oprot);
+          }
+          oprot.writeListEnd();
+        }
+        oprot.writeFieldEnd();
+      }
+      if (struct.watchedEvent != null) {
+        oprot.writeFieldBegin(WATCHED_EVENT_FIELD_DESC);
+        struct.watchedEvent.write(oprot);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class CuratorEventTupleSchemeFactory implements SchemeFactory {
+    public CuratorEventTupleScheme getScheme() {
+      return new CuratorEventTupleScheme();
+    }
+  }
+
+  private static class CuratorEventTupleScheme extends TupleScheme<CuratorEvent> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, CuratorEvent struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetProjection()) {
+        optionals.set(0);
+      }
+      if (struct.isSetType()) {
+        optionals.set(1);
+      }
+      if (struct.isSetResultCode()) {
+        optionals.set(2);
+      }
+      if (struct.isSetPath()) {
+        optionals.set(3);
+      }
+      if (struct.isSetContext()) {
+        optionals.set(4);
+      }
+      if (struct.isSetStat()) {
+        optionals.set(5);
+      }
+      if (struct.isSetData()) {
+        optionals.set(6);
+      }
+      if (struct.isSetName()) {
+        optionals.set(7);
+      }
+      if (struct.isSetChildren()) {
+        optionals.set(8);
+      }
+      if (struct.isSetAclList()) {
+        optionals.set(9);
+      }
+      if (struct.isSetWatchedEvent()) {
+        optionals.set(10);
+      }
+      oprot.writeBitSet(optionals, 11);
+      if (struct.isSetProjection()) {
+        struct.projection.write(oprot);
+      }
+      if (struct.isSetType()) {
+        oprot.writeI32(struct.type.getValue());
+      }
+      if (struct.isSetResultCode()) {
+        oprot.writeI32(struct.resultCode);
+      }
+      if (struct.isSetPath()) {
+        oprot.writeString(struct.path);
+      }
+      if (struct.isSetContext()) {
+        oprot.writeString(struct.context);
+      }
+      if (struct.isSetStat()) {
+        struct.stat.write(oprot);
+      }
+      if (struct.isSetData()) {
+        oprot.writeBinary(struct.data);
+      }
+      if (struct.isSetName()) {
+        oprot.writeString(struct.name);
+      }
+      if (struct.isSetChildren()) {
+        {
+          oprot.writeI32(struct.children.size());
+          for (String _iter8 : struct.children)
+          {
+            oprot.writeString(_iter8);
+          }
+        }
+      }
+      if (struct.isSetAclList()) {
+        {
+          oprot.writeI32(struct.aclList.size());
+          for (Acl _iter9 : struct.aclList)
+          {
+            _iter9.write(oprot);
+          }
+        }
+      }
+      if (struct.isSetWatchedEvent()) {
+        struct.watchedEvent.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);
+      if (incoming.get(0)) {
+        struct.projection = new CuratorProjection();
+        struct.projection.read(iprot);
+        struct.setProjectionIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.type = CuratorEventType.findByValue(iprot.readI32());
+        struct.setTypeIsSet(true);
+      }
+      if (incoming.get(2)) {
+        struct.resultCode = iprot.readI32();
+        struct.setResultCodeIsSet(true);
+      }
+      if (incoming.get(3)) {
+        struct.path = iprot.readString();
+        struct.setPathIsSet(true);
+      }
+      if (incoming.get(4)) {
+        struct.context = iprot.readString();
+        struct.setContextIsSet(true);
+      }
+      if (incoming.get(5)) {
+        struct.stat = new Stat();
+        struct.stat.read(iprot);
+        struct.setStatIsSet(true);
+      }
+      if (incoming.get(6)) {
+        struct.data = iprot.readBinary();
+        struct.setDataIsSet(true);
+      }
+      if (incoming.get(7)) {
+        struct.name = iprot.readString();
+        struct.setNameIsSet(true);
+      }
+      if (incoming.get(8)) {
+        {
+          org.apache.thrift.protocol.TList _list10 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+          struct.children = new ArrayList<String>(_list10.size);
+          for (int _i11 = 0; _i11 < _list10.size; ++_i11)
+          {
+            String _elem12;
+            _elem12 = iprot.readString();
+            struct.children.add(_elem12);
+          }
+        }
+        struct.setChildrenIsSet(true);
+      }
+      if (incoming.get(9)) {
+        {
+          org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+          struct.aclList = new ArrayList<Acl>(_list13.size);
+          for (int _i14 = 0; _i14 < _list13.size; ++_i14)
+          {
+            Acl _elem15;
+            _elem15 = new Acl();
+            _elem15.read(iprot);
+            struct.aclList.add(_elem15);
+          }
+        }
+        struct.setAclListIsSet(true);
+      }
+      if (incoming.get(10)) {
+        struct.watchedEvent = new WatchedEvent();
+        struct.watchedEvent.read(iprot);
+        struct.setWatchedEventIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/curator/blob/5fe11f80/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
new file mode 100644
index 0000000..60350fc
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/CuratorEventType.java
@@ -0,0 +1,72 @@
+/**
+ * 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 CuratorEventType implements org.apache.thrift.TEnum {
+  CREATE(0),
+  DELETE(1),
+  EXISTS(2),
+  GET_DATA(3),
+  SET_DATA(4),
+  CHILDREN(5),
+  SYNC(6),
+  GET_ACL(7),
+  SET_ACL(8),
+  WATCHED(9),
+  CLOSING(10);
+
+  private final int value;
+
+  private CuratorEventType(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 CuratorEventType findByValue(int value) { 
+    switch (value) {
+      case 0:
+        return CREATE;
+      case 1:
+        return DELETE;
+      case 2:
+        return EXISTS;
+      case 3:
+        return GET_DATA;
+      case 4:
+        return SET_DATA;
+      case 5:
+        return CHILDREN;
+      case 6:
+        return SYNC;
+      case 7:
+        return GET_ACL;
+      case 8:
+        return SET_ACL;
+      case 9:
+        return WATCHED;
+      case 10:
+        return CLOSING;
+      default:
+        return null;
+    }
+  }
+}