abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1173209 [19/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/Document.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Document.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Document.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Document.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,189 @@
+/*
+ * 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.Serializable;
+import java.util.Date;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.lang.Lang;
+import org.apache.abdera2.common.xml.XMLVersion;
+import org.apache.abdera2.common.http.EntityTag;
+
+/**
+ * <p>
+ * The top level artifact of the Feed Object Model. The Parser component processes data from an InputStream and returns
+ * a Document instance. The type of Document returned depends on the XML format being parsed. The Feed Object Model
+ * supports four basic types of documents: FeedDocument, EntryDocument, ServiceDocument (Atom Publishing Protocol
+ * Introspection Documents) and XmlDocument (any arbitrary XML).
+ * </p>
+ */
+public interface Document<T extends Element> extends Base, Serializable {
+
+    /**
+     * Returns the root element of the document (equivalent to DOM's getDocumentElement)
+     * 
+     * @return The root element of the document
+     */
+    T getRoot();
+
+    /**
+     * Sets the root element of the document
+     * 
+     * @param root Set the root element of the document
+     */
+    Document<T> setRoot(T root);
+
+    /**
+     * Returns the Base URI of the document. All relative URI's contained in the document will be resolved according to
+     * this base.
+     * 
+     * @return The Base IRI
+     */
+    IRI getBaseUri();
+
+    /**
+     * Sets the Base URI of the document. All relative URI's contained in the document will be resolved according to
+     * this base.
+     * 
+     * @param base The Base URI
+     * @throws IRISyntaxException if the IRI is malformed
+     */
+    Document<T> setBaseUri(String base);
+
+    /**
+     * Returns the content type of this document
+     * 
+     * @return The content type of this document
+     */
+    MimeType getContentType();
+
+    /**
+     * Sets the content type for this document
+     * 
+     * @param contentType The content type of document
+     * @throws MimeTypeParseException if the content type is malformed
+     */
+    Document<T> setContentType(String contentType);
+
+    /**
+     * Returns the last modified date for this document
+     * 
+     * @return The last-modified date
+     */
+    Date getLastModified();
+
+    /**
+     * Sets the last modified date for this document
+     * 
+     * @param lastModified the last-modified date
+     */
+    Document<T> setLastModified(Date lastModified);
+
+    /**
+     * Gets the charset used for this document
+     * 
+     * @return The character encoding used for this document
+     */
+    String getCharset();
+
+    /**
+     * Sets the charset used for this document
+     * 
+     * @param charset The character encoding to use
+     */
+    Document<T> setCharset(String charset);
+
+    /**
+     * Add a processing instruction to the document
+     * 
+     * @param target The processing instruction target
+     * @param value The processing instruction value
+     */
+    Document<T> addProcessingInstruction(String target, String value);
+
+    /**
+     * Get the values for the given processing instruction
+     */
+    String[] getProcessingInstruction(String target);
+
+    /**
+     * Add a xml-stylesheet processing instruction to the document
+     * 
+     * @param href The href of the stylesheet
+     * @param media The media target for this stylesheet or null if none
+     */
+    Document<T> addStylesheet(String href, String media);
+
+    /**
+     * Return the entity tag for this document
+     */
+    EntityTag getEntityTag();
+
+    /**
+     * Set the entity tag for this document
+     */
+    Document<T> setEntityTag(EntityTag tag);
+
+    /**
+     * Set the entity tag for this document
+     */
+    Document<T> setEntityTag(String tag);
+
+    /**
+     * Get the language
+     */
+    String getLanguage();
+
+    /**
+     * Returns the value of the xml:lang attribute as a Lang object
+     */
+    Lang getLanguageTag();
+
+    /**
+     * set the base language
+     */
+    Document<T> setLanguage(String lang);
+
+    /**
+     * Get the slug for this document
+     */
+    String getSlug();
+
+    /**
+     * Set the slug for this document
+     */
+    Document<T> setSlug(String slug);
+
+    /**
+     * Return true if insignificant whitespace must be preserved
+     */
+    boolean getMustPreserveWhitespace();
+
+    /**
+     * Set to true to preserve insignificant whitespace
+     */
+    Document<T> setMustPreserveWhitespace(boolean preserve);
+
+    /**
+     * Get the XMLVersion used by this document
+     */
+    XMLVersion getXmlVersion();
+}

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

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Element.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Element.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Element.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Element.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,328 @@
+/*
+ * 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 java.util.Locale;
+import java.util.Map;
+
+import javax.activation.DataHandler;
+import javax.activation.MimeType;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.iri.IRISyntaxException;
+import org.apache.abdera2.common.lang.Lang;
+import org.apache.abdera2.common.selector.Selector;
+
+/**
+ * Root interface for all elements in the Feed Object Model
+ */
+public interface Element extends Base, Iterable<Element> {
+
+    /**
+     * Return this Element's parent element or document
+     * 
+     * @return The parent
+     */
+    <T extends Base> T getParentElement();
+
+    /**
+     * Set this Element's parent element
+     * 
+     * @param parent The parent element
+     */
+    <T extends Element> T setParentElement(Element parent);
+
+    /**
+     * Get the element preceding this one
+     * 
+     * @return The preceding sibling
+     */
+    <T extends Element> T getPreviousSibling();
+
+    /**
+     * Get the element following this one
+     * 
+     * @return The following sibling
+     */
+    <T extends Element> T getNextSibling();
+
+    /**
+     * Get the first child element
+     * 
+     * @return The first child
+     */
+    <T extends Element> T getFirstChild();
+
+    /**
+     * Get the first previous sibling with the specified QName
+     * 
+     * @param qname The XML QName of the sibling to find
+     * @return The matching element
+     */
+    <T extends Element> T getPreviousSibling(QName qname);
+
+    /**
+     * Get the first following sibling with the specified QName
+     * 
+     * @param qname The XML QName of the sibling to find
+     * @return The matching element
+     */
+    <T extends Element> T getNextSibling(QName qname);
+
+    /**
+     * Get the first child element with the given QName
+     * 
+     * @param qname The XML QName of the sibling to find
+     * @return The matching element
+     */
+    <T extends Element> T getFirstChild(QName qname);
+
+    /**
+     * Return the XML QName of this element
+     * 
+     * @return The QName of the element
+     */
+    QName getQName();
+
+    /**
+     * Returns the value of this elements <code>xml:lang</code> attribute or null if <code>xml:lang</code> is undefined.
+     * 
+     * @return The xml:lang value
+     */
+    String getLanguage();
+
+    /**
+     * Returns the value of the xml:lang attribute as a Lang object
+     */
+    Lang getLanguageTag();
+
+    /**
+     * Returns a Locale object created from the <code>xml:lang</code> attribute
+     * 
+     * @return A Locale appropriate for the Language (xml:lang)
+     */
+    Locale getLocale();
+
+    /**
+     * Sets the value of this elements <code>xml:lang</code> attribute.
+     * 
+     * @param language the value of the xml:lang element
+     */
+    <T extends Element> T setLanguage(String language);
+
+    /**
+     * Returns the value of this element's <code>xml:base</code> attribute or null if <code>xml:base</code> is
+     * undefined.
+     * 
+     * @return The Base URI
+     * @throws IRISyntaxException if the Base URI is malformed
+     */
+    IRI getBaseUri();
+
+    /**
+     * Returns the current in-scope, fully qualified Base URI for this element.
+     * 
+     * @throws IRISyntaxException if the Base URI is malformed
+     */
+    IRI getResolvedBaseUri();
+
+    /**
+     * Sets the value of this element's <code>xml:base</code> attribute.
+     * 
+     * @param base The IRI base value
+     */
+    <T extends Element> T setBaseUri(IRI base);
+
+    /**
+     * Sets the value of this element's <code>xml:base</code> attribute.
+     * 
+     * @param base The Base IRI
+     * @throws IRISyntaxException if the base URI is malformed
+     */
+    <T extends Element> T setBaseUri(String base);
+
+    /**
+     * Returns the document to which this element belongs
+     * 
+     * @return The Document to which this element belongs
+     */
+    <T extends Element> Document<T> getDocument();
+
+    /**
+     * Returns the value of the named attribute
+     * 
+     * @param name The name of the attribute
+     * @return The value of the attribute
+     */
+    String getAttributeValue(String name);
+
+    /**
+     * Returns the value of the named attribute
+     * 
+     * @param qname The XML QName of the attribute
+     * @return The value of the attribute
+     */
+    String getAttributeValue(QName qname);
+
+    /**
+     * Returns a listing of all attributes on this element
+     * 
+     * @return The listing of attributes for this element
+     */
+    List<QName> getAttributes();
+
+    /**
+     * Returns a listing of extension attributes on this element (extension attributes are attributes whose namespace
+     * URI is different than the elements)
+     * 
+     * @return The listing non-Atom attributes
+     */
+    List<QName> getExtensionAttributes();
+
+    /**
+     * Remove the named Attribute
+     * 
+     * @param qname The XML QName of the attribute to remove
+     */
+    <T extends Element> T removeAttribute(QName qname);
+
+    /**
+     * Remove the named attribute
+     * 
+     * @param name The name of the attribute to remove
+     */
+    <T extends Element> T removeAttribute(String name);
+
+    /**
+     * Sets the value of the named attribute
+     * 
+     * @param name The name of the attribute
+     * @param value The value of the attribute
+     */
+    <T extends Element> T setAttributeValue(String name, String value);
+
+    /**
+     * Sets the value of the named attribute
+     * 
+     * @param qname The XML QName of the attribute
+     * @param value The value of the attribute
+     */
+    <T extends Element> T setAttributeValue(QName qname, String value);
+
+    /**
+     * Removes this element from its current document
+     */
+    void discard();
+
+    /**
+     * Returns the Text value of this element
+     * 
+     * @return The text value
+     */
+    String getText();
+
+    /**
+     * Set the Text value of this element
+     * 
+     * @param text The text value
+     */
+    void setText(String text);
+
+    /**
+     * Set the Text value of this element using the data handler
+     */
+    <T extends Element> T setText(DataHandler dataHandler);
+
+    /**
+     * Declare a namespace
+     */
+    <T extends Element> T declareNS(String uri, String prefix);
+
+    /**
+     * Return a map listing the xml namespaces declared for this element
+     */
+    Map<String, String> getNamespaces();
+
+    /**
+     * Return a listing of this elements child elements
+     */
+    <T extends Element> List<T> getElements();
+
+    <T extends Element> List<T> getElements(Selector selector);
+    
+    /**
+     * Return true if insignificant whitespace must be preserved
+     */
+    boolean getMustPreserveWhitespace();
+
+    /**
+     * Set to true to preserve insignificant whitespace
+     */
+    <T extends Element> T setMustPreserveWhitespace(boolean preserve);
+    
+    /**
+     * Returns true if this element has a child element or attribute
+     * with the given QName
+     */
+    boolean has(QName qname);
+    
+    /**
+     * Returns true if this element has an attribute with the given name
+     */
+    boolean hasAttribute(String name);
+    
+    public static final class Helper {
+      private Helper() {}
+
+      /**
+       * Returns the appropriate media type for the given Abdera base
+       */
+      public static <T extends Base> String getMimeType(T base) {
+          if (base == null) return null;
+          String type = null;
+          if (base instanceof Document) {
+              Document<?> doc = (Document<?>)base;
+              MimeType mt = doc.getContentType();
+              type = (mt != null) ? mt.toString() : getMimeType(doc.getRoot());
+          } else if (base instanceof Element) {
+              Element el = (Element)base;
+              if (el.getDocument() != null) {
+                  MimeType mt = el.getDocument().getContentType();
+                  type = (mt != null) ? mt.toString() : null;
+              }
+              if (type == null) {
+                  if (el instanceof Feed)
+                      type = Constants.FEED_MEDIA_TYPE;
+                  else if (el instanceof Entry)
+                      type = Constants.ENTRY_MEDIA_TYPE;
+                  else if (el instanceof Service)
+                      type = Constants.APP_MEDIA_TYPE;
+                  else if (el instanceof Categories)
+                      type = Constants.CAT_MEDIA_TYPE;
+              }
+          }
+          if (type == null)
+              type = base.getFactory().getMimeType(base);
+          return (type != null) ? type : Constants.XML_MEDIA_TYPE;
+      }
+      
+    }
+}

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

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementIterator.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementIterator.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementIterator.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementIterator.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,91 @@
+/*
+ * 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 javax.xml.namespace.QName;
+
+
+public class ElementIterator<T extends Element> implements Iterator<T> {
+
+    /**
+     * Field givenQName
+     */
+    protected QName attribute = null;
+    protected String value = null;
+    protected String defaultValue = null;
+    
+    protected final Class<?> _class;
+    protected final Iterator<?> children;
+    protected Element currentChild = null;
+
+    /**
+     * Constructor OMChildrenQNameIterator.
+     * 
+     * @param currentChild
+     * @param givenQName
+     */
+    public ElementIterator(Element parent, Class<?> _class) {
+        this.children = parent.iterator();
+        this._class = _class;
+    }
+
+    public ElementIterator(Element parent, Class<?> _class, QName attribute, String value, String defaultValue) {
+        this(parent, _class);
+        this.attribute = attribute;
+        this.value = value;
+        this.defaultValue = defaultValue;
+        this.currentChild = getNext();
+    }
+
+    private Element getNext() {
+      while (children.hasNext()) {
+        Object child = children.next();
+        if (child instanceof Element && ((_class != null && _class.isAssignableFrom(child.getClass())) || _class == null) && isMatch((Element)child)) {
+          return (Element)child;
+        }
+      }
+      return null;
+    }
+    
+    public boolean hasNext() {
+      return this.currentChild != null;
+    }
+
+    @SuppressWarnings("unchecked")
+    public T next() {
+      if (currentChild == null) return null;
+      Element child = currentChild;
+      currentChild = getNext();
+      return (T)child;
+    }
+
+    protected boolean isMatch(Element el) {
+        if (attribute != null) {
+            String val = el.getAttributeValue(attribute);
+            return ((val == null && value == null) || (val == null && value != null && value.equals(defaultValue)) || (val != null && val
+                .equals(value)));
+        }
+        return true;
+    }
+
+    public void remove() {
+      throw new UnsupportedOperationException();
+    }
+}

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

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementIteratorWrapper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementIteratorWrapper.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementIteratorWrapper.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementIteratorWrapper.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,67 @@
+/*
+ * 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;
+
+public class ElementIteratorWrapper<T extends Element> implements Iterator<T> {
+
+    private final Iterator<?> iterator;
+    private final Selector selector;
+    private final Factory factory;
+    private T current;
+
+    public ElementIteratorWrapper(Factory factory, Iterator<?> iterator) {
+      this(factory,iterator,null);
+    }
+    
+    public ElementIteratorWrapper(Factory factory, Iterator<?> iterator, Selector selector) {
+        this.iterator = iterator;
+        this.selector = selector;
+        this.factory = factory;
+        current = get_current();
+    }
+
+    @SuppressWarnings("unchecked")
+    private T get_current() {
+      while(iterator.hasNext()) {
+        T item = (T) iterator.next();
+        if (selector == null || selector.select(item))
+          return item;
+      }
+      return null;
+    }
+    
+    public boolean hasNext() {
+        return current != null;
+    }
+
+    public T next() {
+      T item = current;
+      current = get_current();
+      return factory.getElementWrapper(item);
+    }
+
+    public void remove() {
+        iterator.remove();
+    }
+
+}

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

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementList.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementList.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementList.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementList.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,240 @@
+/*
+ * 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.AbstractCollection;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+
+/**
+ * Implements the List interface around an internal buffered iterator. Here's the rationale: Axiom parses incrementally.
+ * Using the iterators provided by Axiom, we can walk a set of elements while preserving the incremental parsing model,
+ * however, if we went with just java.util.Iterator, we'd lose the ability to do things like feed.getEntries().get(0),
+ * or use the new Java5 style iterators for (Entry e : feed.getEntries()). However, using a regular java.util.List also
+ * isn't a great option because it means we have to iterate through all of the elements before returning back to the
+ * caller. This gives us a hybrid approach. We create an internal iterator, then create a List from that, the iterator
+ * is consumed as the list is used. The List itself is unmodifiable.
+ */
+@SuppressWarnings("unchecked")
+public class ElementList<T extends Element> extends AbstractCollection<T> implements List<T> {
+
+    private final Iterator<T> i;
+    private final List<T> buffer = new ArrayList<T>();
+
+    public ElementList(Iterator<T> i) {
+        this.i = i;
+    }
+    
+    public List<T> getAsList() {
+        buffer(-1);
+        return java.util.Collections.unmodifiableList(buffer);
+    }
+
+    private boolean finished() {
+        return !i.hasNext();
+    }
+
+    private int buffered() {
+        return buffer.size() - 1;
+    }
+
+    private int buffer(int n) {
+        if (i.hasNext()) {
+            int read = 0;
+            while (i.hasNext() && (read++ < n || n == -1)) {
+                buffer.add(i.next());
+            }
+        }
+        return buffered();
+    }
+
+    public T get(int index) {
+        int n = buffered();
+        if (index > n && (index > buffer(index - n)))
+            throw new ArrayIndexOutOfBoundsException(index);
+        return (T)buffer.get(index);
+    }
+
+    public int size() {
+        return buffer(-1) + 1;
+    }
+
+    public Iterator<T> iterator() {
+        return new BufferIterator<T>(this);
+    }
+
+    private Iterator<T> iterator(int index) {
+        return new BufferIterator<T>(this, index);
+    }
+
+    public boolean add(T o) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void add(int index, T element) {
+        throw new UnsupportedOperationException();
+    }
+
+    @SuppressWarnings("rawtypes")
+    public boolean addAll(Collection c) {
+        throw new UnsupportedOperationException();
+    }
+
+    @SuppressWarnings("rawtypes")
+    public boolean addAll(int index, Collection c) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void clear() {
+        throw new UnsupportedOperationException();
+    }
+
+    public boolean contains(Object o) {
+        buffer(-1);
+        return buffer.contains(o);
+    }
+
+    @SuppressWarnings("rawtypes")
+    public boolean containsAll(Collection c) {
+        for (Object o : c)
+            if (contains(o))
+                return true;
+        return false;
+    }
+
+    public int indexOf(Object o) {
+        buffer(-1);
+        return buffer.indexOf(o);
+    }
+
+    public boolean isEmpty() {
+        buffer(-1);
+        return buffer.isEmpty();
+    }
+
+    public int lastIndexOf(Object o) {
+        buffer(-1);
+        return buffer.lastIndexOf(o);
+    }
+
+    public ListIterator<T> listIterator() {
+        return (ListIterator<T>)iterator();
+    }
+
+    public ListIterator<T> listIterator(int index) {
+        return (ListIterator<T>)iterator(index);
+    }
+
+    public boolean remove(Object o) {
+        throw new UnsupportedOperationException();
+    }
+
+    public T remove(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    public boolean removeAll(Collection<?> c) {
+        throw new UnsupportedOperationException();
+    }
+
+    public boolean retainAll(Collection<?> c) {
+        throw new UnsupportedOperationException();
+    }
+
+    public T set(int index, T element) {
+        throw new UnsupportedOperationException();
+    }
+
+    public List<T> subList(int fromIndex, int toIndex) {
+        buffer(-1);
+        return Collections.unmodifiableList(buffer.subList(fromIndex, toIndex));
+    }
+
+    public Object[] toArray() {
+        buffer(-1);
+        return buffer.toArray();
+    }
+
+    public Object[] toArray(Object[] a) {
+        buffer(-1);
+        return buffer.toArray(a);
+    }
+
+    private class BufferIterator<M extends Element> implements ListIterator<M> {
+
+        private ElementList<M> set = null;
+        private int counter = 0;
+
+        BufferIterator(ElementList<M> set) {
+            this.set = set;
+        }
+
+        BufferIterator(ElementList<M> set, int index) {
+            this.set = set;
+            this.counter = index;
+        }
+
+        public boolean hasNext() {
+            return (!set.finished()) || (set.finished() && counter < buffer.size());
+        }
+
+        public M next() {
+            return (M)set.get(counter++);
+        }
+
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+
+        public void add(M o) {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean hasPrevious() {
+            return counter > 0;
+        }
+
+        public int nextIndex() {
+            if (hasNext())
+                return counter + 1;
+            else
+                return buffer.size();
+        }
+
+        public M previous() {
+            return (M)set.get(--counter);
+        }
+
+        public int previousIndex() {
+            if (hasPrevious())
+                return counter - 1;
+            else
+                return -1;
+        }
+
+        public void set(M o) {
+            throw new UnsupportedOperationException();
+        }
+
+    }
+}

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

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementWrapper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementWrapper.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementWrapper.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementWrapper.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,316 @@
+/*
+ * 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 java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.lang.Lang;
+import org.apache.abdera2.common.selector.Selector;
+import org.apache.abdera2.factory.Factory;
+import org.apache.abdera2.writer.WriterOptions;
+
+/**
+ * Base implementation used for static extensions.
+ */
+@SuppressWarnings("unchecked")
+public abstract class ElementWrapper implements Element {
+
+    private Element internal;
+
+    protected ElementWrapper(Element internal) {
+        this.internal = internal;
+    }
+
+    protected ElementWrapper(Factory factory, QName qname) {
+        Element el = factory.newElement(qname);
+        internal = (el instanceof ElementWrapper) ? ((ElementWrapper)el).getInternal() : el;
+    }
+
+    public <T extends Base> T addComment(String value) {
+        internal.addComment(value);
+        return (T)this;
+    }
+
+    public Object clone() {
+        try {
+            ElementWrapper wrapper = (ElementWrapper)super.clone();
+            wrapper.internal = (Element)internal.clone();
+            return wrapper;
+        } catch (CloneNotSupportedException e) {
+            // won't happen
+            return null;
+        }
+    }
+
+    public <T extends Element> T declareNS(String uri, String prefix) {
+        internal.declareNS(uri, prefix);
+        return (T)this;
+    }
+
+    public void discard() {
+        internal.discard();
+    }
+
+    public List<QName> getAttributes() {
+        return internal.getAttributes();
+    }
+
+    public String getAttributeValue(QName qname) {
+        return internal.getAttributeValue(qname);
+    }
+
+    public String getAttributeValue(String name) {
+        return internal.getAttributeValue(name);
+    }
+
+    public IRI getBaseUri() {
+        return internal.getBaseUri();
+    }
+
+    public <T extends Element> Document<T> getDocument() {
+        return internal.getDocument();
+    }
+
+    public List<QName> getExtensionAttributes() {
+        return internal.getExtensionAttributes();
+    }
+
+    public Factory getFactory() {
+        return internal.getFactory();
+    }
+
+    public <T extends Element> T getFirstChild() {
+        return (T)internal.getFirstChild();
+    }
+
+    public <T extends Element> T getFirstChild(QName qname) {
+        return (T)internal.getFirstChild(qname);
+    }
+
+    public String getLanguage() {
+        return internal.getLanguage();
+    }
+
+    public Lang getLanguageTag() {
+        return internal.getLanguageTag();
+    }
+
+    public Locale getLocale() {
+        return internal.getLocale();
+    }
+
+    public <T extends Element> T getNextSibling() {
+        return (T)internal.getNextSibling();
+    }
+
+    public <T extends Element> T getNextSibling(QName qname) {
+        return (T)internal.getNextSibling(qname);
+    }
+
+    public <T extends Base> T getParentElement() {
+        return (T)internal.getParentElement();
+    }
+
+    public <T extends Element> T getPreviousSibling() {
+        return (T)internal.getPreviousSibling();
+    }
+
+    public <T extends Element> T getPreviousSibling(QName qname) {
+        return (T)internal.getPreviousSibling(qname);
+    }
+
+    public QName getQName() {
+        return internal.getQName();
+    }
+
+    public IRI getResolvedBaseUri() {
+        return internal.getResolvedBaseUri();
+    }
+
+    public String getText() {
+        return internal.getText();
+    }
+
+    public <T extends Element> T removeAttribute(QName qname) {
+        internal.removeAttribute(qname);
+        return (T)this;
+    }
+
+    public <T extends Element> T removeAttribute(String name) {
+        internal.removeAttribute(name);
+        return (T)this;
+    }
+
+    public <T extends Element> T setAttributeValue(QName qname, String value) {
+        internal.setAttributeValue(qname, value);
+        return (T)this;
+    }
+
+    public <T extends Element> T setAttributeValue(String name, String value) {
+        internal.setAttributeValue(name, value);
+        return (T)this;
+    }
+
+    public <T extends Element> T setBaseUri(IRI base) {
+        internal.setBaseUri(base);
+        return (T)this;
+    }
+
+    public <T extends Element> T setBaseUri(String base) {
+        internal.setBaseUri(base);
+        return (T)this;
+    }
+
+    public <T extends Element> T setLanguage(String language) {
+        internal.setLanguage(language);
+        return (T)this;
+    }
+
+    public <T extends Element> T setParentElement(Element parent) {
+        internal.setParentElement(parent);
+        return (T)this;
+    }
+
+    public void setText(String text) {
+        internal.setText(text);
+    }
+
+    public <T extends Element> T setText(DataHandler handler) {
+        internal.setText(handler);
+        return (T)this;
+    }
+
+    public void writeTo(OutputStream out) throws IOException {
+        internal.writeTo(out);
+    }
+
+    public void writeTo(Writer writer) throws IOException {
+        internal.writeTo(writer);
+    }
+
+    public boolean equals(Object other) {
+        if (other instanceof ElementWrapper)
+            other = ((ElementWrapper)other).getInternal();
+        return internal.equals(other);
+    }
+
+    public String toString() {
+        return internal.toString();
+    }
+
+    public int hashCode() {
+        return internal.hashCode();
+    }
+
+    public Element getInternal() {
+        return internal;
+    }
+
+    public <T extends Element> List<T> getElements() {
+        return internal.getElements();
+    }
+    
+    public <T extends Element> List<T> getElements(Selector selector) {
+        return internal.getElements(selector);
+    }
+
+    public Map<String, String> getNamespaces() {
+        return internal.getNamespaces();
+    }
+
+    public boolean getMustPreserveWhitespace() {
+        return internal.getMustPreserveWhitespace();
+    }
+
+    public <T extends Element> T setMustPreserveWhitespace(boolean preserve) {
+        internal.setMustPreserveWhitespace(preserve);
+        return (T)this;
+    }
+
+    public void writeTo(OutputStream out, WriterOptions options) throws IOException {
+        internal.writeTo(out, options);
+    }
+
+    public void writeTo(org.apache.abdera2.writer.Writer writer, OutputStream out, WriterOptions options)
+        throws IOException {
+        internal.writeTo(writer, out, options);
+    }
+
+    public void writeTo(org.apache.abdera2.writer.Writer writer, OutputStream out) throws IOException {
+        internal.writeTo(writer, out);
+    }
+
+    public void writeTo(org.apache.abdera2.writer.Writer writer, Writer out, WriterOptions options) throws IOException {
+        internal.writeTo(writer, out, options);
+    }
+
+    public void writeTo(org.apache.abdera2.writer.Writer writer, Writer out) throws IOException {
+        internal.writeTo(writer, out);
+    }
+
+    public void writeTo(String writer, OutputStream out, WriterOptions options) throws IOException {
+        internal.writeTo(writer, out, options);
+    }
+
+    public void writeTo(String writer, OutputStream out) throws IOException {
+        internal.writeTo(writer, out);
+    }
+
+    public void writeTo(String writer, Writer out, WriterOptions options) throws IOException {
+        internal.writeTo(writer, out, options);
+    }
+
+    public void writeTo(String writer, Writer out) throws IOException {
+        internal.writeTo(writer, out);
+    }
+
+    public void writeTo(Writer out, WriterOptions options) throws IOException {
+        internal.writeTo(out, options);
+    }
+
+    public WriterOptions getDefaultWriterOptions() {
+        return internal.getDefaultWriterOptions();
+    }
+
+    public <T extends Base> T complete() {
+        internal.complete();
+        return (T)this;
+    }
+
+    public Iterator<Element> iterator() {
+        return internal.iterator();
+    }
+    
+    public boolean has(QName qname) {
+      return internal.has(qname);
+    }
+    
+    public boolean hasAttribute(String name) {
+      return internal.hasAttribute(name);
+    }
+}

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

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Entry.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Entry.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Entry.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Entry.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,1057 @@
+/*
+ * 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_ENTRY;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.List;
+
+import javax.activation.DataHandler;
+import javax.activation.MimeType;
+
+import org.apache.abdera2.common.anno.QName;
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.selector.Selector;
+
+/**
+ * <p>
+ * Represents an Atom Entry element.
+ * </p>
+ * <p>
+ * Per RFC4287:
+ * </p>
+ * 
+ * <pre>
+ * The "atom:entry" element represents an individual entry, acting as a
+ * container for metadata and data associated with the entry.  This
+ * element can appear as a child of the atom:feed element, or it can
+ * appear as the document (i.e., top-level) element of a stand-alone
+ * Atom Entry Document.
+ * 
+ * atomEntry =
+ *    element atom:entry {
+ *       atomCommonAttributes,
+ *       (atomAuthor*
+ *        &amp; atomCategory*
+ *        &amp; atomContent?
+ *        &amp; atomContributor*
+ *        &amp; atomId
+ *        &amp; atomLink*
+ *        &amp; atomPublished?
+ *        &amp; atomRights?
+ *        &amp; atomSource?
+ *        &amp; atomSummary?
+ *        &amp; atomTitle
+ *        &amp; atomUpdated
+ *        &amp; extensionElement*)
+ *    }
+ * 
+ * This specification assigns no significance to the order of appearance
+ * of the child elements of atom:entry.
+ * 
+ * The following child elements are defined by this specification (note
+ * that it requires the presence of some of these elements):
+ * 
+ * o  atom:entry elements MUST contain one or more atom:author elements,
+ *    unless the atom:entry contains an atom:source element that
+ *    contains an atom:author element or, in an Atom Feed Document, the
+ *    atom:feed element contains an atom:author element itself.
+ * o  atom:entry elements MAY contain any number of atom:category
+ *    elements.
+ * o  atom:entry elements MUST NOT contain more than one atom:content
+ *    element.
+ * o  atom:entry elements MAY contain any number of atom:contributor
+ *    elements.
+ * o  atom:entry elements MUST contain exactly one atom:id element.
+ * o  atom:entry elements that contain no child atom:content element
+ *    MUST contain at least one atom:link element with a rel attribute
+ *    value of "alternate".
+ * o  atom:entry 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:entry elements MAY contain additional atom:link elements
+ *    beyond those described above.
+ * o  atom:entry elements MUST NOT contain more than one atom:published
+ *    element.
+ * o  atom:entry elements MUST NOT contain more than one atom:rights
+ *    element.
+ * o  atom:entry elements MUST NOT contain more than one atom:source
+ *    element.
+ * o  atom:entry elements MUST contain an atom:summary element in either
+ *    of the following cases:
+ *    *  the atom:entry contains an atom:content that has a "src"
+ *       attribute (and is thus empty).
+ *    *  the atom:entry contains content that is encoded in Base64;
+ *       i.e., the "type" attribute of atom:content is a MIME media type
+ *       [MIMEREG], but is not an XML media type [RFC3023], does not
+ *       begin with "text/", and does not end with "/xml" or "+xml".
+ * o  atom:entry elements MUST NOT contain more than one atom:summary
+ *    element.
+ * o  atom:entry elements MUST contain exactly one atom:title element.
+ * o  atom:entry elements MUST contain exactly one atom:updated element.
+ * </pre>
+ */
+@QName(value=LN_ENTRY,ns=ATOM_NS)
+public interface Entry extends ExtensibleElement {
+
+    Person getAuthorInherited();
+    List<Person> getAuthorsInherited();
+    List<Person> getAuthorsInherited(Selector selector);
+  
+    /**
+     * Returns the first author listed for the entry
+     * 
+     * @return The atom:author
+     */
+    Person getAuthor();
+
+    /**
+     * Returns the complete set of authors listed for the entry
+     * 
+     * @return The listing of atom:author elements
+     */
+    List<Person> getAuthors();
+    
+    List<Person> getAuthors(Selector selector);
+
+    /**
+     * Adds an individual author to the entry
+     * 
+     * @param person The person to add
+     */
+    Entry addAuthor(Person person);
+
+    /**
+     * Adds an author
+     * 
+     * @param name The name of the author
+     * @return The newly created atom:author element
+     */
+    Person addAuthor(String name);
+
+    /**
+     * Adds an author
+     * 
+     * @param name The name of the author
+     * @param email The author's email address
+     * @param uri A URI belonging to the author
+     * @return The newly created atom:author element
+     * @throws IRISyntaxException if the URI is malformed
+     */
+    Person addAuthor(String name, String email, String uri);
+
+    /**
+     * Lists the complete set of categories listed for the entry
+     * 
+     * @return The listing of atom:category elements
+     */
+    List<Category> getCategories();
+
+    List<Category> getCategories(Selector selector);
+    
+    /**
+     * Lists the complete set of categories using the specified scheme A listing of atom:category elements using the
+     * specified scheme
+     * 
+     * @throws IRISyntaxException if the scheme is malformed
+     */
+    List<Category> getCategories(String scheme);
+
+    /**
+     * Adds an individual category to the entry
+     * 
+     * @param category The atom:category element to add
+     */
+    Entry addCategory(Category category);
+
+    /**
+     * Adds a category to the entry
+     * 
+     * @param term The category term to add
+     * @return The newly created atom:category
+     */
+    Category addCategory(String term);
+
+    /**
+     * Adds a category to the entry
+     * 
+     * @param scheme The category scheme
+     * @param term The category term
+     * @param label The human readable label
+     * @return The newly create atom:category
+     * @throws IRISyntaxException if the scheme is malformed
+     */
+    Category addCategory(String scheme, String term, String label);
+
+    /**
+     * Returns the content for this entry
+     * 
+     * @return The atom:content element
+     */
+    Content getContentElement();
+
+    /**
+     * Sets the content for this entry
+     * 
+     * @param content The atom:content element
+     */
+    Entry setContentElement(Content content);
+
+    /**
+     * Sets the content for this entry as @type="text"
+     * 
+     * @param value The text value of the content
+     * @return The newly created atom:content
+     */
+    Content setContent(String value);
+
+    /**
+     * Sets the content for this entry as @type="html"
+     * 
+     * @param value The text value of the content. Special characters will be escaped (e.g. &amp; will become &amp;amp;)
+     * @return The newly created atom:content
+     */
+    Content setContentAsHtml(String value);
+
+    /**
+     * Sets the content for this entry as @type="xhtml"
+     * 
+     * @param value The text value of the content. The text will be parsed as XHTML
+     * @return The newly created atom:content
+     */
+    Content setContentAsXhtml(String value);
+
+    /**
+     * Sets the content for this entry
+     * 
+     * @param value The text value of the content
+     * @param type The Content Type of the text
+     * @return The newly created atom:content
+     */
+    Content setContent(String value, Content.Type type);
+
+    /**
+     * Sets the content for this entry
+     * 
+     * @param value The content element value. If the value is a Div, the the type attribute will be set to
+     *            type="xhtml", otherwise type="application/xml"
+     * @return The newly create atom:content
+     */
+    Content setContent(Element value);
+
+    /**
+     * Sets the content for this entry
+     * 
+     * @param element The element value
+     * @param mediaType The media type of the element
+     * @throws MimeTypeParseException if the mediaType is malformed
+     */
+    Content setContent(Element element, String mediaType);
+
+    /**
+     * Sets the content for this entry
+     * 
+     * @param dataHandler The Data Handler containing the binary content needing Base64 encoding.
+     * @throws MimeTypeParseException if the media Type specified by the dataHandler is malformed
+     */
+    Content setContent(DataHandler dataHandler);
+
+    /**
+     * Sets the content for this entry
+     * 
+     * @param dataHandler The Data Handler containing the binary content needing Base64 encoding.
+     * @param mediaType The mediatype of the binary content
+     * @return The created content element
+     * @throws MimeTypeParseException if the media type specified is malformed
+     */
+    Content setContent(DataHandler dataHandler, String mediatype);
+
+    /**
+     * Sets the content for this entry
+     * 
+     * @param inputStream An inputstream providing binary content
+     * @return The created content element
+     */
+    Content setContent(InputStream inputStream);
+
+    /**
+     * Sets the content for this entry
+     * 
+     * @param inputStream An inputstream providing binary content
+     * @param mediaType The mediatype of the binary content
+     * @return The created content element
+     * @throws MimeTypeParseException if the media type specified is malformed
+     */
+    Content setContent(InputStream inputStream, String mediatype);
+
+    /**
+     * Sets the content for this entry
+     * 
+     * @param value the string value of the content
+     * @param mediatype the media type for the content
+     * @return The newly created atom:content
+     * @throws MimeTypeParseException if the media type is malformed
+     */
+    Content setContent(String value, String mediatype);
+
+    /**
+     * Sets the content for this entry as out of line.
+     * 
+     * @param uri URI of the content (value of the "src" attribute).
+     * @param mediatype Type of the content.
+     * @return The new content element.
+     * @throws MimeTypeParseException if the mime type is invalid.
+     * @throws IRISyntaxException if the URI is invalid.
+     */
+    Content setContent(IRI uri, String mediatype);
+
+    /**
+     * Returns the text of the content element
+     * 
+     * @return text content
+     */
+    String getContent();
+
+    /**
+     * Returns an input stream from the content element value. This is particularly useful when dealing with Base64
+     * binary content.
+     * 
+     * @throws IOException
+     */
+    InputStream getContentStream() throws IOException;
+
+    /**
+     * Returns the content/@src attribute, if any
+     * 
+     * @return The src IRI
+     * @throws IRISyntaxException if the src attribute is invalid
+     */
+    IRI getContentSrc();
+
+    /**
+     * Returns the content type
+     * 
+     * @return The content type
+     */
+    Content.Type getContentType();
+
+    /**
+     * Returns the media type of the content type or null if type equals 'text', 'html' or 'xhtml'
+     * 
+     * @return The content media type
+     */
+    MimeType getContentMimeType();
+
+    /**
+     * Lists the complete set of contributors for this entry
+     * 
+     * @return The listing of atom:contributor elements
+     */
+    List<Person> getContributors();
+
+    List<Person> getContributors(Selector selector);
+    
+    /**
+     * Adds an individual contributor to this entry
+     * 
+     * @param person The atom:contributor element
+     */
+    Entry addContributor(Person person);
+
+    /**
+     * Adds a contributor
+     * 
+     * @param name The contributor name
+     * @return The newly created atom:contributor
+     */
+    Person addContributor(String name);
+
+    /**
+     * Adds an author
+     * 
+     * @param name The contributor name
+     * @param email The contributor's email address
+     * @param uri The contributor's URI
+     * @return The newly created atom:contributor
+     * @throws IRISyntaxException if the uri is malformed
+     */
+    Person addContributor(String name, String email, String uri);
+
+    /**
+     * Returns the universally unique identifier for this entry
+     * 
+     * @return The atom:id element
+     */
+    IRIElement getIdElement();
+
+    /**
+     * Sets the universally unique identifier for this entry
+     * 
+     * @param id The atom:id element
+     */
+    Entry setIdElement(IRIElement id);
+
+    /**
+     * Returns the universally unique identifier for this entry
+     * 
+     * @throws IRISyntaxException if the atom:id value is malformed
+     */
+    IRI getId();
+
+    /**
+     * Sets the universally unique identifier for this entry
+     * 
+     * @param id The atom:id value
+     * @return The newly created atom:id element
+     * @throws IRISyntaxException if the atom:id value is malformed
+     */
+    IRIElement setId(String id);
+
+    /**
+     * Creates a new randomized atom:id for the entry
+     */
+    IRIElement newId();
+
+    /**
+     * Sets the universally unique identifier for this entry
+     * 
+     * @param id The atom:id value
+     * @param normalize true if the atom:id value should be normalized as called for by RFC4287
+     * @return The newly created atom:id element
+     * @throws IRISyntaxException if the atom:id value is malformed
+     */
+    IRIElement setId(String id, boolean normalize);
+
+    /**
+     * Lists the complete set of links for this entry
+     * 
+     * @return The 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 The rel attribute value to look for
+     * @return The listing of atom:link element's with the rel attribute
+     */
+    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 the atom:link to add
+     */
+    Entry addLink(Link link);
+
+    /**
+     * Add a link to the entry
+     * 
+     * @param href The IRI of the link
+     * @return The newly created atom:link
+     * @throws IRISyntaxException if the href is malformed
+     */
+    Link addLink(String href);
+
+    /**
+     * Add a link to the entry
+     * 
+     * @param href The 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);
+
+    /**
+     * Add a link to the entry
+     * 
+     * @param href The IRI of the link
+     * @param rel The link rel attribute
+     * @param type The media type of the link
+     * @param hreflang The language of the target
+     * @param length The length of the resource
+     * @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:published" element is a Date construct indicating an instant in time associated with an event
+     * early in the life cycle of the entry... Typically, atom:published will be associated with the initial creation or
+     * first availability of the resource.
+     * 
+     * @return The atom:published element
+     */
+    DateTime getPublishedElement();
+
+    /**
+     * RFC4287: The "atom:published" element is a Date construct indicating an instant in time associated with an event
+     * early in the life cycle of the entry... Typically, atom:published will be associated with the initial creation or
+     * first availability of the resource.
+     * 
+     * @param dateTime the atom:published element
+     */
+    Entry setPublishedElement(DateTime dateTime);
+
+    /**
+     * Return the value of the atom:published element
+     * 
+     * @return a java.util.Date for the atom:published value
+     */
+    Date getPublished();
+
+    /**
+     * Set the value of the atom:published element
+     * 
+     * @param value The java.util.Date
+     * @return The newly created atom:published element
+     */
+    DateTime setPublished(Date value);
+
+    /**
+     * Set the value of the atom:published element using the serialized string value
+     * 
+     * @param value The serialized date
+     * @return The newly created atom:published element
+     */
+    DateTime setPublished(String value);
+
+    /**
+     * <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
+     */
+    Entry setRightsElement(Text text);
+
+    /**
+     * Sets the value of the rights as @type="text"
+     * 
+     * @param value The text value of the atom:rights element
+     * @return The newly created atom:rights element
+     */
+    Text setRights(String value);
+
+    /**
+     * Sets the value of the rights as @type="html". Special characters like & will be automatically escaped
+     * 
+     * @param value The text value of the atom:rights element.
+     * @return The newly created atom:rights element
+     */
+    Text setRightsAsHtml(String value);
+
+    /**
+     * Sets the value of the rights as @type="xhtml"
+     * 
+     * @param value The text value of the atom:rights element
+     * @return The newly created atom:rights element
+     */
+    Text setRightsAsXhtml(String value);
+
+    /**
+     * Sets the value of the rights
+     * 
+     * @param value The text value of the atom:rights element
+     * @param type The text type
+     * @return The newly create atom:rights element
+     */
+    Text setRights(String value, Text.Type type);
+
+    /**
+     * Sets the value of the right as @type="xhtml"
+     * 
+     * @param value The XHTML div for the atom:rights element
+     * @return The newly created atom:rights element
+     */
+    Text setRights(Div value);
+
+    /**
+     * Return the String value of the atom:rights element
+     * 
+     * @return The text value of the atom:rights element
+     */
+    String getRights();
+
+    /**
+     * Return the @type of the atom:rights element
+     * 
+     * @return The Text.Type of the atom:rights element
+     */
+    Text.Type getRightsType();
+
+    /**
+     * <p>
+     * Returns the source element for this entry.
+     * </p>
+     * <p>
+     * RFC4287: 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.
+     * </p>
+     * 
+     * @return The atom:source element
+     */
+    Source getSource();
+
+    /**
+     * <p>
+     * Returns the source element for this entry.
+     * </p>
+     * <p>
+     * RFC4287: 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.
+     * </p>
+     * 
+     * @param source The atom:source element
+     */
+    Entry setSource(Source source);
+
+    /**
+     * RFC4287: The "atom:summary" element is a Text construct that conveys a short summary, abstract, or excerpt of an
+     * entry... It is not advisable for the atom:summary element to duplicate atom:title or atom:content because Atom
+     * Processors might assume there is a useful summary when there is none.
+     * 
+     * @return The atom:summary element
+     */
+    Text getSummaryElement();
+
+    /**
+     * RFC4287: The "atom:summary" element is a Text construct that conveys a short summary, abstract, or excerpt of an
+     * entry... It is not advisable for the atom:summary element to duplicate atom:title or atom:content because Atom
+     * Processors might assume there is a useful summary when there is none.
+     * 
+     * @param text The atom:summary element
+     */
+    Entry setSummaryElement(Text text);
+
+    /**
+     * Sets the value of the summary as @type="text"
+     * 
+     * @param value The text value of the atom:summary element
+     * @return the newly created atom:summary element
+     */
+    Text setSummary(String value);
+
+    /**
+     * Sets the value of the summary as @type="html"
+     * 
+     * @param value The text value of the atom:summary element
+     * @return the newly created atom:summary element
+     */
+    Text setSummaryAsHtml(String value);
+
+    /**
+     * Sets the value of the summary as @type="xhtml"
+     * 
+     * @param value The text value of the atom:summary element
+     * @return the newly created atom:summary element
+     */
+    Text setSummaryAsXhtml(String value);
+
+    /**
+     * Sets the value of the summary
+     * 
+     * @param value The text value of the atom:summary element
+     * @param type The Text.Type of the atom:summary element
+     * @return The newly created atom:summary element
+     */
+    Text setSummary(String value, Text.Type type);
+
+    /**
+     * Sets the value of the summary as @type="xhtml"
+     * 
+     * @param value The XHTML div
+     * @return the newly created atom:summary element
+     */
+    Text setSummary(Div value);
+
+    /**
+     * Returns the text string value of this summary
+     * 
+     * @return the text value of the atom:summary
+     */
+    String getSummary();
+
+    /**
+     * Returns the summary type
+     * 
+     * @return the Text.Type of the atom:summary
+     */
+    Text.Type getSummaryType();
+
+    /**
+     * 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 title the atom:title element
+     */
+    Entry setTitleElement(Text title);
+
+    /**
+     * Sets the value of the title as @type="text"
+     * 
+     * @param value The 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 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 title value
+     * @return The newly created atom:title element
+     */
+    Text setTitleAsXhtml(String value);
+
+    /**
+     * Sets the value of the title
+     * 
+     * @param value The title value
+     * @param type The Text.Type of the title
+     * @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 string value of the title element
+     * 
+     * @return text value of the atom:title
+     */
+    String getTitle();
+
+    /**
+     * Returns the @type of this entries title
+     * 
+     * @return the Text.Type of the atom:title
+     */
+    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 updated the atom:updated element.
+     */
+    Entry setUpdatedElement(DateTime updated);
+
+    /**
+     * Return atom:updated
+     * 
+     * @return A java.util.Date value
+     */
+    Date getUpdated();
+
+    /**
+     * Set the atom:updated value
+     * 
+     * @param value The new value
+     * @return The newly created atom:updated element
+     */
+    DateTime setUpdated(Date value);
+
+    /**
+     * Set the atom:updated value
+     * 
+     * @param value The new value
+     * @return The newly created atom:updated element
+     */
+    DateTime setUpdated(String value);
+
+    /**
+     * APP Introduces a new app:edited element whose value changes every time the entry is updated
+     * 
+     * @return the app:edited element
+     */
+    DateTime getEditedElement();
+
+    /**
+     * Set the app:edited element
+     * 
+     * @param modified The app:edited element
+     */
+    void setEditedElement(DateTime modified);
+
+    /**
+     * Return the value of app:edited
+     * 
+     * @return app:edited
+     */
+    Date getEdited();
+
+    /**
+     * Set the value of app:edited
+     * 
+     * @param value The java.util.Date value
+     * @return The newly created app:edited element
+     */
+    DateTime setEdited(Date value);
+
+    /**
+     * Set the value of app:edited
+     * 
+     * @param value the serialized string value for app:edited
+     * @return The newly created app:edited element
+     */
+    DateTime setEdited(String value);
+
+    /**
+     * Returns this entries Atom Publishing Protocol control element. A new control element will be created if one
+     * currently does not exist
+     * 
+     * @return The app:control element
+     */
+    Control getControl(boolean create);
+
+    /**
+     * Returns this entries Atom Publishing Protocol control element
+     * 
+     * @return The app:control element
+     */
+    Control getControl();
+
+    /**
+     * Sets this entries Atom Publishing Protocol control element
+     * 
+     * @param control The app:contorl element
+     */
+    Entry setControl(Control control);
+
+    /**
+     * Sets whether or not this entry is a draft
+     * 
+     * @param draft true if this entry should be marked as a draft
+     */
+    Entry setDraft(boolean draft);
+
+    /**
+     * Returns true if this entry is a draft
+     * 
+     * @return True if this entry is a date
+     */
+    boolean isDraft();
+
+    /**
+     * Returns the first link with the specified rel attribute value
+     * 
+     * @param rel The link rel
+     * @return a Link with the specified rel attribute
+     */
+    Link getLink(String rel);
+
+    /**
+     * Returns this entries first alternate link
+     * 
+     * @return the Alternate link
+     */
+    Link getAlternateLink();
+
+    /**
+     * Returns the first alternate link matching the specified type and hreflang
+     * 
+     * @throws MimeTypeParseException
+     * @param type The link media type
+     * @param hreflang The link target language
+     * @return The matching atom:link
+     * @throws MimeTypeParseException if the type is malformed
+     */
+    Link getAlternateLink(String type, String hreflang);
+
+    /**
+     * Returns this entries first enclosure link
+     * 
+     * @return the Enclosure link
+     */
+    Link getEnclosureLink();
+
+    /**
+     * Returns this entries first edit link
+     * 
+     * @return the Edit Link
+     */
+    Link getEditLink();
+
+    /**
+     * Returns this entries first edit-media link (if any)
+     * 
+     * @return the Edit Media Link
+     */
+    Link getEditMediaLink();
+
+    /**
+     * Returns the first edit-media link matching the specified type and hreflang
+     * 
+     * @param type a media type
+     * @param hreflang a target language
+     * @return A matching atom:link element
+     * @throws MimeTypeParseException
+     */
+    Link getEditMediaLink(String type, String hreflang);
+
+    /**
+     * Returns this entries first self link
+     * 
+     * @return the Self Link
+     */
+    Link getSelfLink();
+
+    /**
+     * Return a link href resolved against the in-scope Base URI
+     * 
+     * @param rel The rel attribute value
+     * @return The resolved IRI
+     * @throws IRISyntaxException if the href attribute is malformed
+     */
+    IRI getLinkResolvedHref(String rel);
+
+    /**
+     * Return a link href resolved against the in-scope Base URI
+     * 
+     * @return The resolved IRI
+     * @throws IRISyntaxException if the href attribute is malformed
+     */
+    IRI getAlternateLinkResolvedHref();
+
+    /**
+     * Return a link href resolved against the in-scope Base URI
+     * 
+     * @param type A target type
+     * @param hreflang A target language
+     * @return The resolved IRI
+     * @throws IRISyntaxException if the href attribute is malformed
+     */
+    IRI getAlternateLinkResolvedHref(String type, String hreflang);
+
+    /**
+     * Return a link href resolved against the in-scope Base URI
+     * 
+     * @return The resolved IRI
+     * @throws IRISyntaxException if the href attribute is malformed
+     */
+    IRI getEnclosureLinkResolvedHref();
+
+    /**
+     * Return a link href resolved against the in-scope Base URI
+     * 
+     * @return The resolved IRI
+     * @throws IRISyntaxException if the href attribute is malformed
+     */
+    IRI getEditLinkResolvedHref();
+
+    /**
+     * Return a link href resolved against the in-scope Base URI
+     * 
+     * @return The resolved IRI
+     * @throws IRISyntaxException if the href attribute is malformed
+     */
+    IRI getEditMediaLinkResolvedHref();
+
+    /**
+     * Return a link href resolved against the in-scope Base URI
+     * 
+     * @param type A target type
+     * @param hreflang A target language
+     * @return The resolved IRI
+     * @throws IRISyntaxException if the href attribute is malformed
+     * @throws MimeTypeParseException if the type is malformed
+     */
+    IRI getEditMediaLinkResolvedHref(String type, String hreflang);
+
+    /**
+     * Return a link href resolved against the in-scope Base URI
+     * 
+     * @return The resolved IRI
+     * @throws IRISyntaxException if the href attribute is malformed
+     */
+    IRI getSelfLinkResolvedHref();
+
+    Control addControl();
+}

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

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensibleElement.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensibleElement.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensibleElement.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensibleElement.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,157 @@
+/*
+ * 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 javax.xml.namespace.QName;
+
+import org.apache.abdera2.common.selector.Selector;
+
+/**
+ * An abstract element that can be extended with namespaced child elements
+ */
+public interface ExtensibleElement extends Element {
+
+    /**
+     * Returns the complete set of extension elements
+     * 
+     * @return a listing of extensions
+     */
+    List<Element> getExtensions();
+    
+    List<Element> getExtensions(Selector selector);
+
+    /**
+     * Returns the complete set of extension elements using the specified XML Namespace URI
+     * 
+     * @param uri A namespace URI
+     * @return A listing of extensions using the specified XML namespace
+     */
+    List<Element> getExtensions(String uri);
+
+    /**
+     * Returns the complete set of extension elements using the specified XML qualified name
+     * 
+     * @param qname An XML QName
+     * @return A listing of extensions with the specified QName
+     */
+    <T extends Element> List<T> getExtensions(QName qname);
+    
+    <T extends Element> List<T> getExtensions(Class<T> _class);
+
+    <T extends Element> List<T> getExtensions(QName qname, Selector selector);
+    
+    <T extends Element> List<T> getExtensions(Class<T> _class, Selector selector);
+    
+    /**
+     * Returns the first extension element with the XML qualified name
+     * 
+     * @param qname An XML QName
+     * @return An extension with the specified qname
+     */
+    <T extends Element> T getExtension(QName qname);
+
+    /**
+     * Adds an individual extension element
+     * 
+     * @param extension An extension element to add
+     */
+    <T extends ExtensibleElement> T addExtension(Element extension);
+
+    /**
+     * Adds an individual extension element before the specified element
+     */
+    <T extends ExtensibleElement> T addExtension(Element extension, Element before);
+
+    /**
+     * Adds an individual extension element
+     * 
+     * @param qname An extension element to create
+     * @return The newly created extension element
+     */
+    <T extends Element> T addExtension(QName qname);
+    
+    <T extends Element> T addExtension(Class<T> _class);
+
+    /**
+     * Adds an individual extension element
+     * 
+     * @param qname An extension element to create
+     * @return The newly created extension element
+     */
+    <T extends Element> T addExtension(QName qname, QName before);
+    
+    <T extends Element> T addExtension(Class<T> _class, QName before);
+
+    /**
+     * Adds an individual extension element
+     * 
+     * @param namespace An XML namespace
+     * @param localPart A localname
+     * @param prefix A XML namespace prefix
+     * @return The newly creatd extension element
+     */
+    <T extends Element> T addExtension(String namespace, String localPart, String prefix);
+
+    /**
+     * Adds a simple extension (text content only)
+     * 
+     * @param qname An XML QName
+     * @param value The simple text value of the element
+     * @return The newly created extension element
+     */
+    Element addSimpleExtension(QName qname, String value);
+
+    /**
+     * Adds a simple extension (text content only)
+     * 
+     * @param namespace An XML namespace
+     * @param localPart A local name
+     * @param prefix A namespace prefix
+     * @param value The simple text value
+     * @return The newly created extension element
+     */
+    Element addSimpleExtension(String namespace, String localPart, String prefix, String value);
+
+    /**
+     * Gets the value of a simple extension
+     * 
+     * @param qname An XML QName
+     * @return The string value of the extension
+     */
+    String getSimpleExtension(QName qname);
+
+    /**
+     * Gets the value of a simple extension
+     * 
+     * @param namespace An XML namespace
+     * @param localPart A localname
+     * @param prefix A namespace prefix
+     * @return The string value of the extension
+     */
+    String getSimpleExtension(String namespace, String localPart, String prefix);
+
+    /**
+     * Find an extension by Class rather than QName
+     * 
+     * @param _class The implementation class of the extension
+     * @return The extension element
+     */
+    <T extends Element> T getExtension(Class<T> _class);
+}

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

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensibleElementWrapper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensibleElementWrapper.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensibleElementWrapper.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensibleElementWrapper.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,139 @@
+/*
+ * 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 javax.xml.namespace.QName;
+
+import org.apache.abdera2.common.selector.Selector;
+import org.apache.abdera2.factory.Factory;
+
+/**
+ * ElementWrapper implementation that implements the ExtensibleElement interface. This should be used to create static
+ * extension elements that support extensions
+ */
+@SuppressWarnings("unchecked")
+public abstract class ExtensibleElementWrapper extends ElementWrapper implements ExtensibleElement {
+
+    protected ExtensibleElementWrapper(Element internal) {
+        super(internal);
+    }
+
+    public ExtensibleElementWrapper(Factory factory, QName qname) {
+        super(factory, qname);
+    }
+
+    protected ExtensibleElement getExtInternal() {
+        return (ExtensibleElement)getInternal();
+    }
+
+    public <T extends ExtensibleElement> T addExtension(Element extension) {
+        getExtInternal().addExtension(extension);
+        return (T)this;
+    }
+
+    public <T extends Element> T addExtension(QName qname) {
+        return (T)getExtInternal().addExtension(qname);
+    }
+
+    public <T extends Element> T addExtension(String namespace, String localPart, String prefix) {
+        return (T)getExtInternal().addExtension(namespace, localPart, prefix);
+    }
+
+    public Element addSimpleExtension(QName qname, String value) {
+        return getExtInternal().addSimpleExtension(qname, value);
+    }
+
+    public Element addSimpleExtension(String namespace, String localPart, String prefix, String value) {
+        return getExtInternal().addSimpleExtension(namespace, localPart, prefix, value);
+    }
+
+    public <T extends Element> T getExtension(QName qname) {
+        return (T)getExtInternal().getExtension(qname);
+    }
+
+    public <T extends Element> T getExtension(Class<T> _class) {
+        return (T)getExtInternal().getExtension(_class);
+    }
+
+    public List<Element> getExtensions() {
+        return getExtInternal().getExtensions();
+    }
+
+    public List<Element> getExtensions(String uri) {
+        return getExtInternal().getExtensions(uri);
+    }
+
+    public <T extends Element> List<T> getExtensions(QName qname) {
+        return getExtInternal().getExtensions(qname);
+    }
+    
+    public <T extends Element> List<T> getExtensions(QName qname, Selector selector) {
+      return getExtInternal().getExtensions(qname, selector);
+    }
+
+    public String getSimpleExtension(QName qname) {
+        return getExtInternal().getSimpleExtension(qname);
+    }
+
+    public String getSimpleExtension(String namespace, String localPart, String prefix) {
+        return getExtInternal().getSimpleExtension(namespace, localPart, prefix);
+    }
+
+    public boolean getMustPreserveWhitespace() {
+        return getExtInternal().getMustPreserveWhitespace();
+    }
+
+    public <T extends Element> T setMustPreserveWhitespace(boolean preserve) {
+        getExtInternal().setMustPreserveWhitespace(preserve);
+        return (T)this;
+    }
+
+    public <T extends ExtensibleElement> T addExtension(Element extension, Element before) {
+        getExtInternal().addExtension(extension, before);
+        return (T)this;
+    }
+
+    public <T extends Element> T addExtension(QName qname, QName before) {
+        return (T)getExtInternal().addExtension(qname, before);
+    }
+
+    public List<Element> getExtensions(Selector selector) {
+      return getExtInternal().getExtensions(selector);
+    }
+
+    public <T extends Element> List<T> getExtensions(Class<T> _class) {
+      return getExtInternal().getExtensions(_class);
+    }
+
+    public <T extends Element> List<T> getExtensions(Class<T> _class,
+        Selector selector) {
+      return getExtInternal().getExtensions(_class,selector);
+    }
+
+    public <T extends Element> T addExtension(Class<T> _class) {
+      return getExtInternal().addExtension(_class);
+    }
+
+    public <T extends Element> T addExtension(Class<T> _class, QName before) {
+      return getExtInternal().addExtension(_class,before);
+    }
+    
+    
+}

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



Mime
View raw message