Created
June 3, 2010 09:35
-
-
Save lucastex/423688 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private buildObjectList(List assets, S3Service s3) { | |
def objs = [] | |
assets.each {a -> | |
S3Object obj = new S3Object() | |
if (a.localPath) { | |
File f = new File(a.localPath) | |
obj.setDataInputFile(f) | |
obj.setContentLength(f.size()) | |
} | |
//TODO support completely custom acls, need to persist xml or some kind of model | |
def acl = a.options.acl | |
if (acl) { | |
try { | |
acl = AccessControlList."${acl}" | |
} catch (MissingPropertyException e) { | |
log.error "Invalid acl specified for asset ${a.id}: ${acl}. It should match one of the constants from org.jets3t.service.acl.AccessControlList" | |
a.status = S3Asset.STATUS_ERROR | |
a.save(flush: true) | |
return | |
} | |
} | |
if (a.options.useRRS) { | |
obj.setStorageClass(S3Object.STORAGE_CLASS_REDUCED_REDUNDANCY) | |
} | |
obj.setAcl(acl ?: AccessControlList.REST_CANNED_PUBLIC_READ) | |
obj.setBucketName(a.fullBucketName ?: s3BucketService.getBucketName()) | |
obj.setContentType(a.mimeType) | |
obj.setKey(a.key) | |
//TODO: add metadata to S3 object | |
objs << obj | |
} | |
return objs | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment