<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/08/2014 09:59 AM, Lucas Holmquist
      wrote:<br>
    </div>
    <blockquote
      cite="mid:E13AB158-12EA-42FC-9FFD-6F2ACC326424@redhat.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <br>
      <div>
        <div>On Jan 8, 2014, at 9:53 AM, Summers Pittman &lt;<a
            moz-do-not-send="true" 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/08/2014 09:42 AM, Tadeas
              Kriz wrote:<br>
            </div>
            <blockquote
              cite="mid:0BE571A7-F030-4561-AEE8-FF87406E5877@redhat.com"
              type="cite">
              <meta http-equiv="Content-Type" content="text/html;
                charset=ISO-8859-1">
              <br>
              <div>
                <div>On 08 Jan 2014, at 15:30, Summers Pittman &lt;<a
                    moz-do-not-send="true"
                    href="mailto:supittma@redhat.com">supittma@redhat.com</a>&gt;

                  wrote:</div>
                <br class="Apple-interchange-newline">
                <blockquote type="cite">
                  <div style="font-size: 12px; font-style: normal;
                    font-variant: normal; font-weight: normal;
                    letter-spacing: normal; line-height: normal;
                    orphans: auto; text-align: start; text-indent: 0px;
                    text-transform: none; white-space: normal; widows:
                    auto; word-spacing: 0px; -webkit-text-stroke-width:
                    0px;">On 01/08/2014 05:51 AM, Tadeas Kriz wrote:<br>
                    <blockquote type="cite">Hey everyone,<br>
                      <br>
                      I&#8217;ve been recently going through the DataManager
                      API in aerogear-android. In this email, I&#8217;d like
                      to suggest addiction of two method (or possibly
                      three) into the `Store&lt;T&gt;` interface. These
                      would be:<br>
                      <br>
                      ```java<br>
                      /**<br>
                      &nbsp;* If store is open, it can be read or written to.<br>
                      &nbsp;*/<br>
                      boolean isOpen();<br>
                      <br>
                      /**<br>
                      &nbsp;* Opens store in current thread (blocking).<br>
                      &nbsp;*/<br>
                      Store&lt;T&gt; open();<br>
                      <br>
                      /**<br>
                      &nbsp;* Opens store in background thread and then
                      callback#onSuccess is called.<br>
                      &nbsp;*/<br>
                      void open(Callback&lt;Store&lt;T&gt;&gt;
                      callback);<br>
                      ```<br>
                    </blockquote>
                    I think those are fine. Feel free to JIRA it up and
                    Passos and I will<span class="Apple-converted-space">&nbsp;</span><br>
                    review.<br>
                    <blockquote type="cite"><br>
                      <blockquote type="cite">From my point of view,
                        this makes sense to be in the `Store&lt;T&gt;`
                        so I can switch between stores easily during
                        development with no need to change other code.
                        Also, if `read` or `write` operations are done
                        with closed store, there are two possible
                        workflows. First one is, that I&#8217;d fail and throw
                        an exception. Second (and for me a preferred
                        one) is, that all those methods would internally
                        check if the store is open and if not, they&#8217;d
                        call the `open` method. This also leads me to
                        another API change for `Store&lt;T&gt;`.<br>
                      </blockquote>
                      <br>
                      ```java<br>
                      /**<br>
                      &nbsp;* Reads all the data from the underlying storage
                      system asynchronously.<br>
                      &nbsp;*/<br>
                      void readAll(Callback&lt;Collection&lt;T&gt;&gt;
                      callback);<br>
                      <br>
                      /**<br>
                      &nbsp;* Reads a specific object/record from the
                      underlying storage system asynchronously.<br>
                      &nbsp;*/<br>
                      void read(Serializable id, Callback&lt;T&gt;
                      callback);<br>
                      <br>
                      /**<br>
                      &nbsp;* Search for objects/records from the underlying
                      storage system asynchronously.<br>
                      &nbsp;*/<br>
                      void readWithFilter(ReadFilter filter,
                      Callback&lt;List&lt;T&gt;&gt; callback);<br>
                      <br>
                      /**<br>
                      &nbsp;* Saves the given object in the underlying
                      storage system asynchronously.<br>
                      &nbsp;*/<br>
                      void save(T item, Callback&lt;Void&gt; callback);<br>
                      <br>
                      /**<br>
                      &nbsp;* Resets the entire storage system
                      asynchronously.<br>
                      &nbsp;*/<br>
                      void reset(Callback&lt;Void&gt; callback);<br>
                      <br>
                      /**<br>
                      &nbsp;* Removes a specific object/record from the
                      underlying storage system asynchronously.<br>
                      &nbsp;*/<br>
                      void remove(Serializable id, Callback&lt;Void&gt;
                      callback);<br>
                      <br>
                      /**<br>
                      &nbsp;* Checks if the storage system contains no stored
                      elements asynchronously.<br>
                      &nbsp;*/<br>
                      void isEmpty(Callback&lt;Boolean&gt; callback);<br>
                      ```<br>
                      <br>
                      That&#8217;s right, async methods for easy access to the
                      storage from background thread, without the pain
                      of writing it myself (for example, it makes no
                      sense if I want to just call `store.save(..)` and
                      I&#8217;d have to write all the `AsyncTask`
                      boilerplate).<br>
                      <br>
                      So, what do you think?<br>
                    </blockquote>
                    <br>
                    I would rather throw an exception than open a
                    database when you call<span
                      class="Apple-converted-space">&nbsp;</span><br>
                    read and friends. That way a developer doesn't
                    accidentally open a<span
                      class="Apple-converted-space">&nbsp;</span><br>
                    database he meant to be closed. I don't have that
                    strong of a feeling on<span
                      class="Apple-converted-space">&nbsp;</span><br>
                    that point one way or another however.</div>
                </blockquote>
                <div><br>
                </div>
                <div>That&#8217;s right, it&#8217;s probably less error prone in
                  scenarios when you want the store closed.</div>
                <br>
                <blockquote type="cite">
                  <div style="font-size: 12px; font-style: normal;
                    font-variant: normal; font-weight: normal;
                    letter-spacing: normal; line-height: normal;
                    orphans: auto; text-align: start; text-indent: 0px;
                    text-transform: none; white-space: normal; widows:
                    auto; word-spacing: 0px; -webkit-text-stroke-width:
                    0px;"><br>
                    My stronger feeling is on adding callbacks to the
                    stores methods. I<span class="Apple-converted-space">&nbsp;</span><br>
                    prefer for the Store to be synchronous and Pipes to
                    be asynchronous. We<span
                      class="Apple-converted-space">&nbsp;</span><br>
                    could add a StorePipe to our PypeTipes which may
                    solve some of the headache.<br>
                    <br>
                  </div>
                </blockquote>
                <div><br>
                </div>
                <div>Would &#8220;void open(Callback&lt;Store&lt;T&gt;&gt;
                  callback);&#8221; make sense then? I mean, that would add
                  another inconsistency in the API, as one method would
                  be async and the rest would be only synchronous,
                  wouldn&#8217;t it?</div>
              </div>
            </blockquote>
            True.&nbsp; The reason for the exception here was that opening a
            SQL store or an encrypted store COULD take significant
            amount of time. For in Memory data stores this is instant of
            course.<br>
          </div>
        </blockquote>
        <div><br>
        </div>
        <div>In JS, &nbsp;once we added IndexedDB and WebSql which are async,
          &nbsp;we deprecated the sync api and made everything "async"</div>
      </div>
    </blockquote>
    I didn't realize you guys were deprecating the sync methods.&nbsp; I
    thought you were just adding the aysnc methods because that* is what
    JS developers expect.<br>
    <br>
    <br>
    <br>
    *That = callback hell :-p<br>
    <blockquote
      cite="mid:E13AB158-12EA-42FC-9FFD-6F2ACC326424@redhat.com"
      type="cite">
      <div><br>
        <blockquote type="cite">
          <div bgcolor="#FFFFFF" text="#000000">
            <blockquote
              cite="mid:0BE571A7-F030-4561-AEE8-FF87406E5877@redhat.com"
              type="cite">
              <div><br>
                <blockquote type="cite">
                  <div style="font-size: 12px; font-style: normal;
                    font-variant: normal; font-weight: normal;
                    letter-spacing: normal; line-height: normal;
                    orphans: auto; text-align: start; text-indent: 0px;
                    text-transform: none; white-space: normal; widows:
                    auto; word-spacing: 0px; -webkit-text-stroke-width:
                    0px;">Passos, wdyt?<br>
                    <br>
                    <br>
                    <blockquote type="cite"><br>
                      PS: You can find the whole text with highlighted
                      syntax here:<br>
                      <br>
                      &#8212;<br>
                      Tadeas Kriz<br>
                      <a moz-do-not-send="true"
                        href="mailto:tkriz@redhat.com">tkriz@redhat.com</a><br>
                      <br>
                      <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">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
                    </blockquote>
                    <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">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></div>
                </blockquote>
              </div>
              <br>
              <br>
              <fieldset class="mimeAttachmentHeader"></fieldset>
              <br>
              <pre wrap="">_______________________________________________
aerogear-dev mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a>
<a moz-do-not-send="true" 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 moz-do-not-send="true"
            href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
          <a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/aerogear-dev">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></blockquote>
      </div>
      <br>
      <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>