You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Roland Kofler <ro...@systemone.at> on 2006/12/14 16:45:09 UTC
AccessManager + CachingHierarchyManager problem
Hi all,
we have a problem in our application using jackrabbit and I'm not sure
whether this is due to a design flaw or a misunderstanding of the
jackrabbit api.
so here's the problem:
----------------------
we use our own implementation of a AccessManager, so what we do is, we
let our own S1AccessManagerImpl extend the SimpleAccessManager and
implement our own interface (S1AccessManager).
The problem we have is the implementation of the CachingHierarchyManager,
to which the SimpleAccessManager holds a reference.
Let's consider following example:
i add 3 subnodes (a,b,c) to a node and after that i reorder b and c ..
so i have a,c,b. in the process of reordering (using the function
orderBefore of javax.jcr.Node) our AccessManager is called several times
to check the permissions of the nodes. In this AccessManager we use some
functions of the CachingHierarchyManager, f.ex.
Path itemPath = hierMgr.getPath(id);
return itemPath.denotesRoot();
or
Path itemPath = hierMgr.getPath(itemId);
Path parentPath = itemPath.getAncestor(1);
return hierMgr.resolvePath(parentPath);
the problem is, that when calling the methods of the
CachingHierarchyManager the nodes i ask for will be cached in the
idCache in a wrong state (i. e.: before actually reordering the elements).
so if i want f.ex. delete the node b after reordering, the node will
be looked up in the idCache. in the cache the index of node b is still 2
(actually it should be 3) and so the wrong node will be deleted!
so, any ideas how to solve this problem? can the methods of the
CachingHierarchyManager be replaced by some non-persisting method calls
(maybe PathBuilder??).
thx, Roland
Re: AccessManager + CachingHierarchyManager problem
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On 12/18/06, bitkid <sa...@systemone.at> wrote:
> i attached a test which will fail if you use the HierarchyManager in the
> CachingBugAccessManager but it will work if you don't use methods of the
> HierarchyManager. just change the flag USE_HIERARCHY_MANAGER to false.
The attachment didn't make it to the mailing list. Please send the
test inline or file a Jira issue and attach it there.
BR,
Jukka Zitting
Re: AccessManager + CachingHierarchyManager problem
Posted by bitkid <sa...@systemone.at>.
i attached a test which will fail if you use the HierarchyManager in the
CachingBugAccessManager but it will work if you don't use methods of the
HierarchyManager. just change the flag USE_HIERARCHY_MANAGER to false.
kind regards, sascha
--
View this message in context: http://www.nabble.com/AccessManager-%2B-CachingHierarchyManager-problem-tf2821371.html#a7928803
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.
Re: AccessManager + CachingHierarchyManager problem
Posted by Dominique Pfister <do...@day.com>.
Hi Roland
> > the problem is, that when calling the methods of the
> > CachingHierarchyManager the nodes i ask for will be cached in the
> > idCache in a wrong state (i. e.: before actually reordering the elements).
> > so if i want f.ex. delete the node b after reordering, the node will
> > be looked up in the idCache. in the cache the index of node b is still 2
> > (actually it should be 3) and so the wrong node will be deleted!
>
> I'm not too familiar with the HierarchyManager and the PathMap
> constructs, but I assume that the problem might be related to
> orderBefore only modifying the state of the parent node. It could be
> that the cache entries for the affected child nodes are not updated.
The effect of reordering nodes should immediately be reflected in the
CachingHierarchyManager and there are also unit tests verifying this.
Can you provide us a simple, isolated test program that exhibits this
erroneous behaviour?
Kind regards
Dominique
Re: AccessManager + CachingHierarchyManager problem
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On 12/14/06, Roland Kofler <ro...@systemone.at> wrote:
> we have a problem in our application using jackrabbit and I'm not sure
> whether this is due to a design flaw or a misunderstanding of the
> jackrabbit api.
Looks like a problem in Jackrabbit.
> the problem is, that when calling the methods of the
> CachingHierarchyManager the nodes i ask for will be cached in the
> idCache in a wrong state (i. e.: before actually reordering the elements).
> so if i want f.ex. delete the node b after reordering, the node will
> be looked up in the idCache. in the cache the index of node b is still 2
> (actually it should be 3) and so the wrong node will be deleted!
I'm not too familiar with the HierarchyManager and the PathMap
constructs, but I assume that the problem might be related to
orderBefore only modifying the state of the parent node. It could be
that the cache entries for the affected child nodes are not updated.
BR,
Jukka Zitting