com.atlassian.bamboo.build.strategy
Class CronTriggerBuildStrategy

java.lang.Object
  extended by com.atlassian.bamboo.build.strategy.AbstractBuildStrategy
      extended by com.atlassian.bamboo.build.strategy.AbstractQuartzStrategy
          extended by com.atlassian.bamboo.build.strategy.CronTriggerBuildStrategy
All Implemented Interfaces:
BuildStrategy, DeploymentProjectPlanUpdateAwareBuildStrategy, PlanDeletionAwareBuildStrategy, PlanKeyUpdateAwareBuildStrategy, QuartzStrategy, SourcePlanAwareBuildStrategy, BambooIdProvider, DeploymentTriggerBranchSelectionModeAwareBuildStrategy, ConvertibleFromConfig, java.io.Serializable

public class CronTriggerBuildStrategy
extends AbstractQuartzStrategy
implements DeploymentTriggerBranchSelectionModeAwareBuildStrategy, SourcePlanAwareBuildStrategy, DeploymentProjectPlanUpdateAwareBuildStrategy, PlanDeletionAwareBuildStrategy, PlanKeyUpdateAwareBuildStrategy

Build strategy specified by a cron expression

See Also:
Serialized Form

Field Summary
static java.lang.String CFG_BRANCH_SELECTION_MODE
           
static java.lang.String CFG_DEPLOYMENTS_MODE
           
static java.lang.String CFG_SOURCE_BRANCH
           
static java.lang.String CFG_SOURCE_PLAN
           
static java.lang.String KEY
           
 
Fields inherited from class com.atlassian.bamboo.build.strategy.AbstractQuartzStrategy
scheduler
 
Fields inherited from interface com.atlassian.bamboo.build.strategy.QuartzStrategy
BUILD_STRATEGY, REPOSITORY_CHANGE_JOB, TRIGGER_CONDITIONS_CONFIGURATION, TRIGGER_ID, TRIGGERED_OBJECT_ID, TRIGGERING_REPOSITORIES
 
Constructor Summary
CronTriggerBuildStrategy()
           
 
Method Summary
 void addDefaultValues(BuildConfiguration buildConfiguration)
           
protected  org.quartz.JobDetail createJobDetail(Triggerable triggerable, java.lang.String jobName)
           
 DeploymentTriggerBranchSelectionMode getBranchSelectionMode()
           
 java.lang.String getCronExpression()
           
 java.lang.String getDescription()
           
 java.lang.String getKey()
          A lowercase string key to identify the build strategy
 java.lang.String getName()
          Returns the display name of the strategy type.
 PlanKey getSourceBranch()
           
 PlanKey getSourcePlan()
           
 PlanKey getSourcePlanKey(Triggerable triggerable)
           
protected  java.lang.Class<? extends org.quartz.Job> getStrategyJob()
           
protected  org.quartz.Trigger getTrigger(Triggerable plan)
           
 java.lang.String getTriggerDetailsSummaryHtml(Triggerable triggerable, com.atlassian.core.i18n.I18nTextProvider i18nTextProvider)
           
 boolean isAffectedByPlanDeletion(PlanKey deletedPlanKey)
          Check if strategy will be affected when Plan is deleted.
 boolean isAffectedByPlanKeyUpdate(PlanKey originalPlanKey)
          Check if strategy will be affected when Plan's key will change
 void onDeploymentProjectPlanUpdate(ImmutableChain oldPlan, ImmutableChain newPlan)
           
 void populateFromConfig(org.apache.commons.configuration.HierarchicalConfiguration config)
          This method might be used in priority upgrade tasks so it should not use cachedPlanManager
 void setBranchSelectionMode(DeploymentTriggerBranchSelectionMode branchSelectionMode)
           
 void setCachedPlanManager(CachedPlanManager cachedPlanManager)
           
 void setCronExpression(java.lang.String cronExpression)
           
 void setEnvironmentTriggerService(EnvironmentTriggerService environmentTriggerService)
           
 void setSourceBranch(PlanKey sourceBranch)
           
 void setSourcePlan(PlanKey sourcePlan)
           
 void setTemplateRenderer(TemplateRenderer templateRenderer)
           
 void setTextProvider(com.atlassian.struts.TextProvider textProvider)
           
 org.apache.commons.configuration.HierarchicalConfiguration toConfiguration()
          Generate a HierarchicalConfiguration from the current state of the object
 void updatePlanKey(PlanKey originalPlanKey, PlanKey newPlanKey)
          Perform actual update of internal strategy state
 ErrorCollection validate(BuildConfiguration buildConfiguration)
          Takes in a BuildConfiguration and returns any errors possible
 void validateDeploymentProjectPlanUpdate(ImmutableChain oldPlan, ImmutableChain newPlan, Environment environment, java.util.List<EnvironmentTriggerValidationError> triggerValidationErrors)
           
 
