Return-Path: X-Original-To: apmail-curator-commits-archive@minotaur.apache.org Delivered-To: apmail-curator-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8A3281042D for ; Tue, 27 May 2014 13:57:24 +0000 (UTC) Received: (qmail 82371 invoked by uid 500); 27 May 2014 13:57:24 -0000 Delivered-To: apmail-curator-commits-archive@curator.apache.org Received: (qmail 82306 invoked by uid 500); 27 May 2014 13:57:24 -0000 Mailing-List: contact commits-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.apache.org Delivered-To: mailing list commits@curator.apache.org Received: (qmail 82179 invoked by uid 99); 27 May 2014 13:57:24 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 May 2014 13:57:24 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 111AF9A6CCD; Tue, 27 May 2014 13:57:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: randgalt@apache.org To: commits@curator.apache.org Date: Tue, 27 May 2014 13:57:31 -0000 Message-Id: <26bb368e9c9d4d5ab1d449f908b805d5@git.apache.org> In-Reply-To: <3ddc2c06d3ce4890b4f4e630be244460@git.apache.org> References: <3ddc2c06d3ce4890b4f4e630be244460@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [09/14] git commit: wip 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 Authored: Mon May 26 02:53:40 2014 -0500 Committer: randgalt 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 children; + + @ThriftField(10) + public List 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 toRpcAclList(List aclList) { - return event.getPath(); - } - - @ThriftField(9) - public List getChildren() - { - return event.getChildren(); - } - - @ThriftField(10) - public List getACLList() - { - List 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 " @@ -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 children; - 10: list aCLList; + 10: list 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, java.io.Serializable, Cloneable, Comparable { + 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, SchemeFactory> schemes = new HashMap, 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 byName = new HashMap(); + + 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 other. + */ + 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 { + + 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 { + + @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; + } + } +}