本文整理了Java中jenkins.model.Jenkins.getUpdateCenter()
方法的一些代码示例,展示了Jenkins.getUpdateCenter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getUpdateCenter()
方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getUpdateCenter
暂无
代码示例来源:origin: jenkinsci/jenkins
/**
* Initializes the update center.
*
* This has to wait until after all plugins load, to let custom UpdateCenterConfiguration take effect first.
*/
@Initializer(after=PLUGINS_STARTED, fatal=false)
public static void init(Jenkins h) throws IOException {
h.getUpdateCenter().load();
}
代码示例来源:origin: jenkinsci/jenkins
/**
* URL to download.
*/
public String getUrl() {
return Jenkins.getInstance().getUpdateCenter().getDefaultBaseUrl()+"updates/"+url;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* URLs to download from.
*/
public List<String> getUrls() {
List<String> updateSites = new ArrayList<String>();
for (UpdateSite site : Jenkins.getActiveInstance().getUpdateCenter().getSiteList()) {
String siteUrl = site.getUrl();
int baseUrlEnd = siteUrl.indexOf("update-center.json");
if (baseUrlEnd != -1) {
String siteBaseUrl = siteUrl.substring(0, baseUrlEnd);
updateSites.add(siteBaseUrl + "updates/" + url);
} else {
LOGGER.log(Level.WARNING, "Url {0} does not look like an update center:", siteUrl);
}
}
return updateSites;
}
代码示例来源:origin: jenkinsci/jenkins
@Nonnull
public Set<UpdateSite.Warning> getAllWarnings() {
HashSet<UpdateSite.Warning> allWarnings = new HashSet<>();
for (UpdateSite site : Jenkins.get().getUpdateCenter().getSites()) {
UpdateSite.Data data = site.getData();
if (data != null) {
allWarnings.addAll(data.getWarnings());
}
}
return allWarnings;
}
代码示例来源:origin: jenkinsci/jenkins
public Data getData() {
UpdateSite cs = Jenkins.getInstance().getUpdateCenter().getCoreSource();
if (cs!=null) return cs.getData();
return null;
}
}
代码示例来源:origin: jenkinsci/jenkins
@Restricted(NoExternalUse.class)
public static void updateDefaultSite() {
final UpdateSite site = Jenkins.getInstance().getUpdateCenter().getSite(UpdateCenter.ID_DEFAULT);
if (site == null) {
LOGGER.log(Level.SEVERE, "Upgrading Jenkins. Cannot retrieve the default Update Site ''{0}''. "
+ "Plugin installation may fail.", UpdateCenter.ID_DEFAULT);
return;
}
try {
// Need to do the following because the plugin manager will attempt to access
// $JENKINS_HOME/updates/$ID_DEFAULT.json. Needs to be up to date.
site.updateDirectlyNow(true);
} catch (Exception e) {
LOGGER.log(WARNING, "Upgrading Jenkins. Failed to update the default Update Site '" + UpdateCenter.ID_DEFAULT +
"'. Plugin upgrades may fail.", e);
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Update the data file from the given URL if the file
* does not exist, or is otherwise due for update.
* Accepted formats are JSONP or HTML with {@code postMessage}, not raw JSON.
* @param signatureCheck whether to enforce the signature (may be off only for testing!)
* @return null if no updates are necessary, or the future result
* @since 1.502
*/
public @CheckForNull Future<FormValidation> updateDirectly(final boolean signatureCheck) {
if (! getDataFile().exists() || isDue()) {
return Jenkins.getInstance().getUpdateCenter().updateService.submit(new Callable<FormValidation>() {
@Override public FormValidation call() throws Exception {
return updateDirectlyNow(signatureCheck);
}
});
} else {
return null;
}
}
代码示例来源:origin: jenkinsci/jenkins
updateSiteList: for (UpdateSite updateSite : Jenkins.get().getUpdateCenter().getSiteList()) {
String updateCenterJsonUrl = updateSite.getUrl();
String suggestedPluginUrl = updateCenterJsonUrl.replace("/update-center.json", "/platform-plugins.json");
代码示例来源:origin: jenkinsci/jenkins
Plugin depPlugin = Jenkins.getInstance().getUpdateCenter().getPlugin(e.getKey(), requiredVersion);
if (depPlugin == null) {
LOGGER.log(Level.WARNING, "Could not find dependency {0} of {1}", new Object[] {e.getKey(), name});
Plugin depPlugin = Jenkins.getInstance().getUpdateCenter().getPlugin(e.getKey(), requiredVersion);
if (depPlugin == null) {
continue;
代码示例来源:origin: jenkinsci/jenkins
private UpdateSite.Plugin getPlugin(String pluginName, String siteName) {
UpdateSite updateSite = Jenkins.getInstance().getUpdateCenter().getById(siteName);
if (updateSite == null) {
throw new Failure("No such update center: " + siteName);
}
return updateSite.getPlugin(pluginName);
}
代码示例来源:origin: jenkinsci/jenkins
private FormValidation checkUpdatesServer() throws Exception {
for (UpdateSite site : Jenkins.get().getUpdateCenter().getSites()) {
FormValidation v = site.updateDirectlyNow(DownloadService.signatureCheck);
if (v.kind != FormValidation.Kind.OK) {
// Stop with an error
return v;
}
}
for (DownloadService.Downloadable d : DownloadService.Downloadable.all()) {
FormValidation v = d.updateNow();
if (v.kind != FormValidation.Kind.OK) {
// Stop with an error
return v;
}
}
return FormValidation.ok();
}
代码示例来源:origin: jenkinsci/jenkins
List<JSONObject> jsonList = new ArrayList<>();
boolean toolInstallerMetadataExists = false;
for (UpdateSite updatesite : Jenkins.getActiveInstance().getUpdateCenter().getSiteList()) {
String site = updatesite.getMetadataUrlForDownloadable(url);
if (site == null) {
代码示例来源:origin: jenkinsci/jenkins
/**
* Bare-minimum configuration mechanism to change the update center.
*/
@RequirePOST
public HttpResponse doSiteConfigure(@QueryParameter String site) throws IOException {
Jenkins hudson = Jenkins.getInstance();
hudson.checkPermission(CONFIGURE_UPDATECENTER);
UpdateCenter uc = hudson.getUpdateCenter();
PersistedList<UpdateSite> sites = uc.getSites();
for (UpdateSite s : sites) {
if (s.getId().equals(UpdateCenter.ID_DEFAULT))
sites.remove(s);
}
sites.add(new UpdateSite(UpdateCenter.ID_DEFAULT, site));
return new HttpRedirect("advanced");
}
代码示例来源:origin: jenkinsci/jenkins
/**
* returns the {@link hudson.model.UpdateSite.Plugin} object, or null.
*/
public UpdateSite.Plugin getInfo() {
UpdateCenter uc = Jenkins.getInstance().getUpdateCenter();
UpdateSite.Plugin p = uc.getPlugin(getShortName(), getVersionNumber());
if (p != null) return p;
return uc.getPlugin(getShortName());
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Schedules the downgrade of this plugin.
*/
public Future<UpdateCenterJob> deployBackup() {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
UpdateCenter uc = Jenkins.getInstance().getUpdateCenter();
return uc.addJob(uc.new PluginDowngradeJob(this, UpdateSite.this, Jenkins.getAuthentication()));
}
/**
代码示例来源:origin: jenkinsci/jenkins
/**
* If the plugin has {@link #getUpdateInfo() an update},
* returns the {@link hudson.model.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 = Jenkins.getInstance().getUpdateCenter();
UpdateSite.Plugin p = uc.getPlugin(getShortName(), getVersionNumber());
if(p!=null && p.isNewerThan(getVersion())) return p;
return null;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Returns whether the system needs a restart, and if it is supported
* e.g. { restartRequired: true, restartSupported: false }
*/
@Restricted(DoNotUse.class) // WebOnly
public HttpResponse doRestartStatus() throws IOException {
JSONObject response = new JSONObject();
Jenkins jenkins = Jenkins.get();
response.put("restartRequired", jenkins.getUpdateCenter().isRestartRequiredForCompletion());
response.put("restartSupported", jenkins.getLifecycle().canRestart());
return HttpResponses.okJSON(response);
}
代码示例来源:origin: jenkinsci/jenkins
for (UpdateSite site : Jenkins.get().getUpdateCenter().getSites()) {
if (site.isDue()) {
due = true;
代码示例来源:origin: jenkinsci/jenkins
public Future<UpdateCenterJob> deploy(boolean dynamicLoad, @CheckForNull UUID correlationId) {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
UpdateCenter uc = Jenkins.getInstance().getUpdateCenter();
for (Plugin dep : getNeededDependencies()) {
UpdateCenter.InstallationJob job = uc.getJob(dep);
代码示例来源:origin: jenkinsci/jenkins
@RequirePOST
public HttpResponse doUpdateSources(StaplerRequest req) throws IOException {
Jenkins.getInstance().checkPermission(CONFIGURE_UPDATECENTER);
if (req.hasParameter("remove")) {
UpdateCenter uc = Jenkins.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");
}
内容来源于网络,如有侵权,请联系作者删除!