com.atlassian.bamboo.build.artifact
Class AbstractArtifactManager

java.lang.Object
  extended by com.atlassian.bamboo.build.artifact.AbstractArtifactManager
All Implemented Interfaces:
ArtifactManager
Direct Known Subclasses:
LocalArtifactManager, RemoteArtifactManager

public abstract class AbstractArtifactManager
extends java.lang.Object
implements ArtifactManager


Field Summary
static java.lang.String ARTIFACT_SECURITY_TOKEN
           
 
Constructor Summary
AbstractArtifactManager(com.atlassian.plugin.PluginAccessor pluginAccessor, CustomVariableContext customVariableContext, AdministrationConfigurationAccessor administrationConfigurationAccessor)
           
 
Method Summary
static org.apache.tools.ant.types.FileSet createFileSet(java.io.File baseDirectory, ArtifactDefinitionContext artifact, boolean useRelativeLocation)
          Deprecated. since 4.2 use $ArtifactHandlingUtils.createFileSet()
protected  java.lang.Iterable<ArtifactHandler> getArtifactHandlers(ArtifactDefinitionContext artifact, java.util.Map<java.lang.String,java.lang.String> artifactHandlersConfiguration)
           
protected abstract  void markSubscriptionAsConsumed(PlanResultKey planResultKey, ArtifactSubscriptionContext artifactSubscription, java.lang.String linkType)
           
 void moveArtifactToGlobalStorage(Artifact artifact)
          Move artifact to a 'global storage'.
 boolean publish(BuildLogger buildLogger, PlanResultKey planResultKey, java.io.File baseDirectory, ArtifactDefinitionContext artifact, java.util.Map<java.lang.String,java.lang.String> artifactHandlerConfiguration, int minExpectedFilesCnt)
          Request copy of artifacts from a designated location to artifact storage.
 boolean publish(BuildLogger buildLogger, PlanResultKey planResultKey, java.io.File baseDirectory, ArtifactDefinitionContext artifact, java.util.Map<java.lang.String,java.lang.String> artifactHandlerConfiguration, java.util.Set<java.lang.String> successfulPublishers, int minExpectedFilesCnt)
          Request copy of artifacts from a designated location to artifact storage.
protected  boolean publishFileSet(PlanResultKey planResultKey, ArtifactDefinitionContext artifact, org.apache.tools.ant.types.FileSet sourceFileSet, java.util.Map<java.lang.String,java.lang.String> artifactHandlersConfiguration, java.util.Set<java.lang.String> publishers, BuildLogger buildLogger)
           
 void removeArtifactFromStorage(Artifact artifact)
          Removes artifact files for a single artifact.
 void removeArtifactFromStorage(PlanResultKey planResultKey, ImmutableArtifactDefinitionBase artifact)
          Removes artifact files for a single artifact.
 void removeArtifactsFromStorage(PlanKey planKey)
          Removes artifact files for all results of a single.
 void removeArtifactsFromStorage(PlanResultKey planResultKey)
          Removes artifact files for a single plan result.
 void removeOrphanedArtifacts()
           
 boolean retrieve(BuildLogger buildLogger, PlanResultKey planResultKey, ArtifactSubscriptionContext artifactSubscription, java.util.Map<java.lang.String,java.lang.String> artifactHandlersConfiguration, java.io.File buildWorkingDirectory)
          Retrieves a plan artifact from artifact storage.
 boolean retrieve(BuildLogger buildLogger, PlanResultKey planResultKey, ResultKey resultKey, ArtifactDefinitionContext artifactDefinitionContext, java.lang.String destinationPath, java.util.Map<java.lang.String,java.lang.String> artifactHandlersConfiguration, java.io.File buildWorkingDirectory, java.util.Map<java.lang.String,Artifact> versionArtifacts)
          Retrieves an artifact from artifact storage.
 ErrorCollection validateArtifactsSize(java.io.File baseDirectory, ArtifactContext artifactContext)
          Validates total size of artifacts produced for single build result
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARTIFACT_SECURITY_TOKEN

