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
ConstructorsConstructorDescriptionArtifactHandlerPackagingDecorator(@NotNull ArtifactHandler delegate) ArtifactHandlerPackagingDecorator(@NotNull ArtifactHandler delegate, @Nullable File baseDirectory) -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull Function<ArtifactHandler, ArtifactHandler> addFilePackaging(File baseDirectory) A function that decoratesArtifactHandlerwith conditional file packaging usingArtifactHandlerPackagingDecorator.protected @NotNull ArtifactHandlerdelegate()Returns the delegate instance that methods are forwarded to.booleanIf republishing is really supported.@NotNull ArtifactHandlerPublishingResultpublish(@NotNull ResultKey resultKey, @NotNull ArtifactDefinitionContext artifact, @NotNull ArtifactPublishingConfig artifactPublishingConfig, @Nullable BuildLogger buildLogger) @NotNull ArtifactHandlerPublishingResultrepublish(@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 ArtifactRetrievalStatusretrieve(@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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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
-
ArtifactHandlerPackagingDecorator
public ArtifactHandlerPackagingDecorator(@NotNull @NotNull ArtifactHandler delegate, @Nullable @Nullable File baseDirectory)
-
-
Method Details
-
delegate
Description copied from class:ArtifactHandlerDecoratorSupportReturns the delegate instance that methods are forwarded to. Subclasses should override this method to supply the instance being decorated.- Specified by:
delegatein classArtifactHandlerDecoratorSupport
-
addFilePackaging
@NotNull public static @NotNull Function<ArtifactHandler,ArtifactHandler> addFilePackaging(File baseDirectory) A function that decoratesArtifactHandlerwith 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:
publishin interfaceArtifactHandler- Overrides:
publishin 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:RepublishingArtifactHandlerMethod 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:
republishin interfaceRepublishingArtifactHandler- Throws:
Exception
-
isRepublishingSupported
public boolean isRepublishingSupported()Description copied from interface:RepublishingArtifactHandlerIf republishing is really supported. Necessary because of handlers that wrap other handlers.- Specified by:
isRepublishingSupportedin 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:ArtifactHandlerRetrieve arbitraryArtifact. Artifact is found by the information in artifact parameter.- Specified by:
retrievein interfaceArtifactHandler- Overrides:
retrievein 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
-