Repository: curator Updated Branches: refs/heads/CURATOR-397 3338c05c9 -> 7a15af6ac
updated doc for new auto-resolve behavior Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/bb36c48e Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/bb36c48e Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/bb36c48e Branch: refs/heads/CURATOR-397 Commit: bb36c48ef420d48e345368d03e4696f22d394126 Parents: 3338c05 Author: randgalt <[email protected]> Authored: Thu May 11 16:53:30 2017 +0200 Committer: randgalt <[email protected]> Committed: Thu May 11 16:53:30 2017 +0200 ---------------------------------------------------------------------- .../confluence/modeled-components.confluence | 34 ++++++++++++++++++++ 1 file changed, 34 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/bb36c48e/curator-x-async/src/site/confluence/modeled-components.confluence ---------------------------------------------------------------------- diff --git a/curator-x-async/src/site/confluence/modeled-components.confluence b/curator-x-async/src/site/confluence/modeled-components.confluence index 280f006..62bcdeb 100644 --- a/curator-x-async/src/site/confluence/modeled-components.confluence +++ b/curator-x-async/src/site/confluence/modeled-components.confluence @@ -35,6 +35,21 @@ Parameters are resolved by calling {{toString()}} on the parameter. You can use to change this behavior. If a parameter implements {{NodeName}} the {{nodeName()}} method is used as the parameter value. +h3. Partial Resolution + +Note: ZPaths can be partially resolved. E.g. + +{code} +ZPath path = ZPath.parseWithIds("/foo/{type}/bar/{id}"); + +... + +ZPath partial = path.resolve("standard"); +// partial is now "/foo/standard/bar/{id}" +{code} + +ModeledFramework takes advantage of this. [[See below|#ModeledFramework]] for details. + h2. ModelSpec A {{ModelSpec}} contains all the metadata needed to operate on a ZooKeeper path: @@ -144,6 +159,25 @@ client.getData().forPath(path).whenComplete((data, e) -> { }); {code} +h3. Partially Resolved ZPaths and Set/Update + +ModeledFramework's various {{set}} and {{update}} methods check for unresolved ZPaths. If the current +modelSpec has an unresolved ZPath when set/update is called, it is automatically resolved using the model +instance being set/updated. E.g. + +{code} +ZPath path = ZPath.parseWithIds("/root/{type}/instance/{id}"); +ModelSpec<MyModel> modelSpec = ModelSpec.builder(path, serializer); +ModeledFramework<MyModel> modeledClient = ModeledFramework.wrap(modelSpec, client, modelSpec); + +... + +String currentType = ... +MyModel model = ... +modeledClient.resolved(currentType).set(model); // internally, ModeledFramework calls ZPath.resolved() + // using "model" as the argument to get the actual ZPath +{code} + h2. Caching and Typed Parameters In addition to the above features, Modeled Curator supports [[Integrated Caching|modeled-typed.html]],