public static final java.lang.String ARTIFACT_SECURITY_TOKEN
See Also:
Constant Field Values
Constructor Detail

AbstractArtifactManager

public AbstractArtifactManager(com.atlassian.plugin.PluginAccessor pluginAccessor,
                               CustomVariableContext customVariableContext,
                               AdministrationConfigurationAccessor administrationConfigurationAccessor)
Method Detail

createFileSet

@Deprecated
@Nullable
public static org.apache.tools.ant.types.FileSet createFileSet(java.io.File baseDirectory,
                                                                                   ArtifactDefinitionContext artifact,
                                                                                   boolean useRelativeLocation)
Deprecated. since 4.2 use $ArtifactHandlingUtils.createFileSet()

Creates a FileSet object.

Parameters:
baseDirectory - directory used to resolve the copy patterns
artifact - artifact definition
useRelativeLocation - used to determine whether the relative location information from artifact definition should be used
Returns:
the created FileSet

publish

public boolean publish(@Nullable
                       BuildLogger buildLogger,
                       @NotNull
                       PlanResultKey planResultKey,
                       @NotNull
                       java.io.File baseDirectory,
                       @NotNull
                       ArtifactDefinitionContext artifact,
                       @NotNull
                       java.util.Map<java.lang.String,java.lang.String> artifactHandlerConfiguration,
                       int minExpectedFilesCnt)
Description copied from interface: ArtifactManager
Request copy of artifacts from a designated location to artifact storage.

Specified by:
publish in interface ArtifactManager
Parameters:
buildLogger - optional, used to log messages
planResultKey - key of a plan result that created the artifact
artifact - definition of the artifact
minExpectedFilesCnt - how many files are necessary to consider the artifact complete, null if no requirements are made
Returns:
true if publish operation result allows the build to continue

publish

public boolean publish(@Nullable
                       BuildLogger buildLogger,
                       @NotNull
                       PlanResultKey planResultKey,
                       @NotNull
                       java.io.File baseDirectory,
                       @NotNull
                       ArtifactDefinitionContext artifact,
                       @NotNull
                       java.util.Map<java.lang.String,java.lang.String> artifactHandlerConfiguration,
                       @NotNull
                       java.util.Set<java.lang.String> successfulPublishers,
                       int minExpectedFilesCnt)
Description copied from interface: ArtifactManager
Request copy of artifacts from a designated location to artifact storage.

Specified by:
publish in interface ArtifactManager
Parameters:
buildLogger - optional, used to log messages
planResultKey - key of a plan result that created the artifact
artifact - definition of the artifact
successfulPublishers - used to return a list of plugin keys for ArtifactHandlers that succesfully published artifacts
minExpectedFilesCnt - how many files are necessary to consider the artifact complete, null if no requirements are made
Returns:
true if publish operation result allows the build to continue

validateArtifactsSize

public final ErrorCollection validateArtifactsSize(@NotNull
                                                   java.io.File baseDirectory,
                                                   @NotNull
                                                   ArtifactContext artifactContext)
Description copied from interface: ArtifactManager
Validates total size of artifacts produced for single build result

Specified by:
validateArtifactsSize in interface ArtifactManager
artifactContext - contains artifacts size quota if set
Returns:
error set in in case of exceeding quota if set

publishFileSet

protected boolean publishFileSet(PlanResultKey planResultKey,
                                 ArtifactDefinitionContext artifact,
                                 org.apache.tools.ant.types.FileSet sourceFileSet,
                                 java.util.Map<java.lang.String,java.lang.String> artifactHandlersConfiguration,
                                 java.util.Set<java.lang.String> publishers,
                                 BuildLogger buildLogger)

retrieve

public boolean retrieve(@Nullable
                        BuildLogger buildLogger,
                        @NotNull
                        PlanResultKey planResultKey,
                        @NotNull
                        ArtifactSubscriptionContext artifactSubscription,
                        @NotNull
                        java.util.Map<java.lang.String,java.lang.String> artifactHandlersConfiguration,
                        @NotNull
                        java.io.File buildWorkingDirectory)
