abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r421809 [1/2] - in /incubator/abdera/java/trunk: core/src/main/java/org/apache/abdera/model/ examples/src/main/java/org/apache/abdera/examples/appclient/ examples/src/main/java/org/apache/abdera/examples/simple/ extensions/src/main/java/org...
Date Fri, 14 Jul 2006 05:26:40 GMT
Author: jmsnell
Date: Thu Jul 13 22:26:38 2006
New Revision: 421809

URL: http://svn.apache.org/viewvc?rev=421809&view=rev
Log:
This is a big update. Many of the model interfaces have been simplified.  For instance, all of the model interface
methods with URI input parameters have been removed in favor of their String counterparts (e.g. instead of 
having both a Author.setUri(URI) and Author.setUri(String), it's now just Author.setUri(String).  Lots of other methods
have been removed.

This change also introduces FOMList, a java.util.List impl based on an internal iterator that is incrementally consumed 
as the list is used.  This allows us to more efficiently consume the underlying parser without sacrificing the benefits of
using java.util.List versus java.util.Iterator.

A number of other improvements and simplifications have been made to the parser implementation.  More work is likely
necessary but this is, at least, a step in the right direction.

Added:
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/util/
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/util/ElementIterator.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/util/FOMExtensionIterator.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/util/FOMHelper.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/util/FOMList.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/util/LinkIterator.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/util/SniffingInputStream.java
      - copied, changed from r421658, incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/SniffingInputStream.java
Removed:
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/SniffingInputStream.java
Modified:
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Category.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Element.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Entry.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/ExtensibleElement.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Generator.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/IRI.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Link.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Person.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Service.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Source.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java
    incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/AtomClient.java
    incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/simple/Create.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/impl/FOMInReplyTo.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java
    incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Category.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Category.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Category.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Category.java Thu Jul 13 22:26:38 2006
@@ -68,13 +68,6 @@
    * RFC4287: The "scheme" attribute is an IRI that identifies a 
    * categorization scheme.  Category elements MAY have a "scheme" 
    * attribute.
-   */
-  void setScheme(URI scheme);
-  
-  /**
-   * RFC4287: The "scheme" attribute is an IRI that identifies a 
-   * categorization scheme.  Category elements MAY have a "scheme" 
-   * attribute.
    * @throws URISyntaxException 
    */
   void setScheme(String scheme) throws URISyntaxException;

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java Thu Jul 13 22:26:38 2006
@@ -71,12 +71,6 @@
   /**
    * APP Draft-08: The app:collection element MUST contain a "href" 
    * attribute, whose value gives the IRI of the collection.
-   */
-  void setHref(URI href);
-  
-  /**
-   * APP Draft-08: The app:collection element MUST contain a "href" 
-   * attribute, whose value gives the IRI of the collection.
    * @throws URISyntaxException 
    */
   void setHref(String href) throws URISyntaxException;

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java Thu Jul 13 22:26:38 2006
@@ -150,18 +150,9 @@
    * be a composite type.  If neither the type attribute nor
    * the src attribute is provided, Atom Processors MUST behave as though
    * the type attribute were present with a value of "text".
+   * @throws MimeTypeParseException 
    */
-  void setMimeType(MimeType type);
-  
-  /**
-   * RFC4287: On the atom:content element, the value of the "type" 
-   * attribute MAY be one of "text", "html", or "xhtml".  Failing that, 
-   * it MUST conform to the syntax of a MIME media type, but MUST NOT 
-   * be a composite type.  If neither the type attribute nor
-   * the src attribute is provided, Atom Processors MUST behave as though
-   * the type attribute were present with a value of "text".
-   */
-  void setMimeType(String type);
+  void setMimeType(String type) throws MimeTypeParseException;
 
   /**
    * <p>RFC4287: atom:content MAY have a "src" attribute, whose value MUST 
@@ -180,19 +171,6 @@
    * Returns the fully qualified URI form of the content src attribute.
    */
   URI getResolvedSrc() throws URISyntaxException;
-
-  /**
-   * <p>RFC4287: atom:content MAY have a "src" attribute, whose value MUST 
-   * be an IRI reference.  If the "src" attribute is present, atom:content
-   * MUST be empty.  Atom Processors MAY use the IRI to retrieve the
-   * content and MAY choose to ignore remote content or to present it in a
-   * different manner than local content.</p>
-   *
-   * <p>If the "src" attribute is present, the "type" attribute SHOULD be
-   * provided and MUST be a MIME media type, rather than "text", "html", 
-   * or "xhtml".</p>
-   */
-  void setSrc(URI src);
 
   /**
    * <p>RFC4287: atom:content MAY have a "src" attribute, whose value MUST 

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java Thu Jul 13 22:26:38 2006
@@ -23,6 +23,7 @@
 import java.util.Date;
 
 import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
 
 /**
  * <p>The top level artifact of the Feed Object Model.  The Parser component
@@ -54,12 +55,6 @@
   /**
    * Sets the Base URI of the document.  All relative URI's contained in the 
    * document will be resolved according to this base.
-   */
-  void setBaseUri(URI base);
-
-  /**
-   * Sets the Base URI of the document.  All relative URI's contained in the 
-   * document will be resolved according to this base.
    * @throws URISyntaxException 
    */
   void setBaseUri(String base) throws URISyntaxException;
@@ -71,8 +66,9 @@
   
   /**
    * Sets the content type for this document
+   * @throws MimeTypeParseException 
    */
-  void setContentType(MimeType contentType);
+  void setContentType(String contentType) throws MimeTypeParseException;
   
   /**
    * Returns the last modified date for this document

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Element.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Element.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Element.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Element.java Thu Jul 13 22:26:38 2006
@@ -109,11 +109,8 @@
    */
   List<QName> getExtensionAttributes();
   
-  /**
-   * Returns the value of the named attribute
-   */
-  String getAttributeValue(String namespace, String localPart);
-    
+  void removeAttribute(QName qname);
+  
   /**
    * Sets the value of the named attribute
    */
@@ -123,11 +120,6 @@
    * Sets the value of the named attribute
    */
   void setAttributeValue(QName qname, String value);
-  
-  /**
-   * Sets the value of the named attribute
-   */
-  void setAttributeValue(String namespace, String localPart, String prefix, String value);
   
   /**
    * Removes this element from its current document

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Entry.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Entry.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Entry.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Entry.java Thu Jul 13 22:26:38 2006
@@ -19,12 +19,10 @@
 
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
 import javax.activation.DataHandler;
-import javax.activation.MimeType;
 import javax.activation.MimeTypeParseException;
 
 /**
@@ -116,11 +114,6 @@
   List<Person> getAuthors();
   
   /**
-   * Sets the complete set of authors for the entry
-   */
-  void setAuthors(List<Person> people);
-  
-  /**
    * Adds an individual author to the entry
    */
   void addAuthor(Person person);
@@ -138,12 +131,6 @@
   Person addAuthor(String name, String email, String uri) throws URISyntaxException;
   
   /**
-   * Adds an author
-   * @throws URISyntaxException 
-   */
-  Person addAuthor(String name, String email, URI uri) throws URISyntaxException;
-  
-  /**
    * Lists the complete set of categories listed for the entry
    */
   List<Category> getCategories();
@@ -155,16 +142,6 @@
   List<Category> getCategories(String scheme) throws URISyntaxException;
 
   /**
-   * Lists the complete set of categories using the specified scheme
-   */
-  List<Category> getCategories(URI scheme);
-  
-  /**
-   * Sets the complete set of categories
-   */
-  void setCategories(List<Category> categories);
-  
-  /**
    * Adds an individual category to the entry
    */
   void addCategory(Category category);
@@ -176,11 +153,6 @@
 
   /**
    * Adds a category to the entry
-   */
-  Category addCategory(URI scheme, String term, String label);
-  
-  /**
-   * Adds a category to the entry
    * @throws URISyntaxException 
    */
   Category addCategory(String scheme, String term, String label) throws URISyntaxException;
@@ -195,8 +167,6 @@
    */
   void setContentElement(Content content);
 
-  Content setContent();
-  
   /**
    * Sets the content for this entry as @type="text"
    */
@@ -215,42 +185,34 @@
   /**
    * Sets the content for this entry
    */
-  Content setContent(Content.Type type);
-  
-  /**
-   * Sets the content for this entry
-   */
   Content setContent(String value, Content.Type type);
   
   /**
    * Sets the content for this entry
    */
-  Content setContent(Element value, Content.Type type);  
-  
-  /**
-   * Sets the content for this entry
-   */
-  Content setContent(MimeType mediaType);
+  Content setContent(Element value);  
   
   /**
    * Sets the content for this entry
+   * @throws MimeTypeParseException 
    */
-  Content setContent(URI src, MimeType mediaType);
+  Content setContent(Element element, String mediaType) throws MimeTypeParseException;
   
   /**
    * Sets the content for this entry
+   * @throws MimeTypeParseException 
    */
-  Content setContent(Element element, MimeType mediaType);
+  Content setContent(DataHandler dataHandler) throws MimeTypeParseException;
   
   /**
    * Sets the content for this entry
    */
-  Content setContent(DataHandler dataHandler, MimeType mediatype);
+  Content setContent(DataHandler dataHandler, String mediatype) throws MimeTypeParseException;;
   
   /**
    * Sets the content for this entry
    */
-  Content setContent(String value, MimeType mediatype);
+  Content setContent(String value, String mediatype) throws MimeTypeParseException;;
   
   /**
    * Returns the text of the content element
@@ -268,11 +230,6 @@
   List<Person> getContributors();
   
   /**
-   * Sets the complete list of contributors for this entry
-   */
-  void setContributors(List<Person> people);
-  
-  /**
    * Adds an individual contributor to this entry
    */
   void addContributor(Person person);
@@ -290,13 +247,6 @@
   Person addContributor(String name, String email, String uri) throws URISyntaxException;
   
   /**
-   * Adds an author
-   * @throws URISyntaxException 
-   */
-  Person addContributor(String name, String email, URI uri) throws URISyntaxException;
-
-  
-  /**
    * Returns the universally unique identifier for this entry
    */
   IRI getIdElement();
@@ -316,24 +266,12 @@
    * Sets the universally unique identifier for this entry
    * @throws URISyntaxException 
    */
-  IRI setId(URI id) throws URISyntaxException;
-
-  /**
-   * Sets the universally unique identifier for this entry
-   * @throws URISyntaxException 
-   */
   IRI setId(String id) throws URISyntaxException;
   
   /**
    * Sets the universally unique identifier for this entry
    * @throws URISyntaxException 
    */
-  IRI setId(URI id, boolean normalize) throws URISyntaxException;
-
-  /**
-   * Sets the universally unique identifier for this entry
-   * @throws URISyntaxException 
-   */
   IRI setId(String id, boolean normalize) throws URISyntaxException;
   
   /**
@@ -347,11 +285,6 @@
   List<Link> getLinks(String rel);
   
   /**
-   * Sets the complete set of links for the entry
-   */
-  void setLinks(List<Link> links);
-  
-  /**
    * Adds an individual link to the entry
    */
   void addLink(Link link);
@@ -360,16 +293,6 @@
   
   Link addLink(String href, String rel) throws URISyntaxException;
   
-  Link addLink(URI href);
-  
-  Link addLink(URI href, String rel);
-  
-  Link addLink(URI href, String rel, MimeType type, String title, String hreflang, long length);
-  
-  Link addLink(String href, String rel, MimeType type, String title, String hreflang, long length) throws URISyntaxException;
-  
-  Link addLink(URI href, String rel, String type, String title, String hreflang, long length) throws MimeTypeParseException;
-  
   Link addLink(String href, String rel, String type, String title, String hreflang, long length) throws URISyntaxException, MimeTypeParseException;
   
   /**
@@ -388,16 +311,10 @@
    */
   void setPublishedElement(DateTime dateTime);
   
-  String getPublishedString();
-  
   Date getPublished();
   
   DateTime setPublished(Date value);
   
-  DateTime setPublished(Calendar value);
-  
-  DateTime setPublished(long value);
-  
   DateTime setPublished(String value);
   
   /**
@@ -418,8 +335,6 @@
    */
   void setRightsElement(Text text);
   
-  Text setRights();
-  
   /**
    * Sets the value of the rights as @type="text"
    */
@@ -436,11 +351,6 @@
   Text setRightsAsXhtml(String value);
   
   /**
-   * Sets the rights
-   */
-  Text setRights(Text.Type type);
-  
-  /**
    * Sets the value of the rights
    */
   Text setRights(String value, Text.Type type);
@@ -510,8 +420,6 @@
    */
   void setSummaryElement(Text text);
   
-  Text setSummary();
-  
   /**
    * Sets the value of the summary as @type="text"
    */
@@ -528,11 +436,6 @@
   Text setSummaryAsXhtml(String value);
   
   /**
-   * Sets the summary
-   */
-  Text setSummary(Text.Type type);
-  
-  /**
    * Sets the value of the summary
    */
   Text setSummary(String value, Text.Type type);
@@ -564,8 +467,6 @@
    */
   void setTitleElement(Text title);
   
-  Text setTitle();
-  
   /**
    * Sets the value of the title as @type="text"
    */
@@ -582,11 +483,6 @@
   Text setTitleAsXhtml(String value);
   
   /**
-   * Sets the title
-   */
-  Text setTitle(Text.Type type);
-  
-  /**
    * Sets the value of the title
    */
   Text setTitle(String value, Text.Type type);
@@ -622,15 +518,9 @@
    */
   void setUpdatedElement(DateTime updated);
   
-  String getUpdatedString();
-  
   Date getUpdated();
   
   DateTime setUpdated(Date value);
-  
-  DateTime setUpdated(Calendar value);
-  
-  DateTime setUpdated(long value);
   
   DateTime setUpdated(String value);
   

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/ExtensibleElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/ExtensibleElement.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/ExtensibleElement.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/ExtensibleElement.java Thu Jul 13 22:26:38 2006
@@ -90,11 +90,6 @@
   String getSimpleExtension(String namespace, String localPart, String prefix);
   
   /**
-   * Adds a list of extensions
-   */
-  void addExtensions(List<Element> extensions);
-  
-  /**
    * Find an extension by Class rather than QName
    */
   <T extends Element> T getExtension(Class<T> _class);

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java Thu Jul 13 22:26:38 2006
@@ -102,11 +102,6 @@
   List<Entry> getEntries();
   
   /**
-   * Sets the complete set of entries for this feed
-   */
-  void setEntries(List<Entry> entries);
-  
-  /**
    * Adds a new Entry to the <i>end</i> of the Feeds collection of entries
    */
   void addEntry(Entry entry);

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Generator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Generator.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Generator.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Generator.java Thu Jul 13 22:26:38 2006
@@ -65,14 +65,6 @@
    *  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.
-   */
-  void setUri(URI uri);
-  
-  /**
-   *  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 URISyntaxException 
    */
   void setUri(String uri) throws URISyntaxException;

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/IRI.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/IRI.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/IRI.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/IRI.java Thu Jul 13 22:26:38 2006
@@ -35,16 +35,9 @@
   
   /**
    * Sets the value of the element
-   */
-  void setValue(URI iri);
-  
-  /**
-   * Sets the value of the element
    * @throws URISyntaxException 
    */
   void setValue(String iri) throws URISyntaxException;
-  
-  void setNormalizedValue(URI id) throws URISyntaxException;
   
   void setNormalizedValue(String id) throws URISyntaxException;
   

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Link.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Link.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Link.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Link.java Thu Jul 13 22:26:38 2006
@@ -100,13 +100,6 @@
    * 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].
