You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by ja...@apache.org on 2012/03/12 19:13:38 UTC

svn commit: r1299768 - in /incubator/rave/trunk: rave-components/rave-core/src/main/java/org/apache/rave/portal/service/ rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rpc/ rave-portal-resources/src/main/resources/ rave-portal-re...

Author: jasha
Date: Mon Mar 12 18:13:37 2012
New Revision: 1299768

URL: http://svn.apache.org/viewvc?rev=1299768&view=rev
Log:
RAVE-492 Add ability to import w3c widgets using the "add widget" page. Patch made by Paul Sharples (psharples).

Added:
    incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/repository/
    incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/repository/W3CWidgetMetadataRepository.java
    incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/repository/impl/
    incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/repository/impl/WookieWidgetMetadataRepository.java
    incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/service/impl/WookieWidgetMetadataResolver.java
    incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/java/org/apache/rave/provider/w3c/service/impl/WookieWidgetMetadataResolverTest.java
    incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/resources/allwidgets.xml
    incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/resources/singlewidget.xml
Modified:
    incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetMetadataResolver.java
    incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rpc/WidgetApi.java
    incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties
    incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/addwidget.jsp
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_api.js
    incubator/rave/trunk/rave-providers/rave-opensocial-provider/src/main/java/org/apache/rave/provider/opensocial/service/impl/OpenSocialWidgetMetadataResolver.java
    incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/resources/org/apache/rave/w3c-provider-applicationContext.xml

Modified: incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetMetadataResolver.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetMetadataResolver.java?rev=1299768&r1=1299767&r2=1299768&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetMetadataResolver.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetMetadataResolver.java Mon Mar 12 18:13:37 2012
@@ -24,4 +24,5 @@ import org.apache.rave.portal.model.Widg
 public interface WidgetMetadataResolver {
     String getSupportedContext();
     Widget getMetadata(String url);
+    Widget[] getMetadataGroup(String url);
 }

Modified: incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rpc/WidgetApi.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rpc/WidgetApi.java?rev=1299768&r1=1299767&r2=1299768&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rpc/WidgetApi.java (original)
+++ incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rpc/WidgetApi.java Mon Mar 12 18:13:37 2012
@@ -65,4 +65,19 @@ public class WidgetApi {
             }
         }.getResult();
     }
+
+    @ResponseBody
+    @RequestMapping(method = RequestMethod.POST, value = "metadatagroup/get")
+    public RpcResult<Widget[]> getWidgetMetadataGroup(@RequestParam final String url,
+                                               @RequestParam final String type) {
+        return new RpcOperation<Widget[]>() {
+            @Override
+            public Widget[] execute() {
+                if (widgetMetadataResolverMap.get(type) == null) {
+                    throw new IllegalArgumentException("Get Metadata group for provider " + type + " is not implemented");
+                }
+                return widgetMetadataResolverMap.get(type).getMetadataGroup(url);
+            }
+        }.getResult();
+    }
 }

Modified: incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties?rev=1299768&r1=1299767&r2=1299768&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/resources/messages.properties Mon Mar 12 18:13:37 2012
@@ -48,6 +48,7 @@ page.error.reload=reloading
 page.error.details=technical details
 
 page.general.back=Back to Rave
+page.general.browse=Browse
 page.general.addnewpage=Add a New Page
 page.general.confirmpassword=Confirm password:
 page.general.deletepage=Delete Page

Modified: incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties?rev=1299768&r1=1299767&r2=1299768&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties Mon Mar 12 18:13:37 2012
@@ -50,6 +50,7 @@ page.error.reload=herladen
 page.error.details=Technische details
 
 page.general.back=Terug naar Rave
+page.general.browse=Blader
 page.general.addnewpage=Voeg een nieuwe pagina toe
 page.general.confirmpassword=Bevestig wachtwoord:
 page.general.deletepage=Verwijder pagina

