@Override public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { throw new InteroperabilityException("Not supported"); }
log.warn(String.format("Failure with PROPFIND request for %s. %s", file, i.getMessage())); final Map<String, String> headers = session.getClient().execute( new HttpHead(new DAVPathEncoder().encode(file)), new HeadersResponseHandler());
@Override public BackgroundException map(final MantaException failure) { final StringBuilder buffer = new StringBuilder(); this.append(buffer, failure.getMessage()); return new InteroperabilityException(buffer.toString(), failure); } }
@Override public BackgroundException map(final HttpResponseException failure) { final StringBuilder buffer = new StringBuilder(); final int statusCode = failure.getStatusCode(); if(statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_MULTI_STATUS) { // HTTP method status this.append(buffer, failure.getMessage()); // Failure unmarshalling XML response return new InteroperabilityException(buffer.toString(), failure); } return super.map(failure); } }
@Override public BackgroundException map(final IOException e) { final StringBuilder buffer = new StringBuilder(); this.append(buffer, e.getMessage()); if(e instanceof FTPConnectionClosedException) { return new ConnectionRefusedException(buffer.toString(), e); } if(e instanceof FTPException) { return this.handle((FTPException) e, buffer); } if(e instanceof MalformedServerReplyException) { return new InteroperabilityException(buffer.toString(), e); } return new DefaultIOExceptionMappingService().map(e); }
throw new InteroperabilityException("Invalid JSON response", e);
private BackgroundException handle(final FTPException e, final StringBuilder buffer) { final int status = e.getCode(); switch(status) { case FTPReply.INSUFFICIENT_STORAGE: case FTPReply.STORAGE_ALLOCATION_EXCEEDED: return new QuotaException(buffer.toString(), e); case FTPReply.NOT_LOGGED_IN: return new LoginFailureException(buffer.toString(), e); case FTPReply.FAILED_SECURITY_CHECK: case FTPReply.DENIED_FOR_POLICY_REASONS: case FTPReply.NEED_ACCOUNT: case FTPReply.NEED_ACCOUNT_FOR_STORING_FILES: case FTPReply.FILE_NAME_NOT_ALLOWED: case FTPReply.FILE_ACTION_NOT_TAKEN: case FTPReply.ACTION_ABORTED: return new AccessDeniedException(buffer.toString(), e); case FTPReply.UNAVAILABLE_RESOURCE: case FTPReply.FILE_UNAVAILABLE: // Requested action not taken. File unavailable (e.g., file not found, no access) return new NotfoundException(buffer.toString(), e); case FTPReply.SERVICE_NOT_AVAILABLE: return new ConnectionRefusedException(buffer.toString(), e); } return new InteroperabilityException(buffer.toString(), e); } }
@Override public BackgroundException map(final ExceptionUDT e) { final StringBuilder buffer = new StringBuilder(); this.append(buffer, e.getError().getDescription()); switch(e.getError()) { case NOSERVER: case ECONNSETUP: case ECONNFAIL: case ECONNLOST: case ECONNREJ: return new ConnectionRefusedException(buffer.toString(), e); case ETIMEOUT: case EINVSOCK: return new ConnectionTimeoutException(buffer.toString(), e); case EWRPERM: return new AccessDeniedException(buffer.toString(), e); case EINVPARAM: return new InteroperabilityException(buffer.toString(), e); case USER_DEFINED_MESSAGE: // Handle UDT Error : -4 : user defined message : UDT send time out [id: 0x3223fa70] case WRAPPER_UNKNOWN: case WRAPPER_UNIMPLEMENTED: case WRAPPER_MESSAGE: return new InteroperabilityException(buffer.toString(), e); } return this.wrap(e, buffer); } }
case HttpStatus.SC_METHOD_NOT_ALLOWED: case HttpStatus.SC_NOT_IMPLEMENTED: return new InteroperabilityException(buffer.toString(), failure); case HttpStatus.SC_REQUEST_TIMEOUT: case HttpStatus.SC_GATEWAY_TIMEOUT: return new InteroperabilityException(buffer.toString(), failure);
public BackgroundException map(final IOException e, final StringBuilder buffer, final DisconnectReason reason) { final String failure = buffer.toString(); if(DisconnectReason.HOST_KEY_NOT_VERIFIABLE.equals(reason)) { log.warn(String.format("Failure verifying host key. %s", failure)); // Host key dismissed by user return new ConnectionCanceledException(e); } if(DisconnectReason.PROTOCOL_ERROR.equals(reason)) { // Too many authentication failures return new InteroperabilityException(failure, e); } if(DisconnectReason.ILLEGAL_USER_NAME.equals(reason)) { return new LoginFailureException(failure, e); } if(DisconnectReason.NO_MORE_AUTH_METHODS_AVAILABLE.equals(reason)) { return new LoginFailureException(failure, e); } if(DisconnectReason.PROTOCOL_VERSION_NOT_SUPPORTED.equals(reason)) { return new InteroperabilityException(failure, e); } if(e instanceof TransportException) { return new ConnectionRefusedException(buffer.toString(), e); } return this.wrap(e, buffer); } }
@Override public BackgroundException map(final StorageException e) { final StringBuilder buffer = new StringBuilder(); this.append(buffer, e.getMessage()); if(ExceptionUtils.getRootCause(e) instanceof UnknownHostException) { return new NotfoundException(buffer.toString(), e); } switch(e.getHttpStatusCode()) { case 403: return new LoginFailureException(buffer.toString(), e); case 404: return new NotfoundException(buffer.toString(), e); case 304: case 405: case 400: case 411: case 412: return new InteroperabilityException(buffer.toString(), e); case 500: // InternalError // OperationTimedOut return new ConnectionTimeoutException(buffer.toString(), e); case 503: // ServerBusy return new RetriableAccessDeniedException(buffer.toString(), e); } return this.wrap(e, buffer); } }
throw new InteroperabilityException("No region found in authentication context"); log.warn(String.format("Fallback to first region %s", region.getRegionId())); if(null == region.getStorageUrl()) { throw new InteroperabilityException(String.format("No storage endpoint found for region %s", region.getRegionId()));
throw new InteroperabilityException(error.toString());
case FAILURE: case OP_UNSUPPORTED: return new InteroperabilityException(buffer.toString(), e); case NO_SUCH_FILE: return new NotfoundException(buffer.toString(), e); return new InteroperabilityException(buffer.toString(), e);
return new InteroperabilityException(buffer.toString(), failure); return new InteroperabilityException(buffer.toString(), failure);
switch(lookup.tag()) { case OTHER: return new InteroperabilityException(buffer.toString(), failure); case NOT_FOUND: case NOT_FILE: switch(lookup.tag()) { case OTHER: return new InteroperabilityException(buffer.toString(), failure); case NOT_FOUND: case NOT_FILE: switch(lookup.tag()) { case OTHER: return new InteroperabilityException(buffer.toString(), failure); case NOT_FOUND: case NOT_FILE: switch(lookup.tag()) { case OTHER: return new InteroperabilityException(buffer.toString(), failure); case MALFORMED_PATH: case DISALLOWED_NAME: switch(lookup.tag()) { case OTHER: return new InteroperabilityException(buffer.toString(), failure); case NOT_FOUND: case NOT_FILE:
private FileKeyProvider buildProvider(final Local identity, final KeyFormat format) throws InteroperabilityException { switch(format) { case PKCS5: return new PKCS5KeyFile.Factory().create(); case PKCS8: return new PKCS8KeyFile.Factory().create(); case OpenSSH: return new OpenSSHKeyFile.Factory().create(); case OpenSSHv1: return new OpenSSHKeyV1KeyFile.Factory().create(); case PuTTY: return new PuTTYKeyFile.Factory().create(); default: throw new InteroperabilityException(String.format("Unknown key format for file %s", identity.getName())); } }
break; default: throw new InteroperabilityException(String.format("Unknown key format for file %s", identity.getName()));
@Override public void setStatus(final Path file, final boolean enabled) throws BackgroundException { final Path bucket = containerService.getContainer(file); try { if(!ServiceUtils.isBucketNameValidDNSName(bucket.getName())) { throw new InteroperabilityException("The name of the bucket used for Transfer Acceleration must be DNS-compliant and must not contain periods."); } session.getClient().setAccelerateConfig(bucket.getName(), new AccelerateConfig(enabled)); } catch(S3ServiceException failure) { throw new S3ExceptionMappingService().map("Failure to write attributes of {0}", failure, bucket); } }