Search in sources :

Example 1 with ConfigurationException

use of com.joyent.manta.exception.ConfigurationException in project cyberduck by iterate-ch.

the class MantaSession method login.

@Override
public void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException {
    try {
        config.setMantaUser(host.getCredentials().getUsername());
        if (host.getCredentials().isPublicKeyAuthentication()) {
            config.setMantaKeyId(new MantaPublicKeyAuthentication(this).authenticate(host, prompt, cancel));
        }
        if (host.getCredentials().isPasswordAuthentication()) {
            config.setPassword(host.getCredentials().getPassword());
        }
        config.setNoAuth(false);
        config.reload();
        // Instantiation of client does not validate credentials. List the home path to test the connection
        client.isDirectoryEmpty(new MantaHomeFinderFeature(host).find().getAbsolute());
    } catch (ConfigurationException e) {
        throw new BackgroundException(e.getRawMessage(), e);
    } catch (MantaException e) {
        throw new MantaExceptionMappingService().map(e);
    } catch (MantaClientHttpResponseException e) {
        throw new MantaHttpExceptionMappingService().map(e);
    } catch (IOException e) {
        throw new DefaultIOExceptionMappingService().map(e);
    }
}
Also used : ConfigurationException(com.joyent.manta.exception.ConfigurationException) IOException(java.io.IOException) DefaultIOExceptionMappingService(ch.cyberduck.core.DefaultIOExceptionMappingService) MantaClientHttpResponseException(com.joyent.manta.exception.MantaClientHttpResponseException) BackgroundException(ch.cyberduck.core.exception.BackgroundException) MantaException(com.joyent.manta.exception.MantaException)

Aggregations

DefaultIOExceptionMappingService (ch.cyberduck.core.DefaultIOExceptionMappingService)1 BackgroundException (ch.cyberduck.core.exception.BackgroundException)1 ConfigurationException (com.joyent.manta.exception.ConfigurationException)1 MantaClientHttpResponseException (com.joyent.manta.exception.MantaClientHttpResponseException)1 MantaException (com.joyent.manta.exception.MantaException)1 IOException (java.io.IOException)1