Last updatedMay 6, 2019

Bamboo API Changes for Bamboo 4.3

Change of Plan/ImmutablePlan inheritance

Inheritance change

Prior to Bamboo 4.3 all immutable Plan implementation classes implemented both immutable and mutable interfaces, ie:

1
2
3
4
5
6
7
8
9
public abstract class AbstractImmutablePlan implements Plan {...}

public class ImmutableJobImpl extends AbstractImmutablePlan implements Job {...}
 
public class AbstractImmutableChain extends AbstractImmutablePlan implements Chain {...}

public class ImmutableChainImpl extends AbstractImmutableChain implements TopLevelPlan {...}
 
public class ImmutableChainBranchImpl extends AbstractImmutableChain implements ChainBranch {...}

Now these definitions were changed, so immutable Plan implementation classes implement only immutable version of interfaces:

1
2
3
4
5
6
7
8
9
public abstract class AbstractImmutablePlan implements ImmutablePlan {...}

public class ImmutableJobImpl extends AbstractImmutablePlan implements ImmutableJob {...}
 
public class AbstractImmutableChain extends AbstractImmutablePlan implements ImmutableChain {...}

public class ImmutableChainImpl extends AbstractImmutableChain implements ImmutableTopLevelPlan {...}

public class ImmutableChainBranchImpl extends AbstractImmutableChain implements ImmutableChainBranch {...}

Some of our internal APIs accept and return immutable objects so plugin developers should revisit their code and start using immutable Plan interfaces wherever they're read-only from Plan. You should use mutable version of interfaces only when you explicitely modify/persist contents of Plan.

Testing if given Plan is Chain/Job

Plugin authors should not test if Plan is a Chain/Job with instanceof Chain/Job  anymore. We've added a small helper class that is dedicated for use in such cases:

c.a.b.plan.PlanClassHelper

1
2
3
4
5
6
7
8
public class PlanClassHelper
{
    public static boolean isChain(ImmutablePlan plan) {...}
    public static boolean isChainBranch(ImmutablePlan plan) {...}
    public static boolean isJob(ImmutablePlan plan) {...}
    public static boolean isTopLevelPlan(ImmutablePlan plan) {...}
    public static Predicate<? super ImmutablePlan> isTopLevelPlan() {...}
}

Removal of deprecated classes

c.a.b.resultsummary.ExtendedBuildResultsSummary

1
2
3
4
5
6
7
8
9
10
11
12
/**
 * Historic version of {@link BuildResultsSummary} that allowed access to {@link #getCommits()} for non-lucene (database) usages
 *
 * This is no longer needed as members {@link #getCommits()} and {@link #getChangesListSummary()} have been moved to {@link BuildResultsSummary}
 *
 * @deprecated since 2.7 use {@link BuildResultsSummary}
 */
@Internal
@Deprecated
public interface ExtendedBuildResultsSummary extends ResultsSummary
{
}

c.a.b.repository.RepositoryDefinitionEntity

1
2
3
4
5
6
7
8
9
10
package com.atlassian.bamboo.repository;
/**
 * Represents repository as persisted in the db.
 * @deprecated since 4.0 use {@link RepositoryDataEntity}
 */
@Deprecated
public interface RepositoryDefinitionEntity extends RepositoryDataEntity
{
 RepositoryDataEntity toRepositoryDataEntity();
}

Removal of deprecated methods and fields

