Class SchemaSetLoader
- java.lang.Object
-
- org.apache.curator.framework.schema.SchemaSetLoader
-
public class SchemaSetLoader extends java.lang.ObjectUtility to load schems set from a JSON stream/file. NOTE: to avoid adding a new dependency to Curator, the Jackson library has been used with "provided" scope. You will need to add a dependency to
com.fasterxml.jackson.core:jackson-core:2.7.3andcom.fasterxml.jackson.core:jackson-databind:2.7.3to your projectThe JSON stream should be an array of named schemas:
[ { "name": "name", required - name of the schema "path": "path or pattern", required - full path or regex pattern "isRegex": true/false, optional - true if path is a regular expression - default is false "schemaValidator": "name", optional - name of a schema validator - default is no validator "documentation": "docs", optional - user displayable docs - default is "" "ephemeral": "allowance", optional - "can", "must" or "cannot" - default is "can" "sequential": "allowance", optional - "can", "must" or "cannot" - default is "can" "watched": "allowance", optional - "can", "must" or "cannot" - default is "can" "canBeDeleted": true/false optional - true if ZNode at path can be deleted - default is true "metadata": { optional - any fields -> values that you want "field1": "value1", "field2": "value2" } } ]
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSchemaSetLoader.SchemaValidatorMapperCalled to map a schema validator name in the JSON stream to an actual data validator
-
Constructor Summary
Constructors Constructor Description SchemaSetLoader(com.fasterxml.jackson.databind.JsonNode root, SchemaSetLoader.SchemaValidatorMapper schemaValidatorMapper)SchemaSetLoader(java.io.Reader jsonStream, SchemaSetLoader.SchemaValidatorMapper schemaValidatorMapper)SchemaSetLoader(java.lang.String json, SchemaSetLoader.SchemaValidatorMapper schemaValidatorMapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Schema>getSchemas()SchemaSettoSchemaSet(boolean useDefaultSchema)
-
-
-
Constructor Detail
-
SchemaSetLoader
public SchemaSetLoader(java.lang.String json, SchemaSetLoader.SchemaValidatorMapper schemaValidatorMapper)- Parameters:
json- the json to parseschemaValidatorMapper- mapper from validator name to instance - can be null if not needed
-
SchemaSetLoader
public SchemaSetLoader(java.io.Reader jsonStream, SchemaSetLoader.SchemaValidatorMapper schemaValidatorMapper)- Parameters:
jsonStream- the json stream to parseschemaValidatorMapper- mapper from validator name to instance - can be null if not needed
-
SchemaSetLoader
public SchemaSetLoader(com.fasterxml.jackson.databind.JsonNode root, SchemaSetLoader.SchemaValidatorMapper schemaValidatorMapper)- Parameters:
root- a Jackson root nodeschemaValidatorMapper- mapper from validator name to instance - can be null if not needed
-
-