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 int
FILES_TO_LOG_COUNT
protected File
myTempArchiveFile
-
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 void
closeArchive()
protected OutputStream
createFileOutputStream()
protected abstract Matcher
createPathMatcher(String targetPathOnServer)
String
getTargetKey(String targetPath)
If this preprocessor can process given target path, return targetPath on server, which should be later be passed to #processArtifacts method.protected boolean
isFileAccessible(File fileToAdd)
protected abstract void
openArchive(Collection<File> files2Add)
void
processArtifacts(String targetPathOnServer, Map<File,String> filePathMap, ArtifactsPreprocessor.SymbolicLinksMode mode)
Publishes files.protected abstract void
putFileToArchive(File fileToAdd, String entryName)
void
setLogger(BuildProgressLogger logger)
Sets flow aware logger that allows to log messages in the same flow as corresponding jetbrains.buildServer.agent.ArtifactsPublisherboolean
shouldProcess(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:ArtifactsPreprocessor
If 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:
getTargetKey
in interfaceArtifactsPreprocessor
-
processArtifacts
public void processArtifacts(String targetPathOnServer, @NotNull Map<File,String> filePathMap, @NotNull ArtifactsPreprocessor.SymbolicLinksMode mode) throws ArtifactPreprocessingFailedException
Description copied from interface:ArtifactsPreprocessor
Publishes 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:
processArtifacts
in 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:ArtifactsPreprocessor
Sets flow aware logger that allows to log messages in the same flow as corresponding jetbrains.buildServer.agent.ArtifactsPublisher- Specified by:
setLogger
in interfaceArtifactsPreprocessor
-
-