abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r542893 [1/2] - in /incubator/abdera/java/trunk/contrib/rss: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/abdera/ src/main/java/org/apache/abdera/contrib/ src/main/java/org/apache/ab...
Date Wed, 30 May 2007 17:41:04 GMT
Author: jmsnell
Date: Wed May 30 10:41:02 2007
New Revision: 542893

URL: http://svn.apache.org/viewvc?view=rev&rev=542893
Log:
Initial import of the RSS code.  This is a very incomplete implementation that I will continue
to flesh out over the coming weeks.  There is no build script yet; I will do that later this 
week as time allows unless someone else beats me to it.  So far the code is capable of parsing
reasonably decent RSS 2.0 feeds and partially parsing RSS 1.0.  There's still lots of stuff to 
do.

Added:
    incubator/abdera/java/trunk/contrib/rss/
    incubator/abdera/java/trunk/contrib/rss/src/
    incubator/abdera/java/trunk/contrib/rss/src/main/
    incubator/abdera/java/trunk/contrib/rss/src/main/java/
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/
    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/RssCloud.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/RssContent.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssDateTime.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssEnclosure.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/RssGenerator.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssGuid.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssImage.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssItem.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssLink.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssPerson.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSkipDays.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSkipHours.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSource.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssText.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssTextInput.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssUriElement.java
    incubator/abdera/java/trunk/contrib/rss/src/main/resources/
    incubator/abdera/java/trunk/contrib/rss/src/main/resources/META-INF/
    incubator/abdera/java/trunk/contrib/rss/src/main/resources/META-INF/services/
    incubator/abdera/java/trunk/contrib/rss/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory
    incubator/abdera/java/trunk/contrib/rss/src/test/
    incubator/abdera/java/trunk/contrib/rss/src/test/java/
    incubator/abdera/java/trunk/contrib/rss/src/test/java/org/
    incubator/abdera/java/trunk/contrib/rss/src/test/java/org/apache/
    incubator/abdera/java/trunk/contrib/rss/src/test/java/org/apache/abdera/
    incubator/abdera/java/trunk/contrib/rss/src/test/java/org/apache/abdera/test/
    incubator/abdera/java/trunk/contrib/rss/src/test/java/org/apache/abdera/test/contrib/
    incubator/abdera/java/trunk/contrib/rss/src/test/java/org/apache/abdera/test/contrib/rss/
    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/
    incubator/abdera/java/trunk/contrib/rss/src/test/resources/rss1.rdf

