Package io.jenkins.plugins.util
Class AgentFileVisitor<T extends Serializable>
java.lang.Object
jenkins.MasterToSlaveFileCallable<AgentFileVisitor.FileVisitorResult<T>>
io.jenkins.plugins.util.AgentFileVisitor<T>
- 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
.- Author:
- Ullrich Hafner
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The results for all found files. -
Constructor Summary
ModifierConstructorDescriptionprotected
AgentFileVisitor
(String filePattern, String encoding, boolean followSymbolicLinks, boolean errorOnEmptyFiles) Creates a new instance ofAgentFileVisitor
. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Creates the correct singular or plural form of the specified word depending on the size of the elements.processFile
(Path file, Charset charset, edu.hm.hafner.util.FilteredLog log) Methods inherited from class jenkins.MasterToSlaveFileCallable
checkRoles
-
Constructor Details
-
AgentFileVisitor
protected AgentFileVisitor(String filePattern, String encoding, boolean followSymbolicLinks, boolean errorOnEmptyFiles) Creates a new instance ofAgentFileVisitor
.- Parameters:
filePattern
- ant file-set pattern to scan for files to parseencoding
- encoding of the files to parsefollowSymbolicLinks
- determines whether the visitor should traverse symbolic linkserrorOnEmptyFiles
- 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
Creates the correct singular or plural form of the specified word depending on the size of the elements.- Parameters:
count
- the count of elementsitemName
- the name of the items (singular)- Returns:
- the message
-
processFile
-