Description copied from interface: ArtifactManager
Retrieves a plan artifact from artifact storage.

Specified by:
retrieve in interface ArtifactManager
Parameters:
buildLogger - to use
planResultKey - the plan result that contains the artifact
artifactSubscription - the artifact subscription used to identify artifact
buildWorkingDirectory - working directory of current build
Returns:
true if retrieval was successful, false otherwise

retrieve

public boolean retrieve(@Nullable
                        BuildLogger buildLogger,
                        @NotNull
                        PlanResultKey planResultKey,
                        @NotNull
                        ResultKey resultKey,
                        @NotNull
                        ArtifactDefinitionContext artifactDefinitionContext,
                        @NotNull
                        java.lang.String destinationPath,
                        @NotNull
                        java.util.Map<java.lang.String,java.lang.String> artifactHandlersConfiguration,
                        @NotNull
                        java.io.File buildWorkingDirectory,
                        @Nullable
                        java.util.Map<java.lang.String,Artifact> versionArtifacts)
Description copied from interface: ArtifactManager
Retrieves an artifact from artifact storage. The important difference for that method is, that NO subscription information is updated. Useful for retrieving artifacts in non standard way (cross-plan for example) If versionArtifacts parameter is specified, the method will first try to match requested artifact with the content of the map. If match is found, information in Artifact object will be used to find artifact in the storage.

Specified by:
retrieve in interface ArtifactManager
Returns:

markSubscriptionAsConsumed

protected abstract void markSubscriptionAsConsumed(PlanResultKey planResultKey,
                                                   ArtifactSubscriptionContext artifactSubscription,
                                                   java.lang.String linkType)

getArtifactHandlers

protected java.lang.Iterable<ArtifactHandler> getArtifactHandlers(ArtifactDefinitionContext artifact,
                                                                  java.util.Map<java.lang.String,java.lang.String> artifactHandlersConfiguration)

removeArtifactFromStorage

public void removeArtifactFromStorage(@NotNull
                                      PlanResultKey planResultKey,
                                      @NotNull
                                      ImmutableArtifactDefinitionBase artifact)
Description copied from interface: ArtifactManager
Removes artifact files for a single artifact.

Specified by:
removeArtifactFromStorage in interface ArtifactManager

removeArtifactsFromStorage

public void removeArtifactsFromStorage(@NotNull
                                       PlanResultKey planResultKey)
Description copied from interface: ArtifactManager
Removes artifact files for a single plan result. Called when removing ResultsSummary Should not remove artifacts that were moved to global storage.

Specified by:
removeArtifactsFromStorage in interface ArtifactManager

removeArtifactsFromStorage

public void removeArtifactsFromStorage(@NotNull
                                       PlanKey planKey)
Description copied from interface: ArtifactManager
Removes artifact files for all results of a single. Called when removing Plan Should not remove artifacts that were moved to global storage.

Specified by:
removeArtifactsFromStorage in interface ArtifactManager

removeArtifactFromStorage

public void removeArtifactFromStorage(@NotNull
                                      Artifact artifact)
Description copied from interface: ArtifactManager
Removes artifact files for a single artifact.

Specified by:
removeArtifactFromStorage in interface ArtifactManager

moveArtifactToGlobalStorage

public void moveArtifactToGlobalStorage(@NotNull
                                        Artifact artifact)
Description copied from interface: ArtifactManager
Move artifact to a 'global storage'. Artifacts in 'global storage' should only be removed when ArtifactManager.removeArtifactFromStorage(Artifact) is called. It is not a requirement to physically move the files as long as the above contract is fulfilled.

Specified by:
moveArtifactToGlobalStorage in interface ArtifactManager

removeOrphanedArtifacts

public void removeOrphanedArtifacts()
Specified by:
removeOrphanedArtifacts in interface ArtifactManager


Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.