Class ReferenceIndex

java.lang.Object
io.apicurio.registry.maven.refs.ReferenceIndex

public class ReferenceIndex extends Object
An index of the files available when discovering references in an artifact. This index is typically populated by getting a list of all files in a directory, or zip file. The index maps a resource name (this will vary depending on the artifact type) to the content of the resource. For example, Avro schemas will have resource names based on the qualified name of the type they define. JSON Schemas will have resources names based on the name of the file. The intent of this index is to resolve an external reference found in an artifact to an actual piece of content (e.g. file) in the index. If it cannot be resolved, that would typically mean that there is a broken reference in the schema/design.
  • Constructor Details

    • ReferenceIndex

      public ReferenceIndex()
      Constructor.
    • ReferenceIndex

      public ReferenceIndex(Path schemaPath)
      Constructor.
      Parameters:
      schemaPath -
  • Method Details

    • addSchemaPath

      public void addSchemaPath(Path path)
      Parameters:
      path -
    • lookup

      public IndexedResource lookup(String resourceName, Path relativeToFile)
      Look up a resource in the index. Returns null if no resource with that name is found.
      Parameters:
      resourceName -
      relativeToFile -
    • index

      public void index(String resourceName, io.apicurio.registry.rest.client.models.VersionMetaData vmd)
      Index an existing (remote) reference using a resource name and remote artifact metadata.
      Parameters:
      resourceName -
      vmd -
    • index

      public void index(Path path, io.apicurio.registry.content.ContentHandle content)
      Index the given content. Indexing will parse the content and figure out its resource name and type.
      Parameters:
      path -
      content -