Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-7271

document plugin point CapabilityTypeModule against 2.7

    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      We need to make plugin developers aware of this new plugin point.
      CR-BAM-2091

          Form Name

            [BAM-7271] document plugin point CapabilityTypeModule against 2.7

            James Dumay added a comment - http://confluence.atlassian.com/display/BAMBOO/Capability+Type+Module

            CapabilityDefaultsHelper : if you by accident implement this interface in your CapabilityTypeModule implementation (or in any other module visible to Spring) you can implement the method:

            @NotNull
            CapabilitySet addDefaultCapabilities(@NotNull CapabilitySet capabilitySet);
            

            Then you can auto detect your capabilities.
            Despite what the prototype suggests, all known implementations of this interface just add capabilities in place to the capabilitySet and return it instead of creating a copy.
            We don't want to let the users know that, IMO

            It's not our invention (CapabilityDefaultsHelper), we just used it as it's quite convenient.

            SlawekA (Inactive) added a comment - CapabilityDefaultsHelper : if you by accident implement this interface in your CapabilityTypeModule implementation (or in any other module visible to Spring) you can implement the method: @NotNull CapabilitySet addDefaultCapabilities(@NotNull CapabilitySet capabilitySet); Then you can auto detect your capabilities. Despite what the prototype suggests, all known implementations of this interface just add capabilities in place to the capabilitySet and return it instead of creating a copy. We don't want to let the users know that, IMO It's not our invention (CapabilityDefaultsHelper), we just used it as it's quite convenient.

            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.

            SlawekA (Inactive) added a comment - 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.

              mmiara Mateusz Miara (Inactive)
              pstefaniak PiotrA
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: