Interface DirectoryCleanersRegistry


  • @SystemProvided
    public interface DirectoryCleanersRegistry
    Builder/registry to register all possible cleanable items. Context will be recreated each next clean attempt.
    Since:
    7.1
    Author:
    Eugene Petrenko (eugene.petrenko@gmail.com) Date: 19.03.12 12:58\
    See Also:
    DirectoryCleanersProvider
    • Method Detail

      • addCleaner

        void addCleaner​(@NotNull
                        File root,
                        @NotNull
                        Date lastUseDate)
        Registers simple cleanable item. Root folder will be removed if clean is required
        Parameters:
        root - file/folder to remove on clean
        lastUseDate - last used time
        Since:
        7.1
      • addCleaner

        void addCleaner​(@NotNull
                        File root,
                        @NotNull
                        Date lastUseDate,
                        @NotNull
                        Runnable cleanAction)
        Registers callback-based cleaner. Callback will be called if item is decided to be removed. Root folder is selected to be as close to the items as possible.
        Parameters:
        root - file/folder containing the item.
        lastUseDate - list use time
        cleanAction - clean action that is called to initiate clean.
        Since:
        7.1
      • addRecurringCleaner

        void addRecurringCleaner​(@NotNull
                                 File root,
                                 @NotNull
                                 Runnable action)
        Registers action that will be called cleaner (registered with addCleaner)
        Parameters:
        root - clean root
        action - action to be called if item is decided to be cleaned.
        Since:
        7.1