Examples of ActiveLock


Examples of org.apache.jackrabbit.webdav.lock.ActiveLock

            throws DavException {
        if (!lockInfo.isDeep() || !TransactionConstants.TRANSACTION.equals(lockInfo.getType())) {
            throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
        }

        ActiveLock existing = getLock(lockInfo.getType(), lockInfo.getScope(), resource);
        if (existing != null) {
            throw new DavException(DavServletResponse.SC_LOCKED);
        }
        // TODO: check for locks on member resources is required as well for lock is always deep!
View Full Code Here

Examples of org.apache.jackrabbit.webdav.lock.ActiveLock

     * @return lock applied to the given resource or <code>null</code>
     * @see LockManager#getLock(Type, Scope, DavResource)
     *      todo: is it correct to return one that specific lock, the current session is token-holder of?
     */
    public ActiveLock getLock(Type type, Scope scope, TransactionResource resource) {
        ActiveLock lock = null;
        if (TransactionConstants.TRANSACTION.equals(type)) {
            String[] sessionTokens = resource.getSession().getLockTokens();
            int i = 0;
            while (lock == null && i < sessionTokens.length) {
                String lockToken = sessionTokens[i];
View Full Code Here

Examples of org.apache.jackrabbit.webdav.lock.ActiveLock

        if (!(resource instanceof TransactionResource)) {
            log.info("");
            return null;
        }

        ActiveLock lock = null;
        Transaction tx = null;
        TransactionMap m = map;
        // check if main-map contains that txId
        if (m.containsKey(lockToken)) {
            tx = m.get(lockToken);
View Full Code Here

Examples of org.apache.jackrabbit.webdav.lock.ActiveLock

    }

    private LockInfo retrieveLockInfo(LockDiscovery lockDiscovery, SessionInfo sessionInfo,
                                      NodeId nodeId, NodeId parentId) throws RepositoryException {
        List<ActiveLock> activeLocks = lockDiscovery.getValue();
        ActiveLock activeLock = null;
        for (ActiveLock l : activeLocks) {
            Scope sc = l.getScope();
            if (l.getType() == Type.WRITE && (sc == Scope.EXCLUSIVE || sc == ItemResourceConstants.EXCLUSIVE_SESSION)) {
                if (activeLock != null) {
                    throw new RepositoryException("Node " + saveGetIdString(nodeId, sessionInfo) + " contains multiple exclusive write locks.");
                } else {
                    activeLock = l;
                }
            }
        }
        if (activeLock == null) {
            log.debug("No lock present on node " + saveGetIdString(nodeId, sessionInfo));
            return null;
        }
        if (activeLock.isDeep() && parentId != null) {
            // try if lock is inherited
            LockInfo pLockInfo = getLockInfo(sessionInfo, parentId);
            if (pLockInfo != null) {
                return pLockInfo;
            }
View Full Code Here

Examples of org.apache.jackrabbit.webdav.lock.ActiveLock

    }

    private LockInfo retrieveLockInfo(LockDiscovery lockDiscovery, SessionInfo sessionInfo,
                                      NodeId nodeId, NodeId parentId) throws RepositoryException {
        List<ActiveLock> activeLocks = lockDiscovery.getValue();
        ActiveLock activeLock = null;
        for (ActiveLock l : activeLocks) {
            Scope sc = l.getScope();
            if (l.getType() == Type.WRITE && (Scope.EXCLUSIVE.equals(sc) || sc == ItemResourceConstants.EXCLUSIVE_SESSION)) {
                if (activeLock != null) {
                    throw new RepositoryException("Node " + saveGetIdString(nodeId, sessionInfo) + " contains multiple exclusive write locks.");
                } else {
                    activeLock = l;
                }
            }
        }
        if (activeLock == null) {
            log.debug("No lock present on node " + saveGetIdString(nodeId, sessionInfo));
            return null;
        }
        if (activeLock.isDeep() && parentId != null) {
            // try if lock is inherited
            LockInfo pLockInfo = getLockInfo(sessionInfo, parentId);
            if (pLockInfo != null) {
                return pLockInfo;
            }
View Full Code Here

Examples of org.apache.jackrabbit.webdav.lock.ActiveLock

     * that is not owned by the given session.
     *
     * @return true if this resource cannot be modified due to a write lock
     */
    private boolean isLocked(DavResource res) {
        ActiveLock lock = res.getLock(Type.WRITE, Scope.EXCLUSIVE);
        if (lock == null) {
            return false;
        } else {
            for (String sLockToken : session.getLockTokens()) {
                if (sLockToken.equals(lock.getToken())) {
                    return false;
                }
            }
            return true;
        }
View Full Code Here

Examples of org.apache.jackrabbit.webdav.lock.ActiveLock

    /**
     * @see DavResource#getLock(Type, Scope)
     */
    public ActiveLock getLock(Type type, Scope scope) {
        ActiveLock lock = null;
        if (TransactionConstants.TRANSACTION.equals(type)) {
            lock = txMgr.getLock(type, scope, this);
        }
        return lock;
    }
View Full Code Here

Examples of org.apache.jackrabbit.webdav.lock.ActiveLock

     * todo improve....
     */
    public ActiveLock[] getLocks() {
        List<ActiveLock> locks = new ArrayList<ActiveLock>();
        // tx locks
        ActiveLock l = getLock(TransactionConstants.TRANSACTION, TransactionConstants.LOCAL);
        if (l != null) {
            locks.add(l);
        }
        l = getLock(TransactionConstants.TRANSACTION, TransactionConstants.GLOBAL);
        if (l != null) {
View Full Code Here

Examples of org.apache.jackrabbit.webdav.lock.ActiveLock

            getJcrSession().save();

            // make sure, non-jcr locks are removed, once the removal is completed
            try {
                if (!isJsrLockable()) {
                    ActiveLock lock = getLock(Type.WRITE, Scope.EXCLUSIVE);
                    if (lock != null) {
                        lockManager.releaseLock(lock.getToken(), member);
                    }
                }
            } catch (DavException e) {
                // since check for 'locked' exception has been performed before
                // ignore any error here
View Full Code Here

Examples of org.apache.jackrabbit.webdav.lock.ActiveLock

    /**
     * @see DavResource#getLock(Type, Scope)
     */
    public ActiveLock getLock(Type type, Scope scope) {
        ActiveLock lock = null;
        if (exists() && Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope)) {
            // try to retrieve the repository lock information first
            try {
                if (node.isLocked()) {
                    Lock jcrLock = node.getLock();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.