com.atlassian.bamboo.plan.branch
Class BranchMonitoringConfigurationImpl

java.lang.Object
  extended by com.atlassian.bamboo.plan.branch.BranchMonitoringConfigurationImpl
All Implemented Interfaces:
ConvertibleFromConfig, OptionallyConvertibleFromConfig, BranchMonitoringConfiguration, Serializable

public class BranchMonitoringConfigurationImpl
extends Object
implements BranchMonitoringConfiguration

Keeps build plan specific plan branch monitoring settings.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.atlassian.bamboo.plan.branch.BranchMonitoringConfiguration
BRANCH_CREATION_CONFIG_KEY, BRANCHES_CUSTOM_CONFIG_KEY, BRANCHES_INACTIVITY_CLEAN_UP_PERIOD, BRANCHES_MATCHING_PATTERN_CONFIG_KEY, BRANCHES_MONITOR_PULL_REQUESTS_CONFIG_KEY, BRANCHES_NOTIFICATION_STRATEGY_CONFIG_KEY, DEFAULT_BRANCH_MATCH_NAME_PATTERN, DEFAULT_REMOVED_BRANCH_CLEAN_UP_PERIOD, DEFAULT_TIME_OF_INACTIVITY_DAYS, INACTIVE_BRANCH_CLEANUP_CONFIG_KEY, JIRA_BRANCH_LINKING_CONFIG_KEY, MINIMUM_INACTIVE_BRANCH_CLEAN_UP_PERIOD, MINIMUM_REMOVED_BRANCH_CLEAN_UP_PERIOD, PLAN_BRANCHES_MONITORING_ENABLED, REMOVED_BRANCH_CLEANUP_CONFIG_KEY, REMOVED_BRANCH_CLEANUP_PERIOD_CONFIG_KEY, REMOVED_BRANCH_DAILY_CLEAN_UP_PERIOD
 
Constructor Summary
BranchMonitoringConfigurationImpl()
           
 
Method Summary
 org.apache.commons.configuration.HierarchicalConfiguration getCustomConfiguration()
          Return custom configuration related to branch detection in the particular plan.
 BranchIntegrationConfiguration getDefaultBranchIntegrationConfiguration()
           
 BranchNotificationStrategy getDefaultBranchNotificationStrategy()
           
 int getInactiveBranchCleanUpPeriodInDays()
          Returns a number of days the branch will be consider inactive (as per no commits activity in the repo) and therefore deleted.
 String getMatchingPattern()
          Returns the reg expression every vcs branch name needs to match for Bamboo to automatically create a plan branch for it.
 int getRemovedBranchCleanUpPeriodInDays()
          Returns a number of days the plan branch will be deleted once detected the vcs branch has been removed.
 int getTimeOfInactivityInDays()
          Returns the period a branch is considered inactive, and therefore deleted given that inactive cleanup is enabled.
 boolean isCleanupEnabled()
          Returns if Bamboo is configured to automatically clean up plan branches.
 boolean isInactiveBranchCleanUpEnabled()
          Returns if Bamboo is configured to automatically clean up plan branches for branches that are considered inactive.
 boolean isMonitoringEnabled()
          Returns if Bamboo is configured to monitor plan branches when detecting new branches in the repo.
 boolean isPlanBranchCreationEnabled()
          Returns if Bamboo is configured to automatically create plan branches when detecting new branches in the repo.
 boolean isRemoteJiraBranchLinkingEnabled()
          Returns if Bamboo will attempt to create remote issue links in JIRA when it finds an issue key in the branch name.
 boolean isRemovedBranchCleanUpEnabled()
          Returns if Bamboo is configured to automatically clean up plan branches if the vcs branch is removed.
 boolean isValid()
          Is the object state valid after it has been initialised from properties.
 boolean monitorPullRequests()
          Currently Bamboo does not handle plan branch monitoring by Pull Requests detection.
 void populateFromConfig(org.apache.commons.configuration.HierarchicalConfiguration config)
          Update the current object with data in the HierarchicalConfiguration
 void setCustomConfiguration(org.apache.commons.configuration.HierarchicalConfiguration customConfiguration)
           
 void setDefaultBranchIntegrationConfiguration(BranchIntegrationConfiguration defaultBranchIntegrationConfiguration)
           
 void setDefaultBranchNotificationStrategy(BranchNotificationStrategy defaultBranchNotificationStrategy)
           
 void setInactiveBranchCleanUpEnabled(boolean enabled)
          Sets Bamboo to automatically cleanup plan branches if vcs branch is inactive.
 void setInactiveBranchCleanUpPeriodInDays(int inactiveBranchCleanUpPeriodInDays)
          Sets the number of days a plan branch will be consider inactive (as per no commits activity in the repo) and therefore deleted.
 void setMatchingPattern(String regularExpression)
          Sets the reg expression every vcs branch name will match for Bamboo to automatically create a plan branch for it.
 void setMonitoringEnabled(boolean enabled)
          Controls whether plan branches will be created when new branches are detected and whether inactive branches will be automatically removed.
 void setMonitorPullRequests(boolean monitorPullRequests)
          Currently Bamboo does not handle plan branch monitoring by Pull Requests detection.
 void setPlanBranchCreationEnabled(boolean isBranchCreationEnabled)
          Sets Bamboo to automatically create plan branches when detecting new branches in the repo.
 void setRemoteJiraBranchLinkingEnabled(boolean jiraBranchLinkingEnabled)
          Sets if Bamboo will attempt to create remote issue links in JIRA when it finds an issue key in the branch name.
 void setRemovedBranchCleanUpEnabled(boolean isAutomaticPlanBranchCleanUpEnabled)
          Sets Bamboo to automatically cleanup plan branches if vcs branch is deleted.
 void setRemovedBranchCleanUpPeriodInDays(int cleanUpPeriodInDays)
          Sets the number of days a plan branch will be deleted once detected the vcs branch is removed.
 void setTimeOfInactivityInDays(int timeOfInactivityInDays)
          Set inactivity cleanup period or turn inactivity cleanup off by passing 0.
 org.apache.commons.configuration.HierarchicalConfiguration toConfiguration()
          Generate a HierarchicalConfiguration from the current state of the object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BranchMonitoringConfigurationImpl

