You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by ca...@apache.org on 2008/11/19 00:38:37 UTC
svn commit: r718797 [1/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/ ...
Author: calavera
Date: Tue Nov 18 15:38:36 2008
New Revision: 718797
URL: http://svn.apache.org/viewvc?rev=718797&view=rev
Log:
[ABDERA-202]: Add RSS contrib to regular build
I've moved it from the contrib directory to the extensions directory
Added:
incubator/abdera/java/trunk/extensions/rss/
incubator/abdera/java/trunk/extensions/rss/pom.xml
incubator/abdera/java/trunk/extensions/rss/src/
incubator/abdera/java/trunk/extensions/rss/src/main/
incubator/abdera/java/trunk/extensions/rss/src/main/java/
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssCategory.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssChannel.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssCloud.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssConstants.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssContent.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssDateTime.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssEnclosure.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssExtensionFactory.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssFeed.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssGenerator.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssGuid.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssImage.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssItem.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssLink.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssPerson.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSkipDays.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSkipHours.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssSource.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssText.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssTextInput.java
incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssUriElement.java
incubator/abdera/java/trunk/extensions/rss/src/main/resources/
incubator/abdera/java/trunk/extensions/rss/src/main/resources/META-INF/
incubator/abdera/java/trunk/extensions/rss/src/main/resources/META-INF/services/
incubator/abdera/java/trunk/extensions/rss/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory
incubator/abdera/java/trunk/extensions/rss/src/test/
incubator/abdera/java/trunk/extensions/rss/src/test/java/
incubator/abdera/java/trunk/extensions/rss/src/test/java/org/
incubator/abdera/java/trunk/extensions/rss/src/test/java/org/apache/
incubator/abdera/java/trunk/extensions/rss/src/test/java/org/apache/abdera/
incubator/abdera/java/trunk/extensions/rss/src/test/java/org/apache/abdera/test/
incubator/abdera/java/trunk/extensions/rss/src/test/java/org/apache/abdera/test/ext/
incubator/abdera/java/trunk/extensions/rss/src/test/java/org/apache/abdera/test/ext/rss/
incubator/abdera/java/trunk/extensions/rss/src/test/java/org/apache/abdera/test/ext/rss/RssTest.java
incubator/abdera/java/trunk/extensions/rss/src/test/resources/
incubator/abdera/java/trunk/extensions/rss/src/test/resources/rss1.rdf
Removed:
incubator/abdera/java/trunk/contrib/rss/
Modified:
incubator/abdera/java/trunk/extensions/pom.xml
Modified: incubator/abdera/java/trunk/extensions/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/pom.xml?rev=718797&r1=718796&r2=718797&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/pom.xml (original)
+++ incubator/abdera/java/trunk/extensions/pom.xml Tue Nov 18 15:38:36 2008
@@ -40,6 +40,7 @@
<module>media</module>
<module>oauth</module>
<module>opensearch</module>
+ <module>rss</module>
<module>serializer</module>
<module>sharing</module>
<module>wsse</module>
Added: incubator/abdera/java/trunk/extensions/rss/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/pom.xml?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/pom.xml (added)
+++ incubator/abdera/java/trunk/extensions/rss/pom.xml 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. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.abdera</groupId>
+ <artifactId>abdera</artifactId>
+ <version>0.5.0-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>abdera-extensions-rss</artifactId>
+ <packaging>jar</packaging>
+ <name>Abdera Extensions - RSS</name>
+ <version>0.5.0-incubating-SNAPSHOT</version>
+ <description>Abdera Specification Extensions - RSS</description>
+ <properties>
+ <topDir>${basedir}/../..</topDir>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.abdera</groupId>
+ <artifactId>abdera-core</artifactId>
+ <version>0.5.0-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.abdera</groupId>
+ <artifactId>abdera-parser</artifactId>
+ <version>0.5.0-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssCategory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssCategory.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssCategory.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssCategory.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,119 @@
+/*
+* 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.i18n.iri.IRI;
+import org.apache.abdera.model.Category;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ExtensibleElement;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+
+public class RssCategory
+ extends ExtensibleElementWrapper
+ implements Category {
+
+ public RssCategory(Element internal) {
+ super(internal);
+ }
+
+ public RssCategory(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+
+ public String getLabel() {
+ return null;
+ }
+
+ public IRI getScheme() {
+ String domain = this.getAttributeValue("domain");
+ return (domain != null) ? new IRI(this.getAttributeValue("domain")) : null;
+ }
+
+ public String getTerm() {
+ return getText();
+ }
+
+ public Category setLabel(String label) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Category setScheme(String scheme) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Category setTerm(String term) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public <T extends ExtensibleElement>T addExtension(Element extension) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public <T extends Element> T addExtension(QName qname) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public <T extends Element> T addExtension(String namespace, String localPart,
+ String prefix) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Element addSimpleExtension(QName qname, String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Element addSimpleExtension(String namespace, String localPart,
+ String prefix, String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public <T extends Element> T getExtension(QName qname) {
+ return null;
+ }
+
+ public <T extends Element> T getExtension(Class<T> _class) {
+ return null;
+ }
+
+ public List<Element> getExtensions() {
+ return null;
+ }
+
+ public List<Element> getExtensions(String uri) {
+ return null;
+ }
+
+ public <T extends Element> List<T> getExtensions(QName qname) {
+ return null;
+ }
+
+ public String getSimpleExtension(QName qname) {
+ return null;
+ }
+
+ public String getSimpleExtension(String namespace, String localPart,
+ String prefix) {
+ return null;
+ }
+
+}
Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssChannel.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssChannel.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssChannel.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssChannel.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,547 @@
+/*
+* 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.ArrayList;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.Category;
+import org.apache.abdera.model.DateTime;
+import org.apache.abdera.model.Div;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.ExtensibleElement;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+import org.apache.abdera.model.Generator;
+import org.apache.abdera.model.IRIElement;
+import org.apache.abdera.model.Link;
+import org.apache.abdera.model.Person;
+import org.apache.abdera.model.Text;
+import org.apache.abdera.model.Text.Type;
+import org.apache.abdera.parser.stax.util.FOMElementIterator;
+import org.apache.abdera.parser.stax.util.FOMHelper;
+import org.apache.abdera.parser.stax.util.FOMList;
+import org.apache.abdera.util.Constants;
+import org.apache.abdera.xpath.XPath;
+import org.apache.abdera.xpath.XPathException;
+
+public class RssChannel
+ extends ExtensibleElementWrapper {
+
+ public RssChannel(Element internal) {
+ super(internal);
+ }
+
+ public RssChannel(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+
+ public void addEntry(Entry entry) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Entry addEntry() {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public List<Entry> getEntries() {
+ QName qname = getQName();
+ if (qname.getNamespaceURI().equals(RssConstants.RSS1_NS) &&
+ qname.getLocalPart().equals("channel")) {
+ List<Entry> entries = new ArrayList<Entry>();
+ ExtensibleElement items = getExtension(RssConstants.QNAME_RDF_ITEMS);
+ if (items != null) {
+ ExtensibleElement se = items.getExtension(RssConstants.QNAME_RDF_SEQ);
+ if (se != null) {
+ List<Element> seq = se.getExtensions(RssConstants.QNAME_RDF_LI);
+ for (Element el : seq) {
+ String res = el.getAttributeValue("resource");
+ if (res != null) {
+ String path = "//rss:item[@rdf:about='" + res + "']";
+ Element entryel = null;
+ try {
+ entryel = locate(path);
+ } catch (Exception e) {}
+ if (entryel != null) {
+ //TODO:fix this.. entryel should already be an RssItem
+ entries.add(new RssItem(entryel));
+ }
+ }
+ }
+ }
+ }
+ return entries;
+ } else {
+ return getExtensions(RssConstants.QNAME_ITEM);
+ }
+ }
+
+ public Entry getEntry(String id) {
+ if (id == null) return null;
+ List<Entry> l = getEntries();
+ for (Entry e : l) {
+ IRI eid = e.getId();
+ if (eid != null && eid.equals(new IRI(id))) return e;
+ }
+ return null;
+ }
+
+ public void insertEntry(Entry entry) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Entry insertEntry() {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void sortEntries(Comparator<Entry> comparator) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void sortEntriesByEdited(boolean new_first) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void sortEntriesByUpdated(boolean new_first) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void addAuthor(Person person) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Person addAuthor(String name) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Person addAuthor(String name, String email, String iri) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void addCategory(Category category) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Category addCategory(String term) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Category addCategory(String scheme, String term, String label) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void addLink(Link link) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Link addLink(String href) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Link addLink(String href, String rel) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Link addLink(String href, String rel, String type, String title,
+ String hreflang, long length) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Link getAlternateLink() {
+ Link link = getExtension(RssConstants.QNAME_LINK);
+ if (link == null) link = getExtension(RssConstants.QNAME_RDF_LINK);
+ return link;
+ }
+
+ public Link getAlternateLink(String type, String hreflang){
+ 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_MANAGINGEDITOR);
+ if (person == null) person = getExtension(RssConstants.QNAME_DC_CREATOR);
+ return person;
+ }
+
+ public List<Person> getAuthors() {
+ List<Person> people = getExtensions(RssConstants.QNAME_MANAGINGEDITOR);
+ if (people == null || people.size() == 0) people = getExtensions(RssConstants.QNAME_DC_CREATOR);
+ return people;
+ }
+
+ public List<Person> getContributors() {
+ List<Person> people = getExtensions(RssConstants.QNAME_DC_CONTRIBUTOR);
+ return people;
+ }
+
+ public List<Category> getCategories() {
+ 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 Generator getGenerator() {
+ return getExtension(RssConstants.QNAME_GENERATOR);
+ }
+
+ public IRI getIcon() {
+ IRIElement iri = getIconElement();
+ return (iri != null) ? iri.getValue() : null;
+ }
+
+ public IRIElement getIconElement() {
+ return getLogoElement();
+ }
+
+ public IRI getId() {
+ IRIElement id = getIdElement();
+ return (id != null) ? id.getValue() : null;
+ }
+
+ public IRIElement getIdElement() {
+ return getExtension(RssConstants.QNAME_DC_IDENTIFIER);
+ }
+
+ public Link getLink(String rel) {
+ if (rel.equals(Link.REL_ALTERNATE) || rel.equals(Link.REL_ALTERNATE_IANA)) {
+ RssGuid guid = (RssGuid) getIdElement();
+ if (guid != null && guid.isPermalink()) return guid;
+ return getAlternateLink();
+ }
+ List<Link> links = FOMHelper.getLinks(getInternal(), rel);
+ return (links != null && links.size() > 0) ? links.get(0) : null;
+ }
+
+ public IRI getLinkResolvedHref(String rel) {
+ Link link = getLink(rel);
+ return (link != null) ? link.getResolvedHref() : null;
+ }
+
+ public List<Link> getLinks() {
+ return getExtensions(Constants.LINK);
+ }
+
+ public List<Link> getLinks(String rel) {
+ return FOMHelper.getLinks(getInternal(), rel);
+ }
+
+ public List<Link> getLinks(String... rel) {
+ return FOMHelper.getLinks(getInternal(), rel);
+ }
+
+ public IRI getLogo() {
+ IRIElement iri = getLogoElement();
+ return (iri != null) ? iri.getValue() : null;
+ }
+
+ public IRIElement getLogoElement() {
+
+ IRIElement iri = getExtension(RssConstants.QNAME_IMAGE);
+ if (iri == null) {
+ Element image = getExtension(RssConstants.QNAME_RDF_IMAGE);
+ if (image != null) {
+ String id = image.getAttributeValue(RssConstants.QNAME_RDF_RESOURCE);
+ if (id != null) {
+ String path = "//rss:image[@rdf:about='" + id + "']";
+ Element res = null;
+ try {
+ res = locate(path);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if (res != null) {
+ // TODO: Need to fix
+ return new RssImage(res);
+ }
+ } else {
+ return (IRIElement) image;
+ }
+ }
+
+ }
+ return iri;
+ }
+
+ public String getRights() {
+ Text text = getRightsElement();
+ return (text != null) ? text.getValue() : null;
+ }
+
+ public Text getRightsElement() {
+ Text text = getExtension(RssConstants.QNAME_COPYRIGHT);
+ if (text == null) text = getExtension(RssConstants.QNAME_DC_RIGHTS);
+ return text;
+ }
+
+ public Type getRightsType() {
+ Text text = getRightsElement();
+ return (text != null) ? text.getTextType() : null;
+ }
+
+ public Link getSelfLink() {
+ return getLink("self");
+ }
+
+ public IRI getSelfLinkResolvedHref() {
+ Link link = getSelfLink();
+ return (link != null) ? link.getResolvedHref() : null;
+ }
+
+ public String getSubtitle() {
+ Text text = getSubtitleElement();
+ return (text != null) ? text.getValue() : null;
+ }
+
+ public Text getSubtitleElement() {
+ Text text = getExtension(RssConstants.QNAME_DESCRIPTION);
+ if (text == null) text = getExtension(RssConstants.QNAME_RDF_DESCRIPTION);
+ if (text == null) text = getExtension(RssConstants.QNAME_DC_DESCRIPTION);
+ return text;
+ }
+
+ public Type getSubtitleType() {
+ Text text = getSubtitleElement();
+ return (text != null) ? text.getTextType() : null;
+ }
+
+ public String getTitle() {
+ Text text = getTitleElement();
+ return (text != null) ? text.getValue() : null;
+ }
+
+ public Text getTitleElement() {
+ Text text = getExtension(RssConstants.QNAME_TITLE);
+ if (text == null) text = getExtension(RssConstants.QNAME_RDF_TITLE);
+ if (text == null) text = getExtension(RssConstants.QNAME_DC_TITLE);
+ return text;
+ }
+
+ public Type getTitleType() {
+ Text text = getTitleElement();
+ return (text != null) ? text.getTextType() : null;
+ }
+
+ public Date getUpdated() {
+ DateTime dt = getUpdatedElement();
+ return (dt != null) ? dt.getDate() : null;
+ }
+
+ public DateTime getUpdatedElement() {
+ DateTime dt = getExtension(RssConstants.QNAME_LASTBUILDDATE);
+ if (dt == null) dt = getExtension(RssConstants.QNAME_LASTBUILDDATE2);
+ if (dt == null) dt = getExtension(RssConstants.QNAME_PUBDATE);
+ if (dt == null) dt = getExtension(RssConstants.QNAME_PUBDATE2);
+ if (dt == null) dt = getExtension(RssConstants.QNAME_DC_DATE);
+ return dt;
+ }
+
+ public String getUpdatedString() {
+ DateTime dt = getUpdatedElement();
+ return (dt != null) ? dt.getString() : null;
+ }
+
+ public Date getPublished() {
+ DateTime dt = getPublishedElement();
+ return (dt != null) ? dt.getDate() : null;
+ }
+
+ public DateTime getPublishedElement() {
+ DateTime dt = getExtension(RssConstants.QNAME_PUBDATE);
+ if (dt == null) dt = getExtension(RssConstants.QNAME_PUBDATE2);
+ if (dt == null) dt = getExtension(RssConstants.QNAME_DC_DATE);
+ return dt;
+ }
+
+ public String getPublishedString() {
+ DateTime dt = getPublishedElement();
+ return (dt != null) ? dt.getString() : null;
+ }
+
+ public IRIElement newId() {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void setGenerator(Generator generator) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Generator setGenerator(String iri, String version, String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public IRIElement setIcon(String iri) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void setIconElement(IRIElement iri) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public IRIElement setId(String id) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public IRIElement setId(String id, boolean normalize) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void setIdElement(IRIElement id) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public IRIElement setLogo(String iri) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void setLogoElement(IRIElement iri) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setRights(String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setRights(String value, Type type) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setRights(Div value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setRightsAsHtml(String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setRightsAsXhtml(String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void setRightsElement(Text text) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setSubtitle(String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setSubtitle(String value, Type type) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setSubtitle(Div value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setSubtitleAsHtml(String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setSubtitleAsXhtml(String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void setSubtitleElement(Text text) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setTitle(String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setTitle(String value, Type type) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setTitle(Div value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setTitleAsHtml(String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Text setTitleAsXhtml(String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void setTitleElement(Text text) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public DateTime setUpdated(Date value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public DateTime setUpdated(String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public void setUpdatedElement(DateTime dateTime) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public String getLanguage() {
+ String lang = getSimpleExtension(RssConstants.QNAME_LANGUAGE);
+ if (lang == null) lang = getSimpleExtension(RssConstants.QNAME_DC_LANGUAGE);
+ return lang;
+ }
+
+ public <T extends Element>T setLanguage(String language) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ private Element locate(String path) throws XPathException {
+ Abdera abdera = this.getFactory().getAbdera();
+ XPath xpath = abdera.getXPath();
+ Map<String,String> ns = xpath.getDefaultNamespaces();
+ ns.put("rdf", RssConstants.RDF_NS);
+ ns.put("rss", RssConstants.RSS1_NS);
+ Element el = getDocument().getRoot();
+ if (el instanceof ElementWrapper) {
+ el = ((ElementWrapper)el).getInternal();
+ }
+ return (Element) xpath.selectSingleNode(path,el,ns);
+ }
+}
Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssCloud.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssCloud.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssCloud.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssCloud.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,56 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.rss;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+
+public class RssCloud extends ElementWrapper {
+
+ public RssCloud(Element internal) {
+ super(internal);
+ }
+
+ public RssCloud(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+
+ public String getDomain() {
+ return getAttributeValue("domain");
+ }
+
+ public int getPort() {
+ String v = getAttributeValue("port");
+ return (v != null) ? Integer.parseInt(v) : -1;
+ }
+
+ public String getPath() {
+ return getAttributeValue("path");
+ }
+
+ public String getRegisterProcedure() {
+ return getAttributeValue("registerProcedure");
+ }
+
+ public String getProtocol() {
+ return getAttributeValue("protocol");
+ }
+}
Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssConstants.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssConstants.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssConstants.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssConstants.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,106 @@
+/*
+* 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;
+
+public interface RssConstants {
+
+ public static final String RSS_MEDIATYPE = "application/rss+xml";
+ public static final String RDF_MEDIATYPE = "application/rdf+xml";
+
+ public static final String ENC_NS = "http://purl.org/rss/1.0/modules/content/";
+ public static final String RDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+ public static final String RSS1_NS = "http://purl.org/rss/1.0/";
+ public static final String DC_NS = "http://purl.org/dc/elements/1.1/";
+
+ public static final QName QNAME_RDF = new QName(RDF_NS,"RDF");
+ public static final QName QNAME_RDF_CHANNEL = new QName(RSS1_NS,"channel");
+ public static final QName QNAME_RDF_TITLE = new QName(RSS1_NS,"title");
+ public static final QName QNAME_RDF_LINK = new QName(RSS1_NS,"link");
+ public static final QName QNAME_RDF_DESCRIPTION = new QName(RSS1_NS,"description");
+ public static final QName QNAME_RDF_ITEM = new QName(RSS1_NS,"item");
+ public static final QName QNAME_RDF_IMAGE = new QName(RSS1_NS,"image");
+ public static final QName QNAME_RDF_SEQ = new QName(RDF_NS,"Seq");
+ public static final QName QNAME_RDF_LI = new QName(RDF_NS,"li");
+ public static final QName QNAME_RDF_RESOURCE = new QName(RDF_NS,"resource");
+ public static final QName QNAME_RDF_ABOUT = new QName(RDF_NS,"about");
+ public static final QName QNAME_RDF_URL = new QName(RSS1_NS, "url");
+ public static final QName QNAME_RDF_ITEMS = new QName(RSS1_NS, "items");
+
+ public static final QName QNAME_RSS = new QName("rss");
+ public static final QName QNAME_CHANNEL = new QName("channel");
+ public static final QName QNAME_ITEM = new QName("item");
+ public static final QName QNAME_LINK = new QName("link");
+ public static final QName QNAME_TITLE = new QName("title");
+ public static final QName QNAME_DESCRIPTION = new QName("description");
+ public static final QName QNAME_LANGUAGE = new QName("language");
+ public static final QName QNAME_COPYRIGHT = new QName("copyright");
+ public static final QName QNAME_MANAGINGEDITOR = new QName("managingEditor");
+ public static final QName QNAME_MANAGINGEDITOR2 = new QName("managingeditor");
+ public static final QName QNAME_WEBMASTER = new QName("webMaster");
+ public static final QName QNAME_WEBMASTER2 = new QName("webmaster");
+ public static final QName QNAME_PUBDATE = new QName("pubDate");
+ public static final QName QNAME_PUBDATE2 = new QName("pubdate");
+ public static final QName QNAME_LASTBUILDDATE = new QName("lastBuildDate");
+ public static final QName QNAME_LASTBUILDDATE2 = new QName("lastbuilddate");
+ public static final QName QNAME_CATEGORY = new QName("category");
+ public static final QName QNAME_GENERATOR = new QName("generator");
+ public static final QName QNAME_DOCS = new QName("docs");
+ public static final QName QNAME_CLOUD = new QName("cloud");
+ public static final QName QNAME_TTL = new QName("ttl");
+ public static final QName QNAME_IMAGE = new QName("image");
+ public static final QName QNAME_RATING = new QName("rating");
+ public static final QName QNAME_TEXTINPUT = new QName("textInput");
+ public static final QName QNAME_TEXTINPUT2 = new QName("textinput");
+ public static final QName QNAME_SKIPHOURS = new QName("skipHours");
+ public static final QName QNAME_SKIPHOURS2 = new QName("skiphours");
+ public static final QName QNAME_SKIPDAYS = new QName("skipDays");
+ public static final QName QNAME_SKIPDAYS2 = new QName("skipdays");
+ public static final QName QNAME_AUTHOR = new QName("author");
+ public static final QName QNAME_ENCLOSURE = new QName("enclosure");
+ public static final QName QNAME_GUID = new QName("guid");
+ public static final QName QNAME_COMMENTS = new QName("comments");
+ public static final QName QNAME_SOURCE = new QName("source");
+
+ public static final QName QNAME_URL = new QName("url");
+ public static final QName QNAME_WIDTH = new QName("width");
+ public static final QName QNAME_HEIGHT = new QName("height");
+ public static final QName QNAME_DAY = new QName("day");
+ public static final QName QNAME_HOUR = new QName("hour");
+ public static final QName QNAME_NAME = new QName("name");
+
+ public static final QName QNAME_CONTENT_ENCODED = new QName(ENC_NS, "encoded");
+
+ public static final QName QNAME_DC_TITLE = new QName(DC_NS, "title");
+ public static final QName QNAME_DC_CREATOR = new QName(DC_NS, "creator");
+ public static final QName QNAME_DC_SUBJECT = new QName(DC_NS, "subject");
+ public static final QName QNAME_DC_DESCRIPTION = new QName(DC_NS, "description");
+ public static final QName QNAME_DC_PUBLISHER = new QName(DC_NS, "publisher");
+ public static final QName QNAME_DC_CONTRIBUTOR = new QName(DC_NS, "contributor");
+ public static final QName QNAME_DC_DATE = new QName(DC_NS, "date");
+ public static final QName QNAME_DC_TYPE = new QName(DC_NS, "type");
+ public static final QName QNAME_DC_FORMAT = new QName(DC_NS, "format");
+ public static final QName QNAME_DC_IDENTIFIER = new QName(DC_NS, "identifier");
+ public static final QName QNAME_DC_SOURCE = new QName(DC_NS, "source");
+ public static final QName QNAME_DC_LANGUAGE = new QName(DC_NS, "language");
+ public static final QName QNAME_DC_RELATION = new QName(DC_NS, "relation");
+ public static final QName QNAME_DC_COVERAGE = new QName(DC_NS, "covrerage");
+ public static final QName QNAME_DC_RIGHTS = new QName(DC_NS, "rights");
+
+}
Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssContent.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssContent.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssContent.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssContent.java Tue Nov 18 15:38:36 2008
@@ -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.ext.rss;
+
+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.Content;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+
+public class RssContent
+ extends ElementWrapper
+ implements Content {
+
+ public RssContent(Element internal) {
+ super(internal);
+ }
+
+ public RssContent(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+
+ public Type getContentType() {
+ return Type.HTML;
+ }
+
+ public DataHandler getDataHandler() {
+ return null;
+ }
+
+ public MimeType getMimeType() {
+ return null;
+ }
+
+ public IRI getResolvedSrc() {
+ return null;
+ }
+
+ public IRI getSrc() {
+ return null;
+ }
+
+ public String getValue() {
+ return getText();
+ }
+
+ public <T extends Element> T getValueElement() {
+ return null;
+ }
+
+ public String getWrappedValue() {
+ return getText();
+ }
+
+ public Content setContentType(Type type) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Content setDataHandler(DataHandler dataHandler) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Content setMimeType(String type){
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Content setSrc(String src) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Content setValue(String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public <T extends Element> Content setValueElement(T value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Content 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/RssDateTime.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssDateTime.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssDateTime.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssDateTime.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,117 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.rss;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.AtomDate;
+import org.apache.abdera.model.DateTime;
+import org.apache.abdera.model.DateTimeWrapper;
+import org.apache.abdera.model.Element;
+
+public class RssDateTime
+ extends DateTimeWrapper
+ implements DateTime {
+
+ private static String[] masks = {
+ "EEE, dd MMM yyyy HH:mm:ss z",
+ "dd MMM yyyy HH:mm z",
+ "dd MMM yyyy",
+ "-yy-MM-dd",
+ "-yy-MM",
+ "-yymm",
+ "yyyy-MM-dd HH:mm:ss.SSS",
+ "yyyy-MM-dd HH:mm:ss",
+ "yyyy-MM-dd'T'HH:mm:ss.SSSz",
+ "yyyy-MM-dd't'HH:mm:ss.SSSz", // invalid
+ "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
+ "yyyy-MM-dd't'HH:mm:ss.SSS'z'", // invalid
+ "yyyy-MM-dd'T'HH:mm:ssz",
+ "yyyy-MM-dd't'HH:mm:ssz", // invalid
+ "yyyy-MM-dd'T'HH:mm:ss'Z'",
+ "yyyy-MM-dd't'HH:mm:ss'Z'", // invalid
+ "yyyy-MM-dd't'HH:mm:ss'z'", // invalid
+ "yyyy-MM-dd'T'HH:mm:ss'z'", // invalid
+ "yyyy-MM-dd'T'HH:mm:ss'z'", // invalid
+ "yyyy-MM-dd'T'HH:mmz", // invalid
+ "yyyy-MM-dd't'HH:mmz", // invalid
+ "yyyy-MM-dd'T'HH:mm'Z'", // invalid
+ "yyyy-MM-dd't'HH:mm'z'", // invalid
+ "yyyy-MM-dd",
+ "yyyy-MM",
+ "yyyyMMdd",
+ "yyMMdd",
+ "yyyy"
+ };
+
+ public RssDateTime(Element internal) {
+ super(internal);
+ }
+
+ public RssDateTime(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+
+ @Override
+ public AtomDate getValue() {
+ return parse(getText());
+ }
+
+ @Override
+ public DateTime setCalendar(Calendar date) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ @Override
+ public DateTime setDate(Date date) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ @Override
+ public DateTime setString(String date) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ @Override
+ public DateTime setTime(long date) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ @Override
+ public DateTime setValue(AtomDate dateTime) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ private AtomDate parse(String value) {
+ for (String mask : masks) {
+ try {
+ SimpleDateFormat sdf = new SimpleDateFormat(mask);
+ sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
+ Date d = sdf.parse(value);
+ return new AtomDate(d);
+ } catch (Exception e) {}
+ }
+ return null;
+ }
+}
Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssEnclosure.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssEnclosure.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssEnclosure.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssEnclosure.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,154 @@
+/*
+* 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.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.ExtensibleElement;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+import org.apache.abdera.model.Link;
+
+public class RssEnclosure
+ extends ExtensibleElementWrapper
+ implements Link {
+
+ public RssEnclosure(Element internal) {
+ super(internal);
+ }
+
+ public RssEnclosure(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+
+ public IRI getHref() {
+ String url = getAttributeValue("url");
+ return (url != null) ? new IRI(url) : null;
+ }
+
+ public String getHrefLang() {
+ return null;
+ }
+
+ public long getLength() {
+ String l = getAttributeValue("length");
+ return (l != null) ? Integer.parseInt(l) : -1;
+ }
+
+ public MimeType getMimeType() {
+ try {
+ String type = getAttributeValue("type");
+ return (type != null) ? new MimeType(type) : null;
+ } catch (javax.activation.MimeTypeParseException e) {
+ throw new org.apache.abdera.util.MimeTypeParseException(e);
+ }
+ }
+
+ public String getRel() {
+ return "enclosure";
+ }
+
+ 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");
+ }
+
+ public <T extends ExtensibleElement>T addExtension(Element extension) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public <T extends Element> T addExtension(QName qname) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public <T extends Element> T addExtension(String namespace, String localPart,
+ String prefix) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Element addSimpleExtension(QName qname, String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Element addSimpleExtension(String namespace, String localPart,
+ String prefix, String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public <T extends Element> T getExtension(QName qname) {
+ return null;
+ }
+
+ public <T extends Element> T getExtension(Class<T> _class) {
+ return null;
+ }
+
+ public List<Element> getExtensions() {
+ return null;
+ }
+
+ public List<Element> getExtensions(String uri) {
+ return null;
+ }
+
+ public <T extends Element> List<T> getExtensions(QName qname) {
+ return null;
+ }
+
+ public String getSimpleExtension(QName qname) {
+ return null;
+ }
+
+ public String getSimpleExtension(String namespace, String localPart,
+ String prefix) {
+ return null;
+ }
+
+}
Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssExtensionFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssExtensionFactory.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssExtensionFactory.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssExtensionFactory.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,83 @@
+/*
+* 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 org.apache.abdera.util.AbstractExtensionFactory;
+
+public class RssExtensionFactory
+ extends AbstractExtensionFactory
+ implements RssConstants {
+
+ public RssExtensionFactory() {
+ super("",ENC_NS,DC_NS,RDF_NS);
+ addMimeType(QNAME_RSS, RSS_MEDIATYPE);
+ addMimeType(QNAME_RDF, RDF_MEDIATYPE);
+ addImpl(QNAME_RSS,RssFeed.class);
+ addImpl(QNAME_RDF,RssFeed.class);
+ addImpl(QNAME_CHANNEL,RssChannel.class);
+ addImpl(QNAME_RDF_CHANNEL,RssChannel.class);
+ addImpl(QNAME_ITEM,RssItem.class);
+ addImpl(QNAME_RDF_ITEM,RssItem.class);
+ addImpl(QNAME_LINK,RssLink.class);
+ addImpl(QNAME_RDF_LINK,RssLink.class);
+ addImpl(QNAME_TITLE,RssText.class);
+ addImpl(QNAME_RDF_TITLE,RssText.class);
+ addImpl(QNAME_DC_TITLE,RssText.class);
+ addImpl(QNAME_DESCRIPTION,RssText.class);
+ addImpl(QNAME_RDF_DESCRIPTION,RssText.class);
+ addImpl(QNAME_DC_DESCRIPTION,RssText.class);
+ addImpl(QNAME_COPYRIGHT,RssText.class);
+ addImpl(QNAME_DC_RIGHTS,RssText.class);
+ addImpl(QNAME_MANAGINGEDITOR,RssPerson.class);
+ addImpl(QNAME_MANAGINGEDITOR2,RssPerson.class);
+ addImpl(QNAME_DC_CREATOR,RssPerson.class);
+ addImpl(QNAME_DC_CONTRIBUTOR,RssPerson.class);
+ addImpl(QNAME_WEBMASTER,RssPerson.class);
+ addImpl(QNAME_WEBMASTER2,RssPerson.class);
+ addImpl(QNAME_PUBDATE,RssDateTime.class);
+ addImpl(QNAME_PUBDATE2,RssDateTime.class);
+ addImpl(QNAME_LASTBUILDDATE,RssDateTime.class);
+ addImpl(QNAME_LASTBUILDDATE2,RssDateTime.class);
+ addImpl(QNAME_DC_DATE,RssDateTime.class);
+ addImpl(QNAME_CATEGORY,RssCategory.class);
+ addImpl(QNAME_DC_SUBJECT,RssCategory.class);
+ addImpl(QNAME_GENERATOR,RssGenerator.class);
+ addImpl(QNAME_DOCS,RssLink.class);
+ addImpl(QNAME_CLOUD,RssCloud.class);
+ addImpl(QNAME_TTL,RssText.class);
+ addImpl(QNAME_IMAGE,RssImage.class);
+ addImpl(QNAME_RDF_IMAGE,RssImage.class);
+ addImpl(QNAME_TEXTINPUT,RssTextInput.class);
+ addImpl(QNAME_TEXTINPUT2,RssTextInput.class);
+ addImpl(QNAME_SKIPHOURS,RssSkipHours.class);
+ addImpl(QNAME_SKIPHOURS2,RssSkipHours.class);
+ addImpl(QNAME_SKIPDAYS,RssSkipDays.class);
+ addImpl(QNAME_SKIPDAYS2,RssSkipDays.class);
+ addImpl(QNAME_URL,RssUriElement.class);
+ addImpl(QNAME_RDF_URL,RssUriElement.class);
+ addImpl(QNAME_AUTHOR,RssPerson.class);
+ addImpl(QNAME_ENCLOSURE,RssEnclosure.class);
+ addImpl(QNAME_GUID,RssGuid.class);
+ addImpl(QNAME_DC_IDENTIFIER,RssGuid.class);
+ addImpl(QNAME_COMMENTS,RssLink.class);
+ addImpl(QNAME_SOURCE,RssSource.class);
+ addImpl(QNAME_DC_SOURCE,RssSource.class);
+ addImpl(QNAME_CONTENT_ENCODED,RssContent.class);
+ }
+
+}
Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssFeed.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssFeed.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssFeed.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssFeed.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,567 @@
+/*
+* 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.Comparator;
+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.Entry;
+import org.apache.abdera.model.ExtensibleElement;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+import org.apache.abdera.model.Feed;
+import org.apache.abdera.model.Generator;
+import org.apache.abdera.model.IRIElement;
+import org.apache.abdera.model.Link;
+import org.apache.abdera.model.Person;
+import org.apache.abdera.model.Source;
+import org.apache.abdera.model.Text;
+import org.apache.abdera.model.Text.Type;
+
+public class RssFeed
+ extends ExtensibleElementWrapper
+ implements Feed {
+
+ public RssFeed(Element internal) {
+ super(internal);
+ }
+
+ public RssFeed(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+
+ @SuppressWarnings("unused")
+ private RssChannel getChannel() {
+ RssChannel c = super.getExtension(RssConstants.QNAME_CHANNEL);
+ if (c == null) c = super.getExtension(RssConstants.QNAME_RDF_CHANNEL);
+ return c;
+ }
+
+ public Feed addEntry(Entry entry) {
+ getChannel().addEntry(entry);
+ return this;
+ }
+
+ public Entry addEntry() {
+ return getChannel().addEntry();
+ }
+
+ public Source getAsSource() {
+ throw new UnsupportedOperationException("Converting to source is not supported");
+ }
+
+ public List<Entry> getEntries() {
+ return getChannel().getEntries();
+ }
+
+ public Entry getEntry(String id) {
+ return getChannel().getEntry(id);
+ }
+
+ public Feed insertEntry(Entry entry) {
+ getChannel().insertEntry(entry);
+ return this;
+ }
+
+ public Entry insertEntry() {
+ return getChannel().insertEntry();
+ }
+
+ public Feed sortEntries(Comparator<Entry> comparator) {
+ getChannel().sortEntries(comparator);
+ return this;
+ }
+
+ public Feed sortEntriesByEdited(boolean new_first) {
+ getChannel().sortEntriesByEdited(new_first);
+ return this;
+ }
+
+ public Feed sortEntriesByUpdated(boolean new_first) {
+ getChannel().sortEntriesByUpdated(new_first);
+ return this;
+ }
+
+ public <T extends Source>T addAuthor(Person person) {
+ getChannel().addAuthor(person);
+ return (T)this;
+ }
+
+ public Person addAuthor(String name) {
+ return getChannel().addAuthor(name);
+ }
+
+ public Person addAuthor(String name, String email, String iri) {
+ return getChannel().addAuthor(name,email,iri);
+ }
+
+ public <T extends Source>T addCategory(Category category) {
+ getChannel().addCategory(category);
+ return (T)this;
+ }
+
+ public Category addCategory(String term) {
+ return getChannel().addCategory(term);
+ }
+
+ public Category addCategory(String scheme, String term, String label) {
+ return getChannel().addCategory(scheme, term, label);
+ }
+
+ public <T extends Source>T addContributor(Person person) {
+ throw new UnsupportedOperationException("Contributor's are not supported");
+ }
+
+ public Person addContributor(String name) {
+ throw new UnsupportedOperationException("Contributor's are not supported");
+ }
+
+ public Person addContributor(String name, String email, String iri) {
+ throw new UnsupportedOperationException("Contributor's are not supported");
+ }
+
+ public <T extends Source>T addLink(Link link) {
+ getChannel().addLink(link);
+ return (T)this;
+ }
+
+ public Link addLink(String href) {
+ return getChannel().addLink(href);
+ }
+
+ public Link addLink(String href, String rel) {
+ return getChannel().addLink(href, rel);
+ }
+
+ public Link addLink(String href, String rel, String type, String title,
+ String hreflang, long length) {
+ return getChannel().addLink(href, rel, type, title, hreflang, length);
+ }
+
+ public Link getAlternateLink() {
+ return getChannel().getAlternateLink();
+ }
+
+ public Link getAlternateLink(String type, String hreflang){
+ return getChannel().getAlternateLink(type, hreflang);
+ }
+
+ public IRI getAlternateLinkResolvedHref() {
+ return getChannel().getAlternateLinkResolvedHref();
+ }
+
+ public IRI getAlternateLinkResolvedHref(String type, String hreflang){
+ return getChannel().getAlternateLinkResolvedHref(type, hreflang);
+ }
+
+ public Person getAuthor() {
+ return getChannel().getAuthor();
+ }
+
+ public List<Person> getAuthors() {
+ return getChannel().getAuthors();
+ }
+
+ public List<Category> getCategories() {
+ return getChannel().getCategories();
+ }
+
+ public List<Category> getCategories(String scheme) {
+ return getChannel().getCategories(scheme);
+ }
+
+ public Collection getCollection() {
+ //TODO: should I support this?
+ return null;
+ }
+
+ public List<Person> getContributors() {
+ return getChannel().getContributors();
+ }
+
+ public Generator getGenerator() {
+ return getChannel().getGenerator();
+ }
+
+ public IRI getIcon() {
+ return getChannel().getIcon();
+ }
+
+ public IRIElement getIconElement() {
+ return getChannel().getIconElement();
+ }
+
+ public IRI getId() {
+ return getChannel().getId();
+ }
+
+ public IRIElement getIdElement() {
+ return getChannel().getIdElement();
+ }
+
+ public Link getLink(String rel) {
+ return getChannel().getLink(rel);
+ }
+
+ public IRI getLinkResolvedHref(String rel) {
+ return getChannel().getLinkResolvedHref(rel);
+ }
+
+ public List<Link> getLinks() {
+ return getChannel().getLinks();
+ }
+
+ public List<Link> getLinks(String rel) {
+ return getChannel().getLinks(rel);
+ }
+
+ public List<Link> getLinks(String... rel) {
+ return getChannel().getLinks(rel);
+ }
+
+ public IRI getLogo() {
+ return getChannel().getLogo();
+ }
+
+ public IRIElement getLogoElement() {
+ return getChannel().getLogoElement();
+ }
+
+ public String getRights() {
+ return getChannel().getRights();
+ }
+
+ public Text getRightsElement() {
+ return getChannel().getRightsElement();
+ }
+
+ public Type getRightsType() {
+ return getChannel().getRightsType();
+ }
+
+ public Link getSelfLink() {
+ return getChannel().getSelfLink();
+ }
+
+ public IRI getSelfLinkResolvedHref() {
+ return getChannel().getSelfLinkResolvedHref();
+ }
+
+ public String getSubtitle() {
+ return getChannel().getSubtitle();
+ }
+
+ public Text getSubtitleElement() {
+ return getChannel().getSubtitleElement();
+ }
+
+ public Type getSubtitleType() {
+ return getChannel().getSubtitleType();
+ }
+
+ public String getTitle() {
+ return getChannel().getTitle();
+ }
+
+ public Text getTitleElement() {
+ return getChannel().getTitleElement();
+ }
+
+ public Type getTitleType() {
+ return getChannel().getTitleType();
+ }
+
+ public Date getUpdated() {
+ return getChannel().getUpdated();
+ }
+
+ public DateTime getUpdatedElement() {
+ return getChannel().getUpdatedElement();
+ }
+
+ public String getUpdatedString() {
+ return getChannel().getUpdatedString();
+ }
+
+ public Date getPublished() {
+ return getChannel().getPublished();
+ }
+
+ public DateTime getPublisheddElement() {
+ return getChannel().getPublishedElement();
+ }
+
+ public String getPublishedString() {
+ return getChannel().getPublishedString();
+ }
+
+ public IRIElement newId() {
+ return getChannel().newId();
+ }
+
+ public <T extends Source>T setCollection(Collection collection) {
+ throw new UnsupportedOperationException("Collection is not supported");
+ }
+
+ public <T extends Source>T setGenerator(Generator generator) {
+ getChannel().setGenerator(generator);
+ return (T)this;
+ }
+
+ public Generator setGenerator(String iri, String version, String value) {
+ return getChannel().setGenerator(iri,version,value);
+ }
+
+ public IRIElement setIcon(String iri) {
+ return getChannel().setIcon(iri);
+ }
+
+ public <T extends Source>T setIconElement(IRIElement iri) {
+ getChannel().setIconElement(iri);
+ return (T)this;
+ }
+
+ public IRIElement setId(String id) {
+ return getChannel().setId(id);
+ }
+
+ public IRIElement setId(String id, boolean normalize) {
+ return getChannel().setId(id,normalize);
+ }
+
+ public <T extends Source>T setIdElement(IRIElement id) {
+ getChannel().setIdElement(id);
+ return (T)this;
+ }
+
+ public IRIElement setLogo(String iri) {
+ return getChannel().setLogo(iri);
+ }
+
+ public <T extends Source>T setLogoElement(IRIElement iri) {
+ getChannel().setLogoElement(iri);
+ return (T)this;
+ }
+
+ public Text setRights(String value) {
+ return getChannel().setRights(value);
+ }
+
+ public Text setRights(String value, Type type) {
+ return getChannel().setRights(value, type);
+ }
+
+ public Text setRights(Div value) {
+ return getChannel().setRights(value);
+ }
+
+ public Text setRightsAsHtml(String value) {
+ return getChannel().setRightsAsHtml(value);
+ }
+
+ public Text setRightsAsXhtml(String value) {
+ return getChannel().setRightsAsXhtml(value);
+ }
+
+ public <T extends Source>T setRightsElement(Text text) {
+ getChannel().setRightsElement(text);
+ return (T)this;
+ }
+
+ public Text setSubtitle(String value) {
+ return getChannel().setSubtitle(value);
+ }
+
+ public Text setSubtitle(String value, Type type) {
+ return getChannel().setSubtitle(value,type);
+ }
+
+ public Text setSubtitle(Div value) {
+ return getChannel().setSubtitle(value);
+ }
+
+ public Text setSubtitleAsHtml(String value) {
+ return getChannel().setSubtitleAsHtml(value);
+ }
+
+ public Text setSubtitleAsXhtml(String value) {
+ return getChannel().setSubtitleAsXhtml(value);
+ }
+
+ public <T extends Source>T setSubtitleElement(Text text) {
+ getChannel().setSubtitleElement(text);
+ return (T)this;
+ }
+
+ public Text setTitle(String value) {
+ return getChannel().setTitle(value);
+ }
+
+ public Text setTitle(String value, Type type) {
+ return getChannel().setTitle(value,type);
+ }
+
+ public Text setTitle(Div value) {
+ return getChannel().setTitle(value);
+ }
+
+ public Text setTitleAsHtml(String value) {
+ return getChannel().setTitleAsHtml(value);
+ }
+
+ public Text setTitleAsXhtml(String value) {
+ return getChannel().setTitleAsXhtml(value);
+ }
+
+ public <T extends Source>T setTitleElement(Text text) {
+ getChannel().setTitleElement(text);
+ return (T)this;
+ }
+
+ public DateTime setUpdated(Date value) {
+ return getChannel().setUpdated(value);
+ }
+
+ public DateTime setUpdated(String value) {
+ return getChannel().setUpdated(value);
+ }
+
+ public <T extends Source>T setUpdatedElement(DateTime dateTime) {
+ getChannel().setUpdatedElement(dateTime);
+ return (T)this;
+ }
+
+ public <T extends ExtensibleElement>T addExtension(Element extension) {
+ getChannel().addExtension(extension);
+ return (T)this;
+ }
+
+ public <T extends Element> T addExtension(QName qname) {
+ return getChannel().addExtension(qname);
+ }
+
+ public <T extends Element> T addExtension(String namespace, String localPart,
+ String prefix) {
+ return getChannel().addExtension(namespace, localPart, prefix);
+ }
+
+ public Element addSimpleExtension(QName qname, String value) {
+ return getChannel().addSimpleExtension(qname, value);
+ }
+
+ public Element addSimpleExtension(String namespace, String localPart,
+ String prefix, String value) {
+ return getChannel().addSimpleExtension(namespace, localPart, prefix, value);
+ }
+
+ public <T extends Element> T getExtension(QName qname) {
+ return getChannel().getExtension(qname);
+ }
+
+ public <T extends Element> T getExtension(Class<T> _class) {
+ return getChannel().getExtension(_class);
+ }
+
+ public List<Element> getExtensions() {
+ return getChannel().getExtensions();
+ }
+
+ public List<Element> getExtensions(String uri) {
+ return getChannel().getExtensions(uri);
+ }
+
+ public <T extends Element> List<T> getExtensions(QName qname) {
+ return getChannel().getExtensions(qname);
+ }
+
+ public String getSimpleExtension(QName qname) {
+ return getChannel().getSimpleExtension(qname);
+ }
+
+ public String getSimpleExtension(String namespace, String localPart,
+ String prefix) {
+ return getChannel().getSimpleExtension(namespace, localPart, prefix);
+ }
+
+ public String getAttributeValue(String name) {
+ return getChannel().getAttributeValue(name);
+ }
+
+ public String getAttributeValue(QName qname) {
+ return getChannel().getAttributeValue(qname);
+ }
+
+ public List<QName> getAttributes() {
+ return getChannel().getAttributes();
+ }
+
+ public List<QName> getExtensionAttributes() {
+ return getChannel().getExtensionAttributes();
+ }
+
+ public String getLanguage() {
+ return getChannel().getLanguage();
+ }
+
+ public <T extends Element>T removeAttribute(QName qname) {
+ getChannel().removeAttribute(qname);
+ return (T)this;
+ }
+
+ public <T extends Element>T setAttributeValue(String name, String value) {
+ getChannel().setAttributeValue(name, value);
+ return (T)this;
+ }
+
+ public <T extends Element>T setAttributeValue(QName qname, String value) {
+ getChannel().setAttributeValue(qname, value);
+ return (T)this;
+ }
+
+ public <T extends Element>T setBaseUri(IRI base) {
+ //throw new UnsupportedOperationException("Setting the base uri with xml:base is not supported");
+ return (T)this;
+ }
+
+ public <T extends Element>T setBaseUri(String base) {
+ //throw new UnsupportedOperationException("Setting the base uri with xml:base is not supported");
+ return (T)this;
+ }
+
+ public <T extends Element>T setLanguage(String language) {
+ getChannel().setLanguage(language);
+ return (T)this;
+ }
+
+ public String getVersion() {
+ return super.getAttributeValue("version");
+ }
+
+ 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/RssGenerator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssGenerator.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssGenerator.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssGenerator.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,60 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.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.Generator;
+
+public class RssGenerator
+ extends ElementWrapper
+ implements Generator {
+
+ public RssGenerator(Element internal) {
+ super(internal);
+ }
+
+ public RssGenerator(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+
+ public IRI getResolvedUri() {
+ return null;
+ }
+
+ public IRI getUri() {
+ return null;
+ }
+
+ public String getVersion() {
+ return null;
+ }
+
+ public Generator setUri(String uri) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Generator setVersion(String version) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+}
Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssGuid.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssGuid.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssGuid.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssGuid.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,169 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.rss;
+
+import java.util.List;
+
+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.ExtensibleElement;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+import org.apache.abdera.model.IRIElement;
+import org.apache.abdera.model.Link;
+
+public class RssGuid
+ extends ExtensibleElementWrapper
+ implements IRIElement, Link {
+
+ public RssGuid(Element internal) {
+ super(internal);
+ }
+
+ public RssGuid(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+
+ public IRI getResolvedValue() {
+ return getValue();
+ }
+
+ public IRI getValue() {
+ String t = getText();
+ return (t != null) ? new IRI(t) : null;
+ }
+
+ public IRIElement setNormalizedValue(String iri) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public IRIElement setValue(String iri) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public boolean isPermalink() {
+ String v = getAttributeValue("isPermaLink");
+ if (v == null) getAttributeValue("ispermalink");
+ return (v.equalsIgnoreCase("true") || v.equalsIgnoreCase("yes"));
+ }
+
+
+ public IRI getHref() {
+ return getValue();
+ }
+
+ public String getHrefLang() {
+ return null;
+ }
+
+ public long getLength() {
+ return -1;
+ }
+
+ public MimeType getMimeType() {
+ return null;
+ }
+
+ public String getRel() {
+ return Link.REL_ALTERNATE;
+ }
+
+ public IRI getResolvedHref() {
+ return getValue();
+ }
+
+ 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");
+ }
+
+ public <T extends ExtensibleElement>T addExtension(Element extension) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public <T extends Element> T addExtension(QName qname) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public <T extends Element> T addExtension(String namespace, String localPart, String prefix) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Element addSimpleExtension(QName qname, String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public Element addSimpleExtension(String namespace, String localPart, String prefix, String value) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public <T extends Element> T getExtension(QName qname) {
+ return null;
+ }
+
+ public <T extends Element> T getExtension(Class<T> _class) {
+ return null;
+ }
+
+ public List<Element> getExtensions() {
+ return null;
+ }
+
+ public List<Element> getExtensions(String uri) {
+ return null;
+ }
+
+ public <T extends Element> List<T> getExtensions(QName qname) {
+ return null;
+ }
+
+ public String getSimpleExtension(QName qname) {
+ return null;
+ }
+
+ public String getSimpleExtension(String namespace, String localPart, String prefix) {
+ return null;
+ }
+
+}
Added: incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssImage.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssImage.java?rev=718797&view=auto
==============================================================================
--- incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssImage.java (added)
+++ incubator/abdera/java/trunk/extensions/rss/src/main/java/org/apache/abdera/ext/rss/RssImage.java Tue Nov 18 15:38:36 2008
@@ -0,0 +1,93 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.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.Link;
+import org.apache.abdera.model.Text;
+
+public class RssImage
+ extends ExtensibleElementWrapper
+ implements IRIElement {
+
+ public RssImage(Element internal) {
+ super(internal);
+ }
+
+ public RssImage(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+
+ public IRI getResolvedValue() {
+ return getValue();
+ }
+
+ public IRI getValue() {
+ IRIElement iri = getExtension(RssConstants.QNAME_URL);
+ if (iri == null) {
+ iri = getExtension(RssConstants.QNAME_RDF_URL);
+ }
+ if (iri == null) {
+ String t = getAttributeValue(RssConstants.QNAME_RDF_ABOUT);
+ if (t != null) return new IRI(t);
+ }
+ return (iri != null) ? iri.getValue() : null;
+ }
+
+ public IRIElement setNormalizedValue(String iri) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public IRIElement setValue(String iri) {
+ throw new UnsupportedOperationException("Modifications are not allowed");
+ }
+
+ public String getTitle() {
+ Text text = getExtension(RssConstants.QNAME_TITLE);
+ if (text == null) text = getExtension(RssConstants.QNAME_RDF_TITLE);
+ return (text != null) ? text.getValue() : null;
+ }
+
+ public String getDescription() {
+ Text text = getExtension(RssConstants.QNAME_DESCRIPTION);
+ if (text == null) text = getExtension(RssConstants.QNAME_RDF_DESCRIPTION);
+ return (text != null) ? text.getValue() : null;
+ }
+
+ public IRI getLink() {
+ Link link = getExtension(RssConstants.QNAME_LINK);
+ if (link == null) link = getExtension(RssConstants.QNAME_RDF_LINK);
+ return (link != null) ? link.getHref() : null;
+ }
+
+ public int getWidth() {
+ String w = getSimpleExtension(RssConstants.QNAME_WIDTH);
+ return (w != null) ? Integer.parseInt(w) : -1;
+ }
+
+ public int getHeight() {
+ String w = getSimpleExtension(RssConstants.QNAME_HEIGHT);
+ return (w != null) ? Integer.parseInt(w) : -1;
+ }
+}