DataRowStore properties

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

DataRowStore properties

Aristedes Maniatis-2
I'm a little confused about the way properties are used and set in the DataRowStore.

    public DataRowStore(String name, RuntimeProperties properties, EventManager eventManager)

properties can be null here, but

    protected void initWithProperties(RuntimeProperties properties)

will throw NPE


Also, initWithProperties(properties) seems to just ignore all the properties we pass except for SNAPSHOT_CACHE_SIZE_PROPERTY. Should SNAPSHOT_EXPIRATION_DEFAULT also be deprecated in this class?


Finally, in the DataDomain class we also have properties, but instead of being RuntimeProperties they are just Map<String, String>. Since it appears that RuntimeProperties are really just an enhanced map with getters that support default values, should RuntimeProperties be used consistently? To me this whole class seems like overkill, but maybe it is useful.


Ari



--
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: DataRowStore properties

Andrus Adamchik
I agree, this is confusing. This API is only half-way converted to the DI style of configuration. So yeah, it doesn't make sense (except as transitional API that needs to be cleaned up). Ideally all stack objects should be immutable and initialized with specific values, not properties. Properties should be decoded by factories that create those objects. (i.e. we need to stick to separation of configuration code from the object we are configuring).

We are following this approach everywhere in Bootique, and we'll gradually refactor towards it in Cayenne.

> Should SNAPSHOT_EXPIRATION_DEFAULT also be deprecated in this class?

Yes. I think in 4.1 we should.

Andrus


> On Jun 26, 2017, at 9:18 PM, Aristedes Maniatis <[hidden email]> wrote:
>
> I'm a little confused about the way properties are used and set in the DataRowStore.
>
>    public DataRowStore(String name, RuntimeProperties properties, EventManager eventManager)
>
> properties can be null here, but
>
>    protected void initWithProperties(RuntimeProperties properties)
>
> will throw NPE
>
>
> Also, initWithProperties(properties) seems to just ignore all the properties we pass except for SNAPSHOT_CACHE_SIZE_PROPERTY. Should SNAPSHOT_EXPIRATION_DEFAULT also be deprecated in this class?
>
>
> Finally, in the DataDomain class we also have properties, but instead of being RuntimeProperties they are just Map<String, String>. Since it appears that RuntimeProperties are really just an enhanced map with getters that support default values, should RuntimeProperties be used consistently? To me this whole class seems like overkill, but maybe it is useful.
>
>
> Ari
>
>
>
> --
> -------------------------->
> Aristedes Maniatis
> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Loading...