public BranchMonitoringConfigurationImpl()
Method Detail

isMonitoringEnabled

public boolean isMonitoringEnabled()
Description copied from interface: BranchMonitoringConfiguration
Returns if Bamboo is configured to monitor plan branches when detecting new branches in the repo. Pre 5.9, this monitoring was related to automatically create AND remove plan branches due to inactivity. As part of 5.9, we split up automatic creation from automatic clean up.

Specified by:
isMonitoringEnabled in interface BranchMonitoringConfiguration

setMonitoringEnabled

public void setMonitoringEnabled(boolean enabled)
Description copied from interface: BranchMonitoringConfiguration
Controls whether plan branches will be created when new branches are detected and whether inactive branches will be automatically removed. Pre 5.9, this monitoring was related to automatically create AND remove plan branches for inactive branches. As part of 5.9, we split up automatic creation from automatic clean up.

Specified by:
setMonitoringEnabled in interface BranchMonitoringConfiguration

isPlanBranchCreationEnabled

public boolean isPlanBranchCreationEnabled()
Description copied from interface: BranchMonitoringConfiguration
Returns if Bamboo is configured to automatically create plan branches when detecting new branches in the repo.

Specified by:
isPlanBranchCreationEnabled in interface BranchMonitoringConfiguration

isRemovedBranchCleanUpEnabled

public boolean isRemovedBranchCleanUpEnabled()
Description copied from interface: BranchMonitoringConfiguration
Returns if Bamboo is configured to automatically clean up plan branches if the vcs branch is removed. This will happen X days after the vcs branch been deleted, where X is an user configurable value that can be set in BranchMonitoringConfiguration.setRemovedBranchCleanUpPeriodInDays(int).

Specified by:
isRemovedBranchCleanUpEnabled in interface BranchMonitoringConfiguration

setPlanBranchCreationEnabled

public void setPlanBranchCreationEnabled(boolean isBranchCreationEnabled)
Description copied from interface: BranchMonitoringConfiguration
Sets Bamboo to automatically create plan branches when detecting new branches in the repo. Existing branches in the repo won't have a build, just the recently created ones.

Specified by:
setPlanBranchCreationEnabled in interface BranchMonitoringConfiguration
Parameters:
isBranchCreationEnabled - turns on / off this setting

setRemovedBranchCleanUpEnabled

public void setRemovedBranchCleanUpEnabled(boolean isAutomaticPlanBranchCleanUpEnabled)
Description copied from interface: BranchMonitoringConfiguration
Sets Bamboo to automatically cleanup plan branches if vcs branch is deleted.

Specified by:
setRemovedBranchCleanUpEnabled in interface BranchMonitoringConfiguration
Parameters:
isAutomaticPlanBranchCleanUpEnabled - turns on / off this setting

isInactiveBranchCleanUpEnabled

