<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 01/15/2013 05:37 AM, Matthias
Wessendorf wrote:<br>
</div>
<blockquote
cite="mid:CAAg5f2S-pmxpoDKx+Ke_pHiBS=bbX8LtABfmf750YJB8k=ynRw@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<p
style="margin-right:0px;margin-bottom:15px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px;margin-top:0px!important">Hi
Summers,</p>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><a
moz-do-not-send="true"
href="https://gist.github.com/4532661" target="_blank">https://gist.github.com/4532661</a><br>
<br>
That is a way to do paging which keeps Pipes immutable, uses
readWithFilter, and doesn't impose any (for convenient
definitions of any) bookkeeping on the developer.<br>
</div>
</blockquote>
<div><br>
</div>
<div><br>
</div>
<div>
<p
style="margin-right:0px;margin-bottom:15px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px;margin-top:0px!important">from
your <a moz-do-not-send="true"
href="https://gist.github.com/4532661"
style="color:rgb(65,131,196);text-decoration:initial">Andorid
gist</a>:</p>
<p style="margin:15px
0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">A) <em>Once
the response has been received, the Pipe implementation
will return a List of objects. If this List instance is
passed to Pipe.getPageContext the appropriate PageContext
will be returned</em></p>
<p style="margin:15px
0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">Note:
There is no 'return' - the <code
style="font-size:12px;line-height:normal;font-family:Consolas,'Liberation
Mono',Courier,monospace;margin:0px 2px;padding:0px
5px;border:1px solid
rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">readWithFilter</code> is <code
style="font-size:12px;line-height:normal;font-family:Consolas,'Liberation
Mono',Courier,monospace;margin:0px 2px;padding:0px
5px;border:1px solid
rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">void</code>,
instead a Callback is invoked (<code
style="font-size:12px;line-height:normal;font-family:Consolas,'Liberation
Mono',Courier,monospace;margin:0px 2px;padding:0px
5px;border:1px solid
rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">onSuccess(list)</code>),
see <a moz-do-not-send="true"
href="https://github.com/aerogear/aerogear-android/blob/master/src/org/jboss/aerogear/android/pipeline/Pipe.java"
style="color:rgb(65,131,196);text-decoration:initial">Pipe.java</a></p>
</div>
</div>
</blockquote>
Yeah I totally fubarred that when I was putting together the gist.<br>
<blockquote
cite="mid:CAAg5f2S-pmxpoDKx+Ke_pHiBS=bbX8LtABfmf750YJB8k=ynRw@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<div>
<p style="margin:15px
0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">B) <em>The
developer will receive from readWithFilter() a List of
object. If she passes this list into
Pipe.getPageContext(List result) she will receive the
PageContext associated with this result.</em></p>
<p style="margin:15px
0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">Do
you mean like:</p>
<div class="highlight"
style="background-color:rgb(255,255,255);border:none;padding:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">
<pre style="font-size:13px;line-height:19px;font-family:Consolas,'Liberation Mono',Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px"><span class="o" style="font-weight:bold">...</span>
<span class="n">myPipe</span><span class="o" style="font-weight:bold">.</span><span class="na" style="color:rgb(0,128,128)">readWithFilter</span><span class="o" style="font-weight:bold">(</span><span class="n">filter</span><span class="o" style="font-weight:bold">,</span> <span class="k" style="font-weight:bold">new</span> <span class="n">Callback</span><span class="o" style="font-weight:bold"><</span><span class="n">List</span><span class="o" style="font-weight:bold"><</span><span class="n">Data</span><span class="o" style="font-weight:bold">>>()</span> <span class="o" style="font-weight:bold">{</span>
<span class="nd">@Override</span>
<span class="kd" style="font-weight:bold">public</span> <span class="kt" style="color:rgb(68,85,136);font-weight:bold">void</span> <span class="nf" style="color:rgb(153,0,0);font-weight:bold">onSuccess</span><span class="o" style="font-weight:bold">(</span><span class="n">List</span><span class="o" style="font-weight:bold"><</span><span class="n">Data</span><span class="o" style="font-weight:bold">></span> <span class="n">data</span><span class="o" style="font-weight:bold">)</span> <span class="o" style="font-weight:bold">{</span>
<span class="c1" style="color:rgb(153,153,136);font-style:italic">// get the PageContext:</span>
<span class="n">PageContext</span> <span class="n">ctx</span> <span class="o" style="font-weight:bold">=</span> <span class="n">myPipe</span><span class="o" style="font-weight:bold">.</span><span class="na" style="color:rgb(0,128,128)">getPageContext</span><span class="o" style="font-weight:bold">(</span><span class="n">data</span><span class="o" style="font-weight:bold">);</span>
<span class="o" style="font-weight:bold">...</span>
<span class="o" style="font-weight:bold">}</span>
<span class="nd">@Override</span>
<span class="kd" style="font-weight:bold">public</span> <span class="kt" style="color:rgb(68,85,136);font-weight:bold">void</span> <span class="nf" style="color:rgb(153,0,0);font-weight:bold">onFailure</span><span class="o" style="font-weight:bold">(</span><span class="n">Exception</span> <span class="n">e</span><span class="o" style="font-weight:bold">)</span> <span class="o" style="font-weight:bold">{</span>
<span class="o" style="font-weight:bold">}</span>
<span class="o" style="font-weight:bold">});</span>
</pre>
</div>
<p style="margin:15px
0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">Not
sure about that.....</p>
<p style="margin:15px
0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">But
for iOS I am thinking about passing in the <code
style="font-size:12px;line-height:normal;font-family:Consolas,'Liberation
Mono',Courier,monospace;margin:0px 2px;padding:0px
5px;border:1px solid
rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">PageContext</code> into
the closure/block of the <code
style="font-size:12px;line-height:normal;font-family:Consolas,'Liberation
Mono',Courier,monospace;margin:0px 2px;padding:0px
5px;border:1px solid
rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">readWithFilter</code>,
like:</p>
<div class="highlight"
style="background-color:rgb(255,255,255);border:none;padding:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">
<pre style="font-size:13px;line-height:19px;font-family:Consolas,'Liberation Mono',Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px"><span class="k" style="font-weight:bold">-</span><span class="p">(</span><span class="kt" style="color:rgb(68,85,136);font-weight:bold">void</span><span class="p">)</span> <span class="nf" style="color:rgb(153,0,0);font-weight:bold">readWithFilter:</span><span class="p">(</span><span class="kt" style="color:rgb(68,85,136);font-weight:bold">void</span> <span class="p">(</span><span class="o" style="font-weight:bold">^</span><span class="p">)(</span><span class="kt" style="color:rgb(68,85,136);font-weight:bold">id</span><span class="o" style="font-weight:bold"><</span><span class="n">AGFilterConf!
ig</span><
span class="o" style="font-weight:bold">></span> <span class="n">config</span><span class="p">))</span> <span class="n">config</span>
<span class="nl">success:</span><span class="p">(</span><span class="kt" style="color:rgb(68,85,136);font-weight:bold">void</span> <span class="p">(</span><span class="o" style="font-weight:bold">^</span><span class="p">)(</span><span class="kt" style="color:rgb(68,85,136);font-weight:bold">id</span> <span class="n">listOfObjects</span><span class="p">,</span> <span class="kt" style="color:rgb(68,85,136);font-weight:bold">id</span> <span class="n">pageContext</span><span class="p">))</span><span class="n">success</span>
<span class="nl">failure:</span><span class="p">(</span><span class="kt" style="color:rgb(68,85,136);font-weight:bold">void</span> <span class="p">(</span><span class="o" style="font-weight:bold">^</span><span class="p">)(</span><span class="n">NSError</span> <span class="o" style="font-weight:bold">*</span><span class="n">error</span><span class="p">))</span><span class="n">failure</span><span class="p">;</span>
</pre>
</div>
<p style="margin:15px
0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">A
usage would look like:</p>
<div class="highlight"
style="background-color:rgb(255,255,255);border:none;padding:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">
<pre style="font-size:13px;line-height:19px;font-family:Consolas,'Liberation Mono',Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px"> <span class="p">[</span><span class="n">pipe</span> <span class="nl">readWithFilter:</span><span class="o" style="font-weight:bold">^</span><span class="p">(</span><span class="kt" style="color:rgb(68,85,136);font-weight:bold">id</span><span class="o" style="font-weight:bold"><</span><span class="n">AGFilterConfig</span><span class="o" style="font-weight:bold">></span> <span class="n">config</span><span class="p">)</span> <span class="p">{</span>
<span class="c1" style="color:rgb(153,153,136);font-style:italic">// set the filter args and override the given defaults</span>
<span class="p">}</span> <span class="nl">success:</span><span class="o" style="font-weight:bold">^</span><span class="p">(</span><span class="kt" style="color:rgb(68,85,136);font-weight:bold">id</span> <span class="n">listOfObjects</span><span class="p">,</span> <span class="kt" style="color:rgb(68,85,136);font-weight:bold">id</span> <span class="n">pageContext</span><span class="p">)</span> <span class="p">{</span>
<span class="c1" style="color:rgb(153,153,136);font-style:italic">// work with the listOfObjects reponse.</span>
<span class="c1" style="color:rgb(153,153,136);font-style:italic">// for paging/query info, access the given pagecontext,</span>
<span class="c1" style="color:rgb(153,153,136);font-style:italic">// of the CURRENT request</span>
<span class="p">...</span>
<span class="p">}</span> <span class="nl">failure:</span><span class="o" style="font-weight:bold">^</span><span class="p">(</span><span class="n">NSError</span> <span class="o" style="font-weight:bold">*</span><span class="n">error</span><span class="p">)</span> <span class="p">{</span>
<span class="c1" style="color:rgb(153,153,136);font-style:italic">// handle errorz</span>
<span class="p">}];</span>
</pre>
</div>
<p style="margin:15px
0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">Any
thoughts ?</p>
</div>
</div>
</blockquote>
I don't hate it. I don't love it but I don't hate it. On the one
hand it makes where the pageContext comes from explicit and you get
it with your request. On the other hand you don't always a
PageContext for a request so it will be something devs always have
to drag around.<br>
<blockquote
cite="mid:CAAg5f2S-pmxpoDKx+Ke_pHiBS=bbX8LtABfmf750YJB8k=ynRw@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<div>
<p style="margin:15px
0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">Not
sure I like (or understand) the <code
style="font-size:12px;line-height:normal;font-family:Consolas,'Liberation
Mono',Courier,monospace;margin:0px 2px;padding:0px
5px;border:1px solid
rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">Pipe.getPageContext(List
result)</code> call. Current mindset is that the<code
style="font-size:12px;line-height:normal;font-family:Consolas,'Liberation
Mono',Courier,monospace;margin:0px 2px;padding:0px
5px;border:1px solid
rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">PageContext</code> just
(and <em>only</em>) belongs to the previous (executed)
request... Not sure I want to support something like</p>
<div class="highlight"
style="background-color:rgb(255,255,255);border:none;padding:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">
<pre style="font-size:13px;line-height:19px;font-family:Consolas,'Liberation Mono',Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px"><span class="c1" style="color:rgb(153,153,136);font-style:italic">// first call:</span>
<span class="n">List</span><span class="o" style="font-weight:bold"><</span><span class="n">SomeType</span><span class="o" style="font-weight:bold">></span> <span class="n">first</span><span class="o" style="font-weight:bold">;</span>
<span class="n">myPipe</span><span class="o" style="font-weight:bold">.</span><span class="na" style="color:rgb(0,128,128)">readWithFilter</span><span class="o" style="font-weight:bold">(.....)</span> <span class="c1" style="color:rgb(153,153,136);font-style:italic">// set first inside of callback</span>
<span class="o" style="font-weight:bold">...</span>
<span class="c1" style="color:rgb(153,153,136);font-style:italic">// second call:</span>
<span class="n">List</span><span class="o" style="font-weight:bold"><</span><span class="n">SomeType</span><span class="o" style="font-weight:bold">></span> <span class="n">second</span><span class="o" style="font-weight:bold">;</span>
<span class="n">myPipe</span><span class="o" style="font-weight:bold">.</span><span class="na" style="color:rgb(0,128,128)">readWithFilter</span><span class="o" style="font-weight:bold">(.....)</span> <span class="c1" style="color:rgb(153,153,136);font-style:italic">// set second inside of callback</span>
<span class="o" style="font-weight:bold">...</span>
<span class="c1" style="color:rgb(153,153,136);font-style:italic">// third call:</span>
<span class="n">List</span><span class="o" style="font-weight:bold"><</span><span class="n">SomeType</span><span class="o" style="font-weight:bold">></span> <span class="n">third</span><span class="o" style="font-weight:bold">;</span>
<span class="n">myPipe</span><span class="o" style="font-weight:bold">.</span><span class="na" style="color:rgb(0,128,128)">readWithFilter</span><span class="o" style="font-weight:bold">(.....)</span> <span class="c1" style="color:rgb(153,153,136);font-style:italic">// set third inside of callback</span>
<span class="o" style="font-weight:bold">...</span>
<span class="c1" style="color:rgb(153,153,136);font-style:italic">/// A BIT LATER ....:</span>
<span class="n">myPipe</span><span class="o" style="font-weight:bold">.</span><span class="na" style="color:rgb(0,128,128)">getPageContext</span><span class="o" style="font-weight:bold">(</span><span class="n">first</span><span class="o" style="font-weight:bold">);</span>
</pre>
</div>
<p
style="margin-top:15px;margin-right:0px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px;margin-bottom:0px!important">I
am not sure if that (<code
style="font-size:12px;line-height:normal;font-family:Consolas,'Liberation
Mono',Courier,monospace;margin:0px 2px;padding:0px
5px;border:1px solid
rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">myPipe.getPageContext(first);</code>)
is really desired (or would even easily work, as it would
need to store the "metadata")..... <br>
</p>
</div>
</div>
</blockquote>
It easily works in Java land. (To leak some implementation here
look at WeakHashMap, the entries die when the keys die).<br>
<br>
I'm open to suggestions because I am not in love with this method
either.<br>
<br>
<blockquote
cite="mid:CAAg5f2S-pmxpoDKx+Ke_pHiBS=bbX8LtABfmf750YJB8k=ynRw@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<div>
<p
style="margin-top:15px;margin-right:0px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px;margin-bottom:0px!important"><br>
</p>
<p
style="margin-top:15px;margin-right:0px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px;margin-bottom:0px!important"><br>
</p>
<p
style="margin-top:15px;margin-right:0px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px;margin-bottom:0px!important">Perhaps
I am just wrong.</p>
</div>
<div>
<br>
</div>
</div>
</blockquote>
You are not wrong at all.<br>
<blockquote
cite="mid:CAAg5f2S-pmxpoDKx+Ke_pHiBS=bbX8LtABfmf750YJB8k=ynRw@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<div><br>
</div>
</div>
-- <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>
<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>
</body>
</html>