db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta Satoor" <msat...@gmail.com>
Subject Re: how should store get an object based on format id and collation id?
Date Mon, 16 Apr 2007 21:54:17 GMT
OK, I think I understand what Dan is suggesting here. Dan, let me know if I
am off.

Keep the InstanceGetter as it is right now. There will be a new interface on
DVF called getNewInstance(format id, collation id). This new interface will
use the code similar to code in BaseMonitor.classFromIdentifier to get the
InstanceGetter for given format id. Then the DVF.getNewInstance will get an
instance from the InstanceGetter and will check if that instance is of type
StringDataValue. If yes, then it will get the RuleBasedCollator based on the
collation type passed to getNewInstance method and call
dvd.getValue(RuleBasedCollator)
which will return Collator sensitive DVDs if the RuleBasedCollator is not
null. So, at the end of it, DVF.getNewInstance will return the right DVD.
>From then on, if Store needs more DVDs, it will just call DVD.getNewNull.

I will start exploring this further because this way of implementation does
not require us to change/create new types of InstanceGetter class to support
collation sensitive DVDs.

Any comments, please post.

thanks,
Mamta


On 4/16/07, Mike Matrigali <mikem_app@sbcglobal.net> wrote:
>
>
>
> Daniel John Debrunner wrote:
> > Mike Matrigali wrote:
> >
> >>
> >>
> >> Daniel John Debrunner wrote:
> >>
> >>> Mamta Satoor wrote:
> >>>
> >>>> Hi Dan,
> >>>>
> >>>> The problem we are trying to solve is provide a way to Store so that
> >>>> it can call a method (say it's called
> >>>> getInstanceGetterForFormatIDandCollationType) on DVF with format id
> >>>> & collation type and get an InstanceGetter for that combination.
> >>>
> >>>
> >>>
> >>> Why use InstanceGetter here?
> >>
> >> Current store code uses InstanceGetter's, should that not be the case?
> >> As I have said the history of this predates when store knew it had
> >> DVD's.  Is there no performance to be had by the current use of
> >> InstanceGettor's where store makes one call get an InstanceGettor and
> >> then muliple calls on it to allocate possibly many objects based off
> >> of it?
> >
> >
> > DVD's can also act as their own factory using getNewNull(), that would
> > be more efficient than InstanceGetter. As you say this change could have
> > been made once the switch to using DVDs consistently through the system
> > was done.
> >
> Ok, this answers a previous question I had posted.  Store currently uses
> the following to get new "empty" instances of classes which will
> subsequently be initiated by calls to readExternal():
> dvd = dvd.getClass().newInstance()
>
> It sounds like this should be replaced by:
> dvd = dvd.getNewNull()
>
> I thought there might be some waisted state setting done by getNewNull()
> that might be saved by creating a new interface like dvd.getNewEmpty().
>
> Given this we should also be able to eliminate store's direct use
> of InstanceGetter, and change it to use a saved empty dvd to
> be the factory.  This factory still needs to produce dvd's that
> will support the same collation as the producing factory dvd, which
> in the current proposal would have been originally created with
> something like:
>
> One time:
> dvd =
> DataValueFactory.getNewInstance(format id, collation id)
>
> possibly MANY times to get objects that will be initialized by
> readExternal:
> dvd = dvd.getNewNull()
>
> As long as getNewNull() does the right thing, I think the only new
> interface
> store needs is the new DataValueFactory.getNewInstance(format id ,
> collate id) interface.
>
> > Dan.
> >
> >
> >
>
>

Mime
View raw message