abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r545838 - in /incubator/abdera/java/trunk/contrib/rss/src: main/java/org/apache/abdera/contrib/rss/ test/java/org/apache/abdera/test/contrib/rss/ test/resources/
Date Sun, 10 Jun 2007 04:35:37 GMT
Author: jmsnell
Date: Sat Jun  9 21:35:35 2007
New Revision: 545838

URL: http://svn.apache.org/viewvc?view=rev&rev=545838
Log:
filling out more of the rss 1.0 support

Modified:
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssCategory.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssChannel.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssConstants.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssExtensionFactory.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssFeed.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssItem.java
    incubator/abdera/java/trunk/contrib/rss/src/test/java/org/apache/abdera/test/contrib/rss/RssTest.java
    incubator/abdera/java/trunk/contrib/rss/src/test/resources/rss1.rdf

Modified: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssCategory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssCategory.java?view=diff&rev=545838&r1=545837&r2=545838
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssCategory.java
(original)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssCategory.java
Sat Jun  9 21:35:35 2007
@@ -44,7 +44,8 @@
   }
 
   public IRI getScheme() {
-    return new IRI(this.getAttributeValue("domain"));
+    String domain = this.getAttributeValue("domain");
+    return (domain != null) ? new IRI(this.getAttributeValue("domain")) : null;
   }
 
   public String getTerm() {

Modified: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssChannel.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssChannel.java?view=diff&rev=545838&r1=545837&r2=545838
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssChannel.java
(original)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssChannel.java
Sat Jun  9 21:35:35 2007
@@ -20,7 +20,6 @@
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -87,9 +86,7 @@
               Element entryel = null;
               try {
                 entryel = locate(path);
-              } catch (Exception e) {
-                e.printStackTrace();
-              }
+              } catch (Exception e) {}
               if (entryel != null) {
                 //TODO:fix this.. entryel should already be an RssItem
                 entries.add(new RssItem(entryel));
@@ -197,21 +194,34 @@
   }
 
   public Person getAuthor() {
-    return getExtension(RssConstants.QNAME_MANAGINGEDITOR);
+    Person person = getExtension(RssConstants.QNAME_MANAGINGEDITOR);
+    if (person == null) person = getExtension(RssConstants.QNAME_DC_CREATOR);
+    return person;
   }
 
   public List<Person> getAuthors() {
-    return getExtensions(RssConstants.QNAME_MANAGINGEDITOR);
+    List<Person> people = getExtensions(RssConstants.QNAME_MANAGINGEDITOR);
+    if (people == null || people.size() == 0) people = getExtensions(RssConstants.QNAME_DC_CREATOR);
+    return people;
+  }
+  
+  public List<Person> getContributors() {
+    List<Person> people = getExtensions(RssConstants.QNAME_DC_CONTRIBUTOR);
+    return people;
   }
 
   public List<Category> getCategories() {
-    return getExtensions(RssConstants.QNAME_CATEGORY);
+    List<Category> cats = getExtensions(RssConstants.QNAME_CATEGORY);
+    if (cats == null || cats.size() == 0) cats = getExtensions(RssConstants.QNAME_DC_SUBJECT);
+    return cats;
   }
 
   @SuppressWarnings("unchecked")
   public List<Category> getCategories(String scheme) {
-    Iterator i = new FOMElementIterator(getInternal(), RssCategory.class, new QName("domain"),
scheme, null);
-    return new FOMList<Category>(i);
+    return (scheme != null) ? 
+      new FOMList<Category>(
+        new FOMElementIterator(getInternal(), RssCategory.class, new QName("domain"), scheme,
null)
+      ) : getCategories();
   }
 
   public Generator getGenerator() {
@@ -228,14 +238,20 @@
   }
 
   public IRI getId() {
-    return null;
+    IRIElement id = getIdElement();
+    return (id != null) ? id.getValue() : null;
   }
 
   public IRIElement getIdElement() {
-    return null;
+    return getExtension(RssConstants.QNAME_DC_IDENTIFIER);
   }
 
   public Link getLink(String rel) {
+    if (rel.equals(Link.REL_ALTERNATE) || rel.equals(Link.REL_ALTERNATE_IANA)) {
+      RssGuid guid = (RssGuid) getIdElement();
+      if (guid != null && guid.isPermalink()) return guid;
+      return getAlternateLink();
+    }
     List<Link> links = FOMHelper.getLinks(getInternal(), rel);
     return (links != null && links.size() > 0) ? links.get(0) : null;
   }
