final boolean missingDatabaseSchema = initDatabaseDao.isEmpty();
if (missingDatabaseSchema == true) {
try {
PFUserContext.setUser(MyDatabaseUpdateDao.__internalGetSystemAdminPseudoUser());
final UpdateEntry updateEntry = DatabaseCoreInitial.getInitializationUpdateEntry(myDatabaseUpdater);
updateEntry.runUpdate();
} finally {
PFUserContext.setUser(null);
}
}
daoRegistry.init();
pluginsRegistry = PluginsRegistry.instance();
pluginsRegistry.set(beanFactory);
pluginsRegistry.set(myDatabaseUpdater.getSystemUpdater());
pluginsRegistry.initialize();
if (missingDatabaseSchema == true) {
try {
PFUserContext.setUser(MyDatabaseUpdateDao.__internalGetSystemAdminPseudoUser()); // Logon admin user.
for (final AbstractPlugin plugin : pluginsRegistry.getPlugins()) {
final UpdateEntry updateEntry = plugin.getInitializationUpdateEntry();
if (updateEntry != null) {
updateEntry.runUpdate();
}
}
} finally {
PFUserContext.setUser(null);
}