Class LuteceRunAfterComparator

  • All Implemented Interfaces:
    java.util.Comparator<java.lang.String>

    public class LuteceRunAfterComparator
    extends java.lang.Object
    implements java.util.Comparator<java.lang.String>
    Comparator for use in the liquibase changelog config (resourceComparator attribute of includeAll). Orders SQL files as liquibase does by default (alphabetical path order), except for plugins declaring an explicit ordering directive in the leading comment block of any of their scripts :
     --liquibase formatted sql
     --lutece runAfter:genericattributes
     --changeset author:id
     
    The directive is plugin-scoped : ALL the scripts of the declaring plugin are then ordered as if the plugin's directory lived under the target plugin's directory, AFTER all the target's own scripts, while physically staying in place. This replaces the fragile practice of placing a SQL file in another plugin's directory to control execution order, which breaks version resolution (LUT-33232) : with runAfter, paths still resolve to the true owner of each script. Directives chain to any depth : if A declares runAfter:B and B declares runAfter:C, the resulting order is C, then B, then A (locations are resolved recursively along the dependency graph). Invalid directives are ignored with an ERROR log and the plugin keeps its natural position : conflicting targets inside one plugin, unknown or script-less target, self reference, involvement of core, and dependency cycles (broken deterministically, plugins being resolved in name order). The directive must appear in the leading comment block, before the first non-comment line. Like the rest of this plugin, this class is deliberately not thread-safe : liquibase runs in the single startup thread. Instantiated by liquibase itself (no-arg constructor), outside any DI.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(java.lang.String left, java.lang.String right)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • LuteceRunAfterComparator

        public LuteceRunAfterComparator()
    • Method Detail

      • compare

        public int compare​(java.lang.String left,
                           java.lang.String right)
        Specified by:
        compare in interface java.util.Comparator<java.lang.String>