Interface SettingsPersister

  • All Known Subinterfaces:
    SettingsPersister
    All Known Implementing Classes:
    SettingsPersisterImpl

    public interface SettingsPersister
    This service can be obtained as a Spring bean and should be used when one wants to save a global (non project related) configuration file under the /config folder. It is important to avoid using direct file I/O otherwise in a multi-node setups other nodes may not see the configuration file changes in time.

    To modify a project configuration, use the ProjectsPersister and ProjectPersistingHandler.

    Since:
    2024.12
    • Method Detail

      • scheduleSaveDocument

        PersistTask scheduleSaveDocument​(@NotNull
                                         String description,
                                         @NotNull
                                         FileWatcher fileWatcher,
                                         @NotNull
                                         org.jdom.Document document)
                                  throws IOException
        Schedules the task to save the document into the file monitored by the file watcher.
        Parameters:
        description - desciprition of the task
        fileWatcher - file watcher for the settings file, if settings file has configured file watcher. TeamCity will obtain real settings file from the file watcher via FileWatcher.getFile() method. TeamCity will imediatelly notify this file watcher about changes in file after persisting changes on disk.
        document - XML document to be saved
        Throws:
        IOException
      • scheduleSaveFile

        PersistTask scheduleSaveFile​(@NotNull
                                     String description,
                                     @NotNull
                                     FileWatcher fileWatcher,
                                     byte[] content)
                              throws IOException
        Schedules the task to save the byte content into the file monitored by the file watcher.
        Parameters:
        description - desciprition of the task
        fileWatcher - file watcher for the settings file, if settings file has configured file watcher. TeamCity will obtain real settings file from the file watcher via FileWatcher.getFile() method. TeamCity will imediatelly notify this file watcher about changes in file after persisting changes on disk.
        content - content of the file to be saved
        Throws:
        IOException
      • scheduleSaveFile

        PersistTask scheduleSaveFile​(@NotNull
                                     String description,
                                     @NotNull
                                     File file,
                                     byte[] content)
                              throws IOException
        Schedules the task to save the byte content into the file monitored by the file watcher.
        Parameters:
        description - desciprition of the task
        file - settings file to be changed, If the file has configured file watcher use scheduleSaveFile(String, FileWatcher, byte[]) instead
        content - content of the file to be saved
        Throws:
        IOException
      • abortTask

        void abortTask​(long taskId)
        Cancel task with specified task id.
        Parameters:
        taskId - task id to be cancelled