A generic implementation of the service locator pattern