You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by John Tranier <jo...@fylab.com> on 2010/05/20 15:42:43 UTC
Re: Jackrabbit 1.6 and DavEx ?
Hi !
Good news : I've migrated to 2.1.0 and the problem I had with move
disappeared :-)
I just discovered something that looks like a strange behaviour to me
and I would like to check whether it is expected or not.
With jcr2spi the cache seems to be handled per session.
Here is a sequence to illustrate it :
1. Create jcrSession1
2. Create jcrSession2
3. Add a node n with jcrSession1
4. ItemExists(n) with jcrSession2 returns false
5. Add a node n with jcrSession2 ==> Exception ItemExists
If I swap point 2. and 3. (i.e. I create jcrSession2 after adding the
node n with jcrSession1) everything works fine.
Is there a reason I don't know to handle the cache at the session
level and not at the repository proxy level ?
And beside that, is there a way to invalidate the cache of a session
(apart from closing and reopening a session) ?
Thanks for your help
John
2010/5/4 John Tranier <jo...@fylab.com>:
> Hi Angela,
> I guess it's a better option to upgrade to 2.1 for accessing the repository
> in WebDav.
> I will try that.
> Thank you for your answers.
> John
>
> 2010/5/4 Angela Schreiber <an...@day.com>
>>
>> hi john
>>
>>> Concerning the problem 2 (move), here is an example :
>>>
>>> jcrSession.move(
>>> fichierNode.path,
>>> fichierNode.parent.path + '/' + 'newName')
>>>
>>> fichierNode.setProperty( JcrConstants.ELIOT_DATE_MODIFICATION,
>>> Calendar.getInstance() )
>>>
>>> jcrSession.save() => throws javax.jcr.PathNotFoundException: <old path>
>>>
>>> The problem is solved when I update the property before the move.
>>
>> depending on the nature of your "fichierNode" this
>> could be the same as JCR-2472, which has been fixed for 2.1
>>
>>> For the problem 1, I give you a short description followed by my concrete
>>> code.
>>> I have 2 mixin types, let's say A and B, with B that inherits A.
>>> When I add the type A, and then the type B I get an exception
>>> javax.jcr.nodetype.ConstraintViolationException:
>>> no matching property definition found for ...
>>> It works when I save the session after adding the type A.
>>
>>> *jcrSession.save() => Without that save it works with the Repository
>>> from core, but not with a webdav connection*
>>
>> not sure, but the reason for this might be that in jcr2spi mixin types
>> are only effective on a given node *after* save() [1].
>> in this part jcr2spi works different than jackrabbit-core since
>> jcr2spi doesn't not have the ability to create autocreated items
>> such as e.g. defined by mix:referenceable and mix:versionable and
>> may not be able to detect conflicts arising from adding the mixin
>> type. this is therefore delegated to the SPI implementation.
>>
>> regards
>> angela
>>
>> [1] see section "10.10 Node Type Assignment" of the specification
>> and the following quote from the javadoc of Node#addMixin:
>> "Semantically, the new node type may take effect immediately,
>> on dispatch or on persist."
>>
>>
>>
>
>
Re: Jackrabbit 1.6 and DavEx ?
Posted by Angela Schreiber <an...@day.com>.
hi john
> I just discovered something that looks like a strange behaviour to me
> and I would like to check whether it is expected or not.
> With jcr2spi the cache seems to be handled per session.
>
> Here is a sequence to illustrate it :
> 1. Create jcrSession1
> 2. Create jcrSession2
> 3. Add a node n with jcrSession1
and save(), right?
> 4. ItemExists(n) with jcrSession2 returns false
> 5. Add a node n with jcrSession2 ==> Exception ItemExists
>
> If I swap point 2. and 3. (i.e. I create jcrSession2 after adding the
> node n with jcrSession1) everything works fine.
>
> Is there a reason I don't know to handle the cache at the session
> level and not at the repository proxy level ?
we made some optimizations regarding the caching behavior in the
past (i don't recall for which version exactly though) in order
to minimize the number of round trips to the SPI layer, which
possibly includes expensive network roundtrips. one that might be
related to the problem described is a flag with childnodeentries that
defines if the list is complete at the point of being populated
-> refresh is required in order to force a reload of the list.
> And beside that, is there a way to invalidate the cache of a session
> (apart from closing and reopening a session) ?
Session.refresh() and Item.refresh() should do the trick. it's
the JCR way to force reloading of the status visible to a particular
session.
one more thing was the CacheBehavior configuration flag:
with jcr2spi running in CacheBehavior.OBSERVATION mode the
refresh call is a nop as in this configuration all changes from
the SPI should be automatically update the existing clients (jcr2spi
Sessions)... i didn't try this one for a while, though.
with jcr2spi running in CacheBehavior.INVALIDATION (default)
you may need an explicit/manual refresh call to get the latest
state of the persistent layer (SPI implementation).
hope that helps
angela