Class RegistryIndex

java.lang.Object
network.ike.docs.plugin.diff.RegistryIndex

public final class RegistryIndex extends Object
One side's topic registry, generated from the files as they stand on that side of a doc-diff comparison: topics grouped by domain (each entry in the shape idoc:topic-registry writes, built from the :topic-*: header), and each assembly's topic membership read from its include:: lines. No hand-kept registry file is read.

This is what lets an assembly module's idoc:diff run project the corpus diff onto its own membership (ike-issues#649), and what RegistryDelta compares.

  • Method Details

    • load

      public static RegistryIndex load(GitSource git, String ref, String registryRoot) throws IOException
      Generate the registry as it stands on one side of a comparison.
      Parameters:
      git - repository access
      ref - the side to read (GitSource.WORKTREE or a committish)
      registryRoot - repository-relative source root of the topic library (the directory holding topics/), or null when the repository has none
      Returns:
      the index (empty when there is no topic library on that side)
      Throws:
      IOException - on repository access failure
    • topicFile

      public String topicFile(String topicId)
      Resolve a topic id to its source file, relative to the registry root (e.g. topics/arch/asg-substrate.adoc).
      Parameters:
      topicId - the topic id
      Returns:
      the registry-root-relative file, or null when the id is unknown
    • assemblyRefs

      public List<String> assemblyRefs(String assemblyId)
      An assembly's topic membership, in include order.
      Parameters:
      assemblyId - the assembly id: by IKE naming convention the module directory (and artifactId) holding the assembly's src/docs/asciidoc
      Returns:
      the topic ids, or null when no file of that assembly includes a topic
    • membershipDelta

      public static String membershipDelta(RegistryIndex oldIndex, RegistryIndex newIndex, String fromRef, String toRef, String assemblyId)
      Render one assembly's membership delta (topics added to and removed from its includes between two sides) as a small registry-delta partial for an assembly-projection packet.
      Parameters:
      oldIndex - the from side
      newIndex - the to side
      fromRef - the from-side ref, for the text
      toRef - the to-side ref (may be GitSource.WORKTREE)
      assemblyId - the assembly to report on
      Returns:
      the partial's text with a level-1 title, or an empty string when this assembly's membership is unchanged
    • findRoot

      public static String findRoot(GitSource git, String ref) throws IOException
      Find the topic library's source root on a side: the …/src/docs/asciidoc directory whose topics/ holds .adoc files.
      Parameters:
      git - repository access
      ref - the side to search
      Returns:
      the repository-relative source root, or null when the repository has no topic library on that side
      Throws:
      IOException - on repository access failure