Class AgentFileVisitor<T extends Serializable>

Type Parameters:
T - the type of the results
All Implemented Interfaces:
FilePath.FileCallable<AgentFileVisitor.FileVisitorResult<T>>, Serializable, org.jenkinsci.remoting.RoleSensitive

public abstract class AgentFileVisitor<T extends Serializable> extends MasterToSlaveFileCallable<AgentFileVisitor.FileVisitorResult<T>>
Finds all files that match a specified Ant file pattern and visits these files with the processing method processFile(Path, Charset, FilteredLog), that has to be implemented by concrete subclasses. This callable will be invoked on an agent so all fields and the returned list of results need to be Serializable.
Ullrich Hafner
See Also:
  • Constructor Details

    • AgentFileVisitor

      protected AgentFileVisitor(String filePattern, String encoding, boolean followSymbolicLinks, boolean errorOnEmptyFiles)
      Creates a new instance of AgentFileVisitor.
      filePattern - ant file-set pattern to scan for files to parse
      encoding - encoding of the files to parse
      followSymbolicLinks - determines whether the visitor should traverse symbolic links
      errorOnEmptyFiles - determines whether the visitor should log errors if a file is empty
  • Method Details

    • invoke

      public final AgentFileVisitor.FileVisitorResult<T> invoke(File workspace, hudson.remoting.VirtualChannel channel)
    • plural

      protected String plural(int count, String itemName)
      Creates the correct singular or plural form of the specified word depending on the size of the elements.
      count - the count of elements
      itemName - the name of the items (singular)
      the message
    • processFile

      protected abstract Optional<T> processFile(Path file, Charset charset, log)