org.stanwood.media.source.xbmc
Class XBMCAddon

java.lang.Object
  extended by org.stanwood.media.xml.XMLParser
      extended by org.stanwood.media.source.xbmc.XBMCAddon

public class XBMCAddon
extends XMLParser

This class is used to manage XBMC addon's


Field Summary
 
Fields inherited from class org.stanwood.media.xml.XMLParser
DTD_WEB_LOCATION, SCHEMA_WEB_LOCATION
 
Constructor Summary
XBMCAddon(XBMCAddonManager addonMgr, java.io.File addonDir, java.util.Locale locale)
          Used to create a instance of the addon class
 
Method Summary
 boolean checkCondition(java.lang.String expression)
          Used to evaluate a expression making use of the addon settings.
 java.lang.String executeFunction(java.lang.String functionName, java.util.Map<java.lang.Integer,java.lang.String> params)
          Used to execute a scraper function
 java.lang.String getDescription()
          Used to get the description of the addon
 java.io.File getFile(java.lang.String path)
          Used to get a reference to one of the addons files
 java.lang.String getId()
          Used to get the id of the addon
 java.lang.String getInfoSetting(java.lang.String key)
          Used to get the value of a info setting
 XBMCAddonManager getManager()
          Used to get the addon manager
 java.lang.String getName()
          Used to get the name of the addon
 java.lang.String getProviderName()
          Used to get the provider name of the addon
 java.util.List<XBMCAddon> getRquiredAddons()
          Used to get a list of required addons by this addon
 XBMCScraper getScraper(Mode mode)
          Used to get the scraper class that will read data using the XBMC XML scraper files
 Value getSetting(java.lang.String id)
          Used to get the value of a addon setting
 java.util.Map<java.lang.String,Value> getSettings()
          Used to get the addon settings
 java.lang.String getSummary()
          Used to get the summary of the addon
 Version getVersion()
          Used to get the version of the addon
 boolean hasScrapers()
          Used to find out if the extension has scrappers
 void setSetting(java.lang.String key, java.lang.String expression)
          Used to assign a value to a variable which are used as settings.
 boolean supportsMode(Mode mode)
          Used o find out if the scraper supports a given mode
 java.lang.String toString()
          
 
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, wait, wait, wait
 

Constructor Detail

XBMCAddon

public XBMCAddon(XBMCAddonManager addonMgr,
                 java.io.File addonDir,
                 java.util.Locale locale)
          throws XBMCException
Used to create a instance of the addon class

Parameters:
addonMgr - The XBMC addon manager
addonDir - The directory contain the XBMC addons
locale - The locale to use with the scrapers
Throws:
XBMCException - Thrown if anable to parse the settings
Method Detail

getSetting

public Value getSetting(java.lang.String id)
                 throws XBMCException
Used to get the value of a addon setting

Parameters:
id - The id of the addon setting
Returns:
The value of the addon setting
Throws:
XBMCException - Thrown if their is a problem getting the setting

getSettings

public java.util.Map<java.lang.String,Value> getSettings()
Used to get the addon settings

Returns:
The addon settings

getId

public java.lang.String getId()
                       throws XBMCException
Used to get the id of the addon

Returns:
the id of the addon
Throws:
XBMCException - Thrown if their are any problems

getRquiredAddons

public java.util.List<XBMCAddon> getRquiredAddons()
                                           throws XBMCException
Used to get a list of required addons by this addon

Returns:
gets a list of required addons by this addon
Throws:
XBMCException - Thrown if their is a problem

getVersion

public Version getVersion()
                   throws XBMCException
Used to get the version of the addon

Returns:
the version of the addon
Throws:
XBMCException - Thrown if their are any problems

getProviderName

public java.lang.String getProviderName()
                                 throws XBMCException
Used to get the provider name of the addon

Returns:
the provider name of the addon
Throws:
XBMCException - Thrown if their are any problems

supportsMode

public boolean supportsMode(Mode mode)
                     throws XBMCException
Used o find out if the scraper supports a given mode

Parameters:
mode - The mode to check
Returns:
True if the mode is supported.
Throws:
XBMCException - Thrown if their is any problems while checking

getScraper

public XBMCScraper getScraper(Mode mode)
                       throws XBMCException
Used to get the scraper class that will read data using the XBMC XML scraper files

Parameters:
mode - The mode that the scraper is been used for
Returns:
The scraper
Throws:
XBMCException - Thrown if their are any problems

getSummary

public java.lang.String getSummary()
                            throws XBMCException
Used to get the summary of the addon

Returns:
the summary of the addon
Throws:
XBMCException - Thrown if their are any problems

getDescription

public java.lang.String getDescription()
                                throws XBMCException
Used to get the description of the addon

Returns:
the description of the addon
Throws:
XBMCException - Thrown if their are any problems

getName

public java.lang.String getName()
                         throws XBMCException
Used to get the name of the addon

Returns:
the name of the addon
Throws:
XBMCException - Thrown if their are any problems

getInfoSetting

public java.lang.String getInfoSetting(java.lang.String key)
                                throws XBMCException
Used to get the value of a info setting

Parameters:
key - The info setting name
Returns:
The info setting value
Throws:
XBMCException - Thrown if not able to find the setting

getFile

public java.io.File getFile(java.lang.String path)
Used to get a reference to one of the addons files

Parameters:
path - The Path relative to the addon directory
Returns:
The file object referencing the file

executeFunction

public java.lang.String executeFunction(java.lang.String functionName,
                                        java.util.Map<java.lang.Integer,java.lang.String> params)
                                 throws XBMCException
Used to execute a scraper function

Parameters:
functionName - The function name
params - The parameters given to the function
Returns:
The results from the function
Throws:
XBMCException - Thrown if their are any problems

getManager

public XBMCAddonManager getManager()
Used to get the addon manager

Returns:
The addon manager

hasScrapers

public boolean hasScrapers()
                    throws XBMCException
Used to find out if the extension has scrappers

Returns:
True if the extension has scrapers
Throws:
XBMCException - Thrown if their are any problems

checkCondition

public boolean checkCondition(java.lang.String expression)
                       throws XBMCException
Used to evaluate a expression making use of the addon settings. The expression must evaluate to a boolean type.

Parameters:
expression - The expression
Returns:
The value the expression evaluates to
Throws:
XBMCException - Thrown if their are any problems

setSetting

public void setSetting(java.lang.String key,
                       java.lang.String expression)
                throws XBMCException
Used to assign a value to a variable which are used as settings. The expression is evaluated and stored in the setting variable.

Parameters:
key - The name of the setting
expression - The expression to evaluate and store in the setting
Throws:
XBMCException - Thrown if their are any problems.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object