You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2010/03/07 21:32:10 UTC
svn commit: r920095 - in
/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c:
W3CWidget.java W3CWidgetFactory.java util/WidgetPackageUtils.java
Author: scottbw
Date: Sun Mar 7 20:32:09 2010
New Revision: 920095
URL: http://svn.apache.org/viewvc?rev=920095&view=rev
Log:
Removed "internal" methods from the W3CWidget interface, and improved the javadoc for W3CWidget and W3CWidgetFactory.
Modified:
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidget.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidgetFactory.java
incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/WidgetPackageUtils.java
Modified: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidget.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidget.java?rev=920095&r1=920094&r2=920095&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidget.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidget.java Sun Mar 7 20:32:09 2010
@@ -16,53 +16,95 @@
import java.util.List;
-import org.apache.wookie.w3c.exceptions.BadManifestException;
-import org.jdom.Element;
-
/**
- * @author Paul Sharples
- * @version $Id: IManifestModel.java,v 1.3 2009-09-02 18:37:31 scottwilson Exp $
+ * A W3C Widget object
+ *
+ * This represents the information model for a W3C widget that has been
+ * unpacked using the W3CWidgetFactory.
*/
public interface W3CWidget extends IManifestModelBase{
+ /**
+ * Get the list of access request entities for the widget
+ */
public List<IAccessEntity> getAccessList();
+ /**
+ * Get the list of start pages for the widget
+ */
public List<IContentEntity> getContentList();
+ /**
+ * Get the list of icons for the widget
+ */
public List<IIconEntity> getIconsList();
+ /**
+ * Get the widget identifier (IRI)
+ */
public String getIdentifier();
+ /**
+ * Get the list of Licenses for the widget
+ */
public List<ILicenseEntity> getLicensesList();
+ /**
+ * Get the list of Names for the widget
+ */
public List<INameEntity> getNames();
+ /**
+ * Get the list of Descriptions for the widget
+ */
public List<IDescriptionEntity> getDescriptions();
+ /**
+ * Get the widget height as an Integer. Note this may be Null.
+ */
public Integer getHeight();
+ /**
+ * Get the widget width as an Integer. Note this may be Null.
+ */
public Integer getWidth();
+ /**
+ * Get the Author information for the widget
+ */
public String getAuthor();
+ /**
+ * Get the email address of the Widget's author
+ */
public String getAuthorEmail();
+ /**
+ * Get the url for the Widget's author
+ */
public String getAuthorHref();
+ /**
+ * Get the list of Preferences defined for the widget
+ */
public List<IPreferenceEntity> getPrefences();
+ /**
+ * 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)
+ */
public List<IFeatureEntity> getFeatures();
+ /**
+ * Get the version of the widget
+ */
public String getVersion();
+
+ /**
+ * 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
+ */
public String getViewModes();
/**
- * 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.
+ * 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:
+ *
+ * <code>
+ * List<INameEntity> names = widget.getNames();
+ * INameEntity name = (INameEntity)LocalizationUtils.getLocalizedElement(names.toArray(new INameEntity[fNamesList.size()]), new String[]{"en"});
+ * </code>
+ *
* @param locale
* @return the name of the widget to be used in the given locale
*/
public String getLocalName(String locale);
- /**
- * Update icons to use paths using the given base path
- * @param path the base path for icons
- */
- public void updateIconPaths(String path);
-
- /**
- * Unmarshall the given XML Element to this Object
- *
- * @param element The Element to unmarshall
- * @param locales the set of supported locales
- */
- public void fromXML(Element element, String[] locales) throws BadManifestException;
}
Modified: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidgetFactory.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidgetFactory.java?rev=920095&r1=920094&r2=920095&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidgetFactory.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/W3CWidgetFactory.java Sun Mar 7 20:32:09 2010
@@ -21,6 +21,32 @@
/**
* Factory for parsing W3C Widget packages (.wgt files).
+ *
+ * <p>To use the factory you MUST supply a valid output directory into which the Factory will unpack the widget. Other factory
+ * properties are optional.<p>
+ *
+ * <p>Factory properties:</p>
+ *
+ * <dl>
+ * <dt>outputDirectory</dt>
+ * <dd>The directory where the widget will be saved. The factory will expand the widget archive into this
+ * directory, using the widget's identifier to generate a directory name and structure in which to place it</dd>
+ * <dt>startPageProcessor</dt>
+ * <dd>An implementation of the IStartPageProcessor interface. Setting this property allows you to inject a class that can pre-process
+ * start pages for the widget; for example to inject javascript, tidy up HTML, insert template code etc. If this is not set,
+ * no pre-processing is done by the factory.</dd>
+ * <dt>locales</dt>
+ * <dd>The supported locales (as BCP47 language-tags) to be processed for the widget. This determines which start files, icons, and other localized elements
+ * will be processed and expanded. This is set to "en" by default</dd>
+ * <dt>localPath</dt>
+ * <dd>The base URL from which unpacked widgets will be served, e.g. "/myapp/widgets". The URLs of start files will be appended to
+ * this base URL to create the widget URL. The default value of this property is "/widgets"</dd>
+ * <dt>features</dt>
+ * <dd>The features supported by the implementation; this should be supplied as IRIs e.g. "http://wave.google.com". The features
+ * are matched against features requested by the widget; if the widget requires features that are unsupported, an Exception will be
+ * thrown when parsing the widget package. The default value of this property is an empty String array.</dd>
+ * </dl>
+ *
*/
public class W3CWidgetFactory {
Modified: incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/WidgetPackageUtils.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/WidgetPackageUtils.java?rev=920095&r1=920094&r2=920095&view=diff
==============================================================================
--- incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/WidgetPackageUtils.java (original)
+++ incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/WidgetPackageUtils.java Sun Mar 7 20:32:09 2010
@@ -238,7 +238,7 @@
if (WidgetPackageUtils.hasManifest(zip)){
try {
// build the model
- W3CWidget widgetModel = new WidgetManifestModel(WidgetPackageUtils.extractManifest(zip), locales, features, zip);
+ WidgetManifestModel widgetModel = new WidgetManifestModel(WidgetPackageUtils.extractManifest(zip), locales, features, zip);
// get the widget identifier
String manifestIdentifier = widgetModel.getIdentifier();