use of com.talend.shaded.com.amazonaws.services.s3.model.ObjectMetadata in project ice by Netflix.
the class BasicS3ApplicationGroupService method saveApplicationGroup.
public boolean saveApplicationGroup(ApplicationGroup appgroup) {
Map<String, ApplicationGroup> appgroups = getApplicationGroups();
appgroups.put(appgroup.name, appgroup);
try {
String json = getJson(appgroups);
s3Client.putObject(config.workS3BucketName, config.workS3BucketPrefix + "appgroups", IOUtils.toInputStream(json), new ObjectMetadata());
s3Client.putObject(config.workS3BucketName, config.workS3BucketPrefix + "copy_appgroups", IOUtils.toInputStream(json), new ObjectMetadata());
BasicS3ApplicationGroupService.logger.info("saved appgroup " + appgroup);
return true;
} catch (JSONException e) {
logger.error("Error saving appgroup " + appgroup, e);
return false;
}
}
use of com.talend.shaded.com.amazonaws.services.s3.model.ObjectMetadata in project ice by Netflix.
the class BasicS3ApplicationGroupService method deleteApplicationGroup.
public boolean deleteApplicationGroup(String name) {
Map<String, ApplicationGroup> appgroups = getApplicationGroups();
ApplicationGroup appgroup = appgroups.remove(name);
try {
String json = getJson(appgroups);
s3Client.putObject(config.workS3BucketName, config.workS3BucketPrefix + "appgroups", new ByteArrayInputStream(json.getBytes()), new ObjectMetadata());
BasicS3ApplicationGroupService.logger.info("delete appgroup " + name + " " + appgroup);
return true;
} catch (JSONException e) {
logger.error("Error deleting appgroup " + appgroup, e);
return false;
}
}
use of com.talend.shaded.com.amazonaws.services.s3.model.ObjectMetadata in project exhibitor by soabase.
the class S3Utils method simpleUploadFile.
public static ObjectMetadata simpleUploadFile(S3Client client, byte[] bytes, String bucket, String key) throws Exception {
byte[] md5 = md5(bytes, bytes.length);
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(bytes.length);
metadata.setLastModified(new Date());
metadata.setContentMD5(S3Utils.toBase64(md5));
PutObjectRequest putObjectRequest = new PutObjectRequest(bucket, key, new ByteArrayInputStream(bytes), metadata);
PutObjectResult putObjectResult = client.putObject(putObjectRequest);
if (!putObjectResult.getETag().equals(S3Utils.toHex(md5))) {
throw new Exception("Unable to match MD5 for config");
}
return metadata;
}
use of com.talend.shaded.com.amazonaws.services.s3.model.ObjectMetadata in project uPortal by Jasig.
the class AwsS3DynamicSkinService method innerSkinCssFileExists.
@Override
protected boolean innerSkinCssFileExists(DynamicSkinInstanceData data) {
final String objectKey = this.getCssObjectKey(data);
log.info(ATTEMPTING_TO_GET_FILE_METADATA_FROM_AWS_S3_LOG_MSG, this.awsS3BucketConfig.getBucketName(), objectKey);
final ObjectMetadata metadata = this.getMetadataFromAwsS3Bucket(objectKey);
log.info(FILE_METADATA_RETRIEVED_FROM_AWS_S3_LOG_MSG, this.awsS3BucketConfig.getBucketName(), objectKey);
if (metadata == null) {
return false;
} else {
final String uniqueTokenFromS3 = metadata.getUserMetaDataOf(SKIN_UNIQUE_TOKEN_METADATA_KEY);
return this.getUniqueToken(data).equals(uniqueTokenFromS3);
}
}
use of com.talend.shaded.com.amazonaws.services.s3.model.ObjectMetadata in project uPortal by Jasig.
the class AwsS3DynamicSkinService method createObjectMetadata.
private ObjectMetadata createObjectMetadata(final String content, final DynamicSkinInstanceData data) {
final ObjectMetadata metadata = new ObjectMetadata();
this.addContentMetadata(metadata, content);
this.addUserMetatadata(metadata);
this.addPortletPreferenceMetadata(metadata, data.getPortletRequest().getPreferences());
this.addDynamicSkinMetadata(metadata, data);
return metadata;
}
Aggregations