org.stanwood.media.source.xbmc.updater
Class XBMCWebUpdater

java.lang.Object
  extended by org.stanwood.media.xml.XMLParser
      extended by org.stanwood.media.source.xbmc.updater.XBMCWebUpdater
All Implemented Interfaces:
IXBMCUpdater

public class XBMCWebUpdater
extends XMLParser
implements IXBMCUpdater

This class is used to install, remove or update XBMC addons


Field Summary
 
Fields inherited from class org.stanwood.media.xml.XMLParser
DTD_WEB_LOCATION, SCHEMA_WEB_LOCATION
 
Constructor Summary
XBMCWebUpdater(ConfigReader config)
          The constructor
 
Method Summary
protected  java.io.File downloadLatestAddonXML()
           
 int installAddons(IConsole console, java.util.Set<java.lang.String> addonIds)
          Used to install a list of addons
 java.util.Set<AddonDetails> listAddons(IConsole console)
          Used to get a list of installed and uninstalled addons
 void setAddonManager(XBMCAddonManager mgr)
          Register the XBMC manager with the updater
 int uninstallAddons(IConsole console, java.util.Set<java.lang.String> addonIds)
          Used to uninstall a list of addons and any that depend on these addons
 int update(IConsole console)
          Update all addons to the latest version
 int update(IConsole console, java.util.Set<java.lang.String> pluginList)
          Update a list of addons to the latest version and the addons they depend on
protected  int updatePlugins(IConsole console, java.io.File newAddon, java.util.Set<java.lang.String> plugins)
           
 
Methods inherited from class org.stanwood.media.xml.XMLParser
createDocBuilder, createFactory, deleteNode, domToStr, encodeAttributeValue, firstChild, getAttribute, getElement, getFirstChildElement, getFloatFromXML, getIntegerFromXML, getLastChildElement, getLongFromXML, getSchema, getStringFromXML, getStringFromXMLOrNull, getURLFromXML, getURLFromXMLOrNull, hasNode, parse, parse, parse, quoteXPathQuery, selectChildNodes, selectNodeList, selectSingleNode, strToDom, strToDom, strToDom, writeXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XBMCWebUpdater

public XBMCWebUpdater(ConfigReader config)
               throws XBMCException
The constructor

Parameters:
config - The Media directory configuration
Throws:
XBMCException - Thrown if their is a problem reading from the configuration
Method Detail

setAddonManager

public void setAddonManager(XBMCAddonManager mgr)
Register the XBMC manager with the updater

Specified by:
setAddonManager in interface IXBMCUpdater
Parameters:
mgr - the XBMC manager

listAddons

public java.util.Set<AddonDetails> listAddons(IConsole console)
                                       throws XBMCUpdaterException
Used to get a list of installed and uninstalled addons

Specified by:
listAddons in interface IXBMCUpdater
Parameters:
console - The console used to send messages to
Returns:
The list of addons
Throws:
XBMCUpdaterException - thrown if their are any problems

installAddons

public int installAddons(IConsole console,
                         java.util.Set<java.lang.String> addonIds)
                  throws XBMCException
Used to install a list of addons

Specified by:
installAddons in interface IXBMCUpdater
Parameters:
console - The console used to send messages to
addonIds - a list of addon ID's to install
Returns:
The number of installed addons
Throws:
XBMCException - Thrown if their are any problems

uninstallAddons

public int uninstallAddons(IConsole console,
                           java.util.Set<java.lang.String> addonIds)
                    throws XBMCUpdaterException
Used to uninstall a list of addons and any that depend on these addons

Specified by:
uninstallAddons in interface IXBMCUpdater
Parameters:
console - The console used to send messages to
addonIds - a list of addon ID's to uninstall
Returns:
The number of uninstalled addons
Throws:
XBMCUpdaterException - Thrown if their are any problems

update

public int update(IConsole console,
                  java.util.Set<java.lang.String> pluginList)
           throws XBMCException
Update a list of addons to the latest version and the addons they depend on

Specified by:
update in interface IXBMCUpdater
Parameters:
console - The console used to send messages to
pluginList - The list of addons to update
Returns:
The number of addones updated
Throws:
XBMCUpdaterException - thrown if their are any problems with the updater
XBMCException - Thrown if their are any other problems

update

public int update(IConsole console)
           throws XBMCException
Update all addons to the latest version

Specified by:
update in interface IXBMCUpdater
Parameters:
console - The console used to send messages to
Returns:
The number of addones updated
Throws:
XBMCUpdaterException - thrown if their are any problems with the updater
XBMCException - Thrown if their are any other problems

updatePlugins

protected int updatePlugins(IConsole console,
                            java.io.File newAddon,
                            java.util.Set<java.lang.String> plugins)
                     throws XMLParserException,
                            java.io.IOException,
                            XBMCUpdaterException,
                            XBMCException
Throws:
XMLParserException
java.io.IOException
XBMCUpdaterException
XBMCException

downloadLatestAddonXML

protected java.io.File downloadLatestAddonXML()
                                       throws java.io.IOException,
                                              XBMCUpdaterException
Throws:
java.io.IOException
XBMCUpdaterException