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/03/22 14:35:23 UTC
[08/10] 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/710d78d4
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/710d78d4
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/710d78d4
Branch: refs/heads/CURATOR-88
Commit: 710d78d48ad8ef9b7f954b2c407aaf9957d0f037
Parents: 656ecde
Author: randgalt <ra...@apache.org>
Authored: Wed Mar 12 12:39:02 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Wed Mar 12 12:39:02 2014 -0500
----------------------------------------------------------------------
.../curator/x/rest/api/ClientResource.java | 8 +--
.../x/rest/api/PathChildrenCacheResource.java | 5 --
.../org/apache/curator/x/rest/api/Session.java | 1 -
.../x/rest/dropwizard/CuratorRestBundle.java | 1 -
.../curator/x/rest/entities/DataAndStat.java | 62 ++++++++++++++++++++
.../curator/x/rest/entities/NodeCacheSpec.java | 1 -
.../x/rest/entities/OptionalNodeData.java | 1 -
.../src/site/confluence/entities.confluence | 8 +--
8 files changed, 68 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/710d78d4/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ClientResource.java
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ClientResource.java b/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ClientResource.java
index 639d865..6d1ad82 100644
--- a/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ClientResource.java
+++ b/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ClientResource.java
@@ -24,6 +24,7 @@ import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.api.*;
import org.apache.curator.x.rest.CuratorRestContext;
import org.apache.curator.x.rest.entities.CreateSpec;
+import org.apache.curator.x.rest.entities.DataAndStat;
import org.apache.curator.x.rest.entities.DeleteSpec;
import org.apache.curator.x.rest.entities.ExistsSpec;
import org.apache.curator.x.rest.entities.GetChildrenSpec;
@@ -33,7 +34,6 @@ import org.apache.curator.x.rest.entities.SetDataSpec;
import org.apache.curator.x.rest.entities.Status;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.data.Stat;
-import org.codehaus.jackson.node.ObjectNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.Consumes;
@@ -282,11 +282,7 @@ public class ClientResource
{
result = new String((byte[])bytes);
}
-
- ObjectNode node = context.getMapper().createObjectNode();
- node.put("data", result);
- node.putPOJO("stat", stat);
- return Response.ok(context.getWriter().writeValueAsString(node)).build();
+ return Response.ok(new DataAndStat(result, stat)).build();
}
@POST
http://git-wip-us.apache.org/repos/asf/curator/blob/710d78d4/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/PathChildrenCacheResource.java
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/PathChildrenCacheResource.java b/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/PathChildrenCacheResource.java
index 771eb93..f383caf 100644
--- a/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/PathChildrenCacheResource.java
+++ b/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/PathChildrenCacheResource.java
@@ -128,11 +128,6 @@ public class PathChildrenCacheResource
{
PathChildrenCache cache = Constants.getThing(context.getSession(), cacheId, PathChildrenCache.class);
ChildData currentData = cache.getCurrentData("/" + path);
- if ( currentData == null )
- {
- return Response.status(Response.Status.NOT_FOUND).build();
- }
-
return Response.ok(Constants.toNodeData(currentData)).build();
}
}
http://git-wip-us.apache.org/repos/asf/curator/blob/710d78d4/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/Session.java
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/Session.java b/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/Session.java
index cbc2211..4640a44 100644
--- a/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/Session.java
+++ b/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/Session.java
@@ -25,7 +25,6 @@ import org.apache.curator.x.rest.entities.StatusMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Closeable;
-import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
http://git-wip-us.apache.org/repos/asf/curator/blob/710d78d4/curator-x-rest/src/main/java/org/apache/curator/x/rest/dropwizard/CuratorRestBundle.java
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/main/java/org/apache/curator/x/rest/dropwizard/CuratorRestBundle.java b/curator-x-rest/src/main/java/org/apache/curator/x/rest/dropwizard/CuratorRestBundle.java
index 80f3e23..6d56d61 100644
--- a/curator-x-rest/src/main/java/org/apache/curator/x/rest/dropwizard/CuratorRestBundle.java
+++ b/curator-x-rest/src/main/java/org/apache/curator/x/rest/dropwizard/CuratorRestBundle.java
@@ -19,7 +19,6 @@
package org.apache.curator.x.rest.dropwizard;
-import com.google.common.annotations.VisibleForTesting;
import com.sun.jersey.spi.inject.SingletonTypeInjectableProvider;
import io.dropwizard.ConfiguredBundle;
import io.dropwizard.setup.Bootstrap;
http://git-wip-us.apache.org/repos/asf/curator/blob/710d78d4/curator-x-rest/src/main/java/org/apache/curator/x/rest/entities/DataAndStat.java
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/main/java/org/apache/curator/x/rest/entities/DataAndStat.java b/curator-x-rest/src/main/java/org/apache/curator/x/rest/entities/DataAndStat.java
new file mode 100644
index 0000000..63d2224
--- /dev/null
+++ b/curator-x-rest/src/main/java/org/apache/curator/x/rest/entities/DataAndStat.java
@@ -0,0 +1,62 @@
+/**
+ * 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.rest.entities;
+
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.data.Stat;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class DataAndStat
+{
+ private String data;
+ private Stat stat;
+
+ public DataAndStat()
+ {
+ this("", new Stat());
+ }
+
+ public DataAndStat(String data, Stat stat)
+ {
+ this.data = data;
+ this.stat = stat;
+ }
+
+ public String getData()
+ {
+ return data;
+ }
+
+ public void setData(String data)
+ {
+ this.data = data;
+ }
+
+ public Stat getStat()
+ {
+ return stat;
+ }
+
+ public void setStat(Stat stat)
+ {
+ this.stat = stat;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/curator/blob/710d78d4/curator-x-rest/src/main/java/org/apache/curator/x/rest/entities/NodeCacheSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/main/java/org/apache/curator/x/rest/entities/NodeCacheSpec.java b/curator-x-rest/src/main/java/org/apache/curator/x/rest/entities/NodeCacheSpec.java
index 07c197f..61f4bb6 100644
--- a/curator-x-rest/src/main/java/org/apache/curator/x/rest/entities/NodeCacheSpec.java
+++ b/curator-x-rest/src/main/java/org/apache/curator/x/rest/entities/NodeCacheSpec.java
@@ -18,7 +18,6 @@
*/
package org.apache.curator.x.rest.entities;
-import org.apache.curator.framework.recipes.cache.PathChildrenCache;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
http://git-wip-us.apache.org/repos/asf/curator/blob/710d78d4/curator-x-rest/src/main/java/org/apache/curator/x/rest/entities/OptionalNodeData.java
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/main/java/org/apache/curator/x/rest/entities/OptionalNodeData.java b/curator-x-rest/src/main/java/org/apache/curator/x/rest/entities/OptionalNodeData.java
index 398308c..b3eb335 100644
--- a/curator-x-rest/src/main/java/org/apache/curator/x/rest/entities/OptionalNodeData.java
+++ b/curator-x-rest/src/main/java/org/apache/curator/x/rest/entities/OptionalNodeData.java
@@ -19,7 +19,6 @@
package org.apache.curator.x.rest.entities;
-import org.apache.zookeeper.data.Stat;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
http://git-wip-us.apache.org/repos/asf/curator/blob/710d78d4/curator-x-rest/src/site/confluence/entities.confluence
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/site/confluence/entities.confluence b/curator-x-rest/src/site/confluence/entities.confluence
index b6624c7..31be87f 100644
--- a/curator-x-rest/src/site/confluence/entities.confluence
+++ b/curator-x-rest/src/site/confluence/entities.confluence
@@ -5,17 +5,17 @@ h1. Entity Descriptions
Here are the entity descriptions for the entities used in the APIs:
||Field||Type||Description||
-|*Status*| | |
+| *Status*| | |
|state|string|This instance's Curator connection state. One of: "connected", "suspended", or "lost". If the state is other than "connected" you must assume that any open locks and/or watchers are no longer valid.|
|messages|array of StatusMessage|Any pending messages from this instance.|
| | | |
-|*StatusMessage*| | |
+| *StatusMessage*| | |
|type|string|The status message type. See the [[Managing Status|client.html]] section for details.|
|message|string|Type-dependent message|
|details|string|Type-dependent details|
|sourceId|string|Type-dependent sourceId|
| | | |
-|*GetChildrenSpec*| | |
+| *GetChildrenSpec*| | |
|path|string|The ZK path|
|async|boolean|If true, perform asynchronously|
|asyncId|string|for async, a user-defined ID to return in the status message|
@@ -23,7 +23,7 @@ Here are the entity descriptions for the entities used in the APIs:
|watched|boolean|if true, set a watch|
|watchId|string|if watched, a user-defined ID to return in the status when the watch triggers|
| | | |
-|*CreateSpec*| | |
+| *CreateSpec*| | |
|path|string|The ZK path|
|data|string|The data to store in the node|
|mode|string|The create mode. One of: "persistent", "persistent\_sequential", "ephemeral", or "ephemeral\_sequential"|