Modified: incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/addwidget.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/addwidget.jsp?rev=1299768&r1=1299767&r2=1299768&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/addwidget.jsp (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/addwidget.jsp Mon Mar 12 18:13:37 2012
@@ -75,10 +75,15 @@
 
             <p>
                 <label for="type1"><fmt:message key="widget.type"/> *</label>
-                <label for="type1" class="formradio"><form:radiobutton path="type" value="OpenSocial"/>
-                    <fmt:message key="widget.type.OpenSocial"/></label>
-                <label for="type2" class="formradio"><form:radiobutton path="type" value="W3C"/>
-                    <fmt:message key="widget.type.W3C"/></label>
+                <label for="type1" class="formradio">
+                    <form:radiobutton path="type" value="OpenSocial"/>
+                    <fmt:message key="widget.type.OpenSocial"/>
+                </label>
+                <label for="type2" class="formradio" style="display:inline">
+                    <form:radiobutton path="type" value="W3C"/>
+                    <fmt:message key="widget.type.W3C"/>
+                    <a id="w3cBrowseLink" style="position:relative;left:10px;" href="#"><fmt:message key="page.general.browse"/></a>
+                </label>
                 <form:errors path="type" cssClass="error"/>
             </p>
 
@@ -98,6 +103,12 @@
                                     $('#authorEmail').val(widget.authorEmail);
                                     $('#addWidgetForm').show();
                                     $('#addWidgetFormSubmit').show();
+                                    // update this field so we can pass widgets by key
+                                    // (soon to be superseeded in wookie by using the guid instead)
+                                    // remove when using 0.10.0 of wookie
+                                    if($('input[name=type]:checked').val()=='W3C'){
+                                        $('#url').val(widget.url);
+                                    }
                                 }
                             });">
                     <fmt:message key="page.getWidgetMetadata.button"/>
@@ -178,4 +189,144 @@
         rave.setContext("<spring:url value="/app/" />");
         $('#addWidgetForm').hide();
         $('#addWidgetFormSubmit').hide();
-    });</script>
\ No newline at end of file
+        $('#w3cBrowseLink').hide();
+        $('input[name=type]:first').attr('checked', true);
+        $('input[name=type]').change(function(){
+            if($('input[name=type]:checked').val()=='W3C'){
+                $('#w3cBrowseLink').show();
+            }
+            else{
+                $('#w3cBrowseLink').hide();
+            }
+        });
+
+        $("#w3cBrowseForm").dialog({
+            autoOpen: false,
+            height: 300,
+            width: 350,
+            modal: true,
+            buttons: {
+                Cancel: function(){
+                    $(this).dialog("close");
+                }
+            },
+            close: function(){
+                // clear contents
+                $('#w3cwidgetsList').empty();
+            }
+        });
+
+        $("#w3cBrowseLink").click(function() {
+            rave.api.rpc.getWidgetMetadataGroup({
+                url: "?all=true",
+                providerType: "W3C",
+                successCallback: function(result) {
+                var i=0;
+                var widgets = result.result;
+                PostLoadW3cWidgets.setList(widgets);
+                jQuery.each(widgets, function() {
+                    $('#w3cwidgetsList')
+                        .append(
+                            $("<li/>")
+                            .addClass("storeItem")
+                            .append(
+                                $("<div/>")
+                                .addClass("storeItemLeft")
+                                .append(
+                                    $("<div/>")
+                                    .attr("id", "w3cImageHolder"+i)
+                                )
+                                .append(
+                                    $("<div/>")
+                                    .attr("id", "widgetAdded")
+                                    .addClass("storeButton")
+                                    .append(
+                                        $("<button/>")
+                                        .addClass("storeItemButton")
+                                        .attr("id", this.url)
+                                        .attr("onclick", "updateRaveMetadata("+i+");")
+                                        .text("Get Metadata")
+                                    )
+                                )
+                            )
+                            .append(
+                                $("<div/>")
+                                .addClass("storeItemCenter")
+                                .append(
+                                    $("<div/>")
+                                    .addClass("secondaryPageItemTitle")
+                                    .text(this.title)
+                                )
+                                .append(
+                                    $("<div/>")
+                                    .addClass("storeWidgetAuthor")
+                                    .text(this.author)
+                                )
+                                .append(
+                                    $("<div/>")
+                                    .addClass("storeWidgetDesc")
+                                    .text(this.description)
+                                )
+                            )
+                            .append(
+                                $("<div/>")
+                                .addClass("clear-float")
+                            )
+                        )
+                        // add the thumbnail image if found
+                        if(this.thumbnailUrl!=null){
+                            $('#w3cImageHolder'+i)
+                            .append(
+                                $("<img/>")
+                                .addClass("storeWidgetThumbnail")
+                                .attr("src", this.thumbnailUrl)
+                                .attr("title", this.title)
+                                .attr("alt", "")
+                                .attr("width", "80")
+                                .attr("height", "80")
+                            )
+                        }
+                    i++;
+                    });
+                    $("#w3cBrowseForm").dialog("open");
+                }
+            })
+        });
+    });
+
+   // use this object to hold the choices of w3c widgets after the page has loaded.
+    var PostLoadW3cWidgets = new function PostLoadW3cWidgets() {
+        this.list = null;
+        this.setList = function (list) {
+            this.list = list;
+        }
+        this.getList = function () {
+            return this.list;
+        }
+        this.getListItemByIndex = function(idx){
+            return this.list[idx];
+        }
+    }
+
+    function updateRaveMetadata(id){
+        if(id != null){
+            widget = PostLoadW3cWidgets.getListItemByIndex(id);
+            $('#title').val(widget.title);
+            $('#description').val(widget.description);
+            $('#thumbnailUrl').val(widget.thumbnailUrl);
+            $('#screenshotUrl').val(widget.screenshotUrl);
+            $('#titleUrl').val(widget.titleUrl);
+            $('#author').val(widget.author);
+            $('#authorEmail').val(widget.authorEmail);
+            $('#url').val(widget.url);
+            $('#addWidgetForm').show();
+            $('#addWidgetFormSubmit').show();
+        }
+        $("#w3cBrowseForm").dialog("close");
+    }
+    </script>
+
+    <div id="w3cBrowseForm" title="Browse available W3C widgets">
+        <ul id="w3cwidgetsList" class="storeItems">
+        </ul>
+    </div>

