Managed repository template path expansions (rebased from dev_5_0)

Refactors managed repository template path expansion to allow extra terms. Testing should be inspired by https://github.com/openmicroscopy/ome-documentation/pull/836 at http://www.openmicroscopy.org/site/support/omero5-staging/sysadmins/fs-upload-configuration.html. Try setting `omero.fs.repo.path` to various values, for instance with `bin/omero config set omero.fs.repo.path '...' ; bin/omero admin restart`, then importing.

--rebased-from #2701