To migrate, add public void setRepositoryRegistry(RepositoryRegistry repositoryRegistry)
to each Repository
implementation.
The primary difference for the user is the removal of the singleton for the RepositoryRegistry. Previously, a repository was loaded by the following
RepositoryRegistry.loadFromFile("./sample-config.xml");
Now this is done through the use of an abstract factory
RepositoryRegistry repositoryRegistry = RepositoryRegistry.Factory.create();
repositoryRegistry.loadFromFile("./sample-config.xml");
If for some reason you need to employ a singleton, create a singleton adapter, similar to the following:
public class NewRepositoryRegistry implements RepositoryRegistry {
private static NewRepositoryRegistry newRepositoryRegistry = new NewRepositoryRegistry();
private static RepositoryRegistry repositoryRegistry;
private NewRepositoryRegistry() {
repositoryRegistry = RepositoryRegistry.Factory.create();
}
public static void loadFromFile(String fileName) throws IOException {
repositoryRegistry.loadFromFile(fileName);
}
...<other methods>
}
and replace all instances of RepositoryRegistry in your code with NewRepositoryRegistry.