Value key = new Value(CollectionStore.NEXT_DOC_ID_KEY);
Value key = new CollectionStore.CollectionKey(CollectionStore.NEXT_DOC_ID_KEY);
	public int getNextResourceId(Txn transaction, Collection collection) {		int nextDocId;		try {			nextDocId = getFreeResourceId(transaction);		} catch (ReadOnlyException e) {            //TODO : rethrow ? -pb			return 1;		}		if (nextDocId != DocumentImpl.UNKNOWN_DOCUMENT_ID)			return nextDocId;		else			nextDocId = 1;				Lock lock = collectionsDb.getLock();		try {			lock.acquire(Lock.WRITE_LOCK);            Value key = new Value(CollectionStore.NEXT_DOC_ID_KEY);            Value data = collectionsDb.get(key);			if (data != null) {				nextDocId = ByteConversion.byteToInt(data.getData(), 0);				++nextDocId;			}			byte[] d = new byte[4];			ByteConversion.intToByte(nextDocId, d, 0);			collectionsDb.put(transaction, key, d, true);		} catch (ReadOnlyException e) {			LOG.debug("database read-only");			return DocumentImpl.UNKNOWN_DOCUMENT_ID;            //TODO : rethrow ? -pb		} catch (LockException e) {			LOG.warn("Failed to acquire lock on " + collectionsDb.getFile().getName(), e);            //TODO : rethrow ? -pb		} finally {			lock.release();		}		return nextDocId;	}