CapabilityTypeModule is the interface for capability types that are provided as 3rd party modules.
To explain the context, the built in capability types are:
- BuilderCapabilityType,
- GenericCapabilityType,
- PerforceCapabilityType,
- JdkCapabilityType.
Currently the only CapabilityTypeModule is the HgCapabilityTypeModule.
You can implement it directly or extend the com.atlassian.bamboo.v2.build.agent.capability.AbstractCapabilityTypeModule
It's in bamboo-web because the AbstractCapabilityType is also there - not the best component to depend on, BTW.
Then you specify your class in your atlassian-plugin.xml as follows:
<capabilityType key="system.hg.executable" name="Mercurial" class="com.atlassian.bamboo.plugins.hg.HgCapabilityTypeModule" sortOrder="1000">
<description>A Mercurial capability type</description>
<resource type="freemarker" name="edit" location="/com/atlassian/bamboo/plugins/hg/editHgCapability.ftl"/>
</capabilityType>
If you extend the AbstractCapabilityTypeModule you have to provide the edit ftl template.
The template will have a capabilityType context object referencing your class instance.
sortOrder is mandatory and it needs to be unique, or Bamboo will mix different capabilitites in one table display.
By default renaming the capability key is not allowed (in contrast to generic capabilities), but you may override isAllowRename() and getNewKeyFromLabel() if you wish.
Last but maybe most important: why would you want your own CapabilityTypeModule:
So you can:
- have a pretty name in edit agent capabilities dropdown, the tables etc,
- provide your own complicated edit control (the "edit" ftl),
- have possibly multiple but related capabilities grouped together but not with a bunch of custom capabilities that are just strings - we have Mercurial executable and ssh executable used by mercurial.
http://confluence.atlassian.com/display/BAMBOO/Capability+Type+Module