Class DeleteAction

    • Method Detail

      • delete

        protected void delete​(Path path)
                       throws IOException
        Deletes the specified file.
        Parameters:
        path - the file to delete
        Throws:
        IOException - if a problem occurred deleting the file
      • isTestMode

        public boolean isTestMode()
        Returns true if files are not deleted even when all conditions accept a path, false otherwise.
        Returns:
        true if files are not deleted even when all conditions accept a path, false otherwise
      • createDeleteAction

        @PluginFactory
        public static DeleteAction createDeleteAction​(@PluginAttribute("basePath")
                                                      String basePath,
                                                      @PluginAttribute("followLinks")
                                                      boolean followLinks,
                                                      @PluginAttribute(value="maxDepth",defaultInt=1)
                                                      int maxDepth,
                                                      @PluginAttribute("testMode")
                                                      boolean testMode,
                                                      @PluginElement("PathSorter")
                                                      PathSorter sorterParameter,
                                                      @PluginElement("PathConditions")
                                                      PathCondition[] pathConditions,
                                                      @PluginElement("ScriptCondition")
                                                      ScriptCondition scriptCondition,
                                                      @PluginConfiguration
                                                      Configuration config)
        Create a DeleteAction.
        Parameters:
        basePath - base path from where to start scanning for files to delete.
        followLinks - whether to follow symbolic links. Default is false.
        maxDepth - The maxDepth parameter is the maximum number of levels of directories to visit. A value of 0 means that only the starting file is visited, unless denied by the security manager. A value of MAX_VALUE may be used to indicate that all levels should be visited.
        testMode - if true, files are not deleted but instead a message is printed to the status logger at INFO level. Users can use this to do a dry run to test if their configuration works as expected. Default is false.
        PathSorter - a plugin implementing the PathSorter interface
        PathConditions - an array of path conditions (if more than one, they all need to accept a path before it is deleted).
        config - The Configuration.
        Returns:
        A DeleteAction.