org.apache.wookie.w3c.impl
Class WidgetManifestModel

java.lang.Object
  extended by org.apache.wookie.w3c.impl.AbstractLocalizedEntity
      extended by org.apache.wookie.w3c.impl.WidgetManifestModel
All Implemented Interfaces:
IDirectional, ILocalized, W3CWidget, IElement

public class WidgetManifestModel
extends AbstractLocalizedEntity
implements W3CWidget, IElement

Processes a config.xml document to create a model for a widget, including all sub-objects

Author:
Paul Sharples

Field Summary
 
Fields inherited from class org.apache.wookie.w3c.impl.AbstractLocalizedEntity
dir, lang, LEFT_TO_RIGHT, LEFT_TO_RIGHT_OVERRIDE, RIGHT_TO_LEFT, RIGHT_TO_LEFT_OVERRIDE
 
Constructor Summary
WidgetManifestModel(java.lang.String xmlText, java.lang.String[] locales, java.lang.String[] features, java.lang.String[] encodings, org.apache.commons.compress.archivers.zip.ZipFile zip, java.lang.String defaultIdentifier)
          Constructs a new WidgetManifestModel using an XML manifest supplied as a String.
 
Method Summary
 void fromXML(org.jdom.Element element)
          Unmarshall the given XML Element to this Object
 void fromXML(org.jdom.Element element, java.lang.String[] locales)
           
 java.util.List<IAccess> getAccessList()
          Get the list of access request entities for the widget
 IAuthor getAuthor()
          Get the Author information for the widget
 java.util.List<IContent> getContentList()
          Get the list of start pages for the widget
 java.lang.String getDefaultLocale()
          Get the default locale
 java.util.List<IDescription> getDescriptions()
          Get the list of Descriptions for the widget
 java.util.List<IFeature> getFeatures()
          Get a list of Features requested by the widget.
 java.lang.Integer getHeight()
          Get the widget height as an Integer.
 java.util.List<IIcon> getIcons()
          Get the list of icons for the widget
 java.lang.String getIdentifier()
          Get the widget identifier (IRI)
 java.util.List<ILicense> getLicenses()
          Get the list of Licenses for the widget
 java.lang.String getLocalName(java.lang.String locale)
          A convenience method typically used for generating debug messages during import.
 java.util.List<IName> getNames()
          Get the list of Names for the widget
 java.util.List<IPreference> getPreferences()
          Get the list of Preferences defined for the widget
 java.lang.String getUpdateLocation()
           
 java.lang.String getVersion()
          Get the version of the widget
 java.lang.String getViewModes()
          Gets the widget viewmodes attribute.
 java.lang.Integer getWidth()
          Get the widget width as an Integer.
 org.jdom.Element toXml()
          Marshall the entity into an XML Element
 void updateIconPaths(java.lang.String path)
           
 
Methods inherited from class org.apache.wookie.w3c.impl.AbstractLocalizedEntity
getDir, getLang, getLocalizedTextContent, getTextDirection, isValid, setDir, setLang, setLocalisationAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.wookie.w3c.ILocalized
getLang, setLang
 
Methods inherited from interface org.apache.wookie.w3c.IDirectional
getDir, isValid, setDir
 

Constructor Detail

WidgetManifestModel

public WidgetManifestModel(java.lang.String xmlText,
                           java.lang.String[] locales,
                           java.lang.String[] features,
                           java.lang.String[] encodings,
                           org.apache.commons.compress.archivers.zip.ZipFile zip,
                           java.lang.String defaultIdentifier)
                    throws org.jdom.JDOMException,
                           java.io.IOException,
                           BadManifestException
Constructs a new WidgetManifestModel using an XML manifest supplied as a String.

Parameters:
xmlText - the XML manifest file
Throws:
org.jdom.JDOMException
java.io.IOException
BadManifestException
Method Detail

getDefaultLocale

public java.lang.String getDefaultLocale()
Description copied from interface: W3CWidget
Get the default locale

Specified by:
getDefaultLocale in interface W3CWidget
Returns:
a locale string, or Null if no default locale is specified

getViewModes

