abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1173789 - in /abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities: extra/ io/gson/ model/
Date Wed, 21 Sep 2011 18:47:01 GMT
Author: jmsnell
Date: Wed Sep 21 18:47:00 2011
New Revision: 1173789

URL: http://svn.apache.org/viewvc?rev=1173789&view=rev
Log:
Javadoc improvements, CollectionWriter abstract base implementation

Added:
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/SimpleCollectionWriter.java
  (with props)
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/AbstractCollectionWriter.java
  (with props)
Modified:
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/BinaryObject.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/BookObject.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/CreativeWork.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/ExtendedEventObject.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/MovieObject.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/OfferObject.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvEpisodeObject.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvSeasonObject.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvSeriesObject.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/VersionObject.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/io/gson/GsonIO.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/ASObject.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/Collection.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/CollectionWriter.java

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/BinaryObject.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/BinaryObject.java?rev=1173789&r1=1173788&r2=1173789&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/BinaryObject.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/BinaryObject.java
Wed Sep 21 18:47:00 2011
@@ -48,17 +48,39 @@ public class BinaryObject extends FileOb
     setDisplayName(displayName);
   }
     
+  /**
+   * Set the Content and the MimeType from the DatHandler. 
+   * This method defers to the setContent(InputStream) method
+   * by passing it the InputStream retrieved from the DataHandler.
+   * That means it currently blocks while reading, consuming, and
+   * encoding the InputStream. TODO: The better approach would be
+   * to simple store the DataHandler in the exts table directly
+   * and use a custom TypeAdapter for the BinaryObject to read and
+   * consume the DataHandler during the actual Serialization.
+   */
   public void setContent(DataHandler data) throws IOException {
     setContent(data.getInputStream());
     setMimeType(data.getContentType());
   }
   
