You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by jm...@apache.org on 2007/05/30 19:41:04 UTC
svn commit: r542893 [2/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...
Added: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssItem.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssItem.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssItem.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssItem.java Wed May 30 10:41:02 2007
@@ -0,0 +1,572 @@
+/*
+* 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.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+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.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 {
+
+ public RssItem(Element internal) {
+ super(internal);
+ }
+
+ public RssItem(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+
+ 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 uri) {
+ 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 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 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() {
+ RssGuid guid = (RssGuid) getIdElement();
+ if (guid != null && guid.isPermalink())
+ return guid;
+ return getExtension(RssConstants.QNAME_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_AUTHOR);
+ }
+
+ public List<Person> getAuthors() {
+ return getExtensions(RssConstants.QNAME_AUTHOR);
+ }
+
+ 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 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() {
+ throw new UnsupportedOperationException("RSS does not support content by reference");
+ }
+
+ public InputStream getContentStream() throws IOException {
+ throw new UnsupportedOperationException("RSS does not support encoded binary content");
+ }
+
+ 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() {
+ return null;
+ }
+
+ public Control getControl(boolean create) {
+ throw new UnsupportedOperationException("RSS does not support APP features");
+ }
+
+ public Control getControl() {
+ throw new UnsupportedOperationException("RSS does not support APP features");
+ }
+
+ public Link getEditLink() {
+ throw new UnsupportedOperationException("RSS does not support APP features");
+ }
+
+ public IRI getEditLinkResolvedHref() {
+ @SuppressWarnings("unused")
+ Link link = getEditLink();
+ throw new UnsupportedOperationException("RSS does not support APP features");
+ }
+
+ public Link getEditMediaLink() {
+ throw new UnsupportedOperationException("RSS does not support APP features");
+ }
+
+ public Link getEditMediaLink(String type, String hreflang)
+ throws MimeTypeParseException {
+ throw new UnsupportedOperationException("RSS does not support APP features");
+ }
+
+ public IRI getEditMediaLinkResolvedHref() {
+ throw new UnsupportedOperationException("RSS does not support APP features");
+ }
+
+ public IRI getEditMediaLinkResolvedHref(String type, String hreflang)
+ throws MimeTypeParseException {
+ throw new UnsupportedOperationException("RSS does not support APP features");
+ }
+
+ public Date getEdited() {
+ throw new UnsupportedOperationException("RSS does not support APP features");
+ }
+
+ public DateTime getEditedElement() {
+ throw new UnsupportedOperationException("RSS does not support APP features");
+ }
+
+ 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() {
+ return getExtension(RssConstants.QNAME_GUID);
+ }
+
+ 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;
+ }
+ 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);
+ 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();
+ return null;
+ }
+
+ 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() {
+ return getExtension(RssConstants.QNAME_SOURCE);
+ }
+
+ public String getSummary() {
+ Text text = getSummaryElement();
+ return (text != null) ? text.getValue() : null;
+ }
+
+ public Text getSummaryElement() {
+ return getExtension(RssConstants.QNAME_DESCRIPTION);
+ }
+
+ 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() {
+ return getExtension(RssConstants.QNAME_TITLE);
+ }
+
+ 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)
+ throws MimeTypeParseException {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Content setContent(DataHandler dataHandler)
+ throws MimeTypeParseException {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Content setContent(DataHandler dataHandler, String mediatype)
+ throws MimeTypeParseException {
+ 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)
+ throws MimeTypeParseException {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Content setContent(String value, String mediatype)
+ throws MimeTypeParseException {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Content setContent(IRI uri, String mediatype)
+ throws MimeTypeParseException {
+ 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 void setContentElement(Content content) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void setControl(Control control) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void 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 void 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 void 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 void setRightsElement(Text text) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void 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 void 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 void 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 void setUpdatedElement(DateTime updated) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Link getComments() {
+ return getExtension(RssConstants.QNAME_COMMENTS);
+ }
+}
Added: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssLink.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssLink.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssLink.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssLink.java Wed May 30 10:41:02 2007
@@ -0,0 +1,102 @@
+/*
+* 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.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 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() throws MimeTypeParseException {
+ 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 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");
+ }
+
+}
Added: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssPerson.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssPerson.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssPerson.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssPerson.java Wed May 30 10:41:02 2007
@@ -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.contrib.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("\\<\\;","")
+ .replaceAll("\\>\\;","")
+ .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 void 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 void 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 void setUriElement(IRIElement element) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+}
Added: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSkipDays.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSkipDays.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSkipDays.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSkipDays.java Wed May 30 10:41:02 2007
@@ -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.contrib.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/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSkipHours.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSkipHours.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSkipHours.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSkipHours.java Wed May 30 10:41:02 2007
@@ -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.contrib.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/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSource.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSource.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSource.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssSource.java Wed May 30 10:41:02 2007
@@ -0,0 +1,388 @@
+/*
+* 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.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.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.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 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 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 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(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 {
+ 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 void setCollection(Collection collection) {
+ 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) {
+ return null;
+ }
+
+ 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, 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 Text setTitle(String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Link getAlternateLink() {
+ return self;
+ }
+
+}
Added: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssText.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssText.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssText.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssText.java Wed May 30 10:41:02 2007
@@ -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.contrib.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 void setTextType(Type type) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void setValue(String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void setValueElement(Div 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/RssTextInput.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssTextInput.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssTextInput.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssTextInput.java Wed May 30 10:41:02 2007
@@ -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.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.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/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssUriElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssUriElement.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssUriElement.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssUriElement.java Wed May 30 10:41:02 2007
@@ -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.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.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 void setNormalizedValue(String iri) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void setValue(String iri) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+}
Added: incubator/abdera/java/trunk/contrib/rss/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory Wed May 30 10:41:02 2007
@@ -0,0 +1 @@
+org.apache.abdera.contrib.rss.RssExtensionFactory
\ No newline at end of file
Added: incubator/abdera/java/trunk/contrib/rss/src/test/java/org/apache/abdera/test/contrib/rss/RssTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/test/java/org/apache/abdera/test/contrib/rss/RssTest.java?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/test/java/org/apache/abdera/test/contrib/rss/RssTest.java (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/test/java/org/apache/abdera/test/contrib/rss/RssTest.java Wed May 30 10:41:02 2007
@@ -0,0 +1,51 @@
+/*
+* 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.contrib.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 junit.framework.TestCase;
+
+public class RssTest extends TestCase {
+
+ public static 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());
+ List<Entry> entries = feed.getEntries();
+ assertEquals(2, entries.size());
+
+ // TODO: finish this test as the RSS 1.0 impl is completed
+ }
+
+}
Added: incubator/abdera/java/trunk/contrib/rss/src/test/resources/rss1.rdf
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/test/resources/rss1.rdf?view=auto&rev=542893
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/test/resources/rss1.rdf (added)
+++ incubator/abdera/java/trunk/contrib/rss/src/test/resources/rss1.rdf Wed May 30 10:41:02 2007
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+
+<rdf:RDF
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ 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>
+ <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>
+ </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>
+ </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