Support dynamic number of namespaces.

Signed-off-by: Pengcheng Bian <pbian@actuate.com>