abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1186541 [5/8] - in /abdera/abdera2: ./ .settings/ activities/ activities/.settings/ activities/src/main/java/org/apache/abdera2/activities/client/ activities/src/main/java/org/apache/abdera2/activities/extra/ activities/src/main/java/org/a...
Date Wed, 19 Oct 2011 22:33:52 GMT
Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/StreamBuilder.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/StreamBuilder.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/StreamBuilder.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/StreamBuilder.java Wed Oct 19 22:33:04 2011
@@ -22,12 +22,12 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Writer;
 import java.nio.channels.WritableByteChannel;
-import java.util.Date;
 import java.util.Locale;
 
 import javax.activation.DataHandler;
 import javax.xml.namespace.QName;
 
+import org.joda.time.DateTime;
 import org.apache.abdera2.Abdera;
 import org.apache.abdera2.common.anno.Name;
 import org.apache.abdera2.common.iri.IRI;
@@ -415,7 +415,7 @@ public class StreamBuilder extends Abstr
         return (StreamBuilder)super.writeAcceptsNothing();
     }
 
-    public StreamBuilder writeAttribute(QName qname, Date value) {
+    public StreamBuilder writeAttribute(QName qname, DateTime value) {
         return (StreamBuilder)super.writeAttribute(qname, value);
     }
 
@@ -435,7 +435,7 @@ public class StreamBuilder extends Abstr
         return (StreamBuilder)super.writeAttribute(qname, value);
     }
 
-    public StreamBuilder writeAttribute(String name, Date value) {
+    public StreamBuilder writeAttribute(String name, DateTime value) {
         return (StreamBuilder)super.writeAttribute(name, value);
     }
 
@@ -451,7 +451,7 @@ public class StreamBuilder extends Abstr
         return (StreamBuilder)super.writeAttribute(name, value);
     }
 
-    public StreamBuilder writeAttribute(String name, String namespace, Date value) {
+    public StreamBuilder writeAttribute(String name, String namespace, DateTime value) {
         return (StreamBuilder)super.writeAttribute(name, namespace, value);
     }
 
@@ -467,7 +467,7 @@ public class StreamBuilder extends Abstr
         return (StreamBuilder)super.writeAttribute(name, namespace, value);
     }
 
-    public StreamBuilder writeAttribute(String name, String namespace, String prefix, Date value) {
+    public StreamBuilder writeAttribute(String name, String namespace, String prefix, DateTime value) {
         return (StreamBuilder)super.writeAttribute(name, namespace, prefix, value);
     }
 
@@ -543,7 +543,7 @@ public class StreamBuilder extends Abstr
         return (StreamBuilder)super.writeContributor(name);
     }
 
-    public StreamBuilder writeDate(QName qname, Date date) {
+    public StreamBuilder writeDate(QName qname, DateTime date) {
         return (StreamBuilder)super.writeDate(qname, date);
     }
 
@@ -551,15 +551,15 @@ public class StreamBuilder extends Abstr
         return (StreamBuilder)super.writeDate(qname, date);
     }
 