Added: 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=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssCategory.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssCategory.java Wed May 30 10:41:02 2007
@@ -0,0 +1,117 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.contrib.rss;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.Category;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+
+public class RssCategory 
+  extends ElementWrapper 
+  implements Category {
+
+  public RssCategory(Element internal) {
+    super(internal);
+  }
+
+  public RssCategory(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  public String getLabel() {
+    return null;
+  }
+
+  public IRI getScheme() {
+    return new IRI(this.getAttributeValue("domain"));
+  }
+
+  public String getTerm() {
+    return getText();
+  }
+
+  public void setLabel(String label) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setScheme(String scheme) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setTerm(String term) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void addExtension(Element extension) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Element> T addExtension(QName qname) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Element> T addExtension(String namespace, String localPart,
+      String prefix) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Element addSimpleExtension(QName qname, String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Element addSimpleExtension(String namespace, String localPart,
+      String prefix, String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Element> T getExtension(QName qname) {
+    return null;
+  }
+
+  public <T extends Element> T getExtension(Class<T> _class) {
+    return null;
+  }
+
+  public List<Element> getExtensions() {
+    return null;
+  }
+
+  public List<Element> getExtensions(String uri) {
+    return null;
+  }
+
+  public <T extends Element> List<T> getExtensions(QName qname) {
+    return null;
+  }
+
+  public String getSimpleExtension(QName qname) {
+    return null;
+  }
+
+  public String getSimpleExtension(String namespace, String localPart,
+      String prefix) {
+    return null;
+  }
+
+}

Added: 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=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssChannel.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssChannel.java Wed May 30 10:41:02 2007
@@ -0,0 +1,526 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.contrib.rss;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.activation.MimeTypeParseException;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.Category;
+import org.apache.abdera.model.DateTime;
+import org.apache.abdera.model.Div;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.ExtensibleElement;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+import org.apache.abdera.model.Generator;
+import org.apache.abdera.model.IRIElement;
+import org.apache.abdera.model.Link;
+import org.apache.abdera.model.Person;
+import org.apache.abdera.model.Text;
+import org.apache.abdera.model.Text.Type;
+import org.apache.abdera.parser.stax.util.FOMElementIterator;
+import org.apache.abdera.parser.stax.util.FOMHelper;
+import org.apache.abdera.parser.stax.util.FOMList;
+import org.apache.abdera.util.Constants;
+import org.apache.abdera.xpath.XPath;
+import org.apache.abdera.xpath.XPathException;
+
+public class RssChannel 
+  extends ExtensibleElementWrapper {
+
+  protected RssChannel(Element internal) {
+    super(internal);
+  }
+
+  public RssChannel(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  public void addEntry(Entry entry) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Entry addEntry() {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public List<Entry> getEntries() {
+    QName qname = getQName();
+    if (qname.getNamespaceURI().equals(RssConstants.RSS1_NS) &&
+        qname.getLocalPart().equals("channel")) {
+      List<Entry> entries = new ArrayList<Entry>();
+      ExtensibleElement items = getExtension(RssConstants.QNAME_RDF_ITEMS);
+      if (items != null) {
+        ExtensibleElement se = items.getExtension(RssConstants.QNAME_RDF_SEQ);
+        if (se != null) {
+          List<Element> seq = se.getExtensions(RssConstants.QNAME_RDF_LI);
+          for (Element el : seq) {
+            String res = el.getAttributeValue("resource");
+            if (res != null) {
+              String path = "//rss:item[@rdf:about='" + res + "']";
+              Element entryel = null;
+              try {
+                entryel = locate(path);
+              } catch (Exception e) {
+                e.printStackTrace();
+              }
+              if (entryel != null) {
+                //TODO:fix this.. entryel should already be an RssItem
+                entries.add(new RssItem(entryel));
+              }
+            }
+          }
+        }
+      }
+      return entries;
+    } else {
+      return getExtensions(RssConstants.QNAME_ITEM);
+    }
+  }
+
+  public Entry getEntry(String id) {
+    if (id == null) return null;
+    List<Entry> l = getEntries();
+    for (Entry e : l) {
+      IRI eid = e.getId();
+      if (eid != null && eid.equals(new IRI(id))) return e;
+    }
+    return null;
+  }
+
+  public void insertEntry(Entry entry) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Entry insertEntry() {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void sortEntries(Comparator<Entry> comparator) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void sortEntriesByEdited(boolean new_first) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void sortEntriesByUpdated(boolean new_first) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void addAuthor(Person person) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Person addAuthor(String name) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Person addAuthor(String name, String email, String iri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void addCategory(Category category) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Category addCategory(String term) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Category addCategory(String scheme, String term, String label) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void addLink(Link link) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Link addLink(String href) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Link addLink(String href, String rel) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Link addLink(String href, String rel, String type, String title,
+      String hreflang, long length) throws MimeTypeParseException {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Link getAlternateLink() {
+    Link link = getExtension(RssConstants.QNAME_LINK);
+    if (link == null) link = getExtension(RssConstants.QNAME_RDF_LINK);
+    return link;
+  }
+
+  public Link getAlternateLink(String type, String hreflang)
+      throws MimeTypeParseException {
+    return getAlternateLink();
+  }
+
+  public IRI getAlternateLinkResolvedHref() {
+    Link link = getAlternateLink();
+    return (link != null) ? link.getResolvedHref() : null;
+  }
+
+  public IRI getAlternateLinkResolvedHref(String type, String hreflang)
+      throws MimeTypeParseException {
+    return getAlternateLinkResolvedHref();
+  }
+
+  public Person getAuthor() {
+    return getExtension(RssConstants.QNAME_MANAGINGEDITOR);
+  }
+
+  public List<Person> getAuthors() {
+    return getExtensions(RssConstants.QNAME_MANAGINGEDITOR);
+  }
+
+  public List<Category> getCategories() {
+    return getExtensions(RssConstants.QNAME_CATEGORY);
+  }
+
+  @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);
+  }
+
+  public Generator getGenerator() {
+    return getExtension(RssConstants.QNAME_GENERATOR);
+  }
+
+  public IRI getIcon() {
+    IRIElement iri = getIconElement();
+    return (iri != null) ? iri.getValue() : null;
+  }
+
+  public IRIElement getIconElement() {
+    return getLogoElement();
+  }
+
+  public IRI getId() {
+    return null;
+  }
+
+  public IRIElement getIdElement() {
+    return null;
+  }
+
+  public Link getLink(String rel) {
+    List<Link> links = FOMHelper.getLinks(getInternal(), rel);
+    return (links != null && links.size() > 0) ? links.get(0) : null;
+  }
+
+  public IRI getLinkResolvedHref(String rel) {
+    Link link = getLink(rel);
+    return (link != null) ? link.getResolvedHref() : null;
+  }
+
+  public List<Link> getLinks() {
+    return getExtensions(Constants.LINK);
+  }
+
+  public List<Link> getLinks(String rel) {
+    return FOMHelper.getLinks(getInternal(), rel);
+  }
+
+  public List<Link> getLinks(String... rel) {
+    return FOMHelper.getLinks(getInternal(), rel);
+  }
+
+  public IRI getLogo() {
+    IRIElement iri = getLogoElement();
+    return (iri != null) ? iri.getValue() : null;
+  }
+
+  public IRIElement getLogoElement() {
+    
+    IRIElement iri = getExtension(RssConstants.QNAME_IMAGE);
+    if (iri == null) {
+      Element image = getExtension(RssConstants.QNAME_RDF_IMAGE);
+      if (image != null) {
+        String id = image.getAttributeValue(RssConstants.QNAME_RDF_RESOURCE);
+        if (id != null) {
+          String path = "//rss:image[@rdf:about='" + id + "']";
+          Element res = null;
+          try {
+            res = locate(path);
+          } catch (Exception e) {
+            e.printStackTrace();
+          }
+          if (res != null) {
+            // TODO: Need to fix
+            return new RssImage(res);
+          }
+        } else {
+          return (IRIElement) image;
+        }
+      }
+      
+    }
+    return iri;
+  }
+
+  public String getRights() {
+    Text text = getRightsElement();
+    return (text != null) ? text.getValue() : null;
+  }
+
+  public Text getRightsElement() {
+    return getExtension(RssConstants.QNAME_COPYRIGHT);
+  }
+
+  public Type getRightsType() {
+    Text text = getRightsElement();
+    return (text != null) ? text.getTextType() : null;
+  }
+
+  public Link getSelfLink() {
+    return getLink("self");
+  }
+
+  public IRI getSelfLinkResolvedHref() {
+    Link link = getSelfLink();
+    return (link != null) ? link.getResolvedHref() : null;
+  }
+
+  public String getSubtitle() {
+    Text text = getSubtitleElement();
+    return (text != null) ? text.getValue() : null;
+  }
+
+  public Text getSubtitleElement() {
+    Text text = getExtension(RssConstants.QNAME_DESCRIPTION);
+    if (text == null) text = getExtension(RssConstants.QNAME_RDF_DESCRIPTION);
+    return text;
+  }
+
+  public Type getSubtitleType() {
+    Text text = getSubtitleElement();
+    return (text != null) ? text.getTextType() : null;
+  }
+
+  public String getTitle() {
+    Text text = getTitleElement();
+    return (text != null) ? text.getValue() : null;
+  }
+
+  public Text getTitleElement() {
+    Text text = getExtension(RssConstants.QNAME_TITLE);
+    if (text == null) text = getExtension(RssConstants.QNAME_RDF_TITLE);
+    return text;
+  }
+
+  public Type getTitleType() {
+    Text text = getTitleElement();
+    return (text != null) ? text.getTextType() : null;
+  }
+
+  public Date getUpdated() {
+    DateTime dt = getUpdatedElement();
+    return (dt != null) ? dt.getDate() : null;
+  }
+
+  public DateTime getUpdatedElement() {
+    DateTime dt = getExtension(RssConstants.QNAME_LASTBUILDDATE);
+    if (dt == null) dt = getExtension(RssConstants.QNAME_LASTBUILDDATE2);
+    if (dt == null) dt = getExtension(RssConstants.QNAME_PUBDATE);
+    if (dt == null) dt = getExtension(RssConstants.QNAME_PUBDATE2);
+    return dt;
+  }
+
+  public String getUpdatedString() {
+    DateTime dt = getUpdatedElement();
+    return (dt != null) ? dt.getString() : null;
+  }
+  
+  public Date getPublished() {
+    DateTime dt = getPublishedElement();
+    return (dt != null) ? dt.getDate() : null;
+  }
+
+  public DateTime getPublishedElement() {
+    DateTime dt = getExtension(RssConstants.QNAME_PUBDATE);
+    if (dt == null) dt = getExtension(RssConstants.QNAME_PUBDATE2);
+    return dt;
+  }
+
+  public String getPublishedString() {
+    DateTime dt = getPublishedElement();
+    return (dt != null) ? dt.getString() : null;
+  }
+
+  public IRIElement newId() {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setGenerator(Generator generator) { 
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Generator setGenerator(String iri, String version, String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public IRIElement setIcon(String iri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setIconElement(IRIElement iri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public IRIElement setId(String id) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public IRIElement setId(String id, boolean normalize) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setIdElement(IRIElement id) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public IRIElement setLogo(String iri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setLogoElement(IRIElement iri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setRights(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setRights(String value, Type type) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setRights(Div value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setRightsAsHtml(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setRightsAsXhtml(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setRightsElement(Text text) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setSubtitle(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setSubtitle(String value, Type type) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setSubtitle(Div value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setSubtitleAsHtml(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setSubtitleAsXhtml(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setSubtitleElement(Text text) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setTitle(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setTitle(String value, Type type) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setTitle(Div value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setTitleAsHtml(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setTitleAsXhtml(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setTitleElement(Text text) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public DateTime setUpdated(Date value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public DateTime setUpdated(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setUpdatedElement(DateTime dateTime) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public String getLanguage() {
+    return getSimpleExtension(RssConstants.QNAME_LANGUAGE);
+  }
+
+  public void setLanguage(String language) {  
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  private Element locate(String path) throws XPathException {
+    Abdera abdera = this.getFactory().getAbdera();
+    XPath xpath = abdera.getXPath();
+    Map<String,String> ns = xpath.getDefaultNamespaces();
+    ns.put("rdf", RssConstants.RDF_NS);
+    ns.put("rss", RssConstants.RSS1_NS);
+    Element el = getDocument().getRoot();
+    if (el instanceof ElementWrapper) {
+      el = ((ElementWrapper)el).getInternal();
+    }
+    return (Element) xpath.selectSingleNode(path,el,ns);
+  }
+}

Added: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssCloud.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssCloud.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssCloud.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssCloud.java Wed May 30 10:41:02 2007
@@ -0,0 +1,56 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.contrib.rss;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+
+public class RssCloud extends ElementWrapper {
+
+  public RssCloud(Element internal) {
+    super(internal);
+  }
+
+  public RssCloud(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  public String getDomain() {
+    return getAttributeValue("domain");
+  }
+  
+  public int getPort() {
+    String v = getAttributeValue("port");
+    return (v != null) ? Integer.parseInt(v) : -1;
+  }
+  
+  public String getPath() {
+    return getAttributeValue("path");
+  }
+  
+  public String getRegisterProcedure() {
+    return getAttributeValue("registerProcedure");
+  }
+  
+  public String getProtocol() {
+    return getAttributeValue("protocol");
+  }
+}

Added: 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=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssConstants.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssConstants.java Wed May 30 10:41:02 2007
@@ -0,0 +1,86 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.contrib.rss;
+
+import javax.xml.namespace.QName;
+
+public interface RssConstants {
+
+  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 QName QNAME_RDF = new QName(RDF_NS,"RDF");
+  public static final QName QNAME_RDF_CHANNEL = new QName(RSS1_NS,"channel");
+  public static final QName QNAME_RDF_TITLE = new QName(RSS1_NS,"title");
+  public static final QName QNAME_RDF_LINK = new QName(RSS1_NS,"link");
+  public static final QName QNAME_RDF_DESCRIPTION = new QName(RSS1_NS,"description");
+  public static final QName QNAME_RDF_ITEM = new QName(RSS1_NS,"item");
+  public static final QName QNAME_RDF_IMAGE = new QName(RSS1_NS,"image");
+  public static final QName QNAME_RDF_SEQ = new QName(RDF_NS,"Seq");
+  public static final QName QNAME_RDF_LI = new QName(RDF_NS,"li");
+  public static final QName QNAME_RDF_RESOURCE = new QName(RDF_NS,"resource");
+  public static final QName QNAME_RDF_ABOUT = new QName(RDF_NS,"about");
+  public static final QName QNAME_RDF_URL = new QName(RSS1_NS, "url");
+  public static final QName QNAME_RDF_ITEMS = new QName(RSS1_NS, "items");
+  
+  public static final QName QNAME_RSS = new QName("rss");
+  public static final QName QNAME_CHANNEL = new QName("channel");
+  public static final QName QNAME_ITEM = new QName("item");  
+  public static final QName QNAME_LINK = new QName("link");
+  public static final QName QNAME_TITLE = new QName("title");
+  public static final QName QNAME_DESCRIPTION = new QName("description");
+  public static final QName QNAME_LANGUAGE = new QName("language");
+  public static final QName QNAME_COPYRIGHT = new QName("copyright");
+  public static final QName QNAME_MANAGINGEDITOR = new QName("managingEditor");
+  public static final QName QNAME_MANAGINGEDITOR2 = new QName("managingeditor");
+  public static final QName QNAME_WEBMASTER = new QName("webMaster");
+  public static final QName QNAME_WEBMASTER2 = new QName("webmaster");
+  public static final QName QNAME_PUBDATE = new QName("pubDate");
+  public static final QName QNAME_PUBDATE2 = new QName("pubdate");
+  public static final QName QNAME_LASTBUILDDATE = new QName("lastBuildDate");
+  public static final QName QNAME_LASTBUILDDATE2 = new QName("lastbuilddate");
+  public static final QName QNAME_CATEGORY = new QName("category");
+  public static final QName QNAME_GENERATOR = new QName("generator");
+  public static final QName QNAME_DOCS = new QName("docs");
+  public static final QName QNAME_CLOUD = new QName("cloud");
+  public static final QName QNAME_TTL = new QName("ttl");
+  public static final QName QNAME_IMAGE = new QName("image");
+  public static final QName QNAME_RATING = new QName("rating");
+  public static final QName QNAME_TEXTINPUT = new QName("textInput");
+  public static final QName QNAME_TEXTINPUT2 = new QName("textinput");
+  public static final QName QNAME_SKIPHOURS = new QName("skipHours");
+  public static final QName QNAME_SKIPHOURS2 = new QName("skiphours");
+  public static final QName QNAME_SKIPDAYS = new QName("skipDays");
+  public static final QName QNAME_SKIPDAYS2 = new QName("skipdays");
+  public static final QName QNAME_AUTHOR = new QName("author");
+  public static final QName QNAME_ENCLOSURE = new QName("enclosure");
+  public static final QName QNAME_GUID = new QName("guid");
+  public static final QName QNAME_COMMENTS = new QName("comments");
+  public static final QName QNAME_SOURCE = new QName("source");
+  
+  public static final QName QNAME_URL = new QName("url");
+  public static final QName QNAME_WIDTH = new QName("width");
+  public static final QName QNAME_HEIGHT = new QName("height");
+  public static final QName QNAME_DAY = new QName("day");
+  public static final QName QNAME_HOUR = new QName("hour");
+  public static final QName QNAME_NAME = new QName("name");
+  
+  public static final QName QNAME_CONTENT_ENCODED = new QName(ENC_NS, "encoded");
+  
+}

Added: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssContent.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssContent.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssContent.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssContent.java Wed May 30 10:41:02 2007
@@ -0,0 +1,103 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.contrib.rss;
+
+import javax.activation.DataHandler;
+import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.Content;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+
+public class RssContent 
+  extends ElementWrapper 
+  implements Content {
+
+  public RssContent(Element internal) {
+    super(internal);
+  }
+
+  public RssContent(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  public Type getContentType() {
+    return Type.HTML;
+  }
+
+  public DataHandler getDataHandler() {
+    return null;
+  }
+
+  public MimeType getMimeType() {
+    return null;
+  }
+
+  public IRI getResolvedSrc() {
+    return null;
+  }
+
+  public IRI getSrc() {
+    return null;
+  }
+
+  public String getValue() {
+    return getText();
+  }
+
+  public <T extends Element> T getValueElement() {
+    return null;
+  }
+
+  public String getWrappedValue() {
+    return getText();
+  }
+
+  public void setContentType(Type type) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setDataHandler(DataHandler dataHandler) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setMimeType(String type) throws MimeTypeParseException {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setSrc(String src) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setValue(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Element> void setValueElement(T value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setWrappedValue(String wrappedValue) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+}

Added: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssDateTime.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssDateTime.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssDateTime.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssDateTime.java Wed May 30 10:41:02 2007
@@ -0,0 +1,117 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.contrib.rss;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.AtomDate;
+import org.apache.abdera.model.DateTime;
+import org.apache.abdera.model.DateTimeWrapper;
+import org.apache.abdera.model.Element;
+
+public class RssDateTime 
+  extends DateTimeWrapper 
+  implements DateTime {
+
+  private static String[] masks = {
+    "EEE, dd MMM yyyy HH:mm:ss z",
+    "dd MMM yyyy HH:mm z",
+    "dd MMM yyyy",
+    "-yy-MM-dd",
+    "-yy-MM",
+    "-yymm",
+    "yyyy-MM-dd HH:mm:ss.SSS",
+    "yyyy-MM-dd HH:mm:ss",
+    "yyyy-MM-dd'T'HH:mm:ss.SSSz",
+    "yyyy-MM-dd't'HH:mm:ss.SSSz",                         // invalid
+    "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
+    "yyyy-MM-dd't'HH:mm:ss.SSS'z'",                       // invalid
+    "yyyy-MM-dd'T'HH:mm:ssz",
+    "yyyy-MM-dd't'HH:mm:ssz",                             // invalid
+    "yyyy-MM-dd'T'HH:mm:ss'Z'",
+    "yyyy-MM-dd't'HH:mm:ss'Z'",                           // invalid
+    "yyyy-MM-dd't'HH:mm:ss'z'",                           // invalid
+    "yyyy-MM-dd'T'HH:mm:ss'z'",                           // invalid
+    "yyyy-MM-dd'T'HH:mm:ss'z'",                           // invalid
+    "yyyy-MM-dd'T'HH:mmz",                                // invalid
+    "yyyy-MM-dd't'HH:mmz",                                // invalid
+    "yyyy-MM-dd'T'HH:mm'Z'",                              // invalid
+    "yyyy-MM-dd't'HH:mm'z'",                              // invalid
+    "yyyy-MM-dd",
+    "yyyy-MM",
+    "yyyyMMdd",
+    "yyMMdd",
+    "yyyy"
+  };
+  
+  public RssDateTime(Element internal) {
+    super(internal);
+  }
+
+  public RssDateTime(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  @Override
+  public AtomDate getValue() {
+    return parse(getText());
+  }
+
+  @Override
+  public void setCalendar(Calendar date) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  @Override
+  public void setDate(Date date) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  @Override
+  public void setString(String date) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  @Override
+  public void setTime(long date) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  @Override
+  public void setValue(AtomDate dateTime) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  private AtomDate parse(String value) {
+    for (String mask : masks) {
+      try {
+        SimpleDateFormat sdf = new SimpleDateFormat(mask);
+        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
+        Date d = sdf.parse(value);
+        return new AtomDate(d);
+      } catch (Exception e) {}
+    }
+    return null;
+  }
+}

Added: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssEnclosure.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssEnclosure.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssEnclosure.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssEnclosure.java Wed May 30 10:41:02 2007
@@ -0,0 +1,150 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.contrib.rss;
+
+import java.util.List;
+
+import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+import org.apache.abdera.model.Link;
+
+public class RssEnclosure 
+  extends ExtensibleElementWrapper 
+  implements Link {
+
+  public RssEnclosure(Element internal) {
+    super(internal);
+  }
+
+  public RssEnclosure(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  public IRI getHref() {
+    String url = getAttributeValue("url");
+    return (url != null) ? new IRI(url) : null;
+  }
+
+  public String getHrefLang() {
+    return null;
+  }
+
+  public long getLength() {
+    String l = getAttributeValue("length");
+    return (l != null) ? Integer.parseInt(l) : -1;
+  }
+
+  public MimeType getMimeType() throws MimeTypeParseException {
+    String type = getAttributeValue("type");
+    return (type != null) ? new MimeType(type) : null;
+  }
+
+  public String getRel() {
+    return "enclosure";
+  }
+
+  public IRI getResolvedHref() {
+    return getHref();
+  }
+
+  public String getTitle() {
+    return null;
+  }
+
+  public void setHref(String href) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setHrefLang(String lang) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setLength(long length) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setMimeType(String type) throws MimeTypeParseException {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setRel(String rel) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setTitle(String title) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void addExtension(Element extension) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Element> T addExtension(QName qname) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Element> T addExtension(String namespace, String localPart,
+      String prefix) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Element addSimpleExtension(QName qname, String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Element addSimpleExtension(String namespace, String localPart,
+      String prefix, String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Element> T getExtension(QName qname) {
+    return null;
+  }
+
+  public <T extends Element> T getExtension(Class<T> _class) {
+    return null;
+  }
+
+  public List<Element> getExtensions() {
+    return null;
+  }
+
+  public List<Element> getExtensions(String uri) {
+    return null;
+  }
+
+  public <T extends Element> List<T> getExtensions(QName qname) {
+    return null;
+  }
+
+  public String getSimpleExtension(QName qname) {
+    return null;
+  }
+
+  public String getSimpleExtension(String namespace, String localPart,
+      String prefix) {
+    return null;
+  }
+
+}

Added: 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=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssExtensionFactory.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssExtensionFactory.java Wed May 30 10:41:02 2007
@@ -0,0 +1,110 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.contrib.rss;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.ExtensionFactory;
+import org.apache.abdera.model.Element;
+
+public class RssExtensionFactory 
+  implements ExtensionFactory, RssConstants {
+
+  @SuppressWarnings("unchecked")
+  public <T extends Element> T getElementWrapper(Element internal) {
+    
+    QName qname = internal.getQName();
+    if (qname.equals(QNAME_RSS)) {
+      if (internal.getAttributeValue("version") != null) {
+        return (T)(new RssFeed(internal));
+      }
+    } if (qname.equals(QNAME_RDF)) {
+      return (T)(new RssFeed(internal));
+    } else if (qname.equals(QNAME_CHANNEL) || qname.equals(QNAME_RDF_CHANNEL)) {
+      return (T)(new RssChannel(internal)); 
+    } else if (qname.equals(QNAME_ITEM) || qname.equals(QNAME_RDF_ITEM)) {
+      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)) {
+      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)) {
+      return (T)(new RssPerson(internal));
+    } else if (qname.equals(QNAME_PUBDATE) || qname.equals(QNAME_PUBDATE2) ||
+               qname.equals(QNAME_LASTBUILDDATE) || qname.equals(QNAME_LASTBUILDDATE2)) {
+      return (T)(new RssDateTime(internal));
+    } else if (qname.equals(QNAME_CATEGORY)) {
+      return (T)(new RssCategory(internal));
+    } else if (qname.equals(QNAME_GENERATOR)) {
+      return (T)(new RssGenerator(internal));
+    } else if (qname.equals(QNAME_DOCS)) {
+      return (T)(new RssLink(internal));
+    } else if (qname.equals(QNAME_CLOUD)) {
+      return (T)(new RssCloud(internal));
+    } else if (qname.equals(QNAME_TTL)) {
+      return (T)(new RssText(internal));
+    } else if (qname.equals(QNAME_IMAGE) || qname.equals(QNAME_RDF_IMAGE)) {
+      return (T)(new RssImage(internal));
+    } else if (qname.equals(QNAME_RATING)) {
+      return (T) internal;
+    } else if (qname.equals(QNAME_TEXTINPUT) || qname.equals(QNAME_TEXTINPUT2)) {
+      return (T)(new RssTextInput(internal));
+    } else if (qname.equals(QNAME_SKIPHOURS) || qname.equals(QNAME_SKIPHOURS2)) {
+      return (T)(new RssSkipHours(internal));
+    } else if (qname.equals(QNAME_SKIPDAYS) || qname.equals(QNAME_SKIPDAYS2)) {
+      return (T)(new RssSkipDays(internal));
+    } else if (qname.equals(QNAME_URL) || qname.equals(QNAME_RDF_URL)) {
+      return (T)(new RssUriElement(internal));
+    } else if (qname.equals(QNAME_AUTHOR)) {
+      return (T)(new RssPerson(internal));
+    } else if (qname.equals(QNAME_ENCLOSURE)) {
+      return (T)(new RssEnclosure(internal));
+    } else if (qname.equals(QNAME_GUID)) {
+      return (T)(new RssGuid(internal));
+    } else if (qname.equals(QNAME_COMMENTS)) {
+      return (T)(new RssLink(internal));
+    } else if (qname.equals(QNAME_SOURCE)) {
+      return (T)(new RssSource(internal));
+    } else if (qname.equals(QNAME_CONTENT_ENCODED)) {
+      return (T)(new RssContent(internal));
+    }
+    
+    return (T) internal;
+  }
+
+  public List<String> getNamespaces() {
+    List<String> namespaces = new ArrayList<String>();
+    namespaces.add("");
+    namespaces.add(ENC_NS);
+    return namespaces;
+  }
+
+  public boolean handlesNamespace(String namespace) {
+    return (namespace.equals("") || namespace.equals(ENC_NS));
+  }
+
+}

Added: 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=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssFeed.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssFeed.java Wed May 30 10:41:02 2007
@@ -0,0 +1,540 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.contrib.rss;
+
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+
+import javax.activation.MimeTypeParseException;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.Category;
+import org.apache.abdera.model.Collection;
+import org.apache.abdera.model.DateTime;
+import org.apache.abdera.model.Div;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+import org.apache.abdera.model.Feed;
+import org.apache.abdera.model.Generator;
+import org.apache.abdera.model.IRIElement;
+import org.apache.abdera.model.Link;
+import org.apache.abdera.model.Person;
+import org.apache.abdera.model.Source;
+import org.apache.abdera.model.Text;
+import org.apache.abdera.model.Text.Type;
+
+public class RssFeed 
+  extends ExtensibleElementWrapper 
+  implements Feed {
+
+  public RssFeed(Element internal) {
+    super(internal);
+  }
+
+  public RssFeed(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+  
+  @SuppressWarnings("unused")
+  private RssChannel getChannel() {
+    return this.getFirstChild();
+  }
+
+  public void addEntry(Entry entry) {
+    getChannel().addEntry(entry);
+  }
+
+  public Entry addEntry() {
+    return getChannel().addEntry();
+  }
+
+  public Source getAsSource() {
+    throw new UnsupportedOperationException("Converting to source is not supported");
+  }
+
+  public List<Entry> getEntries() {
+    return getChannel().getEntries();
+  }
+
+  public Entry getEntry(String id) {
+    return getChannel().getEntry(id);
+  }
+
+  public void insertEntry(Entry entry) {
+    getChannel().insertEntry(entry);
+  }
+
+  public Entry insertEntry() {
+    return getChannel().insertEntry();
+  }
+
+  public void sortEntries(Comparator<Entry> comparator) {
+    getChannel().sortEntries(comparator);
+  }
+
+  public void sortEntriesByEdited(boolean new_first) {
+    getChannel().sortEntriesByEdited(new_first);
+  }
+
+  public void sortEntriesByUpdated(boolean new_first) {
+    getChannel().sortEntriesByUpdated(new_first);
+  }
+
+  public void addAuthor(Person person) {
+    getChannel().addAuthor(person);
+  }
+
+  public Person addAuthor(String name) {
+    return getChannel().addAuthor(name);
+  }
+
+  public Person addAuthor(String name, String email, String iri) {
+    return getChannel().addAuthor(name,email,iri);
+  }
+
+  public void addCategory(Category category) {
+    getChannel().addCategory(category);
+  }
+
+  public Category addCategory(String term) {
+    return getChannel().addCategory(term);
+  }
+
+  public Category addCategory(String scheme, String term, String label) {
+    return getChannel().addCategory(scheme, term, label);
+  }
+
+  public void addContributor(Person person) {
+    throw new UnsupportedOperationException("Contributor's are not supported");
+  }
+
+  public Person addContributor(String name) {
+    throw new UnsupportedOperationException("Contributor's are not supported");
+  }
+
+  public Person addContributor(String name, String email, String iri) {
+    throw new UnsupportedOperationException("Contributor's are not supported");
+  }
+
+  public void addLink(Link link) {
+    getChannel().addLink(link);
+  }
+
+  public Link addLink(String href) {
+    return getChannel().addLink(href);
+  }
+
+  public Link addLink(String href, String rel) {
+    return getChannel().addLink(href, rel);
+  }
+
+  public Link addLink(String href, String rel, String type, String title,
+      String hreflang, long length) throws MimeTypeParseException {
+    return getChannel().addLink(href, rel, type, title, hreflang, length);
+  }
+
+  public Link getAlternateLink() {
+    return getChannel().getAlternateLink();
+  }
+
+  public Link getAlternateLink(String type, String hreflang)
+      throws MimeTypeParseException {
+    return getChannel().getAlternateLink(type, hreflang);
+  }
+
+  public IRI getAlternateLinkResolvedHref() {
+    return getChannel().getAlternateLinkResolvedHref();
+  }
+
+  public IRI getAlternateLinkResolvedHref(String type, String hreflang)
+      throws MimeTypeParseException {
+    return getChannel().getAlternateLinkResolvedHref(type, hreflang);
+  }
+
+  public Person getAuthor() {
+    return getChannel().getAuthor();
+  }
+
+  public List<Person> getAuthors() {
+    return getChannel().getAuthors();
+  }
+
+  public List<Category> getCategories() {
+    return getChannel().getCategories();
+  }
+
+  public List<Category> getCategories(String scheme) {
+    return getChannel().getCategories(scheme);
+  }
+
+  public Collection getCollection() {
+    //TODO: should I support this?
+    return null;
+  }
+
+  public List<Person> getContributors() {
+    throw new UnsupportedOperationException("Contributor's are not supported");
+  }
+
+  public Generator getGenerator() {
+    return getChannel().getGenerator();
+  }
+
+  public IRI getIcon() {
+    return getChannel().getIcon();
+  }
+
+  public IRIElement getIconElement() {
+    return getChannel().getIconElement();
+  }
+
+  public IRI getId() {
+    return getChannel().getId();
+  }
+
+  public IRIElement getIdElement() {
+    return getChannel().getIdElement();
+  }
+
+  public Link getLink(String rel) {
+    return getChannel().getLink(rel);
+  }
+
+  public IRI getLinkResolvedHref(String rel) {
+    return getChannel().getLinkResolvedHref(rel);
+  }
+
+  public List<Link> getLinks() {
+    return getChannel().getLinks();
+  }
+
+  public List<Link> getLinks(String rel) {
+    return getChannel().getLinks(rel);
+  }
+
+  public List<Link> getLinks(String... rel) {
+    return getChannel().getLinks(rel);
+  }
+
+  public IRI getLogo() {
+    return getChannel().getLogo();
+  }
+
+  public IRIElement getLogoElement() {
+    return getChannel().getLogoElement();
+  }
+
+  public String getRights() {
+    return getChannel().getRights();
+  }
+
+  public Text getRightsElement() {
+    return getChannel().getRightsElement();
+  }
+
+  public Type getRightsType() {
+    return getChannel().getRightsType();
+  }
+
+  public Link getSelfLink() {
+    return getChannel().getSelfLink();
+  }
+
+  public IRI getSelfLinkResolvedHref() {
+    return getChannel().getSelfLinkResolvedHref();
+  }
+
+  public String getSubtitle() {
+    return getChannel().getSubtitle();
+  }
+
+  public Text getSubtitleElement() {
+    return getChannel().getSubtitleElement();
+  }
+
+  public Type getSubtitleType() {
+    return getChannel().getSubtitleType();
+  }
+
+  public String getTitle() {
+    return getChannel().getTitle();
+  }
+
+  public Text getTitleElement() {
+    return getChannel().getTitleElement();
+  }
+
+  public Type getTitleType() {
+    return getChannel().getTitleType();
+  }
+
+  public Date getUpdated() {
+    return getChannel().getUpdated();
+  }
+
+  public DateTime getUpdatedElement() {
+    return getChannel().getUpdatedElement();
+  }
+
+  public String getUpdatedString() {
+    return getChannel().getUpdatedString();
+  }
+
+  public Date getPublished() {
+    return getChannel().getPublished();
+  }
+
+  public DateTime getPublisheddElement() {
+    return getChannel().getPublishedElement();
+  }
+
+  public String getPublishedString() {
+    return getChannel().getPublishedString();
+  }
+  
+  public IRIElement newId() {
+    return getChannel().newId();
+  }
+
+  public void setCollection(Collection collection) {
+    throw new UnsupportedOperationException("Collection is not supported");
+  }
+
+  public void setGenerator(Generator generator) {
+    getChannel().setGenerator(generator);
+  }
+
+  public Generator setGenerator(String iri, String version, String value) {
+    return getChannel().setGenerator(iri,version,value);
+  }
+
+  public IRIElement setIcon(String iri) {
+    return getChannel().setIcon(iri);
+  }
+
+  public void setIconElement(IRIElement iri) {
+    getChannel().setIconElement(iri);
+  }
+
+  public IRIElement setId(String id) {
+    return getChannel().setId(id);
+  }
+
+  public IRIElement setId(String id, boolean normalize) {
+    return getChannel().setId(id,normalize);
+  }
+
+  public void setIdElement(IRIElement id) {
+    getChannel().setIdElement(id);
+  }
+
+  public IRIElement setLogo(String iri) {
+    return getChannel().setLogo(iri);
+  }
+
+  public void setLogoElement(IRIElement iri) {
+    getChannel().setLogoElement(iri);
+  }
+
+  public Text setRights(String value) {
+    return getChannel().setRights(value);
+  }
+
+  public Text setRights(String value, Type type) {
+    return getChannel().setRights(value, type);
+  }
+
+  public Text setRights(Div value) {
+    return getChannel().setRights(value);
+  }
+
+  public Text setRightsAsHtml(String value) {
+    return getChannel().setRightsAsHtml(value);
+  }
+
+  public Text setRightsAsXhtml(String value) {
+    return getChannel().setRightsAsXhtml(value);
+  }
+
+  public void setRightsElement(Text text) {
+    getChannel().setRightsElement(text);
+  }
+
+  public Text setSubtitle(String value) {
+    return getChannel().setSubtitle(value);
+  }
+
+  public Text setSubtitle(String value, Type type) {
+    return getChannel().setSubtitle(value,type);
+  }
+
+  public Text setSubtitle(Div value) {
+    return getChannel().setSubtitle(value);
+  }
+
+  public Text setSubtitleAsHtml(String value) {
+    return getChannel().setSubtitleAsHtml(value);
+  }
+
+  public Text setSubtitleAsXhtml(String value) {
+    return getChannel().setSubtitleAsXhtml(value);
+  }
+
+  public void setSubtitleElement(Text text) {
+    getChannel().setSubtitleElement(text);
+  }
+
+  public Text setTitle(String value) {
+    return getChannel().setTitle(value);
+  }
+
+  public Text setTitle(String value, Type type) {
+    return getChannel().setTitle(value,type);
+  }
+
+  public Text setTitle(Div value) {
+    return getChannel().setTitle(value);
+  }
+
+  public Text setTitleAsHtml(String value) {
+    return getChannel().setTitleAsHtml(value);
+  }
+
+  public Text setTitleAsXhtml(String value) {
+    return getChannel().setTitleAsXhtml(value);
+  }
+
+  public void setTitleElement(Text text) {
+    getChannel().setTitleElement(text);
+  }
+
+  public DateTime setUpdated(Date value) {
+    return getChannel().setUpdated(value);
+  }
+
+  public DateTime setUpdated(String value) {
+    return getChannel().setUpdated(value);
+  }
+
+  public void setUpdatedElement(DateTime dateTime) {
+    getChannel().setUpdatedElement(dateTime);
+  }
+
+  public void addExtension(Element extension) {
+    getChannel().addExtension(extension);
+  }
+
+  public <T extends Element> T addExtension(QName qname) {
+    return getChannel().addExtension(qname);
+  }
+
+  public <T extends Element> T addExtension(String namespace, String localPart,
+      String prefix) {
+    return getChannel().addExtension(namespace, localPart, prefix);
+  }
+
+  public Element addSimpleExtension(QName qname, String value) {
+    return getChannel().addSimpleExtension(qname, value);
+  }
+
+  public Element addSimpleExtension(String namespace, String localPart,
+      String prefix, String value) {
+    return getChannel().addSimpleExtension(namespace, localPart, prefix, value);
+  }
+
+  public <T extends Element> T getExtension(QName qname) {
+    return getChannel().getExtension(qname);
+  }
+
+  public <T extends Element> T getExtension(Class<T> _class) {
+    return getChannel().getExtension(_class);
+  }
+
+  public List<Element> getExtensions() {
+    return getChannel().getExtensions();
+  }
+
+  public List<Element> getExtensions(String uri) {
+    return getChannel().getExtensions(uri);
+  }
+
+  public <T extends Element> List<T> getExtensions(QName qname) {
+    return getChannel().getExtensions(qname);
+  }
+
+  public String getSimpleExtension(QName qname) {
+    return getChannel().getSimpleExtension(qname);
+  }
+
+  public String getSimpleExtension(String namespace, String localPart,
+      String prefix) {
+    return getChannel().getSimpleExtension(namespace, localPart, prefix);
+  }
+
+  public String getAttributeValue(String name) {
+    return getChannel().getAttributeValue(name);
+  }
+
+  public String getAttributeValue(QName qname) {
+    return getChannel().getAttributeValue(qname);
+  }
+
+  public List<QName> getAttributes() {
+    return getChannel().getAttributes();
+  }
+
+  public List<QName> getExtensionAttributes() {
+    return getChannel().getExtensionAttributes();
+  }
+
+  public String getLanguage() {
+    return getChannel().getLanguage();
+  }
+
+  public void removeAttribute(QName qname) {
+    getChannel().removeAttribute(qname);
+  }
+
+  public void setAttributeValue(String name, String value) {
+    getChannel().setAttributeValue(name, value);
+  }
+
+  public void setAttributeValue(QName qname, String value) {
+    getChannel().setAttributeValue(qname, value);
+  }
+
+  public void setBaseUri(IRI base) {
+    throw new UnsupportedOperationException("Setting the base uri with xml:base is not supported");
+  }
+
+  public void setBaseUri(String base) {
+    throw new UnsupportedOperationException("Setting the base uri with xml:base is not supported");
+  }
+
+  public void setLanguage(String language) {
+    getChannel().setLanguage(language);
+  }
+
+  public String getVersion() {
+    return super.getAttributeValue("version");
+  }
+}

Added: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssGenerator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssGenerator.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssGenerator.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssGenerator.java Wed May 30 10:41:02 2007
@@ -0,0 +1,60 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.contrib.rss;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+import org.apache.abdera.model.Generator;
+
+public class RssGenerator 
+  extends ElementWrapper 
+  implements Generator {
+
+  public RssGenerator(Element internal) {
+    super(internal);
+  }
+
+  public RssGenerator(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  public IRI getResolvedUri() {
+    return null;
+  }
+
+  public IRI getUri() {
+    return null;
+  }
+
+  public String getVersion() {
+    return null;
+  }
+
+  public void setUri(String uri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setVersion(String version) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+}

Added: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssGuid.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssGuid.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssGuid.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssGuid.java Wed May 30 10:41:02 2007
@@ -0,0 +1,169 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.contrib.rss;
+
+import java.util.List;
+
+import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+import org.apache.abdera.model.IRIElement;
+import org.apache.abdera.model.Link;
+
+public class RssGuid 
+  extends ElementWrapper 
+  implements IRIElement, Link {
+
+  public RssGuid(Element internal) {
+    super(internal);
+  }
+
+  public RssGuid(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  public IRI getResolvedValue() {
+    return getValue();
+  }
+
+  public IRI getValue() {
+    String t = getText();
+    return (t != null) ? new IRI(t) : 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");
+  }
+  
+  public boolean isPermalink() {
+    String v = getAttributeValue("isPermaLink");
+    if (v == null) getAttributeValue("ispermalink");
+    return (v.equalsIgnoreCase("true") || v.equalsIgnoreCase("yes"));
+  }
+
+  
+  public IRI getHref() {
+    return getValue();
+  }
+
+  public String getHrefLang() {
+    return null;
+  }
+
+  public long getLength() {
+    return -1;
+  }
+
+  public MimeType getMimeType() throws MimeTypeParseException {
+    return null;
+  }
+
+  public String getRel() {
+    return Link.REL_ALTERNATE;
+  }
+
+  public IRI getResolvedHref() {
+    return getValue();
+  }
+
+  public String getTitle() {
+    return null;
+  }
+
+  public void setHref(String href) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setHrefLang(String lang) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setLength(long length) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setMimeType(String type) throws MimeTypeParseException {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setRel(String rel) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setTitle(String title) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void addExtension(Element extension) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Element> T addExtension(QName qname) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Element> T addExtension(String namespace, String localPart, String prefix) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Element addSimpleExtension(QName qname, String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Element addSimpleExtension(String namespace, String localPart, String prefix, String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Element> T getExtension(QName qname) {
+    return null;
+  }
+
+  public <T extends Element> T getExtension(Class<T> _class) {
+    return null;
+  }
+
+  public List<Element> getExtensions() {
+    return null;
+  }
+
+  public List<Element> getExtensions(String uri) {
+    return null;
+  }
+
+  public <T extends Element> List<T> getExtensions(QName qname) {
+    return null;
+  }
+
+  public String getSimpleExtension(QName qname) {
+    return null;
+  }
+
+  public String getSimpleExtension(String namespace, String localPart, String prefix) {
+    return null;
+  }
+
+}

Added: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssImage.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssImage.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssImage.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssImage.java Wed May 30 10:41:02 2007
@@ -0,0 +1,93 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.contrib.rss;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+import org.apache.abdera.model.IRIElement;
+import org.apache.abdera.model.Link;
+import org.apache.abdera.model.Text;
+
+public class RssImage 
+  extends ExtensibleElementWrapper 
+  implements IRIElement {
+
+  public RssImage(Element internal) {
+    super(internal);
+  }
+
+  public RssImage(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  public IRI getResolvedValue() {
+    return getValue();
+  }
+
+  public IRI getValue() {
+    IRIElement iri = getExtension(RssConstants.QNAME_URL);
+    if (iri == null) {
+      iri = getExtension(RssConstants.QNAME_RDF_URL);
+    }
+    if (iri == null) {
+      String t = getAttributeValue(RssConstants.QNAME_RDF_ABOUT);
+      if (t != null) return new IRI(t);
+    }
+    return (iri != null) ? iri.getValue() : 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");
+  }
+
+  public String getTitle() {
+    Text text = getExtension(RssConstants.QNAME_TITLE);
+    if (text == null) text = getExtension(RssConstants.QNAME_RDF_TITLE);
+    return (text != null) ? text.getValue() : null;
+  }
+  
+  public String getDescription() {
+    Text text = getExtension(RssConstants.QNAME_DESCRIPTION);
+    if (text == null) text = getExtension(RssConstants.QNAME_RDF_DESCRIPTION);
+    return (text != null) ? text.getValue() : null;
+  }
+  
+  public IRI getLink() {
+    Link link = getExtension(RssConstants.QNAME_LINK);
+    if (link == null) link = getExtension(RssConstants.QNAME_RDF_LINK);
+    return (link != null) ? link.getHref() : null;
+  }
+  
+  public int getWidth() {
+    String w = getSimpleExtension(RssConstants.QNAME_WIDTH);
+    return (w != null) ? Integer.parseInt(w) : -1;
+  }
+  
+  public int getHeight() {
+    String w = getSimpleExtension(RssConstants.QNAME_HEIGHT);
+    return (w != null) ? Integer.parseInt(w) : -1;
+  }
+}



Mime
View raw message