c.a.b.build.fileserver.BuildDirectoryManager

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
 * @deprecated since 3.0 please use ${@link #getBuildWorkingDirectory(PlanKey)}
 * @param planKey
 * @return
 */
@Deprecated
File getBuildWorkingDirectory(String planKey);


/**
 * @deprecated since 3.0 please use ${@link #getWorkingDirectoryOfCurrentAgent()}
 */
@Deprecated
@Nullable
File getBuildWorkingDirectory();

c.a.b.configuration.AdministrationConfiguration

Removed methods deprecated since 3.1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
 * Get the value for a global variable
 * @param key of the variable to get value of.
 * @return the value of the global variable with the given key.
 * @deprecated since 3.1  use {@link VariableDefinitionManager} instead
 */
@Nullable
@Deprecated
public String getGlobalVariable(String key);
 
/**
 * Set a global variable
 * @param key of the variable
 * @param value of the variable
 * @deprecated since 3.1  use {@link VariableDefinitionManager} instead
 */
@Deprecated
public void setGlobalVariable(String key, String value);
 
/**
 * Remove a specific global variable.
 * @param key of the variable to remove
 * @deprecated since 3.1  use {@link VariableDefinitionManager} instead
 */
public void removeGlobalVariable(String key);

c.a.b.persister.file.FileBasedPersister

Removed deprecated fields:

1
2
3
4
5
6
7
8
9
10
11
12
/**
 * @deprecated since 4.0 use {@link #DEFAULT_BUILD_DIRECTORY}
 */
@Deprecated
public static final String DEFALT_BUILD_DIRECTORY = DEFAULT_BUILD_DIRECTORY;


/**
 * @deprecated since 4.0 use {@link #DEFAULT_CONFIG_DIRECTORY}
 */
@Deprecated
public static final String DEFALT_CONFIG_DIRECTORY = DEFAULT_CONFIG_DIRECTORY;

c.a.b.resultsummary.ResultsSummary

Removed deprecated methods:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
 * @return time when build finished
 * @deprecated Since 3.4 Use {@link #getBuildCompletedDate()}
 */
@Nullable
@Deprecated
Date getPlanCompletedDate();

/**
 * Sets the time when build finished.
 * @deprecated Since 3.4 Use {@link #setBuildCompletedDate(Date)}
 * @param completionDate
 */
@Deprecated
void setPlanCompletedDate(@NotNull Date completionDate);

c.a.b.setup.DbmsSpecificUtils

Removed methods deprecated since 3.3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/**
 * Checks whether given table contains the specified column.
 * @param connection
 * @param tableName
 * @param columnName
 * @return
 * @throws SQLException
 *
 * @deprecated since 3.3 Use {@link DbmsBean#isColumnPresent(Connection, String, String)}
 */
@Deprecated
public static boolean isColumnPresent(@NotNull final Connection connection, @NotNull final String tableName, @NotNull final String columnName) throws SQLException;

/**
 * Checks whether given table contains the specified column.
 * @param statement
 * @param tableName
 * @param columnName
 * @return
 * @throws SQLException
 *
 * @deprecated since 3.3 Use {@link DbmsBean#isColumnPresent(Statement, String, String)}
 */
@Deprecated
public static boolean isColumnPresent(@NotNull final Statement statement, @NotNull final String tableName, @NotNull final String columnName) throws SQLException;

/**
 * Checks whether given table is present in the database
 *
 * @param connection  connection used to verify DB table existence
 * @param tableName   name of DB table
 *
 * @return true  if database is accessible and table exists, false otherwise
 * @throws SQLException  if a database error occurs or connection is closed
 *
 * @deprecated since 3.3 Use {@link DbmsBean#isTablePresent(Connection, String)}
 */
@Deprecated
public static boolean isTablePresent(final Connection connection, final String tableName) throws SQLException;

/**
 * Checks whether given table is present in the database
 * 
 * @param statement
 * @param tableName
 * @return
 *
 * @deprecated since 3.3 Use {@link DbmsBean#isTablePresent(Statement, String)}
 */
@Deprecated
public static boolean isTablePresent(final Statement statement, final String tableName);

/**
 * Checks whether the db configured in Hibernate is HSQL
 * @return
 *
 * @deprecated since 3.3 Use {@link DbmsBean#isHsqldb()}
 */
@Deprecated
public boolean isHsqldb();

/**
 * Checks whether the db configured in Hibernate is MS SQL Server (international/standard)
 * @return
 *
 * @deprecated since 3.3 Use {@link DbmsBean#isMsSqlServer()}
 */
@Deprecated
public boolean isMsSqlServer();

/**
 * Checks whether the db configured in Hibernate is MySQL
 * @return
 *
 * @deprecated since 3.3 Use {@link DbmsBean#isMySql()}
 */
@Deprecated
public boolean isMySql();
 
/**
 * Checks whether the db configured in Hibernate is Oracle (8/9 dialect)
 * @return
 *
 * @deprecated since 3.3 Use {@link DbmsBean#isOracle()}
 */
@Deprecated
public boolean isOracle();

/**
 * Checks whether the db configured in Hibernate is PostgreSQL
 * @return
 *
 * @deprecated since 3.3 Use {@link DbmsBean#isPostgreSql()}
 */
@Deprecated
public boolean isPostgreSQL();

RepositoryAwareTaskConfigurator

Added

1
2
3
4
5
6
7
8
9
10
/**
 * Action taken if repository id changed, i.e. after repository is edited. Typically it should replace
 * old repository identifiers with corresponding new id.
 * 
 * @param taskDefinition definition of a Task
 * @param repositoryIdChanges mapping between old and new repository identifiers
 */
void handleRepositoryIdChanged(@NotNull final TaskDefinition taskDefinition,
                               @NotNull final Map<Long, Long> repositoryIdChanges);
 

Deprecated

1
2
3
4
5
6
7
8
9
10
11
12
 /**
 * Action taken if repository id changed, i.e. after repository is edited. Typically it should replace
 * old repository identifiers with corresponding new id.
 * @param taskDefinition definition of a Task
 * @param job
 * @param repositoryIdChanges mapping between old and new repository identifiers
 * @deprecated since 4.3 use {@link #handleRepositoryIdChanged(TaskDefinition, Map)}
 */
@Deprecated
void handleRepositoryIdChanged(@NotNull final TaskDefinition taskDefinition,
                               @NotNull final Job job,
                               @NotNull final Map<Long, Long> repositoryIdChanges);

TaskManager

Added

1
2
3
4
5
6
7
8
/**
 * Updates task configurations affected by repository edition.
 *
 * @param taskDefinition
 * @param repositoryIdChanges mapping between old and new repositories ids
 * @since 4.3
 */
void updateRepositoryIdsInTask(@NotNull TaskDefinition taskDefinition, @NotNull Map<Long, Long>repositoryIdChanges);

Deprecated

1
2
3
4
5
6
7
8
9
10
11
/**
 * Updates task configurations affected by repository edition.
 *
 * @param job
 * @param taskDefinition
 * @param repositoryIdChanges mapping between old and new repositories ids
 * @since 3.3
 * @deprecated since 4.3, use {@link #updateRepositoryIdsInTask(TaskDefinition, Map)}
 */
@Deprecated
void updateRepositoryIdsInTask(@NotNull Job job, @NotNull TaskDefinition taskDefinition, @NotNull Map<Long, Long>repositoryIdChanges);

Decorator Change

Decorator "helppage" has been removed use atl.popup instead

1
<meta name="decorator" content="atl.popup">

OnceOffCapableRepository marker interface

1
2
3
4
5
6
7
8
9
10
11
12
13
14
public interface OnceOffCapableRepository extends Repository
{
    /**
     * Collects the changes for the targetRevision.
     * This method is called only on server side (never on agent).
     *
     * @param planKey
     * @param targetRevision
     * @return A build changes object with the appropriate build changes (that is - with the single commit data relevant for targetRevision)
     * @throws RepositoryException if something goes wrong
     */
    @NotNull
    BuildRepositoryChanges collectChangesForRevision(@NotNull String planKey, @NotNull String targetRevision) throws RepositoryException;
}

BuildStrategy

Added

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
  * Name under which this instance of build strategy appears on Plan's list of triggers.
  * @since 4.3
  */
 @NotNull
 String getUserDescription();
 /**
  * @since 4.3
  * @param userDescription
  */
 void setUserDescription(@NotNull String userDescription);
 /**
  * Identifies this instance amongst Plan's triggers.
  * @since 4.3
  */
 long getId();
 /**
  * @since 4.3
  * @param id
  */
 void setId(long id);
 /**
  * @return configuration of Trigger Conditions associated with this trigger.
  * @since 4.3
  */
 Map<String, String> getTriggerConditionsConfiguration();

RepositoryAwareBuildStrategy marker interface

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package com.atlassian.bamboo.build.strategy;
import java.util.Set;
/**
 * Interface marking {@link BuildStrategy} that works with Source Repositories.
 */
public interface RepositoryAwareBuildStrategy extends BuildStrategy
{
    /**
     * Return a list of repository ids this trigger is configured for.
     * @return {@link Set} of {@link Long}
     */
    Set<Long> getTriggeringRepositories();
    /**
     * Set list of repository ids this trigger is configured for.
     * @param triggeringRepositories
     */
    void setTriggeringRepositories(final Set<Long> triggeringRepositories);
}

BuildDefinition

Added

1
2
3
4
5
6
7
8
9
10
11
12
/**
    * All automatic build triggers defined for this build. If this list is empty, Plan is only triggered manually or through dependencies.
    * @return {@link List} of {@link BuildStrategy}
    */
   @NotNull
   List<BuildStrategy> getBuildStrategies();
   /**
    * Replace existing list of triggers with a new one.
    * Setting null indicates that buildStrategies should be inherited from master chain.
    * @param buildStrategies {@link List} of {@link BuildStrategy}
    */
   void setBuildStrategies(@Nullable List<BuildStrategy> buildStrategies);

Removed (impossible to provide meaningful implementation for deprecated method)

1
2
3
4
5
6
7
8
9
10
11
12
13
/**
    * Returns to {@link BuildStrategy} that the user actually selects
    *
    * @return the selected {@link BuildStrategy}
    */
   @Override
   @NotNull
   BuildStrategy getBuildStrategy();
   /**
    * Set the strategy to override the default build strategy.
    * @param buildStrategy The next build strategy to use.
    */
   void setBuildStrategy(BuildStrategy buildStrategy);

BuildTriggerCondition

Added

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
  * This method should extract entire configuration of this plugin from {@link HierarchicalConfiguration} and
  * return it as map.
  * @param configuration a configuration
  * @return complete configuration of the plugin as a string map
  * @since 4.3
  */
 @NotNull
 Map<String, String> getConfigurationMap(@NotNull HierarchicalConfiguration configuration);

 /**
  * Use to indicate preference for whether this plugin things the plan should execute.  Whether
  * the build actually will execute will follow the above order
  *
  * @param plan the plan that will be executed
  * @param  configuration of the plugin as returned by {@link BuildTriggerCondition#getConfigurationMap(HierarchicalConfiguration)}
  * @return the execution preference of this plan, will be overridden if another plugin returns with a higher preference
  * @since 4.3
  */
 @NotNull
 ExecutionPreference getExecutionPreference(ImmutablePlan plan, Map<String, String> configuration);

Deprecated

1
2
3
4
5
6
7
8
9
10
11
/**
    * Use to indicate preference for whether this plugin things the plan should execute.  Whether
    * the build actually will execute will follow the above order
    *
    * @param plan the plan that will be executed
    * @return the execution preference of this plan, will be overridden if another plugin returns with a higher preference
    * @deprecated since 4.3 use {@link BuildTriggerCondition#getExecutionPreference(ImmutablePlan, Map)}
    */
   @NotNull
   @Deprecated
   ExecutionPreference getExecutionPreference(ImmutablePlan plan);

Deprecated

1
2
3
4
5
6
7
8
9
10
11
12
13
/**
   * This method should not be used outside of import/export and upgrade tasks.
   * @deprecated since 4.3. The information is now stored in configuration of {@link RepositoryAwareBuildStrategy}
   */
  @Deprecated
  boolean isBuildTrigger();
  /**
   * This method should not be used outside of import/export and upgrade tasks.
   * @deprecated since 4.3. The information is now stored in configuration of {@link RepositoryAwareBuildStrategy}
   * @param buildTrigger
   */
  @Deprecated
  void setBuildTrigger(final boolean buildTrigger);

RepositoryDefinition

Removed (impossible to provide meaningful implementation for deprecated method)

1
2
3
4
/**
 * Marks repositories used as build trigger as opposed to only being sources for changesets
 */
boolean isBuildTrigger();

LabelManager

Removed, unused.

1
public List<Label> findLabelsByMatchingString(final String match, final String escapeChar)