com.atlassian.bamboo.plan.artifact
Class ArtifactSubscriptionManagerImpl

java.lang.Object
  extended by com.atlassian.bamboo.plan.artifact.ArtifactSubscriptionManagerImpl
All Implemented Interfaces:
ArtifactSubscriptionManager

public class ArtifactSubscriptionManagerImpl
extends java.lang.Object
implements ArtifactSubscriptionManager


Field Summary
 
Fields inherited from interface com.atlassian.bamboo.plan.artifact.ArtifactSubscriptionManager
BAMBOO_ARTIFACTS_PATH_VARIABLE
 
Constructor Summary
ArtifactSubscriptionManagerImpl(ArtifactDefinitionManager artifactDefinitionManager, ArtifactSubscriptionDao artifactSubscriptionDao, ConsumedSubscriptionDao consumedSubscriptionDao, ArtifactLinkDao artifactLinkDao, ResultsSummaryManager resultsSummaryManager, SecureTokenService secureTokenService)
           
 
Method Summary
 java.util.List<ArtifactSubscription> findCurrentSubscriptionsForPlan(Job producerJob)
          Get list of subscriptions existing in a chain for given artifact
 ArtifactSubscription findSubscription(long id)
          Get artifact definition of specified id
 java.util.List<ArtifactSubscription> findSubscriptionsOfPlan(Plan plan)
          Get list of artifact subscriptions associated with a plan
 java.util.List<ArtifactDefinition> findSubscriptionsPossibleForPlan(Job job)
          Get list of chain level artifacts available for specified plan
 com.google.common.collect.Multimap<ResultsSummary,ConsumedSubscription> getConsumedSubscriptions(ResultsSummary resultsSummary)
          Returns list of ConsumedSubscription ordered by order of ResultsSummary execution.
 boolean isSubscriptionsValid(Job consumer, Chain chain, java.lang.String stageName)
          Shorter for of validateSubscriptions method
 java.util.List<ArtifactSubscriptionContext> prepareSubscriptionContexts(ImmutableJob job, PlanResultKey chainResultKey)
           
 void removeArtifactSubscription(ArtifactSubscription artifactSubscription)
          Remove artifact subscription.
 void removeArtifactSubscriptions(java.util.Collection<ArtifactSubscription> artifactSubscriptions)
          Remove all artifact subscriptions in the collection.
 void removeArtifactSubscriptionsOfPlan(Plan plan)
          Remove all artifact subscriptions for a plan
 void saveArtifactSubscription(ArtifactSubscription artifactSubscription)
          Save artifact subscription.
 void saveArtifactSubscriptions(java.util.Collection<ArtifactSubscription> artifactSubscriptions)
          Save all artifact definitions in a collection.
 void saveConsumedSubscription(ArtifactSubscriptionContext artifactSubscription, PlanResultKey planResultKey)
          Store consumed subscription.
 java.util.List<ArtifactSubscriptionSubstitutionAware> transformSubscriptions(java.util.List<ArtifactSubscription> subscriptions)
           
 java.util.List<ArtifactSubscription> validateSubscribersForMovedJob(Job producer, ChainStage destinationStage)
          Validate all consumer artifact subscriptions to the artifacts produced by a Job against target stage
 java.util.List<ArtifactSubscription> validateSubscriptions(Job consumer, Chain chain, java.lang.String stageName)
          Validate consumer artifact subscriptions against target chain and stage
 java.util.List<ArtifactSubscription> validateSubscriptionsForMovedStage(ChainStage movedStage, int stageIndexAfterMove)
          Validate all consumer artifact subscriptions possibly affected by moving of stage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArtifactSubscriptionManagerImpl

public ArtifactSubscriptionManagerImpl(ArtifactDefinitionManager artifactDefinitionManager,
                                       ArtifactSubscriptionDao artifactSubscriptionDao,
                                       ConsumedSubscriptionDao consumedSubscriptionDao,
                                       ArtifactLinkDao artifactLinkDao,
                                       ResultsSummaryManager resultsSummaryManager,
                                       SecureTokenService secureTokenService)
