Java 类com.amazonaws.services.glacier.transfer.UploadResult 实例源码

项目:simple-glacier-client    文件:ArchiveUploadHighLevel.java   
/**
 * Upload an archive in the given dir to an AWS Glacier vault and assign it with given description
 */
public void upload(String fileName, String description) throws IOException {

    try {

        File file = new File(fileName);

        // handle null description
        if (description == null) {
            description = file.getName() + " on " + (new Date());
        }

        log.info("File (archive): " + fileName);
        log.info("Description: " + description);

        // upload
        UploadResult result = this.atm.upload(account, vault, description, file , new UploadProgressListener(file.length()));

        // Good news! 
        log.info("Done! Archive ID: " + result.getArchiveId());

    } catch (Exception e) {
        log.error(e);
    }
}
项目:olfs    文件:Vault.java   
public String put(String resourceId, File uploadFile) throws FileNotFoundException {
    AmazonGlacierClient client = new AmazonGlacierClient(getCredentials());
    client.setEndpoint(getEndpoint());

    ArchiveTransferManager atm = new ArchiveTransferManager(client, getCredentials());

    _log.info("Transferring cache file content to Glacier. vault: " + getVaultName() + "  description: " + resourceId);
    UploadResult uploadResult = atm.upload(getVaultName(), resourceId, uploadFile);

    String archiveId = uploadResult.getArchiveId();

    _log.info("Upload Successful. archiveId: {} resourceId: {}",archiveId,resourceId);

    return archiveId;

}