-   */
-  void setHref(URI href);
-  
-  /**
-   * 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].
    * @throws URISyntaxException 
    */
   void setHref(String href) throws URISyntaxException;
@@ -157,17 +150,6 @@
    */
   MimeType getMimeType() throws MimeTypeParseException;
 
-  /**
-   * 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].
-   */
-  void setMimeType(MimeType type);
-  
   /**
    * 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

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Person.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Person.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Person.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Person.java Thu Jul 13 22:26:38 2006
@@ -122,14 +122,6 @@
    * 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].
-   */
-  IRI setUri(URI 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].
    * @throws URISyntaxException 
    */
   IRI setUri(String uri) throws URISyntaxException;

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Service.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Service.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Service.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Service.java Thu Jul 13 22:26:38 2006
@@ -53,11 +53,6 @@
   Workspace getWorkspace(String title);
   
   /**
-   * Set the complete set of workspaces
-   */
-  void setWorkspaces(List<Workspace> workspaces);
-  
-  /**
    * Add an individual workspace
    */
   void addWorkspace(Workspace workspace);

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Source.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Source.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Source.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Source.java Thu Jul 13 22:26:38 2006
@@ -19,11 +19,9 @@
 
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
-import javax.activation.MimeType;
 import javax.activation.MimeTypeParseException;
 
 /**
@@ -80,11 +78,6 @@
   List<Person> getAuthors();
   
   /**
-   * Sets the complete set of authors for the entry
-   */
-  void setAuthors(List<Person> people);
-  
-  /**
    * Adds an individual author to the entry
    */
   void addAuthor(Person person);
