public void apply(AbstractWizardSequence sequence) throws Exception {
sequence.putAttribute(ATTR_USER_DATABASE, userDatabase);
// Determine if the user database chosen is different to that selected
UserDatabase installUserDb = (UserDatabase)sequence.getAttribute(ATTR_USER_DATABASE_INSTANCE, null);
UserDatabaseDefinition udbDef = UserDatabaseManager.getInstance().getUserDatabaseDefinition(userDatabase);
UserDatabaseDefinition oldDef = UserDatabaseManager.getInstance().getUserDatabaseDefinition(oldUserDatabase);
Realm defaultRealm = UserDatabaseManager.getInstance().getDefaultRealm();
if(installUserDb == null) {
if(isUsingDifferentDatabase(oldDef, udbDef)) {
log.info("Selected user database differs from current default, open new database");
installUserDb = UserDatabaseManager.getInstance().createUserDatabase(udbDef.getName(), defaultRealm.getResourceName(), defaultRealm.getResourceDescription(), false);