On a side note, if you are willing to have a dependency on some kind of
AOP framework (like AspectJ) you can set the Repository before you are
calling the methods that need it.
Hth,
Nick Stolwijk
(Berry) A.W. van Halderen wrote:
On Tue, Oct 23, 2007 at 11:47:27AM -0700, bilobag wrote:
So I am attempting to create a SessionImpl with a system subject so that it
can have full access to the repository. I want to use this SessionImpl in
my custom AccessManager to query properties of the nodes(ie. node type) to
determine whether a user should have access to a particular node. I am
using spring with jackrabbit and I'm not sure what the best way is to get a
ref to a RepositoryImpl. Can someone please give some advise. i have been
working on this for a week straight now. Thanks in advance.
Check out our AccessManager, source available in public available SVN:
http://svn.hippocms.org/repos/hippo/hippo-ecm/branches/Release-HREPTWO-v2_01_00-M1/repository/engine/src/main/java/org/hippoecm/repository/security/SimpleAccessManager.java
The trick is that you have to extend a number of JackRabbit classes,
such that you are using your own, extended, RepositoryImpl, SessionImpl,
etcetera, in order to create a own (extended) version of a HierarchyManager.
This HierarchyManager can then expose, the otherwise protected method
which allows you to get the actual ItemState.
HOWEVER: be very aware that there may be severe implications with this
approach. I think (but maybe a jackrabbit architect can comment) that
it is not by change that you have only access to ItemId in the access
manager, and not to ItemState as well. This because an access manager
might be required to quickly filter out non accessible items (nodes or
properties) before returning. If it would need to constantly access
the actual state, it might have fatal performance consequences.
We don't have experience with this yet, but it is on our mid-term to-do list.
So if you gain further experience, let us (all) know.
\Berry