public class

ScmModuleDescriptor

extends BaseWeightedModuleDescriptor<T>
java.lang.Object
   ↳ com.atlassian.plugin.descriptors.AbstractModuleDescriptor<T>
     ↳ com.atlassian.stash.scm.BaseWeightedModuleDescriptor<T>
       ↳ com.atlassian.stash.scm.ScmModuleDescriptor

Class Overview

ModuleDescriptor which interprets &lt;scm/&gt; tags in atlassian-plugin.xml.

 <scm id="scm" class="com.example.scm.CustomScm" weight="100"/>
 
Because this module descriptor uses the ModuleFactory to create the Scm instance, the "class" for the Scm may also reference a bean:
 <component id="customScm" class="com.example.scm.CustomScm"/>
 <scm id="scm" class="bean:customScm"/>
 
Using the "bean:" approach allows plugins to declare their custom Scm implementations as public components, allowing other plugins to component-import them and use them.

This module descriptor caches the Scm instance it creates, and returns the same instance on subsequent calls until the module is disabled or uninstalled. As a result, as documented on the Scm interface, implementations are required to be thread-safe, because the same instance will be used by multiple threads.

SCMs are weighted, which is used to control the order they are returned in when retrieving ScmService#getAvailable() available SCMs. The higher the weight, the later in the set they will appear. Additionally, if multiple SCMs are registered with the same ID, the one with the lowest weight will be used.

Summary

Constants
String XML_ELEMENT_NAME
[Expand]
Inherited Fields
From class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
From interface com.atlassian.stash.util.Weighted
Public Constructors
ScmModuleDescriptor(ModuleFactory moduleFactory)
Public Methods
void disabled()
Clears the cached Scm.
Scm getModule()
Retrieves the Scm instance for this descriptor.
[Expand]
Inherited Methods
From class com.atlassian.stash.scm.BaseWeightedModuleDescriptor
From class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
From class java.lang.Object
From interface com.atlassian.plugin.ModuleDescriptor
From interface com.atlassian.plugin.Resourced
From interface com.atlassian.plugin.StateAware
From interface com.atlassian.stash.util.Weighted
From interface java.lang.Comparable

Constants

public static final String XML_ELEMENT_NAME

Constant Value: "scm"

Public Constructors

public ScmModuleDescriptor (ModuleFactory moduleFactory)

Public Methods

public void disabled ()

Clears the cached Scm.

public Scm getModule ()

Retrieves the Scm instance for this descriptor.

The first time this method is called after an SCM plugin is installed or enabled, the Scm will be retrieved from the ModuleFactory and cached. Subsequent calls will retrieve the same instance.

Returns
  • the Scm instance