Methods inherited from class com.atlassian.bamboo.build.strategy.AbstractQuartzStrategy
canTrigger, getScheduler, getUniqueId, init, initialiseJob, removeJob, setScheduler
 
Methods inherited from class com.atlassian.bamboo.build.strategy.AbstractBuildStrategy
getBuildStrategyManager, getId, getTextProvider, getTriggerConditionsConfiguration, getUserDescription, setId, setUserDescription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.bamboo.build.strategy.BuildStrategy
canTrigger, getTriggerConditionsConfiguration, getUserDescription, init, setId, setUserDescription
 
Methods inherited from interface com.atlassian.bamboo.core.BambooIdProvider
getId
 

Field Detail

KEY

public static final java.lang.String KEY
See Also:
Constant Field Values

CFG_DEPLOYMENTS_MODE

public static final java.lang.String CFG_DEPLOYMENTS_MODE
See Also:
Constant Field Values

CFG_BRANCH_SELECTION_MODE

public static final java.lang.String CFG_BRANCH_SELECTION_MODE
See Also:
Constant Field Values

CFG_SOURCE_PLAN

public static final java.lang.String CFG_SOURCE_PLAN
See Also:
Constant Field Values

CFG_SOURCE_BRANCH

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

CronTriggerBuildStrategy

public CronTriggerBuildStrategy()
Method Detail

getKey

public java.lang.String getKey()
Description copied from interface: BuildStrategy
A lowercase string key to identify the build strategy

Specified by:
getKey in interface BuildStrategy
Returns:
String must not be null

getName

public java.lang.String getName()
Description copied from interface: BuildStrategy
Returns the display name of the strategy type.

Specified by:
getName in interface BuildStrategy
Returns:
String must not be null

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface BuildStrategy
Overrides:
getDescription in class AbstractBuildStrategy

toConfiguration

@NotNull
public org.apache.commons.configuration.HierarchicalConfiguration toConfiguration()
Description copied from interface: ConvertibleFromConfig
Generate a HierarchicalConfiguration from the current state of the object

Specified by:
toConfiguration in interface ConvertibleFromConfig
Overrides:
toConfiguration in class AbstractBuildStrategy
Returns:
Always returns an HierarchicalConfiguration. Never null

populateFromConfig

public void populateFromConfig(@NotNull
                               org.apache.commons.configuration.HierarchicalConfiguration config)
This method might be used in priority upgrade tasks so it should not use cachedPlanManager

Specified by:
populateFromConfig in interface ConvertibleFromConfig
Overrides:
populateFromConfig in class AbstractBuildStrategy

addDefaultValues

public void addDefaultValues(BuildConfiguration buildConfiguration)
Specified by:
addDefaultValues in interface BuildStrategy
Overrides:
addDefaultValues in class AbstractBuildStrategy

validate

public ErrorCollection validate(BuildConfiguration buildConfiguration)
Description copied from interface: BuildStrategy
Takes in a BuildConfiguration and returns any errors possible

Specified by:
validate in interface BuildStrategy
Overrides:
validate in class AbstractBuildStrategy
Parameters:
buildConfiguration - not null
Returns:
ErrorCollection. must not be null

getStrategyJob

@NotNull
protected java.lang.Class<? extends org.quartz.Job> getStrategyJob()
Specified by:
getStrategyJob in class AbstractQuartzStrategy

getTrigger

@Nullable
protected org.quartz.Trigger getTrigger(@NotNull
                                                 Triggerable plan)
Specified by:
getTrigger in class AbstractQuartzStrategy

createJobDetail

protected org.quartz.JobDetail createJobDetail(@NotNull
                                               Triggerable triggerable,
                                               @NotNull
                                               java.lang.String jobName)