@@ -296,7 +312,9 @@
   }
 
   public Text getRightsElement() {
-    return getExtension(RssConstants.QNAME_COPYRIGHT);
+    Text text = getExtension(RssConstants.QNAME_COPYRIGHT);
+    if (text == null) text = getExtension(RssConstants.QNAME_DC_RIGHTS);
+    return text;
   }
 
   public Type getRightsType() {
@@ -321,6 +339,7 @@
   public Text getSubtitleElement() {
     Text text = getExtension(RssConstants.QNAME_DESCRIPTION);
     if (text == null) text = getExtension(RssConstants.QNAME_RDF_DESCRIPTION);
+    if (text == null) text = getExtension(RssConstants.QNAME_DC_DESCRIPTION);
     return text;
   }
 
@@ -337,6 +356,7 @@
   public Text getTitleElement() {
     Text text = getExtension(RssConstants.QNAME_TITLE);
     if (text == null) text = getExtension(RssConstants.QNAME_RDF_TITLE);
+    if (text == null) text = getExtension(RssConstants.QNAME_DC_TITLE);
     return text;
   }
 
@@ -355,6 +375,7 @@
     if (dt == null) dt = getExtension(RssConstants.QNAME_LASTBUILDDATE2);
     if (dt == null) dt = getExtension(RssConstants.QNAME_PUBDATE);
     if (dt == null) dt = getExtension(RssConstants.QNAME_PUBDATE2);
+    if (dt == null) dt = getExtension(RssConstants.QNAME_DC_DATE);
     return dt;
   }
 
@@ -371,6 +392,7 @@
   public DateTime getPublishedElement() {
     DateTime dt = getExtension(RssConstants.QNAME_PUBDATE);
     if (dt == null) dt = getExtension(RssConstants.QNAME_PUBDATE2);
+    if (dt == null) dt = getExtension(RssConstants.QNAME_DC_DATE);
     return dt;
   }
 
@@ -504,7 +526,9 @@
   }
 
   public String getLanguage() {
-    return getSimpleExtension(RssConstants.QNAME_LANGUAGE);
+    String lang = getSimpleExtension(RssConstants.QNAME_LANGUAGE);
+    if (lang == null) lang = getSimpleExtension(RssConstants.QNAME_DC_LANGUAGE);
+    return lang;
   }
 
   public void setLanguage(String language) {  

Modified: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssConstants.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssConstants.java?view=diff&rev=545838&r1=545837&r2=545838
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssConstants.java
(original)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssConstants.java
Sat Jun  9 21:35:35 2007
@@ -24,6 +24,7 @@
   public static final String ENC_NS = "http://purl.org/rss/1.0/modules/content/";
   public static final String RDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
   public static final String RSS1_NS = "http://purl.org/rss/1.0/";
+  public static final String DC_NS = "http://purl.org/dc/elements/1.1/";
   
   public static final QName QNAME_RDF = new QName(RDF_NS,"RDF");
   public static final QName QNAME_RDF_CHANNEL = new QName(RSS1_NS,"channel");
@@ -82,5 +83,21 @@
   public static final QName QNAME_NAME = new QName("name");
   
   public static final QName QNAME_CONTENT_ENCODED = new QName(ENC_NS, "encoded");
+  
+  public static final QName QNAME_DC_TITLE = new QName(DC_NS, "title");
+  public static final QName QNAME_DC_CREATOR = new QName(DC_NS, "creator");
+  public static final QName QNAME_DC_SUBJECT = new QName(DC_NS, "subject");
+  public static final QName QNAME_DC_DESCRIPTION = new QName(DC_NS, "description");
+  public static final QName QNAME_DC_PUBLISHER = new QName(DC_NS, "publisher");
+  public static final QName QNAME_DC_CONTRIBUTOR = new QName(DC_NS, "contributor");
+  public static final QName QNAME_DC_DATE = new QName(DC_NS, "date");
+  public static final QName QNAME_DC_TYPE = new QName(DC_NS, "type");
+  public static final QName QNAME_DC_FORMAT = new QName(DC_NS, "format");
+  public static final QName QNAME_DC_IDENTIFIER = new QName(DC_NS, "identifier");
+  public static final QName QNAME_DC_SOURCE = new QName(DC_NS, "source");
+  public static final QName QNAME_DC_LANGUAGE = new QName(DC_NS, "language");
+  public static final QName QNAME_DC_RELATION = new QName(DC_NS, "relation");
+  public static final QName QNAME_DC_COVERAGE = new QName(DC_NS, "covrerage");
+  public static final QName QNAME_DC_RIGHTS = new QName(DC_NS, "rights");
   
 }

