Add stateful metadata builder

Provide a stateful builder that can be used to add resource one by one
instead of providing all of them in one shot. Makes it more clear that
the stream is left open and the caller has to deal with it.

It is possible to call "build()" several times on the same builder
instance: each call to build() will provide an isolated metadata
repository instance and additional resource(s) can be added between each
call if necessary.