Search in sources :

Example 1 with PutObjectResult

use of com.emc.object.s3.bean.PutObjectResult in project pravega by pravega.

the class S3FileSystemImpl method putObject.

@Override
public PutObjectResult putObject(PutObjectRequest request) {
    if (request.getObjectMetadata() != null) {
        request.setObjectMetadata(null);
    }
    try {
        Path path = Paths.get(this.baseDir, request.getBucketName(), request.getKey());
        Files.createDirectories(path.getParent());
        Files.createFile(path);
    } catch (IOException e) {
        throw new S3Exception(e.getMessage(), 0, e);
    }
    PutObjectResult retVal = new PutObjectResult();
    if (request.getAcl() != null) {
        long size = 0;
        if (request.getRange() != null) {
            size = request.getRange().getLast() + 1;
        }
        aclMap.putIfAbsent(request.getKey(), new AclSize(request.getAcl(), size));
    }
    return retVal;
}
Also used : Path(java.nio.file.Path) PutObjectResult(com.emc.object.s3.bean.PutObjectResult) S3Exception(com.emc.object.s3.S3Exception) IOException(java.io.IOException)

Example 2 with PutObjectResult

use of com.emc.object.s3.bean.PutObjectResult in project pravega by pravega.

the class S3ProxyImpl method putObject.

@Override
public PutObjectResult putObject(PutObjectRequest request) {
    S3ObjectMetadata metadata = request.getObjectMetadata();
    if (request.getObjectMetadata() != null) {
        request.setObjectMetadata(null);
    }
    PutObjectResult retVal = client.putObject(request);
    if (request.getAcl() != null) {
        long size = 0;
        if (request.getRange() != null) {
            size = request.getRange().getLast() - 1;
        }
        aclMap.put(request.getKey(), new AclSize(request.getAcl(), size));
    }
    return retVal;
}
Also used : PutObjectResult(com.emc.object.s3.bean.PutObjectResult) S3ObjectMetadata(com.emc.object.s3.S3ObjectMetadata)

Aggregations

PutObjectResult (com.emc.object.s3.bean.PutObjectResult)2 S3Exception (com.emc.object.s3.S3Exception)1 S3ObjectMetadata (com.emc.object.s3.S3ObjectMetadata)1 IOException (java.io.IOException)1 Path (java.nio.file.Path)1