Bug 34047

Summary: A request of the LockDiscoveryProperty on a locked resource returns no owner
Product: Slide Reporter: Paul Manofsky <paul_manofsky>
Component: StoresAssignee: Slide Developer List <slide-dev>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: Nightly   
Target Milestone: ---   
Hardware: Other   
OS: HP-UX   

Description Paul Manofsky 2005-03-17 03:07:09 UTC
Found in:  WCK 2.2pre1

I don't know if the problem I am experiencing is a bug, or by design.   I am 
using Eclipse as a client and have created a custom store to 
retreive/lock/edit resources in a database.   I can lock and retreive the 
resources without any problem.  Although, when I try to retreive a resource 
that has been locked, I want to display a message stating that the resource is 
locked and show the owner of the lock.   I can retreive the 
LockDiscoveryProperty object, but the owner is missing.  Here is
what I have found within the WCK source.  

The WebdavStoreAdapter class (specifically the inner class 
TransactionId.enumerateLocks(WebdavStoreAdapter.java:892) calls my custom 
store to get the lock on the specified resource.  The 
WebdavStoreLockExtension.Lock[] that is returned from my store
is used to create a NodeLock. 

for (int i = 0; i < ids.length; i++) {
     WebdavStoreLockExtension.Lock lockId = ids[i];
     NodeLock lock = new NodeLock(lockId.getId(), uri.toString(),              
lockId.getSubject(), "/actions/write", lockId.getExpirationDate(), 
lockId.isInheritable(), lockId.isExclusive());

     locks.add(lock);
}

The LockDiscoveryProperty obj will then use this NodeLock obj to display the 
owner.

I would assume that the owner would be the 'subject' from the 
WebdavStoreLockExtension.Lock.  However, it turns out that the owner from the 
LockDiscoveryProperty obj is populated from the 'ownerInfo' field of
the NodeLock. From the developer comments in the NodeLock class I found the 
following definitions:

subject -is defined as the user who is the lock owner.
ownerInfo - is defined as contacting information about the lock owner.

I verified this by doing a setOwnerInfo( name ) on the NodeLock just after it 
was created.   After doing that, the owner then showed up in the 
LockDiscoveryProperty obj.   

From the developer comments, I would assume that the 'subject' should be used 
as the owner, not the ownerInfo.  My apologies if I am incorrect.   

The constructor used to create the NodeLock sets the ownerInfo field to null 
which propogates to the null owner in the LockDiscoveryProperty .  I am not 
sure if the constructor needs to be changed to set the ownerInfo, or if the 
LockDiscoveryProperty is referencing the ownerInfo field and it should really 
be using the 'subject' field.