Method Detail

findSubscription

public ArtifactSubscription findSubscription(long id)
Description copied from interface: ArtifactSubscriptionManager
Get artifact definition of specified id

Specified by:
findSubscription in interface ArtifactSubscriptionManager
Parameters:
id - id of artifact subscription
Returns:
artifact definition of specified id or null if not found

findSubscriptionsOfPlan

@NotNull
public java.util.List<ArtifactSubscription> findSubscriptionsOfPlan(@NotNull
                                                                            Plan plan)
Description copied from interface: ArtifactSubscriptionManager
Get list of artifact subscriptions associated with a plan

Specified by:
findSubscriptionsOfPlan in interface ArtifactSubscriptionManager
Parameters:
plan - plan which associated artifact subscriptions should be retrieved
Returns:
list of artifact subscriptions

transformSubscriptions

public java.util.List<ArtifactSubscriptionSubstitutionAware> transformSubscriptions(@NotNull
                                                                                    java.util.List<ArtifactSubscription> subscriptions)
Specified by:
transformSubscriptions in interface ArtifactSubscriptionManager

findSubscriptionsPossibleForPlan

@NotNull
public java.util.List<ArtifactDefinition> findSubscriptionsPossibleForPlan(@NotNull
                                                                                   Job job)
Description copied from interface: ArtifactSubscriptionManager
Get list of chain level artifacts available for specified plan

Specified by:
findSubscriptionsPossibleForPlan in interface ArtifactSubscriptionManager
Returns:
list of available artifact definitions

findCurrentSubscriptionsForPlan

@NotNull
public java.util.List<ArtifactSubscription> findCurrentSubscriptionsForPlan(@NotNull
                                                                                    Job producerJob)
Description copied from interface: ArtifactSubscriptionManager
Get list of subscriptions existing in a chain for given artifact

Specified by:
findCurrentSubscriptionsForPlan in interface ArtifactSubscriptionManager

validateSubscribersForMovedJob

@NotNull
public java.util.List<ArtifactSubscription> validateSubscribersForMovedJob(@NotNull
                                                                                   Job producer,
                                                                                   @NotNull
                                                                                   ChainStage destinationStage)
Description copied from interface: ArtifactSubscriptionManager
Validate all consumer artifact subscriptions to the artifacts produced by a Job against target stage

Specified by:
validateSubscribersForMovedJob in interface ArtifactSubscriptionManager
Parameters:
producer - job being producer of the artifacts
destinationStage - target stage
Returns:
list of subscriptions that NOT satisfy

validateSubscriptions

@NotNull
public java.util.List<ArtifactSubscription> validateSubscriptions(@NotNull
                                                                          Job consumer,
                                                                          @NotNull
                                                                          Chain chain,
                                                                          @NotNull
                                                                          java.lang.String stageName)
Description copied from interface: ArtifactSubscriptionManager
Validate consumer artifact subscriptions against target chain and stage

Specified by:
validateSubscriptions in interface ArtifactSubscriptionManager
Parameters:
consumer - job being consumer of artifact definitions
chain - target chain
stageName - target stage
Returns:
list of subscriptions that NOT satisfy

validateSubscriptionsForMovedStage

@NotNull
public java.util.List<ArtifactSubscription> validateSubscriptionsForMovedStage(@NotNull
                                                                                       ChainStage movedStage,
                                                                                       int stageIndexAfterMove)
Description copied from interface: ArtifactSubscriptionManager
Validate all consumer artifact subscriptions possibly affected by moving of stage.

Specified by:
validateSubscriptionsForMovedStage in interface ArtifactSubscriptionManager
Parameters:
movedStage - stage being moved
stageIndexAfterMove - target stage index
Returns:
list of subscriptions that NOT satisfy

