Class PathResolver

java.lang.Object
network.ike.plugin.scaffold.PathResolver

public final class PathResolver extends Object
Expands manifest dest strings to absolute filesystem paths.

Conventions:

  • ScaffoldScope.USER entries start with "~/" and resolve against the caller-supplied user home.
  • ScaffoldScope.PROJECT entries may optionally start with "{project.root}/" (the literal token, not a property reference); both forms resolve against the project-root path passed in.
  • Constructor Details

    • PathResolver

      public PathResolver(Path userHome, Path projectRoot)
      Construct a resolver bound to the given user-home and project-root anchors. Either anchor may be used at resolve time depending on the scope of the manifest entry; projectRoot may be omitted when only USER-scope resolution is required.
      Parameters:
      userHome - absolute path to the user's home directory; required for USER-scope entries
      projectRoot - absolute path to the current project's root; required for PROJECT-scope entries. May be null when only USER-scope resolution is expected (e.g. fresh-machine bootstrap).
  • Method Details

    • resolve

      public Path resolve(ManifestEntry entry)
      Resolve a manifest entry to an absolute path.
      Parameters:
      entry - the manifest entry
      Returns:
      absolute, normalised path
      Throws:
      ScaffoldException - if the entry's scope does not match the available roots or the dest form is inconsistent with its scope
    • resolveDest

      public Path resolveDest(String dest, ScaffoldScope scope)
      Resolve a bare dest string to an absolute path.

      Used for lockfile entries that have no surviving manifest counterpart (orphans) — the scope is inferred by the caller from which lockfile the dest came out of.

      Parameters:
      dest - the manifest dest string
      scope - the scope to resolve under
      Returns:
      absolute, normalised path
      Throws:
      ScaffoldException - if the dest form is inconsistent with its scope or the required root is unavailable