r = new LocalXMLResource(user, brokerPool, this, id, -1);
r = new LocalXMLResource(user, brokerPool, this, id);
	public Resource getResource(String id) throws XMLDBException {		Collection collection = null;		DBBroker broker = null;		try {			broker = brokerPool.get(user);			collection = broker.openCollection(path, Lock.READ_LOCK);			if(collection == null)				throw new XMLDBException(ErrorCodes.INVALID_COLLECTION, "Collection " + path + " not found");			if (!checkPermissions(collection, Permission.READ))				throw new XMLDBException(						ErrorCodes.PERMISSION_DENIED,				"not allowed to read collection");			DocumentImpl document = collection.getDocument(broker, id);			if (document == null) {				LOG.warn("Resource " + id + " not found");				return null;			}			Resource r;			if (document.getResourceType() == DocumentImpl.XML_FILE)				r = new LocalXMLResource(user, brokerPool, this, id, -1);			else if (document.getResourceType() == DocumentImpl.BINARY_FILE)				r = new LocalBinaryResource(user, brokerPool, this, id);			else				throw new XMLDBException(						ErrorCodes.INVALID_RESOURCE,				"unknown resource type");			return r;		} catch (EXistException e) {			throw new XMLDBException(					ErrorCodes.UNKNOWN_ERROR,					"error while retrieving resource: " + e.getMessage(),					e);		} finally {			if(collection != null)				collection.release();			brokerPool.release(broker);		}	}