コード例 #1
0
 /**
  * Return a lock info base on the VFS lock
  *
  * @param resource
  * @return
  */
 public LockInfo getVFSLock(WebResource resource) {
   VFSItem item = extractItem(resource);
   MetaInfoFileImpl info = getMetaInfo(item);
   if (info != null && info.isLocked()) {
     File file = extractFile(item);
     LockInfo lock = null;
     if (fileLocks.containsKey(file)) {
       lock = fileLocks.get(file);
       if (lock != null) {
         lock.setVfsLock(true);
       }
     }
     if (lock == null) {
       lock = new LockInfo(info.getLockedBy(), false, true);
       lock.setWebResource(resource);
       lock.setCreationDate(info.getLockedDate());
       lock.setOwner(Settings.getServerContextPathURI() + "/Identity/" + info.getLockedBy());
       lock.setDepth(1);
       lock.addToken(generateLockToken(lock, info.getLockedBy()));
       fileLocks.put(file, lock);
     }
     return lock;
   }
   return null;
 }
コード例 #2
0
  @Override
  public LockInfo getLock(VFSItem item) {
    File file = extractFile(item);
    if (file != null && fileLocks.containsKey(file)) {
      LockInfo lock = fileLocks.get(file);
      if (lock != null) {
        return lock;
      }
    }

    MetaInfoFileImpl info = getMetaInfo(item);
    if (info != null && info.isLocked()) {
      LockInfo lock = new LockInfo(info.getLockedBy(), false, true);
      lock.setCreationDate(info.getLockedDate());
      lock.setOwner(Settings.getServerContextPathURI() + "/Identity/" + info.getLockedBy());
      lock.setDepth(1);
      lock.addToken(generateLockToken(lock, info.getLockedBy()));
      fileLocks.put(file, lock);
      return lock;
    }
    return null;
  }