Beispiel #1
0
  private void acquireLock() {
    if (lockInfo.isLocked()) {
      handleLockFailure(lockInfo);
    } else if (!lockRequestPending) {
      lockRequestPending = true;
      final ParameterizedCommand<LockResult> command =
          new ParameterizedCommand<LockResult>() {

            @Override
            public void execute(final LockResult result) {
              if (result.isSuccess()) {
                updateLockInfo(result.getLockInfo());
                releaseLockOnClose();
              } else {
                handleLockFailure(result.getLockInfo());
              }
              lockRequestPending = false;
            }
          };
      lockService.acquireLock(lockTarget.getPath(), command);
    }
  }
Beispiel #2
0
 private void fireUpdatedLockStatusEvent() {
   if (isVisible()) {
     updatedLockStatusEvent.fire(
         new UpdatedLockStatusEvent(lockInfo.isLocked(), isLockedByCurrentUser()));
   }
 }
Beispiel #3
0
 private boolean isLocked() {
   return lockInfo.isLocked();
 }
Beispiel #4
0
 private boolean isLockedByCurrentUser() {
   return lockInfo.isLocked() && lockInfo.lockedBy().equals(user.getIdentifier());
 }