Refactor selection of repository/observer based on argument

Move the complex logic used to choose the document type to be
republished, and obtain its observers and registries down into a
testable class and away from the (untested) republish_documents script.