Modified: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssExtensionFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssExtensionFactory.java?view=diff&rev=545838&r1=545837&r2=545838
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssExtensionFactory.java
(original)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssExtensionFactory.java
Sat Jun  9 21:35:35 2007
@@ -44,20 +44,30 @@
       return (T)(new RssItem(internal));
     } else if (qname.equals(QNAME_LINK) || qname.equals(QNAME_RDF_LINK)) {
       return (T)(new RssLink(internal));
-    } else if (qname.equals(QNAME_TITLE) || qname.equals(QNAME_RDF_TITLE)) {
+    } else if (qname.equals(QNAME_TITLE) || 
+               qname.equals(QNAME_RDF_TITLE) ||
+               qname.equals(QNAME_DC_TITLE) ||
+               qname.equals(QNAME_DESCRIPTION) || 
+               qname.equals(QNAME_RDF_DESCRIPTION) ||
+               qname.equals(QNAME_DC_DESCRIPTION) ||
+               qname.equals(QNAME_COPYRIGHT) || 
+               qname.equals(QNAME_DC_RIGHTS)) {
       return (T)(new RssText(internal));
-    } else if (qname.equals(QNAME_DESCRIPTION) || qname.equals(QNAME_RDF_DESCRIPTION)) {
-      return (T)(new RssText(internal));
-    } else if (qname.equals(QNAME_COPYRIGHT)) {
-      return (T)(new RssText(internal));
-    } else if (qname.equals(QNAME_MANAGINGEDITOR) || qname.equals(QNAME_MANAGINGEDITOR2))
{
-      return (T)(new RssPerson(internal));
-    } else if (qname.equals(QNAME_WEBMASTER) || qname.equals(QNAME_WEBMASTER2)) {
+    } else if (qname.equals(QNAME_MANAGINGEDITOR) || 
+               qname.equals(QNAME_MANAGINGEDITOR2) || 
+               qname.equals(QNAME_DC_CREATOR) ||
+               qname.equals(QNAME_DC_CONTRIBUTOR) ||
+               qname.equals(QNAME_WEBMASTER) ||
+               qname.equals(QNAME_WEBMASTER2)) {
       return (T)(new RssPerson(internal));
-    } else if (qname.equals(QNAME_PUBDATE) || qname.equals(QNAME_PUBDATE2) ||
-               qname.equals(QNAME_LASTBUILDDATE) || qname.equals(QNAME_LASTBUILDDATE2)) {
+    } else if (qname.equals(QNAME_PUBDATE) || 
+               qname.equals(QNAME_PUBDATE2) ||
+               qname.equals(QNAME_LASTBUILDDATE) || 
+               qname.equals(QNAME_LASTBUILDDATE2) ||
+               qname.equals(QNAME_DC_DATE)) {
       return (T)(new RssDateTime(internal));
-    } else if (qname.equals(QNAME_CATEGORY)) {
+    } else if (qname.equals(QNAME_CATEGORY) || 
+               qname.equals(QNAME_DC_SUBJECT)) {
       return (T)(new RssCategory(internal));
     } else if (qname.equals(QNAME_GENERATOR)) {
       return (T)(new RssGenerator(internal));
@@ -83,11 +93,13 @@
       return (T)(new RssPerson(internal));
     } else if (qname.equals(QNAME_ENCLOSURE)) {
       return (T)(new RssEnclosure(internal));
-    } else if (qname.equals(QNAME_GUID)) {
+    } else if (qname.equals(QNAME_GUID) || 
+               qname.equals(QNAME_DC_IDENTIFIER)) {
       return (T)(new RssGuid(internal));
     } else if (qname.equals(QNAME_COMMENTS)) {
       return (T)(new RssLink(internal));
-    } else if (qname.equals(QNAME_SOURCE)) {
+    } else if (qname.equals(QNAME_SOURCE) || 
+               qname.equals(QNAME_DC_SOURCE)) {
       return (T)(new RssSource(internal));
     } else if (qname.equals(QNAME_CONTENT_ENCODED)) {
       return (T)(new RssContent(internal));

Modified: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssFeed.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssFeed.java?view=diff&rev=545838&r1=545837&r2=545838
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssFeed.java
(original)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssFeed.java
Sat Jun  9 21:35:35 2007
@@ -192,7 +192,7 @@
   }
 
   public List<Person> getContributors() {
-    throw new UnsupportedOperationException("Contributor's are not supported");
+    return getChannel().getContributors();
   }
 
   public Generator getGenerator() {

Modified: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssItem.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssItem.java?view=diff&rev=545838&r1=545837&r2=545838
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssItem.java
(original)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssItem.java
Sat Jun  9 21:35:35 2007
@@ -20,7 +20,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 
 import javax.activation.DataHandler;
@@ -51,7 +50,7 @@
 
 public class RssItem 
   extends ExtensibleElementWrapper 
-  implements Entry {
+  implements Entry, IRIElement {
 
   public RssItem(Element internal) {
     super(internal);
@@ -115,10 +114,14 @@
   }
 
   public Link getAlternateLink() {
-    RssGuid guid = (RssGuid) getIdElement();
-    if (guid != null && guid.isPermalink())
-      return guid;
-    return getExtension(RssConstants.QNAME_LINK);
+    Link link = getExtension(RssConstants.QNAME_LINK);
+    if (link == null) link = getExtension(RssConstants.QNAME_RDF_LINK);
+    if (link == null) {
+      IRIElement guid = getIdElement();
+      if (guid != null && guid instanceof RssGuid && ((RssGuid)guid).isPermalink())
+        return (Link)guid;
+    }
+    return link;
   }
 
   public Link getAlternateLink(String type, String hreflang)
@@ -137,21 +140,29 @@
   }
 
   public Person getAuthor() {
-    return getExtension(RssConstants.QNAME_AUTHOR);
+    Person person = getExtension(RssConstants.QNAME_AUTHOR);
+    if (person == null) person = getExtension(RssConstants.QNAME_DC_CREATOR);
+    return person;
   }
 
   public List<Person> getAuthors() {
-    return getExtensions(RssConstants.QNAME_AUTHOR);
+    List<Person> people = getExtensions(RssConstants.QNAME_AUTHOR);
+    if (people == null || people.size() == 0) people = getExtensions(RssConstants.QNAME_DC_CREATOR);
+    return people;
   }
 
   public List<Category> getCategories() {
-    return getExtensions(RssConstants.QNAME_CATEGORY);
+    List<Category> cats = getExtensions(RssConstants.QNAME_CATEGORY);
+    if (cats == null || cats.size() == 0) cats = getExtensions(RssConstants.QNAME_DC_SUBJECT);
+    return cats;
   }
 
   @SuppressWarnings("unchecked")
   public List<Category> getCategories(String scheme) {
-    Iterator i = new FOMElementIterator(getInternal(), RssCategory.class, new QName("domain"),
scheme, null);
-    return new FOMList<Category>(i);
+    return (scheme != null) ? 
+        new FOMList<Category>(
+          new FOMElementIterator(getInternal(), RssCategory.class, new QName("domain"), scheme,
null)
+        ) : getCategories();
   }
 
   public String getContent() {
@@ -163,9 +174,7 @@
   public Content getContentElement() {
     Content content = getExtension(RssConstants.QNAME_CONTENT_ENCODED);
     // what else to return other than content:encoded and possibly atom:content?
-    if (content == null) {
-      content = getExtension(Constants.CONTENT);
-    }
+    if (content == null) content = getExtension(Constants.CONTENT);
     return content;
   }
 
@@ -174,11 +183,11 @@
   }
 
   public IRI getContentSrc() {
-    throw new UnsupportedOperationException("RSS does not support content by reference");
+    return null;
   }
 
   public InputStream getContentStream() throws IOException {
-    throw new UnsupportedOperationException("RSS does not support encoded binary content");
+    return null;
   }
 
   public Type getContentType() {
@@ -197,51 +206,50 @@
   }
 
   public List<Person> getContributors() {
-    return null;
+    List<Person> people = getExtensions(RssConstants.QNAME_DC_CONTRIBUTOR);
+    return people;
   }
 
   public Control getControl(boolean create) {
-    throw new UnsupportedOperationException("RSS does not support APP features");
+    return null;
   }
 
   public Control getControl() {
-    throw new UnsupportedOperationException("RSS does not support APP features");
+    return null;
   }
 
   public Link getEditLink() {
-    throw new UnsupportedOperationException("RSS does not support APP features");
+    return null;
   }
 
   public IRI getEditLinkResolvedHref() {
-    @SuppressWarnings("unused")
-    Link link = getEditLink();
-    throw new UnsupportedOperationException("RSS does not support APP features");
+    return null;
   }
 
   public Link getEditMediaLink() {
-    throw new UnsupportedOperationException("RSS does not support APP features");
+    return null;
   }
 
   public Link getEditMediaLink(String type, String hreflang)
       throws MimeTypeParseException {
-    throw new UnsupportedOperationException("RSS does not support APP features");
+    return null;
   }
 
   public IRI getEditMediaLinkResolvedHref() {
-    throw new UnsupportedOperationException("RSS does not support APP features");
+    return null;
   }
 
   public IRI getEditMediaLinkResolvedHref(String type, String hreflang)
       throws MimeTypeParseException {
-    throw new UnsupportedOperationException("RSS does not support APP features");
+    return null;
   }
 
   public Date getEdited() {
-    throw new UnsupportedOperationException("RSS does not support APP features");
+    return null;
   }
 
   public DateTime getEditedElement() {
-    throw new UnsupportedOperationException("RSS does not support APP features");
+    return null;
   }
 
   public Link getEnclosureLink() {
@@ -259,7 +267,10 @@
   }
 
   public IRIElement getIdElement() {
-    return getExtension(RssConstants.QNAME_GUID);
+    IRIElement id = getExtension(RssConstants.QNAME_GUID);
+    if (id == null) id = getExtension(RssConstants.QNAME_DC_IDENTIFIER);
+    if (id == null && this.getQName().equals(RssConstants.QNAME_RDF_ITEM)) return
this;
+    return id;
   }
 
   public Link getLink(String rel) {
@@ -267,6 +278,7 @@
       RssGuid guid = (RssGuid) getIdElement();
       if (guid != null && guid.isPermalink())
         return guid;
+      return getAlternateLink();
     }
     List<Link> links = FOMHelper.getLinks(getInternal(), rel);
     return (links != null && links.size() > 0) ? links.get(0) : null;
@@ -297,6 +309,7 @@
   public DateTime getPublishedElement() {
     DateTime dt = getExtension(RssConstants.QNAME_PUBDATE);
     if (dt == null) dt = getExtension(RssConstants.QNAME_PUBDATE2);
+    if (dt == null) dt = getExtension(RssConstants.QNAME_DC_DATE);
     return dt;
   }
 
@@ -311,7 +324,8 @@
       return ((RssChannel)el).getRightsElement();
     else if (el instanceof RssFeed) 
       return ((RssFeed)el).getRightsElement();
-    return null;
+    Text text = getExtension(RssConstants.QNAME_DC_RIGHTS);
+    return text;
   }
 
   public org.apache.abdera.model.Text.Type getRightsType() {
@@ -329,16 +343,21 @@
   }
 
   public Source getSource() {
-    return getExtension(RssConstants.QNAME_SOURCE);
+    Source source = getExtension(RssConstants.QNAME_SOURCE);
+    if (source == null) getExtension(RssConstants.QNAME_DC_SOURCE);
+    return source;
   }
 
   public String getSummary() {
-    Text text = getSummaryElement();
+    Text text = getSummaryElement(); 
     return (text != null) ? text.getValue() : null;
   }
 
   public Text getSummaryElement() {
-    return getExtension(RssConstants.QNAME_DESCRIPTION);
+    Text text = getExtension(RssConstants.QNAME_DESCRIPTION);
+    if (text == null) text = getExtension(RssConstants.QNAME_RDF_DESCRIPTION);
+    if (text == null) text = getExtension(RssConstants.QNAME_DC_DESCRIPTION);
+    return text;
   }
 
   public org.apache.abdera.model.Text.Type getSummaryType() {
@@ -352,7 +371,10 @@
   }
 
   public Text getTitleElement() {
-    return getExtension(RssConstants.QNAME_TITLE);
+    Text text = getExtension(RssConstants.QNAME_TITLE);
+    if (text == null) text = getExtension(RssConstants.QNAME_RDF_TITLE);
+    if (text == null) text = getExtension(RssConstants.QNAME_DC_TITLE);
+    return text;
   }
 
   public org.apache.abdera.model.Text.Type getTitleType() {
@@ -568,5 +590,23 @@
 
   public Link getComments() {
     return getExtension(RssConstants.QNAME_COMMENTS);
+  }
+
+  
+  public IRI getResolvedValue() {
+    return getValue();
+  }
+
+  public IRI getValue() {
+    String about = getAttributeValue(RssConstants.QNAME_RDF_ABOUT);
+    return (about != null) ? new IRI(about) : null;
+  }
+
+  public void setNormalizedValue(String iri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setValue(String iri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
   }
 }

Modified: incubator/abdera/java/trunk/contrib/rss/src/test/java/org/apache/abdera/test/contrib/rss/RssTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/test/java/org/apache/abdera/test/contrib/rss/RssTest.java?view=diff&rev=545838&r1=545837&r2=545838
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/test/java/org/apache/abdera/test/contrib/rss/RssTest.java
(original)
+++ incubator/abdera/java/trunk/contrib/rss/src/test/java/org/apache/abdera/test/contrib/rss/RssTest.java
Sat Jun  9 21:35:35 2007
@@ -24,6 +24,7 @@
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.Feed;
+import org.apache.abdera.model.Person;
 
 import junit.framework.TestCase;
 
@@ -42,10 +43,45 @@
     assertEquals("XML.com",feed.getTitle());
     assertEquals("http://xml.com/pub", feed.getAlternateLinkResolvedHref().toASCIIString());
     assertEquals("XML.com features a rich mix of information and services \n      for the
XML community.", feed.getSubtitle().trim());
+    assertNotNull(feed.getAuthor());
+    assertEquals("James Snell", feed.getAuthor().getName());
+    assertEquals("jasnell@example.com", feed.getAuthor().getEmail());
+    assertEquals(1,feed.getCategories().size());
+    assertEquals("Anything",feed.getCategories().get(0).getTerm());
+    assertEquals("foo", feed.getId().toASCIIString());
+    assertEquals("Copyright 2007 Foo", feed.getRights());
+    assertNotNull(feed.getUpdated());
+    assertEquals("en-US", feed.getLanguage());
+    assertEquals(1,feed.getContributors().size());
+    Person person = feed.getContributors().get(0);
+    assertEquals("John Doe", person.getName());
+    assertEquals("jdoe@example.org",person.getEmail());
+    
     List<Entry> entries = feed.getEntries();
     assertEquals(2, entries.size());
     
-    // TODO: finish this test as the RSS 1.0 impl is completed
+    Entry entry = entries.get(0);
+    assertEquals("Processing Inclusions with XSLT",entry.getTitle());
+    assertEquals("http://xml.com/pub/2000/08/09/xslt/xslt.html",entry.getId().toASCIIString());
+    assertEquals("http://xml.com/pub/2000/08/09/xslt/xslt.html",entry.getAlternateLinkResolvedHref().toASCIIString());
+    assertNotNull(entry.getSummary());
+    assertEquals("testing",entry.getContent());
+    
+    person = entry.getAuthor();
+    System.out.println(person.getName());
+    assertEquals("Bob",person.getName());
+    
+    entry = entries.get(1);
+    assertEquals("Putting RDF to Work",entry.getTitle());
+    assertEquals("http://xml.com/pub/2000/08/09/rdfdb/index.html",entry.getId().toASCIIString());
+    assertEquals("http://xml.com/pub/2000/08/09/rdfdb/index.html",entry.getAlternateLinkResolvedHref().toASCIIString());
+    
+    assertNotNull(entry.getSummary());
+    assertEquals("testing",entry.getContent());
+    
+    person = entry.getAuthor();
+    assertEquals("Joe",person.getName());
+   
   }
   
 }

Modified: incubator/abdera/java/trunk/contrib/rss/src/test/resources/rss1.rdf
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/test/resources/rss1.rdf?view=diff&rev=545838&r1=545837&r2=545838
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/test/resources/rss1.rdf (original)
+++ incubator/abdera/java/trunk/contrib/rss/src/test/resources/rss1.rdf Sat Jun  9 21:35:35
2007
@@ -2,12 +2,21 @@
 
 <rdf:RDF 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+  xmlns:dc="http://purl.org/dc/elements/1.1/"
+  xmlns:content="http://purl.org/rss/1.0/modules/content/"
   xmlns="http://purl.org/rss/1.0/"
 >
 
   <channel rdf:about="http://www.xml.com/xml/news.rss">
     <title>XML.com</title>
     <link>http://xml.com/pub</link>
+    <dc:creator>James Snell (mailto:jasnell@example.com)</dc:creator>
+    <dc:subject>Anything</dc:subject>
+    <dc:identifier>foo</dc:identifier>
+    <dc:rights>Copyright 2007 Foo</dc:rights>
+    <dc:date>2000-01-01T12:00+00:00</dc:date>
+    <dc:language>en-US</dc:language>
+    <dc:contributor>John Doe (mailto:jdoe@example.org)</dc:contributor>
     <description>
       XML.com features a rich mix of information and services 
       for the XML community.
@@ -40,6 +49,8 @@
      problematic. This article proposes a way of preserving inclusion 
      information through SAX-based processing.
     </description>
+    <content:encoded>testing</content:encoded>
+    <dc:creator>Bob (mailto:bob@example.org)</dc:creator>
   </item>
   
   <item rdf:about="http://xml.com/pub/2000/08/09/rdfdb/index.html">
@@ -50,6 +61,8 @@
      is slowly coming of age. Edd Dumbill takes a look at RDFDB, 
      one of the most exciting new RDF toolkits.
     </description>
+    <content:encoded>testing</content:encoded>
+    <dc:creator>Joe (mailto:joe@example.org)</dc:creator>
   </item>
 
   <textinput rdf:about="http://search.xml.com">



Mime
View raw message