Class Schema
- java.lang.Object
-
- org.apache.curator.framework.schema.Schema
-
public class Schema extends java.lang.ObjectRepresents and documents operations allowed for a given path pattern
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSchema.Allowance
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SchemaBuilderbuilder(java.lang.String path)Start a builder for the given full path.static SchemaBuilderbuilder(java.util.regex.Pattern pathRegex)Start a builder for the given path pattern.static SchemaBuilderbuilderForRecipe(java.lang.String parentPath)Start a schema builder for a typical Curator recipe's childrenstatic SchemaBuilderbuilderForRecipeParent(java.lang.String parentPath)Start a schema builder for a typical Curator recipe's parent nodebooleancanBeDeleted()booleanequals(java.lang.Object o)java.lang.StringgetDocumentation()Schema.AllowancegetEphemeral()java.util.Map<java.lang.String,java.lang.String>getMetadata()java.lang.StringgetName()java.lang.StringgetPath()java.util.regex.PatterngetPathRegex()java.lang.StringgetRawPath()Return the raw path for this schema.SchemaValidatorgetSchemaValidator()Schema.AllowancegetSequential()Schema.AllowancegetWatched()inthashCode()java.lang.StringtoDocumentation()java.lang.StringtoString()voidvalidateCreate(org.apache.zookeeper.CreateMode mode, java.lang.String path, byte[] data, java.util.List<org.apache.zookeeper.data.ACL> acl)Validate that this schema's create mode setting matches and that the data is validvoidvalidateDelete(java.lang.String path)Validate that this schema allows znode deletionvoidvalidateGeneral(java.lang.String path, byte[] data, java.util.List<org.apache.zookeeper.data.ACL> acl)Validate that this schema validates the datavoidvalidateWatch(java.lang.String path, boolean isWatching)Validate that this schema's watching setting matches
-
-
-
Method Detail
-
builder
public static SchemaBuilder builder(java.lang.String path)
Start a builder for the given full path. Note: full path schemas take precedence over regex path schemas.- Parameters:
path- full ZNode path. This schema only applies to an exact match- Returns:
- builder
-
builder
public static SchemaBuilder builder(java.util.regex.Pattern pathRegex)
Start a builder for the given path pattern.- Parameters:
pathRegex- regex for the path. This schema applies to any matching paths- Returns:
- builder
-
builderForRecipeParent
public static SchemaBuilder builderForRecipeParent(java.lang.String parentPath)
Start a schema builder for a typical Curator recipe's parent node- Parameters:
parentPath- Path to the parent node- Returns:
- builder
-
builderForRecipe
public static SchemaBuilder builderForRecipe(java.lang.String parentPath)
Start a schema builder for a typical Curator recipe's children- Parameters:
parentPath- Path to the parent node- Returns:
- builder
-
validateDelete
public void validateDelete(java.lang.String path)
Validate that this schema allows znode deletion- Parameters:
path- the znode full path- Throws:
SchemaViolation- if schema does not allow znode deletion
-
validateWatch
public void validateWatch(java.lang.String path, boolean isWatching)Validate that this schema's watching setting matches- Parameters:
path- the znode full pathisWatching- true if attempt is being made to watch node- Throws:
SchemaViolation- if schema's watching setting does not match
-
validateCreate
public void validateCreate(org.apache.zookeeper.CreateMode mode, java.lang.String path, byte[] data, java.util.List<org.apache.zookeeper.data.ACL> acl)Validate that this schema's create mode setting matches and that the data is valid- Parameters:
mode- CreateMode being usedpath- the znode full pathdata- data being setacl- the creation acls- Throws:
SchemaViolation- if schema's create mode setting does not match or data is invalid
-
validateGeneral
public void validateGeneral(java.lang.String path, byte[] data, java.util.List<org.apache.zookeeper.data.ACL> acl)Validate that this schema validates the data- Parameters:
path- the znode full pathdata- data being setacl- if creating, the acls otherwise null or empty list- Throws:
SchemaViolation- if data is invalid
-
getName
public java.lang.String getName()
-
getRawPath
public java.lang.String getRawPath()
Return the raw path for this schema. If a full path was used, it is returned. If a regex was used, it is returned- Returns:
- path
-
getMetadata
public java.util.Map<java.lang.String,java.lang.String> getMetadata()
-
getPathRegex
public java.util.regex.Pattern getPathRegex()
-
getPath
public java.lang.String getPath()
-
getDocumentation
public java.lang.String getDocumentation()
-
getSchemaValidator
public SchemaValidator getSchemaValidator()
-
getEphemeral
public Schema.Allowance getEphemeral()
-
getSequential
public Schema.Allowance getSequential()
-
getWatched
public Schema.Allowance getWatched()
-
canBeDeleted
public boolean canBeDeleted()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toDocumentation
public java.lang.String toDocumentation()
-
-