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 2016/05/19 19:02:24 UTC

[09/35] curator git commit: more doc

more doc


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

Branch: refs/heads/CURATOR-3.0
Commit: 8ccfdebddfd9ce3d23d35f9ae94d5be77fa538a8
Parents: f83c8ef
Author: randgalt <ra...@apache.org>
Authored: Mon May 2 17:09:40 2016 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon May 2 17:09:40 2016 -0500

----------------------------------------------------------------------
 .../apache/curator/framework/schema/Schema.java | 39 +++++++++++++++++++-
 1 file changed, 37 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/8ccfdebd/curator-framework/src/main/java/org/apache/curator/framework/schema/Schema.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/schema/Schema.java b/curator-framework/src/main/java/org/apache/curator/framework/schema/Schema.java
index 16d335a..7cb9d76 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/schema/Schema.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/schema/Schema.java
@@ -61,6 +61,11 @@ public class Schema
         this.canBeDeleted = canBeDeleted;
     }
 
+    /**
+     * Validate that this schema allows znode deletion
+     *
+     * @throws SchemaViolation if schema does not allow znode deletion
+     */
     public void validateDeletion()
     {
         if ( !canBeDeleted )
@@ -69,6 +74,12 @@ public class Schema
         }
     }
 
+    /**
+     * Validate that this schema's watching setting matches
+     *
+     * @param isWatching true if attempt is being made to watch node
+     * @throws SchemaViolation if schema's watching setting does not match
+     */
     public void validateWatcher(boolean isWatching)
     {
         if ( isWatching && (watched == Allowance.CANNOT) )
@@ -82,6 +93,13 @@ public class Schema
         }
     }
 
+    /**
+     * Validate that this schema's create mode setting matches and that the data is valid
+     *
+     * @param mode CreateMode being used
+     * @param data data being set
+     * @throws SchemaViolation if schema's create mode setting does not match or data is invalid
+     */
     public void validateCreate(CreateMode mode, byte[] data)
     {
         if ( mode.isEphemeral() && (ephemeral == Allowance.CANNOT) )
@@ -107,6 +125,12 @@ public class Schema
         validateData(data);
     }
 
+    /**
+     * Validate that this schema validates the data
+     *
+     * @param data data being set
+     * @throws SchemaViolation if data is invalid
+     */
     public void validateData(byte[] data)
     {
         if ( !dataValidator.isValid(data) )
@@ -115,12 +139,23 @@ public class Schema
         }
     }
 
-    public Pattern getPathRegex()
+    /**
+     * Return the raw path for this schema. If a full path was used, it is returned.
+     * If a regex was used, it is returned
+     *
+     * @return path
+     */
+    public String getRawPath()
+    {
+        return (path != null) ? path : pathRegex.pattern();
+    }
+
+    Pattern getPathRegex()
     {
         return pathRegex;
     }
 
-    public String getPath()
+    String getPath()
     {
         return path;
     }