Package com.bradmcevoy.http

Examples of com.bradmcevoy.http.LockToken


    }

    private LockToken currentLock( FsResource resource ) {
        CurrentLock curLock = locksByFile.get( resource.getFile() );
        if( curLock == null ) return null;
        LockToken token = curLock.token;
        if( token.isExpired() ) {
            removeLock( token );
            return null;
        } else {
            return token;
        }
View Full Code Here


    public LockToken getCurrentToken( LockableResource r ) {
        FsResource resource = (FsResource) r;
        CurrentLock lock = locksByFile.get( resource.getFile() );
        if( lock == null ) return null;
        LockToken token = new LockToken();
        token.info = new LockInfo( LockInfo.LockScope.EXCLUSIVE, LockInfo.LockType.WRITE, lock.lockedByUser, LockInfo.LockDepth.ZERO );
        token.info.lockedByUser = lock.lockedByUser;
        token.timeout = lock.token.timeout;
        token.tokenId = lock.token.tokenId;
        return token;
View Full Code Here

        LockResult res = lockManager.lock( timeout, lockInfo, resource );
        assertNotNull( res );
        assertTrue( res.isSuccessful() );

        // check is locked
        LockToken token = lockManager.getCurrentToken( resource );
        assertNotNull( token );
        assertEquals( token.tokenId, res.getLockToken().tokenId );

        // unlock
        lockManager.unlock( token.tokenId, resource );
View Full Code Here

        LockResult lr = null;
        try {
            org.exist.dom.LockToken existLT = existDocument.lock(inputToken);

            // Process result
            LockToken mltonLT = convertToken(existLT);
            lr = LockResult.success(mltonLT);

        } catch (PermissionDeniedException ex) {
            LOG.debug(ex.getMessage());
            throw new NotAuthorizedException(this);
View Full Code Here

        LockResult lr = null;
        try {
            org.exist.dom.LockToken existLT = existDocument.refreshLock(token);

            // Process result
            LockToken mltonLT = convertToken(existLT);
            lr = LockResult.success(mltonLT);

        } catch (PermissionDeniedException ex) {
            LOG.debug(ex.getMessage());
            throw new NotAuthorizedException(this);
View Full Code Here

            LOG.debug("No database lock token.");
            return null;
        }

        // Construct Lock Info
        LockToken miltonLT = convertToken(existLT);

        // Return values in Milton object
        return miltonLT;
    }
View Full Code Here

        // Token Id
        String id = existLT.getOpaqueLockToken();

        // Return values in Milton object
        return new LockToken(id, li, lt);

    }
View Full Code Here

            LOG.debug(String.format("'%s' name='%s'", resourceXmldbUri, name));
        }

        String token = UUID.randomUUID().toString();

        return new LockToken(token, lockInfo, timeout);
    }
View Full Code Here

        }

        LockInfo lockInfo = new LockInfo(LockInfo.LockScope.NONE, LockInfo.LockType.READ, token, LockInfo.LockDepth.ZERO);
        LockTimeout lockTime = new LockTimeout(Long.MAX_VALUE);

        LockToken lockToken = new LockToken(token, lockInfo, lockTime);

        return new LockResult(LockResult.FailureReason.PRECONDITION_FAILED, lockToken);
    }
View Full Code Here

  }

  public LockResult lock(LockTimeout timeout, LockInfo lockInfo)
      throws NotAuthorizedException, PreConditionFailedException,
      LockedException {
    return new LockResult(null, new LockToken(new ObjectId().toString(),
        lockInfo, timeout));
  }
View Full Code Here

TOP

Related Classes of com.bradmcevoy.http.LockToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.