if(!doc.getPermissions().validate(user, Permission.READ)) throw new PermissionDeniedException("Insufficient privileges to read resource");
	public byte[] getBinaryResource(User user, String name)			throws EXistException, PermissionDeniedException {		DBBroker broker = null;		try {			broker = brokerPool.get(user);			DocumentImpl doc = (DocumentImpl) broker.getDocument(name);			if (doc == null)				throw new EXistException("Resource " + name + " not found");			if (doc.getResourceType() != DocumentImpl.BINARY_FILE)				throw new EXistException("Document " + name						+ " is not a binary resource");			return broker.getBinaryResourceData((BinaryDocument) doc);		} finally {			brokerPool.release(broker);		}	}