Search in sources :

Example 1 with ConnectionCredentialsNotFound

use of org.forgerock.openam.sm.exceptions.ConnectionCredentialsNotFound in project OpenAM by OpenRock.

the class ServerConfigurationFactory method getServerConfiguration.

/**
     * Select the Server Group from the configuration.
     *
     * If the server group is valid then this ServerConfigurationFactory will select
     * the Server Group and Instance for subsequent calls.
     *
     * @param groupName The name of the server group. For example: "default" or "sms".
     * @param authType The type of connection credentials that should be selected.
     *
     * @throws IllegalStateException If the Server Configuration did not exist for the
     * named Server Group or the Server Group did not have credentials for the requested
     * connection type.
     */
public ServerGroupConfiguration getServerConfiguration(String groupName, LDAPUser.Type authType) throws ServerConfigurationNotFound, ConnectionCredentialsNotFound {
    ServerGroup serverGroup = config.getServerGroup(groupName);
    ServerInstance instance = config.getServerInstance(groupName, authType);
    if (serverGroup == null) {
        throw new ServerConfigurationNotFound(groupName);
    }
    if (instance == null) {
        throw new ConnectionCredentialsNotFound(authType);
    }
    return new ServerGroupConfiguration(serverGroup, instance);
}
Also used : ServerConfigurationNotFound(org.forgerock.openam.sm.exceptions.ServerConfigurationNotFound) ServerGroup(com.iplanet.services.ldap.ServerGroup) ServerInstance(com.iplanet.services.ldap.ServerInstance) ConnectionCredentialsNotFound(org.forgerock.openam.sm.exceptions.ConnectionCredentialsNotFound)

Aggregations

ServerGroup (com.iplanet.services.ldap.ServerGroup)1 ServerInstance (com.iplanet.services.ldap.ServerInstance)1 ConnectionCredentialsNotFound (org.forgerock.openam.sm.exceptions.ConnectionCredentialsNotFound)1 ServerConfigurationNotFound (org.forgerock.openam.sm.exceptions.ServerConfigurationNotFound)1