Class ArchivePreprocessor
- java.lang.Object
 - 
- jetbrains.buildServer.agent.impl.artifacts.ArchivePreprocessor
 
 
- 
- All Implemented Interfaces:
 AgentExtension,ArtifactsPreprocessor,TeamCityExtension
- Direct Known Subclasses:
 BatchArchivePreprocessor,SevenZPreprocessor
public abstract class ArchivePreprocessor extends Object implements ArtifactsPreprocessor
- Author:
 - kir
 
 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from interface jetbrains.buildServer.agent.ArtifactsPreprocessor
ArtifactsPreprocessor.SymbolicLinksMode 
 - 
 
- 
Field Summary
Fields Modifier and Type Field Description static intFILES_TO_LOG_COUNTprotected FilemyTempArchiveFile- 
Fields inherited from interface jetbrains.buildServer.agent.ArtifactsPreprocessor
TARGET_PATH_SEPARATOR 
 - 
 
- 
Constructor Summary
Constructors Constructor Description ArchivePreprocessor(BuildProgressLogger logger, File tempDir)ArchivePreprocessor(EventDispatcher<AgentLifeCycleListener> dispatcher) 
- 
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidcloseArchive()protected OutputStreamcreateFileOutputStream()protected abstract MatchercreatePathMatcher(String targetPathOnServer)StringgetTargetKey(String targetPath)If this preprocessor can process given target path, return targetPath on server, which should be later be passed to #processArtifacts method.protected booleanisFileAccessible(File fileToAdd)protected abstract voidopenArchive(Collection<File> files2Add)voidprocessArtifacts(String targetPathOnServer, Map<File,String> filePathMap, ArtifactsPreprocessor.SymbolicLinksMode mode)Publishes files.protected abstract voidputFileToArchive(File fileToAdd, String entryName)voidsetLogger(BuildProgressLogger logger)Sets flow aware logger that allows to log messages in the same flow as corresponding jetbrains.buildServer.agent.ArtifactsPublisherbooleanshouldProcess(String targetPathOnServer)- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface jetbrains.buildServer.agent.ArtifactsPreprocessor
processArtifacts 
 - 
 
 - 
 
- 
- 
Field Detail
- 
FILES_TO_LOG_COUNT
public static final int FILES_TO_LOG_COUNT
- See Also:
 - Constant Field Values
 
 
- 
myTempArchiveFile
protected File myTempArchiveFile
 
 - 
 
- 
Constructor Detail
- 
ArchivePreprocessor
public ArchivePreprocessor(@NotNull EventDispatcher<AgentLifeCycleListener> dispatcher) 
- 
ArchivePreprocessor
public ArchivePreprocessor(BuildProgressLogger logger, File tempDir)
 
 - 
 
- 
Method Detail
- 
openArchive
protected abstract void openArchive(Collection<File> files2Add) throws IOException
- Throws:
 IOException
 
- 
putFileToArchive
protected abstract void putFileToArchive(File fileToAdd, String entryName) throws IOException
- Throws:
 IOException
 
- 
closeArchive
protected abstract void closeArchive() throws IOException- Throws:
 IOException
 
- 
createFileOutputStream
protected final OutputStream createFileOutputStream() throws IOException
- Throws:
 IOException
 
- 
isFileAccessible
protected boolean isFileAccessible(File fileToAdd)
 
- 
getTargetKey
public String getTargetKey(String targetPath)
Description copied from interface:ArtifactsPreprocessorIf this preprocessor can process given target path, return targetPath on server, which should be later be passed to #processArtifacts method. For instance, for input a.zip/sub/path this method should return a.zip If this processor cannot process targetPath, should return null- Specified by:
 getTargetKeyin interfaceArtifactsPreprocessor
 
- 
processArtifacts
public void processArtifacts(String targetPathOnServer, @NotNull Map<File,String> filePathMap, @NotNull ArtifactsPreprocessor.SymbolicLinksMode mode) throws ArtifactPreprocessingFailedException
Description copied from interface:ArtifactsPreprocessorPublishes files. Note that publishing is performed from the agent messages queue and thus this method can be called when build on the agent is already finished. Usage example 1: gzip published file: file.txt => some/path.gz will gzip file.txt and convert map to path.gz => some/path.gz- Specified by:
 processArtifactsin interfaceArtifactsPreprocessor- Parameters:
 targetPathOnServer- target path on server, right part of "file.dmg => dist/" expressionfilePathMap- map of the file to publish to its destination directory. This map can be altered by the implementation. For archives, target path may contain several entries separated byArtifactsPreprocessor.TARGET_PATH_SEPARATOR, like file.txt => "a.zip!/foo/\na.zip!/bar/"mode- simbolic links mode- Throws:
 ArtifactPreprocessingFailedException
 
- 
shouldProcess
public boolean shouldProcess(@NotNull String targetPathOnServer) 
- 
setLogger
public void setLogger(@NotNull BuildProgressLogger logger)Description copied from interface:ArtifactsPreprocessorSets flow aware logger that allows to log messages in the same flow as corresponding jetbrains.buildServer.agent.ArtifactsPublisher- Specified by:
 setLoggerin interfaceArtifactsPreprocessor
 
 - 
 
 -