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 2011/09/20 17:57:20 UTC
svn commit: r1173209 [18/49] - in /abdera/abdera2: ./ .settings/ activities/
activities/src/ activities/src/main/ activities/src/main/java/
activities/src/main/java/org/ activities/src/main/java/org/apache/
activities/src/main/java/org/apache/abdera2/ ...
Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/StreamBuilder.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/StreamBuilder.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/StreamBuilder.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/StreamBuilder.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,818 @@
+/*
+ * 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.abdera2.factory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.nio.channels.WritableByteChannel;
+import java.util.Date;
+import java.util.Locale;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.Abdera;
+import org.apache.abdera2.common.anno.Name;
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.lang.Lang;
+import org.apache.abdera2.model.Base;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Element;
+import org.apache.abdera2.model.Content.Type;
+import org.apache.abdera2.writer.AbstractStreamWriter;
+
+/**
+ * StreamBuilder is a special implementation of the StreamWriter interface that can be used to create Feed Object Model
+ * instances using the StreamWriter interface. StreamBuilder provides an additional method (getBase) for returning the
+ * FOM Base element that was built. The StreamWriter methods indent(), flush(), close(), setWriter(), setInputStream,
+ * setAutoclose(), setAutoflush(), setAutoIndent(), and setChannel() have no effect on this StreamWriter implementation
+ *
+ * <pre>
+ * StreamBuilder sw = new StreamBuilder();
+ * Entry entry =
+ * sw.startElement(Constants.ENTRY).writeBase("http://example.org").writeLanguage("en-US")
+ * .writeId("http://example.org").writeTitle("testing").writeUpdated(new Date()).endElement().getBase();
+ * entry.writeTo(System.out);
+ * </pre>
+ */
+@SuppressWarnings("unchecked")
+@Name("streambuilder")
+public class StreamBuilder extends AbstractStreamWriter {
+
+ private final Abdera abdera;
+ private Base root = null;
+ private Base current = null;
+
+ public StreamBuilder() {
+ this(Abdera.getInstance());
+ }
+
+ public StreamBuilder(Abdera abdera) {
+ super(abdera, "fom");
+ this.abdera = abdera;
+ }
+
+ public <T extends Base> T getBase() {
+ return (T)root;
+ }
+
+ public StreamBuilder startDocument(String xmlversion, String charset) {
+ if (root != null)
+ throw new IllegalStateException("Document already started");
+ root = abdera.getFactory().newDocument();
+ ((Document<?>)root).setCharset(charset);
+ current = root;
+ return this;
+ }
+
+ public StreamBuilder startDocument(String xmlversion) {
+ return startDocument(xmlversion, "UTF-8");
+ }
+
+ private static QName getQName(String name, String namespace, String prefix) {
+ if (prefix != null)
+ return new QName(namespace, name, prefix);
+ else if (namespace != null)
+ return new QName(namespace, name);
+ else
+ return new QName(name);
+ }
+
+ public StreamBuilder startElement(String name, String namespace, String prefix) {
+ current = abdera.getFactory().newElement(getQName(name, namespace, prefix), current);
+ if (root == null)
+ root = current;
+ return this;
+ }
+
+ public StreamBuilder endElement() {
+ current = current instanceof Element ? ((Element)current).getParentElement() : null;
+ return this;
+ }
+
+ public StreamBuilder writeAttribute(String name, String namespace, String prefix, String value) {
+ if (!(current instanceof Element))
+ throw new IllegalStateException("Not currently an element");
+ ((Element)current).setAttributeValue(getQName(name, namespace, prefix), value);
+ return this;
+ }
+
+ public StreamBuilder writeComment(String value) {
+ current.addComment(value);
+ return this;
+ }
+
+ public StreamBuilder writeElementText(String value) {
+ if (!(current instanceof Element))
+ throw new IllegalStateException("Not currently an element");
+ Element element = (Element)current;
+ String text = element.getText();
+ element.setText(text + value);
+ return this;
+ }
+
+ public StreamBuilder writeId() {
+ return writeId(abdera.getFactory().newUuidUri());
+ }
+
+ public StreamBuilder writePI(String value) {
+ return writePI(value, null);
+ }
+
+ public StreamBuilder writePI(String value, String target) {
+ if (!(current instanceof Document))
+ throw new IllegalStateException("Not currently a document");
+ ((Document<?>)current).addProcessingInstruction(target != null ? target : "", value);
+ return this;
+ }
+
+ public void close() throws IOException {
+ }
+
+ public StreamBuilder flush() {
+ // non-op
+ return this;
+ }
+
+ public StreamBuilder indent() {
+ // non-op
+ return this;
+ }
+
+ public StreamBuilder setOutputStream(OutputStream out) {
+ // non-op
+ return this;
+ }
+
+ public StreamBuilder setOutputStream(OutputStream out, String charset) {
+ // non-op
+ return this;
+ }
+
+ public StreamBuilder setWriter(Writer writer) {
+ // non-op
+ return this;
+ }
+
+ public StreamBuilder endAuthor() {
+ return (StreamBuilder)super.endAuthor();
+ }
+
+ public StreamBuilder endCategories() {
+ return (StreamBuilder)super.endCategories();
+ }
+
+ public StreamBuilder endCategory() {
+ return (StreamBuilder)super.endCategory();
+ }
+
+ public StreamBuilder endCollection() {
+ return (StreamBuilder)super.endCollection();
+ }
+
+ public StreamBuilder endContent() {
+ return (StreamBuilder)super.endContent();
+ }
+
+ public StreamBuilder endContributor() {
+ return (StreamBuilder)super.endContributor();
+ }
+
+ public StreamBuilder endControl() {
+ return (StreamBuilder)super.endControl();
+ }
+
+ public StreamBuilder endDocument() {
+ return (StreamBuilder)super.endDocument();
+ }
+
+ public StreamBuilder endEntry() {
+ return (StreamBuilder)super.endEntry();
+ }
+
+ public StreamBuilder endFeed() {
+ return (StreamBuilder)super.endFeed();
+ }
+
+ public StreamBuilder endGenerator() {
+ return (StreamBuilder)super.endGenerator();
+ }
+
+ public StreamBuilder endLink() {
+ return (StreamBuilder)super.endLink();
+ }
+
+ public StreamBuilder endPerson() {
+ return (StreamBuilder)super.endPerson();
+ }
+
+ public StreamBuilder endService() {
+ return (StreamBuilder)super.endService();
+ }
+
+ public StreamBuilder endSource() {
+ return (StreamBuilder)super.endSource();
+ }
+
+ public StreamBuilder endText() {
+ return (StreamBuilder)super.endText();
+ }
+
+ public StreamBuilder endWorkspace() {
+ return (StreamBuilder)super.endWorkspace();
+ }
+
+ public StreamBuilder setAutoclose(boolean auto) {
+ return (StreamBuilder)super.setAutoclose(auto);
+ }
+
+ public StreamBuilder setAutoflush(boolean auto) {
+ return (StreamBuilder)super.setAutoflush(auto);
+ }
+
+ public StreamBuilder setAutoIndent(boolean indent) {
+ return (StreamBuilder)super.setAutoIndent(indent);
+ }
+
+ public StreamBuilder setChannel(WritableByteChannel channel, String charset) {
+ return (StreamBuilder)super.setChannel(channel, charset);
+ }
+
+ public StreamBuilder setChannel(WritableByteChannel channel) {
+ return (StreamBuilder)super.setChannel(channel);
+ }
+
+ public StreamBuilder startAuthor() {
+ return (StreamBuilder)super.startAuthor();
+ }
+
+ public StreamBuilder startCategories() {
+ return (StreamBuilder)super.startCategories();
+ }
+
+ public StreamBuilder startCategories(boolean fixed, String scheme) {
+ return (StreamBuilder)super.startCategories(fixed, scheme);
+ }
+
+ public StreamBuilder startCategories(boolean fixed) {
+ return (StreamBuilder)super.startCategories(fixed);
+ }
+
+ public StreamBuilder startCategory(String term, String scheme, String label) {
+ return (StreamBuilder)super.startCategory(term, scheme, label);
+ }
+
+ public StreamBuilder startCategory(String term, String scheme) {
+ return (StreamBuilder)super.startCategory(term, scheme);
+ }
+
+ public StreamBuilder startCategory(String term) {
+ return (StreamBuilder)super.startCategory(term);
+ }
+
+ public StreamBuilder startCollection(String href) {
+ return (StreamBuilder)super.startCollection(href);
+ }
+
+ public StreamBuilder startContent(String type, String src) {
+ return (StreamBuilder)super.startContent(type, src);
+ }
+
+ public StreamBuilder startContent(String type) {
+ return (StreamBuilder)super.startContent(type);
+ }
+
+ public StreamBuilder startContent(Type type, String src) {
+ return (StreamBuilder)super.startContent(type, src);
+ }
+
+ public StreamBuilder startContent(Type type) {
+ return (StreamBuilder)super.startContent(type);
+ }
+
+ public StreamBuilder startContributor() {
+ return (StreamBuilder)super.startContributor();
+ }
+
+ public StreamBuilder startControl() {
+ return (StreamBuilder)super.startControl();
+ }
+
+ public StreamBuilder startDocument() {
+ return (StreamBuilder)super.startDocument();
+ }
+
+ public StreamBuilder startElement(QName qname) {
+ return (StreamBuilder)super.startElement(qname);
+ }
+
+ public StreamBuilder startElement(String name, String namespace) {
+ return (StreamBuilder)super.startElement(name, namespace);
+ }
+
+ public StreamBuilder startElement(String name) {
+ return (StreamBuilder)super.startElement(name);
+ }
+
+ public StreamBuilder startEntry() {
+ return (StreamBuilder)super.startEntry();
+ }
+
+ public StreamBuilder startFeed() {
+ return (StreamBuilder)super.startFeed();
+ }
+
+ public StreamBuilder startGenerator(String version, String uri) {
+ return (StreamBuilder)super.startGenerator(version, uri);
+ }
+
+ public StreamBuilder startLink(String iri, String rel, String type, String title, String hreflang, long length) {
+ return (StreamBuilder)super.startLink(iri, rel, type, title, hreflang, length);
+ }
+
+ public StreamBuilder startLink(String iri, String rel, String type) {
+ return (StreamBuilder)super.startLink(iri, rel, type);
+ }
+
+ public StreamBuilder startLink(String iri, String rel) {
+ return (StreamBuilder)super.startLink(iri, rel);
+ }
+
+ public StreamBuilder startLink(String iri) {
+ return (StreamBuilder)super.startLink(iri);
+ }
+
+ public StreamBuilder startPerson(QName qname) {
+ return (StreamBuilder)super.startPerson(qname);
+ }
+
+ public StreamBuilder startPerson(String name, String namespace, String prefix) {
+ return (StreamBuilder)super.startPerson(name, namespace, prefix);
+ }
+
+ public StreamBuilder startPerson(String name, String namespace) {
+ return (StreamBuilder)super.startPerson(name, namespace);
+ }
+
+ public StreamBuilder startPerson(String name) {
+ return (StreamBuilder)super.startPerson(name);
+ }
+
+ public StreamBuilder startService() {
+ return (StreamBuilder)super.startService();
+ }
+
+ public StreamBuilder startSource() {
+ return (StreamBuilder)super.startSource();
+ }
+
+ public StreamBuilder startText(QName qname, org.apache.abdera2.model.Text.Type type) {
+ return (StreamBuilder)super.startText(qname, type);
+ }
+
+ public StreamBuilder startText(String name, String namespace, String prefix, org.apache.abdera2.model.Text.Type type) {
+ return (StreamBuilder)super.startText(name, namespace, prefix, type);
+ }
+
+ public StreamBuilder startText(String name, String namespace, org.apache.abdera2.model.Text.Type type) {
+ return (StreamBuilder)super.startText(name, namespace, type);
+ }
+
+ public StreamBuilder startText(String name, org.apache.abdera2.model.Text.Type type) {
+ return (StreamBuilder)super.startText(name, type);
+ }
+
+ public StreamBuilder startWorkspace() {
+ return (StreamBuilder)super.startWorkspace();
+ }
+
+ public StreamBuilder writeAccepts(String... accepts) {
+ return (StreamBuilder)super.writeAccepts(accepts);
+ }
+
+ public StreamBuilder writeAcceptsEntry() {
+ return (StreamBuilder)super.writeAcceptsEntry();
+ }
+
+ public StreamBuilder writeAcceptsNothing() {
+ return (StreamBuilder)super.writeAcceptsNothing();
+ }
+
+ public StreamBuilder writeAttribute(QName qname, Date value) {
+ return (StreamBuilder)super.writeAttribute(qname, value);
+ }
+
+ public StreamBuilder writeAttribute(QName qname, double value) {
+ return (StreamBuilder)super.writeAttribute(qname, value);
+ }
+
+ public StreamBuilder writeAttribute(QName qname, int value) {
+ return (StreamBuilder)super.writeAttribute(qname, value);
+ }
+
+ public StreamBuilder writeAttribute(QName qname, long value) {
+ return (StreamBuilder)super.writeAttribute(qname, value);
+ }
+
+ public StreamBuilder writeAttribute(QName qname, String value) {
+ return (StreamBuilder)super.writeAttribute(qname, value);
+ }
+
+ public StreamBuilder writeAttribute(String name, Date value) {
+ return (StreamBuilder)super.writeAttribute(name, value);
+ }
+
+ public StreamBuilder writeAttribute(String name, double value) {
+ return (StreamBuilder)super.writeAttribute(name, value);
+ }
+
+ public StreamBuilder writeAttribute(String name, int value) {
+ return (StreamBuilder)super.writeAttribute(name, value);
+ }
+
+ public StreamBuilder writeAttribute(String name, long value) {
+ return (StreamBuilder)super.writeAttribute(name, value);
+ }
+
+ public StreamBuilder writeAttribute(String name, String namespace, Date value) {
+ return (StreamBuilder)super.writeAttribute(name, namespace, value);
+ }
+
+ public StreamBuilder writeAttribute(String name, String namespace, double value) {
+ return (StreamBuilder)super.writeAttribute(name, namespace, value);
+ }
+
+ public StreamBuilder writeAttribute(String name, String namespace, int value) {
+ return (StreamBuilder)super.writeAttribute(name, namespace, value);
+ }
+
+ public StreamBuilder writeAttribute(String name, String namespace, long value) {
+ return (StreamBuilder)super.writeAttribute(name, namespace, value);
+ }
+
+ public StreamBuilder writeAttribute(String name, String namespace, String prefix, Date value) {
+ return (StreamBuilder)super.writeAttribute(name, namespace, prefix, value);
+ }
+
+ public StreamBuilder writeAttribute(String name, String namespace, String prefix, double value) {
+ return (StreamBuilder)super.writeAttribute(name, namespace, prefix, value);
+ }
+
+ public StreamBuilder writeAttribute(String name, String namespace, String prefix, int value) {
+ return (StreamBuilder)super.writeAttribute(name, namespace, prefix, value);
+ }
+
+ public StreamBuilder writeAttribute(String name, String namespace, String prefix, long value) {
+ return (StreamBuilder)super.writeAttribute(name, namespace, prefix, value);
+ }
+
+ public StreamBuilder writeAttribute(String name, String namespace, String value) {
+ return (StreamBuilder)super.writeAttribute(name, namespace, value);
+ }
+
+ public StreamBuilder writeAttribute(String name, String value) {
+ return (StreamBuilder)super.writeAttribute(name, value);
+ }
+
+ public StreamBuilder writeAuthor(String name, String email, String uri) {
+ return (StreamBuilder)super.writeAuthor(name, email, uri);
+ }
+
+ public StreamBuilder writeAuthor(String name) {
+ return (StreamBuilder)super.writeAuthor(name);
+ }
+
+ public StreamBuilder writeBase(IRI iri) {
+ return (StreamBuilder)super.writeBase(iri);
+ }
+
+ public StreamBuilder writeBase(String iri) {
+ return (StreamBuilder)super.writeBase(iri);
+ }
+
+ public StreamBuilder writeCategory(String term, String scheme, String label) {
+ return (StreamBuilder)super.writeCategory(term, scheme, label);
+ }
+
+ public StreamBuilder writeCategory(String term, String scheme) {
+ return (StreamBuilder)super.writeCategory(term, scheme);
+ }
+
+ public StreamBuilder writeCategory(String term) {
+ return (StreamBuilder)super.writeCategory(term);
+ }
+
+ public StreamBuilder writeContent(String type, String value) {
+ return (StreamBuilder)super.writeContent(type, value);
+ }
+
+ public StreamBuilder writeContent(Type type, DataHandler value) throws IOException {
+ return (StreamBuilder)super.writeContent(type, value);
+ }
+
+ public StreamBuilder writeContent(Type type, InputStream value) throws IOException {
+ return (StreamBuilder)super.writeContent(type, value);
+ }
+
+ public StreamBuilder writeContent(Type type, String value) {
+ return (StreamBuilder)super.writeContent(type, value);
+ }
+
+ public StreamBuilder writeContributor(String name, String email, String uri) {
+ return (StreamBuilder)super.writeContributor(name, email, uri);
+ }
+
+ public StreamBuilder writeContributor(String name) {
+ return (StreamBuilder)super.writeContributor(name);
+ }
+
+ public StreamBuilder writeDate(QName qname, Date date) {
+ return (StreamBuilder)super.writeDate(qname, date);
+ }
+
+ public StreamBuilder writeDate(QName qname, String date) {
+ return (StreamBuilder)super.writeDate(qname, date);
+ }
+
+ public StreamBuilder writeDate(String name, Date date) {
+ return (StreamBuilder)super.writeDate(name, date);
+ }
+
+ public StreamBuilder writeDate(String name, String namespace, Date date) {
+ return (StreamBuilder)super.writeDate(name, namespace, date);
+ }
+
+ public StreamBuilder writeDate(String name, String namespace, String prefix, Date date) {
+ return (StreamBuilder)super.writeDate(name, namespace, prefix, date);
+ }
+
+ public StreamBuilder writeDate(String name, String namespace, String prefix, String date) {
+ return (StreamBuilder)super.writeDate(name, namespace, prefix, date);
+ }
+
+ public StreamBuilder writeDate(String name, String namespace, String date) {
+ return (StreamBuilder)super.writeDate(name, namespace, date);
+ }
+
+ public StreamBuilder writeDate(String name, String date) {
+ return (StreamBuilder)super.writeDate(name, date);
+ }
+
+ public StreamBuilder writeDraft(boolean draft) {
+ return (StreamBuilder)super.writeDraft(draft);
+ }
+
+ public StreamBuilder writeEdited(Date date) {
+ return (StreamBuilder)super.writeEdited(date);
+ }
+
+ public StreamBuilder writeEdited(String date) {
+ return (StreamBuilder)super.writeEdited(date);
+ }
+
+ public StreamBuilder writeElementText(DataHandler value) throws IOException {
+ return (StreamBuilder)super.writeElementText(value);
+ }
+
+ public StreamBuilder writeElementText(Date value) {
+ return (StreamBuilder)super.writeElementText(value);
+ }
+
+ public StreamBuilder writeElementText(double value) {
+ return (StreamBuilder)super.writeElementText(value);
+ }
+
+ public StreamBuilder writeElementText(InputStream value) throws IOException {
+ return (StreamBuilder)super.writeElementText(value);
+ }
+
+ public StreamBuilder writeElementText(int value) {
+ return (StreamBuilder)super.writeElementText(value);
+ }
+
+ public StreamBuilder writeElementText(long value) {
+ return (StreamBuilder)super.writeElementText(value);
+ }
+
+ public StreamBuilder writeElementText(String format, Object... args) {
+ return (StreamBuilder)super.writeElementText(format, args);
+ }
+
+ public StreamBuilder writeGenerator(String version, String uri, String value) {
+ return (StreamBuilder)super.writeGenerator(version, uri, value);
+ }
+
+ public StreamBuilder writeIcon(IRI iri) {
+ return (StreamBuilder)super.writeIcon(iri);
+ }
+
+ public StreamBuilder writeIcon(String iri) {
+ return (StreamBuilder)super.writeIcon(iri);
+ }
+
+ public StreamBuilder writeId(IRI iri) {
+ return (StreamBuilder)super.writeId(iri);
+ }
+
+ public StreamBuilder writeId(String iri) {
+ return (StreamBuilder)super.writeId(iri);
+ }
+
+ public StreamBuilder writeIRIElement(QName qname, IRI iri) {
+ return (StreamBuilder)super.writeIRIElement(qname, iri);
+ }
+
+ public StreamBuilder writeIRIElement(QName qname, String iri) {
+ return (StreamBuilder)super.writeIRIElement(qname, iri);
+ }
+
+ public StreamBuilder writeIRIElement(String name, IRI iri) {
+ return (StreamBuilder)super.writeIRIElement(name, iri);
+ }
+
+ public StreamBuilder writeIRIElement(String name, String namespace, IRI iri) {
+ return (StreamBuilder)super.writeIRIElement(name, namespace, iri);
+ }
+
+ public StreamBuilder writeIRIElement(String name, String namespace, String prefix, IRI iri) {
+ return (StreamBuilder)super.writeIRIElement(name, namespace, prefix, iri);
+ }
+
+ public StreamBuilder writeIRIElement(String name, String namespace, String prefix, String iri) {
+ return (StreamBuilder)super.writeIRIElement(name, namespace, prefix, iri);
+ }
+
+ public StreamBuilder writeIRIElement(String name, String namespace, String iri) {
+ return (StreamBuilder)super.writeIRIElement(name, namespace, iri);
+ }
+
+ public StreamBuilder writeIRIElement(String name, String iri) {
+ return (StreamBuilder)super.writeIRIElement(name, iri);
+ }
+
+ public StreamBuilder writeLanguage(Lang lang) {
+ return (StreamBuilder)super.writeLanguage(lang);
+ }
+
+ public StreamBuilder writeLanguage(Locale locale) {
+ return (StreamBuilder)super.writeLanguage(locale);
+ }
+
+ public StreamBuilder writeLanguage(String lang) {
+ return (StreamBuilder)super.writeLanguage(lang);
+ }
+
+ public StreamBuilder writeLink(String iri, String rel, String type, String title, String hreflang, long length) {
+ return (StreamBuilder)super.writeLink(iri, rel, type, title, hreflang, length);
+ }
+
+ public StreamBuilder writeLink(String iri, String rel, String type) {
+ return (StreamBuilder)super.writeLink(iri, rel, type);
+ }
+
+ public StreamBuilder writeLink(String iri, String rel) {
+ return (StreamBuilder)super.writeLink(iri, rel);
+ }
+
+ public StreamBuilder writeLink(String iri) {
+ return (StreamBuilder)super.writeLink(iri);
+ }
+
+ public StreamBuilder writeLogo(IRI iri) {
+ return (StreamBuilder)super.writeLogo(iri);
+ }
+
+ public StreamBuilder writeLogo(String iri) {
+ return (StreamBuilder)super.writeLogo(iri);
+ }
+
+ public StreamBuilder writePerson(QName qname, String name, String email, String uri) {
+ return (StreamBuilder)super.writePerson(qname, name, email, uri);
+ }
+
+ public StreamBuilder writePerson(String localname,
+ String namespace,
+ String prefix,
+ String name,
+ String email,
+ String uri) {
+ return (StreamBuilder)super.writePerson(localname, namespace, prefix, name, email, uri);
+ }
+
+ public StreamBuilder writePerson(String localname, String namespace, String name, String email, String uri) {
+ return (StreamBuilder)super.writePerson(localname, namespace, name, email, uri);
+ }
+
+ public StreamBuilder writePerson(String localname, String name, String email, String uri) {
+ return (StreamBuilder)super.writePerson(localname, name, email, uri);
+ }
+
+ public StreamBuilder writePersonEmail(String email) {
+ return (StreamBuilder)super.writePersonEmail(email);
+ }
+
+ public StreamBuilder writePersonName(String name) {
+ return (StreamBuilder)super.writePersonName(name);
+ }
+
+ public StreamBuilder writePersonUri(String uri) {
+ return (StreamBuilder)super.writePersonUri(uri);
+ }
+
+ public StreamBuilder writePublished(Date date) {
+ return (StreamBuilder)super.writePublished(date);
+ }
+
+ public StreamBuilder writePublished(String date) {
+ return (StreamBuilder)super.writePublished(date);
+ }
+
+ public StreamBuilder writeRights(String value) {
+ return (StreamBuilder)super.writeRights(value);
+ }
+
+ public StreamBuilder writeRights(org.apache.abdera2.model.Text.Type type, String value) {
+ return (StreamBuilder)super.writeRights(type, value);
+ }
+
+ public StreamBuilder writeSubtitle(String value) {
+ return (StreamBuilder)super.writeSubtitle(value);
+ }
+
+ public StreamBuilder writeSubtitle(org.apache.abdera2.model.Text.Type type, String value) {
+ return (StreamBuilder)super.writeSubtitle(type, value);
+ }
+
+ public StreamBuilder writeSummary(String value) {
+ return (StreamBuilder)super.writeSummary(value);
+ }
+
+ public StreamBuilder writeSummary(org.apache.abdera2.model.Text.Type type, String value) {
+ return (StreamBuilder)super.writeSummary(type, value);
+ }
+
+ public StreamBuilder writeText(QName qname, org.apache.abdera2.model.Text.Type type, String value) {
+ return (StreamBuilder)super.writeText(qname, type, value);
+ }
+
+ public StreamBuilder writeText(String name,
+ String namespace,
+ String prefix,
+ org.apache.abdera2.model.Text.Type type,
+ String value) {
+ return (StreamBuilder)super.writeText(name, namespace, prefix, type, value);
+ }
+
+ public StreamBuilder writeText(String name, String namespace, org.apache.abdera2.model.Text.Type type, String value) {
+ return (StreamBuilder)super.writeText(name, namespace, type, value);
+ }
+
+ public StreamBuilder writeText(String name, org.apache.abdera2.model.Text.Type type, String value) {
+ return (StreamBuilder)super.writeText(name, type, value);
+ }
+
+ public StreamBuilder writeTitle(String value) {
+ return (StreamBuilder)super.writeTitle(value);
+ }
+
+ public StreamBuilder writeTitle(org.apache.abdera2.model.Text.Type type, String value) {
+ return (StreamBuilder)super.writeTitle(type, value);
+ }
+
+ public StreamBuilder writeUpdated(Date date) {
+ return (StreamBuilder)super.writeUpdated(date);
+ }
+
+ public StreamBuilder writeUpdated(String date) {
+ return (StreamBuilder)super.writeUpdated(date);
+ }
+
+ public StreamBuilder setPrefix(String prefix, String uri) {
+ if (!(current instanceof Element))
+ throw new IllegalStateException("Not currently an element");
+ ((Element)current).declareNS(uri, prefix);
+ return this;
+ }
+
+ public StreamBuilder writeNamespace(String prefix, String uri) {
+ return setPrefix(prefix, uri);
+ }
+
+}
Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/StreamBuilder.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Attribute.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Attribute.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Attribute.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Attribute.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,55 @@
+/*
+ * 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.abdera2.model;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.factory.Factory;
+
+/**
+ * An attribute. Returned by the Abdera XPath implementation when querying for Attribute nodes.
+ */
+public interface Attribute {
+
+ /**
+ * Get the QName of the attribute
+ *
+ * @return The attribute QName
+ */
+ QName getQName();
+
+ /**
+ * Return the text value of the attribute
+ *
+ * @return The attribute value
+ */
+ String getText();
+
+ /**
+ * Set the text value of the attribute. The value will be automatically escaped for proper serialization to XML
+ *
+ * @param text The attribute value
+ */
+ Attribute setText(String text);
+
+ /**
+ * The Abdera Factory
+ */
+ Factory getFactory();
+
+}
Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Attribute.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Base.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Base.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Base.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Base.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,163 @@
+/*
+ * 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.abdera2.model;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+
+import org.apache.abdera2.factory.Factory;
+import org.apache.abdera2.writer.WriterOptions;
+
+/**
+ * The Base interface provides the basis for the Feed Object Model API and defines the operations common to both the
+ * Element and Document interfaces. Classes implementing Base MUST NOT be assumed to be thread safe. Developers wishing
+ * to allow multiple threads to perform concurrent modifications to a Base MUST provide their own synchronization.
+ */
+public interface Base extends Cloneable {
+
+ /**
+ * Get the default WriterOptions for this object
+ */
+ WriterOptions getDefaultWriterOptions();
+
+ /**
+ * Serializes the model component out to the specified stream
+ *
+ * @param out The target output stream
+ * @param options The WriterOptions to use
+ */
+ void writeTo(OutputStream out, WriterOptions options) throws IOException;
+
+ /**
+ * Serializes the model component out to the specified java.io.Writer
+ *
+ * @param out The target output writer
+ * @param options The WriterOptions to use
+ */
+ void writeTo(Writer out, WriterOptions options) throws IOException;
+
+ /**
+ * Serializes the model component out to the specified stream using the given Abdera writer
+ *
+ * @param writer The Abdera writer to use
+ * @param out The target output stream
+ */
+ void writeTo(org.apache.abdera2.writer.Writer writer, OutputStream out) throws IOException;
+
+ /**
+ * Serializes the model component out to the specified java.io.Writer using the given Abdera writer
+ *
+ * @param writer The Abdera writer to use
+ * @param out The target output writer
+ */
+ void writeTo(org.apache.abdera2.writer.Writer writer, Writer out) throws IOException;
+
+ /**
+ * Serializes the model component out to the specified stream using the given Abdera writer
+ *
+ * @param writer The Abdera writer to use
+ * @param out The target output stream
+ */
+ void writeTo(String writer, OutputStream out) throws IOException;
+
+ /**
+ * Serializes the model component out to the specified java.io.Writer using the given Abdera writer
+ *
+ * @param writer The Abdera writer to use
+ * @param out The target output writer
+ */
+ void writeTo(String writer, Writer out) throws IOException;
+
+ /**
+ * Serializes the model component out to the specified stream using the given abdera writer
+ *
+ * @param writer The Abdera writer to use
+ * @param out The target output stream
+ * @param options The WriterOptions to use
+ */
+ void writeTo(org.apache.abdera2.writer.Writer writer, OutputStream out, WriterOptions options) throws IOException;
+
+ /**
+ * Serializes the model component out to the specified java.io.Writer using the given abdera writer
+ *
+ * @param writer The Abdera writer to use
+ * @param out The target output writer
+ * @param options The WriterOptions to use
+ */
+ void writeTo(org.apache.abdera2.writer.Writer writer, Writer out, WriterOptions options) throws IOException;
+
+ /**
+ * Serializes the model component out to the specified stream using the given abdera writer
+ *
+ * @param writer The name of the Abdera writer to use
+ * @param out The target output stream
+ * @param options The WriterOptions to use
+ */
+ void writeTo(String writer, OutputStream out, WriterOptions options) throws IOException;
+
+ /**
+ * Serializes the model component out to the specified java.io.Writer using the given abdera writer
+ *
+ * @param writer The name of the Abdera writer to use
+ * @param out The target output writer
+ * @param options The WriterOptions to use
+ */
+ void writeTo(String writer, Writer out, WriterOptions options) throws IOException;
+
+ /**
+ * Serializes the model component out to the specified stream
+ *
+ * @param out The java.io.OutputStream to use when serializing the Base. The charset encoding specified for the
+ * document will be used
+ */
+ void writeTo(OutputStream out) throws IOException;
+
+ /**
+ * Serializes the model component out to the specified writer
+ *
+ * @param writer The java.io.Writer to use when serializing the Base
+ */
+ void writeTo(Writer writer) throws IOException;
+
+ /**
+ * Clone this Base
+ */
+ Object clone();
+
+ /**
+ * Get the Factory used to create this Base
+ *
+ * @return The Factory used to create this object
+ */
+ Factory getFactory();
+
+ /**
+ * Add an XML comment to this Base
+ *
+ * @param value The text value of the comment
+ */
+ <T extends Base> T addComment(String value);
+
+ /**
+ * Ensure that the underlying streams are fully parsed. Calling complete on an Element does not necessarily mean
+ * that the underlying stream is fully consumed, only that that particular element has been completely parsed.
+ */
+ <T extends Base> T complete();
+
+}
Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Base.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Categories.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Categories.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Categories.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Categories.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,171 @@
+/*
+ * 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.abdera2.model;
+
+import java.util.List;
+
+import org.apache.abdera2.common.anno.QName;
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.selector.Selector;
+
+import static org.apache.abdera2.common.Constants.*;
+
+/**
+ * The Atom Publishing Protocol introduces the notion of a "Category Document" and the app:categories element. These are
+ * used to provide a listing of atom:category elements that may be used with the members of an Atom Publishing Protocol
+ * collection.
+ */
+@QName(value=LN_CATEGORIES,ns=APP_NS)
+public interface Categories extends ExtensibleElement {
+
+ /**
+ * When contained within an app:collection element, the app:categories element can have an href attribute whose
+ * value MUST point to an Atompub Categories Document.
+ *
+ * @return The href attribute value
+ */
+ IRI getHref();
+
+ /**
+ * Returns the value of the href attribute resolved against the in-scope Base URI
+ *
+ * @return The fully resolved href attribute value
+ */
+ IRI getResolvedHref();
+
+ /**
+ * Sets the value of the href attribute.
+ *
+ * @param href The location of an Atompub Categories Document
+ */
+ Categories setHref(String href);
+
+ /**
+ * If an app:categories element is marked as fixed, then the set of atom:category elements is considered to be a
+ * closed set. That is, Atom Publishing Protocol clients SHOULD only use the atom:category elements listed. The
+ * default is false (fixed="no")
+ *
+ * @return True if the categories listing is fixed
+ */
+ boolean isFixed();
+
+ /**
+ * Sets whether or not this is a fixed listing of categories. If set to false, the fixed attribute will be removed
+ * from the app:categories element.
+ *
+ * @param fixed True if the app:categories listing is fixed
+ */
+ Categories setFixed(boolean fixed);
+
+ /**
+ * The app:categories element may specify a default scheme attribute for listed atom:category elements that do not
+ * have their own scheme attribute.
+ *
+ * @return The scheme IRI
+ */
+ IRI getScheme();
+
+ /**
+ * Sets the default scheme for this listing of categories
+ *
+ * @param scheme The default scheme used for this listing of categories
+ */
+ Categories setScheme(String scheme);
+
+ /**
+ * Lists the complete set of categories
+ *
+ * @return This app:categories listing of atom:category elements
+ */
+ List<Category> getCategories();
+
+ /**
+ * Lists the complete set of categories that use the specified scheme
+ *
+ * @param scheme The IRI of an atom:category scheme
+ * @return A listing of atom:category elements that use the specified scheme
+ */
+ List<Category> getCategories(String scheme);
+
+ /**
+ * Returns a copy of the complete set of categories with the scheme attribute set
+ *
+ * @return A listing of atom:category elements using the default scheme specified by the app:categories scheme
+ * attribute
+ */
+ List<Category> getCategoriesWithScheme();
+
+ /**
+ * Returns a copy of the complete set of categories with the scheme attribute set as specified in 7.2.1. (child
+ * categories that do not have a scheme attribute inherit the scheme attribute of the parent)
+ *
+ * @param scheme A scheme IRI
+ * @return A listing of atom:category elements
+ */
+ List<Category> getCategoriesWithScheme(String scheme);
+
+ List<Category> getCategories(Selector selector);
+
+ /**
+ * Add an atom:category to the listing
+ *
+ * @param category The atom:category to add to the listing
+ */
+ Categories addCategory(Category category);
+
+ /**
+ * Create and add an atom:category to the listing
+ *
+ * @param term The string term
+ * @return The newly created atom:category
+ */
+ Category addCategory(String term);
+
+ /**
+ * Create an add an atom:category to the listing
+ *
+ * @param scheme The scheme IRI for the newly created category
+ * @param term The string term
+ * @param label The human readable label for the category
+ * @return The newly created atom:category
+ */
+ Category addCategory(String scheme, String term, String label);
+
+ /**
+ * Returns true if this app:categories listing contains a category with the specified term
+ *
+ * @param term The term to look for
+ * @return True if the term is found
+ */
+ boolean contains(String term);
+
+ /**
+ * Returns true if this app:categories listing contains a category with the specified term and scheme
+ *
+ * @param term The term to look for
+ * @param scheme The IRI scheme
+ * @return True if the term and scheme are found
+ */
+ boolean contains(String term, String scheme);
+
+ /**
+ * Returns true if the href attribute is set
+ */
+ boolean isOutOfLine();
+
+}
Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Categories.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Category.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Category.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Category.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Category.java Tue Sep 20 15:56:46 2011
@@ -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.abdera2.model;
+
+import org.apache.abdera2.common.anno.QName;
+import org.apache.abdera2.common.iri.IRI;
+
+import static org.apache.abdera2.common.Constants.*;
+/**
+ * <p>
+ * Provides categorization informaton for a feed or entry
+ * </p>
+ * <p>
+ * Per RFC4287:
+ * </p>
+ *
+ * <pre>
+ * The "atom:category" element conveys information about a category
+ * associated with an entry or feed. This specification assigns no
+ * meaning to the content (if any) of this element.
+ *
+ * atomCategory =
+ * element atom:category {
+ * atomCommonAttributes,
+ * attribute term { text },
+ * attribute scheme { atomUri }?,
+ * attribute label { text }?,
+ * undefinedContent
+ * }
+ * </pre>
+ */
+@QName(value=LN_CATEGORY,ns=ATOM_NS)
+public interface Category extends ExtensibleElement {
+
+ /**
+ * RFC4287: The "term" attribute is a string that identifies the category to which the entry or feed belongs.
+ * Category elements MUST have a "term" attribute.
+ *
+ * @return The string value of the term attribute
+ */
+ String getTerm();
+
+ /**
+ * RFC4287: The "term" attribute is a string that identifies the category to which the entry or feed belongs.
+ * Category elements MUST have a "term" attribute.
+ *
+ * @param term The string value of the term attribute
+ */
+ Category setTerm(String term);
+
+ /**
+ * RFC4287: The "scheme" attribute is an IRI that identifies a categorization scheme. Category elements MAY have a
+ * "scheme" attribute.
+ *
+ * @return The IRI value of the scheme attribute
+ */
+ IRI getScheme();
+
+ /**
+ * RFC4287: The "scheme" attribute is an IRI that identifies a categorization scheme. Category elements MAY have a
+ * "scheme" attribute.
+ *
+ * @param scheme The IRI of the scheme
+ */
+ Category setScheme(String scheme);
+
+ /**
+ * RFC4287: The "label" attribute provides a human-readable label for display in end-user applications. The content
+ * of the "label" attribute is Language-Sensitive. Entities such as "&amp;" and "&lt;" represent their
+ * corresponding characters ("&" and "<", respectively), not markup. Category elements MAY have a "label"
+ * attribute.
+ *
+ * @return The value of the human-readable label
+ */
+ String getLabel();
+
+ /**
+ * RFC4287: The "label" attribute provides a human-readable label for display in end-user applications. The content
+ * of the "label" attribute is Language-Sensitive. Entities such as "&amp;" and "&lt;" represent their
+ * corresponding characters ("&" and "<", respectively), not markup. Category elements MAY have a "label"
+ * attribute.
+ *
+ * @param label The value of the human-readable label
+ */
+ Category setLabel(String label);
+
+}
Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Category.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Collection.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Collection.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Collection.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Collection.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,227 @@
+/*
+ * 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.abdera2.model;
+
+import static org.apache.abdera2.common.Constants.APP_NS;
+import static org.apache.abdera2.common.Constants.LN_COLLECTION;
+
+import java.util.List;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera2.common.anno.QName;
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.selector.Selector;
+
+/**
+ * <p>
+ * Represents an collection element in an Atom Publishing Protocol introspection document.
+ * </p>
+ *
+ * <pre>
+ * The "app:collection" describes an Atom Protocol collection. One
+ * child element is defined here for app:collection: "app:member-type".
+ *
+ * appCollection =
+ * element app:collection {
+ * appCommonAttributes,
+ * attribute href { text },
+ * ( atomTitle
+ * & appAccept
+ * & extensionElement* )
+ * }
+ * </pre>
+ */
+@QName(value=LN_COLLECTION,ns=APP_NS)
+public interface Collection extends ExtensibleElement {
+
+ /**
+ * The text value of the collections atom:title element
+ *
+ * @return The atom:title value
+ */
+ String getTitle();
+
+ /**
+ * Set the value of the collections atom:title element using type="text"
+ *
+ * @param title The value of the atom:title
+ * @return The newly created title element
+ */
+ Text setTitle(String title);
+
+ /**
+ * Set the value of the collections atom:title element using type="html". Special characters in the value will be
+ * automatically escaped (e.g. & will become &
+ *
+ * @param title The value of the atom:title
+ * @return The newly created title element
+ */
+ Text setTitleAsHtml(String title);
+
+ /**
+ * Set the value of the collections atom:title element using type="xhtml". The title text will be wrapped in a
+ * xhtml:div and parsed to ensure that it is welformed XML. A ParseException (RuntimeException) could be thrown
+ *
+ * @param title The value of the atom:title
+ * @return The newly created title element
+ */
+ Text setTitleAsXHtml(String title);
+
+ /**
+ * Return the title element
+ *
+ * @return The title element
+ */
+ Text getTitleElement();
+
+ /**
+ * Return the value of the app:collection elements href attribute
+ *
+ * @return The href attribute IRI value
+ * @throws IRISyntaxException if the value of the href attribute is malformed
+ */
+ IRI getHref();
+
+ /**
+ * Return the href attribute resolved against the in-scope Base URI
+ *
+ * @return The href attribute IRI value
+ * @throws IRISyntaxException if the value of the href attribute is malformed
+ */
+ IRI getResolvedHref();
+
+ /**
+ * Set the value of the href attribute
+ *
+ * @param href The value of href attribute
+ * @throws IRISyntaxException if the href attribute is malformed
+ */
+ Collection setHref(String href);
+
+ /**
+ * Returns the listing of media-ranges allowed for this collection
+ *
+ * @return An array listing the media-ranges allowed for this collection
+ */
+ String[] getAccept();
+
+ /**
+ * Set the listing of media-ranges allowed for this collection. The special value "entry" is used to indicate Atom
+ * Entry Documents.
+ *
+ * @param mediaRanges a listing of media-ranges
+ * @throws MimeTypeParseException
+ */
+ Collection setAccept(String... mediaRanges);
+
+ /**
+ * Returns true if the collection accepts the given media-type
+ *
+ * @param mediaType The media-type to check
+ * @return True if the media-type is acceptable
+ */
+ boolean accepts(String mediaType);
+
+ /**
+ * Returns true if the collection accepts Atom entry documents (equivalent to calling
+ * accepts("application/atom+xml;type=entry");)
+ */
+ boolean acceptsEntry();
+
+ /**
+ * Returns true if the collection accepts nothing (i.e. there is an empty accept element)
+ */
+ boolean acceptsNothing();
+
+ /**
+ * Sets the appropriate accept element to indicate that entries are accepted (equivalent to calling
+ * setAccept("application/atom+xml;type=entry");)
+ */
+ Collection setAcceptsEntry();
+
+ /**
+ * Sets the collection so that nothing is accepted (equivalent to calling setAccept(""); )
+ */
+ Collection setAcceptsNothing();
+
+ /**
+ * Adds a new accept element to the collection
+ */
+ Collection addAccepts(String mediaRange);
+
+ /**
+ * Adds new accept elements to the collection
+ */
+ Collection addAccepts(String... mediaRanges);
+
+ /**
+ * Same as setAcceptsEntry except the existing accepts are not discarded
+ */
+ Collection addAcceptsEntry();
+
+ /**
+ * Returns true if the collection accepts the given media-type
+ *
+ * @param mediaType The media-type to check
+ * @return True if the media-type is acceptable
+ */
+ boolean accepts(MimeType mediaType);
+
+ /**
+ * Returns the app:categories element
+ *
+ * @return The app:categories element
+ */
+ List<Categories> getCategories();
+
+ List<Categories> getCategories(Selector selector);
+
+ /**
+ * Add an app:categories element
+ *
+ * @return The newly created app:categories element
+ */
+ Categories addCategories();
+
+ /**
+ * Add an app:categories element that links to an external Category Document
+ *
+ * @param href The IRI of the external Category Document
+ * @return The newly created app:categories element
+ */
+ Categories addCategories(String href);
+
+ /**
+ * Add the app:categories element to the collection
+ *
+ * @param categories The app:categories element
+ */
+ Collection addCategories(Categories categories);
+
+ /**
+ * Add a listing of categories to the collection
+ *
+ * @param categories The listing of categories to add
+ * @param fixed True if the listing of categories should be fixed
+ * @param scheme The default IRI scheme for the categories listing
+ * @return The newly created app:categories element
+ */
+ Categories addCategories(List<Category> categories, boolean fixed, String scheme);
+
+}
Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Collection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Comment.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Comment.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Comment.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Comment.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,53 @@
+/*
+ * 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.abdera2.model;
+
+import org.apache.abdera2.factory.Factory;
+
+/**
+ * A comment. Returned by the Abdera XPath implementation when querying for comment nodes (e.g.
+ * xpath.selectNodes("//comment()"); ...). Most applications should never have much of a reason to use this interface.
+ * It is provided primarily to avoid application from having to deal directly with the underlying parser implementation
+ */
+public interface Comment {
+
+ /**
+ * Delete the comment node
+ */
+ void discard();
+
+ /**
+ * The text of this comment node
+ */
+ String getText();
+
+ /**
+ * The text of this comment node
+ */
+ Comment setText(String text);
+
+ /**
+ * The Abdera Factory
+ */
+ Factory getFactory();
+
+ /**
+ * The parent node
+ */
+ <T extends Base> T getParentElement();
+}
Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Comment.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Content.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Content.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Content.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Content.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,294 @@
+/*
+ * 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.abdera2.model;
+
+import static org.apache.abdera2.common.Constants.ATOM_NS;
+import static org.apache.abdera2.common.Constants.LN_CONTENT;
+
+import javax.activation.DataHandler;
+import javax.activation.MimeType;
+
+import org.apache.abdera2.common.anno.QName;
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.mediatype.MimeTypeHelper;
+
+/**
+ * <p>
+ * Represents an atom:content element.
+ * </p>
+ * <p>
+ * Atom has a very clearly defined and extremely flexible content model. The model allows for five basic types of
+ * content:
+ * </p>
+ * <ul>
+ * <li>Text, consisting of content that is to be interpreted as plain text with no markup. For instance,
+ * <code><content type="text">&lt;content&gt;</content></code> is interpreted as literal characer "<"
+ * followed by the word "content", followed by the literal character ">".</li>
+ * <li>HTML, consisting of content that is to be interpreted as escaped HTML markup. For instance,
+ * <code><content type="html">&lt;b&gt;content&lt;/b&gt;</content></code> is interpreted as the
+ * word "content" surrounded by the HTML <code><b></code> and <code></b></code> tags.</li>
+ * <li>XHTML, consisting of well-formed XHTML content wrapped in an XHTML div element. For instance,
+ * <code><content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><b>Content</b></div></content></code>
+ * .</li>
+ * <li>XML, consisting of well-formed XML content. For instance,
+ * <code><content type="application/xml"><a xmlns="..."><b><c/></b></a></content></code>. The
+ * content could, alternatively, be linked to via the src attribute,
+ * <code><content type="application/xml" src="http://example.org/foo.xml"/></code>.</li>
+ * <li>Media, consisting of content conforming to any MIME media type.
+ * <ul>
+ * <li>Text media types are encoded literally, e.g.
+ * <code><content type="text/calendar">BEGIN:VCALENDAR...</content></code>.</li>
+ * <li>Other media types are encoded as Base64 strings, e.g.
+ * <code><content type="image/jpeg">{Base64}</content></code>.</li>
+ * <li>Alternatively, media content may use the src attribute,
+ * <code><content type="text/calendar" src="http://example.org/foo.cal"/></code>,
+ * <code><content type="image/jpeg" src="http://example.org/foo.jpg" /></code></li>
+ * </ul>
+ * </li>
+ * </ul>
+ * <p>
+ * Per RFC4287:
+ * </p>
+ *
+ * <pre>
+ * The "atom:content" element either contains or links to the content of
+ * the entry. The content of atom:content is Language-Sensitive.
+ *
+ * atomInlineTextContent =
+ * element atom:content {
+ * atomCommonAttributes,
+ * attribute type { "text" | "html" }?,
+ * (text)*
+ * }
+ *
+ * atomInlineXHTMLContent =
+ * element atom:content {
+ * atomCommonAttributes,
+ * attribute type { "xhtml" },
+ * xhtmlDiv
+ * }
+ * atomInlineOtherContent =
+ * element atom:content {
+ * atomCommonAttributes,
+ * attribute type { atomMediaType }?,
+ * (text|anyElement)*
+ * }
+ *
+ * atomOutOfLineContent =
+ * element atom:content {
+ * atomCommonAttributes,
+ * attribute type { atomMediaType }?,
+ * attribute src { atomUri },
+ * empty
+ * }
+ *
+ * atomContent = atomInlineTextContent
+ * | atomInlineXHTMLContent
+ * | atomInlineOtherContent
+ * | atomOutOfLineContent
+ *
+ * </pre>
+ */
+@QName(value=LN_CONTENT,ns=ATOM_NS)
+public interface Content extends Element {
+
+ /**
+ * Used to identify the type of content
+ */
+ public enum Type {
+ /** Plain text **/
+ TEXT,
+ /** Escaped HTML **/
+ HTML,
+ /** Welformed XHTML **/
+ XHTML,
+ /** Welformed XML **/
+ XML("application/xml"),
+ /** Base64-encoded Binary **/
+ MEDIA;
+
+ private final String label;
+
+ Type() {
+ this.label = this.name().toLowerCase();
+ }
+
+ Type(String label) {
+ this.label = label;
+ }
+
+ public String label() {
+ return label;
+ }
+
+ /**
+ * Return an appropriate Type given the specified @type attribute value
+ */
+ public static Type typeFromString(String val) {
+ Type type = TEXT;
+ if (val != null) {
+ if (val.equalsIgnoreCase("text"))
+ type = TEXT;
+ else if (val.equalsIgnoreCase("html"))
+ type = HTML;
+ else if (val.equalsIgnoreCase("xhtml"))
+ type = XHTML;
+ else if (MimeTypeHelper.isXml(val))
+ type = XML;
+ else {
+ type = MimeTypeHelper.isMimeType(val) ? MEDIA : null;
+ }
+ }
+ return type;
+ }
+ }
+
+ /**
+ * Returns the Content Type
+ *
+ * @return The Content Type
+ */
+ Type getContentType();
+
+ /**
+ * Set the Content Type
+ *
+ * @param type The Content Type
+ */
+ Content setContentType(Type type);
+
+ /**
+ * Return the value element or null if type="text", type="html" or type is some non-XML media type
+ *
+ * @return The first child element of the atom:content element or null
+ */
+ <T extends Element> T getValueElement();
+
+ /**
+ * Set the value element of the content. If the value is a Div, the type attribute will be set to type="xhtml",
+ * otherwise, the attribute will be set to type="application/xml"
+ *
+ * @param value The element to set
+ */
+ <T extends Element> Content setValueElement(T value);
+
+ /**
+ * RFC4287: On the atom:content element, the value of the "type" attribute MAY be one of "text", "html", or "xhtml".
+ * Failing that, it MUST conform to the syntax of a MIME media type, but MUST NOT be a composite type. If neither
+ * the type attribute nor the src attribute is provided, Atom Processors MUST behave as though the type attribute
+ * were present with a value of "text".
+ *
+ * @return null if type = text, html or xhtml, otherwise a media type
+ */
+ MimeType getMimeType();
+
+ /**
+ * RFC4287: On the atom:content element, the value of the "type" attribute MAY be one of "text", "html", or "xhtml".
+ * Failing that, it MUST conform to the syntax of a MIME media type, but MUST NOT be a composite type. If neither
+ * the type attribute nor the src attribute is provided, Atom Processors MUST behave as though the type attribute
+ * were present with a value of "text".
+ *
+ * @param type The media type
+ * @throws MimeTypeParseException if the media type is malformed
+ */
+ Content setMimeType(String type);
+
+ /**
+ * <p>
+ * RFC4287: atom:content MAY have a "src" attribute, whose value MUST be an IRI reference. If the "src" attribute is
+ * present, atom:content MUST be empty. Atom Processors MAY use the IRI to retrieve the content and MAY choose to
+ * ignore remote content or to present it in a different manner than local content.
+ * </p>
+ * <p>
+ * If the "src" attribute is present, the "type" attribute SHOULD be provided and MUST be a MIME media type, rather
+ * than "text", "html", or "xhtml".
+ * </p>
+ *
+ * @return The IRI value of the src attribute or null if none
+ * @throws IRISyntaxException if the src attribute value is malformed
+ */
+ IRI getSrc();
+
+ /**
+ * Returns the fully qualified URI form of the content src attribute.
+ *
+ * @return The IRI value of the src attribute resolved against the in-scope Base URI
+ * @throws IRISyntaxException if the src attribute value is malformed
+ */
+ IRI getResolvedSrc();
+
+ /**
+ * <p>
+ * RFC4287: atom:content MAY have a "src" attribute, whose value MUST be an IRI reference. If the "src" attribute is
+ * present, atom:content MUST be empty. Atom Processors MAY use the IRI to retrieve the content and MAY choose to
+ * ignore remote content or to present it in a different manner than local content.
+ * </p>
+ * <p>
+ * If the "src" attribute is present, the "type" attribute SHOULD be provided and MUST be a MIME media type, rather
+ * than "text", "html", or "xhtml".
+ * </p>
+ *
+ * @param src The IRI to use as the src attribute value for the content
+ * @throws IRISyntaxException if the src value is malformed
+ */
+ Content setSrc(String src);
+
+ /**
+ * Attempts to Base64 decode the string value of the content element.
+ *
+ * @return A DataHandler or null
+ * @throws UnsupportedOperationException if type = text, html, xhtml, or any application/*+xml, or text/* type
+ */
+ DataHandler getDataHandler();
+
+ /**
+ * Sets the string value of the content element by Base64 encoding the specifed byte array.
+ *
+ * @param dataHandler The DataHandler for the binary content requiring Base64 encoding
+ * @throws UnsupportedOperationException if type = text, html, xhtml, or any application/*+xml, or text/* type
+ */
+ Content setDataHandler(DataHandler dataHandler);
+
+ /**
+ * Returns the string value of this atom:content element
+ *
+ * @return The string value
+ */
+ String getValue();
+
+ /**
+ * Set the string value of the atom:content element
+ *
+ * @param value The string value
+ */
+ Content setValue(String value);
+
+ /**
+ * Return the string value of the atom:content element with the enclosing div tag if type="xhtml"
+ *
+ * @return The div wrapped value
+ */
+ String getWrappedValue();
+
+ /**
+ * Set the string value of the atom:content with the enclosing div tag
+ *
+ * @param wrappedValue The string value with the wrapping div tag
+ */
+ Content setWrappedValue(String wrappedValue);
+}
Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Content.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Control.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Control.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Control.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Control.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,108 @@
+/*
+ * 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.abdera2.model;
+
+import static org.apache.abdera2.common.Constants.APP_NS;
+import static org.apache.abdera2.common.Constants.LN_CONTROL;
+
+import org.apache.abdera2.common.anno.QName;
+
+/**
+ * <p>
+ * Represents an Atom Publishing Protocol <code>control</code> element.
+ * </p>
+ * <p>
+ * The purpose of the control extension is to provide a means for content publishers to embed various
+ * publishing-operation specific control parameters within the body of the entry. For instance, the client may wish to
+ * mark the entry as a draft, or may wish to ask the publishing server to enable or disable specific extended features
+ * for a given entry.
+ * </p>
+ * <p>
+ * Per APP Draft-08:
+ * </p>
+ *
+ * <pre>
+ * pubControl =
+ * element pub:control {
+ * atomCommonAttributes,
+ * pubDraft?
+ * & extensionElement
+ * }
+ *
+ * pubDraft =
+ * element pub:draft { "yes" | "no" }
+ *
+ * The "pub:control" element MAY appear as a child of an "atom:entry"
+ * which is being created or updated via the Atom Publishing Protocol.
+ * The "pub:control" element, if it does appear in an entry, MUST only
+ * appear at most one time. The "pub:control" element is considered
+ * foreign markup as defined in Section 6 of [RFC4287].
+ *
+ * The "pub:control" element and its child elements MAY be included in
+ * Atom Feed or Entry Documents.
+ *
+ * The "pub:control" element MAY contain exactly one "pub:draft" element
+ * as defined here, and MAY contain zero or more extension elements as
+ * outlined in Section 6 of [RFC4287]. Both clients and servers MUST
+ * ignore foreign markup present in the pub:control element.
+ * </pre>
+ */
+@QName(value=LN_CONTROL,ns=APP_NS)
+public interface Control extends ExtensibleElement {
+
+ /**
+ * <p>
+ * Returns true if the entry should <i>not</i> be made publicly visible.
+ * </p>
+ * <p>
+ * APP Draft-08: The number of "pub:draft" elements in "pub:control" MUST be zero or one. Its value MUST be one of
+ * "yes" or "no". A value of "no" means that the entry MAY be made publicly visible. If the "pub:draft" element is
+ * missing then the value MUST be understood to be "no". The pub:draft element MAY be ignored.
+ * </p>
+ *
+ * @return True if this is a draft
+ */
+ boolean isDraft();
+
+ /**
+ * <p>
+ * Set to "true" if the entry should <i>not</i> be made publicly visible.
+ * </p>
+ * <p>
+ * APP Draft-08: The number of "pub:draft" elements in "pub:control" MUST be zero or one. Its value MUST be one of
+ * "yes" or "no". A value of "no" means that the entry MAY be made publicly visible. If the "pub:draft" element is
+ * missing then the value MUST be understood to be "no". The pub:draft element MAY be ignored.
+ * </p>
+ *
+ * @param draft true if app:draft should be set to "yes"
+ */
+ Control setDraft(boolean draft);
+
+ /**
+ * <p>
+ * Removes the draft setting completely from the control element.
+ * </p>
+ * <p>
+ * APP Draft-08: The number of "pub:draft" elements in "pub:control" MUST be zero or one. Its value MUST be one of
+ * "yes" or "no". A value of "no" means that the entry MAY be made publicly visible. If the "pub:draft" element is
+ * missing then the value MUST be understood to be "no". The pub:draft element MAY be ignored.
+ * </p>
+ */
+ Control unsetDraft();
+
+}
Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Control.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTime.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTime.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTime.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTime.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,100 @@
+/*
+ * 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.abdera2.model;
+
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * <p>
+ * An element conforming to the Atom Date Construct. The data type implementation for this element is provided by the
+ * AtomDate class.
+ * </p>
+ */
+public interface DateTime extends Element {
+
+ /**
+ * Returns the content value of the element as an AtomDate object
+ *
+ * @return The Atom Date value of this element
+ */
+ org.apache.abdera2.common.date.DateTime getValue();
+
+ /**
+ * Returns the content value of the element as a java.util.Date object
+ *
+ * @return The java.util.Date value of this element
+ */
+ Date getDate();
+
+ /**
+ * Returns the content value of the element as a java.util.Calendar object
+ *
+ * @return The java.util.Calendar value of this element
+ */
+ Calendar getCalendar();
+
+ /**
+ * Returns the content value of the element as a long (equivalent to calling DateTimeElement().getDate().getTime()
+ *
+ * @return The number of milliseconds since January 1, 1970, 00:00:00 GMT
+ */
+ long getTime();
+
+ /**
+ * Returns the content value of the element as a string conforming to RFC-3339
+ *
+ * @return The serialized string form of this element
+ */
+ String getString();
+
+ /**
+ * Sets the content value of the element
+ *
+ * @param dateTime the Atom Date value
+ */
+ DateTime setValue(org.apache.abdera2.common.date.DateTime dateTime);
+
+ /**
+ * Sets the content value of the element
+ *
+ * @param date The java.util.Date value
+ */
+ DateTime setDate(Date date);
+
+ /**
+ * Sets the content value of the element
+ *
+ * @param date The java.util.Calendar value
+ */
+ DateTime setCalendar(Calendar date);
+
+ /**
+ * Sets the content value of the element
+ *
+ * @param date the number of milliseconds since January 1, 1970, 00:00:00 GMT
+ */
+ DateTime setTime(long date);
+
+ /**
+ * Sets the content value of the element
+ *
+ * @param date The serialized string value
+ */
+ DateTime setString(String date);
+}
Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTime.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTimeWrapper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTimeWrapper.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTimeWrapper.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTimeWrapper.java Tue Sep 20 15:56:46 2011
@@ -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.abdera2.model;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.factory.Factory;
+
+/**
+ * An ElementWrapper implementation that can serve as the basis for Atom Date Construct based extensions.
+ */
+public abstract class DateTimeWrapper extends ElementWrapper implements DateTime {
+
+ protected DateTimeWrapper(Element internal) {
+ super(internal);
+ }
+
+ protected DateTimeWrapper(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+
+ public org.apache.abdera2.common.date.DateTime getValue() {
+ org.apache.abdera2.common.date.DateTime value = null;
+ String v = getText();
+ if (v != null) {
+ value = org.apache.abdera2.common.date.DateTime.valueOf(v);
+ }
+ return value;
+ }
+
+ public DateTime setValue(org.apache.abdera2.common.date.DateTime dateTime) {
+ if (dateTime != null)
+ setText(dateTime.getValue());
+ else
+ setText("");
+ return this;
+ }
+
+ public DateTime setDate(Date date) {
+ if (date != null)
+ setText(org.apache.abdera2.common.date.DateTime.valueOf(date).getValue());
+ else
+ setText("");
+ return this;
+ }
+
+ public DateTime setCalendar(Calendar date) {
+ if (date != null)
+ setText(org.apache.abdera2.common.date.DateTime.valueOf(date).getValue());
+ else
+ setText("");
+ return this;
+ }
+
+ public DateTime setTime(long date) {
+ setText(org.apache.abdera2.common.date.DateTime.valueOf(date).getValue());
+ return this;
+ }
+
+ public DateTime setString(String date) {
+ if (date != null)
+ setText(org.apache.abdera2.common.date.DateTime.valueOf(date).getValue());
+ else
+ setText("");
+ return this;
+ }
+
+ public Date getDate() {
+ org.apache.abdera2.common.date.DateTime ad = getValue();
+ return (ad != null) ? ad.getDate() : null;
+ }
+
+ public Calendar getCalendar() {
+ org.apache.abdera2.common.date.DateTime ad = getValue();
+ return (ad != null) ? ad.getCalendar() : null;
+ }
+
+ public long getTime() {
+ org.apache.abdera2.common.date.DateTime ad = getValue();
+ return (ad != null) ? ad.getTime() : null;
+ }
+
+ public String getString() {
+ org.apache.abdera2.common.date.DateTime ad = getValue();
+ return (ad != null) ? ad.getValue() : null;
+ }
+
+}
Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTimeWrapper.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Div.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Div.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Div.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Div.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.model;
+
+import static org.apache.abdera2.common.Constants.LN_DIV;
+import static org.apache.abdera2.common.Constants.XHTML_NS;
+
+import org.apache.abdera2.common.anno.QName;
+
+/**
+ * <p>
+ * Represents an XHTML div tag.
+ * </p>
+ */
+@QName(value=LN_DIV,ns=XHTML_NS)
+public interface Div extends ExtensibleElement {
+
+ /**
+ * Returns the array of class attribute values on the div
+ *
+ * @return A listing of class attribute values
+ */
+ String[] getXhtmlClass();
+
+ /**
+ * Returns the value of the div element's id attribute
+ *
+ * @return The value of the id attribute
+ */
+ String getId();
+
+ /**
+ * Returns the value of the div element's title attribute
+ *
+ * @return The value of the title attribute
+ */
+ String getTitle();
+
+ /**
+ * Sets the value of the div element's id attribute
+ *
+ * @param id The value of the id attribute
+ */
+ Div setId(String id);
+
+ /**
+ * Set the value of the div element's title attribute
+ *
+ * @param title The value of the title attribute
+ */
+ Div setTitle(String title);
+
+ /**
+ * Sets the array of class attribute values on the div
+ *
+ * @param classes A listing of class attribute values
+ */
+ Div setXhtmlClass(String[] classes);
+
+ /**
+ * Returns the value of the div element
+ *
+ * @return The value of the div element
+ */
+ String getValue();
+
+ /**
+ * Set the value of the div element
+ *
+ * @param value The text value
+ */
+ void setValue(String value);
+}
Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Div.java
------------------------------------------------------------------------------
svn:mime-type = text/plain