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 StringAVRO_SCHEMA_EXTprotected PathschemaDirectoryPathprotected 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 longaddSchema(org.apache.avro.Schema schema)Adds a schema to the store and returns its fingerprint.org.apache.avro.SchemafindByFingerprint(long fingerprint)protected StringgetFilename(String prefix, long fingerprint)voidloadSchema(Path schemaPath)Load the avro schema from this file.voidloadSchemas(Path directory)Load all avro schema files from this directory.protected voidloadSchemasEndingWith(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:AvroSchemaStoreAdds a schema to the store and returns its fingerprint.- Specified by:
addSchemain interfaceAvroSchemaStore
-
findByFingerprint
public org.apache.avro.Schema findByFingerprint(long fingerprint)
- Specified by:
findByFingerprintin interfaceorg.apache.avro.message.SchemaStore
-
-