Modified: incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_api.js
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_api.js?rev=1299768&r1=1299767&r2=1299768&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_api.js (original)
+++ incubator/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_api.js Mon Mar 12 18:13:37 2012
@@ -402,6 +402,27 @@ rave.api = rave.api || (function() {
                }).error(handleError);
         }
 
+        function getWidgetMetadataGroup(args) {
+            var url = args.url;
+            var providerType = args.providerType;
+            if ( url == null || providerType == null ) {
+                alert(rave.getClientMessage("api.widget_metadata.invalid_params"));
+                return;
+            }
+            $.post(rave.getContext() + path + "widget/metadatagroup/get",
+               {"url": url, "type": providerType},
+               function(result) {
+                   if (result.error) {
+                       alert(rave.getClientMessage("api.widget_metadata.parse_error"));
+                   }
+                   else {
+                       if (typeof args.successCallback == 'function') {
+                            args.successCallback(result);
+                       }
+                   }
+               }).error(handleError);
+        }
+
         return {
             moveWidget : moveWidgetOnPage,
             addWidgetToPage : addWidgetToPage,
@@ -411,7 +432,8 @@ rave.api = rave.api || (function() {
             getPagePrefs: getPagePrefs,
             movePage: movePage,
             moveWidgetToPage: moveWidgetToPage,
-            getWidgetMetadata: getWidgetMetadata
+            getWidgetMetadata: getWidgetMetadata,
+            getWidgetMetadataGroup: getWidgetMetadataGroup
         };
 
     })();

Modified: incubator/rave/trunk/rave-providers/rave-opensocial-provider/src/main/java/org/apache/rave/provider/opensocial/service/impl/OpenSocialWidgetMetadataResolver.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-providers/rave-opensocial-provider/src/main/java/org/apache/rave/provider/opensocial/service/impl/OpenSocialWidgetMetadataResolver.java?rev=1299768&r1=1299767&r2=1299768&view=diff
==============================================================================
--- incubator/rave/trunk/rave-providers/rave-opensocial-provider/src/main/java/org/apache/rave/provider/opensocial/service/impl/OpenSocialWidgetMetadataResolver.java (original)
+++ incubator/rave/trunk/rave-providers/rave-opensocial-provider/src/main/java/org/apache/rave/provider/opensocial/service/impl/OpenSocialWidgetMetadataResolver.java Mon Mar 12 18:13:37 2012
@@ -108,4 +108,10 @@ public class OpenSocialWidgetMetadataRes
         }
         return null;
  }
