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
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull Function<ArtifactHandler,
ArtifactHandler> A function that decoratesArtifactHandler
with conditional file packaging usingArtifactHandlerPackagingDecorator
.protected @NotNull ArtifactHandler
delegate()
Returns the delegate instance that methods are forwarded to.boolean
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, removeAllArtifactsOfChain, removeArtifactFromStorage, removeArtifactFromStorage, removeArtifactFromStorage, removeArtifactsFromStorage, removeArtifactsFromStorage
-
Constructor Details
-
ArtifactHandlerPackagingDecorator
-
-
Method Details
-
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
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
-