Class KeepList

java.lang.Object
com.iizix.server.tools.KeepList

public final class KeepList extends Object
The keep list of a server update (CC-SERVER-RESTART-UPDATE-V5, after NetPhantom's keep.lst): which paths of the installation an update leaves alone while it mirrors the trees of the package. A file in the installation, conf/update-keep.lst, one entry per line:
  • path - KEEP: an existing file is never overwritten and never deleted; a file of the package that does not exist yet is added. A path ending with / is a tree.
  • + path - MERGE: a file of the package replaces the existing one, a file the package does not have is kept (never deleted). The shape of apps/ and demos/: the shipped applications are updated, the customer's are kept.
  • - path - MIRROR: inside a kept or merged tree, this path is mirrored after all (replaced by the package's, deleted when the package has none).
  • # or ; starts a comment; blank lines are skipped.
The most specific entry wins: the longest path that matches. A path matches itself and everything under it when it names a tree; * in a file name matches any characters of that name. Everything the list does not name is MIRRORED: the file of the package replaces it, and a file the package does not have is deleted - the versioned jar names of lib/ and its wildcard classpath demand it.

Without a file the defaults() apply: conf/, db/, logs/, updates/, jdk/ and bin/ntservice/ kept (the Windows service runs from the last one: SrvAny, the event log DLL and the wrapper's copy of the tools jar are locked while it runs, and is.bat refreshes them), apps/ and demos/ merged, root/.well-known/ kept (the ACME challenge files the server writes there).

Nothing here depends on another IIZI class: the updater runs from its own jar.

Author:
Christopher Mindus
  • Constructor Details

    • KeepList

      public KeepList()
      Creates an empty list: everything mirrored.
  • Method Details

    • defaults

      public static KeepList defaults()
      The built-in defaults.
      Returns:
      The list.
    • read

      public static KeepList read(Path file) throws IOException
      Reads the list from a file.
      Parameters:
      file - The file.
      Returns:
      The list.
      Throws:
      IOException - If the file cannot be read.
    • parse

      public static KeepList parse(String text)
      Parses the list.
      Parameters:
      text - The text of the file.
      Returns:
      The list; lines that are not entries are in getErrors().
    • rule

      public KeepList.Rule rule(String rel)
      Gets the rule of a path of the installation.
      Parameters:
      rel - The path, relative to the installation, with forward slashes.
      Returns:
      The rule: KeepList.Rule.MIRROR when no entry names the path.
    • getErrors

      public List<String> getErrors()
      Gets the lines that were not entries.
      Returns:
      The errors, empty for a clean file.
    • size

      public int size()
      Gets the number of entries.
      Returns:
      The count.
    • toString

      public String toString()
      Overrides:
      toString in class Object