Class 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 Detail

      • schemaDirectoryPath

        protected final Path schemaDirectoryPath
      • schemas

        protected final Map<Long,​org.apache.avro.Schema> schemas
    • 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 interface AvroSchemaStore
      • getFilename

        protected String getFilename​(String prefix,
                                     long fingerprint)
      • findByFingerprint

        public org.apache.avro.Schema findByFingerprint​(long fingerprint)
        Specified by:
        findByFingerprint in interface org.apache.avro.message.SchemaStore