use of hudson.model.UpdateCenter in project hudson-2.x by hudson.
the class PluginManager method doSiteConfigure.
/**
* Bare-minimum configuration mechanism to change the update center.
*/
public HttpResponse doSiteConfigure(@QueryParameter String site) throws IOException {
Hudson hudson = Hudson.getInstance();
hudson.checkPermission(Hudson.ADMINISTER);
UpdateCenter uc = hudson.getUpdateCenter();
PersistedList<UpdateSite> sites = uc.getSites();
for (UpdateSite s : sites) {
if (s.getId().equals("default"))
sites.remove(s);
}
sites.add(new UpdateSite("default", site));
return HttpResponses.redirectToContextRoot();
}
use of hudson.model.UpdateCenter in project hudson-2.x by hudson.
the class PluginManager method doUpdateSources.
public HttpResponse doUpdateSources(StaplerRequest req) throws IOException {
Hudson.getInstance().checkPermission(Hudson.ADMINISTER);
if (req.hasParameter("remove")) {
UpdateCenter uc = Hudson.getInstance().getUpdateCenter();
BulkChange bc = new BulkChange(uc);
try {
for (String id : req.getParameterValues("sources")) uc.getSites().remove(uc.getById(id));
} finally {
bc.commit();
}
} else if (req.hasParameter("add"))
return new HttpRedirect("addSite");
return new HttpRedirect("./sites");
}
use of hudson.model.UpdateCenter in project hudson-2.x by hudson.
the class PluginWrapper method getUpdateInfo.
/**
* If the plugin has {@link #getUpdateInfo() an update},
* returns the {@link UpdateSite.Plugin} object.
*
* @return
* This method may return null — for example,
* the user may have installed a plugin locally developed.
*/
public UpdateSite.Plugin getUpdateInfo() {
UpdateCenter uc = Hudson.getInstance().getUpdateCenter();
UpdateSite.Plugin p = uc.getPlugin(getShortName());
if (p != null && p.isNewerThan(getVersion()))
return p;
return null;
}
Aggregations