if(doc.isLockedForWrite()) throw new PermissionDeniedException("Document " + doc.getFileName() + " is locked for write");
	synchronized public void removeBinaryResource(DBBroker broker,			String docname) throws PermissionDeniedException, LockException {		Lock lock = db.getLock();		try {			lock.acquire(Lock.WRITE_LOCK);			String path = getName() + '/' + docname;			DocumentImpl doc = getDocument(path);			if (!getPermissions().validate(broker.getUser(), Permission.WRITE))				throw new PermissionDeniedException(						"write access to collection denied; user=" + broker.getUser().getName());			if (!doc.getPermissions().validate(broker.getUser(), Permission.WRITE))				throw new PermissionDeniedException("permission to remove document denied");			removeBinaryResource(broker, doc);		} finally {			lock.release();		}	}