<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">OK, so here is where I stand. I don't think there is any way to have the API's match identically between JS and the others. It sounds like Android and iOS are getting closer to agreement but as they get closer, it seems they get further away from what makes sense for JS. Basically, anything that involves creating a new object to maintain paged pipes rather than just using any other pipe and overloading the read method to do paging doesn't make sense to me. IMO, JS should move forward with basically what was written up in the strawman as that feels like the best solution for JS.<div><br><div><div>On Jan 15, 2013, at 10:18 AM, Summers Pittman &lt;<a href="mailto:supittma@redhat.com">supittma@redhat.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
  
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 01/15/2013 08:45 AM, Sebastien Blanc
      wrote:<br>
    </div>
    <blockquote cite="mid:CAD_dpu0dZceRqzoUWeOqQX2v_QfopR_2yQz7Zhmbv7qnSbhDqg@mail.gmail.com" type="cite">
      <div>Just to summarize what have until now :</div>
      <div><br>
      </div>
      <div>1. Kris's proposition:&nbsp;<a moz-do-not-send="true" href="https://gist.github.com/4531575">https://gist.github.com/4531575</a></div>
      <div><br>
      </div>
      <div>2. Summers's proposition:&nbsp;<a moz-do-not-send="true" href="https://gist.github.com/4532661">https://gist.github.com/4532661</a></div>
      <div><br>
      </div>
      <div>3. qmx's propositon:&nbsp;<a moz-do-not-send="true" href="https://gist.github.com/4538709">https://gist.github.com/4538709</a></div>
      <div><br>
      </div>
      <div>4. Sebi's proposition<a moz-do-not-send="true" href="https://gist.github.com/4538725">https://gist.github.com/4538725</a></div>
      <div><br>
      </div>
      <div><br>
      </div>
    </blockquote>
    I've just updated my proposition.&nbsp; PageContext is no longer and
    thing and I've replaced it with a PagedList interface.<br>
    <blockquote cite="mid:CAD_dpu0dZceRqzoUWeOqQX2v_QfopR_2yQz7Zhmbv7qnSbhDqg@mail.gmail.com" type="cite">
      <div><br>
        <br>
        <div class="gmail_quote">On Tue, Jan 15, 2013 at 2:32 PM,
          Matthias Wessendorf <span dir="ltr">&lt;<a moz-do-not-send="true" href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div class="im">On Tue, Jan 15, 2013 at 2:25 PM, Matthias
              Wessendorf &lt;<a moz-do-not-send="true" href="mailto:matzew@apache.org">matzew@apache.org</a>&gt;
              wrote:<br>
              &gt; I was wondering, if the result should be received on
              every rquest,<br>
              <br>
              <br>
            </div>
            ideally on the callback..., to not block (at least in iOS
            land, I<br>
            would pass that "result set" on to the "success" block)<br>
            <span class="HOEnZb"><font color="#888888"><br>
                -M<br>
              </font></span>
            <div class="HOEnZb">
              <div class="h5"><br>
                &gt;<br>
                &gt; thx<br>
                &gt;<br>
                &gt; On Tue, Jan 15, 2013 at 2:01 PM, Sebastien Blanc
                &lt;<a moz-do-not-send="true" href="mailto:scm.blanc@gmail.com">scm.blanc@gmail.com</a>&gt;
                wrote:<br>
                &gt;&gt; In the same spirit (inspired from<br>
                &gt;&gt; <a moz-do-not-send="true" href="http://stackoverflow.com/questions/5412059/how-to-implement-general-pagination" target="_blank">http://stackoverflow.com/questions/5412059/how-to-implement-general-pagination</a>)<br>
                &gt;&gt; :<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt; public interface PagedResult&lt;T&gt; {<br>
                &gt;&gt;<br>
                &gt;&gt; &nbsp; &nbsp; PagedResult&lt;T&gt; next();<br>
                &gt;&gt;<br>
                &gt;&gt; &nbsp; &nbsp; PagedResult&lt;T&gt; prev();<br>
                &gt;&gt;<br>
                &gt;&gt; &nbsp; &nbsp; PagedResult&lt;T&gt; withOffset(int
                offset);<br>
                &gt;&gt;<br>
                &gt;&gt; &nbsp; &nbsp; PagedResult&lt;T&gt; withLimit(int limit);<br>
                &gt;&gt;<br>
                &gt;&gt; &nbsp; &nbsp; List&lt;T&gt; result();<br>
                &gt;&gt;<br>
                &gt;&gt; }<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt; On Tue, Jan 15, 2013 at 1:38 PM, Douglas Campos
                &lt;<a moz-do-not-send="true" href="mailto:qmx@qmx.me">qmx@qmx.me</a>&gt;
                wrote:<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; I'm not a fan of those PageContext objects
                (remembers me of some wild-ass<br>
                &gt;&gt;&gt; ThreadLocals leaking all over)<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; My proposal for the paging aware APIs would
                be something like this:<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; public interface PagedResult&lt;T&gt; {<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; &nbsp; &nbsp; List&lt;T&gt; next();<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; &nbsp; &nbsp; List&lt;T&gt; prev();<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; &nbsp; &nbsp; List&lt;T&gt; page(int offset, int
                limit);<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; }<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; and the Async counterpart<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; public interface AsyncPagedResult&lt;T&gt;
                {<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; &nbsp; &nbsp; void next(Callback&lt;List&lt;T&gt;&gt;
                callback);<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; &nbsp; &nbsp; void prev(Callback&lt;List&lt;T&gt;&gt;
                callback);<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; &nbsp; &nbsp; void page(int offset, int limit,
                Callback&lt;List&lt;T&gt;&gt; callback);<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; &nbsp; &nbsp; public static interface
                Callback&lt;U&gt; {<br>
                &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; public void onResult(U result);<br>
                &gt;&gt;&gt; &nbsp; &nbsp; }<br>
                &gt;&gt;&gt; }<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; I don't like the idea of having a companion
                object for holding the<br>
                &gt;&gt;&gt; pagination state.<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; Thoughts?<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; -- qmx<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; On 15/01/2013, at 08:37, Matthias
                Wessendorf &lt;<a moz-do-not-send="true" href="mailto:matzew@apache.org">matzew@apache.org</a>&gt;
                wrote:<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt; &gt; Hi Summers,<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; <a moz-do-not-send="true" href="https://gist.github.com/4532661" target="_blank">https://gist.github.com/4532661</a><br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; That is a way to do paging which keeps
                Pipes immutable, uses<br>
                &gt;&gt;&gt; &gt; readWithFilter, and doesn't impose any
                (for convenient definitions of any)<br>
                &gt;&gt;&gt; &gt; bookkeeping on the developer.<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; from your Andorid gist:<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; A) Once the response has been
                received, the Pipe implementation will<br>
                &gt;&gt;&gt; &gt; return a List of objects. If this List
                instance is passed to<br>
                &gt;&gt;&gt; &gt; Pipe.getPageContext the appropriate
                PageContext will be returned<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; Note: There is no 'return' - the
                readWithFilter is void, instead a<br>
                &gt;&gt;&gt; &gt; Callback is invoked (onSuccess(list)),
                see Pipe.java<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; B) The developer will receive from
                readWithFilter() a List of object. If<br>
                &gt;&gt;&gt; &gt; she passes this list into
                Pipe.getPageContext(List result) she will receive<br>
                &gt;&gt;&gt; &gt; the PageContext associated with this
                result.<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; Do you mean like:<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; ...<br>
                &gt;&gt;&gt; &gt; myPipe.readWithFilter(filter, new
                Callback&lt;List&lt;Data&gt;&gt;() {<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; @Override<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; public void onSuccess(List&lt;Data&gt;
                data) {<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; // get the PageContext:<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; PageContext ctx =
                myPipe.getPageContext(data);<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; ...<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; }<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; @Override<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; public void onFailure(Exception e) {<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; }<br>
                &gt;&gt;&gt; &gt; });<br>
                &gt;&gt;&gt; &gt; Not sure about that.....<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; But for iOS I am thinking about
                passing in the PageContext into the<br>
                &gt;&gt;&gt; &gt; closure/block of the readWithFilter,
                like:<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; -(void) readWithFilter:(void
                (^)(id&lt;AGFilterConfig&gt; config)) config<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; success:(void (^)(id listOfObjects, id
                pageContext))success<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; failure:(void (^)(NSError
                *error))failure;<br>
                &gt;&gt;&gt; &gt; A usage would look like:<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; &nbsp; &nbsp; [pipe
                readWithFilter:^(id&lt;AGFilterConfig&gt; config) {<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; // set the filter args and override
                the given defaults<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; } success:^(id listOfObjects, id
                pageContext) {<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; // work with the listOfObjects
                reponse.<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; // for paging/query info, access the
                given pagecontext,<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; // of the CURRENT request<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; ...<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; } failure:^(NSError *error) {<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; // handle errorz<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; }];<br>
                &gt;&gt;&gt; &gt; Any thoughts ?<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; Not sure I like (or understand) the
                Pipe.getPageContext(List result)<br>
                &gt;&gt;&gt; &gt; call. Current mindset is that
                thePageContext just (and only) belongs to the<br>
                &gt;&gt;&gt; &gt; previous (executed) request... Not
                sure I want to support something like<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; // first call:<br>
                &gt;&gt;&gt; &gt; List&lt;SomeType&gt; first;<br>
                &gt;&gt;&gt; &gt; myPipe.readWithFilter(.....) // set
                first inside of callback<br>
                &gt;&gt;&gt; &gt; ...<br>
                &gt;&gt;&gt; &gt; // second call:<br>
                &gt;&gt;&gt; &gt; List&lt;SomeType&gt; second;<br>
                &gt;&gt;&gt; &gt; myPipe.readWithFilter(.....) // set
                second inside of callback<br>
                &gt;&gt;&gt; &gt; ...<br>
                &gt;&gt;&gt; &gt; // third call:<br>
                &gt;&gt;&gt; &gt; List&lt;SomeType&gt; third;<br>
                &gt;&gt;&gt; &gt; myPipe.readWithFilter(.....) // set
                third inside of callback<br>
                &gt;&gt;&gt; &gt; ...<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; /// A BIT LATER ....:<br>
                &gt;&gt;&gt; &gt; myPipe.getPageContext(first);<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; I am not sure if that
                (myPipe.getPageContext(first);) is really desired<br>
                &gt;&gt;&gt; &gt; (or would even easily work, as it
                would need to store the "metadata").....<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; Perhaps I am just wrong.<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; --<br>
                &gt;&gt;&gt; &gt; Matthias Wessendorf<br>
                &gt;&gt;&gt; &gt;<br>
                &gt;&gt;&gt; &gt; blog: <a moz-do-not-send="true" href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>
                &gt;&gt;&gt; &gt; sessions: <a moz-do-not-send="true" href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
                &gt;&gt;&gt; &gt; twitter: <a moz-do-not-send="true" href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a><br>
                &gt;&gt;&gt; &gt;
                _______________________________________________<br>
                &gt;&gt;&gt; &gt; aerogear-dev mailing list<br>
                &gt;&gt;&gt; &gt; <a moz-do-not-send="true" href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
                &gt;&gt;&gt; &gt; <a moz-do-not-send="true" href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt;<br>
                &gt;&gt;&gt;
                _______________________________________________<br>
                &gt;&gt;&gt; aerogear-dev mailing list<br>
                &gt;&gt;&gt; <a moz-do-not-send="true" href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
                &gt;&gt;&gt; <a moz-do-not-send="true" href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt; _______________________________________________<br>
                &gt;&gt; aerogear-dev mailing list<br>
                &gt;&gt; <a moz-do-not-send="true" href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
                &gt;&gt; <a moz-do-not-send="true" href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
                &gt;&gt;<br>
                &gt;<br>
                &gt;<br>
                &gt;<br>
                &gt; --<br>
                &gt; Matthias Wessendorf<br>
                &gt;<br>
                &gt; blog: <a moz-do-not-send="true" href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>
                &gt; sessions: <a moz-do-not-send="true" href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
                &gt; twitter: <a moz-do-not-send="true" href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a><br>
                <br>
                <br>
                <br>
                --<br>
                Matthias Wessendorf<br>
                <br>
                blog: <a moz-do-not-send="true" href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>
                sessions: <a moz-do-not-send="true" href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
                twitter: <a moz-do-not-send="true" href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a><br>
                _______________________________________________<br>
                aerogear-dev mailing list<br>
                <a moz-do-not-send="true" href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
                <a moz-do-not-send="true" href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
aerogear-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/aerogear-dev">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a>
</pre>
    </blockquote>
    <br>
  </div>

_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/aerogear-dev<br></blockquote></div><br></div></body></html>