You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by tr...@sachsendv.de on 2008/11/25 18:13:45 UTC

Re: unlock file

Hi,

I'm still locking for a way to unlock previously locked files.
I want to implement a lock-superuser.
How can I do that?

I allready have written a LoginModule to authenticate my users.
Do I now have to implement a new AccessManager?

Thanks in advance
Tobias


> 22.10.2008 11:49
> 
> Please respond to users
> 
> Hi there,
> 
> I played around with Novell Netdrive to connect my repository through 
> webdav.
> In Netdrive is an option to lock files, but unlocking gives me an error.
> "Can't unlock file, error=File is not currently locked"
> 
> The file is definitely locked and I don't find a way to unlock.
> Trying to unlock the file through the Jackrabbit API, gives me an 
> "javax.jcr.lock.LockException: Node not locked by session:" error.
> 
> How can I unlock this file?
> Is there a way to define a lock-superuser (JCR 1.0 Spec 8.4.5)?
> 
> Here are some test values:
> 
> Node lockedNode = rootNode.getNode("data/image.jpg");
> System.out.println("[LOCKEDNODES] " + session.getLockTokens().length);
> System.out.println("[LOCKED] " + lockedNode.isLocked());
> System.out.println("[LOCKHOLDER] " + lockedNode.holdsLock());
> System.out.println("[SESSIONSCOPED] " + 
> lockedNode.getLock().isSessionScoped());
> System.out.println("[LIVE] " + lockedNode.getLock().isLive());
> System.out.println("[DEEP] " + lockedNode.getLock().isDeep());
> System.out.println("[TOKEN] " + lockedNode.getLock().getLockToken());
> lockedNode.unlock();
> 
> 
> [LOCKEDNODES] 0
> [LOCKED] true
> [LOCKHOLDER] true
> [SESSIONSCOPED] false
> [LIVE] true
> [DEEP] true
> [TOKEN] null
> javax.jcr.lock.LockException: Node not locked by session: 
/data/image.jpg



_________________________________________________________________

Sachsen DV Betriebs- und Servicegesellschaft mbH
Täubchenweg 26
04317 Leipzig
Amtsgericht Leipzig, HRB 18545

Geschäftsführer: Herbert Roller Brandão, Dr. Jean-Michael Pfitzner

Aufsichtsratsvorsitzender: Andreas Benninger

Re: unlock file

Posted by Angela Schreiber <an...@day.com>.
hi tobias

> I'm still locking for a way to unlock previously locked files.
> I want to implement a lock-superuser.
> How can I do that?

as far as i know you need to have your own LockManager
that checks if the Session that tries to unlock the
node is your lock-superuser and then act accordingly
i.e. allow to unlock even if the session isn't the
lock owner.

and: as far as i know, there is not smooth way to
replace the lock manager impl (by config etc...)

see
-> RepositoryImpl#WorkspaceInfo#getLockManager()

> I allready have written a LoginModule to authenticate my users.
> Do I now have to implement a new AccessManager?

no. in the first place it isn't a question of missing
permission but rather a question of being the lock
owner/holder... that's govered by the LockManager impl
(see above).

regards
angela