Overrides:
createJobDetail in class AbstractQuartzStrategy

isAffectedByPlanKeyUpdate

public boolean isAffectedByPlanKeyUpdate(@NotNull
                                         PlanKey originalPlanKey)
Description copied from interface: PlanKeyUpdateAwareBuildStrategy
Check if strategy will be affected when Plan's key will change

Specified by:
isAffectedByPlanKeyUpdate in interface PlanKeyUpdateAwareBuildStrategy
Parameters:
originalPlanKey - Plan key that is about to be changed
Returns:
true if object will require configuration update

updatePlanKey

public void updatePlanKey(@NotNull
                          PlanKey originalPlanKey,
                          @NotNull
                          PlanKey newPlanKey)
Description copied from interface: PlanKeyUpdateAwareBuildStrategy
Perform actual update of internal strategy state

Specified by:
updatePlanKey in interface PlanKeyUpdateAwareBuildStrategy
Parameters:
originalPlanKey - original value of plan key
newPlanKey - new value of plan key

isAffectedByPlanDeletion

public boolean isAffectedByPlanDeletion(@NotNull
                                        PlanKey deletedPlanKey)
Description copied from interface: PlanDeletionAwareBuildStrategy
Check if strategy will be affected when Plan is deleted.

Specified by:
isAffectedByPlanDeletion in interface PlanDeletionAwareBuildStrategy
Parameters:
deletedPlanKey - key of Plan that was deleted
Returns:
true if action needs to be taken when Plan is deleted

getTriggerDetailsSummaryHtml

@NotNull
public java.lang.String getTriggerDetailsSummaryHtml(@NotNull
                                                             Triggerable triggerable,
                                                             @NotNull
                                                             com.atlassian.core.i18n.I18nTextProvider i18nTextProvider)
Specified by:
getTriggerDetailsSummaryHtml in interface BuildStrategy
Overrides:
getTriggerDetailsSummaryHtml in class AbstractBuildStrategy
Returns:
html containing summary of the trigger in 'pretty' form

getBranchSelectionMode

@NotNull
public DeploymentTriggerBranchSelectionMode getBranchSelectionMode()
Specified by:
getBranchSelectionMode in interface DeploymentTriggerBranchSelectionModeAwareBuildStrategy

getSourcePlanKey

@Nullable
public PlanKey getSourcePlanKey(@NotNull
                                         Triggerable triggerable)
Specified by:
getSourcePlanKey in interface SourcePlanAwareBuildStrategy

validateDeploymentProjectPlanUpdate

public void validateDeploymentProjectPlanUpdate(@Nullable
                                                ImmutableChain oldPlan,
                                                @NotNull
                                                ImmutableChain newPlan,
                                                @NotNull
                                                Environment environment,
                                                @NotNull
                                                java.util.List<EnvironmentTriggerValidationError> triggerValidationErrors)
Specified by:
validateDeploymentProjectPlanUpdate in interface DeploymentProjectPlanUpdateAwareBuildStrategy

onDeploymentProjectPlanUpdate

public void onDeploymentProjectPlanUpdate(@Nullable
                                          ImmutableChain oldPlan,
                                          @NotNull
                                          ImmutableChain newPlan)
Specified by:
onDeploymentProjectPlanUpdate in interface DeploymentProjectPlanUpdateAwareBuildStrategy

setCachedPlanManager

public void setCachedPlanManager(CachedPlanManager cachedPlanManager)

setEnvironmentTriggerService

public void setEnvironmentTriggerService(EnvironmentTriggerService environmentTriggerService)

setTextProvider

public void setTextProvider(com.atlassian.struts.TextProvider textProvider)

setTemplateRenderer

public void setTemplateRenderer(TemplateRenderer templateRenderer)

getCronExpression

public java.lang.String getCronExpression()

setCronExpression

public void setCronExpression(java.lang.String cronExpression)

setBranchSelectionMode

public void setBranchSelectionMode(DeploymentTriggerBranchSelectionMode branchSelectionMode)

getSourceBranch

public PlanKey getSourceBranch()

setSourceBranch

public void setSourceBranch(PlanKey sourceBranch)

getSourcePlan

public PlanKey getSourcePlan()

setSourcePlan

public void setSourcePlan(PlanKey sourcePlan)


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