Package org.nuxeo.lib.stream.codec
Class FileAvroSchemaStore
- java.lang.Object
-
- org.nuxeo.lib.stream.codec.FileAvroSchemaStore
-
- All Implemented Interfaces:
org.apache.avro.message.SchemaStore
,AvroSchemaStore
public class FileAvroSchemaStore extends Object implements AvroSchemaStore
Very simple SchemaStore that uses a file storage to persists its schemas.- Since:
- 10.3
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
AVRO_SCHEMA_EXT
protected Path
schemaDirectoryPath
protected Map<Long,org.apache.avro.Schema>
schemas
-
Constructor Summary
Constructors Constructor Description FileAvroSchemaStore(Path schemaDirectoryPath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
addSchema(org.apache.avro.Schema schema)
Adds a schema to the store and returns its fingerprint.org.apache.avro.Schema
findByFingerprint(long fingerprint)
protected String
getFilename(String prefix, long fingerprint)
void
loadSchema(Path schemaPath)
Load the avro schema from this file.void
loadSchemas(Path directory)
Load all avro schema files from this directory.protected void
loadSchemasEndingWith(Path directory, String pattern)
Loads all avro schema files from this directory that end with the pattern.
-
-
-
Field Detail
-
AVRO_SCHEMA_EXT
protected static final String AVRO_SCHEMA_EXT
- See Also:
- Constant Field Values
-
schemaDirectoryPath
protected final Path schemaDirectoryPath
-
-
Constructor Detail
-
FileAvroSchemaStore
public FileAvroSchemaStore(Path schemaDirectoryPath)
-
-
Method Detail
-
loadSchemas
public void loadSchemas(Path directory)
Load all avro schema files from this directory. Files must have the .avsc extention.
-
loadSchemasEndingWith
protected void loadSchemasEndingWith(Path directory, String pattern)
Loads all avro schema files from this directory that end with the pattern.- Since:
- 11.5
-
loadSchema
public void loadSchema(Path schemaPath)
Load the avro schema from this file.
-
addSchema
public long addSchema(org.apache.avro.Schema schema)
Description copied from interface:AvroSchemaStore
Adds a schema to the store and returns its fingerprint.- Specified by:
addSchema
in interfaceAvroSchemaStore
-
findByFingerprint
public org.apache.avro.Schema findByFingerprint(long fingerprint)
- Specified by:
findByFingerprint
in interfaceorg.apache.avro.message.SchemaStore
-
-