-    public StreamBuilder writeDate(String name, Date date) {
+    public StreamBuilder writeDate(String name, DateTime date) {
         return (StreamBuilder)super.writeDate(name, date);
     }
 
-    public StreamBuilder writeDate(String name, String namespace, Date date) {
+    public StreamBuilder writeDate(String name, String namespace, DateTime date) {
         return (StreamBuilder)super.writeDate(name, namespace, date);
     }
 
-    public StreamBuilder writeDate(String name, String namespace, String prefix, Date date) {
+    public StreamBuilder writeDate(String name, String namespace, String prefix, DateTime date) {
         return (StreamBuilder)super.writeDate(name, namespace, prefix, date);
     }
 
@@ -579,7 +579,7 @@ public class StreamBuilder extends Abstr
         return (StreamBuilder)super.writeDraft(draft);
     }
 
-    public StreamBuilder writeEdited(Date date) {
+    public StreamBuilder writeEdited(DateTime date) {
         return (StreamBuilder)super.writeEdited(date);
     }
 
@@ -591,7 +591,7 @@ public class StreamBuilder extends Abstr
         return (StreamBuilder)super.writeElementText(value);
     }
 
-    public StreamBuilder writeElementText(Date value) {
+    public StreamBuilder writeElementText(DateTime value) {
         return (StreamBuilder)super.writeElementText(value);
     }
 
@@ -736,7 +736,7 @@ public class StreamBuilder extends Abstr
         return (StreamBuilder)super.writePersonUri(uri);
     }
 
-    public StreamBuilder writePublished(Date date) {
+    public StreamBuilder writePublished(DateTime date) {
         return (StreamBuilder)super.writePublished(date);
     }
 
@@ -796,7 +796,7 @@ public class StreamBuilder extends Abstr
         return (StreamBuilder)super.writeTitle(type, value);
     }
 
-    public StreamBuilder writeUpdated(Date date) {
+    public StreamBuilder writeUpdated(DateTime date) {
         return (StreamBuilder)super.writeUpdated(date);
     }
 

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Categories.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Categories.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Categories.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Categories.java Wed Oct 19 22:33:04 2011
@@ -31,6 +31,7 @@ import static org.apache.abdera2.common.
  * collection.
  */
 @QName(value=LN_CATEGORIES,ns=APP_NS)
+@SuppressWarnings("rawtypes")
 public interface Categories extends ExtensibleElement {
 
     /**

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Collection.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Collection.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Collection.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Collection.java Wed Oct 19 22:33:04 2011
@@ -48,6 +48,7 @@ import org.apache.abdera2.common.selecto
  * </pre>
  */
 @QName(value=LN_COLLECTION,ns=APP_NS)
+@SuppressWarnings("rawtypes")
 public interface Collection extends ExtensibleElement {
 
     /**

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTime.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTime.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTime.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTime.java Wed Oct 19 22:33:04 2011
@@ -33,7 +33,7 @@ public interface DateTime extends Elemen
      * 
      * @return The Atom Date value of this element
      */
-    org.apache.abdera2.common.date.DateTime getValue();
+    org.joda.time.DateTime getValue();
 
     /**
      * Returns the content value of the element as a java.util.Date object
@@ -68,7 +68,7 @@ public interface DateTime extends Elemen
      * 
      * @param dateTime the Atom Date value
      */
-    DateTime setValue(org.apache.abdera2.common.date.DateTime dateTime);
+    DateTime setValue(org.joda.time.DateTime dateTime);
 
     /**
      * Sets the content value of the element

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTimeWrapper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTimeWrapper.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTimeWrapper.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/DateTimeWrapper.java Wed Oct 19 22:33:04 2011
@@ -19,9 +19,11 @@ package org.apache.abdera2.model;
 
 import java.util.Calendar;
 import java.util.Date;
+import java.util.Locale;
 
 import javax.xml.namespace.QName;
 
+import org.apache.abdera2.common.date.DateTimes;
 import org.apache.abdera2.factory.Factory;
 
 /**
@@ -37,18 +39,18 @@ public abstract class DateTimeWrapper ex
         super(factory, qname);
     }
 
-    public org.apache.abdera2.common.date.DateTime getValue() {
-        org.apache.abdera2.common.date.DateTime value = null;
+    public org.joda.time.DateTime getValue() {
+        org.joda.time.DateTime value = null;
         String v = getText();
         if (v != null) {
-            value = org.apache.abdera2.common.date.DateTime.valueOf(v);
+            value = org.joda.time.DateTime.parse(v);
         }
         return value;
     }
 
-    public DateTime setValue(org.apache.abdera2.common.date.DateTime dateTime) {
+    public DateTime setValue(org.joda.time.DateTime dateTime) {
         if (dateTime != null)
-            setText(dateTime.getValue());
+            setText(DateTimes.format(dateTime));
         else
             setText("");
         return this;
@@ -56,7 +58,7 @@ public abstract class DateTimeWrapper ex
 
     public DateTime setDate(Date date) {
         if (date != null)
-            setText(org.apache.abdera2.common.date.DateTime.valueOf(date).getValue());
+            setText(DateTimes.format(date));
         else
             setText("");
         return this;
@@ -64,43 +66,43 @@ public abstract class DateTimeWrapper ex
 
     public DateTime setCalendar(Calendar date) {
         if (date != null)
-            setText(org.apache.abdera2.common.date.DateTime.valueOf(date).getValue());
+            setText(DateTimes.format(date));
         else
             setText("");
         return this;
     }
 
     public DateTime setTime(long date) {
-        setText(org.apache.abdera2.common.date.DateTime.valueOf(date).getValue());
+        setText(DateTimes.format(date));
         return this;
     }
 
     public DateTime setString(String date) {
         if (date != null)
-            setText(org.apache.abdera2.common.date.DateTime.valueOf(date).getValue());
+            setText(DateTimes.format(date));
         else
             setText("");
         return this;
     }
 
     public Date getDate() {
-        org.apache.abdera2.common.date.DateTime ad = getValue();
-        return (ad != null) ? ad.getDate() : null;
+        org.joda.time.DateTime ad = getValue();
+        return (ad != null) ? ad.toDate() : null;
     }
 
     public Calendar getCalendar() {
-        org.apache.abdera2.common.date.DateTime ad = getValue();
-        return (ad != null) ? ad.getCalendar() : null;
+        org.joda.time.DateTime ad = getValue();
+        return (ad != null) ? ad.toCalendar(Locale.getDefault()) : null;
     }
 
     public long getTime() {
-        org.apache.abdera2.common.date.DateTime ad = getValue();
-        return (ad != null) ? ad.getTime() : null;
+        org.joda.time.DateTime ad = getValue();
+        return (ad != null) ? ad.getMillis() : null;
     }
 
     public String getString() {
-        org.apache.abdera2.common.date.DateTime ad = getValue();
-        return (ad != null) ? ad.getValue() : null;
+        org.joda.time.DateTime ad = getValue();
+        return (ad != null) ? DateTimes.format(ad) : null;
     }
 
 }

Modified: 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=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Document.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Document.java Wed Oct 19 22:33:04 2011
@@ -18,7 +18,6 @@
 package org.apache.abdera2.model;
 
 import java.io.Serializable;
-import java.util.Date;
 
 import javax.activation.MimeType;
 
@@ -88,14 +87,14 @@ public interface Document<T extends Elem
      * 
      * @return The last-modified date
      */
-    Date getLastModified();
+    org.joda.time.DateTime getLastModified();
 
     /**
      * Sets the last modified date for this document
      * 
      * @param lastModified the last-modified date
      */
-    Document<T> setLastModified(Date lastModified);
+    Document<T> setLastModified(org.joda.time.DateTime lastModified);
 
     /**
      * Gets the charset used for this document

Modified: 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=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Element.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Element.java Wed Oct 19 22:33:04 2011
@@ -266,6 +266,7 @@ public interface Element extends Base, I
      */
     <T extends Element> List<T> getElements();
 
+    @SuppressWarnings("rawtypes")
     <T extends Element> List<T> getElements(Selector selector);
     
     /**

Modified: 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=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementIteratorWrapper.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementIteratorWrapper.java Wed Oct 19 22:33:04 2011
@@ -22,6 +22,7 @@ import java.util.Iterator;
 import org.apache.abdera2.common.selector.Selector;
 import org.apache.abdera2.factory.Factory;
 
+@SuppressWarnings("rawtypes")
 public class ElementIteratorWrapper<T extends Element> implements Iterator<T> {
 
     private final Iterator<?> iterator;
@@ -57,7 +58,7 @@ public class ElementIteratorWrapper<T ex
     public T next() {
       T item = current;
       current = get_current();
-      return (T)factory.getElementWrapper(item);
+      return factory.<T>getElementWrapper(item);
     }
 
     public void remove() {

Modified: 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=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementWrapper.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ElementWrapper.java Wed Oct 19 22:33:04 2011
@@ -37,7 +37,7 @@ import org.apache.abdera2.writer.WriterO
 /**
  * Base implementation used for static extensions.
  */
-@SuppressWarnings("unchecked")
+@SuppressWarnings({"unchecked","rawtypes"})
 public abstract class ElementWrapper implements Element {
 
     private Element internal;

Modified: 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=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Entry.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Entry.java Wed Oct 19 22:33:04 2011
@@ -22,7 +22,6 @@ import static org.apache.abdera2.common.
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Date;
 import java.util.List;
 
 import javax.activation.DataHandler;
@@ -111,6 +110,7 @@ import org.apache.abdera2.common.selecto
  * </pre>
  */
 @QName(value=LN_ENTRY,ns=ATOM_NS)
+@SuppressWarnings("rawtypes")
 public interface Entry extends ExtensibleElement {
 
     Person getAuthorInherited();
@@ -528,7 +528,7 @@ public interface Entry extends Extensibl
      * 
      * @return a java.util.Date for the atom:published value
      */
-    Date getPublished();
+    org.joda.time.DateTime getPublished();
 
     /**
      * Set the value of the atom:published element
@@ -536,8 +536,10 @@ public interface Entry extends Extensibl
      * @param value The java.util.Date
      * @return The newly created atom:published element
      */
-    DateTime setPublished(Date value);
+    DateTime setPublished(org.joda.time.DateTime value);
 
+    DateTime setPublishedNow();
+    
     /**
      * Set the value of the atom:published element using the serialized string value
      * 
@@ -828,7 +830,7 @@ public interface Entry extends Extensibl
      * 
      * @return A java.util.Date value
      */
-    Date getUpdated();
+    org.joda.time.DateTime getUpdated();
 
     /**
      * Set the atom:updated value
@@ -836,8 +838,10 @@ public interface Entry extends Extensibl
      * @param value The new value
      * @return The newly created atom:updated element
      */
-    DateTime setUpdated(Date value);
+    DateTime setUpdated(org.joda.time.DateTime value);
 
+    DateTime setUpdatedNow();
+    
     /**
      * Set the atom:updated value
      * 
@@ -865,7 +869,7 @@ public interface Entry extends Extensibl
      * 
      * @return app:edited
      */
-    Date getEdited();
+    org.joda.time.DateTime getEdited();
 
     /**
      * Set the value of app:edited
@@ -873,8 +877,10 @@ public interface Entry extends Extensibl
      * @param value The java.util.Date value
      * @return The newly created app:edited element
      */
-    DateTime setEdited(Date value);
+    DateTime setEdited(org.joda.time.DateTime value);
 
+    DateTime setEditedNow();
+    
     /**
      * Set the value of app:edited
      * 

Modified: 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=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensibleElement.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensibleElement.java Wed Oct 19 22:33:04 2011
@@ -26,6 +26,7 @@ import org.apache.abdera2.common.selecto
 /**
  * An abstract element that can be extended with namespaced child elements
  */
+@SuppressWarnings("rawtypes")
 public interface ExtensibleElement extends Element {
 
     /**

Modified: 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=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensibleElementWrapper.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensibleElementWrapper.java Wed Oct 19 22:33:04 2011
@@ -28,7 +28,7 @@ import org.apache.abdera2.factory.Factor
  * ElementWrapper implementation that implements the ExtensibleElement interface. This should be used to create static
  * extension elements that support extensions
  */
-@SuppressWarnings("unchecked")
+@SuppressWarnings({"unchecked","rawtypes"})
 public abstract class ExtensibleElementWrapper extends ElementWrapper implements ExtensibleElement {
 
     protected ExtensibleElementWrapper(Element internal) {

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensionIterator.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensionIterator.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensionIterator.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/ExtensionIterator.java Wed Oct 19 22:33:04 2011
@@ -27,6 +27,7 @@ import javax.xml.namespace.QName;
 /**
  * Most of the original code for this class came from the OMChildrenQNameIterator from Axiom
  */
+@SuppressWarnings("rawtypes")
 public class ExtensionIterator implements Iterator<Element> {
 
     /**

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Feed.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Feed.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Feed.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Feed.java Wed Oct 19 22:33:04 2011
@@ -104,6 +104,7 @@ import org.apache.abdera2.common.selecto
  * </pre>
  */
 @QName(value=LN_FEED,ns=ATOM_NS)
+@SuppressWarnings("rawtypes")
 public interface Feed extends Source {
 
     /**

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Link.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Link.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Link.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Link.java Wed Oct 19 22:33:04 2011
@@ -233,13 +233,15 @@ public interface Link extends Extensible
       private Helper() {}
       
       public static final WebLink toWebLink(Link link) {
-        WebLink weblink = new WebLink(link.getResolvedHref());
-        weblink.addRel(link.getRel());
-        weblink.setAnchor(link.getResolvedBaseUri());
-        weblink.setMediaType(link.getMimeType());
-        weblink.setHrefLang(link.getHrefLang());
-        weblink.setTitle(link.getTitle());
-        return weblink;
+        return WebLink
+          .make()
+          .iri(link.getResolvedHref())
+          .rel(link.getRel())
+          .anchor(link.getResolvedBaseUri())
+          .mediaType(link.getMimeType())
+          .lang(link.getHrefLang())
+          .title(link.getTitle())
+          .get();
       }
       
       public static final Iterable<Link> fromWebLink(Abdera abdera, WebLink weblink) {

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Service.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Service.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Service.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Service.java Wed Oct 19 22:33:04 2011
@@ -51,6 +51,7 @@ import org.apache.abdera2.common.selecto
  * </pre>
  */
 @QName(value=LN_SERVICE,ns=APP_NS)
+@SuppressWarnings("rawtypes")
 public interface Service extends ExtensibleElement {
 
     /**

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Source.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Source.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Source.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Source.java Wed Oct 19 22:33:04 2011
@@ -20,7 +20,6 @@ package org.apache.abdera2.model;
 import static org.apache.abdera2.common.Constants.ATOM_NS;
 import static org.apache.abdera2.common.Constants.LN_SOURCE;
 
-import java.util.Date;
 import java.util.List;
 
 import org.apache.abdera2.common.anno.QName;
@@ -71,6 +70,7 @@ import org.apache.abdera2.common.selecto
  * </pre>
  */
 @QName(value=LN_SOURCE,ns=ATOM_NS)
+@SuppressWarnings("rawtypes")
 public interface Source extends ExtensibleElement {
     /**
      * Returns the first author listed for the entry
@@ -657,7 +657,7 @@ public interface Source extends Extensib
      * 
      * @return The atom:updated as a java.util.Date
      */
-    Date getUpdated();
+    org.joda.time.DateTime getUpdated();
 
     /**
      * Set the atom:updated value
@@ -665,8 +665,10 @@ public interface Source extends Extensib
      * @param value The java.util.Date
      * @return The newly created atom:updated element
      */
-    DateTime setUpdated(Date value);
+    DateTime setUpdated(org.joda.time.DateTime value);
 
+    DateTime setUpdatedNow();
+    
     /**
      * Set the atom:updated value
      * 

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Workspace.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Workspace.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Workspace.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/Workspace.java Wed Oct 19 22:33:04 2011
@@ -51,6 +51,7 @@ import org.apache.abdera2.common.selecto
  * </pre>
  */
 @QName(value=LN_WORKSPACE,ns=APP_NS)
+@SuppressWarnings("rawtypes")
 public interface Workspace extends ExtensibleElement {
 
     /**

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/CategorySchemeSelector.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/CategorySchemeSelector.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/CategorySchemeSelector.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/CategorySchemeSelector.java Wed Oct 19 22:33:04 2011
@@ -21,6 +21,7 @@ import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.selector.AbstractSelector;
 import org.apache.abdera2.common.selector.Selector;
 import org.apache.abdera2.model.Category;
 
@@ -30,7 +31,8 @@ import org.apache.abdera2.model.Category
  * @see org.apache.abdera2.common.selector.Selector
  */
 public class CategorySchemeSelector 
-  implements Selector {
+  extends AbstractSelector<Category>
+  implements Selector<Category> {
 
   private static final long serialVersionUID = 7008363856043465676L;
   private final Set<IRI> schemes = new HashSet<IRI>();

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/CollectionAcceptSelector.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/CollectionAcceptSelector.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/CollectionAcceptSelector.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/CollectionAcceptSelector.java Wed Oct 19 22:33:04 2011
@@ -22,6 +22,7 @@ import java.util.Set;
 
 import javax.activation.MimeType;
 
+import org.apache.abdera2.common.selector.AbstractSelector;
 import org.apache.abdera2.common.selector.Selector;
 import org.apache.abdera2.model.Collection;
 
@@ -31,7 +32,8 @@ import org.apache.abdera2.model.Collecti
  * accept elements
  */
 public class CollectionAcceptSelector 
-  implements Selector {
+extends AbstractSelector<Collection>
+  implements Selector<Collection> {
 
   private static final long serialVersionUID = 1821941024155067263L;
   private final Set<MimeType> types = 

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/LinkHrefLangSelector.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/LinkHrefLangSelector.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/LinkHrefLangSelector.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/LinkHrefLangSelector.java Wed Oct 19 22:33:04 2011
@@ -22,6 +22,7 @@ import java.util.Set;
 
 import org.apache.abdera2.common.lang.Lang;
 import org.apache.abdera2.common.lang.Range;
+import org.apache.abdera2.common.selector.AbstractSelector;
 import org.apache.abdera2.common.selector.Selector;
 import org.apache.abdera2.model.Link;
 
@@ -30,7 +31,9 @@ import org.apache.abdera2.model.Link;
  * a matching hreflang attribute.
  * @see org.apache.abdera2.common.selector.Selector
  */
-public class LinkHrefLangSelector implements Selector {
+public class LinkHrefLangSelector 
+extends AbstractSelector<Link>
+implements Selector<Link> {
 
   private static final long serialVersionUID = 7008363856043465676L;
   private final Set<Lang> langs = new HashSet<Lang>();

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/LinkRelSelector.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/LinkRelSelector.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/LinkRelSelector.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/LinkRelSelector.java Wed Oct 19 22:33:04 2011
@@ -20,6 +20,7 @@ package org.apache.abdera2.model.selecto
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.abdera2.common.selector.AbstractSelector;
 import org.apache.abdera2.common.selector.Selector;
 import org.apache.abdera2.model.Link;
 
@@ -28,7 +29,9 @@ import org.apache.abdera2.model.Link;
  * that match a given set of rel attribute values
  * @see org.apache.abdera2.common.selector.Selector
  */
-public class LinkRelSelector implements Selector {
+public class LinkRelSelector 
+extends AbstractSelector<Link>
+implements Selector<Link> {
 
   private static final long serialVersionUID = 7008363856043465676L;
   private final Set<String> rels = new HashSet<String>();

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/Selectors.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/Selectors.java?rev=1186541&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/Selectors.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/Selectors.java Wed Oct 19 22:33:04 2011
@@ -0,0 +1,98 @@
+package org.apache.abdera2.model.selector;
+
+import java.util.Locale;
+import java.util.Map;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.lang.Lang;
+import org.apache.abdera2.common.lang.Range;
+import org.apache.abdera2.common.selector.PropertySelector;
+import org.apache.abdera2.common.selector.Selector;
+import org.apache.abdera2.model.Category;
+import org.apache.abdera2.model.Collection;
+import org.apache.abdera2.model.Entry;
+import org.apache.abdera2.model.Link;
+import org.apache.abdera2.xpath.XPath;
+import org.joda.time.DateTime;
+
+import com.google.common.base.Predicate;
+
+public class Selectors {
+
+  public static Selector<Entry> updated(Predicate<DateTime> predicate) {
+    return 
+      PropertySelector.<Entry>create(
+        Entry.class, 
+        "getUpdated",
+        predicate);
+  }
+  
+  public static Selector<Entry> edited(Predicate<DateTime> predicate) {
+    return
+      PropertySelector.<Entry>create(
+        Entry.class,
+        "getEdited",
+        predicate);
+  }
+  
+  public static Selector<Entry> published(Predicate<DateTime> predicate) {
+    return
+      PropertySelector.<Entry>create(
+        Entry.class,
+        "getPublished",
+        predicate);
+  }
+  
+  public static Selector<Category> withCategoryScheme(String... schemes) {
+    return new CategorySchemeSelector(schemes);
+  }
+  
+  public static Selector<Category> withCategoryScheme(IRI... schemes) {
+    return new CategorySchemeSelector(schemes);
+  }
+  
+  public static Selector<Collection> accepts(String... types) {
+    return new CollectionAcceptSelector(types);
+  }
+  
+  public static Selector<Collection> accepts(MimeType... types) {
+    return new CollectionAcceptSelector(types);
+  }
+  
+  public static Selector<Link> withHrefLang(Range range) {
+    return new LinkHrefLangSelector(range);
+  }
+  
+  public static Selector<Link> withHrefLang(String... langs) {
+    return new LinkHrefLangSelector(langs);
+  }
+  
+  public static Selector<Link> withHrefLang(Lang... langs) {
+    return new LinkHrefLangSelector(langs);
+  }
+  
+  public static Selector<Link> withHrefLang(Locale locale) {
+    return new LinkHrefLangSelector(Lang.fromLocale(locale));
+  }
+  
+  public static Selector<Link> withRel(String... rels) {
+    return new LinkRelSelector(rels);
+  }
+  
+  @SuppressWarnings("rawtypes")
+  public static Selector xpath(String path) {
+    return new XPathSelector(path);
+  }
+  
+  @SuppressWarnings("rawtypes")
+  public static Selector xpath(String path, XPath xpath) {
+    return new XPathSelector(path,xpath);
+  }
+  
+  @SuppressWarnings("rawtypes")
+  public static Selector xpath(String path, XPath xpath, Map<String, String> namespaces) {
+    return new XPathSelector(path,xpath,namespaces);
+  }
+}

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

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/XPathSelector.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/XPathSelector.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/XPathSelector.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/model/selector/XPathSelector.java Wed Oct 19 22:33:04 2011
@@ -20,6 +20,7 @@ package org.apache.abdera2.model.selecto
 import java.util.Map;
 
 import org.apache.abdera2.Abdera;
+import org.apache.abdera2.common.selector.AbstractSelector;
 import org.apache.abdera2.common.selector.Selector;
 import org.apache.abdera2.model.Element;
 import org.apache.abdera2.xpath.XPath;
@@ -28,7 +29,10 @@ import org.apache.abdera2.xpath.XPath;
  * Selects a collection based on a boolean XPath expression
  * @see org.apache.abdera2.common.selector.Selector
  */
-public class XPathSelector implements Selector {
+@SuppressWarnings("rawtypes")
+public class XPathSelector 
+extends AbstractSelector
+implements Selector {
 
     private static final long serialVersionUID = 7751803876821166591L;
 

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/Parsers.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/Parsers.java?rev=1186541&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/Parsers.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/Parsers.java Wed Oct 19 22:33:04 2011
@@ -0,0 +1,135 @@
+package org.apache.abdera2.parser;
+
+import java.io.InputStream;
+import java.io.Reader;
+
+import org.apache.abdera2.Abdera;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Element;
+
+import com.google.common.base.Function;
+
+public final class Parsers {
+
+  private Parsers() {}
+ 
+  public static interface InputStreamFunction<E extends Element> 
+    extends Function<InputStream,Document<E>> {}
+  
+  public static interface ReaderFunction<E extends Element> 
+    extends Function<Reader,Document<E>> {}
+  
+  public static <E extends Element>InputStreamFunction<E> forInputStream(
+    final Parser parser,
+    final String base,
+    final ParserOptions options) {
+    return new InputStreamFunction<E>() {
+      public Document<E> apply(InputStream in) {
+        return parser.parse(in, base, options);
+      }
+    };
+  }
+  
+  public static <E extends Element>InputStreamFunction<E> forInputStream(
+    final Parser parser, 
+    final ParserOptions options) {
+    return new InputStreamFunction<E>() {
+      public Document<E> apply(InputStream in) {
+        return parser.parse(in, options);
+      }
+    };
+  }
+  
+  public static <E extends Element>InputStreamFunction<E> forInputStream(
+    final Parser parser) {
+    return new InputStreamFunction<E>() {
+      public Document<E> apply(InputStream in) {
+        return parser.parse(in);
+      }
+    };
+  }
+  
+  public static <E extends Element>InputStreamFunction<E> forInputStream() {
+    return new InputStreamFunction<E>() {
+      public Document<E> apply(InputStream in) {
+        return Abdera.getInstance().getParser().parse(in);
+      }
+    };
+  }
+  
+  public static <E extends Element>InputStreamFunction<E> forInputStream(
+    final String base,
+    final ParserOptions options) {
+    return new InputStreamFunction<E>() {
+      public Document<E> apply(InputStream in) {
+        return Abdera.getInstance().getParser().parse(in, base, options);
+      }
+    };
+  }
+  
+  public static <E extends Element>InputStreamFunction<E> forInputStream(
+    final ParserOptions options) {
+    return new InputStreamFunction<E>() {
+      public Document<E> apply(InputStream in) {
+        return Abdera.getInstance().getParser().parse(in, options);
+      }
+    };
+  }
+  
+  public static <E extends Element>ReaderFunction<E> forReader(
+    final Parser parser,
+    final String base,
+    final ParserOptions options) {
+    return new ReaderFunction<E>() {
+      public Document<E> apply(Reader in) {
+        return parser.parse(in, base, options);
+      }
+    };
+  }
+  
+  public static <E extends Element>ReaderFunction<E> forReader(
+    final Parser parser, 
+    final ParserOptions options) {
+    return new ReaderFunction<E>() {
+      public Document<E> apply(Reader in) {
+        return parser.parse(in, options);
+      }
+    };
+  }
+  
+  public static <E extends Element>ReaderFunction<E> forReader(
+    final Parser parser) {
+    return new ReaderFunction<E>() {
+      public Document<E> apply(Reader in) {
+        return parser.parse(in);
+      }
+    };
+  }
+  
+  public static <E extends Element>ReaderFunction<E> forReader() {
+    return new ReaderFunction<E>() {
+      public Document<E> apply(Reader in) {
+        return Abdera.getInstance().getParser().parse(in);
+      }
+    };
+  }
+  
+  public static <E extends Element>ReaderFunction<E> forReader(
+    final String base,
+    final ParserOptions options) {
+    return new ReaderFunction<E>() {
+      public Document<E> apply(Reader in) {
+        return Abdera.getInstance().getParser().parse(in, base, options);
+      }
+    };
+  }
+  
+  public static <E extends Element>ReaderFunction<E> forReader(
+    final ParserOptions options) {
+    return new ReaderFunction<E>() {
+      public Document<E> apply(Reader in) {
+        return Abdera.getInstance().getParser().parse(in, options);
+      }
+    };
+  }
+}

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

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMCategories.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMCategories.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMCategories.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMCategories.java Wed Oct 19 22:33:04 2011
@@ -33,6 +33,7 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
+@SuppressWarnings("rawtypes")
 public class FOMCategories extends FOMExtensibleElement implements Categories {
 
     private static final long serialVersionUID = 5480273546375102411L;

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMCollection.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMCollection.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMCollection.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMCollection.java Wed Oct 19 22:33:04 2011
@@ -40,7 +40,7 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation","rawtypes"})
 public class FOMCollection extends FOMExtensibleElement implements Collection {
 
     private static final String[] ENTRY = {"application/atom+xml;type=\"entry\""};

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMDateTime.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMDateTime.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMDateTime.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMDateTime.java Wed Oct 19 22:33:04 2011
@@ -19,9 +19,10 @@ package org.apache.abdera2.parser.axiom;
 
 import java.util.Calendar;
 import java.util.Date;
+import java.util.Locale;
 
 import javax.xml.namespace.QName;
-
+import org.apache.abdera2.common.date.DateTimes;
 import org.apache.abdera2.model.DateTime;
 import org.apache.abdera2.model.Element;
 import org.apache.axiom.om.OMContainer;
@@ -33,7 +34,7 @@ import org.apache.axiom.om.OMXMLParserWr
 public class FOMDateTime extends FOMElement implements DateTime {
 
     private static final long serialVersionUID = -6611503566172011733L;
-    private org.apache.abdera2.common.date.DateTime value;
+    private org.joda.time.DateTime value;
 
     public FOMDateTime(QName qname) {
         super(qname);
@@ -59,7 +60,7 @@ public class FOMDateTime extends FOMElem
         setTime(time);
     }
 
-    public FOMDateTime(QName qname, org.apache.abdera2.common.date.DateTime dateTime) {
+    public FOMDateTime(QName qname, org.joda.time.DateTime dateTime) {
         this(qname);
         setValue(dateTime);
     }
@@ -77,21 +78,21 @@ public class FOMDateTime extends FOMElem
         super(qname, parent, factory, builder);
     }
 
-    public org.apache.abdera2.common.date.DateTime getValue() {
+    public org.joda.time.DateTime getValue() {
         if (value == null) {
             String v = getText();
             if (v != null) {
-                value = org.apache.abdera2.common.date.DateTime.valueOf(v);
+                value = org.joda.time.DateTime.parse(v);
             }
         }
         return value;
     }
 
-    public DateTime setValue(org.apache.abdera2.common.date.DateTime dateTime) {
+    public DateTime setValue(org.joda.time.DateTime dateTime) {
         complete();
         value = null;
         if (dateTime != null)
-            ((Element)this).setText(dateTime.getValue());
+            ((Element)this).setText(DateTimes.format(dateTime));
         else
             _removeAllChildren();
         return this;
@@ -101,7 +102,7 @@ public class FOMDateTime extends FOMElem
         complete();
         value = null;
         if (date != null)
-            ((Element)this).setText(org.apache.abdera2.common.date.DateTime.valueOf(date).getValue());
+            ((Element)this).setText(DateTimes.format(date));
         else
             _removeAllChildren();
         return this;
@@ -111,7 +112,7 @@ public class FOMDateTime extends FOMElem
         complete();
         value = null;
         if (date != null)
-            ((Element)this).setText(org.apache.abdera2.common.date.DateTime.valueOf(date).getValue());
+            ((Element)this).setText(DateTimes.format(date));
         else
             _removeAllChildren();
         return this;
@@ -120,7 +121,7 @@ public class FOMDateTime extends FOMElem
     public DateTime setTime(long date) {
         complete();
         value = null;
-        ((Element)this).setText(org.apache.abdera2.common.date.DateTime.valueOf(date).getValue());
+        ((Element)this).setText(DateTimes.format(date));
         return this;
     }
 
@@ -128,30 +129,30 @@ public class FOMDateTime extends FOMElem
         complete();
         value = null;
         if (date != null)
-            ((Element)this).setText(org.apache.abdera2.common.date.DateTime.valueOf(date).getValue());
+            ((Element)this).setText(DateTimes.format(date));
         else
             _removeAllChildren();
         return this;
     }
 
     public Date getDate() {
-        org.apache.abdera2.common.date.DateTime ad = getValue();
-        return (ad != null) ? ad.getDate() : null;
+        org.joda.time.DateTime ad = getValue();
+        return (ad != null) ? ad.toDate() : null;
     }
 
     public Calendar getCalendar() {
-        org.apache.abdera2.common.date.DateTime ad = getValue();
-        return (ad != null) ? ad.getCalendar() : null;
+        org.joda.time.DateTime ad = getValue();
+        return (ad != null) ? ad.toCalendar(Locale.getDefault()) : null;
     }
 
     public long getTime() {
-        org.apache.abdera2.common.date.DateTime ad = getValue();
-        return (ad != null) ? ad.getTime() : null;
+        org.joda.time.DateTime ad = getValue();
+        return (ad != null) ? ad.getMillis() : null;
     }
 
     public String getString() {
-        org.apache.abdera2.common.date.DateTime ad = getValue();
-        return (ad != null) ? ad.getValue() : null;
+        org.joda.time.DateTime ad = getValue();
+        return (ad != null) ? DateTimes.format(ad) : null;
     }
 
 }

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMDocument.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMDocument.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMDocument.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMDocument.java Wed Oct 19 22:33:04 2011
@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 
@@ -52,6 +51,7 @@ import org.apache.axiom.om.OMXMLParserWr
 import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.llom.OMDocumentImpl;
 import org.apache.axiom.om.util.StAXUtils;
+import org.joda.time.DateTime;
 
 @SuppressWarnings("unchecked")
 public class FOMDocument<T extends Element> extends OMDocumentImpl implements Document<T> {
@@ -59,7 +59,7 @@ public class FOMDocument<T extends Eleme
     private static final long serialVersionUID = -3255339511063344662L;
     protected IRI base = null;
     protected MimeType contentType = null;
-    protected Date lastModified = null;
+    protected DateTime lastModified = null;
     protected EntityTag etag = null;
     protected String language = null;
     protected String slug = null;
@@ -180,11 +180,11 @@ public class FOMDocument<T extends Eleme
         return this;
     }
 
-    public Date getLastModified() {
+    public DateTime getLastModified() {
         return this.lastModified;
     }
 
-    public Document<T> setLastModified(Date lastModified) {
+    public Document<T> setLastModified(DateTime lastModified) {
         this.lastModified = lastModified;
         return this;
     }

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMElement.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMElement.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMElement.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMElement.java Wed Oct 19 22:33:04 2011
@@ -75,7 +75,7 @@ import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.llom.OMElementImpl;
 
-@SuppressWarnings("unchecked")
+@SuppressWarnings({"unchecked","rawtypes"})
 public class FOMElement extends OMElementImpl implements Element, OMElement, Constants {
 
     private static final long serialVersionUID = 8024257594220911953L;

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMEntry.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMEntry.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMEntry.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMEntry.java Wed Oct 19 22:33:04 2011
@@ -55,7 +55,7 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation","rawtypes"})
 public class FOMEntry extends FOMExtensibleElement implements Entry {
 
     private static final long serialVersionUID = 1L;
@@ -112,9 +112,11 @@ public class FOMEntry extends FOMExtensi
       if (is_empty(list)) {
         Source source = getSource();
         if (source == null) {
-          Element parent = getParentElement();
-          if (parent != null && parent instanceof Source)
-            source = (Source) parent;
+          if (this.getParent() instanceof Element) {
+            Element parent = getParentElement();
+            if (parent != null && parent instanceof Source)
+              source = (Source) parent;
+          }
         }
         if (source != null)
           list = source.getAuthors();
@@ -527,12 +529,12 @@ public class FOMEntry extends FOMExtensi
         return this;
     }
 
-    public Date getPublished() {
+    public org.joda.time.DateTime getPublished() {
         DateTime dte = getPublishedElement();
-        return (dte != null) ? dte.getDate() : null;
+        return (dte != null) ? dte.getValue() : null;
     }
 
-    private DateTime setPublished(org.apache.abdera2.common.date.DateTime value) {
+    public DateTime setPublished(org.joda.time.DateTime value) {
         complete();
         if (value == null) {
             _removeChildren(PUBLISHED, false);
@@ -550,12 +552,12 @@ public class FOMEntry extends FOMExtensi
         }
     }
 
-    public DateTime setPublished(Date value) {
-        return setPublished((value != null) ? org.apache.abdera2.common.date.DateTime.valueOf(value) : null);
+    public DateTime setPublished(java.util.Date date) {
+        return setPublished(new org.joda.time.DateTime(date));
     }
 
     public DateTime setPublished(String value) {
-        return setPublished((value != null) ? org.apache.abdera2.common.date.DateTime.valueOf(value) : null);
+        return setPublished((value != null) ? new org.joda.time.DateTime(value) : null);
     }
 
     public Text getRightsElement() {
@@ -728,12 +730,12 @@ public class FOMEntry extends FOMExtensi
         return this;
     }
 
-    public Date getUpdated() {
+    public org.joda.time.DateTime getUpdated() {
         DateTime dte = getUpdatedElement();
-        return (dte != null) ? dte.getDate() : null;
+        return (dte != null) ? dte.getValue() : null;
     }
 
-    private DateTime setUpdated(org.apache.abdera2.common.date.DateTime value) {
+    public DateTime setUpdated(org.joda.time.DateTime value) {
         complete();
         if (value == null) {
             _removeChildren(UPDATED, false);
@@ -752,11 +754,11 @@ public class FOMEntry extends FOMExtensi
     }
 
     public DateTime setUpdated(Date value) {
-        return setUpdated((value != null) ? org.apache.abdera2.common.date.DateTime.valueOf(value) : null);
+        return setUpdated(new org.joda.time.DateTime(value));
     }
 
     public DateTime setUpdated(String value) {
-        return setUpdated((value != null) ? org.apache.abdera2.common.date.DateTime.valueOf(value) : null);
+        return setUpdated((value != null) ? new org.joda.time.DateTime(value) : null);
     }
 
     public DateTime getEditedElement() {
@@ -776,12 +778,12 @@ public class FOMEntry extends FOMExtensi
             _removeChildren(EDITED, false);
     }
 
-    public Date getEdited() {
+    public org.joda.time.DateTime getEdited() {
         DateTime dte = getEditedElement();
-        return (dte != null) ? dte.getDate() : null;
+        return (dte != null) ? dte.getValue() : null;
     }
 
-    private DateTime setEdited(org.apache.abdera2.common.date.DateTime value) {
+    public DateTime setEdited(org.joda.time.DateTime value) {
         complete();
         declareNamespace(APP_NS, "app");
         if (value == null) {
@@ -802,11 +804,11 @@ public class FOMEntry extends FOMExtensi
     }
 
     public DateTime setEdited(Date value) {
-        return setEdited((value != null) ? org.apache.abdera2.common.date.DateTime.valueOf(value) : null);
+        return setEdited(new org.joda.time.DateTime(value));
     }
 
     public DateTime setEdited(String value) {
-        return setUpdated((value != null) ? org.apache.abdera2.common.date.DateTime.valueOf(value) : null);
+        return setUpdated((value != null) ? new org.joda.time.DateTime(value) : null);
     }
 
     public Control getControl(boolean create) {
@@ -995,4 +997,16 @@ public class FOMEntry extends FOMExtensi
     public List<Link> getLinks(Selector selector) {
       return _getChildrenAsSet(LINK,selector);
     }
+
+    public DateTime setPublishedNow() {
+      return setPublished(org.joda.time.DateTime.now());
+    }
+
+    public DateTime setUpdatedNow() {
+      return setUpdated(org.joda.time.DateTime.now());
+    }
+
+    public DateTime setEditedNow() {
+      return setEdited(org.joda.time.DateTime.now());
+    }
 }

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMExtensibleElement.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMExtensibleElement.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMExtensibleElement.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMExtensibleElement.java Wed Oct 19 22:33:04 2011
@@ -36,7 +36,7 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-@SuppressWarnings("unchecked")
+@SuppressWarnings({"unchecked","rawtypes"})
 public class FOMExtensibleElement extends FOMElement implements ExtensibleElement {
 
     private static final long serialVersionUID = -1652430686161947531L;

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMFeed.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMFeed.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMFeed.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMFeed.java Wed Oct 19 22:33:04 2011
@@ -19,7 +19,6 @@ package org.apache.abdera2.parser.axiom;
 
 import java.util.Arrays;
 import java.util.Comparator;
-import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 
@@ -39,6 +38,7 @@ import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
+@SuppressWarnings("rawtypes")
 public class FOMFeed extends FOMSource implements Feed {
 
     private static final long serialVersionUID = 4552921210185524535L;
@@ -168,8 +168,8 @@ public class FOMFeed extends FOMSource i
         }
 
         public int compare(Entry o1, Entry o2) {
-            Date d1 = o1.getEdited();
-            Date d2 = o2.getEdited();
+            org.joda.time.DateTime d1 = o1.getEdited();
+            org.joda.time.DateTime d2 = o2.getEdited();
             if (d1 == null)
                 d1 = o1.getUpdated();
             if (d2 == null)
@@ -193,8 +193,8 @@ public class FOMFeed extends FOMSource i
         }
 
         public int compare(Entry o1, Entry o2) {
-            Date d1 = o1.getUpdated();
-            Date d2 = o2.getUpdated();
+          org.joda.time.DateTime d1 = o1.getUpdated();
+          org.joda.time.DateTime d2 = o2.getUpdated();
             if (d1 == null && d2 == null)
                 return 0;
             if (d1 == null && d2 != null)

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMService.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMService.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMService.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMService.java Wed Oct 19 22:33:04 2011
@@ -35,7 +35,7 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation","rawtypes"})
 public class FOMService extends FOMExtensibleElement implements Service {
 
     private static final long serialVersionUID = 7982751563668891240L;

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMSource.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMSource.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMSource.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMSource.java Wed Oct 19 22:33:04 2011
@@ -47,7 +47,7 @@ import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-@SuppressWarnings( {"unchecked", "deprecation"})
+@SuppressWarnings( {"unchecked", "deprecation", "rawtypes"})
 public class FOMSource extends FOMExtensibleElement implements Source {
 
     private static final long serialVersionUID = 9153127297531238021L;
@@ -432,12 +432,12 @@ public class FOMSource extends FOMExtens
         return (dte != null) ? dte.getString() : null;
     }
 
-    public Date getUpdated() {
+    public org.joda.time.DateTime getUpdated() {
         DateTime dte = getUpdatedElement();
-        return (dte != null) ? dte.getDate() : null;
+        return (dte != null) ? dte.getValue() : null;
     }
 
-    private DateTime setUpdated(org.apache.abdera2.common.date.DateTime value) {
+    public DateTime setUpdated(org.joda.time.DateTime value) {
         complete();
         if (value == null) {
             _removeChildren(UPDATED, false);
@@ -456,11 +456,11 @@ public class FOMSource extends FOMExtens
     }
 
     public DateTime setUpdated(Date value) {
-        return setUpdated((value != null) ? org.apache.abdera2.common.date.DateTime.valueOf(value) : null);
+        return setUpdated((value != null) ? new org.joda.time.DateTime(value) : null);
     }
 
     public DateTime setUpdated(String value) {
-        return setUpdated((value != null) ? org.apache.abdera2.common.date.DateTime.valueOf(value) : null);
+        return setUpdated((value != null) ? new org.joda.time.DateTime(value) : null);
     }
 
     public Generator getGenerator() {
@@ -657,4 +657,8 @@ public class FOMSource extends FOMExtens
       return _getChildrenAsSet(AUTHOR,selector);
     }
 
+    public DateTime setUpdatedNow() {
+      return setUpdated(org.joda.time.DateTime.now());
+    }
+
 }

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMWorkspace.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMWorkspace.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMWorkspace.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/axiom/FOMWorkspace.java Wed Oct 19 22:33:04 2011
@@ -35,7 +35,7 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation","rawtypes"})
 public class FOMWorkspace extends FOMExtensibleElement implements Workspace {
 
     private static final long serialVersionUID = -421749865550509424L;

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/AbstractParseFilter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/AbstractParseFilter.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/AbstractParseFilter.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/AbstractParseFilter.java Wed Oct 19 22:33:04 2011
@@ -17,43 +17,108 @@
  */
 package org.apache.abdera2.parser.filter;
 
+import javax.xml.namespace.QName;
 
-public abstract class AbstractParseFilter implements ParseFilter {
+import org.apache.abdera2.common.misc.ExceptionHelper;
+import com.google.common.base.Supplier;
 
+@SuppressWarnings("unchecked")
+public abstract class AbstractParseFilter 
+  implements ParseFilter {
+
+  public static abstract class Builder<E extends ParseFilter> implements Supplier<E> {
+    
+    protected byte flags = 0;
+    private Class<? extends UnacceptableException> _throw;
+
+    public <X extends Builder<E>>X throwOnUnacceptable() {
+      return (X)throwOnUnacceptable(UnacceptableException.class);
+    }
+    
+    public <X extends Builder<E>>X throwOnUnacceptable(Class<? extends UnacceptableException> error) {
+      this._throw = error;
+      return (X)this;
+    }
+    
+    private void toggle(boolean s, byte flag) {
+      if (s)
+          flags |= flag;
+      else
+          flags &= ~flag;
+    }
+    
+    protected Builder() {
+      withDefaults();
+    }
+    
+    public <X extends Builder<E>>X withDefaults() {
+      return (X)ignoreComments()
+            .ignoreWhitespace()
+            .ignoreProcessingInstructions();
+    }
+    
+    public <X extends Builder<E>>X withoutDefaults() {
+      toggle(false, COMMENTS);
+      toggle(false, WHITESPACE);
+      toggle(false, PI);
+      return (X)this;
+    }
+    
+    public <X extends Builder<E>>X ignoreComments() {
+      toggle(true, COMMENTS);
+      return (X)this;
+    }
+
+    public <X extends Builder<E>>X ignoreWhitespace() {
+      toggle(true, (byte)WHITESPACE);
+      return (X)this;
+    }
+
+    public <X extends Builder<E>>X ignoreProcessingInstructions() {
+      toggle(true, (byte)PI);
+      return (X)this;
+    }
+    
+  }
+  
     private static final long serialVersionUID = -1866308276050148524L;
 
     private static final byte COMMENTS = 1;
     private static final byte WHITESPACE = 2;
     private static final byte PI = 4;
 
-    protected byte flags = 0;
+    protected final byte flags;
+    protected final Class<? extends UnacceptableException> _throw;
 
-    private void toggle(boolean s, byte flag) {
-        if (s)
-            flags |= flag;
-        else
-            flags &= ~flag;
+    protected AbstractParseFilter(Builder<?> builder) {
+      this.flags = builder.flags;
+      this._throw = builder._throw;
+    }
+    
+    protected boolean checkThrow(
+      boolean answer, 
+      QName element, 
+      QName attribute) {
+      if (!answer && _throw != null) {
+        try {
+          throw _throw
+            .getConstructor(
+              QName.class,
+              QName.class)
+            .newInstance(
+              element,
+              attribute);
+        } catch (Throwable e) {
+          throw ExceptionHelper.propogate(e);
+        }
+      }
+      return answer;
     }
-
+    
     private boolean check(byte flag) {
         return (flags & flag) == flag;
     }
 
-    public ParseFilter setIgnoreComments(boolean ignore) {
-        toggle(ignore, COMMENTS);
-        return this;
-    }
-
-    public ParseFilter setIgnoreWhitespace(boolean ignore) {
-        toggle(ignore, (byte)WHITESPACE);
-        return this;
-    }
-
-    public ParseFilter setIgnoreProcessingInstructions(boolean ignore) {
-        toggle(ignore, (byte)PI);
-        return this;
-    }
-
     public boolean getIgnoreComments() {
         return check(COMMENTS);
     }

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/AbstractSetParseFilter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/AbstractSetParseFilter.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/AbstractSetParseFilter.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/AbstractSetParseFilter.java Wed Oct 19 22:33:04 2011
@@ -38,42 +38,59 @@ import javax.xml.namespace.QName;
  */
 public abstract class AbstractSetParseFilter 
   extends AbstractParseFilter 
-  implements Cloneable, SetParseFilter {
+  implements Cloneable {
 
+  @SuppressWarnings("unchecked")
+    public static abstract class Builder<E extends AbstractSetParseFilter> 
+      extends AbstractParseFilter.Builder<E> {
+      
+      private transient Set<QName> 
+        qnames = new HashSet<QName>();
+      private transient Map<QName, Set<QName>> 
+        attributes = new HashMap<QName, Set<QName>>();     
+      
+      public <X extends Builder<E>>X add(QName qname) {
+        if (!qnames.contains(qname))
+          qnames.add(qname);
+        return (X)this;
+      }
+      
+      public <X extends Builder<E>>X add(QName parent, QName attribute) {
+        if (attributes.containsKey(parent)) {
+            Set<QName> attrs = attributes.get(parent);
+            if (!attrs.contains(attribute))
+                attrs.add(attribute);
+        } else {
+            Set<QName> attrs = new HashSet<QName>();
+            attrs.add(attribute);
+            attributes.put(parent, attrs);
+        }
+        return (X)this;
+      }
+      
+    }
+  
     private static final long serialVersionUID = -758691949740569208L;
 
-    private transient Set<QName> 
+    private transient final Set<QName> 
       qnames = new HashSet<QName>();
-    private transient Map<QName, Set<QName>> 
+    private transient final Map<QName, Set<QName>> 
       attributes = new HashMap<QName, Set<QName>>();
 
+    protected AbstractSetParseFilter(Builder<?> builder) {
+      super(builder);
+      this.qnames.addAll(builder.qnames);
+      this.attributes.putAll(builder.attributes);
+    }
+    
     public Object clone() throws CloneNotSupportedException {
         return super.clone();
     }
 
-    public AbstractSetParseFilter add(QName qname) {
-        if (!contains(qname))
-          qnames.add(qname);
-        return this;
-    }
-
     public boolean contains(QName qname) {
       return qnames.contains(qname);
     }
 
-    public AbstractSetParseFilter add(QName parent, QName attribute) {
-        if (attributes.containsKey(parent)) {
-            Set<QName> attrs = attributes.get(parent);
-            if (!attrs.contains(attribute))
-                attrs.add(attribute);
-        } else {
-            Set<QName> attrs = new HashSet<QName>();
-            attrs.add(attribute);
-            attributes.put(parent, attrs);
-        }
-        return this;
-    }
-
     public boolean contains(QName qname, QName attribute) {
         if (attributes.containsKey(qname)) {
             Set<QName> attrs = attributes.get(qname);
@@ -87,6 +104,7 @@ public abstract class AbstractSetParseFi
 
     public abstract boolean acceptable(QName qname, QName attribute);
 
+    
     private void writeObject(ObjectOutputStream out) throws IOException {
         out.defaultWriteObject();
 
@@ -116,14 +134,14 @@ public abstract class AbstractSetParseFi
 
         // qnames field
         final int qnamesSize = in.readInt();
-        qnames = new HashSet<QName>(qnamesSize);
+        //qnames = new HashSet<QName>(qnamesSize);
         for (int i = 0; i < qnamesSize; i++) {
             qnames.add((QName)in.readObject());
         }
 
         // attributes field
         final int attributesSize = in.readInt();
-        attributes = new HashMap<QName, Set<QName>>();
+        //attributes = new HashMap<QName, Set<QName>>();
         for (int i = 0; i < attributesSize; i++) {
             final QName k = (QName)in.readObject();
             final int vSize = in.readInt();

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/BlackListParseFilter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/BlackListParseFilter.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/BlackListParseFilter.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/BlackListParseFilter.java Wed Oct 19 22:33:04 2011
@@ -24,15 +24,30 @@ import javax.xml.namespace.QName;
  * based filtering is problematic, at best, due largely to the fact that it's easier to define safe subsets of elements
  * than it is to define unsafe subsets.
  */
-public class BlackListParseFilter extends AbstractSetParseFilter {
+public class BlackListParseFilter 
+  extends AbstractSetParseFilter {
 
+  public static Builder make() {
+    return new Builder();
+  }
+  
+  public static class Builder extends AbstractSetParseFilter.Builder<BlackListParseFilter> {
+    public BlackListParseFilter get() {
+      return new BlackListParseFilter(this);
+    } 
+  }
+  
     private static final long serialVersionUID = -8428373486568649179L;
 
+    protected BlackListParseFilter(Builder builder) {
+      super(builder);
+    }
+    
     public boolean acceptable(QName qname) {
-        return !contains(qname);
+        return checkThrow(!contains(qname),qname,null);
     }
 
     public boolean acceptable(QName qname, QName attribute) {
-        return !contains(qname, attribute);
+        return checkThrow(!contains(qname, attribute),qname,attribute);
     }
 }

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/CompoundParseFilter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/CompoundParseFilter.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/CompoundParseFilter.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/CompoundParseFilter.java Wed Oct 19 22:33:04 2011
@@ -17,6 +17,9 @@
  */
 package org.apache.abdera2.parser.filter;
 
+import java.util.LinkedHashSet;
+import java.util.Set;
+
 import javax.xml.namespace.QName;
 
 
@@ -63,20 +66,81 @@ public class CompoundParseFilter 
             return 0;
         }
     };
-
-    protected final Condition condition;
-    protected final ParseFilter[] filters;
-
-    public CompoundParseFilter(Condition condition, ParseFilter... filters) {
-        this.filters = filters;
+    
+    public static ParseFilter acceptableToAll(ParseFilter... filters) {
+      return makeAcceptableToAll().filters(filters).get();
+    }
+    
+    public static ParseFilter acceptableToAny(ParseFilter... filters) {
+      return makeAcceptableToAny().filters(filters).get();
+    }
+    
+    public static ParseFilter unacceptableToAll(ParseFilter... filters) {
+      return makeUnacceptableToAll().filters(filters).get();
+    }
+    
+    public static ParseFilter unacceptableToAny(ParseFilter... filters) {
+      return makeUnacceptableToAny().filters(filters).get();
+    }
+    
+    public static Builder makeAcceptableToAll() {
+      return make().condition(Condition.ACCEPTABLE_TO_ALL);
+    }
+    
+    public static Builder makeAcceptableToAny() {
+      return make().condition(Condition.ACCEPTABLE_TO_ANY);
+    }
+    
+    public static Builder makeUnacceptableToAll() {
+      return make().condition(Condition.UNACCEPTABLE_TO_ALL);
+    }
+    
+    public static Builder makeUnacceptableToAny() {
+      return make().condition(Condition.UNACCEPTABLE_TO_ANY);
+    }
+    
+    public static Builder make() {
+      return new Builder();
+    }
+    
+    public static class Builder extends AbstractParseFilter.Builder<CompoundParseFilter> {
+
+      private Condition condition;
+      private final Set<ParseFilter> filters = 
+        new LinkedHashSet<ParseFilter>();
+      
+      public CompoundParseFilter get() {
+        return new CompoundParseFilter(this);
+      }
+      
+      public Builder condition(Condition condition) {
         this.condition = condition;
+        return this;
+      }
+      
+      public Builder filter(ParseFilter filter) {
+        this.filters.add(filter);
+        return this;
+      }
+      
+      public Builder filters(ParseFilter... filters) {
+        for (ParseFilter filter : filters)
+          filter(filter);
+        return this;
+      }
     }
 
-    public CompoundParseFilter(ParseFilter... filters) {
-        this(Condition.ACCEPTABLE_TO_ANY, filters);
+    protected final Condition condition;
+    protected final Set<ParseFilter> filters = 
+      new LinkedHashSet<ParseFilter>();
+
+    protected CompoundParseFilter(Builder builder) {
+      super(builder);
+      this.condition = builder.condition;
+      this.filters.addAll(builder.filters);
     }
 
-    private ParseFilter[] getFilters() {
+    private Iterable<ParseFilter> getFilters() {
         return filters;
     }
 
@@ -86,7 +150,7 @@ public class CompoundParseFilter 
                 case 1:
                     return true;
                 case -1:
-                    return false;
+                    return checkThrow(false,qname,null);
             }
         }
         return true;
@@ -98,7 +162,7 @@ public class CompoundParseFilter 
                 case 1:
                     return true;
                 case -1:
-                    return false;
+                    return checkThrow(false,qname,attribute);
             }
         }
         return true;

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/NonOpParseFilter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/NonOpParseFilter.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/NonOpParseFilter.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/NonOpParseFilter.java Wed Oct 19 22:33:04 2011
@@ -19,10 +19,16 @@ package org.apache.abdera2.parser.filter
 
 import javax.xml.namespace.QName;
 
-public class NonOpParseFilter extends AbstractParseFilter {
-
+public final class NonOpParseFilter
+  implements ParseFilter {
+  
+    public static final ParseFilter INSTANCE = 
+      new NonOpParseFilter();
+  
     private static final long serialVersionUID = -1895875728388522456L;
 
+    private NonOpParseFilter() {}
+    
     public boolean acceptable(QName qname) {
         return true;
     }
@@ -31,4 +37,19 @@ public class NonOpParseFilter extends Ab
         return true;
     }
 
+    public boolean getIgnoreComments() {
+      return false;
+    }
+
+    public boolean getIgnoreWhitespace() {
+      return false;
+    }
+
+    public boolean getIgnoreProcessingInstructions() {
+      return false;
+    }
+
+    public Object clone() throws CloneNotSupportedException {
+      return this;
+    }
 }

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/ParseFilter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/ParseFilter.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/ParseFilter.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/ParseFilter.java Wed Oct 19 22:33:04 2011
@@ -57,18 +57,4 @@ public interface ParseFilter extends Clo
      */
     boolean getIgnoreProcessingInstructions();
 
-    /**
-     * True if the parser should ignore comments
-     */
-    ParseFilter setIgnoreComments(boolean ignore);
-
-    /**
-     * True if the parser should ignore insignificant whitespace
-     */
-    ParseFilter setIgnoreWhitespace(boolean ignore);
-
-    /**
-     * True if the parser should ignore processing instructions
-     */
-    ParseFilter setIgnoreProcessingInstructions(boolean ignore);
 }

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/SafeContentWhiteListParseFilter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/SafeContentWhiteListParseFilter.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/SafeContentWhiteListParseFilter.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/SafeContentWhiteListParseFilter.java Wed Oct 19 22:33:04 2011
@@ -25,6 +25,18 @@ public class SafeContentWhiteListParseFi
     extends AbstractParseFilter 
     implements ParseFilter {
 
+    public static Builder make() {
+      return new Builder();
+    }
+  
+    public static class Builder extends AbstractParseFilter.Builder<SafeContentWhiteListParseFilter> {
+
+      public SafeContentWhiteListParseFilter get() {
+        return new SafeContentWhiteListParseFilter(this);
+      }
+      
+    }
+  
     private static final long serialVersionUID = -4802312485715572721L;
 
     private static enum xhtml_elements {
@@ -58,6 +70,10 @@ public class SafeContentWhiteListParseFi
             return v.toLowerCase();
         }
     };
+    
+    protected SafeContentWhiteListParseFilter(Builder builder) {
+      super(builder);
+    }
 
     public boolean acceptable(QName qname) {
         if (qname.getNamespaceURI().equals(Constants.XHTML_NS)) {
@@ -66,7 +82,7 @@ public class SafeContentWhiteListParseFi
                 return true;
             } catch (Exception e) {
             }
-            return false;
+            return checkThrow(false,qname,null);
         } else {
             return true;
         }
@@ -79,7 +95,7 @@ public class SafeContentWhiteListParseFi
                 return true;
             } catch (Exception e) {
             }
-            return false;
+            return checkThrow(false,qname,attribute);
         } else {
             return true;
         }

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/UnacceptableException.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/UnacceptableException.java?rev=1186541&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/UnacceptableException.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/UnacceptableException.java Wed Oct 19 22:33:04 2011
@@ -0,0 +1,71 @@
+package org.apache.abdera2.parser.filter;
+
+import javax.xml.namespace.QName;
+
+public class UnacceptableException extends RuntimeException {
+
+  private static final long serialVersionUID = -6923049484196141770L;
+
+  private final QName element;
+  private final QName attribute;
+  
+  protected UnacceptableException(QName element, QName attribute) {
+    super(message(element,attribute));
+    this.element = element;
+    this.attribute = attribute;
+  }
+
+  public QName getElement() {
+    return element;
+  }
+  
+  public QName getAttribute() {
+    return attribute;
+  }
+  
+  private static String message(QName element, QName attribute) {
+    if (element == null && attribute == null)
+      return "Unacceptable element";
+    else if (attribute == null)
+      return String.format(
+        "Unacceptable element [%s]", 
+        element.toString());
+    else 
+      return String.format(
+        "Unacceptable element [%s,%s]", 
+        element.toString(), 
+        attribute.toString());
+  }
+
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((attribute == null) ? 0 : attribute.hashCode());
+    result = prime * result + ((element == null) ? 0 : element.hashCode());
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj)
+      return true;
+    if (obj == null)
+      return false;
+    if (getClass() != obj.getClass())
+      return false;
+    UnacceptableException other = (UnacceptableException) obj;
+    if (attribute == null) {
+      if (other.attribute != null)
+        return false;
+    } else if (!attribute.equals(other.attribute))
+      return false;
+    if (element == null) {
+      if (other.element != null)
+        return false;
+    } else if (!element.equals(other.element))
+      return false;
+    return true;
+  }
+  
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/UnacceptableException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/WhiteListParseFilter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/WhiteListParseFilter.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/WhiteListParseFilter.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/parser/filter/WhiteListParseFilter.java Wed Oct 19 22:33:04 2011
@@ -24,30 +24,37 @@ import javax.xml.namespace.QName;
  */
 public class WhiteListParseFilter extends AbstractSetParseFilter {
 
+  public static Builder make() {
+    return new Builder();
+  }
+  
+  public static class Builder extends AbstractSetParseFilter.Builder<WhiteListParseFilter> {
+    private boolean listAttributesExplicitly;
+    public Builder listAttributesExplicitly() {
+      this.listAttributesExplicitly = true;
+      return this;
+    }
+    public WhiteListParseFilter get() {
+      return new WhiteListParseFilter(this);
+    } 
+  }
+  
     private static final long serialVersionUID = -2126524829459798481L;
     private final boolean listAttributesExplicitly;
 
-    public WhiteListParseFilter() {
-        this(false);
-    }
-
-    /**
-     * If listAttributesExplicity == true, attributes MUST be whitelisted independently of the elements on which they
-     * appear, otherwise, all attributes will automatically be considered acceptable if the containing element is
-     * considered acceptable.
-     */
-    public WhiteListParseFilter(boolean listAttributesExplicitly) {
-        this.listAttributesExplicitly = listAttributesExplicitly;
+    protected WhiteListParseFilter(Builder builder) {
+        super(builder);
+        this.listAttributesExplicitly = builder.listAttributesExplicitly;
     }
 
     public boolean acceptable(QName qname) {
-        return contains(qname);
+        return checkThrow(contains(qname),qname,null);
     }
 
     public boolean acceptable(QName qname, QName attribute) {
-        return (listAttributesExplicitly) ? 
+        return checkThrow((listAttributesExplicitly) ? 
             contains(qname, attribute) && acceptable(qname) : 
-            acceptable(qname);
+            acceptable(qname),qname,attribute);
     }
 
 }



Mime
View raw message