Example usage for com.amazonaws.services.s3.model AmazonS3Exception setStatusCode

List of usage examples for com.amazonaws.services.s3.model AmazonS3Exception setStatusCode

Introduction

In this page you can find the example usage for com.amazonaws.services.s3.model AmazonS3Exception setStatusCode.

Prototype

public void setStatusCode(int statusCode) 

Source Link

Document

Sets the HTTP status code that was returned with this service exception.

Usage

From source file:com.facebook.presto.hive.MockAmazonS3.java

License:Apache License

@Override
public ObjectMetadata getObjectMetadata(String bucketName, String key) throws AmazonClientException {
    if (getObjectMetadataHttpCode != SC_OK) {
        AmazonS3Exception exception = new AmazonS3Exception(
                "Failing getObjectMetadata call with " + getObjectMetadataHttpCode);
        exception.setStatusCode(getObjectMetadataHttpCode);
        throw exception;
    }/*ww  w . j ava 2 s .c o m*/
    return null;
}

From source file:com.facebook.presto.hive.MockAmazonS3.java

License:Apache License

@Override
public S3Object getObject(GetObjectRequest getObjectRequest) throws AmazonClientException {
    if (getObjectHttpCode != SC_OK) {
        AmazonS3Exception exception = new AmazonS3Exception("Failing getObject call with " + getObjectHttpCode);
        exception.setStatusCode(getObjectHttpCode);
        throw exception;
    }/*  ww  w  . j av a2 s.  c o m*/
    return null;
}

From source file:com.facebook.presto.hive.s3.MockAmazonS3.java

License:Apache License

@Override
public ObjectMetadata getObjectMetadata(GetObjectMetadataRequest getObjectMetadataRequest) {
    this.getObjectMetadataRequest = getObjectMetadataRequest;
    if (getObjectMetadataHttpCode != SC_OK) {
        AmazonS3Exception exception = new AmazonS3Exception(
                "Failing getObjectMetadata call with " + getObjectMetadataHttpCode);
        exception.setStatusCode(getObjectMetadataHttpCode);
        throw exception;
    }//from w  ww  .j av  a  2  s  .c  o  m
    return null;
}

From source file:com.facebook.presto.hive.s3.MockAmazonS3.java

License:Apache License

@Override
public S3Object getObject(GetObjectRequest getObjectRequest) {
    if (getObjectHttpCode != SC_OK) {
        AmazonS3Exception exception = new AmazonS3Exception("Failing getObject call with " + getObjectHttpCode);
        exception.setStatusCode(getObjectHttpCode);
        throw exception;
    }//from   w w w . jav  a 2 s .com
    return null;
}

From source file:com.upplication.s3fs.util.AmazonS3ClientMock.java

License:Open Source License

@Override
public S3Object getObject(String bucketName, String key) throws AmazonClientException {

    S3Element result = find(bucketName, key);

    if (result == null) {
        AmazonS3Exception amazonS3Exception = new AmazonS3Exception("not found with key: " + key);
        amazonS3Exception.setStatusCode(404);
        throw amazonS3Exception;
    } else {/*  ww  w  .j  a  va2 s  . c  o m*/
        return result.getS3Object();
    }
}

From source file:com.upplication.s3fs.util.AmazonS3ClientMock.java

License:Open Source License

@Override
public ObjectMetadata getObjectMetadata(String bucketName, String key) {
    S3Element result = find(bucketName, key);

    if (result == null) {
        AmazonS3Exception amazonS3Exception = new AmazonS3Exception("not found with key: " + key);
        amazonS3Exception.setStatusCode(404);
        throw amazonS3Exception;
    } else {//from  w  ww.  j  a v  a 2 s .  com
        return result.getS3Object().getObjectMetadata();
    }
}

From source file:io.prestosql.plugin.hive.s3.MockAmazonS3.java

License:Apache License

@Override
public ObjectMetadata getObjectMetadata(GetObjectMetadataRequest getObjectMetadataRequest) {
    this.getObjectMetadataRequest = getObjectMetadataRequest;
    if (getObjectMetadataHttpCode != HTTP_OK) {
        AmazonS3Exception exception = new AmazonS3Exception(
                "Failing getObjectMetadata call with " + getObjectMetadataHttpCode);
        exception.setStatusCode(getObjectMetadataHttpCode);
        throw exception;
    }// w  w  w .  ja v a2 s. com
    return null;
}

From source file:io.prestosql.plugin.hive.s3.MockAmazonS3.java

License:Apache License

@Override
public S3Object getObject(GetObjectRequest getObjectRequest) {
    if (getObjectHttpCode != HTTP_OK) {
        AmazonS3Exception exception = new AmazonS3Exception("Failing getObject call with " + getObjectHttpCode);
        exception.setStatusCode(getObjectHttpCode);
        throw exception;
    }//  w  w  w . j a v  a2 s.  co m
    return null;
}