A good place to start is to find the Jenkins github repository
The code you want
Jenkins.getInstance().getDescriptor( MyPluginWithGlobalConfig.class )
Which will give you the back handle you want (since there is only one instance of the handle)
Here is the one I used in a plugin (in groovy) that retrieves a handle and then calls the source file method on it
@Override
public List<String> rebuild(List<String> list){
SeleniumDynamicCapability.DescriptorImpl sdcd = Jenkins.getInstance().getDescriptor(SeleniumDynamicCapability.class)
List<SeleniumCapabilityRO> sc = sdcd.loadDefaultItems()
if (sc.size() == 0)
throw(new SeleniumException("No selenium capabilities detected"))
setSeleniumCapabilities(sc)
sc.each{list.add(it.toString())}
return list;
}
source
share