Interface ModelSpec<T>
-
- All Superinterfaces:
Resolvable
- All Known Implementing Classes:
ModelSpecImpl
public interface ModelSpec<T> extends Resolvable
A full specification for dealing with a portion of the ZooKeeper tree. ModelSpec's contain:- A node path
- Serializer for the data stored
- Options for how to create the node (mode, compression, etc.)
- Options for how to deleting the node (quietly, guaranteed, etc.)
- ACLs
- Optional schema generation
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Set<CreateOption>defaultCreateOptionsstatic java.util.Set<DeleteOption>defaultDeleteOptions
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<org.apache.zookeeper.data.ACL>aclList()Return the model's ACL liststatic <T> ModelSpecBuilder<T>builder(ModelSerializer<T> serializer)Start a new ModelSpecBuilder for the given serializer.static <T> ModelSpecBuilder<T>builder(ZPath path, ModelSerializer<T> serializer)Start a new ModelSpecBuilder for the given path and serializer.ModelSpec<T>child(java.lang.Object child)Return a new CuratorModel instance with all the same options but applying to the given child node of this CuratorModel's path.org.apache.zookeeper.CreateModecreateMode()Return the model's create modejava.util.Set<CreateOption>createOptions()Return the model's create optionsjava.util.Set<DeleteOption>deleteOptions()Return the model's delete optionsModelSpec<T>parent()Return a new CuratorModel instance with all the same options but applying to the parent node of this CuratorModel's path.ZPathpath()Return the model's pathModelSpec<T>resolved(java.lang.Object... parameters)Return a new CuratorModel instance with all the same options but using a resolved path by callingZPath.resolved(Object...)using the given parametersModelSpec<T>resolved(java.util.List<java.lang.Object> parameters)Return a new CuratorModel instance with all the same options but using a resolved path by callingZPath.resolved(java.util.List)using the given parametersorg.apache.curator.framework.schema.Schemaschema()Return a Curator schema that validates ZNodes at this model's path using this model's valuesModelSerializer<T>serializer()Return the model's serializerlongttl()Return the TTL to use or -1ModelSpec<T>withPath(ZPath path)Return a new CuratorModel instance with all the same options but using the given path.
-
-
-
Field Detail
-
defaultCreateOptions
static final java.util.Set<CreateOption> defaultCreateOptions
-
defaultDeleteOptions
static final java.util.Set<DeleteOption> defaultDeleteOptions
-
-
Method Detail
-
builder
static <T> ModelSpecBuilder<T> builder(ZPath path, ModelSerializer<T> serializer)
Start a new ModelSpecBuilder for the given path and serializer. The returned ModelSpecBuilder usesdefaultCreateOptionsanddefaultDeleteOptions, but you can change these with builder methods.- Parameters:
path- path to modelserializer- the model's serializer- Returns:
- builder
-
builder
static <T> ModelSpecBuilder<T> builder(ModelSerializer<T> serializer)
Start a new ModelSpecBuilder for the given serializer. The returned ModelSpecBuilder usesdefaultCreateOptionsanddefaultDeleteOptions, but you can change these with builder methods. You must set a path before callingModelSpecBuilder.build()- Parameters:
serializer- the model's serializer- Returns:
- builder
-
child
ModelSpec<T> child(java.lang.Object child)
Return a new CuratorModel instance with all the same options but applying to the given child node of this CuratorModel's path. E.g. if this CuratorModel instance applies to "/a/b", calling
modeled.at("c")returns an instance that applies to "/a/b/c".The replacement is the
toString()value of child or, if it implementsNodeName, the value ofnodeName().- Parameters:
child- child node.- Returns:
- new Modeled Spec instance
-
parent
ModelSpec<T> parent()
Return a new CuratorModel instance with all the same options but applying to the parent node of this CuratorModel's path. E.g. if this CuratorModel instance applies to "/a/b/c", calling
modeled.parent()returns an instance that applies to "/a/b".The replacement is the
toString()value of child or, if it implementsNodeName, the value ofnodeName().- Returns:
- new Modeled Spec instance
-
withPath
ModelSpec<T> withPath(ZPath path)
Return a new CuratorModel instance with all the same options but using the given path.- Parameters:
path- new path- Returns:
- new Modeled Spec instance
-
resolved
ModelSpec<T> resolved(java.lang.Object... parameters)
Return a new CuratorModel instance with all the same options but using a resolved path by calling
ZPath.resolved(Object...)using the given parametersThe replacement is the
toString()value of the parameter object or, if the object implementsNodeName, the value ofnodeName().- Specified by:
resolvedin interfaceResolvable- Parameters:
parameters- list of replacements. Must have be the same length as the number of parameter nodes in the path- Returns:
- new resolved ModelSpec
-
resolved
ModelSpec<T> resolved(java.util.List<java.lang.Object> parameters)
Return a new CuratorModel instance with all the same options but using a resolved path by calling
ZPath.resolved(java.util.List)using the given parametersThe replacement is the
toString()value of the parameter object or, if the object implementsNodeName, the value ofnodeName().- Specified by:
resolvedin interfaceResolvable- Parameters:
parameters- list of replacements. Must have be the same length as the number of parameter nodes in the path- Returns:
- new resolved ModelSpec
-
path
ZPath path()
Return the model's path- Returns:
- path
-
serializer
ModelSerializer<T> serializer()
Return the model's serializer- Returns:
- serializer
-
createMode
org.apache.zookeeper.CreateMode createMode()
Return the model's create mode- Returns:
- create mode
-
aclList
java.util.List<org.apache.zookeeper.data.ACL> aclList()
Return the model's ACL list- Returns:
- ACL list
-
createOptions
java.util.Set<CreateOption> createOptions()
Return the model's create options- Returns:
- create options
-
deleteOptions
java.util.Set<DeleteOption> deleteOptions()
Return the model's delete options- Returns:
- delete options
-
ttl
long ttl()
Return the TTL to use or -1- Returns:
- ttl
-
schema
org.apache.curator.framework.schema.Schema schema()
Return a Curator schema that validates ZNodes at this model's path using this model's values- Returns:
- schema
-
-