Hey Everyone,
I'm having some issues. I have a plugin which basically only has a global configuration that provides access to a mongo database other plugins can make use of to store data with via a simple interface. I am having an issue with the rendering of the configuration screen
The main plugin simply just extends Plugin and has a config.jelly with the following to show a list of possible datasources
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:section title="NoSQL Configuration: ${it.provider}">
<f:dropdownDescriptorSelector field="provider" title="Database selection" descriptors="${it.getAllProviders()}"/>
</f:section>
</j:jelly>
I't populates and renders the list of my describable objects just fine, and i can see that the values do get persisted in the xml file on my jenkins instance. However, when the i reload and go back to see the configuration all the fields are blank in the configuration for my describable object.
I have overriden the following methods in the Plugin Implemention:
@Override
public void configure(StaplerRequest req, JSONObject formData) throws IOException, ServletException, Descriptor.FormException {
super.configure(req, formData); //To change body of generated methods, choose Tools | Templates.
provider = req.bindJSON(NoSQLProvider.class, formData.getJSONObject("provider"));
save();
}
@Override
public void start() throws Exception {
super.start(); //To change body of generated methods, choose Tools | Templates.
load();
}
The base implementation of my describable object looks like this:
public abstract class NoSQLProvider implements Describable<NoSQLProvider>, Serializable {
public abstract <T> T create(T t) throws NoSQLDataException;
public abstract <T> T read(Object key, Class<T> clazz) throws NoSQLDataException;
public abstract static class NoSQLDescriptor extends Descriptor<NoSQLProvider> {
public static ExtensionList<NoSQLDescriptor> all() {
return Jenkins.getInstance().getExtensionList(NoSQLDescriptor.class);
}
}
}
I also tried all sorts of things, one of the was calling load() in the constructor of my desribables, for example for MongoDB i have the following descriptor:
@Extension
public static final class MongoProviderDescriptor extends NoSQLDescriptor {
public MongoProviderDescriptor() {
load();
}
@Override
public String getDisplayName() {
return "MongoDB";
}
}
What am i missing here? I've done this before...but i can't figure out what keeps this from working :)
Best regards,
Mads