You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2014/05/29 18:37:40 UTC
git commit: Added getChildren
Repository: curator
Updated Branches:
refs/heads/curator-rpc fecb6db8b -> f55b4554c
Added getChildren
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/f55b4554
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/f55b4554
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/f55b4554
Branch: refs/heads/curator-rpc
Commit: f55b4554c5c154ce6b88a9319e8f8494508f00fb
Parents: fecb6db
Author: randgalt <ra...@apache.org>
Authored: Thu May 29 11:37:33 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 29 11:37:33 2014 -0500
----------------------------------------------------------------------
.../x/rpc/idl/event/OptionalChildrenList.java | 21 +
.../curator/x/rpc/idl/event/OptionalPath.java | 2 +-
.../projection/CuratorProjectionService.java | 24 +
.../x/rpc/idl/projection/GetChildrenSpec.java | 46 +
curator-x-rpc/src/main/thrift/curator.thrift | 11 +
.../apache/curator/generated/CuratorEvent.java | 68 +-
.../curator/generated/CuratorService.java | 959 +++++++++++++++++++
.../curator/generated/GetChildrenSpec.java | 586 +++++++++++
.../curator/generated/OptionalChildrenList.java | 437 +++++++++
.../org/apache/curator/x/rpc/TestClient.java | 5 +
10 files changed, 2124 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/f55b4554/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalChildrenList.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalChildrenList.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalChildrenList.java
new file mode 100644
index 0000000..229c7bc
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalChildrenList.java
@@ -0,0 +1,21 @@
+package org.apache.curator.x.rpc.idl.event;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+import java.util.List;
+
+@ThriftStruct("OptionalChildrenList")
+public class OptionalChildrenList
+{
+ @ThriftField(1)
+ public List<String> children;
+
+ public OptionalChildrenList()
+ {
+ }
+
+ public OptionalChildrenList(List<String> children)
+ {
+ this.children = children;
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/f55b4554/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalPath.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalPath.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalPath.java
index 947dd75..ba17a33 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalPath.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/event/OptionalPath.java
@@ -3,7 +3,7 @@ package org.apache.curator.x.rpc.idl.event;
import com.facebook.swift.codec.ThriftField;
import com.facebook.swift.codec.ThriftStruct;
-@ThriftStruct
+@ThriftStruct("OptionalPath")
public class OptionalPath
{
@ThriftField(1)
http://git-wip-us.apache.org/repos/asf/curator/blob/f55b4554/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 c2a8c94..1daf1e7 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/CuratorProjectionService.java
@@ -31,6 +31,7 @@ import org.apache.curator.x.rpc.connections.ConnectionManager;
import org.apache.curator.x.rpc.connections.CuratorEntry;
import org.apache.curator.x.rpc.details.RpcBackgroundCallback;
import org.apache.curator.x.rpc.details.RpcWatcher;
+import org.apache.curator.x.rpc.idl.event.OptionalChildrenList;
import org.apache.curator.x.rpc.idl.event.OptionalPath;
import org.apache.curator.x.rpc.idl.event.OptionalRpcStat;
import org.apache.curator.x.rpc.idl.event.RpcCuratorEvent;
@@ -38,6 +39,7 @@ import org.apache.curator.x.rpc.idl.event.RpcStat;
import org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
@@ -222,6 +224,28 @@ public class CuratorProjectionService
}
@ThriftMethod
+ public OptionalChildrenList getChildren(CuratorProjection projection, GetChildrenSpec spec) throws Exception
+ {
+ CuratorFramework client = getEntry(projection).getClient();
+
+ Object builder = client.getChildren();
+ if ( spec.watched )
+ {
+ builder = castBuilder(builder, Watchable.class).usingWatcher(new RpcWatcher(this, projection));
+ }
+
+ if ( spec.asyncContext != null )
+ {
+ BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
+ builder = castBuilder(builder, Backgroundable.class).inBackground(backgroundCallback);
+ }
+
+ @SuppressWarnings("unchecked")
+ List<String> children = (List<String>)castBuilder(builder, Pathable.class).forPath(spec.path);
+ return new OptionalChildrenList(children);
+ }
+
+ @ThriftMethod
public boolean closeGenericProjection(CuratorProjection curatorProjection, GenericProjection genericProjection) throws Exception
{
CuratorEntry entry = getEntry(curatorProjection);
http://git-wip-us.apache.org/repos/asf/curator/blob/f55b4554/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/GetChildrenSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/GetChildrenSpec.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/GetChildrenSpec.java
new file mode 100644
index 0000000..fe9e4c1
--- /dev/null
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/projection/GetChildrenSpec.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.curator.x.rpc.idl.projection;
+
+import com.facebook.swift.codec.ThriftField;
+import com.facebook.swift.codec.ThriftStruct;
+
+@ThriftStruct
+public class GetChildrenSpec
+{
+ @ThriftField(1)
+ public String path;
+
+ @ThriftField(2)
+ public boolean watched;
+
+ @ThriftField(3)
+ public String asyncContext;
+
+ public GetChildrenSpec()
+ {
+ }
+
+ public GetChildrenSpec(String path, boolean watched, String asyncContext)
+ {
+ this.path = path;
+ this.watched = watched;
+ this.asyncContext = asyncContext;
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/f55b4554/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 e0e57f6..afcbb08 100644
--- a/curator-x-rpc/src/main/thrift/curator.thrift
+++ b/curator-x-rpc/src/main/thrift/curator.thrift
@@ -43,6 +43,12 @@ struct GenericProjection {
1: string id;
}
+struct GetChildrenSpec {
+ 1: string path;
+ 2: bool watched;
+ 3: string asyncContext;
+}
+
struct GetDataSpec {
1: string path;
2: bool watched;
@@ -54,6 +60,10 @@ struct Version {
1: i32 version;
}
+struct OptionalChildrenList {
+ 1: list<string> children;
+}
+
struct OptionalPath {
1: string path;
}
@@ -129,6 +139,7 @@ service CuratorService {
OptionalPath createNode(1: CuratorProjection projection, 2: CreateSpec spec);
void deleteNode(1: CuratorProjection projection, 2: DeleteSpec spec);
OptionalStat exists(1: CuratorProjection projection, 2: ExistsSpec spec);
+ OptionalChildrenList getChildren(1: CuratorProjection projection, 2: GetChildrenSpec spec);
binary getData(1: CuratorProjection projection, 2: GetDataSpec spec);
CuratorProjection newCuratorProjection(1: string connectionName);
Stat setData(1: CuratorProjection projection, 2: SetDataSpec spec);
http://git-wip-us.apache.org/repos/asf/curator/blob/f55b4554/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 8674d26..54afe6b 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
@@ -1141,13 +1141,13 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
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)
+ org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
+ struct.children = new ArrayList<String>(_list8.size);
+ for (int _i9 = 0; _i9 < _list8.size; ++_i9)
{
- String _elem2;
- _elem2 = iprot.readString();
- struct.children.add(_elem2);
+ String _elem10;
+ _elem10 = iprot.readString();
+ struct.children.add(_elem10);
}
iprot.readListEnd();
}
@@ -1159,14 +1159,14 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
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)
+ org.apache.thrift.protocol.TList _list11 = iprot.readListBegin();
+ struct.aclList = new ArrayList<Acl>(_list11.size);
+ for (int _i12 = 0; _i12 < _list11.size; ++_i12)
{
- Acl _elem5;
- _elem5 = new Acl();
- _elem5.read(iprot);
- struct.aclList.add(_elem5);
+ Acl _elem13;
+ _elem13 = new Acl();
+ _elem13.read(iprot);
+ struct.aclList.add(_elem13);
}
iprot.readListEnd();
}
@@ -1236,9 +1236,9 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
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)
+ for (String _iter14 : struct.children)
{
- oprot.writeString(_iter6);
+ oprot.writeString(_iter14);
}
oprot.writeListEnd();
}
@@ -1248,9 +1248,9 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
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)
+ for (Acl _iter15 : struct.aclList)
{
- _iter7.write(oprot);
+ _iter15.write(oprot);
}
oprot.writeListEnd();
}
@@ -1334,18 +1334,18 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
if (struct.isSetChildren()) {
{
oprot.writeI32(struct.children.size());
- for (String _iter8 : struct.children)
+ for (String _iter16 : struct.children)
{
- oprot.writeString(_iter8);
+ oprot.writeString(_iter16);
}
}
}
if (struct.isSetAclList()) {
{
oprot.writeI32(struct.aclList.size());
- for (Acl _iter9 : struct.aclList)
+ for (Acl _iter17 : struct.aclList)
{
- _iter9.write(oprot);
+ _iter17.write(oprot);
}
}
}
@@ -1389,27 +1389,27 @@ public class CuratorEvent implements org.apache.thrift.TBase<CuratorEvent, Curat
}
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);
- for (int _i11 = 0; _i11 < _list10.size; ++_i11)
+ org.apache.thrift.protocol.TList _list18 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.children = new ArrayList<String>(_list18.size);
+ for (int _i19 = 0; _i19 < _list18.size; ++_i19)
{
- String _elem12;
- _elem12 = iprot.readString();
- struct.children.add(_elem12);
+ String _elem20;
+ _elem20 = iprot.readString();
+ struct.children.add(_elem20);
}
}
struct.setChildrenIsSet(true);
}
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);
- for (int _i14 = 0; _i14 < _list13.size; ++_i14)
+ org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.aclList = new ArrayList<Acl>(_list21.size);
+ for (int _i22 = 0; _i22 < _list21.size; ++_i22)
{
- Acl _elem15;
- _elem15 = new Acl();
- _elem15.read(iprot);
- struct.aclList.add(_elem15);
+ Acl _elem23;
+ _elem23 = new Acl();
+ _elem23.read(iprot);
+ struct.aclList.add(_elem23);
}
}
struct.setAclListIsSet(true);
http://git-wip-us.apache.org/repos/asf/curator/blob/f55b4554/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 c67f8d4..1cf2786 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
@@ -48,6 +48,8 @@ public class CuratorService {
public OptionalStat exists(CuratorProjection projection, ExistsSpec spec) throws org.apache.thrift.TException;
+ public OptionalChildrenList getChildren(CuratorProjection projection, GetChildrenSpec spec) throws org.apache.thrift.TException;
+
public ByteBuffer getData(CuratorProjection projection, GetDataSpec spec) throws org.apache.thrift.TException;
public CuratorProjection newCuratorProjection(String connectionName) throws org.apache.thrift.TException;
@@ -70,6 +72,8 @@ public class CuratorService {
public void exists(CuratorProjection projection, ExistsSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void getChildren(CuratorProjection projection, GetChildrenSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
public void getData(CuratorProjection projection, GetDataSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void newCuratorProjection(String connectionName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
@@ -236,6 +240,30 @@ public class CuratorService {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "exists failed: unknown result");
}
+ public OptionalChildrenList getChildren(CuratorProjection projection, GetChildrenSpec spec) throws org.apache.thrift.TException
+ {
+ send_getChildren(projection, spec);
+ return recv_getChildren();
+ }
+
+ public void send_getChildren(CuratorProjection projection, GetChildrenSpec spec) throws org.apache.thrift.TException
+ {
+ getChildren_args args = new getChildren_args();
+ args.setProjection(projection);
+ args.setSpec(spec);
+ sendBase("getChildren", args);
+ }
+
+ public OptionalChildrenList recv_getChildren() throws org.apache.thrift.TException
+ {
+ getChildren_result result = new getChildren_result();
+ receiveBase(result, "getChildren");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getChildren failed: unknown result");
+ }
+
public ByteBuffer getData(CuratorProjection projection, GetDataSpec spec) throws org.apache.thrift.TException
{
send_getData(projection, spec);
@@ -535,6 +563,41 @@ public class CuratorService {
}
}
+ public void getChildren(CuratorProjection projection, GetChildrenSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ getChildren_call method_call = new getChildren_call(projection, spec, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class getChildren_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private CuratorProjection projection;
+ private GetChildrenSpec spec;
+ public getChildren_call(CuratorProjection projection, GetChildrenSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.projection = projection;
+ this.spec = spec;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getChildren", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ getChildren_args args = new getChildren_args();
+ args.setProjection(projection);
+ args.setSpec(spec);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public OptionalChildrenList 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_getChildren();
+ }
+ }
+
public void getData(CuratorProjection projection, GetDataSpec spec, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
getData_call method_call = new getData_call(projection, spec, resultHandler, this, ___protocolFactory, ___transport);
@@ -656,6 +719,7 @@ public class CuratorService {
processMap.put("createNode", new createNode());
processMap.put("deleteNode", new deleteNode());
processMap.put("exists", new exists());
+ processMap.put("getChildren", new getChildren());
processMap.put("getData", new getData());
processMap.put("newCuratorProjection", new newCuratorProjection());
processMap.put("setData", new setData());
@@ -783,6 +847,26 @@ public class CuratorService {
}
}
+ public static class getChildren<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getChildren_args> {
+ public getChildren() {
+ super("getChildren");
+ }
+
+ public getChildren_args getEmptyArgsInstance() {
+ return new getChildren_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public getChildren_result getResult(I iface, getChildren_args args) throws org.apache.thrift.TException {
+ getChildren_result result = new getChildren_result();
+ result.success = iface.getChildren(args.projection, args.spec);
+ return result;
+ }
+ }
+
public static class getData<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getData_args> {
public getData() {
super("getData");
@@ -862,6 +946,7 @@ public class CuratorService {
processMap.put("createNode", new createNode());
processMap.put("deleteNode", new deleteNode());
processMap.put("exists", new exists());
+ processMap.put("getChildren", new getChildren());
processMap.put("getData", new getData());
processMap.put("newCuratorProjection", new newCuratorProjection());
processMap.put("setData", new setData());
@@ -1173,6 +1258,57 @@ public class CuratorService {
}
}
+ public static class getChildren<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getChildren_args, OptionalChildrenList> {
+ public getChildren() {
+ super("getChildren");
+ }
+
+ public getChildren_args getEmptyArgsInstance() {
+ return new getChildren_args();
+ }
+
+ public AsyncMethodCallback<OptionalChildrenList> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback<OptionalChildrenList>() {
+ public void onComplete(OptionalChildrenList o) {
+ getChildren_result result = new getChildren_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;
+ getChildren_result result = new getChildren_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, getChildren_args args, org.apache.thrift.async.AsyncMethodCallback<OptionalChildrenList> resultHandler) throws TException {
+ iface.getChildren(args.projection, args.spec,resultHandler);
+ }
+ }
+
public static class getData<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getData_args, ByteBuffer> {
public getData() {
super("getData");
@@ -6023,6 +6159,829 @@ public class CuratorService {
}
+ public static class getChildren_args implements org.apache.thrift.TBase<getChildren_args, getChildren_args._Fields>, java.io.Serializable, Cloneable, Comparable<getChildren_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getChildren_args");
+
+ private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+ private static final org.apache.thrift.protocol.TField SPEC_FIELD_DESC = new org.apache.thrift.protocol.TField("spec", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new getChildren_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new getChildren_argsTupleSchemeFactory());
+ }
+
+ public CuratorProjection projection; // required
+ public GetChildrenSpec spec; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROJECTION((short)1, "projection"),
+ SPEC((short)2, "spec");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // PROJECTION
+ return PROJECTION;
+ case 2: // SPEC
+ return SPEC;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
+ tmpMap.put(_Fields.SPEC, new org.apache.thrift.meta_data.FieldMetaData("spec", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, GetChildrenSpec.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getChildren_args.class, metaDataMap);
+ }
+
+ public getChildren_args() {
+ }
+
+ public getChildren_args(
+ CuratorProjection projection,
+ GetChildrenSpec spec)
+ {
+ this();
+ this.projection = projection;
+ this.spec = spec;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public getChildren_args(getChildren_args other) {
+ if (other.isSetProjection()) {
+ this.projection = new CuratorProjection(other.projection);
+ }
+ if (other.isSetSpec()) {
+ this.spec = new GetChildrenSpec(other.spec);
+ }
+ }
+
+ public getChildren_args deepCopy() {
+ return new getChildren_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.projection = null;
+ this.spec = null;
+ }
+
+ public CuratorProjection getProjection() {
+ return this.projection;
+ }
+
+ public getChildren_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 GetChildrenSpec getSpec() {
+ return this.spec;
+ }
+
+ public getChildren_args setSpec(GetChildrenSpec spec) {
+ this.spec = spec;
+ return this;
+ }
+
+ public void unsetSpec() {
+ this.spec = null;
+ }
+
+ /** Returns true if field spec is set (has been assigned a value) and false otherwise */
+ public boolean isSetSpec() {
+ return this.spec != null;
+ }
+
+ public void setSpecIsSet(boolean value) {
+ if (!value) {
+ this.spec = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROJECTION:
+ if (value == null) {
+ unsetProjection();
+ } else {
+ setProjection((CuratorProjection)value);
+ }
+ break;
+
+ case SPEC:
+ if (value == null) {
+ unsetSpec();
+ } else {
+ setSpec((GetChildrenSpec)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROJECTION:
+ return getProjection();
+
+ case SPEC:
+ return getSpec();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case PROJECTION:
+ return isSetProjection();
+ case SPEC:
+ return isSetSpec();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof getChildren_args)
+ return this.equals((getChildren_args)that);
+ return false;
+ }
+
+ public boolean equals(getChildren_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_projection = true && this.isSetProjection();
+ boolean that_present_projection = true && that.isSetProjection();
+ if (this_present_projection || that_present_projection) {
+ if (!(this_present_projection && that_present_projection))
+ return false;
+ if (!this.projection.equals(that.projection))
+ return false;
+ }
+
+ boolean this_present_spec = true && this.isSetSpec();
+ boolean that_present_spec = true && that.isSetSpec();
+ if (this_present_spec || that_present_spec) {
+ if (!(this_present_spec && that_present_spec))
+ return false;
+ if (!this.spec.equals(that.spec))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(getChildren_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProjection()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetSpec()).compareTo(other.isSetSpec());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSpec()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.spec, other.spec);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getChildren_args(");
+ boolean first = true;
+
+ sb.append("projection:");
+ if (this.projection == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.projection);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("spec:");
+ if (this.spec == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.spec);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (projection != null) {
+ projection.validate();
+ }
+ if (spec != null) {
+ spec.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class getChildren_argsStandardSchemeFactory implements SchemeFactory {
+ public getChildren_argsStandardScheme getScheme() {
+ return new getChildren_argsStandardScheme();
+ }
+ }
+
+ private static class getChildren_argsStandardScheme extends StandardScheme<getChildren_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, getChildren_args struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // PROJECTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.projection = new CuratorProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // SPEC
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.spec = new GetChildrenSpec();
+ struct.spec.read(iprot);
+ struct.setSpecIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, getChildren_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.projection != null) {
+ oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
+ struct.projection.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.spec != null) {
+ oprot.writeFieldBegin(SPEC_FIELD_DESC);
+ struct.spec.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class getChildren_argsTupleSchemeFactory implements SchemeFactory {
+ public getChildren_argsTupleScheme getScheme() {
+ return new getChildren_argsTupleScheme();
+ }
+ }
+
+ private static class getChildren_argsTupleScheme extends TupleScheme<getChildren_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, getChildren_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetProjection()) {
+ optionals.set(0);
+ }
+ if (struct.isSetSpec()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetProjection()) {
+ struct.projection.write(oprot);
+ }
+ if (struct.isSetSpec()) {
+ struct.spec.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, getChildren_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.projection = new CuratorProjection();
+ struct.projection.read(iprot);
+ struct.setProjectionIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.spec = new GetChildrenSpec();
+ struct.spec.read(iprot);
+ struct.setSpecIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class getChildren_result implements org.apache.thrift.TBase<getChildren_result, getChildren_result._Fields>, java.io.Serializable, Cloneable, Comparable<getChildren_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getChildren_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 getChildren_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new getChildren_resultTupleSchemeFactory());
+ }
+
+ public OptionalChildrenList 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, OptionalChildrenList.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getChildren_result.class, metaDataMap);
+ }
+
+ public getChildren_result() {
+ }
+
+ public getChildren_result(
+ OptionalChildrenList success)
+ {
+ this();
+ this.success = success;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public getChildren_result(getChildren_result other) {
+ if (other.isSetSuccess()) {
+ this.success = new OptionalChildrenList(other.success);
+ }
+ }
+
+ public getChildren_result deepCopy() {
+ return new getChildren_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ }
+
+ public OptionalChildrenList getSuccess() {
+ return this.success;
+ }
+
+ public getChildren_result setSuccess(OptionalChildrenList 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((OptionalChildrenList)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 getChildren_result)
+ return this.equals((getChildren_result)that);
+ return false;
+ }
+
+ public boolean equals(getChildren_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(getChildren_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("getChildren_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 getChildren_resultStandardSchemeFactory implements SchemeFactory {
+ public getChildren_resultStandardScheme getScheme() {
+ return new getChildren_resultStandardScheme();
+ }
+ }
+
+ private static class getChildren_resultStandardScheme extends StandardScheme<getChildren_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, getChildren_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 OptionalChildrenList();
+ 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, getChildren_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 getChildren_resultTupleSchemeFactory implements SchemeFactory {
+ public getChildren_resultTupleScheme getScheme() {
+ return new getChildren_resultTupleScheme();
+ }
+ }
+
+ private static class getChildren_resultTupleScheme extends TupleScheme<getChildren_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, getChildren_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, getChildren_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.success = new OptionalChildrenList();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
+ }
+
public static class getData_args implements org.apache.thrift.TBase<getData_args, getData_args._Fields>, java.io.Serializable, Cloneable, Comparable<getData_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getData_args");
http://git-wip-us.apache.org/repos/asf/curator/blob/f55b4554/curator-x-rpc/src/test/java/org/apache/curator/generated/GetChildrenSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/GetChildrenSpec.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/GetChildrenSpec.java
new file mode 100644
index 0000000..7282982
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/GetChildrenSpec.java
@@ -0,0 +1,586 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.curator.generated;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GetChildrenSpec implements org.apache.thrift.TBase<GetChildrenSpec, GetChildrenSpec._Fields>, java.io.Serializable, Cloneable, Comparable<GetChildrenSpec> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GetChildrenSpec");
+
+ private static final org.apache.thrift.protocol.TField PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("path", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField WATCHED_FIELD_DESC = new org.apache.thrift.protocol.TField("watched", org.apache.thrift.protocol.TType.BOOL, (short)2);
+ private static final org.apache.thrift.protocol.TField ASYNC_CONTEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("asyncContext", org.apache.thrift.protocol.TType.STRING, (short)3);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new GetChildrenSpecStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new GetChildrenSpecTupleSchemeFactory());
+ }
+
+ public String path; // required
+ public boolean watched; // required
+ public String asyncContext; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PATH((short)1, "path"),
+ WATCHED((short)2, "watched"),
+ ASYNC_CONTEXT((short)3, "asyncContext");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // PATH
+ return PATH;
+ case 2: // WATCHED
+ return WATCHED;
+ case 3: // ASYNC_CONTEXT
+ return ASYNC_CONTEXT;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __WATCHED_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.PATH, new org.apache.thrift.meta_data.FieldMetaData("path", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.WATCHED, new org.apache.thrift.meta_data.FieldMetaData("watched", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ tmpMap.put(_Fields.ASYNC_CONTEXT, new org.apache.thrift.meta_data.FieldMetaData("asyncContext", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GetChildrenSpec.class, metaDataMap);
+ }
+
+ public GetChildrenSpec() {
+ }
+
+ public GetChildrenSpec(
+ String path,
+ boolean watched,
+ String asyncContext)
+ {
+ this();
+ this.path = path;
+ this.watched = watched;
+ setWatchedIsSet(true);
+ this.asyncContext = asyncContext;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public GetChildrenSpec(GetChildrenSpec other) {
+ __isset_bitfield = other.__isset_bitfield;
+ if (other.isSetPath()) {
+ this.path = other.path;
+ }
+ this.watched = other.watched;
+ if (other.isSetAsyncContext()) {
+ this.asyncContext = other.asyncContext;
+ }
+ }
+
+ public GetChildrenSpec deepCopy() {
+ return new GetChildrenSpec(this);
+ }
+
+ @Override
+ public void clear() {
+ this.path = null;
+ setWatchedIsSet(false);
+ this.watched = false;
+ this.asyncContext = null;
+ }
+
+ public String getPath() {
+ return this.path;
+ }
+
+ public GetChildrenSpec setPath(String path) {
+ this.path = path;
+ return this;
+ }
+
+ public void unsetPath() {
+ this.path = null;
+ }
+
+ /** Returns true if field path is set (has been assigned a value) and false otherwise */
+ public boolean isSetPath() {
+ return this.path != null;
+ }
+
+ public void setPathIsSet(boolean value) {
+ if (!value) {
+ this.path = null;
+ }
+ }
+
+ public boolean isWatched() {
+ return this.watched;
+ }
+
+ public GetChildrenSpec setWatched(boolean watched) {
+ this.watched = watched;
+ setWatchedIsSet(true);
+ return this;
+ }
+
+ public void unsetWatched() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WATCHED_ISSET_ID);
+ }
+
+ /** Returns true if field watched is set (has been assigned a value) and false otherwise */
+ public boolean isSetWatched() {
+ return EncodingUtils.testBit(__isset_bitfield, __WATCHED_ISSET_ID);
+ }
+
+ public void setWatchedIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WATCHED_ISSET_ID, value);
+ }
+
+ public String getAsyncContext() {
+ return this.asyncContext;
+ }
+
+ public GetChildrenSpec setAsyncContext(String asyncContext) {
+ this.asyncContext = asyncContext;
+ return this;
+ }
+
+ public void unsetAsyncContext() {
+ this.asyncContext = null;
+ }
+
+ /** Returns true if field asyncContext is set (has been assigned a value) and false otherwise */
+ public boolean isSetAsyncContext() {
+ return this.asyncContext != null;
+ }
+
+ public void setAsyncContextIsSet(boolean value) {
+ if (!value) {
+ this.asyncContext = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PATH:
+ if (value == null) {
+ unsetPath();
+ } else {
+ setPath((String)value);
+ }
+ break;
+
+ case WATCHED:
+ if (value == null) {
+ unsetWatched();
+ } else {
+ setWatched((Boolean)value);
+ }
+ break;
+
+ case ASYNC_CONTEXT:
+ if (value == null) {
+ unsetAsyncContext();
+ } else {
+ setAsyncContext((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PATH:
+ return getPath();
+
+ case WATCHED:
+ return Boolean.valueOf(isWatched());
+
+ case ASYNC_CONTEXT:
+ return getAsyncContext();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case PATH:
+ return isSetPath();
+ case WATCHED:
+ return isSetWatched();
+ case ASYNC_CONTEXT:
+ return isSetAsyncContext();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof GetChildrenSpec)
+ return this.equals((GetChildrenSpec)that);
+ return false;
+ }
+
+ public boolean equals(GetChildrenSpec that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_path = true && this.isSetPath();
+ boolean that_present_path = true && that.isSetPath();
+ if (this_present_path || that_present_path) {
+ if (!(this_present_path && that_present_path))
+ return false;
+ if (!this.path.equals(that.path))
+ return false;
+ }
+
+ boolean this_present_watched = true;
+ boolean that_present_watched = true;
+ if (this_present_watched || that_present_watched) {
+ if (!(this_present_watched && that_present_watched))
+ return false;
+ if (this.watched != that.watched)
+ return false;
+ }
+
+ boolean this_present_asyncContext = true && this.isSetAsyncContext();
+ boolean that_present_asyncContext = true && that.isSetAsyncContext();
+ if (this_present_asyncContext || that_present_asyncContext) {
+ if (!(this_present_asyncContext && that_present_asyncContext))
+ return false;
+ if (!this.asyncContext.equals(that.asyncContext))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(GetChildrenSpec other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetPath()).compareTo(other.isSetPath());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPath()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.path, other.path);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetWatched()).compareTo(other.isSetWatched());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetWatched()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.watched, other.watched);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAsyncContext()).compareTo(other.isSetAsyncContext());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAsyncContext()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.asyncContext, other.asyncContext);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("GetChildrenSpec(");
+ boolean first = true;
+
+ sb.append("path:");
+ if (this.path == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.path);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("watched:");
+ sb.append(this.watched);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("asyncContext:");
+ if (this.asyncContext == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.asyncContext);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bitfield = 0;
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class GetChildrenSpecStandardSchemeFactory implements SchemeFactory {
+ public GetChildrenSpecStandardScheme getScheme() {
+ return new GetChildrenSpecStandardScheme();
+ }
+ }
+
+ private static class GetChildrenSpecStandardScheme extends StandardScheme<GetChildrenSpec> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, GetChildrenSpec struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // PATH
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.path = iprot.readString();
+ struct.setPathIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // WATCHED
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.watched = iprot.readBool();
+ struct.setWatchedIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // ASYNC_CONTEXT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.asyncContext = iprot.readString();
+ struct.setAsyncContextIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, GetChildrenSpec struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.path != null) {
+ oprot.writeFieldBegin(PATH_FIELD_DESC);
+ oprot.writeString(struct.path);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(WATCHED_FIELD_DESC);
+ oprot.writeBool(struct.watched);
+ oprot.writeFieldEnd();
+ if (struct.asyncContext != null) {
+ oprot.writeFieldBegin(ASYNC_CONTEXT_FIELD_DESC);
+ oprot.writeString(struct.asyncContext);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class GetChildrenSpecTupleSchemeFactory implements SchemeFactory {
+ public GetChildrenSpecTupleScheme getScheme() {
+ return new GetChildrenSpecTupleScheme();
+ }
+ }
+
+ private static class GetChildrenSpecTupleScheme extends TupleScheme<GetChildrenSpec> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, GetChildrenSpec struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetPath()) {
+ optionals.set(0);
+ }
+ if (struct.isSetWatched()) {
+ optionals.set(1);
+ }
+ if (struct.isSetAsyncContext()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetPath()) {
+ oprot.writeString(struct.path);
+ }
+ if (struct.isSetWatched()) {
+ oprot.writeBool(struct.watched);
+ }
+ if (struct.isSetAsyncContext()) {
+ oprot.writeString(struct.asyncContext);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, GetChildrenSpec struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct.path = iprot.readString();
+ struct.setPathIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.watched = iprot.readBool();
+ struct.setWatchedIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.asyncContext = iprot.readString();
+ struct.setAsyncContextIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/curator/blob/f55b4554/curator-x-rpc/src/test/java/org/apache/curator/generated/OptionalChildrenList.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/generated/OptionalChildrenList.java b/curator-x-rpc/src/test/java/org/apache/curator/generated/OptionalChildrenList.java
new file mode 100644
index 0000000..e052215
--- /dev/null
+++ b/curator-x-rpc/src/test/java/org/apache/curator/generated/OptionalChildrenList.java
@@ -0,0 +1,437 @@
+/**
+ * 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 OptionalChildrenList implements org.apache.thrift.TBase<OptionalChildrenList, OptionalChildrenList._Fields>, java.io.Serializable, Cloneable, Comparable<OptionalChildrenList> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("OptionalChildrenList");
+
+ 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)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new OptionalChildrenListStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new OptionalChildrenListTupleSchemeFactory());
+ }
+
+ public List<String> children; // 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 {
+ CHILDREN((short)1, "children");
+
+ 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: // CHILDREN
+ return CHILDREN;
+ 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.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))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(OptionalChildrenList.class, metaDataMap);
+ }
+
+ public OptionalChildrenList() {
+ }
+
+ public OptionalChildrenList(
+ List<String> children)
+ {
+ this();
+ this.children = children;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public OptionalChildrenList(OptionalChildrenList other) {
+ if (other.isSetChildren()) {
+ List<String> __this__children = new ArrayList<String>(other.children);
+ this.children = __this__children;
+ }
+ }
+
+ public OptionalChildrenList deepCopy() {
+ return new OptionalChildrenList(this);
+ }
+
+ @Override
+ public void clear() {
+ this.children = 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 OptionalChildrenList 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 void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case CHILDREN:
+ if (value == null) {
+ unsetChildren();
+ } else {
+ setChildren((List<String>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case CHILDREN:
+ return getChildren();
+
+ }
+ 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 CHILDREN:
+ return isSetChildren();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof OptionalChildrenList)
+ return this.equals((OptionalChildrenList)that);
+ return false;
+ }
+
+ public boolean equals(OptionalChildrenList that) {
+ if (that == null)
+ 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;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(OptionalChildrenList other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ 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;
+ }
+ }
+ 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("OptionalChildrenList(");
+ boolean first = true;
+
+ sb.append("children:");
+ if (this.children == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.children);
+ }
+ 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 OptionalChildrenListStandardSchemeFactory implements SchemeFactory {
+ public OptionalChildrenListStandardScheme getScheme() {
+ return new OptionalChildrenListStandardScheme();
+ }
+ }
+
+ private static class OptionalChildrenListStandardScheme extends StandardScheme<OptionalChildrenList> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, OptionalChildrenList 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: // 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;
+ 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, OptionalChildrenList struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ 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 _iter3 : struct.children)
+ {
+ oprot.writeString(_iter3);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class OptionalChildrenListTupleSchemeFactory implements SchemeFactory {
+ public OptionalChildrenListTupleScheme getScheme() {
+ return new OptionalChildrenListTupleScheme();
+ }
+ }
+
+ private static class OptionalChildrenListTupleScheme extends TupleScheme<OptionalChildrenList> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, OptionalChildrenList struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetChildren()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetChildren()) {
+ {
+ oprot.writeI32(struct.children.size());
+ for (String _iter4 : struct.children)
+ {
+ oprot.writeString(_iter4);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, OptionalChildrenList struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.children = new ArrayList<String>(_list5.size);
+ for (int _i6 = 0; _i6 < _list5.size; ++_i6)
+ {
+ String _elem7;
+ _elem7 = iprot.readString();
+ struct.children.add(_elem7);
+ }
+ }
+ struct.setChildrenIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/curator/blob/f55b4554/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 a9b3b86..11b2f7d 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
@@ -77,6 +77,11 @@ public class TestClient
OptionalPath path = client.createNode(curatorProjection, createSpec);
System.out.println("Path: " + path);
+ GetChildrenSpec getChildrenSpec = new GetChildrenSpec();
+ getChildrenSpec.path = "/a";
+ OptionalChildrenList children = client.getChildren(curatorProjection, getChildrenSpec);
+ System.out.println("Children: " + children);
+
GenericProjection lockId = client.acquireLock(curatorProjection, "/mylock", 1000);
client.closeGenericProjection(curatorProjection, lockId);