use of com.pspace.ifs.ksan.gw.exception.GWException in project ksan by infinistor.
the class S3Request method updateBucketTagging.
protected void updateBucketTagging(String bucket, String tagging) throws GWException {
try {
setObjManager();
objManager.updateBucketTagging(bucket, tagging);
} catch (Exception e) {
logger.error(e.getMessage());
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
} finally {
try {
releaseObjManager();
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
}
}
}
use of com.pspace.ifs.ksan.gw.exception.GWException in project ksan by infinistor.
the class S3Request method putBucketVersioning.
protected void putBucketVersioning(String bucket, String status) throws GWException {
try {
setObjManager();
objManager.putBucketVersioning(bucket, status);
} catch (ResourceNotFoundException e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.NO_SUCH_BUCKET, s3Parameter);
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
} finally {
try {
releaseObjManager();
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
}
}
}
use of com.pspace.ifs.ksan.gw.exception.GWException in project ksan by infinistor.
the class S3Request method isGrantObject.
protected boolean isGrantObject(Metadata meta, String id, String s3grant) throws GWException {
if (meta == null) {
return false;
}
if (accessControlPolicyObject == null) {
XmlMapper xmlMapper = new XmlMapper();
try {
accessControlPolicyObject = xmlMapper.readValue(meta.getAcl(), AccessControlPolicy.class);
} catch (JsonMappingException e) {
logger.error(e.getMessage());
throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
} catch (JsonProcessingException e) {
logger.error(e.getMessage());
throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
}
}
logger.info(GWConstants.LOG_REQUEST_CHECK_ACL_ID_GRANT, id, s3grant);
logger.info(GWConstants.LOG_REQUEST_BUCKET_ACL, meta.getAcl());
logger.info(GWConstants.LOG_REQUEST_BUCKET_OWNER_ID, accessControlPolicyObject.owner.id);
if (accessControlPolicyObject.aclList.grants == null) {
return false;
}
return checkGrant(id, s3grant, accessControlPolicyObject);
}
use of com.pspace.ifs.ksan.gw.exception.GWException in project ksan by infinistor.
the class S3Request method createBucket.
protected int createBucket(String bucket, String userName, String userId, String acl, String encryption, String objectlock) throws GWException {
int result = 0;
try {
setObjManager();
result = objManager.createBucket(bucket, userName, userId, acl, encryption, objectlock);
} catch (ResourceAlreadyExistException e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.BUCKET_ALREADY_EXISTS, s3Parameter);
} catch (ResourceNotFoundException e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
} finally {
try {
releaseObjManager();
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
}
}
if (result != 0) {
throw new GWException(GWErrorCode.INTERNAL_SERVER_DB_ERROR, s3Parameter);
}
return result;
}
use of com.pspace.ifs.ksan.gw.exception.GWException in project ksan by infinistor.
the class S3Request method insertObject.
protected int insertObject(String bucket, String object, Metadata data) throws GWException {
int result = 0;
try {
setObjManager();
result = objManager.close(bucket, object, data);
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
} finally {
try {
releaseObjManager();
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
}
}
return result;
}
Aggregations