abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1173209 [20/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/ ...
Date Tue, 20 Sep 2011 15:57:20 GMT
Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensionIterator.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensionIterator.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensionIterator.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensionIterator.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.Iterator;
+
+import org.apache.abdera2.common.selector.Selector;
+import org.apache.abdera2.factory.Factory;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Most of the original code for this class came from the OMChildrenQNameIterator from Axiom
+ */
+public class ExtensionIterator implements Iterator<Element> {
+
+    /**
+     * Field givenQName
+     */
+    private final String namespace;
+    private final String extns;
+    private final Factory factory;
+    private final Selector selector;
+
+    protected final Iterator<?> children;
+    protected Element currentChild = null;
+    
+
+    /**
+     * Constructor OMChildrenQNameIterator.
+     * 
+     * @param currentChild
+     * @param givenQName
+     */
+    public ExtensionIterator(Element parent) {
+        this(parent,null,null);
+    }
+    
+    public ExtensionIterator(Element parent, Selector selector) {
+      this(parent,null,selector);
+    }
+
+    public ExtensionIterator(Element parent, String extns) {
+      this(parent,extns,null);
+    }
+    
+    public ExtensionIterator(Element parent, String extns, Selector selector) {
+        this.children = parent.iterator();
+        this.selector = selector;
+        this.namespace = parent.getQName().getNamespaceURI();
+        this.factory = parent.getFactory();
+        this.currentChild = getNext();
+        this.extns = extns;
+    }
+
+    private Element getNext() {
+      while (children.hasNext()) {
+        Object child = children.next();
+        if ((child instanceof Element) && (isQNamesMatch(((Element)child).getQName(),
+            this.namespace)) && (selector == null || selector.select((Element)child))) {
+          return factory.getElementWrapper((Element)child);
+        }
+      }
+      return null;
+    }
+    
+    public boolean hasNext() {
+      return currentChild != null;
+    }
+
+    public Element next() {
+      if (currentChild == null) return null;
+      Element child = currentChild;
+      currentChild = getNext();
+      return factory.getElementWrapper(child);
+    }
+
+    private boolean isQNamesMatch(QName elementQName, String namespace) {
+        String elns = elementQName == null ? "" : elementQName.getNamespaceURI();
+        boolean namespaceURIMatch = (namespace == null) || (namespace == "") || elns.equals(namespace);
+        if (!namespaceURIMatch && extns != null && !elns.equals(extns))
+            return false;
+        else
+            return !namespaceURIMatch;
+    }
+
+    public void remove() {
+      throw new UnsupportedOperationException();
+    }
+
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensionIterator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Feed.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Feed.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Feed.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Feed.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,181 @@
+/*
+ * 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_FEED;
+
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.abdera2.common.anno.QName;
+import org.apache.abdera2.common.selector.Selector;
+
+/**
+ * <p>
+ * Represents an Atom Feed Element
+ * </p>
+ * <p>
+ * Per RFC4287:
+ * </p>
+ * 
+ * <pre>
+ * The "atom:feed" element is the document (i.e., top-level) element of
+ * an Atom Feed Document, acting as a container for metadata and data
+ * associated with the feed.  Its element children consist of metadata
+ * elements followed by zero or more atom:entry child elements.
+ * 
+ * atomFeed =
+ *   element atom:feed {
+ *       atomCommonAttributes,
+ *       (atomAuthor*
+ *        &amp; atomCategory*
+ *        &amp; atomContributor*
+ *        &amp; atomGenerator?
+ *        &amp; atomIcon?
+ *        &amp; atomId
+ *        &amp; atomLink*
+ *        &amp; atomLogo?
+ *        &amp; atomRights?
+ *        &amp; atomSubtitle?
+ *        &amp; atomTitle
+ *        &amp; atomUpdated
+ *        &amp; extensionElement*),
+ *       atomEntry*
+ *   }
+ * 
+ * This specification assigns no significance to the order of atom:entry
+ * elements within the feed.
+ * 
+ * The following child elements are defined by this specification (note
+ * that the presence of some of these elements is required):
+ * 
+ * o  atom:feed elements MUST contain one or more atom:author elements,
+ *    unless all of the atom:feed element's child atom:entry elements
+ *    contain at least one atom:author element.
+ * o  atom:feed elements MAY contain any number of atom:category
+ *    elements.
+ * o  atom:feed elements MAY contain any number of atom:contributor
+ *    elements.
+ * o  atom:feed elements MUST NOT contain more than one atom:generator
+ *    element.
+ * o  atom:feed elements MUST NOT contain more than one atom:icon
+ *    element.
+ * o  atom:feed elements MUST NOT contain more than one atom:logo
+ *    element.
+ * o  atom:feed elements MUST contain exactly one atom:id element.
+ * o  atom:feed elements SHOULD contain one atom:link element with a rel
+ *    attribute value of "self".  This is the preferred URI for
+ *    retrieving Atom Feed Documents representing this Atom feed.
+ * o  atom:feed elements MUST NOT contain more than one atom:link
+ *    element with a rel attribute value of "alternate" that has the
+ *    same combination of type and hreflang attribute values.
+ * o  atom:feed elements MAY contain additional atom:link elements
+ *    beyond those described above.
+ * o  atom:feed elements MUST NOT contain more than one atom:rights
+ *    element.
+ * o  atom:feed elements MUST NOT contain more than one atom:subtitle
+ *    element.
+ * o  atom:feed elements MUST contain exactly one atom:title element.
+ * o  atom:feed elements MUST contain exactly one atom:updated element.
+ * 
+ * If multiple atom:entry elements with the same atom:id value appear in
+ * an Atom Feed Document, they represent the same entry.  Their
+ * atom:updated timestamps SHOULD be different.  If an Atom Feed
+ * Document contains multiple entries with the same atom:id, Atom
+ * Processors MAY choose to display all of them or some subset of them.
+ * One typical behavior would be to display only the entry with the
+ * latest atom:updated timestamp.
+ * </pre>
+ */
+@QName(value=LN_FEED,ns=ATOM_NS)
+public interface Feed extends Source {
+
+    /**
+     * Returns the complete set of entries contained in this feed
+     * 
+     * @return A listing of atom:entry elements
+     */
+    List<Entry> getEntries();
+    
+    List<Entry> getEntries(Selector selector);
+
+    /**
+     * Adds a new Entry to the <i>end</i> of the Feeds collection of entries
+     * 
+     * @param entry Add an entry
+     */
+    Feed addEntry(Entry entry);
+
+    /**
+     * Adds a new Entry to the <i>end</i> of the Feeds collection of entries
+     * 
+     * @return A newly created atom:entry
+     */
+    Entry addEntry();
+
+    /**
+     * Adds a new Entry to the <i>start</i> of the Feeds collection of entries
+     * 
+     * @param entry An atom:entry to insert
+     */
+    Feed insertEntry(Entry entry);
+
+    /**
+     * Adds a new Entry to the <i>start</i> of the Feeds collection of entries
+     * 
+     * @return A newly created atom:entry
+     */
+    Entry insertEntry();
+
+    /**
+     * Creates a Source element from this Feed
+     * 
+     * @return Returns a copy of this atom:feed as a atom:source element
+     */
+    Source getAsSource();
+
+    /**
+     * Sorts entries by the atom:updated property
+     * 
+     * @param new_first If true, entries with newer atom:updated values will come first
+     */
+    Feed sortEntriesByUpdated(boolean new_first);
+
+    /**
+     * Sorts entries by the app:edited property. if app:edited is null, use app:updated
+     */
+    Feed sortEntriesByEdited(boolean new_first);
+
+    /**
+     * Sorts entries using the given comparator
+     * 
+     * @param comparator Sort the entries using the comparator
+     */
+    Feed sortEntries(Comparator<Entry> comparator);
+
+    /**
+     * Retrieves the first entry in the feed with the given atom:id value
+     * 
+     * @param id The id to retrieve
+     * @return The matching atom:entry
+     * @throws IRISyntaxException if the id is malformed
+     */
+    Entry getEntry(String id);
+
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Feed.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Generator.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Generator.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Generator.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Generator.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,96 @@
+/*
+ * 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_GENERATOR;
+
+import org.apache.abdera2.common.anno.QName;
+import org.apache.abdera2.common.iri.IRI;
+
+/**
+ * <p>
+ * Identifies the software implementation that produced the Atom feed.
+ * </p>
+ * <p>
+ * Per RFC4287:
+ * </p>
+ * 
+ * <pre>
+ * The "atom:generator" element's content identifies the agent used to
+ *  generate a feed, for debugging and other purposes.
+ *  The content of this element, when present, MUST be a string that is a
+ *  human-readable name for the generating agent.  Entities such as
+ *  "&amp;amp;" and "&amp;lt;" represent their corresponding characters 
+ *  ("&amp;" and "&lt;" respectively), not markup.
+ * 
+ *  The atom:generator element MAY have a "uri" attribute whose value
+ *  MUST be an IRI reference [RFC3987].  When dereferenced, the resulting
+ *  URI (mapped from an IRI, if necessary) SHOULD produce a
+ *  representation that is relevant to that agent.
+ * 
+ *  The atom:generator element MAY have a "version" attribute that
+ *  indicates the version of the generating agent.
+ * </pre>
+ */
+@QName(value=LN_GENERATOR,ns=ATOM_NS)
+public interface Generator extends Element {
+
+    /**
+     * The atom:generator element MAY have a "uri" attribute whose value MUST be an IRI reference [RFC3987]. When
+     * dereferenced, the resulting URI (mapped from an IRI, if necessary) SHOULD produce a representation that is
+     * relevant to that agent.
+     * 
+     * @throws IRISyntaxException if the uri is malformed
+     */
+    IRI getUri();
+
+    /**
+     * Returns the fully qualified form of the generator element's uri attribute (resolved against the in-scope Base
+     * URI)
+     * 
+     * @return the resolved uri value
+     * @throws IRISyntaxException if the uri is malformed
+     */
+    IRI getResolvedUri();
+
+    /**
+     * The atom:generator element MAY have a "uri" attribute whose value MUST be an IRI reference [RFC3987]. When
+     * dereferenced, the resulting URI (mapped from an IRI, if necessary) SHOULD produce a representation that is
+     * relevant to that agent.
+     * 
+     * @param uri The URI attribute value
+     * @throws IRISyntaxException if the uri is malformed
+     */
+    Generator setUri(String uri);
+
+    /**
+     * The atom:generator element MAY have a "version" attribute that indicates the version of the generating agent.
+     * 
+     * @return The version attribute value
+     */
+    String getVersion();
+
+    /**
+     * The atom:generator element MAY have a "version" attribute that indicates the version of the generating agent.
+     * 
+     * @param version The version attribute
+     */
+    Generator setVersion(String version);
+
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Generator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/IRIElement.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/IRIElement.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/IRIElement.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/IRIElement.java Tue Sep 20 15:56:46 2011
@@ -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.abdera2.model;
+
+import org.apache.abdera2.common.iri.IRI;
+
+/**
+ * <p>
+ * The IRI interface provides a common base for a set of feed and entry elements whose content value must be a valid
+ * IRI/URI reference. These include the elements atom:icon, atom:logo, and atom:id.
+ * </p>
+ */
+public interface IRIElement extends Element {
+
+    /**
+     * Returns the value of the element as a java.net.URI
+     * 
+     * @return The IRI value of this element
+     */
+    IRI getValue();
+
+    /**
+     * Sets the value of the element
+     * 
+     * @param iri The iri value
+     * @throws IRISyntaxException if the value is malformed
+     */
+    IRIElement setValue(String iri);
+
+    /**
+     * Set the value of this element using the normalization as specified in RFC4287
+     * 
+     * @param iri A non-normalized IRI
+     * @throws IRISyntaxException if the iri is malformed
+     */
+    IRIElement setNormalizedValue(String iri);
+
+    /**
+     * Returns the value of the element resolved against the current in-scope Base URI
+     * 
+     * @return The resolved IRI value
+     */
+    IRI getResolvedValue();
+
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/IRIElement.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Link.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Link.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Link.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Link.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,287 @@
+/*
+ * 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_LINK;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera2.Abdera;
+import org.apache.abdera2.common.anno.QName;
+import org.apache.abdera2.common.http.WebLink;
+import org.apache.abdera2.common.iri.IRI;
+
+/**
+ * <p>
+ * Represents an Atom Link element.
+ * </p>
+ * <p>
+ * Per RFC4287:
+ * </p>
+ * 
+ * <pre>
+ *  The "atom:link" element defines a reference from an entry or feed to
+ *  a Web resource.  This specification assigns no meaning to the content
+ *  (if any) of this element.
+ * 
+ *  atomLink =
+ *     element atom:link {
+ *        atomCommonAttributes,
+ *        attribute href { atomUri },
+ *        attribute rel { atomNCName | atomUri }?,
+ *        attribute type { atomMediaType }?,
+ *        attribute hreflang { atomLanguageTag }?,
+ *        attribute title { text }?,
+ *        attribute length { text }?,
+ *        undefinedContent
+ *     }
+ * </pre>
+ */
+@QName(value=LN_LINK,ns=ATOM_NS)
+public interface Link extends ExtensibleElement {
+
+    public static final String REL_ALTERNATE = "alternate";
+    public static final String REL_CURRENT = "current";
+    public static final String REL_ENCLOSURE = "enclosure";
+    public static final String REL_FIRST = "first";
+    public static final String REL_LAST = "last";
+    public static final String REL_NEXT = "next";
+    public static final String REL_PAYMENT = "payment";
+    public static final String REL_PREVIOUS = "previous";
+    /** @deprecated **/ public static final String REL_PREV = "prev";
+    public static final String REL_RELATED = "related";
+    public static final String REL_SELF = "self";
+    public static final String REL_VIA = "via";
+    public static final String REL_REPLIES = "replies";
+    public static final String REL_LICENSE = "license";
+    public static final String REL_EDIT = "edit";
+    public static final String REL_EDIT_MEDIA = "edit-media";
+    public static final String REL_SERVICE = "service";
+    public static final String REL_NEXT_ARCHIVE = "next-archive";
+    public static final String REL_PREV_ARCHIVE = "prev-archive";
+
+    public static final String IANA_BASE = "http://www.iana.org/assignments/relation/";
+
+    /**
+     * RFC4287: The "href" attribute contains the link's IRI. atom:link elements MUST have an href attribute, whose
+     * value MUST be a IRI reference [RFC3987].
+     * 
+     * @return The href IRI value
+     * @throws IRISyntaxException if the href is malformed
+     */
+    IRI getHref();
+
+    /**
+     * Returns the value of the link's href attribute resolved against the in-scope Base IRI
+     * 
+     * @return The href IRI value
+     * @throws IRISyntaxException if the href is malformed
+     */
+    IRI getResolvedHref();
+
+    /**
+     * RFC4287: The "href" attribute contains the link's IRI. atom:link elements MUST have an href attribute, whose
+     * value MUST be a IRI reference [RFC3987].
+     * 
+     * @param href The href IRI
+     * @throws IRISyntaxException if the href is malformed
+     */
+    Link setHref(String href);
+
+    Link setHref(IRI href);
+    
+    /**
+     * <p>
+     * RFC4287: atom:link elements MAY have a "rel" attribute that indicates the link relation type. If the "rel"
+     * attribute is not present, the link element MUST be interpreted as if the link relation type is "alternate"... The
+     * value of "rel" MUST be a string that is non-empty and matches either the "isegment-nz-nc" or the "IRI" production
+     * in [RFC3987]. Note that use of a relative reference other than a simple name is not allowed. If a name is given,
+     * implementations MUST consider the link relation type equivalent to the same name registered within the IANA
+     * Registry of Link Relations (Section 7), and thus to the IRI that would be obtained by appending the value of the
+     * rel attribute to the string "http://www.iana.org/assignments/relation/". The value of "rel" describes the meaning
+     * of the link, but does not impose any behavioral requirements on Atom Processors.
+     * </p>
+     * 
+     * @return The rel attribute value
+     */
+    String getRel();
+
+    /**
+     * <p>
+     * RFC4287: atom:link elements MAY have a "rel" attribute that indicates the link relation type. If the "rel"
+     * attribute is not present, the link element MUST be interpreted as if the link relation type is "alternate"... The
+     * value of "rel" MUST be a string that is non-empty and matches either the "isegment-nz-nc" or the "IRI" production
+     * in [RFC3987]. Note that use of a relative reference other than a simple name is not allowed. If a name is given,
+     * implementations MUST consider the link relation type equivalent to the same name registered within the IANA
+     * Registry of Link Relations (Section 7), and thus to the IRI that would be obtained by appending the value of the
+     * rel attribute to the string "http://www.iana.org/assignments/relation/". The value of "rel" describes the meaning
+     * of the link, but does not impose any behavioral requirements on Atom Processors.
+     * </p>
+     * 
+     * @param rel The rel attribute value
+     */
+    Link setRel(String rel);
+
+    /**
+     * RFC4287: On the link element, the "type" attribute's value is an advisory media type: it is a hint about the type
+     * of the representation that is expected to be returned when the value of the href attribute is dereferenced. Note
+     * that the type attribute does not override the actual media type returned with the representation. Link elements
+     * MAY have a type attribute, whose value MUST conform to the syntax of a MIME media type [MIMEREG].
+     * 
+     * @return The value of the type attribute
+     * @throws MimeTypeParseException if the type is malformed
+     */
+    MimeType getMimeType();
+
+    /**
+     * RFC4287: On the link element, the "type" attribute's value is an advisory media type: it is a hint about the type
+     * of the representation that is expected to be returned when the value of the href attribute is dereferenced. Note
+     * that the type attribute does not override the actual media type returned with the representation. Link elements
+     * MAY have a type attribute, whose value MUST conform to the syntax of a MIME media type [MIMEREG].
+     * 
+     * @param type The link type
+     * @throws MimeTypeParseException if the type is malformed
+     */
+    Link setMimeType(String type);
+
+    /**
+     * RFC4287: The "hreflang" attribute's content describes the language of the resource pointed to by the href
+     * attribute. When used together with the rel="alternate", it implies a translated version of the entry. Link
+     * elements MAY have an hreflang attribute, whose value MUST be a language tag [RFC3066].
+     * 
+     * @return The hreflang value
+     */
+    String getHrefLang();
+
+    /**
+     * RFC4287: The "hreflang" attribute's content describes the language of the resource pointed to by the href
+     * attribute. When used together with the rel="alternate", it implies a translated version of the entry. Link
+     * elements MAY have an hreflang attribute, whose value MUST be a language tag [RFC3066].
+     * 
+     * @param lang The hreflang value
+     */
+    Link setHrefLang(String lang);
+
+    /**
+     * RFC4287: The "title" attribute conveys human-readable information about the link. The content of the "title"
+     * attribute is Language-Sensitive. Entities such as "&amp;amp;" and "&amp;lt;" represent their corresponding
+     * characters ("&amp;" and "&lt;", respectively), not markup. Link elements MAY have a title attribute.
+     * 
+     * @return The title attribute
+     */
+    String getTitle();
+
+    /**
+     * RFC4287: The "title" attribute conveys human-readable information about the link. The content of the "title"
+     * attribute is Language-Sensitive. Entities such as "&amp;amp;" and "&amp;lt;" represent their corresponding
+     * characters ("&amp;" and "&lt;", respectively), not markup. Link elements MAY have a title attribute.
+     * 
+     * @param title The title attribute
+     */
+    Link setTitle(String title);
+
+    /**
+     * RFC4287: The "length" attribute indicates an advisory length of the linked content in octets; it is a hint about
+     * the content length of the representation returned when the URI in the href attribute is mapped to a IRI and
+     * dereferenced. Note that the length attribute does not override the actual content length of the representation as
+     * reported by the underlying protocol. Link elements MAY have a length attribute.
+     * 
+     * @return The length attribute value
+     */
+    long getLength();
+
+    /**
+     * RFC4287: The "length" attribute indicates an advisory length of the linked content in octets; it is a hint about
+     * the content length of the representation returned when the IRI in the href attribute is mapped to a URI and
+     * dereferenced. Note that the length attribute does not override the actual content length of the representation as
+     * reported by the underlying protocol. Link elements MAY have a length attribute.
+     * 
+     * @param length The length attribute value
+     */
+    Link setLength(long length);
+
+    public static class Helper {
+      
+      private Helper() {}
+      
+      public static final WebLink toWebLink(Link link) {
+        WebLink weblink = new WebLink(link.getResolvedHref());
+        weblink.addRel(link.getRel());
+        weblink.setAnchor(link.getResolvedBaseUri());
+        weblink.setMediaType(link.getMimeType());
+        weblink.setHrefLang(link.getHrefLang());
+        weblink.setTitle(link.getTitle());
+        return weblink;
+      }
+      
+      public static final Iterable<Link> fromWebLink(Abdera abdera, WebLink weblink) {
+        if (weblink == null) return Collections.emptyList();
+        List<Link> links = new ArrayList<Link>();
+        Iterable<String> rels = weblink.getRel();
+        for (String rel : rels) {
+          Link link = abdera.getFactory().newLink();
+          link.setHref(weblink.getIri());
+          link.setRel(rel);
+          if (weblink.getAnchor() != null)
+            link.setBaseUri(weblink.getAnchor());
+          if (weblink.getHrefLang() != null)
+            link.setHrefLang(weblink.getHrefLang().toString());
+          if (weblink.getMediaType() != null)
+            link.setMimeType(weblink.getMediaType().toString());
+          if (weblink.getTitle() != null)
+            link.setTitle(weblink.getTitle());
+          links.add(link);
+        }   
+        if (links.size() == 0) {
+          Link link = abdera.getFactory().newLink();
+          link.setHref(weblink.getIri());
+          links.add(link);
+          if (weblink.getAnchor() != null)
+            link.setBaseUri(weblink.getAnchor());
+          if (weblink.getHrefLang() != null)
+            link.setHrefLang(weblink.getHrefLang().toString());
+          if (weblink.getMediaType() != null)
+            link.setMimeType(weblink.getMediaType().toString());
+          if (weblink.getTitle() != null)
+            link.setTitle(weblink.getTitle());
+        }
+        return links;
+      }
+      
+      public static final String getRelEquiv(String val) {
+          try {
+              String nval = IRI.normalizeString(val);
+              if (nval.startsWith(IANA_BASE)) {
+                int n = nval.lastIndexOf('/');
+                return nval.substring(n+1).toLowerCase(Locale.US);
+              } else if (nval.indexOf('/') == 0) {
+                return String.format("%s%s", IANA_BASE, val.toLowerCase(Locale.US));
+              } else return val;
+          } catch (Exception e) {
+            return val;
+          }
+      }
+      
+    }
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Link.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Person.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Person.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Person.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Person.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,152 @@
+/*
+ * 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.iri.IRI;
+
+/**
+ * <p>
+ * An Atom Person Construct
+ * </p>
+ * <p>
+ * Per RFC4287:
+ * </p>
+ * 
+ * <pre>
+ *   A Person construct is an element that describes a person,
+ *   corporation, or similar entity (hereafter, 'person').
+ * 
+ *   atomPersonConstruct =
+ *     atomCommonAttributes,
+ *     (element atom:name { text }
+ *      &amp; element atom:uri { atomUri }?
+ *      &amp; element atom:email { atomEmailAddress }?
+ *      &amp; extensionElement*)
+ * 
+ * </pre>
+ */
+public interface Person extends ExtensibleElement, Element {
+
+    /**
+     * The "atom:name" element's content conveys a human-readable name for the person. The content of atom:name is
+     * Language-Sensitive. Person constructs MUST contain exactly one "atom:name" element.
+     * 
+     * @return The atom:name element
+     */
+    Element getNameElement();
+
+    /**
+     * The "atom:name" element's content conveys a human-readable name for the person. The content of atom:name is
+     * Language-Sensitive. Person constructs MUST contain exactly one "atom:name" element.
+     * 
+     * @param element The atom:name element
+     */
+    Person setNameElement(Element element);
+
+    /**
+     * The "atom:name" element's content conveys a human-readable name for the person. The content of atom:name is
+     * Language-Sensitive. Person constructs MUST contain exactly one "atom:name" element.
+     * 
+     * @param name The person name
+     * @return The newly created atom:name element
+     */
+    Element setName(String name);
+
+    /**
+     * The "atom:name" element's content conveys a human-readable name for the person. The content of atom:name is
+     * Language-Sensitive. Person constructs MUST contain exactly one "atom:name" element.
+     * 
+     * @return The name value
+     */
+    String getName();
+
+    /**
+     * The "atom:email" element's content conveys an e-mail address associated with the person. Person constructs MAY
+     * contain an atom:email element, but MUST NOT contain more than one. Its content MUST conform to the "addr-spec"
+     * production in [RFC2822].
+     * 
+     * @return the atom:email element
+     */
+    Element getEmailElement();
+
+    /**
+     * The "atom:email" element's content conveys an e-mail address associated with the person. Person constructs MAY
+     * contain an atom:email element, but MUST NOT contain more than one. Its content MUST conform to the "addr-spec"
+     * production in [RFC2822].
+     * 
+     * @param element The atom:email element
+     */
+    Person setEmailElement(Element element);
+
+    /**
+     * The "atom:email" element's content conveys an e-mail address associated with the person. Person constructs MAY
+     * contain an atom:email element, but MUST NOT contain more than one. Its content MUST conform to the "addr-spec"
+     * production in [RFC2822].
+     * 
+     * @param email The person email
+     * @return the newly created atom:email element
+     */
+    Element setEmail(String email);
+
+    /**
+     * The "atom:email" element's content conveys an e-mail address associated with the person. Person constructs MAY
+     * contain an atom:email element, but MUST NOT contain more than one. Its content MUST conform to the "addr-spec"
+     * production in [RFC2822].
+     * 
+     * @return the person's emali
+     */
+    String getEmail();
+
+    /**
+     * The "atom:uri" element's content conveys an IRI associated with the person. Person constructs MAY contain an
+     * atom:uri element, but MUST NOT contain more than one. The content of atom:uri in a Person construct MUST be an
+     * IRI reference [RFC3987].
+     * 
+     * @return the atom:uri element
+     */
+    IRIElement getUriElement();
+
+    /**
+     * The "atom:uri" element's content conveys an IRI associated with the person. Person constructs MAY contain an
+     * atom:uri element, but MUST NOT contain more than one. The content of atom:uri in a Person construct MUST be an
+     * IRI reference [RFC3987].
+     * 
+     * @param uri The atom:uri element
+     */
+    Person setUriElement(IRIElement uri);
+
+    /**
+     * The "atom:uri" element's content conveys an IRI associated with the person. Person constructs MAY contain an
+     * atom:uri element, but MUST NOT contain more than one. The content of atom:uri in a Person construct MUST be an
+     * IRI reference [RFC3987].
+     * 
+     * @param uri The atom:uri value
+     * @throws IRISyntaxException if the uri is malformed
+     */
+    IRIElement setUri(String uri);
+
+    /**
+     * The "atom:uri" element's content conveys an IRI associated with the person. Person constructs MAY contain an
+     * atom:uri element, but MUST NOT contain more than one. The content of atom:uri in a Person construct MUST be an
+     * IRI reference [RFC3987].
+     * 
+     * @return The atom:uri value
+     * @throws IRISyntaxException if the uri is invalid
+     */
+    IRI getUri();
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Person.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/PersonWrapper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/PersonWrapper.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/PersonWrapper.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/PersonWrapper.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,142 @@
+/*
+ * 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.common.Constants;
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.factory.Factory;
+
+/**
+ * ElementWrapper implementation that implements the Person interface. Used to create static extensions based on the
+ * Atom Person Construct
+ */
+public abstract class PersonWrapper extends ExtensibleElementWrapper implements Person, Constants {
+
+    protected PersonWrapper(Element internal) {
+        super(internal);
+    }
+
+    public PersonWrapper(Factory factory, QName qname) {
+        super(factory, qname);
+    }
+
+    public String getEmail() {
+        Element email = getEmailElement();
+        return (email != null) ? email.getText() : null;
+    }
+
+    public Element getEmailElement() {
+        return getInternal().getFirstChild(EMAIL);
+    }
+
+    public String getName() {
+        Element name = getNameElement();
+        return (name != null) ? name.getText() : null;
+    }
+
+    public Element getNameElement() {
+        return getInternal().getFirstChild(NAME);
+    }
+
+    public IRI getUri() {
+        IRIElement iri = getUriElement();
+        return (iri != null) ? iri.getResolvedValue() : null;
+    }
+
+    public IRIElement getUriElement() {
+        return getInternal().getFirstChild(URI);
+    }
+
+    public Element setEmail(String email) {
+        ExtensibleElement internal = getExtInternal();
+        Element el = getEmailElement();
+        if (email != null) {
+            if (el == null)
+                el = internal.getFactory().newEmail(internal);
+            el.setText(email);
+            return el;
+        } else {
+            if (el != null)
+                el.discard();
+            return null;
+        }
+    }
+
+    public Person setEmailElement(Element element) {
+        ExtensibleElement internal = getExtInternal();
+        Element el = getEmailElement();
+        if (el != null)
+            el.discard();
+        if (element != null)
+            internal.addExtension(element);
+        return this;
+    }
+
+    public Element setName(String name) {
+        ExtensibleElement internal = getExtInternal();
+        Element el = getNameElement();
+        if (name != null) {
+            if (el == null)
+                el = internal.getFactory().newName(internal);
+            el.setText(name);
+            return el;
+        } else {
+            if (el != null)
+                el.discard();
+            return null;
+        }
+    }
+
+    public Person setNameElement(Element element) {
+        ExtensibleElement internal = getExtInternal();
+        Element el = getNameElement();
+        if (el != null)
+            el.discard();
+        if (element != null)
+            internal.addExtension(element);
+        return this;
+    }
+
+    public IRIElement setUri(String uri) {
+        ExtensibleElement internal = getExtInternal();
+        IRIElement el = getUriElement();
+        if (uri != null) {
+            if (el == null)
+                el = internal.getFactory().newUri(internal);
+            el.setText(uri.toString());
+            return el;
+        } else {
+            if (el != null)
+                el.discard();
+            return null;
+        }
+    }
+
+    public Person setUriElement(IRIElement element) {
+        ExtensibleElement internal = getExtInternal();
+        Element el = getUriElement();
+        if (el != null)
+            el.discard();
+        if (element != null)
+            internal.addExtension(element);
+        return this;
+    }
+
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/PersonWrapper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ProcessingInstruction.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ProcessingInstruction.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ProcessingInstruction.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ProcessingInstruction.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,64 @@
+/*
+ * 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 processing instruction. Returned by the Abdera XPath implementation when querying for PI nodes (e.g.
+ * xpath.selectNodes("//processing-instruction()"); ...). There should be very little reason for applications to use
+ * this. It is provided to keep applications from having to deal with the underlying parser implementation
+ */
+public interface ProcessingInstruction {
+
+    /**
+     * Delete this PI
+     */
+    void discard();
+
+    /**
+     * The Abdera Factory
+     */
+    Factory getFactory();
+
+    /**
+     * The parent node
+     */
+    <T extends Base> T getParentElement();
+
+    /**
+     * The PI target
+     */
+    String getTarget();
+
+    /**
+     * The PI target
+     */
+    void setTarget(String target);
+
+    /**
+     * The PI text
+     */
+    String getText();
+
+    /**
+     * The PI text
+     */
+    <T extends ProcessingInstruction> T setText(String text);
+
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ProcessingInstruction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Service.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Service.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Service.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Service.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,129 @@
+/*
+ * 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_SERVICE;
+
+import java.util.List;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera2.common.anno.QName;
+import org.apache.abdera2.common.selector.Selector;
+
+/**
+ * <p>
+ * Represents the root of an Atom Publishing Protocol Introspection Document.
+ * </p>
+ * <p>
+ * Per APP Draft-08:
+ * </p>
+ * 
+ * <pre>
+ *  The root of an introspection document is the "app:service" element.
+ * 
+ *  The "app:service" element is the container for introspection
+ *  information associated with one or more workspaces.  An app:service
+ *  element MUST contain one or more app:workspace elements.
+ *  
+ *  appService =
+ *     element app:service {
+ *        appCommonAttributes,
+ *       ( appWorkspace+
+ *          &amp; extensionElement* )
+ *     }
+ * </pre>
+ */
+@QName(value=LN_SERVICE,ns=APP_NS)
+public interface Service extends ExtensibleElement {
+
+    /**
+     * Return the complete set of workspaces
+     * 
+     * @return A listing of app:workspaces elements
+     */
+    List<Workspace> getWorkspaces();
+    
+    List<Workspace> getWorkspaces(Selector selector);
+
+    /**
+     * Return the named workspace
+     * 
+     * @param title The workspace title
+     * @return A matching app:workspace
+     */
+    Workspace getWorkspace(String title);
+
+    /**
+     * Add an individual workspace
+     * 
+     * @param workspace a app:workspace element
+     */
+    Service addWorkspace(Workspace workspace);
+
+    /**
+     * Add an individual workspace
+     * 
+     * @param title The workspace title
+     * @return The newly created app:workspace
+     */
+    Workspace addWorkspace(String title);
+
+    /**
+     * Returns the named collection
+     * 
+     * @param workspace The workspace title
+     * @param collection The collection title
+     * @return A matching app:collection element
+     */
+    Collection getCollection(String workspace, String collection);
+
+    /**
+     * Returns a collection that accepts the specified media types
+     * 
+     * @param a listing of media types the collection must accept
+     * @return A matching app:collection element
+     */
+    Collection getCollectionThatAccepts(MimeType... type);
+
+    /**
+     * Returns a collection that accepts the specified media types
+     * 
+     * @param a listing of media types the collection must accept
+     * @return A matching app:collection element
+     */
+    Collection getCollectionThatAccepts(String... type);
+
+    /**
+     * Returns collections that accept the specified media types
+     * 
+     * @param a listing of media types the collection must accept
+     * @return A listing matching app:collection elements
+     */
+    List<Collection> getCollectionsThatAccept(MimeType... type);
+
+    /**
+     * Returns collections that accept the specified media types
+     * 
+     * @param a listing of media types the collection must accept
+     * @return A listing of matching app:collection elements
+     */
+    List<Collection> getCollectionsThatAccept(String... type);
+
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Service.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Source.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Source.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Source.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Source.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,751 @@
+/*
+ * 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_SOURCE;
+
+import java.util.Date;
+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;
+
+/**
+ * <p>
+ * Per RFC4287:
+ * </p>
+ * 
+ * <pre>
+ *  If an atom:entry is copied from one feed into another feed, then the
+ *  source atom:feed's metadata (all child elements of atom:feed other
+ *  than the atom:entry elements) MAY be preserved within the copied
+ *  entry by adding an atom:source child element, if it is not already
+ *  present in the entry, and including some or all of the source feed's
+ *  Metadata elements as the atom:source element's children.  Such
+ *  metadata SHOULD be preserved if the source atom:feed contains any of
+ *  the child elements atom:author, atom:contributor, atom:rights, or
+ *  atom:category and those child elements are not present in the source
+ *  atom:entry.
+ * 
+ *  atomSource =
+ *     element atom:source {
+ *        atomCommonAttributes,
+ *        (atomAuthor*
+ *         &amp; atomCategory*
+ *         &amp; atomContributor*
+ *         &amp; atomGenerator?
+ *         &amp; atomIcon?
+ *         &amp; atomId?
+ *         &amp; atomLink*
+ *         &amp; atomLogo?
+ *         &amp; atomRights?
+ *         &amp; atomSubtitle?
+ *         &amp; atomTitle?
+ *         &amp; atomUpdated?
+ *         &amp; extensionElement*)
+ *     }
+ * 
+ *  The atom:source element is designed to allow the aggregation of
+ *  entries from different feeds while retaining information about an
+ *  entry's source feed.  For this reason, Atom Processors that are
+ *  performing such aggregation SHOULD include at least the required
+ *  feed-level Metadata elements (atom:id, atom:title, and atom:updated)
+ *  in the atom:source element.
+ * </pre>
+ */
+@QName(value=LN_SOURCE,ns=ATOM_NS)
+public interface Source extends ExtensibleElement {
+    /**
+     * Returns the first author listed for the entry
+     * 
+     * @return This feed's author
+     */
+    Person getAuthor();
+
+    /**
+     * Returns the complete set of authors listed for the entry
+     * 
+     * @return This feeds list of authors
+     */
+    List<Person> getAuthors();
+    
+    List<Person> getAuthors(Selector selector);
+
+    /**
+     * Adds an individual author to the entry
+     * 
+     * @param person an atom:author element
+     */
+    <T extends Source> T addAuthor(Person person);
+
+    /**
+     * Adds an author
+     * 
+     * @param name The author name
+     * @return The newly created atom:author element
+     */
+    Person addAuthor(String name);
+
+    /**
+     * Adds an author
+     * 
+     * @param name The author name
+     * @param email The author email
+     * @param iri The author iri
+     * @return The newly created atom:author element
+     * @throws IRISyntaxException if the iri is malformed
+     */
+    Person addAuthor(String name, String email, String iri);
+
+    /**
+     * Lists the complete set of categories listed for the entry
+     * 
+     * @return A listing of app:category elements
+     */
+    List<Category> getCategories();
+
+    List<Category> getCategories(Selector selector);
+    
+    /**
+     * Lists the complete set of categories using the specified scheme
+     * 
+     * @param scheme A Scheme IRI
+     * @return The listing of app:category elements
+     * @throws IRISyntaxException if the scheme is malformed
+     */
+    List<Category> getCategories(String scheme);
+
+    /**
+     * Adds an individual category to the entry
+     * 
+     * @param category A atom:category element
+     */
+    <T extends Source> T addCategory(Category category);
+
+    /**
+     * Adds a category to the feed
+     * 
+     * @param term A category term
+     * @return The newly created atom:category element
+     */
+    Category addCategory(String term);
+
+    /**
+     * Adds a category to the feed
+     * 
+     * @param scheme A category scheme
+     * @param term A category term
+     * @param label The human readable label
+     * @return the newly created atom:category element
+     * @throws IRISyntaxException if the scheme is malformed
+     */
+    Category addCategory(String scheme, String term, String label);
+
+    /**
+     * Lists the complete set of contributors for this entry
+     * 
+     * @return A listing of atom:contributor elements
+     */
+    List<Person> getContributors();
+
+    List<Person> getContributors(Selector selector);
+    
+    /**
+     * Adds an individual contributor to this entry
+     * 
+     * @param person a atom:contributor element
+     */
+    <T extends Source> T addContributor(Person person);
+
+    /**
+     * Adds a contributor
+     * 
+     * @param name The name of a contributor
+     * @return The newly created atom:contributor element
+     */
+    Person addContributor(String name);
+
+    /**
+     * Adds a contributor
+     * 
+     * @param name The contributor name
+     * @param email The contributor email
+     * @param iri The contributor uri
+     * @return The atom:contributor element
+     * @throws IRISyntaxException if the iri is malformed
+     */
+    Person addContributor(String name, String email, String iri);
+
+    /**
+     * RFC4287: The "atom:generator" element's content identifies the agent used to generate a feed, for debugging and
+     * other purposes.
+     * 
+     * @return The atom:generator
+     */
+    Generator getGenerator();
+
+    /**
+     * RFC4287: The "atom:generator" element's content identifies the agent used to generate a feed, for debugging and
+     * other purposes.
+     * 
+     * @param generator A atom:generator element
+     */
+    <T extends Source> T setGenerator(Generator generator);
+
+    /**
+     * RFC4287: The "atom:generator" element's content identifies the agent used to generate a feed, for debugging and
+     * other purposes.
+     * 
+     * @param iri The iri attribute
+     * @param version The version attribute
+     * @param value The value attribute
+     * @return A newly created atom:generator element
+     * @throws IRISyntaxException if the iri is malformed
+     */
+    Generator setGenerator(String iri, String version, String value);
+
+    /**
+     * RFC4287: The "atom:icon" element's content is an IRI reference [RFC3987] that identifies an image that provides
+     * iconic visual identification for a feed... The image SHOULD have an aspect ratio of one (horizontal) to one
+     * (vertical) and SHOULD be suitable for presentation at a small size.
+     * 
+     * @return the atom:icon element
+     */
+    IRIElement getIconElement();
+
+    /**
+     * RFC4287: The "atom:icon" element's content is an IRI reference [RFC3987] that identifies an image that provides
+     * iconic visual identification for a feed... The image SHOULD have an aspect ratio of one (horizontal) to one
+     * (vertical) and SHOULD be suitable for presentation at a small size.
+     * 
+     * @param iri The atom:icon element
+     */
+    <T extends Source> T setIconElement(IRIElement iri);
+
+    /**
+     * RFC4287: The "atom:icon" element's content is an IRI reference [RFC3987] that identifies an image that provides
+     * iconic visual identification for a feed... The image SHOULD have an aspect ratio of one (horizontal) to one
+     * (vertical) and SHOULD be suitable for presentation at a small size.
+     * 
+     * @param iri The atom:icon IRI value
+     * @throws IRISyntaxException if the iri is malformed
+     */
+    IRIElement setIcon(String iri);
+
+    /**
+     * RFC4287: The "atom:icon" element's content is an IRI reference [RFC3987] that identifies an image that provides
+     * iconic visual identification for a feed... The image SHOULD have an aspect ratio of one (horizontal) to one
+     * (vertical) and SHOULD be suitable for presentation at a small size.
+     * 
+     * @return The atom:icon value
+     * @throws IRISyntaxException if the atom:icon value is malformed
+     */
+    IRI getIcon();
+
+    /**
+     * RFC4287: The "atom:id" element conveys a permanent, universally unique identifier for an entry or feed.
+     * 
+     * @return The atom:id element
+     */
+    IRIElement getIdElement();
+
+    /**
+     * RFC4287: The "atom:id" element conveys a permanent, universally unique identifier for an entry or feed.
+     * 
+     * @param id A atom:id element
+     */
+    <T extends Source> T setIdElement(IRIElement id);
+
+    /**
+     * Returns the universally unique identifier for this feed
+     * 
+     * @return The atom:id value
+     * @throws IRISyntaxException if the atom:id is malformed
+     */
+    IRI getId();
+
+    /**
+     * Sets the universally unique identifier for this feed
+     * 
+     * @param id The atom:id value
+     * @return The newly created atom:id element
+     * @throws IRISyntaxException if the id is malformed
+     */
+    IRIElement setId(String id);
+
+    /**
+     * Creates a new randomized atom:id for the entry
+     */
+    IRIElement newId();
+
+    /**
+     * Sets the universally unique identifier for this feed
+     * 
+     * @param id The atom:id value
+     * @param normalize True if the atom:id value should be normalized
+     * @return The newly created atom:id element
+     * @throws IRISyntaxException if the id is malformed
+     */
+    IRIElement setId(String id, boolean normalize);
+
+    /**
+     * Lists the complete set of links for this entry
+     * 
+     * @return returns a listing of atom:link elements
+     */
+    List<Link> getLinks();
+
+    List<Link> getLinks(Selector selector);
+    
+    /**
+     * Lists the complete set of links using the specified rel attribute value
+     * 
+     * @param rel A link relation
+     * @return A listing of atom:link elements
+     */
+    List<Link> getLinks(String rel);
+
+    /**
+     * Lists the complete set of links using the specified rel attributes values
+     * 
+     * @param rels A listing of link relations
+     * @return A listof atom:link elements
+     */
+    List<Link> getLinks(String... rel);
+
+    /**
+     * Adds an individual link to the entry
+     * 
+     * @param link A atom:link element
+     */
+    <T extends Source> T addLink(Link link);
+
+    /**
+     * Adds an individual link element
+     * 
+     * @param href The href IRI of the link
+     * @return The newly created atom:link
+     * @throws IRISyntaxException if the href is malformed
+     */
+    Link addLink(String href);
+
+    /**
+     * Adds an individual link element
+     * 
+     * @param href The href IRI of the link
+     * @param rel The link rel attribute
+     * @return The newly created atom:link
+     * @throws IRISyntaxException if the href is malformed
+     */
+    Link addLink(String href, String rel);
+
+    /**
+     * Adds an individual link element
+     * 
+     * @param href The href IRI of the link
+     * @param rel The link rel attribute
+     * @param type The link type attribute
+     * @param hreflang The link hreflang attribute
+     * @param length The length attribute
+     * @return The newly created atom:link
+     * @throws IRISyntaxException if the href is malformed
+     */
+    Link addLink(String href, String rel, String type, String title, String hreflang, long length);
+
+    /**
+     * RFC4287: The "atom:logo" element's content is an IRI reference [RFC3987] that identifies an image that provides
+     * visual identification for a feed. The image SHOULD have an aspect ratio of 2 (horizontal) to 1 (vertical).
+     * 
+     * @return the atom:logo element
+     */
+    IRIElement getLogoElement();
+
+    /**
+     * RFC4287: The "atom:logo" element's content is an IRI reference [RFC3987] that identifies an image that provides
+     * visual identification for a feed. The image SHOULD have an aspect ratio of 2 (horizontal) to 1 (vertical).
+     * 
+     * @param iri The atom:logo element
+     */
+    <T extends Source> T setLogoElement(IRIElement iri);
+
+    /**
+     * RFC4287: The "atom:logo" element's content is an IRI reference [RFC3987] that identifies an image that provides
+     * visual identification for a feed. The image SHOULD have an aspect ratio of 2 (horizontal) to 1 (vertical).
+     * 
+     * @param iri The atom:logo value
+     * @return The newly created atom:logo element
+     * @throws IRISyntaxException if the iri is malformed
+     */
+    IRIElement setLogo(String iri);
+
+    /**
+     * RFC4287: The "atom:logo" element's content is an IRI reference [RFC3987] that identifies an image that provides
+     * visual identification for a feed. The image SHOULD have an aspect ratio of 2 (horizontal) to 1 (vertical).
+     * 
+     * @return The atom:logo element value
+     * @throws IRISyntaxException if the atom:logo value is malformed
+     */
+    IRI getLogo();
+
+    /**
+     * <p>
+     * The rights element is typically used to convey a human readable copyright (e.g. "&lt;atom:rights>Copyright (c),
+     * 2006&lt;/atom:rights>).
+     * </p>
+     * <p>
+     * RFC4287: The "atom:rights" element is a Text construct that conveys information about rights held in and over an
+     * entry or feed.
+     * </p>
+     * 
+     * @return The atom:rights element
+     */
+    Text getRightsElement();
+
+    /**
+     * <p>
+     * The rights element is typically used to convey a human readable copyright (e.g. "&lt;atom:rights>Copyright (c),
+     * 2006&lt;/atom:rights>).
+     * </p>
+     * <p>
+     * RFC4287: The "atom:rights" element is a Text construct that conveys information about rights held in and over an
+     * entry or feed.
+     * </p>
+     * 
+     * @param text The atom:rights element
+     */
+    <T extends Source> T setRightsElement(Text text);
+
+    /**
+     * Sets the value of the rights as @type="text"
+     * 
+     * @param value The atom:rights text value
+     * @return The newly created atom:rights element
+     */
+    Text setRights(String value);
+
+    /**
+     * Sets the value of the rights as @type="html"
+     * 
+     * @param value The atom:rights text value
+     * @return The newly created atom:rights element
+     */
+    Text setRightsAsHtml(String value);
+
+    /**
+     * Sets the value of the rights as @type="xhtml"
+     * 
+     * @param value The atom:rights text value
+     * @return The newly created atom:rights element
+     */
+    Text setRightsAsXhtml(String value);
+
+    /**
+     * Sets the value of the rights
+     * 
+     * @param value The atom:rights text value
+     * @param type The atom:rights text type
+     * @return The newly created atom:rights element
+     */
+    Text setRights(String value, Text.Type type);
+
+    /**
+     * Sets the value of the rights as @type="xhtml"
+     * 
+     * @param value The XHTML div element
+     * @return The newly created atom:rights element
+     */
+    Text setRights(Div value);
+
+    /**
+     * Returns the text of atom:rights
+     * 
+     * @return The value of the atom:rights element
+     */
+    String getRights();
+
+    /**
+     * Returns the type of atom:rights
+     * 
+     * @return The Text.Type of the atom:rights element
+     */
+    Text.Type getRightsType();
+
+    /**
+     * RFC4287: The "atom:subtitle" element is a Text construct that conveys a human-readable description or subtitle
+     * for a feed.
+     * 
+     * @return The atom:subtitle element
+     */
+    Text getSubtitleElement();
+
+    /**
+     * RFC4287: The "atom:subtitle" element is a Text construct that conveys a human-readable description or subtitle
+     * for a feed.
+     * 
+     * @param text A atom:subtitle element
+     */
+    <T extends Source> T setSubtitleElement(Text text);
+
+    /**
+     * Sets the value of the subtitle as @type="text"
+     * 
+     * @param value the value of the atom:subtitle element
+     * @return The atom:subtitle element
+     */
+    Text setSubtitle(String value);
+
+    /**
+     * Sets the value of the subtitle as @type="html"
+     * 
+     * @param value The value of the atom:subtitle element
+     * @return The newly created atom:subtitle element
+     */
+    Text setSubtitleAsHtml(String value);
+
+    /**
+     * Sets the value of the subtitle as @type="xhtml"
+     * 
+     * @param value The value of the atom:subtitle element
+     * @return The newly created atom:subtitle element
+     */
+    Text setSubtitleAsXhtml(String value);
+
+    /**
+     * Sets the value of the subtitle
+     * 
+     * @param value The value of the atom:subtitle element
+     * @param type The atom:subtitle Text.Type
+     * @return The newly created atom:subtitle element
+     */
+    Text setSubtitle(String value, Text.Type type);
+
+    /**
+     * Sets the value of the subtitle as @type="xhtml"
+     * 
+     * @param value The atom:subtitle element
+     * @return The newly created atom:subtitle element
+     */
+    Text setSubtitle(Div value);
+
+    /**
+     * Returns the text value of atom:subtitle
+     * 
+     * @return The atom:subtitle text value
+     */
+    String getSubtitle();
+
+    /**
+     * Returns the atom:subtitle type
+     * 
+     * @return The atom:subtitle Text.Type
+     */
+    Text.Type getSubtitleType();
+
+    /**
+     * RFC4287: The "atom:title" element is a Text construct that conveys a human-readable title for an entry or feed.
+     * 
+     * @return The atom:title element
+     */
+    Text getTitleElement();
+
+    /**
+     * RFC4287: The "atom:title" element is a Text construct that conveys a human-readable title for an entry or feed.
+     * 
+     * @param text The atom:title element
+     */
+    <T extends Source> T setTitleElement(Text text);
+
+    /**
+     * Sets the value of the title as @type="text"
+     * 
+     * @param value The atom:title value
+     * @return The newly created atom:title element
+     */
+    Text setTitle(String value);
+
+    /**
+     * Sets the value of the title as @type="html"
+     * 
+     * @param value The atom:title value
+     * @return The newly created atom:title element
+     */
+    Text setTitleAsHtml(String value);
+
+    /**
+     * Sets the value of the title as @type="xhtml"
+     * 
+     * @param value The atom:title value
+     * @return The newly created atom:title element
+     */
+    Text setTitleAsXhtml(String value);
+
+    /**
+     * Sets the value of the title
+     * 
+     * @param value The atom:title value
+     * @param type The atom:title Text.Type
+     * @return The newly created atom:title element
+     */
+    Text setTitle(String value, Text.Type type);
+
+    /**
+     * Sets the value of the title as @type="xhtml"
+     * 
+     * @param value The XHTML div
+     * @return The newly created atom:title element
+     */
+    Text setTitle(Div value);
+
+    /**
+     * Returns the text of atom:title
+     * 
+     * @return The text value of the atom:title element
+     */
+    String getTitle();
+
+    /**
+     * Returns the type of atom:title
+     * 
+     * @return The atom:title Text.Type value
+     */
+    Text.Type getTitleType();
+
+    /**
+     * RFC4287: The "atom:updated" element is a Date construct indicating the most recent instant in time when an entry
+     * or feed was modified in a way the publisher considers significant. Therefore, not all modifications necessarily
+     * result in a changed atom:updated value.
+     * 
+     * @return the atom:updated element
+     */
+    DateTime getUpdatedElement();
+
+    /**
+     * RFC4287: The "atom:updated" element is a Date construct indicating the most recent instant in time when an entry
+     * or feed was modified in a way the publisher considers significant. Therefore, not all modifications necessarily
+     * result in a changed atom:updated value.
+     * 
+     * @param dateTime A atom:updated element
+     */
+    <T extends Source> T setUpdatedElement(DateTime dateTime);
+
+    /**
+     * Return the atom:updated value
+     * 
+     * @return The serialized string form value of atom:updated
+     */
+    String getUpdatedString();
+
+    /**
+     * Return the atom:updated value
+     * 
+     * @return The atom:updated as a java.util.Date
+     */
+    Date getUpdated();
+
+    /**
+     * Set the atom:updated value
+     * 
+     * @param value The java.util.Date
+     * @return The newly created atom:updated element
+     */
+    DateTime setUpdated(Date value);
+
+    /**
+     * Set the atom:updated value
+     * 
+     * @param value The serialized string date
+     * @return The newly created atom:updated element
+     */
+    DateTime setUpdated(String value);
+
+    /**
+     * Returns the first link with the specified rel attribute value
+     * 
+     * @param rel A link relation
+     * @return The newly created atom:link element
+     */
+    Link getLink(String rel);
+
+    /**
+     * Returns the first link using the rel attribute value "self"
+     * 
+     * @return An atom:link
+     */
+    Link getSelfLink();
+
+    /**
+     * Returns this entries first alternate link
+     * 
+     * @return An atom:link
+     */
+    Link getAlternateLink();
+
+    /**
+     * @param type A media type
+     * @param hreflang A target language
+     * @return A matching atom:link
+     * @throws MimeTypeParseException if the type if malformed
+     */
+    Link getAlternateLink(String type, String hreflang);
+
+    /**
+     * @param rel A link relation
+     * @return An atom:link
+     */
+    IRI getLinkResolvedHref(String rel);
+
+    /**
+     * @return An atom:link
+     */
+    IRI getSelfLinkResolvedHref();
+
+    /**
+     * @return An atom:link
+     */
+    IRI getAlternateLinkResolvedHref();
+
+    /**
+     * @param type A media type
+     * @param hreflang A target language
+     * @return A matching atom:link
+     * @throws MimeTypeParseException if the type if malformed
+     */
+    IRI getAlternateLinkResolvedHref(String type, String hreflang);
+
+    /**
+     * Return an app:collection element associatd with this atom:source. The Atom Publishing Protocol allows an
+     * app:collection to be contained by atom:feed to specify the collection to which the feed is associated.
+     * 
+     * @return An app:collection element
+     */
+    Collection getCollection();
+
+    /**
+     * Set the app:collection element
+     * 
+     * @param collection An app:collection element
+     */
+    <T extends Source> T setCollection(Collection collection);
+
+    /**
+     * Convert the Source element into an empty Feed element
+     */
+    Feed getAsFeed();
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Source.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Text.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Text.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Text.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Text.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,148 @@
+/*
+ * 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;
+
+/**
+ * <p>
+ * Represents an Atom Text Contruct.
+ * </p>
+ * <p>
+ * Atom allows three kinds of Text constructs:
+ * </p>
+ * <ul>
+ * <li>Text, consisting of content that is to be interpreted as plain text with no markup. For instance,
+ * <code>&lt;title type="text">&amp;lt;title&amp;gt;&lt;/title></code> is interpreted as literal characer "&lt;"
+ * followed by the word "content", followed by the literal character "&gt;".</li>
+ * <li>HTML, consisting of content that is to be interpreted as escaped HTML markup. For instance,
+ * <code>&lt;title type="html">&amp;lt;b&amp;gt;title&amp;lt;/b&amp;gt;&lt;/title></code> is interpreted as the word
+ * "content" surrounded by the HTML <code>&lt;b&gt;</code> and <code>&lt;/b&gt;</code> tags.</li>
+ * <li>XHTML, consisting of well-formed XHTML content wrapped in an XHTML div element. For instance,
+ * <code>&lt;title type="xhtml">&lt;div xmlns="http://www.w3.org/1999/xhtml">&lt;b>Title&lt;/b>&lt;/div>&lt;/title></code>
+ * .</li>
+ * </ul>
+ * <p>
+ * Per RFC4287:
+ * </p>
+ * 
+ * <pre>
+ *  A Text construct contains human-readable text, usually in small
+ *  quantities.  The content of Text constructs is Language-Sensitive.
+ * 
+ *  atomPlainTextConstruct =
+ *     atomCommonAttributes,
+ *     attribute type { "text" | "html" }?,
+ *     text
+ * 
+ *  atomXHTMLTextConstruct =
+ *     atomCommonAttributes,
+ *     attribute type { "xhtml" },
+ *     xhtmlDiv
+ * 
+ *  atomTextConstruct = atomPlainTextConstruct | atomXHTMLTextConstruct
+ * </pre>
+ */
+public interface Text extends Element {
+
+    /**
+     * Text Constructs can be either Text, HTML or XHTML
+     */
+    public static enum Type {
+        /** Plain Text **/
+        TEXT,
+        /** Escaped HTML **/
+        HTML,
+        /** Welformed XHTML **/
+        XHTML;
+        
+        /**
+         * Return the text type
+         */
+        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
+                    type = null;
+            }
+            return type;
+        }
+
+    };
+
+    /**
+     * Return the Text.Type
+     * 
+     * @return The Text.Type
+     */
+    Type getTextType();
+
+    /**
+     * Set the Text.Type
+     * 
+     * @param type The Text.Type
+     */
+    Text setTextType(Type type);
+
+    /**
+     * Return the text value element
+     * 
+     * @return A xhtml:div
+     */
+    Div getValueElement();
+
+    /**
+     * Set the text value element
+     * 
+     * @param value The xhtml:div
+     */
+    Text setValueElement(Div value);
+
+    /**
+     * Return the text value
+     * 
+     * @return The text value
+     */
+    String getValue();
+
+    /**
+     * Set the text value
+     * 
+     * @param value The text value
+     */
+    Text setValue(String value);
+
+    /**
+     * Return the wrapped value
+     * 
+     * @return The text value wrapped in a xhtml:div
+     */
+    String getWrappedValue();
+
+    /**
+     * Set the wrapped value
+     * 
+     * @param wrappedValue The text value wrapped in a xhtml:div
+     */
+    Text setWrappedValue(String wrappedValue);
+
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Text.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/TextValue.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/TextValue.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/TextValue.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/TextValue.java Tue Sep 20 15:56:46 2011
@@ -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.abdera2.model;
+
+import java.io.InputStream;
+
+import javax.activation.DataHandler;
+
+/**
+ * A text value. Returned by the Abdera XPath implementation when querying for text nodes (e.g.
+ * xpath.selectNodes("//text()"); ...). There should be very little reason why an application would use this. It is
+ * provided to keep applications from having to deal directly with the underlying parser impl
+ */
+public interface TextValue {
+
+    /**
+     * A DataHandler for Base64 encoded binary data
+     */
+    DataHandler getDataHandler();
+
+    /**
+     * An InputStream used to read the text content
+     */
+    InputStream getInputStream();
+
+    /**
+     * Return the text value
+     */
+    String getText();
+
+    /**
+     * The parent element
+     */
+    <T extends Base> T getParentElement();
+
+    /**
+     * Delete this node
+     */
+    void discard();
+
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/TextValue.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Workspace.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Workspace.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Workspace.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Workspace.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,170 @@
+/*
+ * 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_WORKSPACE;
+
+import java.util.List;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera2.common.anno.QName;
+import org.apache.abdera2.common.selector.Selector;
+
+/**
+ * <p>
+ * An Atom Publishing Protocol Introspection Document workspace element.
+ * </p>
+ * <p>
+ * Per APP Draft-08
+ * </p>
+ * 
+ * <pre>
+ *  The "app:workspace" element contains information elements about the
+ *  collections of resources available for editing.  The app:workspace
+ *  element MUST contain one or more app:collection elements.
+ * 
+ *  appWorkspace =
+ *     element app:workspace {
+ *        appCommonAttributes,
+ *        ( atomTitle
+ *          &amp; appCollection*
+ *          &amp; extensionElement* )
+ *     }
+ * 
+ * </pre>
+ */
+@QName(value=LN_WORKSPACE,ns=APP_NS)
+public interface Workspace extends ExtensibleElement {
+
+    /**
+     * Return the workspace title
+     * 
+     * @return The atom:title value
+     */
+    String getTitle();
+
+    /**
+     * Set the workspace title
+     * 
+     * @param title The atom:title value
+     * @return The newly created atom:title
+     */
+    Text setTitle(String title);
+
+    /**
+     * Set the workspace title as escaped HTML
+     * 
+     * @param title The atom:title value
+     * @return The newly created atom:title
+     */
+    Text setTitleAsHtml(String title);
+
+    /**
+     * Set the workspace title as XHTML
+     * 
+     * @param title The atom:title value
+     * @return the newly created atom:title
+     */
+    Text setTitleAsXHtml(String title);
+
+    /**
+     * Return the atom:title
+     * 
+     * @return The atom:title element
+     */
+    Text getTitleElement();
+
+    /**
+     * Returns the full set of collections in this workspace
+     * 
+     * @return A listing of app:collection elements
+     */
+    List<Collection> getCollections();
+    
+    List<Collection> getCollections(Selector selector);
+
+    /**
+     * Returns the named collection
+     * 
+     * @param title A collection title
+     * @return A matching app:collection
+     */
+    Collection getCollection(String title);
+
+    /**
+     * Adds an individual collection to this workspace
+     * 
+     * @param collection The collection to add
+     */
+    Workspace addCollection(Collection collection);
+
+    /**
+     * Adds an individual collection to this workspace
+     * 
+     * @param title The collection title
+     * @param href The collection HREF
+     * @return The newly created app:collection
+     * @throws IRISyntaxException if the href is malformed
+     */
+    Collection addCollection(String title, String href);
+
+    /**
+     * Adds a multipart collection to this workspace
+     * 
+     * @param title The collection title
+     * @param href The collection HREF
+     * @return The newly created app:collection
+     * @throws IRISyntaxException if the href is malformed
+     */
+    public Collection addMultipartCollection(String title, String href);
+
+    /**
+     * Returns a collection that accepts the specified media types
+     * 
+     * @param a listing of media types the collection must accept
+     * @return A matching app:collection element
+     */
+    Collection getCollectionThatAccepts(MimeType... type);
+
+    /**
+     * Returns a collection that accepts the specified media types
+     * 
+     * @param a listing of media types the collection must accept
+     * @return A matching app:collection element
+     */
+    Collection getCollectionThatAccepts(String... type);
+
+    /**
+     * Returns collections that accept the specified media types
+     * 
+     * @param a listing of media types the collection must accept
+     * @return A listing matching app:collection elements
+     */
+    List<Collection> getCollectionsThatAccept(MimeType... type);
+
+    /**
+     * Returns collections that accept the specified media types
+     * 
+     * @param a listing of media types the collection must accept
+     * @return A listing of matching app:collection elements
+     */
+    List<Collection> getCollectionsThatAccept(String... type);
+
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Workspace.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message