@@ -101,12 +94,6 @@
   Person addAuthor(String name, String email, String uri) throws URISyntaxException;
   
   /**
-   * Adds an author
-   * @throws URISyntaxException 
-   */
-  Person addAuthor(String name, String email, URI uri) throws URISyntaxException;
-  
-  /**
    * Lists the complete set of categories listed for the entry
    */
   List<Category> getCategories();
@@ -118,16 +105,6 @@
   List<Category> getCategories(String scheme) throws URISyntaxException;
   
   /**
-   * Lists the complete set of categories using the specified scheme
-   */
-  List<Category> getCategories(URI scheme);  
-  
-  /**
-   * Sets the complete set of categories
-   */
-  void setCategories(List<Category> categories);
-  
-  /**
    * Adds an individual category to the entry
    */
   void addCategory(Category category);
@@ -139,11 +116,6 @@
 
   /**
    * Adds a category to the feed
-   */
-  Category addCategory(URI scheme, String term, String label);
-  
-  /**
-   * Adds a category to the feed
    * @throws URISyntaxException 
    */
   Category addCategory(String scheme, String term, String label) throws URISyntaxException;
@@ -154,11 +126,6 @@
   List<Person> getContributors();
   
   /**
-   * Sets the complete list of contributors for this entry
-   */
-  void setContributors(List<Person> people);
-  
-  /**
    * Adds an individual contributor to this entry
    */
   void addContributor(Person person);
@@ -169,18 +136,12 @@
   Person addContributor(String name);
 
   /**
-   * Adds an author
+   * Adds a contributor
    * @throws URISyntaxException 
    */
   Person addContributor(String name, String email, String uri) throws URISyntaxException;
   
   /**
-   * Adds an author
-   * @throws URISyntaxException 
-   */
-  Person addContributor(String name, String email, URI uri) throws URISyntaxException;
-  
-  /**
    * RFC4287: The "atom:generator" element's content identifies the 
    * agent used to generate a feed, for debugging and other purposes.
    */
@@ -197,15 +158,6 @@
    * agent used to generate a feed, for debugging and other purposes.
    */
   Generator setGenerator(
-    URI uri, 
-    String version, 
-    String value);
-  
-  /**
-   * RFC4287: The "atom:generator" element's content identifies the 
-   * agent used to generate a feed, for debugging and other purposes.
-   */
-  Generator setGenerator(
     String uri, 
     String version, 
     String value) 
@@ -245,15 +197,6 @@
    *  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.
-   */
-  IRI setIcon(URI 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.
    * @throws URISyntaxException 
    */
   URI getIcon() throws URISyntaxException;
@@ -278,22 +221,12 @@
 
   /**
    * Sets the universally unique identifier for this feed
-   */
-  IRI setId(URI id) throws URISyntaxException;
-
-  /**
-   * Sets the universally unique identifier for this feed
    * @throws URISyntaxException 
    */
   IRI setId(String id) throws URISyntaxException;
   
   /**
    * Sets the universally unique identifier for this feed
-   */
-  IRI setId(URI id, boolean normalize) throws URISyntaxException;
-
-  /**
-   * Sets the universally unique identifier for this feed
    * @throws URISyntaxException 
    */
   IRI setId(String id, boolean normalize) throws URISyntaxException;
@@ -309,11 +242,6 @@
   List<Link> getLinks(String rel);
   
   /**
-   * Sets the complete set of links for the entry
-   */
-  void setLinks(List<Link> links);
-  
-  /**
    * Adds an individual link to the entry
    */
   void addLink(Link link);
@@ -322,19 +250,8 @@
   
   Link addLink(String href, String rel) throws URISyntaxException;
   
-  Link addLink(URI href);
-  
-  Link addLink(URI href, String rel);
-  
-  Link addLink(URI href, String rel, MimeType type, String title, String hreflang, long length);
-  
-  Link addLink(String href, String rel, MimeType type, String title, String hreflang, long length) throws URISyntaxException;
-  
-  Link addLink(URI href, String rel, String type, String title, String hreflang, long length) throws MimeTypeParseException;
-  
   Link addLink(String href, String rel, String type, String title, String hreflang, long length) throws URISyntaxException, MimeTypeParseException;
- 
-  
+   
   /**
    * RFC4287: The "atom:logo" element's content is an IRI reference [RFC3987] 
    * that identifies an image that provides visual identification for a feed.
@@ -361,13 +278,6 @@
    * 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).
-   */
-  IRI setLogo(URI 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).
    * @throws URISyntaxException 
    */
   URI getLogo() throws URISyntaxException;
@@ -390,8 +300,6 @@
    */
   void setRightsElement(Text text);
   
-  Text setRights();
-  
   /**
    * Sets the value of the rights as @type="text"
    */
@@ -408,11 +316,6 @@
   Text setRightsAsXhtml(String value);
   
   /**
-   * Sets the rights
-   */
-  Text setRights(Text.Type type);
-  
-  /**
    * Sets the value of the rights
    */
   Text setRights(String value, Text.Type type);
@@ -444,8 +347,6 @@
    */  
   void setSubtitleElement(Text text);
   
-  Text setSubtitle();
-  
   /**
    * Sets the value of the subtitle as @type="text"
    */
@@ -462,11 +363,6 @@
   Text setSubtitleAsXhtml(String value);
   
   /**
-   * Sets the subtitle
-   */
-  Text setSubtitle(Text.Type type);
-  
-  /**
    * Sets the value of the subtitle
    */
   Text setSubtitle(String value, Text.Type type);
@@ -498,8 +394,6 @@
    */
   void setTitleElement(Text text);
   
-  Text setTitle();
-  
   /**
    * Sets the value of the title as @type="text"
    */
@@ -516,11 +410,6 @@
   Text setTitleAsXhtml(String value);
   
   /**
-   * Sets the title
-   */
-  Text setTitle(Text.Type type);
-  
-  /**
    * Sets the value of the title
    */
   Text setTitle(String value, Text.Type type);
@@ -561,10 +450,6 @@
   Date getUpdated();
   
   DateTime setUpdated(Date value);
-  
-  DateTime setUpdated(Calendar value);
-  
-  DateTime setUpdated(long value);
   
   DateTime setUpdated(String value);
   

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java Thu Jul 13 22:26:38 2006
@@ -17,7 +17,6 @@
 */
 package org.apache.abdera.model;
 
-import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.List;
 
@@ -69,22 +68,10 @@
   Collection getCollection(String title);
   
   /**
-   * Sets the full set of collections for this workspace
-   */
-  void setCollection(List<Collection> collections);
-  
-  /**
    * Adds an individual collection to this workspace
    */
   void addCollection(Collection collection);
 
-  /**
-   * Adds an individual collection to this workspace
-   */
-  Collection addCollection(
-    String title, 
-    URI href);
-  
   /**
    * Adds an individual collection to this workspace
    */

Modified: incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/AtomClient.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/AtomClient.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/AtomClient.java (original)
+++ incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/AtomClient.java Thu Jul 13 22:26:38 2006
@@ -564,7 +564,7 @@
           "charset"));
     }
     Document<T> doc = parser.parse(in, uri, parserOptions);
-    doc.setContentType(mimeType);
+    doc.setContentType(mimeType.toString());
     doc.setLastModified(_getLastModified(method));
     return doc;
   }

Modified: incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/simple/Create.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/simple/Create.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/simple/Create.java (original)
+++ incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/simple/Create.java Thu Jul 13 22:26:38 2006
@@ -17,7 +17,6 @@
 */
 package org.apache.abdera.examples.simple;
 
-import java.util.Calendar;
 import java.util.Date;
 
 import org.apache.abdera.factory.Factory;
@@ -60,7 +59,7 @@
     entry3.setTitle("<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>Test</p></div>", Text.Type.XHTML);
     entry3.addLink("/2003/12/13/atom03/2");
     entry3.setId("HTTP://www.Example.org/foo/../bar", true); // normalizes the id to the value http://www.example.org/bar
