The dev article for developing new capability types found here https://developer.atlassian.com/display/BAMBOODEV/Capability+Type+Module
allows me to create and see my capability, but blows up when saving:
[INFO] [talledLocalContainer] 2012-05-05 11:01:13,885 ERROR [http-6990-1] [FiveOhOh] 500 Exception was thrown. [INFO] [talledLocalContainer] java.lang.NullPointerException [INFO] [talledLocalContainer] at com.atlassian.bamboo.configuration.agent.ConfigureAgentCapability$2.addCapabilityAndSave(ConfigureAgentCapability.java:100) [INFO] [talledLocalContainer] at com.atlassian.bamboo.configuration.agent.ConfigureAgentCapability$2.visitLocal(ConfigureAgentCapability.java:83) [INFO] [talledLocalContainer] at com.atlassian.bamboo.v2.build.agent.LocalAgentDefinitionImpl.accept(LocalAgentDefinitionImpl.java:41) [INFO] [talledLocalContainer] at com.atlassian.bamboo.configuration.agent.ConfigureAgentCapability.doAddCapability(ConfigureAgentCapability.java:70) [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
And thatis because the class specified in the plugin.xml must extend AbstractCapabilityTypeModule which includes the method getCapability(actionParams){..}
BUt I can't find in the API what that should return (other than null). I tried creating a new CapabilityImpl() and setting the key and value, but that only got me so far as :
public class GroupAgentCapability extends AbstractCapabilityTypeModule { private static final Logger log = LoggerFactory .getLogger(GroupAgentCapability.class); @Override public Capability getCapability(Map<String, String[]> params) { return new CapabilityImpl("group.agent.key", "any.value"); } @Override public String getLabel(String key) { return "Group Agent Capability"; } @Override public Map<String, String> validate(Map<String, String[]> params) { //no values to set, no errors! return new HashMap<String,String>(); } }
[INFO] [talledLocalContainer] 2012-05-05 11:00:16,211 ERROR [http-6990-6] [FiveOhOh] 500 Exception was thrown. [INFO] [talledLocalContainer] java.lang.NullPointerException [INFO] [talledLocalContainer] at com.atlassian.bamboo.v2.build.agent.capability.CapabilitySetImpl.getCapability(CapabilitySetImpl.java:56) [INFO] [talledLocalContainer] at com.atlassian.bamboo.configuration.agent.ConfigureAgentCapability$2.addCapabilityAndSave(ConfigureAgentCapability.java:100) [INFO] [talledLocalContainer] at com.atlassian.bamboo.configuration.agent.ConfigureAgentCapability$2.visitLocal(ConfigureAgentCapability.java:83) [INFO] [talledLocalContainer] at com.atlassian.bamboo.v2.build.agent.LocalAgentDefinitionImpl.accept(LocalAgentDefinitionImpl.java:41) [INFO] [talledLocalContainer] at com.atlassian.bamboo.configuration.agent.ConfigureAgentCapability.doAddCapability(ConfigureAgentCapability.java:70) [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
So obviously my Capability needs a CapabilitySet as well? Can someone point me to some design overview of how all these classes work together?
My desire is simple, a "flag" capability that marks certain agents to be picked up by my custom filter.
Community moderators have prevented the ability to post new answers.
Was able to get this working by examing some other capabilities (JDK).
It seems the trick is indeed to instantiate a new CapabilityImpl() but the keys used in the constructor must match up with the keys used in your i18n file, and other getters of the class.
See this source for the full class:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.