abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From calav...@apache.org
Subject svn commit: r718797 [2/2] - in /incubator/abdera/java/trunk: contrib/rss/ extensions/ extensions/rss/ extensions/rss/src/ extensions/rss/src/main/ extensions/rss/src/main/java/ extensions/rss/src/main/java/org/ extensions/rss/src/main/java/org/apache/ ...
Date Tue, 18 Nov 2008 23:38:37 GMT
Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssItem.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssItem.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssItem.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssItem.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,615 @@
+/*
+* 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.ext.rss;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.List;
+
+import javax.activation.DataHandler;
+import javax.activation.MimeType;
+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.Content;
+import org.apache.abdera.model.Control;
+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.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.Content.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;
+
+public class RssItem 
+  extends ExtensibleElementWrapper 
+  implements Entry, IRIElement {
+
+  public RssItem(Element internal) {
+    super(internal);
+  }
+
+  public RssItem(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  public Entry 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 uri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Entry 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 Entry addContributor(Person person) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Person addContributor(String name) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Person addContributor(String name, String email, String uri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Entry 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) {
+    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);
+    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)
+      {
+    return getAlternateLink();
+  }
+
+  public IRI getAlternateLinkResolvedHref() {
+    Link link = getAlternateLink();
+    return (link != null) ? link.getResolvedHref() : null;
+  }
+
+  public IRI getAlternateLinkResolvedHref(String type, String hreflang)
+      {
+    return getAlternateLinkResolvedHref();
+  }
+
+  public Person getAuthor() {
+    Person person = getExtension(RssConstants.QNAME_AUTHOR);
+    if (person == null) person = getExtension(RssConstants.QNAME_DC_CREATOR);
+    return person;
+  }
+
+  public List<Person> getAuthors() {
+    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() {
+    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) {
+    return (scheme != null) ? 
+        new FOMList<Category>(
+          new FOMElementIterator(getInternal(), RssCategory.class, new QName("domain"), scheme, null)
+        ) : getCategories();
+  }
+
+  public String getContent() {
+    Content content = getContentElement();
+    if (content == null) return getSummary();
+    return content.getValue();
+  }
+
+  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);
+    return content;
+  }
+
+  public MimeType getContentMimeType() {
+    return null;
+  }
+
+  public IRI getContentSrc() {
+    return null;
+  }
+
+  public InputStream getContentStream() throws IOException {
+    return null;
+  }
+
+  public Type getContentType() {
+    Content content = getContentElement();
+    if (content == null) {
+      Text text = getSummaryElement();
+      switch (text.getTextType()) {
+        case TEXT: return Content.Type.TEXT;
+        case HTML: return Content.Type.HTML;
+        case XHTML: return Content.Type.XHTML;
+        default: return Content.Type.HTML;
+      }
+    } else {
+      return content.getContentType();
+    }
+  }
+
+  public List<Person> getContributors() {
+    List<Person> people = getExtensions(RssConstants.QNAME_DC_CONTRIBUTOR);
+    return people;
+  }
+
+  public Control getControl(boolean create) {
+    return null;
+  }
+
+  public Control getControl() {
+    return null;
+  }
+
+  public Link getEditLink() {
+    return null;
+  }
+
+  public IRI getEditLinkResolvedHref() {
+    return null;
+  }
+
+  public Link getEditMediaLink() {
+    return null;
+  }
+
+  public Link getEditMediaLink(String type, String hreflang)
+      {
+    return null;
+  }
+
+  public IRI getEditMediaLinkResolvedHref() {
+    return null;
+  }
+
+  public IRI getEditMediaLinkResolvedHref(String type, String hreflang)
+      {
+    return null;
+  }
+
+  public Date getEdited() {
+    return null;
+  }
+
+  public DateTime getEditedElement() {
+    return null;
+  }
+
+  public Link getEnclosureLink() {
+    return getExtension(RssConstants.QNAME_ENCLOSURE);
+  }
+
+  public IRI getEnclosureLinkResolvedHref() {
+    Link link = getEnclosureLink();
+    return (link != null) ? link.getHref() : null;
+  }
+
+  public IRI getId() {
+    IRIElement iri = getIdElement();
+    return (iri != null) ? iri.getValue() : null;
+  }
+
+  public IRIElement getIdElement() {
+    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) {
+    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;
+  }
+
+  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 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);
+    if (dt == null) dt = getExtension(RssConstants.QNAME_DC_DATE);
+    return dt;
+  }
+
+  public String getRights() {
+    Text text = getRightsElement();
+    return (text != null) ? text.getValue() : null;
+  }
+
+  public Text getRightsElement() {
+    Element el = getParentElement();
+    if (el instanceof RssChannel)
+      return ((RssChannel)el).getRightsElement();
+    else if (el instanceof RssFeed) 
+      return ((RssFeed)el).getRightsElement();
+    Text text = getExtension(RssConstants.QNAME_DC_RIGHTS);
+    return text;
+  }
+
+  public org.apache.abdera.model.Text.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 Source getSource() {
+    Source source = getExtension(RssConstants.QNAME_SOURCE);
+    if (source == null) getExtension(RssConstants.QNAME_DC_SOURCE);
+    return source;
+  }
+
+  public String getSummary() {
+    Text text = getSummaryElement(); 
+    return (text != null) ? text.getValue() : null;
+  }
+
+  public Text getSummaryElement() {
+    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() {
+    Text text = getSummaryElement();
+    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);
+    if (text == null) text = getExtension(RssConstants.QNAME_DC_TITLE);
+    return text;
+  }
+
+  public org.apache.abdera.model.Text.Type getTitleType() {
+    Text text = getTitleElement();
+    return (text != null) ? text.getTextType() : null;
+  }
+
+  public Date getUpdated() {
+    return getPublished();
+  }
+
+  public DateTime getUpdatedElement() {
+    return getPublishedElement();
+  }
+
+  public boolean isDraft() {
+    return false;
+  }
+
+  public IRIElement newId() {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Content setContent(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Content setContent(String value, Type type) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Content setContent(Element value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Content setContent(Element element, String mediaType)
+      {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Content setContent(DataHandler dataHandler)
+      {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Content setContent(DataHandler dataHandler, String mediatype)
+      {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Content setContent(InputStream inputStream) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Content setContent(InputStream inputStream, String mediatype)
+      {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Content setContent(String value, String mediatype)
+      {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Content setContent(IRI uri, String mediatype)
+      {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Content setContentAsHtml(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Content setContentAsXhtml(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Entry setContentElement(Content content) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Entry setControl(Control control) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Entry setDraft(boolean draft) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public DateTime setEdited(Date value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public DateTime setEdited(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public void setEditedElement(DateTime modified) {
+    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 Entry setIdElement(IRIElement id) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public DateTime setPublished(Date value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public DateTime setPublished(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Entry setPublishedElement(DateTime dateTime) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setRights(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setRights(String value, org.apache.abdera.model.Text.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 Entry setRightsElement(Text text) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Entry setSource(Source source) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setSummary(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setSummary(String value, org.apache.abdera.model.Text.Type type) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setSummary(Div value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setSummaryAsHtml(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setSummaryAsXhtml(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Entry setSummaryElement(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, org.apache.abdera.model.Text.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 Entry setTitleElement(Text title) {
+    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 Entry setUpdatedElement(DateTime updated) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  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 IRIElement setNormalizedValue(String iri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public IRIElement setValue(String iri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Control addControl() {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+}

Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssLink.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssLink.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssLink.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssLink.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,101 @@
+/*
+* 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.ext.rss;
+
+import javax.activation.MimeType;
+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 RssLink 
+  extends ExtensibleElementWrapper 
+  implements Link {
+
+  public RssLink(Element internal) {
+    super(internal);
+  }
+
+  public RssLink(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  public IRI getHref() {
+    String txt = getText();
+    return (txt != null) ? new IRI(txt) : null;
+  }
+
+  public String getHrefLang() {
+    return null;
+  }
+
+  public long getLength() {
+    return -1;
+  }
+
+  public MimeType getMimeType() {
+    return null;
+  }
+
+  public String getRel() {
+    QName qname = getQName();
+    if (qname.equals(RssConstants.QNAME_DOCS)) {
+      return "docs";
+    } else if (qname.equals(RssConstants.QNAME_COMMENTS)) {
+      return "comments";
+    } else {
+      return Link.REL_ALTERNATE;
+    }
+  }
+
+  public IRI getResolvedHref() {
+    return getHref();
+  }
+
+  public String getTitle() {
+    return null;
+  }
+
+  public Link setHref(String href) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Link setHrefLang(String lang) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Link setLength(long length) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Link setMimeType(String type) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Link setRel(String rel) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Link setTitle(String title) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+}

Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssPerson.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssPerson.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssPerson.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssPerson.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,124 @@
+/*
+* 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.ext.rss;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+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.IRIElement;
+import org.apache.abdera.model.Person;
+import org.apache.abdera.model.PersonWrapper;
+
+public class RssPerson 
+  extends PersonWrapper 
+  implements Person {
+
+  static String EMAIL_PATTERN = "(([a-zA-Z0-9\\_\\-\\.\\+]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?))(\\?subject=\\S+)?";
+  
+  private String email = null;
+  private String name = null;
+  
+  public RssPerson(Element internal) {
+    super(internal);
+    
+    Pattern p = Pattern.compile(EMAIL_PATTERN);
+    
+    String t = getText();
+    Matcher m = p.matcher(t);
+    if (m.find()) {
+      email = m.group(0);
+      name = t.replaceAll(email, "")
+                     .replaceAll("[\\(\\)\\<\\>]", "")
+                     .replaceAll("mailto:","")
+                     .replaceAll("\\&lt\\;","")
+                     .replaceAll("\\&gt\\;","")
+                     .trim();
+    }
+    
+  }
+
+  public RssPerson(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  @Override
+  public String getEmail() {
+    return email;
+  }
+
+  @Override
+  public Element getEmailElement() {
+    return null;
+  }
+
+  @Override
+  public String getName() {
+    return name;
+  }
+
+  @Override
+  public Element getNameElement() {
+    return null;
+  }
+
+  @Override
+  public IRI getUri() {
+    return null;
+  }
+
+  @Override
+  public IRIElement getUriElement() {
+    return null;
+  }
+
+  @Override
+  public Element setEmail(String email) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  @Override
+  public Person setEmailElement(Element element) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  @Override
+  public Element setName(String name) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  @Override
+  public Person setNameElement(Element element) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  @Override
+  public IRIElement setUri(String uri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  @Override
+  public Person setUriElement(IRIElement element) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+}

Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSkipDays.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSkipDays.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSkipDays.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSkipDays.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,52 @@
+/*
+* 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.ext.rss;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+
+public class RssSkipDays extends ExtensibleElementWrapper {
+
+  public RssSkipDays(Element internal) {
+    super(internal);
+  }
+
+  public RssSkipDays(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+  
+  public enum Day {
+    MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY
+  }
+
+  public boolean skip(Day day) {
+    List<Element> days = getExtensions(RssConstants.QNAME_DAY);
+    for (Element d : days) {
+      try {
+        Day check = Day.valueOf(d.getText().toUpperCase());
+        if (d.equals(check)) return true;
+      } catch (Exception e) {}
+    }
+    return false;
+  }
+}

Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSkipHours.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSkipHours.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSkipHours.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSkipHours.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,48 @@
+/*
+* 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.ext.rss;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+
+public class RssSkipHours extends ExtensibleElementWrapper {
+
+  public RssSkipHours(Element internal) {
+    super(internal);
+  }
+
+  public RssSkipHours(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  public boolean skip(int hour) {
+    List<Element> hours = getExtensions(RssConstants.QNAME_HOUR);
+    for (Element h : hours) {
+      try {
+        int check = Integer.parseInt(h.getText());
+        if (check == hour) return true;
+      } catch (Exception e) {}
+    }
+    return false;
+  }
+}

Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSource.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSource.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSource.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSource.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,390 @@
+/*
+* 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.ext.rss;
+
+import java.util.Date;
+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.Collection;
+import org.apache.abdera.model.DateTime;
+import org.apache.abdera.model.Div;
+import org.apache.abdera.model.Element;
+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 RssSource 
+  extends ExtensibleElementWrapper 
+  implements Source {
+
+  private Link self = null;
+  
+  public RssSource(Element internal) {
+    super(internal);
+    self = new RssLink(internal);
+  }
+
+  public RssSource(Factory factory, QName qname) {
+    super(factory, qname);
+    self = new RssLink(factory,qname);
+  }
+
+  public <T extends Source>T 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 <T extends Source>T 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 <T extends Source>T addContributor(Person person) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Person addContributor(String name) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Person addContributor(String name, String email, String iri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Source>T 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) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Link getAlternateLink(String type, String hreflang)  {
+    return getAlternateLink();
+  }
+
+  public IRI getAlternateLinkResolvedHref() {
+    Link link = getAlternateLink();
+    return (link != null) ? link.getResolvedHref() : null;
+  }
+
+  public IRI getAlternateLinkResolvedHref(String type, String hreflang) {
+    Link link = getAlternateLink();
+    return (link != null) ? link.getResolvedHref() : null;
+  }
+
+  public Person getAuthor() {
+    return null;
+  }
+
+  public List<Person> getAuthors() {
+    return null;
+  }
+
+  public List<Category> getCategories() {
+    return null;
+  }
+
+  public List<Category> getCategories(String scheme) {
+    return null;
+  }
+
+  public Collection getCollection() {
+    return null;
+  }
+
+  public List<Person> getContributors() {
+    return null;
+  }
+
+  public Generator getGenerator() {
+    return null;
+  }
+
+  public IRI getIcon() {
+    return null;
+  }
+
+  public IRIElement getIconElement() {
+    return null;
+  }
+
+  public IRI getId() {
+    return null;
+  }
+
+  public IRIElement getIdElement() {
+    return null;
+  }
+
+  public Link getLink(String rel) {
+    return null;
+  }
+
+  public IRI getLinkResolvedHref(String rel) {
+    return null;
+  }
+
+  public List<Link> getLinks() {
+    return null;
+  }
+
+  public List<Link> getLinks(String rel) {
+    return null;
+  }
+
+  public List<Link> getLinks(String... rel) {
+    return null;
+  }
+
+  public IRI getLogo() {
+    return null;
+  }
+
+  public IRIElement getLogoElement() {
+    return null;
+  }
+
+  public String getRights() {
+    return null;
+  }
+
+  public Text getRightsElement() {
+    return null;
+  }
+
+  public Type getRightsType() {
+    return null;
+  }
+
+  public Link getSelfLink() {
+    return getAlternateLink();
+  }
+
+  public IRI getSelfLinkResolvedHref() {
+    Link link = getSelfLink();
+    return (link != null) ? link.getResolvedHref() : null;
+  }
+
+  public String getSubtitle() {
+    return null;
+  }
+
+  public Text getSubtitleElement() {
+    return null;
+  }
+
+  public Type getSubtitleType() {
+    return null;
+  }
+
+  public String getTitle() {
+    return getText();
+  }
+
+  public Text getTitleElement() {
+    return null;
+  }
+
+  public Type getTitleType() {
+    return Type.HTML;
+  }
+
+  public Date getUpdated() {
+    return null;
+  }
+
+  public DateTime getUpdatedElement() {
+    return null;
+  }
+
+  public String getUpdatedString() {
+    return null;
+  }
+
+  public IRIElement newId() {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Source>T setCollection(Collection collection) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Source>T 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 <T extends Source>T setIconElement(IRIElement iri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public IRIElement setId(String id) {
+    return null;
+  }
+
+  public IRIElement setId(String id, boolean normalize) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Source>T setIdElement(IRIElement id) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public IRIElement setLogo(String iri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public <T extends Source>T 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 <T extends Source>T 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 <T extends Source>T setSubtitleElement(Text text) {
+    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 <T extends Source>T 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 <T extends Source>T setUpdatedElement(DateTime dateTime) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setTitle(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Link getAlternateLink() {
+    return self;
+  }
+
+  public Feed getAsFeed() {
+    throw new UnsupportedOperationException("Converting to feed is not supported");
+  }
+
+}

Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssText.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssText.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssText.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssText.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,72 @@
+/*
+* 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.ext.rss;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Div;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+import org.apache.abdera.model.Text;
+
+public class RssText 
+  extends ElementWrapper 
+  implements Text {
+
+  public RssText(Element internal) {
+    super(internal);
+  }
+
+  public RssText(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  public Type getTextType() {
+    return Type.HTML;
+  }
+
+  public String getValue() {
+    return getText();
+  }
+
+  public Div getValueElement() {
+    return null;
+  }
+
+  public String getWrappedValue() {
+    return getValue();
+  }
+
+  public Text setTextType(Type type) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setValue(String value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setValueElement(Div value) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public Text setWrappedValue(String wrappedValue) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+}

Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssTextInput.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssTextInput.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssTextInput.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssTextInput.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,58 @@
+/*
+* 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.ext.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.Text;
+
+public class RssTextInput extends ExtensibleElementWrapper {
+
+  public RssTextInput(Element internal) {
+    super(internal);
+  }
+
+  public RssTextInput(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  public String getTitle() {
+    Text text = getExtension(RssConstants.QNAME_TITLE);
+    return (text != null) ? text.getValue() : null;
+  }
+  
+  public String getDescription() {
+    Text text = getExtension(RssConstants.QNAME_DESCRIPTION);
+    return (text != null) ? text.getValue() : null;
+  }
+  
+  public String getName() {
+    Element el = getExtension(RssConstants.QNAME_NAME);
+    return (el != null) ? el.getText() : null;
+  }
+  
+  public IRI getLink() {
+    IRIElement iri = getExtension(RssConstants.QNAME_LINK);
+    return (iri != null) ? iri.getValue() : null;
+  }
+}

Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssUriElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssUriElement.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssUriElement.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssUriElement.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,54 @@
+/*
+* 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.ext.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.IRIElement;
+
+public class RssUriElement extends ElementWrapper implements IRIElement {
+
+  public RssUriElement(Element internal) {
+    super(internal);
+  }
+
+  public RssUriElement(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+
+  public IRI getResolvedValue() {
+    return getValue();
+  }
+
+  public IRI getValue() {
+    return new IRI(getText());
+  }
+
+  public IRIElement setNormalizedValue(String iri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+  public IRIElement setValue(String iri) {
+    throw new UnsupportedOperationException("Modifications are not allowed");
+  }
+
+}

Added: incubator/abdera/java/trunk/extensions/rss/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory Tue Nov 18 15:38:36 2008
@@ -0,0 +1 @@
+org.apache.abdera.ext.rss.RssExtensionFactory

Added: incubator/abdera/java/trunk/extensions/rss/src/test/java/org/apache/abdera/test/ext/rss/RssTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/test/java/org/apache/abdera/test/ext/rss/RssTest.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/test/java/org/apache/abdera/test/ext/rss/RssTest.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/test/java/org/apache/abdera/test/ext/rss/RssTest.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,88 @@
+/*
+* 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.test.ext.rss;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.apache.abdera.Abdera;
+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 org.junit.Assert;
+import org.junit.Test;
+
+public class RssTest extends Assert {
+
+  @Test
+  public void testRSS1() {
+    
+    Abdera abdera = new Abdera();
+    
+    InputStream in = RssTest.class.getResourceAsStream("/rss1.rdf");
+    
+    Document<Feed> doc = abdera.getParser().parse(in);
+    
+    Feed feed = doc.getRoot();
+    
+    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());
+    
+    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());
+   
+  }
+  
+}

Added: incubator/abdera/java/trunk/extensions/rss/src/test/resources/rss1.rdf
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/test/resources/rss1.rdf?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/test/resources/rss1.rdf (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/test/resources/rss1.rdf Tue Nov 18 15:38:36 2008
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+
+<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.
+    </description>
+
+    <image rdf:resource="http://xml.com/universal/images/xml_tiny.gif" />
+
+    <items>
+      <rdf:Seq>
+        <rdf:li resource="http://xml.com/pub/2000/08/09/xslt/xslt.html" />
+        <rdf:li resource="http://xml.com/pub/2000/08/09/rdfdb/index.html" />
+      </rdf:Seq>
+    </items>
+
+    <textinput rdf:resource="http://search.xml.com" />
+
+  </channel>
+  
+  <image rdf:about="http://xml.com/universal/images/xml_tiny.gif">
+    <title>XML.com</title>
+    <link>http://www.xml.com</link>
+    <url>http://xml.com/universal/images/xml_tiny.gif</url>
+  </image>
+  
+  <item rdf:about="http://xml.com/pub/2000/08/09/xslt/xslt.html">
+    <title>Processing Inclusions with XSLT</title>
+    <link>http://xml.com/pub/2000/08/09/xslt/xslt.html</link>
+    <description>
+     Processing document inclusions with general XML tools can be 
+     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">
+    <title>Putting RDF to Work</title>
+    <link>http://xml.com/pub/2000/08/09/rdfdb/index.html</link>
+    <description>
+     Tool and API support for the Resource Description Framework 
+     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">
+    <title>Search XML.com</title>
+    <description>Search XML.com's XML collection</description>
+    <name>s</name>
+    <link>http://search.xml.com</link>
+  </textinput>
+
+</rdf:RDF>
\ No newline at end of file



Mime
View raw message