isSubscriptionsValid

public boolean isSubscriptionsValid(@NotNull
                                    Job consumer,
                                    @NotNull
                                    Chain chain,
                                    @NotNull
                                    java.lang.String stageName)
Description copied from interface: ArtifactSubscriptionManager
Shorter for of validateSubscriptions method

Specified by:
isSubscriptionsValid in interface ArtifactSubscriptionManager
Parameters:
consumer - job being consumer of artifact definitions
chain - target chain
stageName - target stage
Returns:
true if all subscriptions are valid

prepareSubscriptionContexts

@NotNull
public java.util.List<ArtifactSubscriptionContext> prepareSubscriptionContexts(@NotNull
                                                                                       ImmutableJob job,
                                                                                       @NotNull
                                                                                       PlanResultKey chainResultKey)
Specified by:
prepareSubscriptionContexts in interface ArtifactSubscriptionManager
Returns:

removeArtifactSubscription

public void removeArtifactSubscription(@NotNull
                                       ArtifactSubscription artifactSubscription)
Description copied from interface: ArtifactSubscriptionManager
Remove artifact subscription.

Specified by:
removeArtifactSubscription in interface ArtifactSubscriptionManager
Parameters:
artifactSubscription - ArtifactSubscription to be removed

removeArtifactSubscriptions

public void removeArtifactSubscriptions(@NotNull
                                        java.util.Collection<ArtifactSubscription> artifactSubscriptions)
Description copied from interface: ArtifactSubscriptionManager
Remove all artifact subscriptions in the collection.

Specified by:
removeArtifactSubscriptions in interface ArtifactSubscriptionManager
Parameters:
artifactSubscriptions - collection of ArtifactSubscription to be removed

removeArtifactSubscriptionsOfPlan

public void removeArtifactSubscriptionsOfPlan(@NotNull
                                              Plan plan)
Description copied from interface: ArtifactSubscriptionManager
Remove all artifact subscriptions for a plan

Specified by:
removeArtifactSubscriptionsOfPlan in interface ArtifactSubscriptionManager

saveArtifactSubscription

public void saveArtifactSubscription(@NotNull
                                     ArtifactSubscription artifactSubscription)
Description copied from interface: ArtifactSubscriptionManager
Save artifact subscription.

Specified by:
saveArtifactSubscription in interface ArtifactSubscriptionManager
Parameters:
artifactSubscription - object to be saved

saveArtifactSubscriptions

public void saveArtifactSubscriptions(@NotNull
                                      java.util.Collection<ArtifactSubscription> artifactSubscriptions)
Description copied from interface: ArtifactSubscriptionManager
Save all artifact definitions in a collection.

Specified by:
saveArtifactSubscriptions in interface ArtifactSubscriptionManager
Parameters:
artifactSubscriptions - collection of objects to be saved/updated

saveConsumedSubscription

public void saveConsumedSubscription(@NotNull
                                     ArtifactSubscriptionContext artifactSubscription,
                                     @NotNull
                                     PlanResultKey planResultKey)
Description copied from interface: ArtifactSubscriptionManager
Store consumed subscription. Method should be called when artifacts are physically transferred to the agent

Specified by:
saveConsumedSubscription in interface ArtifactSubscriptionManager

getConsumedSubscriptions

@NotNull
public com.google.common.collect.Multimap<ResultsSummary,ConsumedSubscription> getConsumedSubscriptions(@NotNull
                                                                                                                ResultsSummary resultsSummary)
Description copied from interface: ArtifactSubscriptionManager
Returns list of ConsumedSubscription ordered by order of ResultsSummary execution. Artifacts whose producer does not exists are appended at the end, with null key.

Specified by:
getConsumedSubscriptions in interface ArtifactSubscriptionManager
Parameters:
resultsSummary - a job result
Returns:


Copyright © 2012 Atlassian. All Rights Reserved.