public java.lang.String getViewModes()
Description copied from interface: W3CWidget
Gets the widget viewmodes attribute. A keyword list attribute that denotes the author's preferred view mode, followed by the next most preferred view mode and so forth

Specified by:
getViewModes in interface W3CWidget

getVersion

public java.lang.String getVersion()
Description copied from interface: W3CWidget
Get the version of the widget

Specified by:
getVersion in interface W3CWidget

getPreferences

public java.util.List<IPreference> getPreferences()
Description copied from interface: W3CWidget
Get the list of Preferences defined for the widget

Specified by:
getPreferences in interface W3CWidget

getFeatures

public java.util.List<IFeature> getFeatures()
Description copied from interface: W3CWidget
Get a list of Features requested by the widget. Note that only valid features are included (e.g. ones supported by the platform, or that are defined by the widget as optional)

Specified by:
getFeatures in interface W3CWidget

getAccessList

public java.util.List<IAccess> getAccessList()
Description copied from interface: W3CWidget
Get the list of access request entities for the widget

Specified by:
getAccessList in interface W3CWidget

getAuthor

public IAuthor getAuthor()
Description copied from interface: W3CWidget
Get the Author information for the widget

Specified by:
getAuthor in interface W3CWidget

getContentList

public java.util.List<IContent> getContentList()
Description copied from interface: W3CWidget
Get the list of start pages for the widget

Specified by:
getContentList in interface W3CWidget

getDescriptions

public java.util.List<IDescription> getDescriptions()
Description copied from interface: W3CWidget
Get the list of Descriptions for the widget

Specified by:
getDescriptions in interface W3CWidget

getNames

public java.util.List<IName> getNames()
Description copied from interface: W3CWidget
Get the list of Names for the widget

Specified by:
getNames in interface W3CWidget

getIcons

public java.util.List<IIcon> getIcons()
Description copied from interface: W3CWidget
Get the list of icons for the widget

Specified by:
getIcons in interface W3CWidget

getLicenses

public java.util.List<ILicense> getLicenses()
Description copied from interface: W3CWidget
Get the list of Licenses for the widget

Specified by:
getLicenses in interface W3CWidget

getIdentifier

public java.lang.String getIdentifier()
Description copied from interface: W3CWidget
Get the widget identifier (IRI)

Specified by:
getIdentifier in interface W3CWidget

getHeight

public java.lang.Integer getHeight()
Description copied from interface: W3CWidget
Get the widget height as an Integer. Note this may be Null.

Specified by:
getHeight in interface W3CWidget

getWidth

public java.lang.Integer getWidth()
Description copied from interface: W3CWidget
Get the widget width as an Integer. Note this may be Null.

Specified by:
getWidth in interface W3CWidget

getUpdateLocation

public java.lang.String getUpdateLocation()
Specified by:
getUpdateLocation in interface W3CWidget
Returns:
the update description document URL for the widget, or null if no valid update URL has been set

fromXML

public void fromXML(org.jdom.Element element)
Description copied from interface: IElement
Unmarshall the given XML Element to this Object

Specified by:
fromXML in interface IElement
Overrides:
fromXML in class AbstractLocalizedEntity
Parameters:
element - The Element to unmarshall

getLocalName

public java.lang.String getLocalName(java.lang.String locale)
Description copied from interface: W3CWidget
A convenience method typically used for generating debug messages during import. This method will never return null, however the name may be an empty String. This is equivalent to: List names = widget.getNames(); IName name = (IName)LocalizationUtils.getLocalizedElement(names.toArray(new IName[fNamesList.size()]), new String[]{"en"});

Specified by:
getLocalName in interface W3CWidget
Returns:
the name of the widget to be used in the given locale

updateIconPaths

public void updateIconPaths(java.lang.String path)

fromXML

public void fromXML(org.jdom.Element element,
                    java.lang.String[] locales)
             throws BadManifestException
Throws:
BadManifestException

toXml

public org.jdom.Element toXml()
Description copied from interface: IElement
Marshall the entity into an XML Element

Specified by:
toXml in interface IElement
Returns:
the W3C Widgets Element representing the content of the entity


2012 Apache Software Foundation.