getSites() {
return sites;
}
@@ -748,6 +757,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable {
*
* This object will have the row.jelly which renders the job on UI.
*/
+ @ExportedBean
public abstract class UpdateCenterJob implements Runnable {
/**
* Which {@link UpdateSite} does this belong to?
@@ -763,6 +773,10 @@ public class UpdateCenter extends AbstractModelObject implements Saveable {
this.site = site;
}
+ public Api getApi() {
+ return new Api(this);
+ }
+
/**
* @deprecated as of 1.326
* Use {@link #submit()} instead.
@@ -771,6 +785,11 @@ public class UpdateCenter extends AbstractModelObject implements Saveable {
submit();
}
+ @Exported
+ public String getType() {
+ return getClass().getSimpleName();
+ }
+
/**
* Schedules this job for an execution
* @return
@@ -782,6 +801,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable {
return installerService.submit(this,this);
}
+ @Exported
public Throwable getError() {
return error;
}
@@ -794,11 +814,13 @@ public class UpdateCenter extends AbstractModelObject implements Saveable {
/**
* Unique ID that identifies this job.
*/
+ @Exported
public final int id = iota.incrementAndGet();
/**
* Immutable state of this job.
*/
+ @Exported(inline=true)
public volatile RestartJenkinsJobStatus status = new Pending();
/**
@@ -829,15 +851,19 @@ public class UpdateCenter extends AbstractModelObject implements Saveable {
error = exception;
}
}
-
+
+ @ExportedBean
public abstract class RestartJenkinsJobStatus {
-
+ @Exported
public final int id = iota.incrementAndGet();
}
public class Pending extends RestartJenkinsJobStatus {
-
+ @Exported
+ public String getType() {
+ return getClass().getSimpleName();
+ }
}
public class Running extends RestartJenkinsJobStatus {
@@ -912,10 +938,12 @@ public class UpdateCenter extends AbstractModelObject implements Saveable {
/**
* Unique ID that identifies this job.
*/
+ @Exported
public final int id = iota.incrementAndGet();
/**
* Immutable object representing the current state of this job.
*/
+ @Exported(inline=true)
public volatile InstallationStatus status = new Pending();
/**
@@ -928,6 +956,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable {
*/
protected abstract File getDestination();
+ @Exported
public abstract String getName();
/**
@@ -941,6 +970,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable {
/**
* Get the user that initiated this job
*/
+ @Exported
public Authentication getUser() {
return this.authentication;
}
@@ -1002,9 +1032,14 @@ public class UpdateCenter extends AbstractModelObject implements Saveable {
*/
public abstract class InstallationStatus extends Throwable {
public final int id = iota.incrementAndGet();
+ @Exported
public boolean isSuccess() {
return false;
}
+ @Exported
+ public final String getType() {
+ return getClass().getSimpleName();
+ }
}
/**
@@ -1076,6 +1111,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable {
/**
* What plugin are we trying to install?
*/
+ @Exported
public final Plugin plugin;
private final PluginManager pm = Jenkins.getInstance().getPluginManager();
diff --git a/core/src/main/java/hudson/model/UpdateSite.java b/core/src/main/java/hudson/model/UpdateSite.java
index 98139b353470957532e0064ee32f5b3229acda61..0ab66c1165c3202b0514c2374325ba4031fa6506 100644
--- a/core/src/main/java/hudson/model/UpdateSite.java
+++ b/core/src/main/java/hudson/model/UpdateSite.java
@@ -49,6 +49,8 @@ import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
+import org.kohsuke.stapler.export.Exported;
+import org.kohsuke.stapler.export.ExportedBean;
import javax.servlet.ServletContext;
import java.io.ByteArrayInputStream;
@@ -533,23 +535,28 @@ public class UpdateSite {
}
}
+ @ExportedBean
public static class Entry {
/**
* {@link UpdateSite} ID.
*/
+ @Exported
public final String sourceId;
/**
* Artifact ID.
*/
+ @Exported
public final String name;
/**
* The version.
*/
+ @Exported
public final String version;
/**
* Download URL.
*/
+ @Exported
public final String url;
public Entry(String sourceId, JSONObject o) {
@@ -577,12 +584,17 @@ public class UpdateSite {
}
}
+ public Api getApi() {
+ return new Api(this);
+ }
+
}
public final class Plugin extends Entry {
/**
* Optional URL to the Wiki page that discusses this plugin.
*/
+ @Exported
public final String wiki;
/**
* Human readable title of the plugin, taken from Wiki page.
@@ -591,28 +603,34 @@ public class UpdateSite {
*
* beware of XSS vulnerability since this data comes from Wiki
*/
+ @Exported
public final String title;
/**
* Optional excerpt string.
*/
+ @Exported
public final String excerpt;
/**
* Optional version # from which this plugin release is configuration-compatible.
*/
+ @Exported
public final String compatibleSinceVersion;
/**
* Version of Jenkins core this plugin was compiled against.
*/
+ @Exported
public final String requiredCore;
/**
* Categories for grouping plugins, taken from labels assigned to wiki page.
* Can be null.
*/
+ @Exported
public final String[] categories;
/**
* Dependencies of this plugin.
*/
+ @Exported
public final Map dependencies = new HashMap();
@DataBoundConstructor
@@ -654,6 +672,7 @@ public class UpdateSite {
* If some version of this plugin is currently installed, return {@link PluginWrapper}.
* Otherwise null.
*/
+ @Exported
public PluginWrapper getInstalled() {
PluginManager pm = Jenkins.getInstance().getPluginManager();
return pm.getPlugin(name);
@@ -666,6 +685,7 @@ public class UpdateSite {
* If it's not older, or it's not installed, or it's installed but there's no compatibleSinceVersion
* specified, it'll return true.
*/
+ @Exported
public boolean isCompatibleWithInstalledVersion() {
PluginWrapper installedVersion = getInstalled();
if (installedVersion != null) {
@@ -682,6 +702,7 @@ public class UpdateSite {
/**
* Returns a list of dependent plugins which need to be installed or upgraded for this plugin to work.
*/
+ @Exported
public List getNeededDependencies() {
List deps = new ArrayList();