public static RemoteServerConfiguration getConfiguration(String domain) {
        RemoteServerConfiguration configuration = configurationsCache.get(domain);
        if (configuration != null && configuration.getPermission() == null) {
            return null;
        }
        if (configuration == null) {
            java.sql.Connection con = null;
            PreparedStatement pstmt = null;
            ResultSet rs = null;
            try {
                con = DbConnectionManager.getConnection();
                pstmt = con.prepareStatement(LOAD_CONFIGURATION);
                pstmt.setString(1, domain);
                rs = pstmt.executeQuery();
                while (rs.next()) {
                    configuration = new RemoteServerConfiguration(domain);
                    configuration.setRemotePort(rs.getInt(1));
                    configuration.setPermission(Permission.valueOf(rs.getString(2)));
                }
            }
            catch (SQLException sqle) {
                Log.error(sqle.getMessage(), sqle);
            }
            finally {
                DbConnectionManager.closeConnection(rs, pstmt, con);
            }
            if (configuration != null) {
                configurationsCache.put(domain, configuration);
            }
            else {
                // Config without a permission, cached to prevent continuous database lookups.
                configurationsCache.put(domain, new RemoteServerConfiguration(domain));
            }
        }
        return configuration;
    }
Returns the configuration for a remote server or {@code null} if none was found.

@param domain the domain of the remote server.
@return the configuration for a remote server or {@code null} if none was found.
xmppserver/src/main/java/org/jivesoftware/openfire/server/RemoteServerManager.java