hudson.model
Class DownloadService.Downloadable

java.lang.Object
  extended by hudson.model.DownloadService.Downloadable
All Implemented Interfaces:
ExtensionPoint
Direct Known Subclasses:
JDKInstaller.JDKList
Enclosing class:
DownloadService

public static class DownloadService.Downloadable
extends Object
implements ExtensionPoint

Represents a periodically updated JSON data file obtained from a remote URL.

This mechanism is one of the basis of the update center, which involves fetching up-to-date data file.

Since:
1.305

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Constructor Summary
DownloadService.Downloadable(Class id)
          Uses the class name as an ID.
DownloadService.Downloadable(String id)
           
DownloadService.Downloadable(String id, String url)
           
DownloadService.Downloadable(String id, String url, long interval)
           
 
Method Summary
static ExtensionList<DownloadService.Downloadable> all()
          Returns all the registered DownloadService.Downloadables.
 void doPostBack(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          This is where the browser sends us the data.
static DownloadService.Downloadable get(String id)
          Returns the DownloadService.Downloadable that has the given ID.
 net.sf.json.JSONObject getData()
          Loads the current file into JSON and returns it, or null if no data exists.
 TextFile getDataFile()
          This is where the retrieved file will be stored.
 long getDue()
          When shall we retrieve this file next time?
 String getId()
           
 long getInterval()
          How often do we retrieve the new image?
 String getUrl()
          URL to download.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DownloadService.Downloadable

public DownloadService.Downloadable(String id,
                                    String url,
                                    long interval)
Parameters:
url - URL relative to UpdateCenter#getUrl(). So if this string is "foo.json", the ultimate URL will be something like "https://hudson-ci.org/update-center3/foo.json" For security and privacy reasons, we don't allow the retrieval from random locations.

DownloadService.Downloadable

public DownloadService.Downloadable(Class id)
Uses the class name as an ID.


DownloadService.Downloadable

public DownloadService.Downloadable(String id)

DownloadService.Downloadable

public DownloadService.Downloadable(String id,
                                    String url)
Method Detail

getId

public String getId()

getUrl

public String getUrl()
URL to download.


getInterval

public long getInterval()
How often do we retrieve the new image?

Returns:
number of milliseconds between retrieval.

getDataFile

public TextFile getDataFile()
This is where the retrieved file will be stored.


getDue

public long getDue()
When shall we retrieve this file next time?


getData

public net.sf.json.JSONObject getData()
                               throws IOException
Loads the current file into JSON and returns it, or null if no data exists.

Throws:
IOException

doPostBack

public void doPostBack(org.kohsuke.stapler.StaplerRequest req,
                       org.kohsuke.stapler.StaplerResponse rsp)
                throws IOException
This is where the browser sends us the data.

Throws:
IOException

all

public static ExtensionList<DownloadService.Downloadable> all()
Returns all the registered DownloadService.Downloadables.


get

public static DownloadService.Downloadable get(String id)
Returns the DownloadService.Downloadable that has the given ID.



Copyright © 2004-2013 Hudson. All Rights Reserved.