@Override
    public UserProvider getUserProvider(String username)
    {
        UserProvider nonReadOnly = null;
        for (final UserProvider provider : getUserProviders())
        {
            try
            {
                provider.loadUser(username);
                return provider;
            }
            catch (UserNotFoundException unfe)
            {
                Log.debug( "User {} not found by UserProvider {}", username, provider.getClass().getName() );

                if (nonReadOnly == null && !provider.isReadOnly()) {
                    nonReadOnly = provider;
                }
            }
        }

        // User does not exist. Return a provider suitable for creating users.
        if ( nonReadOnly == null )
        {
            throw new UnsupportedOperationException();
        }

        return nonReadOnly;
    }
Returns the first provider that contains the user, or the first provider that is not read-only when the user
does not exist in any provider.

@param username the username (cannot be null or empty).
@return The user provider (never null)
xmppserver/src/main/java/org/jivesoftware/openfire/user/HybridUserProvider.java