doc = (DocumentImpl) broker.openDocument(path, Lock.WRITE_LOCK);
doc = (DocumentImpl) broker.getXMLResource(path, Lock.WRITE_LOCK);
    public void unlockResource(java.lang.String sessionId, java.lang.String path) throws java.rmi.RemoteException {        DBBroker broker = null;		Session session = getSession(sessionId);		User user = session.getUser();        DocumentImpl doc = null;        try {            broker = pool.get(user);            doc = (DocumentImpl) broker.openDocument(path, Lock.WRITE_LOCK);            if (doc == null)                throw new EXistException("Resource "                        + path + " not found");            if (!doc.getPermissions().validate(user, Permission.UPDATE))                throw new PermissionDeniedException("User is not allowed to lock resource " + path);            org.exist.security.SecurityManager manager = pool.getSecurityManager();            User lockOwner = doc.getUserLock();            if(lockOwner != null && (!lockOwner.equals(user)) && (!manager.hasAdminPrivileges(user)))                throw new PermissionDeniedException("Resource is already locked by user " +                        lockOwner.getName());            TransactionManager transact = pool.getTransactionManager();            Txn transaction = transact.beginTransaction();            doc.setUserLock(null);            broker.storeDocument(transaction, doc);            transact.commit(transaction);            return;        } catch (Exception ex){        	throw new RemoteException(ex.getMessage());        } finally {            if(doc != null)                doc.getUpdateLock().release(Lock.WRITE_LOCK);            pool.release(broker);        }    }