Re: DataContextFactory

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Sep 16 2005 - 13:13:01 EDT

  • Next message: Mike Kienenberger: "Re: DataContextFactory"

    When I mentioned builder I meant is as a joke, pointing out that
    there is no limit of how complex we can make it :-) Builders are good
    for creating complex hierarchical assemblies, such as Swing panels,
    etc. All we need is a simple extension point.

    Like I said, current solution is good, and now that I am looking at
    the cost of creating a throwaway ObjectStore, it is really not that
    big. EventManager registration is not a problem either - EventManager
    uses weak references, so such ObjectStore will be garbage collected
    in no time.

    Andrus

    On Sep 15, 2005, at 6:30 PM, Mike Kienenberger wrote:

    > I've been reading through the builder pattern and it's not quite clear
    > to me how this could be made to work. The pattern seems to assume
    > that the DataNode would know which kind of factory it wants first (one
    > using ObjectStore or one without).
    >
    > Another possiblity might be adding methods like
    >
    > public boolean needsObjectStore(); // recommended default is true
    > public boolean needsDataRowStore(); // recommended default is
    > false
    >
    > and calling the appropriate constructor.
    >
    > DataContext createDataContext(QueryEngine parent);
    > DataContext createDataContext(QueryEngine parent, ObjectStore
    > objectStore);
    > DataContext createDataContext(QueryEngine parent, DataRowStore
    > dataRowStore);
    >
    > or maybe simply just having what's below and assuming the end-user can
    > figure out how to get whatever resources are necessary to create an
    > object store.
    >
    > public boolean willProvideObjectStore()
    > DataContext createDataContext(QueryEngine parent);
    > DataContext createDataContext(QueryEngine parent, ObjectStore
    > objectStore);
    >
    > if (dataContextFactory.willProvideObjectStore()) {
    > context = new DataContext(this);
    > }
    > else {
    > context = dataContextFactory.createDataContext(this, new
    > ObjectStore(snapshotCache));
    > }
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri Sep 16 2005 - 13:13:05 EDT