Package org.tmatesoft.svn.core

Examples of org.tmatesoft.svn.core.SVNLock


                throw e;
            }
            boolean done = false;
            for (Iterator paths = pathsToRevisions.keySet().iterator(); paths.hasNext();) {
                String path = (String) paths.next();
                SVNLock lock = null;
                SVNErrorMessage error = null;
                SVNItem item = readItem(false);
                if (item.getKind() == SVNItem.WORD && "done".equals(item.getWord())) {
                    done = true;
                    break;
                }
                if (item.getKind() != SVNItem.LIST) {
                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_MALFORMED_DATA, "Lock response not a list");
                    SVNErrorManager.error(err, SVNLogType.NETWORK);
                }
                try {
                    List values = SVNReader.parseTuple("wl", item.getItems(), null);
                    String status = SVNReader.getString(values, 0);
                    List items = (List) values.get(1);
                    if ("success".equals(status)) {
                        lock = SVNReader.getLock(items);
                        path = lock.getPath();
                    } else if ("failure".equals(status)) {
                        SVNReader.handleFailureStatus(items);
                    } else {
                        SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_MALFORMED_DATA);
                        SVNErrorManager.error(err, SVNLogType.NETWORK);
View Full Code Here


                if (error == null) {
                    throw e;
                }
            }
            if (handler != null) {
                SVNLock lock = items == null ? null : SVNReader.getLock(items);
                handler.handleLock(path, lock, error);
            }
        }
    }
View Full Code Here

                } catch (SVNException e) {
                    error = e.getErrorMessage();
                }
                path = getRepositoryPath(path);
                if (handler != null) {
                    handler.handleUnlock(path, new SVNLock(path, id, null, null, null, null), error);
                }
            }
            if (!done) {
                SVNItem item = readItem(false);
                if (item.getKind() != SVNItem.WORD || !"done".equals(item.getWord())) {
View Full Code Here

                Object[] buffer = new Object[]{"get-lock", path};
                write("(w(s))", buffer);
                authenticate();
                List items = read("l", null, false);
                items = (List) items.get(0);
                SVNLock lock = SVNReader.getLock(items);
                if (lock == null) {
                    lock = new SVNLock(path, "", null, null, null, null);
                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_NOT_LOCKED, "No lock on path ''{0}''", path);
                    if (handler != null) {
                        handler.handleUnlock(path, lock, err);
                    }
                    continue;
                }
                id = lock.getID();
            }
            Object[] buffer = new Object[]{"unlock", path, id, Boolean.valueOf(force)};
            write("(w(s(s)w))", buffer);
            authenticate();
            SVNErrorMessage error = null;
            try {
                read("", null, false);
            } catch (SVNException e) {
                if (e.getErrorMessage() != null && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_LOCKED) {
                    error = e.getErrorMessage();
                    error = SVNErrorMessage.create(error.getErrorCode(), error.getMessageTemplate(), path);
                } else {
                    throw e;
                }
            }
            if (handler != null) {
                SVNLock lock = new SVNLock(path, id, null, null, null, null);
                handler.handleUnlock(path, lock, error);
            }
        }
    }
View Full Code Here

        Date creationDate = getDate(values, 4);
        Date expirationDate = null;
        if (values.size() >= 6 && values.get(5) != null) {
            expirationDate = getDate(values, 5);
        }
        return new SVNLock(path, token, owner, comment, creationDate, expirationDate);
    }
View Full Code Here

        Date created = creationDate != null ? SVNTimeUtil.parseDate(creationDate)
                : null;
        Date expires = expirationDate != null ? SVNTimeUtil
                .parseDate(expirationDate) : null;

        return new SVNLock(path, id, owner, comment, created, expires);
    }
View Full Code Here

        Date createdDate = created != null ? SVNTimeUtil.parseDate(created) : null;
        path = SVNEncodingUtil.uriDecode(info.baselinePath);
        if (!path.startsWith("/")) {
            path = "/" + path;
        }
        return new SVNLock(path, id, owner, comment, createdDate, null);
    }
View Full Code Here

            if (userName == null || created == null) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_DAV_MALFORMED_DATA, "Incomplete lock data returned");
                SVNErrorManager.error(err);
            }
            Date createdDate = created != null ? SVNTimeUtil.parseDate(created) : null;           
            return new SVNLock(info.baselinePath, handler.getID(), userName, comment, createdDate, null);
        }
        return null;
    }
View Full Code Here

        return null;
    }

    public void doUnlock(String path, DAVRepository repos, String id, boolean force) throws SVNException {
        if (id == null) {
            SVNLock lock = doGetLock(path, repos);
            if (lock != null) {
                id = lock.getID();
            }
            if (id == null) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_NOT_LOCKED, "''{0}'' is not locked in the repository", path);
                SVNErrorManager.error(err);
            }
View Full Code Here

       
        revNodeFile.write("\n".getBytes("UTF-8"));
    }
   
    public SVNLock getLock(String repositoryPath, boolean haveWriteLock) throws SVNException {
        SVNLock lock = fetchLockFromDigestFile(null, repositoryPath, null);
       
        if (lock == null) {
            SVNErrorManager.error(FSErrors.errorNoSuchLock(repositoryPath, this));
        }
       
        Date current = new Date(System.currentTimeMillis());

        if (lock.getExpirationDate() != null && current.compareTo(lock.getExpirationDate()) > 0) {
            if (haveWriteLock) {
                deleteLock(lock);
            }
            SVNErrorManager.error(FSErrors.errorLockExpired(lock.getID(), this));
        }
        return lock;
    }
View Full Code Here

TOP

Related Classes of org.tmatesoft.svn.core.SVNLock

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.