Class ArtifactHandlerPackagingDecorator
- java.lang.Object
-
- com.atlassian.bamboo.build.artifact.ArtifactHandlerDecoratorSupport
-
- com.atlassian.bamboo.build.artifact.handlers.ArtifactHandlerPackagingDecorator
-
- All Implemented Interfaces:
ArtifactHandler
,RepublishingArtifactHandler
,BambooPluginModule
public class ArtifactHandlerPackagingDecorator extends ArtifactHandlerDecoratorSupport implements RepublishingArtifactHandler
A decorator for an
ArtifactHandler
that adds packaging of artifact files when certain conditions are met.This decorator checks the
ArtifactHandler.getMaxUnarchivedFilesPerArtifact(Map)
threshold when publishing artifacts and if it is exceeded, it packages all artifact files into a single archive, which is then published instead.Artifacts are automatically unpacked during retrieval, which means that for artifact dependency consumers (e.g. different build stages, different build plans or deployment projects) the packaging will be transparent.
-
-
Field Summary
-
Fields inherited from interface com.atlassian.bamboo.build.artifact.ArtifactHandler
LAN_SPEED, LOCAL_SPEED, NEVER_ARCHIVE, WAN_SPEED
-
-
Constructor Summary
Constructors Constructor Description ArtifactHandlerPackagingDecorator(@NotNull ArtifactHandler delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static @NotNull com.google.common.base.Function<ArtifactHandler,ArtifactHandler>
addFilePackaging()
A function that decoratesArtifactHandler
with conditional file packaging usingArtifactHandlerPackagingDecorator
.protected @NotNull ArtifactHandler
delegate()
Returns the delegate instance that methods are forwarded to.boolean
isRepublishingSupported()
If republishing is really supported.@NotNull ArtifactHandlerPublishingResult
publish(@NotNull ResultKey resultKey, @NotNull ArtifactDefinitionContext artifact, @NotNull ArtifactPublishingConfig artifactPublishingConfig, @Nullable BuildLogger buildLogger)
@NotNull ArtifactHandlerPublishingResult
republish(@NotNull ArtifactHandlerPublishingResult previousPublishingResult, @NotNull ResultKey resultKey, @NotNull ArtifactDefinitionContext artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider, @Nullable BuildLogger buildLogger)
Method called when remote agent tries to recover from result publishing failures.@NotNull ArtifactRetrievalStatus
retrieve(@NotNull ResultKey clientKey, @NotNull Artifact artifact, @NotNull ArtifactSubscriptionContext artifactSubscription, @NotNull ArtifactRetrievalConfig artifactRetrievalConfig)
Retrieve arbitraryArtifact
.-
Methods inherited from class com.atlassian.bamboo.build.artifact.ArtifactHandlerDecoratorSupport
canHandleArtifact, getArtifactLinkDataProvider, getArtifactLinkDataProvider, getDefaultConfiguration, getMaxUnarchivedFilesPerArtifact, getModuleDescriptor, getSpeed, getSupportedAgents, moveArtifactToGlobalStorage, removeAllArtifactsOfChain, removeArtifactFromStorage, removeArtifactFromStorage, removeArtifactFromStorage, removeArtifactsFromStorage, removeArtifactsFromStorage, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.atlassian.bamboo.build.artifact.ArtifactHandler
canHandleArtifact, getArtifactLinkDataProvider, getArtifactLinkDataProvider, getDefaultConfiguration, getMaxUnarchivedFilesPerArtifact, getModuleDescriptor, getSpeed, getSupportedAgents, moveArtifactToGlobalStorage, publish, removeAllArtifactsOfChain, removeArtifactFromStorage, removeArtifactFromStorage, removeArtifactFromStorage, removeArtifactsFromStorage, removeArtifactsFromStorage
-
Methods inherited from interface com.atlassian.bamboo.build.artifact.RepublishingArtifactHandler
republish
-
-
-
-
Constructor Detail
-
ArtifactHandlerPackagingDecorator
public ArtifactHandlerPackagingDecorator(@NotNull @NotNull ArtifactHandler delegate)
-
-
Method Detail
-
delegate
@NotNull protected @NotNull ArtifactHandler delegate()
Description copied from class:ArtifactHandlerDecoratorSupport
Returns the delegate instance that methods are forwarded to. Subclasses should override this method to supply the instance being decorated.- Specified by:
delegate
in classArtifactHandlerDecoratorSupport
-
addFilePackaging
@NotNull public static @NotNull com.google.common.base.Function<ArtifactHandler,ArtifactHandler> addFilePackaging()
A function that decoratesArtifactHandler
with conditional file packaging usingArtifactHandlerPackagingDecorator
.
-
publish
@NotNull public @NotNull ArtifactHandlerPublishingResult publish(@NotNull @NotNull ResultKey resultKey, @NotNull @NotNull ArtifactDefinitionContext artifact, @NotNull @NotNull ArtifactPublishingConfig artifactPublishingConfig, @Nullable @Nullable BuildLogger buildLogger) throws Exception
- Specified by:
publish
in interfaceArtifactHandler
- Overrides:
publish
in classArtifactHandlerDecoratorSupport
- Throws:
Exception
-
republish
@NotNull public @NotNull ArtifactHandlerPublishingResult republish(@NotNull @NotNull ArtifactHandlerPublishingResult previousPublishingResult, @NotNull @NotNull ResultKey resultKey, @NotNull @NotNull ArtifactDefinitionContext artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider, @Nullable @Nullable BuildLogger buildLogger) throws Exception
Description copied from interface:RepublishingArtifactHandler
Method called when remote agent tries to recover from result publishing failures. It is called if the previous attempt of transferring the artifact returned statusArtifactHandlerPublishingResult.Status.DEFERRED
.- Specified by:
republish
in interfaceRepublishingArtifactHandler
- Throws:
Exception
-
isRepublishingSupported
public boolean isRepublishingSupported()
Description copied from interface:RepublishingArtifactHandler
If republishing is really supported. Necessary because of handlers that wrap other handlers.- Specified by:
isRepublishingSupported
in interfaceRepublishingArtifactHandler
- Returns:
- true iff republishing is actually supported
-
retrieve
@NotNull public @NotNull ArtifactRetrievalStatus retrieve(@NotNull @NotNull ResultKey clientKey, @NotNull @NotNull Artifact artifact, @NotNull @NotNull ArtifactSubscriptionContext artifactSubscription, @NotNull @NotNull ArtifactRetrievalConfig artifactRetrievalConfig) throws Exception
Description copied from interface:ArtifactHandler
Retrieve arbitraryArtifact
. Artifact is found by the information in artifact parameter.- Specified by:
retrieve
in interfaceArtifactHandler
- Overrides:
retrieve
in classArtifactHandlerDecoratorSupport
- Parameters:
clientKey
- identifier of plan or deployment doing the downloadartifact
- artifact informationartifactSubscription
- download details (e.g. target path, copy pattern)artifactRetrievalConfig
- handler specific configuration- Throws:
Exception
-
-