org.apache.wookie.w3c.updates
Class UpdateUtils

java.lang.Object
  extended by org.apache.wookie.w3c.updates.UpdateUtils

public class UpdateUtils
extends java.lang.Object

Utility methods for working with updates


Constructor Summary
UpdateUtils()
           
 
Method Summary
static UpdateDescriptionDocument checkForUpdate(java.lang.String href, java.lang.String version)
          Gets an update description document for a widget using the specified href and version.
static UpdateDescriptionDocument checkForUpdate(W3CWidget widget)
          Gets an update description document for a widget Returns null if there is no update available, or the Update Description Document is not valid
static W3CWidget getUpdate(W3CWidgetFactory factory, java.lang.String identifier, java.lang.String href, java.lang.String version, boolean onlyUseHttps)
          Gets the latest version of a widget
static W3CWidget getUpdate(W3CWidgetFactory factory, W3CWidget widget)
          Gets an updated widget of a widget.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdateUtils

public UpdateUtils()
Method Detail

checkForUpdate

public static UpdateDescriptionDocument checkForUpdate(W3CWidget widget)
Gets an update description document for a widget Returns null if there is no update available, or the Update Description Document is not valid

Parameters:
widget - the widget to check for updates
Returns:
an UpdateDescriptionDocument for an update to the widget, or null if there is no update available

checkForUpdate

public static UpdateDescriptionDocument checkForUpdate(java.lang.String href,
                                                       java.lang.String version)
Gets an update description document for a widget using the specified href and version. Returns null if there is no update available, or the Update Description Document is not valid

Parameters:
href - the URL to use to obtain update information for the widget
version - the current version of the widget
Returns:
an UpdateDescriptionDocument for an update to the widget, or null if there is no update available

getUpdate

public static W3CWidget getUpdate(W3CWidgetFactory factory,
                                  W3CWidget widget)
Gets an updated widget of a widget. Note that by default this allows "unsafe" downloads over plain HTTP connections.

Parameters:
factory -
widget - the widget to update
Returns:
the latest version of the widget, or null if there is no updated version available, or the updated widget isn't valid

getUpdate

public static W3CWidget getUpdate(W3CWidgetFactory factory,
                                  java.lang.String identifier,
                                  java.lang.String href,
                                  java.lang.String version,
                                  boolean onlyUseHttps)
                           throws InvalidContentTypeException,
                                  BadWidgetZipFileException,
                                  BadManifestException,
                                  java.io.IOException,
                                  java.lang.Exception
Gets the latest version of a widget

Parameters:
factory -
href - the location of the widget Update Description Document
version - the version of the currently installed widget
onlyUseHttps - only get updates using HTTPS, ignore plain HTTP updates
Returns:
the latest version of the widget, or null if the current version is up to date
Throws:
java.lang.Exception
java.io.IOException
BadManifestException
BadWidgetZipFileException
InvalidContentTypeException


2012 Apache Software Foundation.