public boolean isInactiveBranchCleanUpEnabled()
Description copied from interface: BranchMonitoringConfiguration
Returns if Bamboo is configured to automatically clean up plan branches for branches that are considered inactive. This will happen if the vcs branch does not have commits for X days, where X is an user configurable value that can be set through BranchMonitoringConfiguration.setInactiveBranchCleanUpPeriodInDays(int).

Specified by:
isInactiveBranchCleanUpEnabled in interface BranchMonitoringConfiguration

setInactiveBranchCleanUpEnabled

public void setInactiveBranchCleanUpEnabled(boolean enabled)
Description copied from interface: BranchMonitoringConfiguration
Sets Bamboo to automatically cleanup plan branches if vcs branch is inactive.

Specified by:
setInactiveBranchCleanUpEnabled in interface BranchMonitoringConfiguration
Parameters:
enabled - turns on / off this setting

getMatchingPattern

public String getMatchingPattern()
Description copied from interface: BranchMonitoringConfiguration
Returns the reg expression every vcs branch name needs to match for Bamboo to automatically create a plan branch for it. This will happen only is automatic plan branch creation is on, which can be evaluated through BranchMonitoringConfiguration.isPlanBranchCreationEnabled().

Specified by:
getMatchingPattern in interface BranchMonitoringConfiguration
Returns:
regular expression for matching vcs branches

setMatchingPattern

public void setMatchingPattern(@NotNull
                               String regularExpression)
Description copied from interface: BranchMonitoringConfiguration
Sets the reg expression every vcs branch name will match for Bamboo to automatically create a plan branch for it. Setting this value won't turn automatic branch creation on, for this use BranchMonitoringConfiguration.setPlanBranchCreationEnabled(boolean).

Specified by:
setMatchingPattern in interface BranchMonitoringConfiguration
Parameters:
regularExpression - regular expression for the vcs branch name to match

isCleanupEnabled

public boolean isCleanupEnabled()
Description copied from interface: BranchMonitoringConfiguration
Returns if Bamboo is configured to automatically clean up plan branches. Pre 5.9, this clean up was just related to inactivity and would only happen if branch monitoring was on. Post 5.9, this clean up can either be due to inactivity or because the branch was deleted in the repository.

Specified by:
isCleanupEnabled in interface BranchMonitoringConfiguration

getTimeOfInactivityInDays

public int getTimeOfInactivityInDays()
Description copied from interface: BranchMonitoringConfiguration
Returns the period a branch is considered inactive, and therefore deleted given that inactive cleanup is enabled. If inactive cleanup is disabled, it returns 0.

Specified by:
getTimeOfInactivityInDays in interface BranchMonitoringConfiguration

setTimeOfInactivityInDays

public void setTimeOfInactivityInDays(int timeOfInactivityInDays)
Description copied from interface: BranchMonitoringConfiguration
Set inactivity cleanup period or turn inactivity cleanup off by passing 0.

Specified by:
setTimeOfInactivityInDays in interface BranchMonitoringConfiguration

getInactiveBranchCleanUpPeriodInDays

public int getInactiveBranchCleanUpPeriodInDays()
Description copied from interface: BranchMonitoringConfiguration
Returns a number of days the branch will be consider inactive (as per no commits activity in the repo) and therefore deleted.

Specified by:
getInactiveBranchCleanUpPeriodInDays in interface BranchMonitoringConfiguration
Returns:
number of days a vcs branch is consider to be inactive

setInactiveBranchCleanUpPeriodInDays

public void setInactiveBranchCleanUpPeriodInDays(int inactiveBranchCleanUpPeriodInDays)
Description copied from interface: BranchMonitoringConfiguration
Sets the number of days a plan branch will be consider inactive (as per no commits activity in the repo) and therefore deleted.

Specified by:
setInactiveBranchCleanUpPeriodInDays in interface BranchMonitoringConfiguration
Parameters:
inactiveBranchCleanUpPeriodInDays - number of days a vcs branch is considered to be inactive

getRemovedBranchCleanUpPeriodInDays

public int getRemovedBranchCleanUpPeriodInDays()
Description copied from interface: BranchMonitoringConfiguration
Returns a number of days the plan branch will be deleted once detected the vcs branch has been removed.

Specified by:
getRemovedBranchCleanUpPeriodInDays in interface BranchMonitoringConfiguration
Returns:
number of days a plan branch is considered to be deleted after

setRemovedBranchCleanUpPeriodInDays

