Interface UpdateListener

  • All Known Implementing Classes:
    UpdateListenerAdapter

    public interface UpdateListener
    Update stages listener. Provide hooks for the main processing points and opens internal model. Used mainly for testing (to simulate situations), but might be used as a workaround for specific cases (merger bugs workaround or manual model processing).
    Since:
    17.08.2021
    See Also:
    UpdateListenerAdapter
    • Method Detail

      • configured

        void configured​(UpdateConfig config)
        Called just before start to provide access to configuration actually used by merger (catching configuration errors).
        Parameters:
        config - configuration instance
      • updateConfigParsed

        void updateConfigParsed​(CmtTree tree,
                                StructTree struct)
        Parsed new configuration with two parsers (preserving comments and snakeyaml). At this point trees were validated to be equal (merger self-control mechanism).

        Environment variables already applied.

        Passed structure tree would be used later for the final result validation, so be careful with modifications.

        If you going to modify tree then modify both trees accordingly (otherwise final validation would fail)

        Parameters:
        tree - comments tree
        struct - structure tree
        See Also:
        for creating new comment nodes, for creating new struct nodes
      • currentConfigParsed

        void currentConfigParsed​(CmtTree tree,
                                 StructTree struct)
        Parsed current configuration with two parsers (preserving comments and snakeyaml). At this point trees were validated to be equal (merger self-control mechanism).

        Configured deletions already applied.

        Method would not be called if current configuration does not exist.

        Passed structure tree would be used later for the final result validation, so be careful with modifications.

        NOTE: The same CmtTree instance used for updates and would be written to file after merge.

        If you going to modify tree then modify both trees accordingly (otherwise final validation would fail)

        Parameters:
        tree - comments tree
        struct - structure tree
        See Also:
        for creating new comment nodes, for creating new struct nodes
      • merged

        void merged​(CmtTree result)
        Called just after the merge, but before final validation. Provided structure would be written to file after validation.

        NOTE: validation would detect modifications and deny entire update. If you want to manually correct the resulted tree then disable result validation (it would still read the resulted file to make sure it's semantically correct, but would not compare with old/new files).

        Parameters:
        result - merge result
        See Also:
        for creating new comment nodes
      • validated

        void validated​(StructTree result)
        Called after result validation. Not called if validation disabled.

        At this point merged file was already saved. Passed model is a read of just merged file for validation. Any changes to this model will not take any effect. Method may be used for additional validations.

        Parameters:
        result - parsed merged file (with snakeyaml)
      • backupCreated

        void backupCreated​(java.io.File backup)
        Called after backup file creation (only if required).
        Parameters:
        backup - created backup file for current configuration