Interface ArtifactSubscriptionManager

All Known Implementing Classes:
ArtifactSubscriptionManagerImpl

@PublicApi public interface ArtifactSubscriptionManager
  • Field Details

  • Method Details

    • findSubscription

      @Nullable @Nullable ArtifactSubscription findSubscription(long id)
      Get artifact definition of specified id
      Parameters:
      id - id of artifact subscription
      Returns:
      artifact definition of specified id or null if not found
    • findSubscriptionsOfPlan

      @NotNull @NotNull List<ArtifactSubscription> findSubscriptionsOfPlan(@NotNull @NotNull PlanIdentifier plan)
      Get list of artifact subscriptions associated with a plan
      Parameters:
      plan - plan which associated artifact subscriptions should be retrieved
      Returns:
      list of artifact subscriptions
    • findSubscriptionsPossibleForPlan

      @NotNull @NotNull List<ArtifactDefinition> findSubscriptionsPossibleForPlan(@NotNull @NotNull ImmutableJob job)
      Get list of chain level artifacts available for specified plan
      Parameters:
      job -
      Returns:
      list of available artifact definitions
    • findCurrentSubscriptionsForPlan

      @NotNull @NotNull List<ArtifactSubscription> findCurrentSubscriptionsForPlan(@NotNull @NotNull ImmutableJob producerJob)
      Get list of subscriptions existing in a chain for given artifact
      Parameters:
      producerJob -
      Returns:
      list of artifact subscriptions
    • prepareSubscriptionContexts

      @NotNull @NotNull List<ArtifactSubscriptionContext> prepareSubscriptionContexts(@NotNull @NotNull ImmutableJob job, @NotNull @NotNull BuildContext parentBuildContext, SecureToken secureToken)
      Parameters:
      job -
      parentBuildContext -
      secureToken -
      Returns:
    • removeArtifactSubscription

      void removeArtifactSubscription(@NotNull @NotNull ArtifactSubscription artifactSubscription)
      Remove artifact subscription.
      Parameters:
      artifactSubscription - ArtifactSubscription to be removed
    • removeArtifactSubscriptions

      void removeArtifactSubscriptions(@NotNull @NotNull Collection<ArtifactSubscription> artifactSubscriptions)
      Remove all artifact subscriptions in the collection.
      Parameters:
      artifactSubscriptions - collection of ArtifactSubscription to be removed
    • removeArtifactSubscriptionsOfPlan

      @Deprecated void removeArtifactSubscriptionsOfPlan(@NotNull @NotNull Plan plan)
      Deprecated.
      Remove all artifact subscriptions for a plan
    • removeArtifactSubscriptionsOfPlan

      void removeArtifactSubscriptionsOfPlan(@NotNull @NotNull ImmutablePlan plan)
      Remove all artifact subscriptions for a plan
    • saveArtifactSubscription

      void saveArtifactSubscription(@NotNull @NotNull ArtifactSubscription artifactSubscription)
      Save artifact subscription.
      Parameters:
      artifactSubscription - object to be saved
    • saveArtifactSubscriptions

      void saveArtifactSubscriptions(@NotNull @NotNull Collection<ArtifactSubscription> artifactSubscriptions)
      Save all artifact definitions in a collection.
      Parameters:
      artifactSubscriptions - collection of objects to be saved/updated
    • validateSubscriptions

      @NotNull @NotNull List<ArtifactSubscription> validateSubscriptions(@NotNull @NotNull ImmutableJob consumer, @NotNull @NotNull ImmutableChain chain, @NotNull @NotNull String stageName)
      Validate consumer artifact subscriptions against target chain and stage
      Parameters:
      consumer - job being consumer of artifact definitions
      chain - target chain
      stageName - target stage
      Returns:
      list of subscriptions that NOT satisfy
    • validateSubscribersForMovedJob

      @NotNull @NotNull List<ArtifactSubscription> validateSubscribersForMovedJob(@NotNull @NotNull ImmutableJob producer, @NotNull @NotNull ImmutableChainStage producerStage)
      Validate all consumer artifact subscriptions to the artifacts produced by a Job against target stage
      Parameters:
      producer - job being producer of the artifacts
      producerStage - target stage
      Returns:
      list of subscriptions that NOT satisfy
    • validateSubscriptionsForMovedJob

      @NotNull @NotNull List<ArtifactSubscription> validateSubscriptionsForMovedJob(@NotNull @NotNull ImmutableJob job, @NotNull @NotNull ImmutableChainStage targetStage)
      Validate all artifact subscriptions possibly affected by moving a job. Artifact subscriptions will be broken if the producer is moved down, or if the consumer is moved up. This validation will return all artifact subscriptions that will be broken.
      Parameters:
      job - job being moved
      targetStage - target stage
      Returns:
      list of ArtifactSubscription that won't qualify after the move
    • validateSubscriptionsForMovedStage

      @NotNull @NotNull List<ArtifactSubscription> validateSubscriptionsForMovedStage(@NotNull @NotNull ImmutableChainStage stage, int stageIndex)
      Validates all artifact subscriptions possibly affected by moving a stage. Artifact subscriptions will be broken if the producer is moved down, or if the consumer is moved up. This validation will return all artifact subscriptions that will be broken.
      Parameters:
      stage - stage being moved
      stageIndex - target stage index
      Returns:
      list of ArtifactSubscription that won't qualify after the move
    • isSubscriptionsValid

      boolean isSubscriptionsValid(@NotNull @NotNull Job consumer, @NotNull @NotNull Chain chain, @NotNull @NotNull String stageName)
      Shorter for of validateSubscriptions method
      Parameters:
      consumer - job being consumer of artifact definitions
      chain - target chain
      stageName - target stage
      Returns:
      true if all subscriptions are valid
    • saveConsumedSubscription

      void saveConsumedSubscription(@NotNull @NotNull ArtifactSubscriptionContext artifactSubscription, @NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull String artifactLinkType)
      Store consumed subscription. Method should be called when artifacts are physically transferred to the agent
      Parameters:
      artifactSubscription -
      planResultKey -
    • getConsumedSubscriptions

      @NotNull @NotNull Multimap<ResultsSummary,ConsumedSubscription> getConsumedSubscriptions(@NotNull @NotNull ResultsSummary resultsSummary)
      Returns list of ConsumedSubscription ordered by order of ResultsSummary execution. Artifacts whose producer does not exists are appended at the end, with null key.
      Parameters:
      resultsSummary - a job result
      Returns:
    • transformSubscriptions

      List<ArtifactSubscriptionSubstitutionAware> transformSubscriptions(@NotNull @NotNull List<ArtifactSubscription> subscriptions)
    • prepareArtifactDefinitionContexts

      @NotNull @NotNull List<ArtifactDefinitionContext> prepareArtifactDefinitionContexts(@NotNull @NotNull ImmutableJob job, @NotNull @NotNull BuildContext buildContext, SecureToken secureToken)
      Helps prepare the artifact definitions
      Parameters:
      job -
      buildContext -
      secureToken -
      Returns:
    • countSubscriptionsOfArtifact

      long countSubscriptionsOfArtifact(long artifactDefinitionId)
      Returns:
      amount of subscriptions existing for an artifact
      Since:
      7.1