Search in sources :

Example 1 with DataPutBucketReplication

use of com.pspace.ifs.ksan.gw.data.DataPutBucketReplication in project ksan by infinistor.

the class PutBucketReplication method process.

@Override
public void process() throws GWException {
    logger.info(GWConstants.LOG_PUT_BUCKET_REPLICATION_START);
    String bucket = s3Parameter.getBucketName();
    initBucketInfo(bucket);
    S3Bucket s3Bucket = new S3Bucket();
    s3Bucket.setCors(getBucketInfo().getCors());
    s3Bucket.setAccess(getBucketInfo().getAccess());
    s3Parameter.setBucket(s3Bucket);
    GWUtils.checkCors(s3Parameter);
    if (s3Parameter.isPublicAccess() && GWUtils.isIgnorePublicAcls(s3Parameter)) {
        throw new GWException(GWErrorCode.ACCESS_DENIED, s3Parameter);
    }
    checkGrantBucketOwner(s3Parameter.isPublicAccess(), String.valueOf(s3Parameter.getUser().getUserId()), GWConstants.GRANT_WRITE_ACP);
    if (!GWConstants.VERSIONING_ENABLED.equalsIgnoreCase(getBucketVersioning(bucket))) {
        throw new GWException(GWErrorCode.INVALID_REPLICATION_REQUEST, s3Parameter);
    }
    DataPutBucketReplication dataPutBucketReplication = new DataPutBucketReplication(s3Parameter);
    dataPutBucketReplication.extract();
    String replicationXml = dataPutBucketReplication.getReplicationXml();
    checkBucketReplication(replicationXml);
    updateBucketReplication(bucket, replicationXml);
    s3Parameter.getResponse().setStatus(HttpServletResponse.SC_OK);
}
Also used : S3Bucket(com.pspace.ifs.ksan.gw.identity.S3Bucket) DataPutBucketReplication(com.pspace.ifs.ksan.gw.data.DataPutBucketReplication) GWException(com.pspace.ifs.ksan.gw.exception.GWException)

Aggregations

DataPutBucketReplication (com.pspace.ifs.ksan.gw.data.DataPutBucketReplication)1 GWException (com.pspace.ifs.ksan.gw.exception.GWException)1 S3Bucket (com.pspace.ifs.ksan.gw.identity.S3Bucket)1