@Override
    public User loadUser(String username) throws UserNotFoundException {
        if(username.contains("@")) {
            if (!XMPPServer.getInstance().isLocal(new JID(username))) {
                throw new UserNotFoundException("Cannot load user of remote server: " + username);
            }
            username = username.substring(0,username.lastIndexOf("@"));
        }
        Connection con = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(LOAD_USER);
            pstmt.setString(1, username);
            rs = pstmt.executeQuery();
            if (!rs.next()) {
                throw new UserNotFoundException();
            }
            String salt = rs.getString(1);
            String serverKey = rs.getString(2);
            String storedKey = rs.getString(3);
            int iterations = rs.getInt(4);
            String name = rs.getString(5);
            String email = rs.getString(6);
            Date creationDate = new Date(Long.parseLong(rs.getString(7).trim()));
            Date modificationDate = new Date(Long.parseLong(rs.getString(8).trim()));

            User user = new User(username, name, email, creationDate, modificationDate);
            user.setSalt(salt);
            user.setServerKey(serverKey);
            user.setStoredKey(storedKey);
            user.setIterations(iterations);
            return user;
        }
        catch (Exception e) {
            throw new UserNotFoundException(e);
        }
        finally {
            DbConnectionManager.closeConnection(rs, pstmt, con);
        }
    }
Default implementation of the UserProvider interface, which reads and writes data
from the {@code ofUser} database table.<p>

Passwords can be stored as plain text, or encrypted using Blowfish. The
encryption/decryption key is stored as the Openfire property {@code passwordKey},
which is automatically created on first-time use. It's critical that the password key
not be changed once created, or existing passwords will be lost. By default
passwords will be stored encrypted. Plain-text password storage can be enabled
by setting the Openfire property {@code user.usePlainPassword} to {@code true}.

@author Matt Tucker
xmppserver/src/main/java/org/jivesoftware/openfire/user/DefaultUserProvider.java