public void setRemovedBranchCleanUpPeriodInDays(int cleanUpPeriodInDays)
Description copied from interface: BranchMonitoringConfiguration
Sets the number of days a plan branch will be deleted once detected the vcs branch is removed.

Specified by:
setRemovedBranchCleanUpPeriodInDays in interface BranchMonitoringConfiguration
Parameters:
cleanUpPeriodInDays - number of days a plan branch is considered to be removed after

monitorPullRequests

public boolean monitorPullRequests()
Description copied from interface: BranchMonitoringConfiguration
Currently Bamboo does not handle plan branch monitoring by Pull Requests detection. It does not work and it should not be used. We're keeping it as part of the interface to not break backwards compatibility, and in the case we do implement it in the future.

Specified by:
monitorPullRequests in interface BranchMonitoringConfiguration

setMonitorPullRequests

public void setMonitorPullRequests(boolean monitorPullRequests)
Description copied from interface: BranchMonitoringConfiguration
Currently Bamboo does not handle plan branch monitoring by Pull Requests detection. It does not work and it should not be used. We're keeping it as part of the interface to not break backwards compatibility, and in the case we do implement it in the future.

Specified by:
setMonitorPullRequests in interface BranchMonitoringConfiguration

getCustomConfiguration

@NotNull
public org.apache.commons.configuration.HierarchicalConfiguration getCustomConfiguration()
Description copied from interface: BranchMonitoringConfiguration
Return custom configuration related to branch detection in the particular plan. The custom configuration may hold for example "branchRootOverride" for the SvnRepositories. That custom configuration object is given to the Repository classes when detecting/creating new branches.

Specified by:
getCustomConfiguration in interface BranchMonitoringConfiguration
Returns:
the branch configuration of a plan

setCustomConfiguration

public void setCustomConfiguration(org.apache.commons.configuration.HierarchicalConfiguration customConfiguration)
Specified by:
setCustomConfiguration in interface BranchMonitoringConfiguration

getDefaultBranchNotificationStrategy

public BranchNotificationStrategy getDefaultBranchNotificationStrategy()
Specified by:
getDefaultBranchNotificationStrategy in interface BranchMonitoringConfiguration

setDefaultBranchNotificationStrategy

public void setDefaultBranchNotificationStrategy(BranchNotificationStrategy defaultBranchNotificationStrategy)
Specified by:
setDefaultBranchNotificationStrategy in interface BranchMonitoringConfiguration

getDefaultBranchIntegrationConfiguration

public BranchIntegrationConfiguration getDefaultBranchIntegrationConfiguration()
Specified by:
getDefaultBranchIntegrationConfiguration in interface BranchMonitoringConfiguration

setDefaultBranchIntegrationConfiguration

public void setDefaultBranchIntegrationConfiguration(BranchIntegrationConfiguration defaultBranchIntegrationConfiguration)
Specified by:
setDefaultBranchIntegrationConfiguration in interface BranchMonitoringConfiguration

isRemoteJiraBranchLinkingEnabled

public boolean isRemoteJiraBranchLinkingEnabled()
Description copied from interface: BranchMonitoringConfiguration
Returns if Bamboo will attempt to create remote issue links in JIRA when it finds an issue key in the branch name. Bamboo will always create the link from Bamboo to JIRA regardless of this setting.

Specified by:
isRemoteJiraBranchLinkingEnabled in interface BranchMonitoringConfiguration
Returns:
true if Bamboo should try to create remote issue links in JIRA

setRemoteJiraBranchLinkingEnabled

public void setRemoteJiraBranchLinkingEnabled(boolean jiraBranchLinkingEnabled)
Description copied from interface: BranchMonitoringConfiguration
Sets if Bamboo will attempt to create remote issue links in JIRA when it finds an issue key in the branch name. Bamboo will always create the link from Bamboo to JIRA regardless of this setting.

Specified by:
setRemoteJiraBranchLinkingEnabled in interface BranchMonitoringConfiguration
Parameters:
jiraBranchLinkingEnabled - enables/disables this setting

populateFromConfig

public void populateFromConfig(@NotNull
                               org.apache.commons.configuration.HierarchicalConfiguration config)
Description copied from interface: ConvertibleFromConfig
Update the current object with data in the HierarchicalConfiguration

Specified by:
populateFromConfig in interface ConvertibleFromConfig

isValid

public boolean isValid()
Description copied from interface: OptionallyConvertibleFromConfig
Is the object state valid after it has been initialised from properties.

Specified by:
isValid in interface OptionallyConvertibleFromConfig
Returns:

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
Returns:
Always returns an HierarchicalConfiguration. Never null


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.