jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mete Atamel <mata...@adobe.com>
Subject Re: MicroKernel add/set property
Date Wed, 17 Oct 2012 13:30:29 GMT
Ok, I opened OAK-381 for adding property twice. However, one thing is
still not quite clear to me. It looks like set-property is really
create-or-modify-property whereas add-property is only create-property,
right? In that case, how do we really generate appropriate PROPERTY_ADDED
and PROPERTY_CHANGED events? What happens when set-property is being used
as create-property? For clear separation between PROPERTY_ADDED and
PROPERTY_CHANGED, I feel like add-property should be prerequisite to
set-property and set-property should really be modify-property only (i.e.
If a property does not exist, set-property should throw an exception). If
you think this is not necessary because appropriate PROPERTY_ADDED and
PROPERTY_CHANGED events can be derived from set-property as it is today,
then I'm not sure why add-property is necessary.

-Mete


On 10/17/12 2:58 PM, "Stefan Guggisberg" <stefan.guggisberg@gmail.com>
wrote:

>On Tue, Oct 16, 2012 at 4:39 PM, Mete Atamel <matamel@adobe.com> wrote:
>> Hi,
>>
>> I have 2 questions on MicroKernel add/set property that MicroKernel
>> JavaDoc does not seem to answer.
>>
>> 1- What's the difference between adding a property vs. setting a
>>property?
>> Are the two following commits basically the same?
>>
>> mk.commit("/", "+\"a/key1\" : \"value1\"", null, null);
>> mk.commit("/", "^\"a/key1\" : \"value1\"", null, null);
>
>initially we used to only support the 'set property' (create-or-modify)
>syntax,
>i.e.  ^"/some/property" : "some value"
>
>however, in JCR there are 2 distinct event types:
>PROPERTY_ADDED and PROPERTY_CHANGED
>
>in the mk journal/diff we therefore need to make the same distinction,
>i.e. added properties are reported with the '+' syntax, whereas the '^'
>syntax is used to represent property modifications.
>
>>
>>
>> Or are there scenarios where adding a property acts differently than
>> setting a property?
>>
>> 2- Is adding a property twice supposed to work or is it supposed to
>>throw
>> a MicroKernelException? For example, this seems to work with
>> MicroKernelImpl but is it supposed to?
>>
>>         mk.commit("/", "+\"a/key1\" : \"value1\"", null, null);
>>         mk.commit("/", "+\"a/key1\" : \"value1\"", null, null);
>
>you're right, that seems to be a bug. could you please file a jira issue?
>
>>
>> What about setting a property twice?
>
>that shouldn't be an issue. you can set a property more than once in a
>single commit. only the last modification should be persisted.
>
>cheers
>stefan
>
>>
>>
>> Thanks,
>> Mete
>>
>>


Mime
View raw message