public abstract class

AbstractScm

extends Object
implements Scm
java.lang.Object
   ↳ com.atlassian.bitbucket.scm.AbstractScm

Class Overview

Convenience implementation of Scm that returns null for all of the optional contract members. Required members have no default implementation.

Derived classes should provide their supported ScmFeature features to the constructor. The nullary constructor assumes the SCM doesn't support any of the optional features.

SCM implementors are strongly encouraged to use this base class for their Scm implementation. As new features are added SCMs built on this base class will better retain cross-version support because it will provide null implementations of new optional members.

Summary

Protected Constructors
AbstractScm()
AbstractScm(Set<ScmFeature> features)
Public Methods
PluginCommandBuilderFactory getCommandBuilderFactory()
Retrieves a PluginCommandBuilderFactory, used to create ScmCommandBuilder command builders for custom SCM commands.
PluginCompareCommandFactory getCompareCommandFactory()
Retrieves a PluginCompareCommandFactory, used to create Command commands tailored for comparing refs.
@Nonnull Set<ScmFeature> getFeatures()
Retrieves the ScmFeature features that are supported by this SCM.
PluginHookHandlerFactory getHookHandlerFactory()
Retrieves a PluginHookHandlerFactory, used to create HookHandler
PluginPullRequestCommandFactory getPullRequestCommandFactory()
Retrieves a PluginPullRequestCommandFactory, used to create Command commands tailored for use supporting pull requests.
PluginRefCommandFactory getRefCommandFactory()
Retrieves a PluginRefCommandFactory, used to create Command commands tailored for creating branches and tags.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.bitbucket.scm.Scm

Protected Constructors

protected AbstractScm ()

protected AbstractScm (Set<ScmFeature> features)

Public Methods

public PluginCommandBuilderFactory getCommandBuilderFactory ()

Retrieves a PluginCommandBuilderFactory, used to create ScmCommandBuilder command builders for custom SCM commands.

Implementation Note: This method is optional. SCMs which do not support a ScmCommandBuilder may return null.

Returns
  • a command builder factory, or null if the SCM does not support command builders

public PluginCompareCommandFactory getCompareCommandFactory ()

Retrieves a PluginCompareCommandFactory, used to create Command commands tailored for comparing refs.

Implementation Note: This method is optional. SCMs which do not support comparing refs may return null.

Returns
  • a compare command factory, or null if the SCM does not support it

@Nonnull public Set<ScmFeature> getFeatures ()

Retrieves the ScmFeature features that are supported by this SCM.

Since the system relies on optional features to provide some functionality, like branch compare and pull requests, it relies on this set to disable functionality that requires features the SCM doesn't provide. Similarly, plugin developers can use the returned features to control which optional features they try to use, rather than checking for null or handling UnsupportedOperationExceptions.

Returns
  • the set of optional features this SCM supports, which may be empty but never null

public PluginHookHandlerFactory getHookHandlerFactory ()

Retrieves a PluginHookHandlerFactory, used to create HookHandler

Returns
  • a hook handler factory, or null if the SCM does not support hooks

public PluginPullRequestCommandFactory getPullRequestCommandFactory ()

Retrieves a PluginPullRequestCommandFactory, used to create Command commands tailored for use supporting pull requests. Repositories using an SCM which implements this method will have the ability to create, view and merge pull requests.

Implementation Note: This method is optional. SCMs which do not support pull requests may return null. Repositories using such SCMs will not be able to create pull requests.

Returns
  • a pull request command factory, or null if the SCM does not support pull requests

public PluginRefCommandFactory getRefCommandFactory ()

Retrieves a PluginRefCommandFactory, used to create Command commands tailored for creating branches and tags.

Implementation Note: This method is optional. SCMs which do not support mutable refs may return null. Repositories using such SCMs will not be able create branches and tags.