*/
public void uploadLocalDirectoryToS3(Map filesMap, S3Bucket bucket,
String rootObjectPath, String aclString,
BytesProgressWatcher progressWatcher) throws Exception
{
FileComparerResults mergedDiscrepancyResults = new FileComparerResults();
String priorLastKey = null;
String lastFileKeypathChecked = "";
long totalObjectsListed = 0;
EncryptionUtil encryptionUtil = null;
if (isEncryptionEnabled) {
String algorithm = properties
.getStringProperty("crypto.algorithm", "PBEWithMD5AndDES");
encryptionUtil = new EncryptionUtil(cryptoPassword, algorithm, EncryptionUtil.DEFAULT_VERSION);
}
// Repeat upload actions until all objects in bucket have been listed.
do {
// List objects in S3. Listing may be complete, or partial.
printProgressLine("Listing objects in S3"
+ (isBatchMode ? " (Batch mode. Objects listed so far: "
+ totalObjectsListed + ")" : ""));
PartialObjectListing partialListing = fileComparer.buildS3ObjectMapPartial(
s3Service, bucket, rootObjectPath, priorLastKey, !isBatchMode,
isSkipMetadata, serviceEventAdaptor);
if (serviceEventAdaptor.wasErrorThrown()) {
throw new Exception("Unable to build map of S3 Objects",
serviceEventAdaptor.getErrorThrown());
}
// Retrieve details from listing.
priorLastKey = partialListing.getPriorLastKey();
Map s3ObjectsMap = partialListing.getObjectsMap();
totalObjectsListed += partialListing.getObjectsMap().size();
ArrayList sortedS3ObjectKeys = new ArrayList(s3ObjectsMap.keySet());
Collections.sort(sortedS3ObjectKeys);
// Compare the listed objects with the local sytem.
printProgressLine("Comparing S3 contents with local system");
FileComparerResults discrepancyResults = fileComparer.buildDiscrepancyLists(
filesMap, s3ObjectsMap, progressWatcher);
// Merge S3 objects and discrepancies to track overall changes.
mergedDiscrepancyResults.merge(discrepancyResults);