Examples of LockedObject


Examples of org.modeshape.webdav.locking.LockedObject

                    resp.setStatus(WebdavStatus.SC_CREATED);
                    return;
                }
                // object already exists
                if (so.isNullResource()) {
                    LockedObject nullResourceLo = resourceLocks.getLockedObjectByPath(transaction, path);
                    if (nullResourceLo == null) {
                        resp.sendError(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
                        return;
                    }
                    String nullResourceLockToken = nullResourceLo.getID();
                    String[] lockTokens = getLockIdFromIfHeader(req);
                    String lockToken = null;
                    if (lockTokens != null) {
                        lockToken = lockTokens[0];
                    } else {
                        resp.sendError(WebdavStatus.SC_BAD_REQUEST);
                        return;
                    }
                    if (lockToken.equals(nullResourceLockToken)) {
                        so.setNullResource(false);
                        so.setFolder(true);

                        String[] nullResourceLockOwners = nullResourceLo.getOwner();
                        String owner = null;
                        if (nullResourceLockOwners != null) {
                            owner = nullResourceLockOwners[0];
                        }
View Full Code Here

Examples of org.modeshape.webdav.locking.LockedObject

            String tempLockOwner = "doUnlock" + System.currentTimeMillis() + req.toString();
            try {
                if (resourceLocks.lock(transaction, path, tempLockOwner, false, 0, TEMP_TIMEOUT, TEMPORARY)) {

                    String lockId = getLockIdFromLockTokenHeader(req);
                    LockedObject lo;
                    if (lockId != null && ((lo = resourceLocks.getLockedObjectByID(transaction, lockId)) != null)) {

                        String[] owners = lo.getOwner();
                        String owner = null;
                        if (lo.isShared()) {
                            // more than one owner is possible
                            if (owners != null) {
                                for (int i = 0; i < owners.length; i++) {
                                    // remove owner from LockedObject
                                    lo.removeLockedObjectOwner(owners[i]);
                                }
                            }
                        } else {
                            // exclusive, only one lock owner
                            if (owners != null) {
                                owner = owners[0];
                            }
                        }

                        if (resourceLocks.unlock(transaction, lockId, owner)) {
                            StoredObject so = store.getStoredObject(transaction, path);
                            if (so == null) {
                                resp.setStatus(WebdavStatus.SC_NOT_FOUND);
                            } else {
                                if (so.isNullResource()) {
                                    store.removeObject(transaction, path);
                                }
                                resp.setStatus(WebdavStatus.SC_NO_CONTENT);
                            }
                        } else {
                            logger.trace("DoUnlock failure at " + lo.getPath());
                            resp.sendError(WebdavStatus.SC_METHOD_FAILURE);
                        }

                    } else {
                        resp.sendError(WebdavStatus.SC_BAD_REQUEST);
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.