-    entry3.setUpdated(Calendar.getInstance());
+    entry3.setUpdated(new Date());
     entry3.setSummaryAsHtml("<p><a href=\"foo\">Test</a></p>").setBaseUri("http://example.org/site/");
     entry3.setSource(feed.getAsSource());
     

Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/impl/FOMInReplyTo.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/impl/FOMInReplyTo.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/impl/FOMInReplyTo.java (original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/impl/FOMInReplyTo.java Thu Jul 13 22:26:38 2006
@@ -92,7 +92,7 @@
   }
 
   public void setRef(URI ref) {
-    this._setAttributeValue(ThreadConstants.THRREF, ref.toString());
+    this.setAttributeValue(ThreadConstants.THRREF, ref.toString());
   }
   
   public void setRef(String ref) throws URISyntaxException {
@@ -108,7 +108,7 @@
   }
 
   public void setHref(URI ref) {
-    this._setAttributeValue(HREF, ref.toString());
+    this.setAttributeValue(HREF, ref.toString());
   }
 
   public void setHref(String ref) throws URISyntaxException {
@@ -117,7 +117,7 @@
   
   public MimeType getMimeType() throws MimeTypeParseException {
     MimeType type = null;
-    String value = _getAttributeValue(TYPE);
+    String value = getAttributeValue(TYPE);
     if (value != null) {
       type = new MimeType(value);
     }
@@ -125,7 +125,7 @@
   }
 
   public void setMimeType(MimeType mimeType) {
-    this._setAttributeValue(TYPE, mimeType.toString());
+    this.setAttributeValue(TYPE, mimeType.toString());
   }
   
   public void setMimeType(String mimeType) throws MimeTypeParseException {
@@ -141,7 +141,7 @@
   }
 
   public void setSource(URI source) {
-    this._setAttributeValue(ThreadConstants.THRSOURCE, source.toString());
+    this.setAttributeValue(ThreadConstants.THRSOURCE, source.toString());
   }
   
   public void setSource(String source) throws URISyntaxException {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java Thu Jul 13 22:26:38 2006
@@ -49,16 +49,6 @@
   
   public FOMCategory(
     String term, 
-    URI scheme, 
-    String label) {
-      this();
-      setTerm(term);
-      setScheme(scheme);
-      setLabel(label);
-  }
-  
-  public FOMCategory(
-    String term, 
     String scheme, 
     String label) 
       throws URISyntaxException {
@@ -106,32 +96,37 @@
   }
   
   public String getTerm() {
-    return _getAttributeValue(TERM);
+    return getAttributeValue(TERM);
   }
 
   public void setTerm(String term) {
-    _setAttributeValue(TERM, term);
+    if (term != null)
+      setAttributeValue(TERM, term);
+    else
+      removeAttribute(TERM);
   }
 
   public URI getScheme() throws URISyntaxException {
-    String value = _getAttributeValue(SCHEME);
+    String value = getAttributeValue(SCHEME);
     return (value != null) ? new URI(value) : null;
   }
 
-  public void setScheme(URI scheme) {
-    _setAttributeValue(SCHEME, (scheme != null) ? scheme.toString() : null);
-  }
-
   public void setScheme(String scheme) throws URISyntaxException {
-    setScheme((scheme != null) ? new URI(scheme) : null);
+    if (scheme != null)
+      setAttributeValue(SCHEME, (scheme != null) ? new URI(scheme).toString() : null);
+    else 
+      removeAttribute(SCHEME);
   }
   
   public String getLabel() {
-    return _getAttributeValue(LABEL);
+    return getAttributeValue(LABEL);
   }
 
   public void setLabel(String label) {
-    _setAttributeValue(LABEL, label);
+    if (label != null)
+      setAttributeValue(LABEL, label);
+    else
+      removeAttribute(LABEL);
   }
 
   public String getValue() {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java Thu Jul 13 22:26:38 2006
@@ -46,16 +46,6 @@
   
   public FOMCollection(
     String title, 
-    URI href, 
-    String[] accepts) {
-      this();
-      setTitle(title);
-      setHref(href);
-      setAccept(accepts);
-  }
-  
-  public FOMCollection(
-    String title, 
     String href, 
     String[] accepts) 
       throws URISyntaxException {
@@ -103,33 +93,29 @@
   }
   
   public String getTitle() {
-    return _getAttributeValue(ATITLE);
+    return getAttributeValue(ATITLE);
   }
 
   public void setTitle(String title) {
     if (title != null)
-      _setAttributeValue(ATITLE, title);
+      setAttributeValue(ATITLE, title);
     else 
-      _removeAttribute(ATITLE);
+      removeAttribute(ATITLE);
   }
 
   public URI getHref() throws URISyntaxException {
-    return _getUriValue(_getAttributeValue(HREF));
+    return _getUriValue(getAttributeValue(HREF));
   }
 
   public URI getResolvedHref() throws URISyntaxException {
     return _resolve(getResolvedBaseUri(), getHref());
   }
   
-  public void setHref(URI href) {
+  public void setHref(String href) throws URISyntaxException {
     if (href != null)
-      _setAttributeValue(HREF, _getStringValue(href));
+      setAttributeValue(HREF, (new URI(href).toString()));
     else 
-      _removeAttribute(HREF);
-  }
-
-  public void setHref(String href) throws URISyntaxException {
-    setHref((href != null) ? new URI(href) : null);
+      removeAttribute(HREF);
   }
   
   public String[] getAccept(){
@@ -150,7 +136,7 @@
       }
       _setElementValue(ACCEPT, value);
     } else {
-      _removeElement(ACCEPT, false);
+      _removeChildren(ACCEPT, false);
     }
   }
 

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java Thu Jul 13 22:26:38 2006
@@ -22,6 +22,7 @@
 
 import javax.activation.DataHandler;
 import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
 import javax.activation.URLDataSource;
 import javax.xml.namespace.QName;
 
@@ -100,13 +101,13 @@
   private void init(Type type) {
     this.type = type;
     if (Type.TEXT.equals(type))
-      _setAttributeValue(TYPE, "text");
+      setAttributeValue(TYPE, "text");
     else if (Type.HTML.equals(type)) 
-      _setAttributeValue(TYPE, "html");
+      setAttributeValue(TYPE, "html");
     else if (Type.XHTML.equals(type))
-      _setAttributeValue(TYPE, "xhtml");
+      setAttributeValue(TYPE, "xhtml");
     else {
-      _removeAttribute(TYPE);
+      removeAttribute(TYPE);
     }
   }
   
@@ -139,7 +140,7 @@
 
   public MimeType getMimeType() {
     MimeType type = null;
-    String mimeType = _getAttributeValue(TYPE);
+    String mimeType = getAttributeValue(TYPE);
     if (mimeType != null) {
       try {
         type = new MimeType(mimeType);
@@ -148,34 +149,27 @@
     return type;
   }
   
-  public void setMimeType(MimeType type) {
+  public void setMimeType(String type) throws MimeTypeParseException {
     if (type != null)
-      _setAttributeValue(TYPE, type.toString());
-    else 
-      _removeAttribute(TYPE);
-  }
-
-  public void setMimeType(String type) {
-    _setAttributeValue(TYPE, type);
+      setAttributeValue(TYPE, (new MimeType(type)).toString());
+    else
+      removeAttribute(TYPE);
   }
 
   public URI getSrc() throws URISyntaxException {
-    return _getUriValue(_getAttributeValue(SRC));
+    return _getUriValue(getAttributeValue(SRC));
   }
 
   public URI getResolvedSrc() throws URISyntaxException {
     return _resolve(getResolvedBaseUri(), getSrc());
   }
   
-  public void setSrc(URI src) {
+  public void setSrc(String src) throws URISyntaxException {
     if (src != null)
-      _setAttributeValue(SRC, _getStringValue(src));
+      setAttributeValue(SRC, (new URI(src)).toString());
     else 
-      _removeAttribute(SRC);
-  }
-  
-  public void setSrc(String src) throws URISyntaxException {
-    setSrc((src != null) ? new URI(src) : null);
+      removeAttribute(SRC);
+
   }
 
   public DataHandler getDataHandler() {
@@ -201,7 +195,7 @@
     if (!Type.MEDIA.equals(type)) throw new IllegalArgumentException();
     if (dataHandler.getContentType() != null) {
       try {
-        setMimeType(new MimeType(dataHandler.getContentType()));
+        setMimeType(dataHandler.getContentType());
       } catch (Exception e) {}
     }
     _removeAllChildren();
@@ -230,7 +224,7 @@
   }
   
   public void setValue(String value) {
-    if (value != null) setSrc((URI)null);
+    if (value != null) removeAttribute(SRC);
     if (value != null) {
       if (Type.TEXT.equals(type)) {
         _removeAllChildren();
@@ -255,9 +249,15 @@
         Element element = _parse(value, baseUri);
         if (element != null)
           setValueElement(element);
+        try {
+          setMimeType("application/xml");
+        } catch (Exception e) {}
       } else if (Type.MEDIA.equals(type)) {
         _removeAllChildren();
         super.setText(value);
+        try {
+          setMimeType("text/plain");
+        } catch (Exception e) {}
       }
     } else {
       _removeAllChildren();

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java Thu Jul 13 22:26:38 2006
@@ -74,7 +74,7 @@
   }
 
   public String[] getXhtmlClass() {
-    String _class = _getAttributeValue(CLASS);
+    String _class = getAttributeValue(CLASS);
     String[] classes = null;
     if (_class != null) {
       classes = _class.split(" ");
@@ -83,25 +83,25 @@
   }
 
   public String getId() {
-    return _getAttributeValue(AID);
+    return getAttributeValue(AID);
   }
 
   public String getTitle() {
-    return _getAttributeValue(ATITLE);
+    return getAttributeValue(ATITLE);
   }
 
   public void setId(String id) {
     if (id != null)
-      _setAttributeValue(AID, id);
+      setAttributeValue(AID, id);
     else 
-      _removeAttribute(AID);
+      removeAttribute(AID);
   }
   
   public void setTitle(String title) {
     if (title != null)
-      _setAttributeValue(ATITLE, title);
+      setAttributeValue(ATITLE, title);
     else 
-      _removeAttribute(ATITLE);
+      removeAttribute(ATITLE);
   }
   
   public void setXhtmlClass(String[] classes) {
@@ -111,8 +111,8 @@
         if (s.length() > 0) val += " ";
         val += s;
       }
-      _setAttributeValue(CLASS, val);
-    } else _removeAttribute(CLASS);
+      setAttributeValue(CLASS, val);
+    } else removeAttribute(CLASS);
   }
 
   public String getValue() {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java Thu Jul 13 22:26:38 2006
@@ -26,6 +26,7 @@
 import java.util.Iterator;
 
 import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
 import javax.xml.stream.XMLStreamException;
 
 import org.apache.abdera.factory.Factory;
@@ -100,12 +101,8 @@
     return base;
   }
 
-  public void setBaseUri(URI base) {
-    this.base = base;
-  }
-  
   public void setBaseUri(String base) throws URISyntaxException {
-    setBaseUri((base != null) ? new URI(base) : null);
+    this.base = new URI(base);
   }
 
   public void writeTo(OutputStream out) throws IOException {
@@ -132,8 +129,10 @@
     return contentType;
   }
   
-  public void setContentType(MimeType contentType) {
-    this.contentType = contentType;
+  public void setContentType(String contentType) throws MimeTypeParseException {
+    this.contentType = new MimeType(contentType);
+    if (this.contentType.getParameter("charset") != null)
+      setCharset(this.contentType.getParameter("charset"));
   }
   
   public Date getLastModified() {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java Thu Jul 13 22:26:38 2006
@@ -24,6 +24,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
@@ -39,6 +40,7 @@
 import org.apache.abdera.model.Text;
 import org.apache.abdera.parser.Parser;
 import org.apache.abdera.parser.ParserOptions;
+import org.apache.abdera.parser.stax.util.FOMList;
 import org.apache.abdera.util.Constants;
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMComment;
@@ -162,15 +164,15 @@
   }
   
   public String getLanguage() {
-    return _getAttributeValue(LANG);
+    return getAttributeValue(LANG);
   }
 
   public void setLanguage(String language) {
-    _setAttributeValue(LANG,language);
+    setAttributeValue(LANG,language);
   }
 
   public URI getBaseUri() throws URISyntaxException {
-    URI uri = _getUriValue(_getAttributeValue(BASE));
+    URI uri = _getUriValue(getAttributeValue(BASE));
     if (uri == null) {
       if (parent instanceof Element) {
         uri = ((Element)parent).getBaseUri();
@@ -183,7 +185,7 @@
 
   public URI getResolvedBaseUri() throws URISyntaxException {
     URI baseUri = null;
-    URI uri = _getUriValue(_getAttributeValue(BASE));
+    URI uri = _getUriValue(getAttributeValue(BASE));
     if (parent instanceof Element) 
       baseUri = ((Element)parent).getResolvedBaseUri();
     else if (parent instanceof Document)
@@ -201,19 +203,19 @@
   }
   
   public void setBaseUri(URI base) {
-    _setAttributeValue(BASE,_getStringValue(base));
+    setAttributeValue(BASE,_getStringValue(base));
   }
   
   public void setBaseUri(String base) throws URISyntaxException {
     setBaseUri((base != null) ? new URI(base) : null);
   }
   
-  protected String _getAttributeValue(QName qname) {
+  public String getAttributeValue(QName qname) {
     OMAttribute attr = getAttribute(qname);
     return (attr != null) ? attr.getAttributeValue() : null;    
   }
   
-  protected void _setAttributeValue(QName qname, String value) {
+  public void setAttributeValue(QName qname, String value) {
     OMAttribute attr = this.getAttribute(qname);
     if (attr != null && value != null) {
       attr.setAttributeValue(value);
@@ -241,22 +243,7 @@
   
   @SuppressWarnings("unchecked")
   protected <E extends Element>List<E> _getChildrenAsSet(QName qname) {
-    List<E> set = new ArrayList<E>();
-    for (Iterator i = getChildrenWithName(qname);i.hasNext();) {
-      set.add((E)i.next());
-    }
-    return set;
-  }
-  
-  protected <E extends Element> void _setChildrenFromSet(QName qname, List<E> set) {
-    for (Iterator i = getChildrenWithName(qname);i.hasNext();) {
-      ((OMElement)i.next()).discard();
-    }
-    if (set != null) {
-      for (Element element : set) {
-        addChild((OMElement)element);
-      }
-    }
+    return new FOMList(getChildrenWithName(qname));
   }
   
   protected void _setChild(QName qname, OMElement element) {
@@ -319,27 +306,6 @@
     return document;
   }
 
-  public void setAttributeValue(QName qname, String value) {
-    _setAttributeValue(qname, value);
-  }
-
-  public void setAttributeValue(
-    String namespace, 
-    String localPart, 
-    String prefix, 
-    String value) {
-      setAttributeValue(new QName(namespace, localPart, prefix), value);
-  }
-  
-  public String getAttributeValue(QName qname) {
-    OMAttribute attr = getAttribute(qname);
-    return (attr != null) ? attr.getAttributeValue() : null;
-  }
-  
-  public String getAttributeValue(String namespace, String localPart) {
-    return this.getAttributeValue(new QName(namespace, localPart));
-  }
-
   public String getAttributeValue(String name) {
     return getAttributeValue(new QName(name));
   }
@@ -384,7 +350,7 @@
         if (el != null) el.discard();
       }
       _setChild(qname, (OMElement)text);
-    } else _removeElement(qname, false);
+    } else _removeChildren(qname, false);
   }
 
   protected Text setTextText(QName qname, String value) {
@@ -449,7 +415,7 @@
       OMAttribute attr = (OMAttribute) i.next();
       list.add(attr.getQName());
     }
-    return list;
+    return Collections.unmodifiableList(list);
   }
   
   public List<QName> getExtensionAttributes() {
@@ -463,7 +429,7 @@
           !namespace.equals(""))
         list.add(attr.getQName());
     }
-    return list;
+    return Collections.unmodifiableList(list);
   }
   
   
@@ -479,12 +445,16 @@
     return doc.getRoot();
   }
 
-  protected void _removeAttribute(QName qname) {
-    if (getAttribute(qname) != null)
-      removeAttribute(getAttribute(qname));
+  public void removeAttribute(QName qname) {
+    OMAttribute attr = getAttribute(qname);
+    if (attr != null) removeAttribute(attr);
+  }
+  
+  public void removeAttribute(String name) {
+    removeAttribute(getAttribute(new QName(name)));
   }
   
-  protected void _removeElement(QName qname, boolean many) {
+  protected void _removeChildren(QName qname, boolean many) {
     if (many) {
       for (Iterator i = getChildrenWithName(qname); i.hasNext();) {
         OMElement element = (OMElement) i.next();

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java Thu Jul 13 22:26:38 2006
@@ -19,8 +19,6 @@
 
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -30,6 +28,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.AtomDate;
 import org.apache.abdera.model.Category;
 import org.apache.abdera.model.Content;
 import org.apache.abdera.model.Control;
@@ -44,6 +43,7 @@
 import org.apache.abdera.model.Source;
 import org.apache.abdera.model.Text;
 import org.apache.abdera.model.Content.Type;
+import org.apache.abdera.parser.stax.util.FOMHelper;
 import org.apache.abdera.util.Constants;
 import org.apache.abdera.util.URIHelper;
 import org.apache.axiom.om.OMContainer;
@@ -53,7 +53,6 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-
 public class FOMEntry
   extends FOMExtensibleElement 
   implements Entry {
@@ -111,10 +110,6 @@
     return _getChildrenAsSet(AUTHOR);
   }
 
-  public void setAuthors(List<Person> people) {
-    _setChildrenFromSet(AUTHOR, people);
-  }
-
   public void addAuthor(Person person) {
     addChild((OMElement)person);
   }
@@ -135,40 +130,12 @@
     return person;
   }
   
-  public Person addAuthor(String name, String email, URI uri) {
-    FOMFactory fomfactory = (FOMFactory) this.factory;
-    Person person = fomfactory.newAuthor(this);
-    person.setName(name);
-    person.setEmail(email);
-    person.setUri(uri);
-    return person;    
-  }
-
   public List<Category> getCategories() {
     return _getChildrenAsSet(CATEGORY);
   }
 
-  public List<Category> getCategories(URI scheme) {
-    List<Category> categories = getCategories();
-    List<Category> matching = new ArrayList<Category>();
-    for (Category category : categories) {
-      try {
-        URI uri = category.getScheme();
-        if ((uri != null && uri.equals(scheme)) ||
-            (uri == null && scheme == null)) {
-          matching.add(category);
-        }
-      } catch (Exception e) {}
-    }
-    return matching;
-  }
-  
   public List<Category> getCategories(String scheme) throws URISyntaxException {
-    return getCategories((scheme != null) ? new URI(scheme) : null);
-  }
-
-  public void setCategories(List<Category> categories) {
-    _setChildrenFromSet(CATEGORY, categories);
+    return FOMHelper.getCategories(this, scheme);
   }
 
   public void addCategory(Category category) {
@@ -182,15 +149,6 @@
     return category;
   }
 
-  public Category addCategory(URI scheme, String term, String label) {
-    FOMFactory factory = (FOMFactory) this.factory;
-    Category category = factory.newCategory(this);
-    category.setTerm(term);
-    category.setScheme(scheme);
-    category.setLabel(label);
-    return category;
-  }
-  
   public Category addCategory(String scheme, String term, String label) throws URISyntaxException {
     FOMFactory factory = (FOMFactory) this.factory;
     Category category = factory.newCategory(this);
@@ -211,17 +169,10 @@
       if (element != null) element.discard();
       _setChild(CONTENT, (OMElement)content);
     } else {
-      _removeElement(CONTENT, false);
+      _removeChildren(CONTENT, false);
     }
   }
   
-  public Content setContent() {
-    FOMFactory factory = (FOMFactory) this.factory;
-    Content content = factory.newContent(Content.Type.TEXT);
-    setContentElement(content);
-    return content;
-  }
-  
   /**
    * Sets the content for this entry as @type="text"
    */
@@ -244,16 +195,6 @@
   /**
    * Sets the content for this entry
    */
-  public Content setContent(Content.Type type) {
-    FOMFactory factory = (FOMFactory) this.factory;
-    Content content = factory.newContent(type);
-    setContentElement(content);
-    return content;
-  }
-  
-  /**
-   * Sets the content for this entry
-   */
   public Content setContent(String value, Content.Type type) {
     FOMFactory factory = (FOMFactory) this.factory;
     Content content = factory.newContent(type);
@@ -265,9 +206,12 @@
   /**
    * Sets the content for this entry
    */
-  public Content setContent(Element value, Content.Type type) {
+  public Content setContent(Element value) {
     FOMFactory factory = (FOMFactory) this.factory;
-    Content content = factory.newContent(type);
+    Content content = factory.newContent(
+      (value instanceof Div) ? 
+        Content.Type.XHTML : 
+        Content.Type.XHTML);
     content.setValueElement(value);
     setContentElement(content);
     return content;
@@ -275,41 +219,30 @@
   
   /**
    * Sets the content for this entry
+   * @throws MimeTypeParseException 
    */
-  public Content setContent(MimeType mediaType) {
+  public Content setContent(Element element, String mediaType) throws MimeTypeParseException {
     FOMFactory factory = (FOMFactory) this.factory;
-    Content content = factory.newContent(mediaType);
+    Content content = factory.newContent(new MimeType(mediaType), element);
     setContentElement(content);
     return content;
   }
   
   /**
    * Sets the content for this entry
+   * @throws MimeTypeParseException 
    */
-  public Content setContent(URI src, MimeType mediaType) {
-    FOMFactory factory = (FOMFactory) this.factory;
-    Content content = factory.newContent(mediaType);
-    content.setSrc(src);
-    setContentElement(content);
-    return content;
-  }
+  public Content setContent(DataHandler dataHandler) throws MimeTypeParseException {
+     return setContent(dataHandler, dataHandler.getContentType());
+  }  
   
   /**
    * Sets the content for this entry
+   * @throws MimeTypeParseException 
    */
-  public Content setContent(Element element, MimeType mediaType) {
+  public Content setContent(DataHandler dataHandler, String mediatype) throws MimeTypeParseException {
     FOMFactory factory = (FOMFactory) this.factory;
-    Content content = factory.newContent(mediaType, element);
-    setContentElement(content);
-    return content;
-  }
-  
-  /**
-   * Sets the content for this entry
-   */
-  public Content setContent(DataHandler dataHandler, MimeType mediatype) {
-    FOMFactory factory = (FOMFactory) this.factory;
-    Content content = factory.newContent(mediatype);
+    Content content = factory.newContent(new MimeType(mediatype));
     content.setDataHandler(dataHandler);
     setContentElement(content);
     return content;
@@ -317,10 +250,11 @@
   
   /**
    * Sets the content for this entry
+   * @throws MimeTypeParseException 
    */
-  public Content setContent(String value, MimeType mediatype) {
+  public Content setContent(String value, String mediatype) throws MimeTypeParseException {
     FOMFactory factory = (FOMFactory) this.factory;
-    Content content = factory.newContent(mediatype);
+    Content content = factory.newContent(new MimeType(mediatype));
     content.setValue(value);
     setContentElement(content);
     return content;
@@ -331,10 +265,6 @@
     return _getChildrenAsSet(CONTRIBUTOR);
   }
 
-  public void setContributors(List<Person> people) {
-    _setChildrenFromSet(CONTRIBUTOR, people);
-  }
-
   public void addContributor(Person person) {
     addChild((OMElement)person);
   }
@@ -359,18 +289,6 @@
     return person;
   }
   
-  public Person addContributor(
-    String name, 
-    String email, 
-    URI uri) {
-      FOMFactory fomfactory = (FOMFactory) this.factory;
-      Person person = fomfactory.newContributor(this);
-      person.setName(name);
-      person.setEmail(email);
-      person.setUri(uri);
-      return person;    
-  }
-  
   public IRI getIdElement() {
     return (IRI)getFirstChildWithName(ID);
   }
@@ -379,7 +297,7 @@
     if (id != null)
       _setChild(ID, (OMElement)id);
     else
-      _removeElement(ID, false);
+      _removeChildren(ID, false);
   }
 
   public URI getId() throws URISyntaxException {
@@ -387,17 +305,13 @@
     return (id != null) ? id.getValue() : null;
   }
   
-  public IRI setId(URI value) throws URISyntaxException {
-    return setId(value, false);
-  }
-  
   public IRI setId(String value) throws URISyntaxException {
     return setId(value, false);
   }
   
-  public IRI setId(URI value, boolean normalize) throws URISyntaxException {
+  public IRI setId(String value, boolean normalize) throws URISyntaxException {
     if (value == null) {
-      _removeElement(ID, false);
+      _removeChildren(ID, false);
       return null;
     }
     IRI id = getIdElement();
@@ -413,34 +327,12 @@
     }
   }
   
-  public IRI setId(String value, boolean normalize) throws URISyntaxException {
-    return setId((value != null) ? new URI(value) : null, normalize);
-  }
-  
   public List<Link> getLinks() {
     return _getChildrenAsSet(LINK);
   }
 
   public List<Link> getLinks(String rel) {
-    if (rel == null) return getLinks();
-    List<Link> links = getLinks();
-    List<Link> matching = new ArrayList<Link>();
-    for (Link link : links) {
-      String value = FOMLink.getRelEquiv(link.getRel());
-      rel = FOMLink.getRelEquiv(rel);
-      if (rel.equalsIgnoreCase(Link.REL_ALTERNATE) && 
-          (value == null || 
-            value.equalsIgnoreCase(Link.REL_ALTERNATE))) {
-        matching.add(link);
-      } else if (rel.equalsIgnoreCase(value)) {
-        matching.add(link);
-      }
-    }
-    return matching;
-  }
-
-  public void setLinks(List<Link> links) {
-    _setChildrenFromSet(LINK, links);
+    return FOMHelper.getLinks(this, rel);
   }
 
   public void addLink(Link link) {
@@ -459,74 +351,6 @@
     return link;    
   }
   
-  public Link addLink(URI href) {
-    return addLink(href, null);
-  }
-  
-  public Link addLink(URI href, String rel) {
-    FOMFactory fomfactory = (FOMFactory) factory;
-    Link link = fomfactory.newLink(this);
-    link.setHref(href);
-    link.setRel(rel);
-    return link;
-  }
-  
-  public Link addLink(
-    URI href, 
-    String rel, 
-    MimeType type, 
-    String title, 
-    String hreflang, 
-    long length) {
-    FOMFactory fomfactory = (FOMFactory) factory;
-    Link link = fomfactory.newLink(this);
-    link.setHref(href);
-    link.setRel(rel);
-    link.setMimeType(type);
-    link.setTitle(title);
-    link.setHrefLang(hreflang);
-    link.setLength(length);
-    return link;    
-  }
-  
-  public Link addLink(
-    String href, 
-    String rel, 
-    MimeType type, 
-    String title, 
-    String hreflang, 
-    long length) 
-      throws URISyntaxException {
-    FOMFactory fomfactory = (FOMFactory) factory;
-    Link link = fomfactory.newLink(this);
-    link.setHref(href);
-    link.setRel(rel);
-    link.setMimeType(type);
-    link.setTitle(title);
-    link.setHrefLang(hreflang);
-    link.setLength(length);
-    return link;
-  }
-  
-  public Link addLink(
-    URI href, 
-    String rel, 
-    String type, 
-    String title, 
-    String hreflang, 
-    long length) 
-      throws MimeTypeParseException {
-    FOMFactory fomfactory = (FOMFactory) factory;
-    Link link = fomfactory.newLink(this);
-    link.setHref(href);
-    link.setRel(rel);
-    link.setMimeType(type);
-    link.setTitle(title);
-    link.setHrefLang(hreflang);
-    link.setLength(length);
-    return link;
-  }
-  
   public Link addLink(
     String href, 
     String rel, 
@@ -554,81 +378,37 @@
     if (dateTime != null)
       _setChild(PUBLISHED, (OMElement)dateTime);
     else
-      _removeElement(PUBLISHED, false);
+      _removeChildren(PUBLISHED, false);
   }
 
-  public String getPublishedString() {
-    DateTime dte = getPublishedElement();
-    return (dte != null) ? dte.getString() : null;
-  }
-  
   public Date getPublished() {
     DateTime dte = getPublishedElement();
     return (dte != null) ? dte.getDate() : null;
   }
   
-  public DateTime setPublished(Date value) {
-    if (value == null) {
-      _removeElement(PUBLISHED, false);
-      return null;
-    }
-    DateTime dte = getPublishedElement();
-    if (dte != null) {
-      dte.setDate(value);
-      return dte;
-    } else {
-      FOMFactory fomfactory = (FOMFactory) factory;
-      DateTime dt = fomfactory.newPublished(this);
-      dt.setDate(value);
-      return dt;
-    }
-  }
-  
-  public DateTime setPublished(Calendar value) {
+  private DateTime setPublished(AtomDate value) {
     if (value == null) {
-      _removeElement(PUBLISHED, false);
+      _removeChildren(PUBLISHED, false);
       return null;
     }
     DateTime dte = getPublishedElement();
     if (dte != null) {
-      dte.setCalendar(value);
+      dte.setValue(value);
       return dte;
     } else {
       FOMFactory fomfactory = (FOMFactory) factory;
       DateTime dt = fomfactory.newPublished(this);
-      dt.setCalendar(value);
+      dt.setValue(value);
       return dt;
     }
   }
   
-  public DateTime setPublished(long value) {
-    DateTime dte = getPublishedElement();
-    if (dte != null) {
-      dte.setTime(value);
-      return dte;
-    } else {
-      FOMFactory fomfactory = (FOMFactory) factory;
-      DateTime dt = fomfactory.newPublished(this);
-      dt.setTime(value);
-      return dt;
-    }
+  public DateTime setPublished(Date value) {
+    return setPublished((value != null) ? AtomDate.valueOf(value) : null);
   }
   
   public DateTime setPublished(String value) {
-    if (value == null) {
-      _removeElement(PUBLISHED, false);
-      return null;
-    }
-    DateTime dte = getPublishedElement();
-    if (dte != null) {
-      dte.setString(value);
-      return dte;
-    } else {
-      FOMFactory fomfactory = (FOMFactory) factory;
-      DateTime dt = fomfactory.newPublished(this);
-      dt.setString(value);
-      return dt;
-    }
+    return setPublished((value != null) ? AtomDate.valueOf(value) : null);
   }
   
   @SuppressWarnings("unchecked")
@@ -640,13 +420,6 @@
     setTextElement(RIGHTS, text, false);
   }
   
-  public Text setRights() {
-    FOMFactory factory = (FOMFactory)this.factory;
-    Text text = factory.newRights(Text.Type.TEXT);
-    setRightsElement(text);
-    return text;
-  }
-  
   public Text setRights(String value) {
     FOMFactory factory = (FOMFactory)this.factory;
     Text text = factory.newRights();
@@ -663,13 +436,6 @@
     return setRights(value, Text.Type.XHTML);
   }
   
-  public Text setRights(Text.Type type) {
-    FOMFactory factory = (FOMFactory)this.factory;
-    Text text = factory.newRights(type);
-    setRightsElement(text);
-    return text;
-  }
-  
   public Text setRights(String value, Text.Type type) {
     FOMFactory factory = (FOMFactory)this.factory;
     Text text = factory.newRights(type);
@@ -699,7 +465,7 @@
         source = ((Feed)source).getAsSource();
       _setChild(SOURCE, (OMElement)source);
     } else {
-      _removeElement(SOURCE, false);
+      _removeChildren(SOURCE, false);
     }
   }
 
@@ -712,13 +478,6 @@
     setTextElement(SUMMARY, text, false);
   }
   
-  public Text setSummary() {
-    FOMFactory factory = (FOMFactory)this.factory;
-    Text text = factory.newSummary(Text.Type.TEXT);
-    setSummaryElement(text);
-    return text;
-  }
-  
   public Text setSummary(String value) {
     FOMFactory factory = (FOMFactory)this.factory;
     Text text = factory.newSummary();
@@ -735,13 +494,6 @@
     return setSummary(value, Text.Type.XHTML);
   }
   
-  public Text setSummary(Text.Type type) {
-    FOMFactory factory = (FOMFactory)this.factory;
-    Text text = factory.newSummary(type);
-    setSummaryElement(text);
-    return text;
-  }
-  
   public Text setSummary(String value, Text.Type type) {
     FOMFactory factory = (FOMFactory)this.factory;
     Text text = factory.newSummary(type);
@@ -770,13 +522,6 @@
     setTextElement(TITLE, title, false);
   }
 
-  public Text setTitle() {
-    FOMFactory factory = (FOMFactory)this.factory;
-    Text text = factory.newTitle(Text.Type.TEXT);
-    setTitleElement(text);
-    return text;
-  }
-  
   public Text setTitle(String value) {
     FOMFactory factory = (FOMFactory)this.factory;
     Text text = factory.newTitle();
@@ -793,13 +538,6 @@
     return setTitle(value, Text.Type.XHTML);
   }
   
-  public Text setTitle(Text.Type type) {
-    FOMFactory factory = (FOMFactory)this.factory;
-    Text text = factory.newTitle(type);
-    setTitleElement(text);
-    return text;
-  }
-  
   public Text setTitle(String value, Text.Type type) {
     FOMFactory factory = (FOMFactory)this.factory;
     Text text = factory.newTitle(type);
@@ -827,81 +565,37 @@
     if (updated != null)
       _setChild(UPDATED, (OMElement)updated);
     else 
-      _removeElement(UPDATED, false);
+      _removeChildren(UPDATED, false);
   }
 
-  public String getUpdatedString() {
-    DateTime dte = getUpdatedElement();
-    return (dte != null) ? dte.getString() : null;
-  }
-  
   public Date getUpdated() {
     DateTime dte = getUpdatedElement();
     return (dte != null) ? dte.getDate() : null;
   }
   
-  public DateTime setUpdated(Date value) {
-    if (value == null) {
-      _removeElement(UPDATED, false);
-      return null;
-    }
-    DateTime dte = getUpdatedElement();
-    if (dte != null) {
-      dte.setDate(value);
-      return dte;
-    } else {
-      FOMFactory fomfactory = (FOMFactory) factory;
-      DateTime dt = fomfactory.newUpdated(this);
-      dt.setDate(value);
-      return dt;
-    }
-  }
-  
-  public DateTime setUpdated(Calendar value) {
+  private DateTime setUpdated(AtomDate value) {
     if (value == null) {
-      _removeElement(UPDATED, false);
+      _removeChildren(UPDATED, false);
       return null;
     }
     DateTime dte = getUpdatedElement();
     if (dte != null) {
-      dte.setCalendar(value);
+      dte.setValue(value);
       return dte;
     } else {
       FOMFactory fomfactory = (FOMFactory) factory;
       DateTime dt = fomfactory.newUpdated(this);
-      dt.setCalendar(value);
+      dt.setValue(value);
       return dt;
     }
   }
   
-  public DateTime setUpdated(long value) {
-    DateTime dte = getUpdatedElement();
-    if (dte != null) {
-      dte.setTime(value);
-      return dte;
-    } else {
-      FOMFactory fomfactory = (FOMFactory) factory;
-      DateTime dt = fomfactory.newUpdated(this);
-      dt.setTime(value);
-      return dt;
-    }
+  public DateTime setUpdated(Date value) {
+    return setUpdated((value != null) ? AtomDate.valueOf(value) : null);
   }
   
   public DateTime setUpdated(String value) {
-    if (value == null) {
-      _removeElement(UPDATED, false);
-      return null;
-    }
-    DateTime dte = getUpdatedElement();
-    if (dte != null) {
-      dte.setString(value);
-      return dte;
-    } else {
-      FOMFactory fomfactory = (FOMFactory) factory;
-      DateTime dt = fomfactory.newUpdated(this);
-      dt.setString(value);
-      return dt;
-    }
+    return setUpdated((value != null) ? AtomDate.valueOf(value) : null);
   }
 
   public Control getControl() {
@@ -912,7 +606,7 @@
     if (control != null) 
       _setChild(CONTROL, (OMElement)control);
     else 
-      _removeElement(CONTROL, false);
+      _removeChildren(CONTROL, false);
   }
 
   public Link getLink(String rel) {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java Thu Jul 13 22:26:38 2006
@@ -17,8 +17,6 @@
 */
 package org.apache.abdera.parser.stax;
 
-import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import javax.xml.namespace.QName;
@@ -26,12 +24,13 @@
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.ExtensibleElement;
+import org.apache.abdera.parser.stax.util.FOMExtensionIterator;
+import org.apache.abdera.parser.stax.util.FOMList;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
 
@@ -70,45 +69,18 @@
   }
 
   @SuppressWarnings("unchecked")
-  protected <E extends Element>List<E> _getExtensionChildrenAsList() {
-    List<E> set = new ArrayList<E>();
-    for (Iterator i = getChildren();i.hasNext();) {
-      OMNode e = (OMNode) i.next();
-      if (e instanceof Element) {
-        Element el = (Element) e;
-        QName qname = el.getQName();
-        if (!(qname.getNamespaceURI().equals(getQName().getNamespaceURI()))) {
-          set.add((E)e);
-        }
-      }
-    }
-    return set;
-  }
-  
   public List<Element> getExtensions() {
-    return _getExtensionChildrenAsList();
+    return new FOMList<Element>(new FOMExtensionIterator(this));
   }
 
+  @SuppressWarnings("unchecked")
   public List<Element> getExtensions(String uri) {
-    List<Element> matching = new ArrayList<Element>();
-    for (Iterator i = this.getChildElements(); i.hasNext();) {
-      OMElement e = (OMElement) i.next();
-      if ((uri == null)?
-            e.getQName().getNamespaceURI() == null: 
-            e.getQName().getNamespaceURI().equals(uri)) {
-        matching.add((Element) e);
-      }
-    }
-    return matching;
+    return new FOMList<Element>(new FOMExtensionIterator(this, uri));
   }
 
   @SuppressWarnings("unchecked")
   public <T extends Element>List<T> getExtensions(QName qname) {
-    List<T> matching = new ArrayList<T>();
-    for (Iterator i = this.getChildrenWithName(qname); i.hasNext();) {
-      matching.add((T) i.next());
-    }
-    return matching;
+    return new FOMList<T>(getChildrenWithName(qname));
   }
 
   @SuppressWarnings("unchecked")

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java Thu Jul 13 22:26:38 2006
@@ -245,8 +245,10 @@
       Content content = 
         _newInstance(
           FOMContent.class, CONSTRUCTORS[3], type, (OMContainer)parent, this);
-      if (type.equals(Content.Type.XML))
-        content.setMimeType("application/xml");
+      try {
+        if (type.equals(Content.Type.XML))
+          content.setMimeType("application/xml");
+      } catch (Exception e) {}
       return content;
   }
   
@@ -261,7 +263,9 @@
       (MimeTypeHelper.isXml(mediaType.toString())) ? 
          Content.Type.XML : Content.Type.MEDIA;
     Content content = newContent(type, parent);
-    content.setMimeType(mediaType);
+    try {
+      content.setMimeType(mediaType.toString());
+    } catch (Exception e) {}
     return content;
   }
 

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java Thu Jul 13 22:26:38 2006
@@ -88,10 +88,6 @@
     return _getChildrenAsSet(ENTRY);
   }
 
-  public void setEntries(List<Entry> entries) {
-    _setChildrenFromSet(ENTRY, entries);
-  }
-
   public void addEntry(Entry entry) {
     addChild((OMElement)entry);
   }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java Thu Jul 13 22:26:38 2006
@@ -45,16 +45,6 @@
   public FOMGenerator(
     String value, 
     String version, 
-    URI uri) {
-      this();
-      setText(value);
-      setVersion(version);
-      setUri(uri);
-  }
-
-  public FOMGenerator(
-    String value, 
-    String version, 
     String uri) 
       throws URISyntaxException {
     this();
@@ -103,28 +93,30 @@
   }
   
   public URI getUri() throws URISyntaxException {
-    String value = _getAttributeValue(AURI);
+    String value = getAttributeValue(AURI);
     return (value != null) ? new URI(value) : null;
 }
 
   public URI getResolvedUri() throws URISyntaxException {
     return _resolve(getResolvedBaseUri(), getUri());
   }
-  
-  public void setUri(URI uri) {
-    _setAttributeValue(AURI, (uri != null) ? uri.toString() : null);
-  }
 
   public void setUri(String uri) throws URISyntaxException {
-    setUri((uri != null) ? new URI(uri) : null);
+    if (uri != null)
+      setAttributeValue(AURI, (new URI(uri)).toString());
+    else 
+      removeAttribute(AURI);
   }
   
   public String getVersion() {
-    return _getAttributeValue(VERSION);
+    return getAttributeValue(VERSION);
   }
 
   public void setVersion(String version) {
-    _setAttributeValue(VERSION, version);
+    if (version != null)
+      setAttributeValue(VERSION, version);
+    else
+      removeAttribute(VERSION);
   }
 
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java?rev=421809&r1=421808&r2=421809&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java Thu Jul 13 22:26:38 2006
@@ -42,11 +42,6 @@
     super(qname, null, (OMFactory)Factory.INSTANCE);
   }
   
-  public FOMIRI(QName qname, URI value) {
-    this(qname);
-    setValue(value);
-  }
-
   public FOMIRI(QName qname, String value) throws URISyntaxException {
     this(qname);
     setValue(value);
@@ -82,29 +77,22 @@
     return _getUriValue(getText());
   }
 
-  public void setValue(URI iri) {
+  public void setValue(String iri) throws URISyntaxException {
     if (iri != null)
-      setText(_getStringValue(iri));
+      setText((new URI(iri)).toString());
     else
       _removeAllChildren();
-  }
 
-  public void setValue(String iri) throws URISyntaxException {
-    setValue((iri != null) ? new URI(iri) : null);
   }
   
   public java.net.URI getResolvedValue() throws URISyntaxException {
     return _resolve(getResolvedBaseUri(), getValue());
   }
 
-  public void setNormalizedValue(URI uri) throws URISyntaxException {
+  public void setNormalizedValue(String uri) throws URISyntaxException {
     if (uri != null)
       setValue(URIHelper.normalize(uri));
     else 
-      setValue((URI)null);
-  }
-
-  public void setNormalizedValue(String id) throws URISyntaxException {
-    setNormalizedValue((id != null)?new URI(id):null);
+      setValue(null);
   }
 }



Mime
View raw message