+
+    @Override
+    public Widget[] getMetadataGroup(String groupUrl) {
+      // not implemented
+      return null;
+    }
 }

Added: incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/repository/W3CWidgetMetadataRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/repository/W3CWidgetMetadataRepository.java?rev=1299768&view=auto
==============================================================================
--- incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/repository/W3CWidgetMetadataRepository.java (added)
+++ incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/repository/W3CWidgetMetadataRepository.java Mon Mar 12 18:13:37 2012
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.rave.provider.w3c.repository;
+
+public interface W3CWidgetMetadataRepository {
+    /**
+     * Fetches widget metadata for the widget via
+     * either an internal widget key or by
+     * using a w3cs widgets guid
+     *
+     * @param widgetGuid The widget to fetch metadata for.
+     * @return The string response from the w3c widget server.
+     */
+    public String getWidgetMetadata(String widgetGuid);
+}

Added: incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/repository/impl/WookieWidgetMetadataRepository.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/repository/impl/WookieWidgetMetadataRepository.java?rev=1299768&view=auto
==============================================================================
--- incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/repository/impl/WookieWidgetMetadataRepository.java (added)
+++ incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/repository/impl/WookieWidgetMetadataRepository.java Mon Mar 12 18:13:37 2012
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.rave.provider.w3c.repository.impl;
+
+import org.apache.rave.provider.w3c.repository.W3CWidgetMetadataRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.client.RestClientException;
+import org.springframework.web.client.RestOperations;
+
+/**
+ * Handles the call to wookies metadata service
+ * (wookie currently uses an xml format response)
+ */
+@Repository
+public class WookieWidgetMetadataRepository implements W3CWidgetMetadataRepository {
+    private static Logger logger = LoggerFactory.getLogger(WookieWidgetMetadataRepository.class);
+    private RestOperations restOperations;
+    private String wookieUrl;
+
+    @Autowired
+    public WookieWidgetMetadataRepository(@Qualifier(value = "xmlStringCompatibleRestTemplate") RestOperations restOperations,
+                                          @Value("${provider.wookie.wookieServerUrl}") String wookieRoot) {
+        this.restOperations = restOperations;
+        this.wookieUrl = wookieRoot + "/widgets/";
+        logger.debug("Wookie render Url: {}", wookieUrl);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.rave.provider.w3c.repository.W3CWidgetMetadataRepository#getWidgetMetadata(java.lang.String)
+     */
+    @Override
+    public String getWidgetMetadata(String widgetGuid) {
+        String responseString = null;
+        try {
+            responseString = restOperations.getForObject(wookieUrl + widgetGuid, String.class);
+        } catch (RestClientException e) {
+            throw new IllegalArgumentException("Error occurred while processing response from wookie metadata call", e);
+        }
+        // return the raw xml
+        return responseString;
+    }
+
+}

Added: incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/service/impl/WookieWidgetMetadataResolver.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/service/impl/WookieWidgetMetadataResolver.java?rev=1299768&view=auto
==============================================================================
--- incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/service/impl/WookieWidgetMetadataResolver.java (added)
+++ incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/service/impl/WookieWidgetMetadataResolver.java Mon Mar 12 18:13:37 2012
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.rave.provider.w3c.service.impl;
+
+import org.apache.rave.portal.model.Widget;
+import org.apache.rave.portal.service.WidgetMetadataResolver;
+import org.apache.rave.provider.w3c.Constants;
+import org.apache.rave.provider.w3c.repository.W3CWidgetMetadataRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+@Component
+public class WookieWidgetMetadataResolver implements WidgetMetadataResolver {
+    private static Logger logger = LoggerFactory.getLogger(WookieWidgetMetadataResolver.class);
+    private W3CWidgetMetadataRepository widgetMetadataRepository;
+
+    @Autowired
+    public WookieWidgetMetadataResolver(W3CWidgetMetadataRepository widgetMetadataRepository){
+        this.widgetMetadataRepository = widgetMetadataRepository;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.rave.portal.service.WidgetMetadataResolver#getSupportedContext()
+     */
+    public String getSupportedContext() {
+        return Constants.WIDGET_TYPE;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.rave.portal.service.WidgetMetadataResolver#getMetadata(java.lang.String)
+     */
+    public Widget getMetadata(String url) {
+        try {
+            String xmlResult = widgetMetadataRepository.getWidgetMetadata(url);
+            Widget[] widgets = processResponse(xmlResult);
+            return widgets[0];
+        } catch (Exception e) {
+            throw new IllegalArgumentException("Error occurred while processing response for Widget metadata call", e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.rave.portal.service.WidgetMetadataResolver#getMetadataGroup(java.lang.String)
+     */
+    @Override
+    public Widget[] getMetadataGroup(String url) {
+        try {
+            String xmlResult = widgetMetadataRepository.getWidgetMetadata(url);
+            return processResponse(xmlResult);
+        } catch (Exception e) {
+            throw new IllegalArgumentException("Error occurred while processing response for Widget (group) metadata call", e);
+        }
+    }
+
+    /**
+     * Method sets up the xml parsing routine. (from a string supplied from wookie)
+     * @param rawXml - raw xml string
+     * @return an array of widgets
+     */
+    private Widget[] processResponse(String rawXml){
+        Widget[] widgets = null;
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document xml = db.parse(new InputSource(new StringReader(rawXml)));
+            widgets = parseWookieAdvert(xml);
+        } catch (ParserConfigurationException e) {
+            throw new IllegalArgumentException("Error occurred while processing response for Widget metadata call", e);
+        } catch (SAXException e) {
+            throw new IllegalArgumentException("Error occurred while processing response for Widget metadata call", e);
+        } catch (IOException e) {
+            throw new IllegalArgumentException("Error occurred while processing response for Widget metadata call", e);
+        }
+        return widgets;
+    }
+
+    /**
+     * Method to parse an xml response from wookie into a set of Widget objects
+     * @param xml -a w3c dom document
+     * @return an array of widgets
+     */
+    private Widget[] parseWookieAdvert(Document xml){
+        List<Widget> widgets = new ArrayList<Widget>();
+        Widget widget;
+        Element currentElement = null;
+        Element rootEl = xml.getDocumentElement();
+        NodeList widgetNodes = rootEl.getElementsByTagName("widget");
+        if(widgetNodes != null && widgetNodes.getLength() > 0) {
+            for(int i = 0 ; i < widgetNodes.getLength();i++) {
+                widget = new Widget();
+                widget.setType(getSupportedContext());
+                // get the guid
+                Element el = (Element)widgetNodes.item(i);
+                widget.setUrl(el.getAttribute("identifier"));
+                // get the title
+                Node titleNode = el.getElementsByTagName("title").item(0);
+                if(titleNode != null){
+                    currentElement = (Element)titleNode;
+                    widget.setTitle(currentElement.getTextContent());
+                }
+                // get the description
+                Node descriptionNode = el.getElementsByTagName("description").item(0);
+                if(descriptionNode != null){
+                    currentElement = (Element)descriptionNode;
+                    widget.setDescription(currentElement.getTextContent());
+                }
+                // get the icon
+                Node iconNode = el.getElementsByTagName("icon").item(0);
+                if(iconNode != null){
+                    currentElement = (Element)iconNode;
+                    widget.setThumbnailUrl(currentElement.getTextContent());
+                }
+                // get the icon
+                Node authorNode = el.getElementsByTagName("author").item(0);
+                if(authorNode != null){
+                    currentElement = (Element)authorNode;
+                    widget.setAuthor(currentElement.getTextContent());
+                }
+                // add to the list
+                widgets.add(widget);
+            }
+        }
+        Widget[] widgetsArr = new Widget[widgets.size()];
+        widgetsArr = widgets.toArray(widgetsArr);
+        return widgetsArr;
+    }
+
+}

Modified: incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/resources/org/apache/rave/w3c-provider-applicationContext.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/resources/org/apache/rave/w3c-provider-applicationContext.xml?rev=1299768&r1=1299767&r2=1299768&view=diff
==============================================================================
--- incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/resources/org/apache/rave/w3c-provider-applicationContext.xml (original)
+++ incubator/rave/trunk/rave-providers/rave-w3c-provider/src/main/resources/org/apache/rave/w3c-provider-applicationContext.xml Mon Mar 12 18:13:37 2012
@@ -20,15 +20,33 @@
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:util="http://www.springframework.org/schema/util"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
-        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
+        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
 
     <!-- rave-w3c-provider base-package scan -->
     <context:component-scan base-package="org.apache.rave.provider.w3c"/>
 
+    <!-- A RestTemplate instance that can be used to call a web service which expects Content-Type
+    and Accept headers of application/xml -->
+    <bean id="xmlStringCompatibleRestTemplate" class="org.springframework.web.client.RestTemplate">
+        <property name="messageConverters">
+            <list>
+                <bean class="org.springframework.http.converter.StringHttpMessageConverter">
+                    <property name="supportedMediaTypes">
+                        <list>
+                            <util:constant static-field="org.springframework.http.MediaType.TEXT_XML"/>
+                        </list>
+                    </property>
+                </bean>
+            </list>
+        </property>
+    </bean>
+
     <bean id="wookieWidgetService" class="org.apache.rave.provider.w3c.service.impl.WookieWidgetService">
         <constructor-arg name="wookieServerUrl" value="${provider.wookie.wookieServerUrl}"/>
         <constructor-arg name="wookieApiKey" value="${provider.wookie.wookieApiKey}"/>
     </bean>
 
-</beans>
\ No newline at end of file
+</beans>

Added: incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/java/org/apache/rave/provider/w3c/service/impl/WookieWidgetMetadataResolverTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/java/org/apache/rave/provider/w3c/service/impl/WookieWidgetMetadataResolverTest.java?rev=1299768&view=auto
==============================================================================
--- incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/java/org/apache/rave/provider/w3c/service/impl/WookieWidgetMetadataResolverTest.java (added)
+++ incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/java/org/apache/rave/provider/w3c/service/impl/WookieWidgetMetadataResolverTest.java Mon Mar 12 18:13:37 2012
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.rave.provider.w3c.service.impl;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.rave.portal.model.Widget;
+import org.apache.rave.portal.service.WidgetMetadataResolver;
+import org.apache.rave.provider.w3c.repository.W3CWidgetMetadataRepository;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+public class WookieWidgetMetadataResolverTest {
+    private W3CWidgetMetadataRepository wookieWidgetMetadataRepository;
+    private WidgetMetadataResolver widgetMetadataResolver;
+    private static final String TYPE = "W3C";
+
+    // TODO - update these tests to use GUID rather than id once rave is bundled with wookie 0.10.0
+    private static final String VALID_IDENTIFIER = "7";
+    private static final String VALID_GROUP_IDENTIFIER = "?all=true";
+    private static final String NO_WIDGETS_RESPONSE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><widgets></widgets>";
+    private static File ALL_WIDGETS_FILE;
+    private static File SINGLE_WIDGET_FILE;
+
+    @Before
+    public void setup() {
+        wookieWidgetMetadataRepository = createNiceMock(W3CWidgetMetadataRepository.class);
+        widgetMetadataResolver = new WookieWidgetMetadataResolver(wookieWidgetMetadataRepository);
+        ALL_WIDGETS_FILE = new File("src/test/resources/allwidgets.xml");
+        SINGLE_WIDGET_FILE = new File("src/test/resources/singlewidget.xml");
+    }
+
+    @Test
+    public void getSupportedContext_test() {
+        assertNotNull(widgetMetadataResolver.getSupportedContext());
+    }
+
+    @Test
+    public void getMetadata() throws IOException {
+        assertTrue(SINGLE_WIDGET_FILE.exists());
+        String xmlText = FileUtils.readFileToString(SINGLE_WIDGET_FILE);
+        expect(wookieWidgetMetadataRepository.getWidgetMetadata(VALID_IDENTIFIER)).andReturn(xmlText);
+        replay(wookieWidgetMetadataRepository);
+        Widget w = widgetMetadataResolver.getMetadata(VALID_IDENTIFIER);
+        assertNotNull(w);
+        assertEquals("freeder", w.getTitle());
+        assertEquals("Apache Wookie (Incubating) Team", w.getAuthor());
+        assertEquals("http://wookie.apache.org/widgets/freeder", w.getUrl());
+        assertEquals("An RSS reader widget optimised for small screens or desktop widgets.", w.getDescription());
+        assertEquals("http://localhost:8080/wookie/wservices/wookie.apache.org/widgets/freeder/images/icon.png", w.getThumbnailUrl());
+        assertEquals(TYPE, w.getType());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void getMetadata_noWidgetFound() {
+        expect(wookieWidgetMetadataRepository.getWidgetMetadata(VALID_IDENTIFIER)).andReturn(NO_WIDGETS_RESPONSE);
+        replay(wookieWidgetMetadataRepository);
+        Widget w = widgetMetadataResolver.getMetadata(VALID_IDENTIFIER);
+        assertNotNull(w);
+    }
+
+    @Test
+    public void getAllWidgets() throws IOException {
+        assertTrue(ALL_WIDGETS_FILE.exists());
+        String xmlText = FileUtils.readFileToString(ALL_WIDGETS_FILE);
+        expect(wookieWidgetMetadataRepository.getWidgetMetadata(VALID_GROUP_IDENTIFIER)).andReturn(xmlText);
+        replay(wookieWidgetMetadataRepository);
+        Widget[] widgets = widgetMetadataResolver.getMetadataGroup(VALID_GROUP_IDENTIFIER);
+        assertEquals(14, widgets.length);
+        assertNull(widgets[0].getThumbnailUrl());
+        assertEquals("http://www.getwookie.org/widgets/wiki", widgets[3].getUrl());
+        assertEquals("A silly Weather widget", widgets[4].getDescription());
+        assertEquals("Ta-Da!", widgets[9].getTitle());
+        assertEquals("http://localhost:8080/wookie/wservices/www.opera.com/widgets/bubbles/icon_64.png", widgets[12].getThumbnailUrl());
+    }
+}

Added: incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/resources/allwidgets.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/resources/allwidgets.xml?rev=1299768&view=auto
==============================================================================
--- incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/resources/allwidgets.xml (added)
+++ incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/resources/allwidgets.xml Mon Mar 12 18:13:37 2012
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+<widgets><widget id="1" identifier="http://notsupported" width="500" height="358" version=""><title short="">Unsupported widget widget</title><description>This widget is a placeholder for when no corresponding widget is found for a given type</description><category>unsupported</category><author>Paul Sharples</author><license>Licensed under the Apache 2.0 License (see http://www.apache.org/licenses/LICENSE-2.0).</license></widget><widget id="802" identifier="http://www.getwookie.org/widgets/natter" width="255" height="383" version=""><title short="">Natter</title><description>basic chat widget</description><icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/natter/icon.png</icon><author>Scott Wilson</author><license>Licensed under the Apache 2.0 License (see http://www.apache.org/licenses/LICENSE-2.0). Smileys created by macpoupou and licensed under Creative Commons Attribution License 3.0. See http://ismileys.free.fr/smileys/ for more information.</license
 ><preference name="moderator" value="false" readonly="false"/></widget><widget id="3" identifier="http://wookie.apache.org/widgets/butterfly" width="420" height="350" version="0.1"><title short="">Butterfly</title><description>Paint colourful butterflies!</description><icon>http://localhost:8080/wookie/wservices/wookie.apache.org/widgets/butterfly/images/icon.png</icon><author>Apache Wookie (Incubating) Team</author><license>Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</license></widget><widget id="4" identifier="http://www.getwookie.org/widgets/wiki" width="320" height="520" version="1.0"><title short="">WookieWiki</title><description>A Wiki In A Widget</description><icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/wiki/icon.png</icon><author>Apache Wookie (Incubating) Team</author><license>Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless requ
 ired by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Note this widget makes heavy use of Creole, (c) 2009 by Ivan Fomichev (see license in creole.js)</license></widget><widget id="5" identifier="http://www.getwookie.org/widgets/weather" width="125" height="125" version="1.0"><title short="">Weather</title><description>A silly Weather widget</description><icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/weather/icon.png</icon><author>Scott Wilson</author><license>Licensed under the Apache 2.0 License (see http://www.apache.org/licenses/LICENSE-2.0).</license></widget><widget id="6" identifier="http://wookie.apache.org/widgets/sharedraw" width="420" height="320" version="0.1"><title short="">ShareDraw</title><descripti
 on>A collaborative drawing application - sketch with friends!</description><icon>http://localhost:8080/wookie/wservices/wookie.apache.org/widgets/sharedraw/images/icon.png</icon><author>Apache Wookie (Incubating) Team</author><license>Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</licens
 e></widget><widget id="7" identifier="http://wookie.apache.org/widgets/freeder" width="320" height="480" version="0.1"><title short="">freeder</title><description>An RSS reader widget optimised for small screens or desktop widgets.</description><icon>http://localhost:8080/wookie/wservices/wookie.apache.org/widgets/freeder/images/icon.png</icon><author>Apache Wookie (Incubating) Team</author><license>Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WAR
 RANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</license></widget><widget id="801" identifier="http://wookie.apache.org/widgets/geo" width="620" height="660" version="0.1"><title short="">geo</title><description>An example of a HTML 5 geolocation widget.</description><icon>http://localhost:8080/wookie/wservices/wookie.apache.org/widgets/geo/icon.svg</icon><author>Apache Wookie (Incubating) Team</author><license>Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by a
 pplicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</license></widget><widget id="9" identifier="http://www.getwookie.org/widgets/youdecide" width="255" height="320" version="1.0"><title short="">You decide</title><description>A quick and simple voting widget</description><icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/youdecide/icon.png</icon><author>Scott Wilson</author><preference name="moderator" value="false" readonly="false"/></widget><widget id="10" identifier="http://www.getwookie.org/widgets/todo" width="320" height="460" version=""><title short="">Ta-Da!</title><description>A shared to-do list widget</description><icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/icon.png</icon><author>Ap
 ache Wookie (Incubating) Team</author><license>Licensed under the Apache 2.0 License (see http://www.apache.org/licenses/LICENSE-2.0).</license></widget><widget id="11" identifier="http://www.getwookie.org/widgets/camera" width="380" height="380" version=""><title short="">camera</title><description>A widget demonstrating the use of the BONDI camera API</description><icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/camera/icon.svg</icon><author>Apache Wookie (Incubating) Team</author><license>Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
  law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</license></widget><widget id="12" identifier="http://wookie.apache.org/widgets/simplechat" width="255" height="383" version=""><title short="">SimpleChat</title><description>Stripped down chat widget with minimal styling</description><icon>http://localhost:8080/wookie/wservices/wookie.apache.org/widgets/simplechat/icon.png</icon><author>Apache Wookie (Incubating) Team</author><license>Licensed under the Apache 2.0 License (see http://www.apache.org/licenses/LICENSE-2.0). Smileys created by macpoupou and licensed under Creative Commons Attribution License 3.0. See http://ismileys.free.fr/smileys/ for more information.</license><preference name="moderator" value="false" readonly="false"/></widget><widget 
 id="13" identifier="http://www.opera.com/widgets/bubbles" width="240" height="320" version="2006-07-26"><title short="">Bubbles</title><description>A Bubbles game</description><icon>http://localhost:8080/wookie/wservices/www.opera.com/widgets/bubbles/icon_64.png</icon><author>Mathieu Henri, Gautam Chandna, Christian Mangnus Sinding-Larsen, Opera Software ASA</author><license>Copyright (c) 2007, Opera Software ASA All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of Opera Software ASA nor the names of its contributors may be 
 used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY OPERA SOFTWARE ASA ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPERA SOFTWARE ASA BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</license></widget><widget id="14" identifier="http://www.getwookie.org/widgets/sudoku" width="520" height="380" version="1.0"><title short="">Wave Test: Sudoku</ti
 tle><description>Google Wave Sudoku Widget</description><icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/sudoku/icon.png</icon><author>Austin Chau</author><license>Unknown (c) Google.com</license></widget></widgets>

Added: incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/resources/singlewidget.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/resources/singlewidget.xml?rev=1299768&view=auto
==============================================================================
--- incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/resources/singlewidget.xml (added)
+++ incubator/rave/trunk/rave-providers/rave-w3c-provider/src/test/resources/singlewidget.xml Mon Mar 12 18:13:37 2012
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+<widgets><widget id="7" identifier="http://wookie.apache.org/widgets/freeder" width="320" height="480" version="0.1"><title  short="">freeder</title><description>An RSS reader widget optimised for small screens or desktop widgets.</description><icon>http://localhost:8080/wookie/wservices/wookie.apache.org/widgets/freeder/images/icon.png</icon><author>Apache Wookie (Incubating) Team</author><license>Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot;
  BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</license></widget></widgets>