Class LegacyBranchDetector
- java.lang.Object
-
- com.atlassian.bamboo.vcs.configuration.legacy.LegacyExecutorBase
-
- com.atlassian.bamboo.vcs.configuration.legacy.LegacyBranchDetector
-
- All Implemented Interfaces:
IdentifyingExecutor<VcsBranchDetector>
,VcsBranchDetector
public class LegacyBranchDetector extends LegacyExecutorBase implements VcsBranchDetector
-
-
Field Summary
-
Fields inherited from class com.atlassian.bamboo.vcs.configuration.legacy.LegacyExecutorBase
repositoryModuleDescriptor
-
-
Constructor Summary
Constructors Constructor Description LegacyBranchDetector(RepositoryModuleDescriptor repositoryModuleDescriptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable CommitContext
getFirstCommit(@NotNull VcsRepositoryData repositoryData)
Retrieve the commit that created the Branch (if that information is possible to retrieve)@NotNull CommitContext
getLastCommit(@NotNull VcsRepositoryData repositoryData)
Retrieve last commit on the branch set on this Repository.@NotNull List<VcsBranch>
getOpenBranches(@NotNull VcsRepositoryData repositoryData)
Set
of open branches that are discovered in the repository.@Nullable ContextualVcsId<VcsBranchDetector>
getVcsIdForExecutor(@NotNull VcsRepositoryData repositoryData)
Returned id has to fulfill the following: Given two VcsRepositoryData objects A and B, and executor e returning equal ContextualVcsId (in terms of equals()), for any operation foo() provided by the executor, the calls e::foo(A) and e::foo(B) should be equivalent.boolean
usePollingForBranchDetection(@NotNull VcsRepositoryData repositoryData)
Check if for specific repository configuration Bamboo needs to actively poll in order to detect new/deleted branches.-
Methods inherited from class com.atlassian.bamboo.vcs.configuration.legacy.LegacyExecutorBase
getNewRepositoryInstance, getNewRepositoryInstanceAs, getRepositoryInstance, getRepositoryInstanceAs, xmlToConfiguration
-
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.vcs.runtime.VcsBranchDetector
getFirstCommitApproximation
-
-
-
-
Constructor Detail
-
LegacyBranchDetector
public LegacyBranchDetector(RepositoryModuleDescriptor repositoryModuleDescriptor)
-
-
Method Detail
-
getOpenBranches
@NotNull public @NotNull List<VcsBranch> getOpenBranches(@NotNull @NotNull VcsRepositoryData repositoryData) throws RepositoryException
Description copied from interface:VcsBranchDetector
Set
of open branches that are discovered in the repository. Returns empty collection if no branches at all (can that happen?). Used for monitoring repositories for new branches. An open branch is a branch that is considered 'open' by underlying VCS - it has nothing to do with the actual development on that branch (recent commits or so).- Specified by:
getOpenBranches
in interfaceVcsBranchDetector
- Returns:
List
of branch names. May be empty.- Throws:
RepositoryException
-
getLastCommit
@NotNull public @NotNull CommitContext getLastCommit(@NotNull @NotNull VcsRepositoryData repositoryData) throws RepositoryException
Description copied from interface:VcsBranchDetector
Retrieve last commit on the branch set on this Repository. Method is used by Chain Branch automatic expiry. If this method returns null Chain Branch is not expired.- Specified by:
getLastCommit
in interfaceVcsBranchDetector
- Returns:
- the last commit
- Throws:
RepositoryException
-
getFirstCommit
@Nullable public @Nullable CommitContext getFirstCommit(@NotNull @NotNull VcsRepositoryData repositoryData) throws RepositoryException
Description copied from interface:VcsBranchDetector
Retrieve the commit that created the Branch (if that information is possible to retrieve)- Specified by:
getFirstCommit
in interfaceVcsBranchDetector
- Returns:
- the first commit to the branch or null if N/A.
- Throws:
RepositoryException
-
usePollingForBranchDetection
public boolean usePollingForBranchDetection(@NotNull @NotNull VcsRepositoryData repositoryData)
Description copied from interface:VcsBranchDetector
Check if for specific repository configuration Bamboo needs to actively poll in order to detect new/deleted branches. If this method returns true, Bamboo will periodically contact the remote repository in order to update list of known branches. Return false if repository is capable of creating Bamboo Plan Branches using one of available "push" method, e.g. REST resource, remote event.- Specified by:
usePollingForBranchDetection
in interfaceVcsBranchDetector
- Returns:
-
getVcsIdForExecutor
@Nullable public @Nullable ContextualVcsId<VcsBranchDetector> getVcsIdForExecutor(@NotNull @NotNull VcsRepositoryData repositoryData)
Description copied from interface:IdentifyingExecutor
Returned id has to fulfill the following: Given two VcsRepositoryData objects A and B, and executor e returning equal ContextualVcsId (in terms of equals()), for any operation foo() provided by the executor, the calls e::foo(A) and e::foo(B) should be equivalent. To be more precise: given any time point t and any variable context v, calling a::foo(A) should yield the same results as calling e::foo(B). Given the above it follows that - calculation of the id should take into account global and plan variables. This means, that calling this method on the same object in different variable context can (possibly must) yield different results. - equal ids need not (and should not) guarantee equal call results over indefinite time. In particular, result of e:foo(A).equals(e::foo(A)) is allowed to be false, since 2 calls to e::foo(A) do not happen at the same time. Example: 2 git repositories with the same url and credentials are considered equal in context ofVcsBranchDetector
. If they also point to the same branch, they are considered equal in context ofVcsChangeDetector
- Specified by:
getVcsIdForExecutor
in interfaceIdentifyingExecutor<VcsBranchDetector>
- Returns:
- the id of repository, can be null if no feasible identification algorithm exists
-
-