void runAutoSetup() {
        // Setup property encryptor as early as possible so that database related properties can use it
        JiveGlobals.setupPropertyEncryptionAlgorithm(JiveGlobals.getXMLProperty("autosetup.encryption.algorithm", "Blowfish")); // or AES
        JiveGlobals.setupPropertyEncryptionKey(JiveGlobals.getXMLProperty("autosetup.encryption.key", null));

        // steps from setup-datasource-standard.jsp
        // do this first so that other changes persist
        if ("standard".equals(JiveGlobals.getXMLProperty("autosetup.database.mode"))) {
            JiveGlobals.setXMLProperty("database.defaultProvider.driver", JiveGlobals.getXMLProperty("autosetup.database.defaultProvider.driver"));
            JiveGlobals.setXMLProperty("database.defaultProvider.serverURL", JiveGlobals.getXMLProperty("autosetup.database.defaultProvider.serverURL"));
            JiveGlobals.setXMLProperty("database.defaultProvider.username", JiveGlobals.getXMLProperty("autosetup.database.defaultProvider.username"));
            JiveGlobals.setXMLProperty("database.defaultProvider.password", JiveGlobals.getXMLProperty("autosetup.database.defaultProvider.password"));

            int minConnections;
            int maxConnections;
            double connectionTimeout;

            try {
                minConnections = Integer.parseInt(
                    JiveGlobals.getXMLProperty("autosetup.database.defaultProvider.minConnections"));
            }
            catch (Exception e) {
                minConnections = 5;
            }
            try {
                maxConnections = Integer.parseInt(
                    JiveGlobals.getXMLProperty("autosetup.database.defaultProvider.maxConnections"));
            }
            catch (Exception e) {
                maxConnections = 25;
            }
            try {
                connectionTimeout = Double.parseDouble(
                    JiveGlobals.getXMLProperty("autosetup.database.defaultProvider.connectionTimeout"));
            }
            catch (Exception e) {
                connectionTimeout = 1.0;
            }

            JiveGlobals.setXMLProperty("database.defaultProvider.minConnections",
                Integer.toString(minConnections));
            JiveGlobals.setXMLProperty("database.defaultProvider.maxConnections",
                Integer.toString(maxConnections));
            JiveGlobals.setXMLProperty("database.defaultProvider.connectionTimeout",
                Double.toString(connectionTimeout));
        }

        // mark setup as done, so that other things can be written to the DB
        JiveGlobals.setXMLProperty("setup","true");

        // steps from index.jsp
        String localeCode = JiveGlobals.getXMLProperty("autosetup.locale");
        logger.info("Setting locale to {}", localeCode);
        JiveGlobals.setLocale(LocaleUtils.localeCodeToLocale(localeCode.trim()));

        // steps from setup-host-settings.jsp
        JiveGlobals.setXMLProperty(XMPPServerInfo.XMPP_DOMAIN.getKey(), JiveGlobals.getXMLProperty("autosetup." + XMPPServerInfo.XMPP_DOMAIN.getKey()));
        JiveGlobals.setXMLProperty("fqdn", JiveGlobals.getXMLProperty("autosetup.xmpp.fqdn"));
        JiveGlobals.migrateProperty(XMPPServerInfo.XMPP_DOMAIN.getKey());

        ConnectionSettings.Client.ENABLE_OLD_SSLPORT_PROPERTY.setValue(Boolean.valueOf(JiveGlobals.getXMLProperty("autosetup." + ConnectionSettings.Client.ENABLE_OLD_SSLPORT_PROPERTY.getKey(), "true")));
        AnonymousSaslServer.ENABLED.setValue(Boolean.valueOf(JiveGlobals.getXMLProperty("autosetup." + AnonymousSaslServer.ENABLED.getKey(), "false")));


        // steps from setup-profile-settings.jsp
        if ("default".equals(JiveGlobals.getXMLProperty("autosetup.authprovider.mode", "default"))) {
            JiveGlobals.setProperty(AuthFactory.AUTH_PROVIDER.getKey(), JiveGlobals.getXMLProperty(AuthFactory.AUTH_PROVIDER.getKey(),
                AuthFactory.AUTH_PROVIDER.getDefaultValue().getName()));
            JiveGlobals.setProperty(UserManager.USER_PROVIDER.getKey(), JiveGlobals.getXMLProperty(UserManager.USER_PROVIDER.getKey(),
                UserManager.USER_PROVIDER.getDefaultValue().getName()));
            JiveGlobals.setProperty(GroupManager.GROUP_PROVIDER.getKey(), JiveGlobals.getXMLProperty(GroupManager.GROUP_PROVIDER.getKey(),
                GroupManager.GROUP_PROVIDER.getDefaultValue().getName()));
            JiveGlobals.setProperty(VCardManager.VCARD_PROVIDER.getKey(), JiveGlobals.getXMLProperty(VCardManager.VCARD_PROVIDER.getKey(),
                VCardManager.VCARD_PROVIDER.getDefaultValue().getName()));
            JiveGlobals.setProperty(LockOutManager.LOCKOUT_PROVIDER.getKey(), JiveGlobals.getXMLProperty(LockOutManager.LOCKOUT_PROVIDER.getKey(),
                LockOutManager.LOCKOUT_PROVIDER.getDefaultValue().getName()));
            JiveGlobals.setProperty(SecurityAuditManager.AUDIT_PROVIDER.getKey(), JiveGlobals.getXMLProperty(SecurityAuditManager.AUDIT_PROVIDER.getKey(),
                SecurityAuditManager.AUDIT_PROVIDER.getDefaultValue().getName()));
            JiveGlobals.setProperty(AdminManager.ADMIN_PROVIDER.getKey(), JiveGlobals.getXMLProperty(AdminManager.ADMIN_PROVIDER.getKey(),
                AdminManager.ADMIN_PROVIDER.getDefaultValue().getName()));

            // make configurable?
            JiveGlobals.setProperty("user.scramHashedPasswordOnly", "true");
        }

        // steps from setup-admin-settings.jsp
        try {
            User adminUser = UserManager.getInstance().getUser("admin");
            adminUser.setPassword(JiveGlobals.getXMLProperty("autosetup.admin.password"));
            adminUser.setEmail(JiveGlobals.getXMLProperty("autosetup.admin.email"));
            Date now = new Date();
            adminUser.setCreationDate(now);
            adminUser.setModificationDate(now);
        } catch (Exception e) {
            e.printStackTrace();
            logger.warn("There was an unexpected error encountered when "
                + "setting the new admin information. Please check your error "
                + "logs and try to remedy the problem.");
        }

        // Import any provisioned users.
        try {
            RosterItemProvider rosterItemProvider = null;
            for (int userId = 1; userId < Integer.MAX_VALUE; userId++ ) {
                final String username = JiveGlobals.getXMLProperty( "autosetup.users.user" + userId + ".username" );
                final String password = JiveGlobals.getXMLProperty( "autosetup.users.user" + userId + ".password" );
                if (username == null || password == null) {
                    break;
                }
                final String name = JiveGlobals.getXMLProperty( "autosetup.users.user" + userId + ".name" );
                final String email = JiveGlobals.getXMLProperty( "autosetup.users.user" + userId + ".email" );

                final User user = UserManager.getInstance().createUser(username, password, name, email );
                for (int itemId = 1; itemId < Integer.MAX_VALUE; itemId++) {
                    final String jid = JiveGlobals.getXMLProperty( "autosetup.users.user" + userId + ".roster.item" + itemId + ".jid" );
                    if (jid == null) {
                        break;
                    }
                    final String nickname = JiveGlobals.getXMLProperty( "autosetup.users.user" + userId + ".roster.item" + itemId + ".nickname" );
                    final RosterItem rosterItem = new RosterItem(new JID(jid), RosterItem.SubType.BOTH, RosterItem.AskType.NONE, RosterItem.RecvType.NONE, nickname, null);

                    if (rosterItemProvider == null) {
                        // Modules have not started at this point, so we can't go through the roster. Use the default provider instead.
                        rosterItemProvider = new DefaultRosterItemProvider();
                    }
                    rosterItemProvider.createItem(user.getUsername(), rosterItem);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            logger.warn("There was an unexpected error encountered when provisioning auto-setup provided users.", e);
        }

        // finish setup
        this.finalSetupSteps();
        setupMode = false;
    }
Removes a server listener that was being notified when the server was being started
or was about to be stopped.

@param listener the server listener to remove.
xmppserver/src/main/java/org/jivesoftware/openfire/XMPPServer.java