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:

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:

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
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

  Click here to expand...
/**
 * 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

  Click here to expand...
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

/**
 * @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

/**
 * 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:

/**
 * @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:

/**
 * @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

/**
 * 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

    /**
     * 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

     /**
     * 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

    /**
     * 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

    /**
     * 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

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

OnceOffCapableRepository marker interface

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

   /**
     * 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

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

 /**
     * 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)

 /**
     * 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

   /**
     * 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

 /**
     * 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

  /**
     * 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)

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

LabelManager

Removed, unused.

    public List<Label> findLabelsByMatchingString(final String match, final String escapeChar)
Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport