Collection collection = broker.getCollection(collectionName);
collection = broker.openCollection(collectionName, Lock.READ_LOCK);
	public String createResourceId(User user, String collectionName)	throws EXistException, PermissionDeniedException {	    DBBroker broker = null;	    try {	        broker = brokerPool.get(user);	        if (!collectionName.startsWith("/"))	            collectionName = '/' + collectionName;	        if (!collectionName.startsWith("/db"))	            collectionName = "/db" + collectionName;	        Collection collection = broker.getCollection(collectionName);	        String id;			Random rand = new Random();			boolean ok;			do {				ok = true;				id = Integer.toHexString(rand.nextInt()) + ".xml";				// check if this id does already exist				if (collection.hasDocument(id))					ok = false;				if (collection.hasSubcollection(id))					ok = false;			} while (!ok);			return id;	    } finally {	        brokerPool.release(broker);	    }}