Patch implementing DataContextDelegate

From: Mike Kienenberger (mkienen..laska.net)
Date: Thu Sep 25 2003 - 14:36:35 EDT

  • Next message: Mike Kienenberger: "Re: Patch implementing DataContextDelegate"

    Andrus Adamchik <andru..bjectstyle.org> wrote:
    > The more I think about it, the more I am convinced that we need a
    > separate delegate interface for DataContext. DataContextDelegate is a
    > good start :-)...

    Well,I had a fairly clean implementation of this with one iteration right before the QueryEngine was called, then I realized that if willPerformSelect() returned null, then the prefetch for that query shouldn't be performed. Which made me realize that if a query changed, the prefetch might also change. So I now have three slightly-different sections of code.

    So here's my not-quite-as-clear changes, but I believe it correctly handles all cases.

    One thing I'm not sure about is if all queries are vetoed.
    Can an empty list of queries by passed to QueryEngine.performQueries?
    Should DataContext.performQueries() bail out if it detects that there are no more finalQueries?
    Will this confuse resultConsumer?
    My implementation chose to pass the problem on to QueryEngine and hope it was handled reasonably.

    Another thing I'm unclear on is whether it is legal or appropriate to call iterator.remove on the original query List passed in. The alternative is to build another list, but up to this point, I've made it so that the DataContextDelegate code has almost no impact if no DataContextDelegates are specified. This change will require that a new query list be built even if no DataContextDelgates exist.

    Actually, the more I look at the finalQueries code, the more I'm convinced that it's not appropriate to modify the queries list. I've reworked it so that a new query list is created, and while the code becomes yet even more difficult to read, it doesn't impact the performance unless there are delegates.

    Here are the patches.

    Unfortunately, they are against the 2003-09-11 build. I did a diff between 09/11 and 09/25 and didn't see any conflicts, but some of the imports, class instance variables, and methods providing nearby "context" for the patch may have changed.

    [DataContext.java.diffs][DataContextDelegate.java]



    This archive was generated by hypermail 2.0.0 : Thu Sep 25 2003 - 14:36:21 EDT