if(res.getResourceType().equals("XMLResource")) doc = ((LocalXMLResource) res).getDocument(broker, true); else doc = ((LocalBinaryResource) res).getDocument(broker, true);
doc = ((AbstractEXistResource) res).openDocument(broker, Lock.READ_LOCK);
	public String hasUserLock(Resource res) throws XMLDBException {		DocumentImpl doc = null;		DBBroker broker = null;		try {		    broker = pool.get(user);			if(res.getResourceType().equals("XMLResource"))				doc = ((LocalXMLResource) res).getDocument(broker, true);			else			    doc = ((LocalBinaryResource) res).getDocument(broker, true);			User lockOwner = doc.getUserLock();			return lockOwner == null ? null : lockOwner.getName();		} catch (EXistException e) {		    throw new XMLDBException(					ErrorCodes.VENDOR_ERROR,					e.getMessage(),					e);        } finally {            collection.getCollection().releaseDocument(doc);		    pool.release(broker);		}	}