Examples of FSLock


Examples of org.tmatesoft.svn.core.internal.io.fs.FSLock

    public DAVLock refreshLock(DAVResource resource, String lockToken, Date newTime) throws DAVException {
        //TODO: add here authz check
        FSFS fsfs = resource.getFSFS();
        String path = resource.getResourceURI().getPath();

        FSLock svnLock = null;
        try {
            svnLock = (FSLock) fsfs.getLockHelper(path, false);
        } catch (SVNException e) {
            throw DAVException.convertError(e.getErrorMessage(), HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Token doesn't point to a lock.", null);
        }
       
        if (svnLock == null || !svnLock.getID().equals(lockToken)) {
            throw new DAVException("Lock refresh request doesn't match existing lock.", HttpServletResponse.SC_UNAUTHORIZED, DAVErrorCode.LOCK_SAVE_LOCK);
        }
       
        try {
            svnLock = (FSLock) fsfs.lockPath(svnLock.getPath(), svnLock.getID(), resource.getUserName(), svnLock.getComment(), newTime,
                    SVNRepository.INVALID_REVISION, true, svnLock.isDAVComment());
        } catch (SVNException e) {
            SVNErrorMessage err = e.getErrorMessage();
            if (err.getErrorCode() == SVNErrorCode.FS_NO_USER) {
                throw new DAVException("Anonymous lock refreshing is not allowed.", HttpServletResponse.SC_UNAUTHORIZED, DAVErrorCode.LOCK_SAVE_LOCK);
            }
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.io.fs.FSLock

                throw DAVException.convertError(svne.getErrorMessage(), HttpServletResponse.SC_CONFLICT, "Conflict when committing ''{0}''.",
                        new Object[] { conflictPath.toString() });
            }
        }
       
        FSLock svnLock = convertDAVLockToSVNLock(lock, path, resource.isSVNClient(), ServletDAVHandler.getSAXParserFactory());
        try {
            fsfs.lockPath(path, svnLock.getID(), svnLock.getOwner(), svnLock.getComment(), svnLock.getExpirationDate(), myWorkingRevision,
                    myIsStealLock, svnLock.isDAVComment());
        } catch (SVNException svne) {
            if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.FS_NO_USER) {
                throw new DAVException("Anonymous lock creation is not allowed.", HttpServletResponse.SC_UNAUTHORIZED,
                        DAVErrorCode.LOCK_SAVE_LOCK);
            }
            throw DAVException.convertError(svne.getErrorMessage(), HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to create new lock.",
                    null);
        }
       
        myOwner.setResponseHeader(HTTPHeader.CREATION_DATE_HEADER, SVNDate.formatDate(svnLock.getCreationDate()));
        myOwner.setResponseHeader(HTTPHeader.LOCK_OWNER_HEADER, svnLock.getOwner());
        //TODO: add logging here later
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.io.fs.FSLock

        }
       
        //TODO: add authz check here later

        DAVLock davLock = null;
        FSLock lock = null;
        try {
            lock = (FSLock) resource.getLock();
        } catch (SVNException svne) {
            throw DAVException.convertError(svne.getErrorMessage(), HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                    "Failed to check path for a lock.", null);
        }
       
        if (lock != null) {
            davLock = convertSVNLockToDAVLock(lock, myIsBreakLock, resource.exists());
            myOwner.setResponseHeader(HTTPHeader.CREATION_DATE_HEADER, SVNDate.formatDate(lock.getCreationDate()));
            myOwner.setResponseHeader(HTTPHeader.LOCK_OWNER_HEADER, lock.getOwner());
        }
        return davLock;
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.io.fs.FSLock

   
    public DAVLock findLock(DAVResource resource, String lockToken) throws DAVException {
        //TODO: add here authz check later
       
        DAVLock davLock = null;
        FSLock lock = null;
        try {
            lock = (FSLock) resource.getLock();
        } catch (SVNException svne) {
            throw DAVException.convertError(svne.getErrorMessage(), HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                    "Failed to look up lock by path.", null);
        }
       
        if (lock != null) {
            if (!lockToken.equals(lock.getID())) {
                throw new DAVException("Incoming token doesn't match existing lock.", HttpServletResponse.SC_BAD_REQUEST,
                        DAVErrorCode.LOCK_SAVE_LOCK);
            }
            davLock = convertSVNLockToDAVLock(lock, false, resource.exists());
            myOwner.setResponseHeader(HTTPHeader.CREATION_DATE_HEADER, SVNDate.formatDate(lock.getCreationDate()));
            myOwner.setResponseHeader(HTTPHeader.LOCK_OWNER_HEADER, lock.getOwner());
        }
        return davLock;
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.io.fs.FSLock

                isDAVComment = true;
                comment = davLock.getOwner();
            }
        }
       
        return new FSLock(path, davLock.getLockToken(), davLock.getAuthUser(), comment, new Date(System.currentTimeMillis()),
                davLock.getTimeOutDate(), isDAVComment);
    }
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.