+  /**
+   * Set the Content as a Base64 Encoded string. Calling this 
+   * method will perform a blocking read that will consume the 
+   * InputStream and generate a Base64 Encoded String. 
+   * TODO: A better approach would be to store the InputStream
+   * or DataHandler directly within the exts table and use a 
+   * custom TypeAdapter for the BinaryObject to read and consume
+   * the InputStream during the actual Serialization process.
+   * That would, at the very least, defer the performance hit
+   * and save memory resources while the object is stored in 
+   * memory.
+   */
   public void setContent(InputStream data) throws IOException {
     ByteArrayOutputStream out = 
       new ByteArrayOutputStream();
     Base64OutputStream bout = 
       new Base64OutputStream(out,true,0,null);
-    byte[] d = new byte[100];
+    byte[] d = new byte[1024];
     int r = -1;
     while((r = data.read(d)) > -1) { 
       bout.write(d, 0, r);
@@ -69,6 +91,11 @@ public class BinaryObject extends FileOb
     super.setContent(c);
   }
   
+  /**
+   * Returns an InputStream that will decode the Base64 encoded 
+   * content on the fly. The data is stored encoded in memory and
+   * only decoded as the InputStream is consumed.
+   */
   public InputStream getInputStream() throws IOException {
     String content = super.getContent();
     if (content == null) return null;

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/BookObject.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/BookObject.java?rev=1173789&r1=1173788&r2=1173789&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/BookObject.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/BookObject.java
Wed Sep 21 18:47:00 2011
@@ -3,6 +3,10 @@ package org.apache.abdera2.activities.ex
 import org.apache.abdera2.activities.model.ASObject;
 import org.apache.abdera2.common.anno.Name;
 
+/**
+ * A simple "objectType":"book" object that serves primarily as an 
+ * example of creating new ASObject types.
+ */
 @Name("book")
 public class BookObject extends CreativeWork {
 

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/CreativeWork.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/CreativeWork.java?rev=1173789&r1=1173788&r2=1173789&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/CreativeWork.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/CreativeWork.java
Wed Sep 21 18:47:00 2011
@@ -2,6 +2,9 @@ package org.apache.abdera2.activities.ex
 
 import org.apache.abdera2.activities.model.ASObject;
 
+/**
+ * Abstract base class for several extension ASObject types
+ */
 public abstract class CreativeWork extends ASObject {
 
   private static final long serialVersionUID = -178336535850006357L;

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/ExtendedEventObject.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/ExtendedEventObject.java?rev=1173789&r1=1173788&r2=1173789&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/ExtendedEventObject.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/ExtendedEventObject.java
Wed Sep 21 18:47:00 2011
@@ -3,6 +3,12 @@ package org.apache.abdera2.activities.ex
 import org.apache.abdera2.activities.model.ASObject;
 import org.apache.abdera2.activities.model.objects.EventObject;
 
+/**
+ * Abstract extension of the basic event object type that adds
+ * additional useful fields. Subclasses of this object MUST
+ * define their own objectType names using the Name annotation
+ * (@see org.apache.abdera2.common.anno.Name). 
+ */
 public abstract class ExtendedEventObject extends EventObject {
 
   private static final long serialVersionUID = 8368535995814591315L;

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/MovieObject.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/MovieObject.java?rev=1173789&r1=1173788&r2=1173789&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/MovieObject.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/MovieObject.java
Wed Sep 21 18:47:00 2011
@@ -7,6 +7,10 @@ import org.apache.abdera2.activities.mod
 import org.apache.abdera2.common.anno.Name;
 import org.apache.abdera2.common.date.Duration;
 
+/**
+ * A simple "objectType":"movie" object that serves primarily as an 
+ * example of creating new ASObject types.
+ */
 @Name("movie")
 @Properties({
   @Property(name="preview",to=MediaLink.class),

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/OfferObject.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/OfferObject.java?rev=1173789&r1=1173788&r2=1173789&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/OfferObject.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/OfferObject.java
Wed Sep 21 18:47:00 2011
@@ -7,6 +7,10 @@ import org.apache.abdera2.activities.io.
 import org.apache.abdera2.activities.model.ASObject;
 import org.apache.abdera2.common.anno.Name;
 
+/**
+ * A simple "objectType":"offer" object that serves primarily as an 
+ * example of creating new ASObject types.
+ */
 @Name("offer")
 @Properties({
   @Property(name="validFrom",to=Date.class),

Added: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/SimpleCollectionWriter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/SimpleCollectionWriter.java?rev=1173789&view=auto
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/SimpleCollectionWriter.java
(added)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/SimpleCollectionWriter.java
Wed Sep 21 18:47:00 2011
@@ -0,0 +1,38 @@
+package org.apache.abdera2.activities.extra;
+
+import org.apache.abdera2.activities.model.ASObject;
+import org.apache.abdera2.activities.model.AbstractCollectionWriter;
+import org.apache.abdera2.activities.model.Collection;
+
+/**
+ * Simple implementation of the CollectionWriter interface that builds
+ * an in-memory Collection using the CollectionWriter's streaming interface.
+ */
+@SuppressWarnings({"unchecked","rawtypes"})
+public class SimpleCollectionWriter 
+  extends AbstractCollectionWriter {
+
+  private final Collection collection = new Collection();
+  
+  @Override
+  protected void write(String name, Object val) {
+    collection.setProperty(name, val);
+  }
+
+  @Override
+  protected void startItems() {
+    collection.getItems(true);
+  }
+
+  @Override
+  protected void writeItem(ASObject object) {
+    collection.addItem(object);
+  }
+
+  @Override
+  public void complete() {}
+
+  public <T extends ASObject>Collection<T> getCollection() {
+    return (Collection<T>) collection;
+  }
+}

Propchange: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/SimpleCollectionWriter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvEpisodeObject.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvEpisodeObject.java?rev=1173789&r1=1173788&r2=1173789&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvEpisodeObject.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvEpisodeObject.java
Wed Sep 21 18:47:00 2011
@@ -6,6 +6,10 @@ import org.apache.abdera2.activities.mod
 import org.apache.abdera2.activities.model.MediaLink;
 import org.apache.abdera2.common.anno.Name;
 
+/**
+ * A simple "objectType":"tv-episode" object that serves primarily as an 
+ * example of creating new ASObject types.
+ */
 @Name("tv-episode")
 @Properties({
   @Property(name="preview",to=MediaLink.class)

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvSeasonObject.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvSeasonObject.java?rev=1173789&r1=1173788&r2=1173789&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvSeasonObject.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvSeasonObject.java
Wed Sep 21 18:47:00 2011
@@ -8,6 +8,10 @@ import org.apache.abdera2.activities.mod
 import org.apache.abdera2.activities.model.MediaLink;
 import org.apache.abdera2.common.anno.Name;
 
+/**
+ * A simple "objectType":"tv-season" object that serves primarily as an 
+ * example of creating new ASObject types.
+ */
 @Name("tv-season")
 @Properties({
   @Property(name="startDate",to=Date.class),

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvSeriesObject.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvSeriesObject.java?rev=1173789&r1=1173788&r2=1173789&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvSeriesObject.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/TvSeriesObject.java
Wed Sep 21 18:47:00 2011
@@ -8,6 +8,10 @@ import org.apache.abdera2.activities.mod
 import org.apache.abdera2.activities.model.MediaLink;
 import org.apache.abdera2.common.anno.Name;
 
+/**
+ * A simple "objectType":"tv-series" object that serves primarily as an 
+ * example of creating new ASObject types.
+ */
 @Name("tv-series")
 @Properties({
   @Property(name="startDate",to=Date.class),

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/VersionObject.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/VersionObject.java?rev=1173789&r1=1173788&r2=1173789&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/VersionObject.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/VersionObject.java
Wed Sep 21 18:47:00 2011
@@ -7,7 +7,8 @@ import org.apache.abdera2.common.anno.Na
 
 /**
  * Activity Stream object that represents a description of a Version 
- * of a referenced object.
+ * of a referenced object. "objectType":"version"... The basic use 
+ * case for this would be for Version control systems.
  */
 @Name("version")
 @Properties({

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/io/gson/GsonIO.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/io/gson/GsonIO.java?rev=1173789&r1=1173788&r2=1173789&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/io/gson/GsonIO.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/io/gson/GsonIO.java
Wed Sep 21 18:47:00 2011
@@ -35,6 +35,7 @@ import org.apache.abdera2.common.lang.La
 import org.apache.abdera2.common.templates.Template;
 import org.apache.abdera2.activities.model.ASBase;
 import org.apache.abdera2.activities.model.ASObject;
+import org.apache.abdera2.activities.model.AbstractCollectionWriter;
 import org.apache.abdera2.activities.model.Activity;
 import org.apache.abdera2.activities.model.Collection;
 import org.apache.abdera2.activities.model.CollectionWriter;
@@ -214,12 +215,11 @@ public class GsonIO extends IO {
   }
   
   private static class GsonCollectionWriter
-    implements CollectionWriter {
+    extends AbstractCollectionWriter {
     private final JsonWriter writer;
     private final Gson gson;
     private final boolean autoclose;
-    private boolean _items = false;
-    private boolean _header = false;
+    
     GsonCollectionWriter(Gson gson, Writer out, boolean autoclose) {
       this.gson = gson;
       this.writer = new JsonWriter(out);
@@ -230,56 +230,49 @@ public class GsonIO extends IO {
         throw new RuntimeException(e);
       }
     }
-    public void writeHeader(ASBase base) {
-      if (_items || _header)
-        throw new IllegalStateException();
+
+    public void complete() {
       try {
-        if (base != null) {
-          for (String name : base) {
-            Object val = base.getProperty(name);
-            writer.name(name);
-            if (val != null) {
-              gson.toJson(val,val.getClass(),writer);
-            } else writer.nullValue();
-          }
-        }
-        _header = true;
+        if (_items) writer.endArray();
+        writer.endObject();
         writer.flush();
+        if (autoclose) 
+          writer.close();
       } catch (IOException e) {
         throw new RuntimeException(e);
       }
     }
-    public void writeObject(ASObject object) {
+    @Override
+    protected void write(String name, Object val) {
       try {
-        if (!_items) {
-          writer.name("items");
-          writer.beginArray();
-          _items = true;
-        }
-        gson.toJson(object,ASBase.class,writer);
-        writer.flush();
+        writer.name(name);
+        if (val != null) {
+          gson.toJson(val,val.getClass(),writer);
+        } else writer.nullValue();
       } catch (IOException e) {
         throw new RuntimeException(e);
       }
     }
-    public void writeObjects(ASObject... objects) {
-      for (ASObject object : objects)
-        writeObject(object);
-    }
-    public void writeObjects(Iterable<ASObject> objects) {
-      for (ASObject object : objects)
-        writeObject(object);
-    }
-    public void complete() {
+    @Override
+    protected void startItems() {
       try {
-        if (_items) writer.endArray();
-        writer.endObject();
-        writer.flush();
-        if (autoclose) 
-          writer.close();
+        writer.name("items");
+        writer.beginArray();
       } catch (IOException e) {
         throw new RuntimeException(e);
       }
     }
+    @Override
+    protected void writeItem(ASObject object) {
+      gson.toJson(object,ASBase.class,writer);
+    }
+    
+    protected void flush() {
+      try {
+        writer.flush();
+      } catch (IOException t) {
+        throw new RuntimeException(t);
+      }
+    }
   }
 }

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/ASObject.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/ASObject.java?rev=1173789&r1=1173788&r2=1173789&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/ASObject.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/ASObject.java
Wed Sep 21 18:47:00 2011
@@ -27,6 +27,9 @@ import org.apache.abdera2.activities.mod
 import org.apache.abdera2.common.anno.AnnoUtil;
 import org.apache.abdera2.common.iri.IRI;
 
+/**
+ * Base class for all Activity Streams Objects.
+ */
 @SuppressWarnings("unchecked")
 public class ASObject extends ASBase {
 

Added: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/AbstractCollectionWriter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/AbstractCollectionWriter.java?rev=1173789&view=auto
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/AbstractCollectionWriter.java
(added)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/AbstractCollectionWriter.java
Wed Sep 21 18:47:00 2011
@@ -0,0 +1,57 @@
+package org.apache.abdera2.activities.model;
+
+/**
+ * Base implementation of the CollectionWriter interface.. handles
+ * basic flow and state management
+ */
+public abstract class AbstractCollectionWriter 
+  implements CollectionWriter {
+
+  protected boolean _items = false;
+  protected boolean _header = false;
+  
+  protected void flush() {}
+  
+  protected abstract void write(String name, Object val);
+  
+  protected abstract void startItems();
+  
+  protected abstract void writeItem(ASObject object);
+  
+  public abstract void complete();
+  
+  public void writeHeader(ASBase base) {
+    if (_items || _header)
+    throw new IllegalStateException();
+    if (base != null) {
+      for (String name : base) {
+        if (!"items".equals(name)) {
+          Object val = base.getProperty(name);
+          write(name,val);
+        }
+      }
+    }
+    _header = true;
+    flush();
+  }
+  
+  public void writeObject(ASObject object) {
+    if (!_items) {
+      startItems();
+      _items = true;
+    }
+    writeItem(object);
+    flush();
+  }
+  
+  public void writeObjects(ASObject... objects) {
+    for (ASObject object : objects)
+      writeObject(object);
+  }
+  
+  public void writeObjects(Iterable<ASObject> objects) {
+    for (ASObject object : objects)
+      writeObject(object);
+  }
+ 
+}

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

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/Collection.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/Collection.java?rev=1173789&r1=1173788&r2=1173789&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/Collection.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/Collection.java
Wed Sep 21 18:47:00 2011
@@ -23,6 +23,14 @@ import java.util.Set;
 import org.apache.abdera2.common.anno.Name;
 import org.apache.abdera2.common.iri.IRI;
 
+/**
+ * An Activity Streams Collection... used as the root object of
+ * JSON Activity Streams documents and as the value for a variety 
+ * of properties (such as "replies"). Encapsulates an array of 
+ * items with additional metadata. As an alternative to specifying
+ * the array of items inline, the "url" property can be used to 
+ * reference an external Collection document. 
+ */
 @Name("collection")
 public class Collection<T extends ASObject> extends ASObject {
 
@@ -71,6 +79,15 @@ public class Collection<T extends ASObje
     return getProperty(ITEMS);
   }
   
+  public Iterable<T> getItems(boolean create) {
+    Iterable<T> items = getItems();
+    if (items == null && create) {
+      items = new LinkedHashSet<T>();
+      setProperty(ITEMS,items);
+    }
+    return items;
+  }
+  
   public void setItems(Set<T> items) {
     setProperty(ITEMS, new LinkedHashSet<T>(items));
     setTotalItems(items.size());

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/CollectionWriter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/CollectionWriter.java?rev=1173789&r1=1173788&r2=1173789&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/CollectionWriter.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/CollectionWriter.java
Wed Sep 21 18:47:00 2011
@@ -1,15 +1,35 @@
 package org.apache.abdera2.activities.model;
 
+/**
+ * Interface used to stream a Collection of activity objects.
+ */
 public interface CollectionWriter {
 
+  /**
+   * Writes all of the properties other than the "items" property. 
+   * This MUST be called before calling writeObject or writeObjects
+   * and cannot be called after calling either of those.
+   */
   void writeHeader(ASBase base);
   
+  /**
+   * Writes an object to the items array of the Collection
+   */
   void writeObject(ASObject object);
   
+  /**
+   * Writes one or more objects to the items array of the Collection
+   */
   void writeObjects(ASObject... objects);
   
+  /**
+   * Writes one or more objects to the items array of the Collection
+   */
   void writeObjects(Iterable<ASObject> objects);
   
+  /**
+   * Completes the Collection
+   */
   void complete();
   
 }



Mime
View raw message