Class ArtifactHandlerDecoratorSupport
java.lang.Object
com.atlassian.bamboo.build.artifact.ArtifactHandlerDecoratorSupport
- All Implemented Interfaces:
ArtifactHandler,BambooPluginModule
- Direct Known Subclasses:
ArtifactHandlerPackagingDecorator
Allows to decorate an
ArtifactHandler by overwriting some of it's methods. By default all methods are
forwarded to the underlying ArtifactHandler returned by delegate().-
Field Summary
Fields inherited from interface com.atlassian.bamboo.build.artifact.ArtifactHandler
LAN_SPEED, LOCAL_SPEED, NEVER_ARCHIVE, WAN_SPEED -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor for use by subclasses. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanHandleArtifact(ArtifactDefinitionContext artifact, Map<String, String> artifactHandlersConfiguration) protected abstract @NotNull ArtifactHandlerdelegate()Returns the delegate instance that methods are forwarded to.@Nullable ArtifactLinkDataProvidergetArtifactLinkDataProvider(Artifact artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) @Nullable ArtifactLinkDataProvidergetArtifactLinkDataProvider(ArtifactLink artifactLink, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) longgetMaxUnarchivedFilesPerArtifact(@NotNull Map<String, String> artifactHandlersConfiguration) Returns the maximum number of files that can exist per artifact which will not be compressed and combined into a single archive.@NotNull ArtifactHandlerModuleDescriptorintReturn approximate transfer speed of this artifact handler in bytes per second for the specified configuration.booleanmoveArtifactToGlobalStorage(@NotNull Artifact artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Move artifact to a 'global storage'.@NotNull ArtifactHandlerPublishingResultpublish(@NotNull ResultKey resultKey, @NotNull ArtifactDefinitionContext artifact, @NotNull ArtifactPublishingConfig artifactPublishingConfig, @Nullable BuildLogger buildLogger) voidremoveAllArtifactsOfChain(@NotNull PlanKey planKey, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for all results of a single chain.voidremoveArtifactFromStorage(@NotNull Artifact artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for a single artifact.voidremoveArtifactFromStorage(@NotNull PlanResultKey planResultKey, @NotNull ImmutableArtifactDefinitionBase artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for a single artifact.voidremoveArtifactFromStorage(@NotNull ResultKey resultKey, @NotNull ImmutableArtifactDefinitionBase artifact, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for a single artifact.voidremoveArtifactsFromStorage(@NotNull PlanKey planKey, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for all results of a single chain or job.voidremoveArtifactsFromStorage(@NotNull PlanResultKey planResultKey, @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Removes artifact files for a single plan result.@NotNull ArtifactRetrievalStatusretrieve(@NotNull ResultKey clientKey, @NotNull Artifact artifact, @NotNull ArtifactSubscriptionContext artifactSubscription, @NotNull ArtifactRetrievalConfig artifactRetrievalConfig) Retrieve arbitraryArtifact.toString()
-
Constructor Details
-
ArtifactHandlerDecoratorSupport
protected ArtifactHandlerDecoratorSupport()Constructor for use by subclasses.
-
-
Method Details
-
delegate
Returns the delegate instance that methods are forwarded to. Subclasses should override this method to supply the instance being decorated. -
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- Throws:
Exception
-
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- 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
-
getSupportedAgents
- Specified by:
getSupportedAgentsin interfaceArtifactHandler
-
getModuleDescriptor
- Specified by:
getModuleDescriptorin interfaceArtifactHandler
-
canHandleArtifact
public boolean canHandleArtifact(ArtifactDefinitionContext artifact, Map<String, String> artifactHandlersConfiguration) - Specified by:
canHandleArtifactin interfaceArtifactHandler
-
getDefaultConfiguration
- Specified by:
getDefaultConfigurationin interfaceArtifactHandler
-
getSpeed
Description copied from interface:ArtifactHandlerReturn approximate transfer speed of this artifact handler in bytes per second for the specified configuration. Result of this method might be taken into account when deciding which artifact handler to use if multiple handlers are enabled.- Specified by:
getSpeedin interfaceArtifactHandler- Parameters:
artifactHandlersConfiguration- artifact handler configuration- Returns:
- approximate transfer speed in Bps, for example:
ArtifactHandler.LOCAL_SPEED,ArtifactHandler.LAN_SPEED,ArtifactHandler.WAN_SPEED
-
removeArtifactFromStorage
public void removeArtifactFromStorage(@NotNull @NotNull Artifact artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandlerRemoves artifact files for a single artifact.- Specified by:
removeArtifactFromStoragein interfaceArtifactHandler
-
removeArtifactFromStorage
public void removeArtifactFromStorage(@NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull ImmutableArtifactDefinitionBase artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandlerRemoves artifact files for a single artifact. Called when removingArtifactLinkShould not remove artifacts that were moved to global storage.- Specified by:
removeArtifactFromStoragein interfaceArtifactHandler
-
removeArtifactFromStorage
public void removeArtifactFromStorage(@NotNull @NotNull ResultKey resultKey, @NotNull @NotNull ImmutableArtifactDefinitionBase artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandlerRemoves artifact files for a single artifact. Called when removingArtifactLinkShould not remove artifacts that were moved to global storage.- Specified by:
removeArtifactFromStoragein interfaceArtifactHandler
-
removeArtifactsFromStorage
public void removeArtifactsFromStorage(@NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandlerRemoves artifact files for a single plan result. Called when removingResultsSummaryShould not remove artifacts that were moved to global storage.- Specified by:
removeArtifactsFromStoragein interfaceArtifactHandler
-
removeArtifactsFromStorage
public void removeArtifactsFromStorage(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandlerRemoves artifact files for all results of a single chain or job. Called when removingPlanCalling it for chain removes only the shared artifacts. Should not remove artifacts that were moved to global storage.- Specified by:
removeArtifactsFromStoragein interfaceArtifactHandler
-
removeAllArtifactsOfChain
public void removeAllArtifactsOfChain(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) Description copied from interface:ArtifactHandlerRemoves artifact files for all results of a single chain. Called when removingChainShould not remove artifacts that were moved to global storage.- Specified by:
removeAllArtifactsOfChainin interfaceArtifactHandler
-
moveArtifactToGlobalStorage
public boolean moveArtifactToGlobalStorage(@NotNull @NotNull Artifact artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) throws IOException Description copied from interface:ArtifactHandlerMove artifact to a 'global storage'. Artifacts in 'global storage' should only be removed whenArtifactHandler.removeArtifactFromStorage(Artifact, ArtifactHandlerConfigProvider)is called. It is not a requirement to physically move the files as long as the above contract is fulfilled.- Specified by:
moveArtifactToGlobalStoragein interfaceArtifactHandler- Returns:
- true if move successful
- Throws:
IOException
-
getArtifactLinkDataProvider
@Nullable public @Nullable ArtifactLinkDataProvider getArtifactLinkDataProvider(ArtifactLink artifactLink, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) - Specified by:
getArtifactLinkDataProviderin interfaceArtifactHandler
-
getArtifactLinkDataProvider
@Nullable public @Nullable ArtifactLinkDataProvider getArtifactLinkDataProvider(Artifact artifact, @NotNull @NotNull ArtifactHandlerConfigProvider artifactHandlerConfigProvider) - Specified by:
getArtifactLinkDataProviderin interfaceArtifactHandler
-
getMaxUnarchivedFilesPerArtifact
public long getMaxUnarchivedFilesPerArtifact(@NotNull @NotNull Map<String, String> artifactHandlersConfiguration) Description copied from interface:ArtifactHandlerReturns the maximum number of files that can exist per artifact which will not be compressed and combined into a single archive. If the threshold is exceeded, artifacts will be packaged into a single file before publishing.
ArtifactHandlerdoes not need to treat archived artifacts differently - from ArtifactHandler perspective the packaging is transparent. Artifact files will be compressed before invoking #publish method and decompressed after invoking #retrieve method.This method should return
ArtifactHandler.NEVER_ARCHIVEif packaging of artifacts is disabled, to always send files unarchived.- Specified by:
getMaxUnarchivedFilesPerArtifactin interfaceArtifactHandler- Parameters:
artifactHandlersConfiguration- artifact handler configuration- Returns:
- maximum number of files per artifact that should not be packaged into a single file
-
toString
-