I am new to Jenkins Plugin development so pardon me if the question is silly. I am currently developing a Jenkins Plugin that provides a very small list of configuration options
After some research I have got to know how to update the config file through user defined form.
PFB Code
AbstractItem item= (AbstractItem) Jenkins.getInstance().getItemByFullName(itemName)
Source streamSource = new StreamSource(new StringReader(config))
item.updateByXml(streamSource);
item.save();
In the jelly the form has to called the method like this
<f:form method="post" name="config" action="configSubmit">
So the code to update has to be placed in the method as follows
public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws
IOException, ServletException, Descriptor.FormException
You can use the jenkins-client-api project to access Jenkins from java application. It is quite standard and definitely of great help when interacting from Java application to Jenkins. https://github.com/jenkinsci/java-client-api