Package org.jets3t.service.utils

Examples of org.jets3t.service.utils.FileComparerResults


     */
    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);
                      
View Full Code Here


     */
    public void restoreFromS3ToLocalDirectory(Map filesMap, String rootObjectPath,
        File localDirectory, S3Bucket bucket,
        BytesProgressWatcher progressWatcher) throws Exception
    {
        FileComparerResults mergedDiscrepancyResults = new FileComparerResults();
        String priorLastKey = null;
        long totalObjectsListed = 0;

        // Repeat download 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. Already listed: "
                    + 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);
       
View Full Code Here

                            int progressValue = (int)((double)getBytesTransferred() * 100 / getBytesToTransfer());                           
                            updateProgressDialog(statusText, detailsText, progressValue);
                        }
                    };
                                       
                    FileComparerResults comparisonResults = FileComparer.getInstance()
                        .buildDiscrepancyLists(localFilesMap, s3ObjectsMap, progressWatcher);
                   
                    stopProgressDialog();
                   
                    if (upload) {
View Full Code Here

     */
    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);
                      
View Full Code Here

     */
    public void restoreFromS3ToLocalDirectory(Map filesMap, String rootObjectPath,
        File localDirectory, S3Bucket bucket,
        BytesProgressWatcher progressWatcher) throws Exception
    {
        FileComparerResults mergedDiscrepancyResults = new FileComparerResults();
        String priorLastKey = null;
        long totalObjectsListed = 0;

        // Repeat download 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. Already listed: "
                    + 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);
       
View Full Code Here

                if (!retrieveObjectsDetails(getSelectedObjects())) {
                    return;
                }

                try {
                    final FileComparerResults comparisonResults = compareRemoteAndLocalFiles(
                        objectKeyToFilepathMap, s3DownloadObjectsMap);

                    DownloadPackage[] downloadPackages =
                        buildDownloadPackageList(comparisonResults, s3DownloadObjectsMap);
                    if (downloadPackages == null) {
View Full Code Here

                           return;
                       }
                   }

                   try {
                       FileComparerResults comparisonResults =
                           compareRemoteAndLocalFiles(objectKeyToFilepathMap, s3ExistingObjectsMap);

                        S3Object[] uploadObjects = buildUploadObjectsList(
                            comparisonResults, objectKeyToFilepathMap);
View Full Code Here

                    int progressValue = (int)((double)getBytesTransferred() * 100 / getBytesToTransfer());
                    updateProgressDialog(statusText, detailsText, progressValue);
                }
            };

            FileComparerResults comparisonResults = FileComparer.getInstance()
                    .buildDiscrepancyLists(objectKeyToFilepathMap, s3ObjectsMap, progressWatcher);

            stopProgressDialog();

            return comparisonResults;
View Full Code Here

        priorLastKey = partialListing.getPriorLastKey();
        Map<String, StorageObject> objectsMap = partialListing.getObjectsMap();

        // Compare the listed objects with the local system.
        printProgressLine("Comparing service contents with local system");
        FileComparerResults discrepancyResults = fileComparer.buildDiscrepancyLists(
            objectKeyToFilepathMap, objectsMap, md5GenerationProgressWatcher, isForce);

        // Merge objects and discrepancies to track overall changes.
        mergedDiscrepancyResults.merge(discrepancyResults);
View Full Code Here

     */
    public void uploadLocalDirectory(Map<String, String> objectKeyToFilepathMap,
        StorageBucket bucket, String rootObjectPath, String aclString,
        BytesProgressWatcher md5GenerationProgressWatcher) throws Exception
    {
        FileComparerResults mergedDiscrepancyResults = new FileComparerResults();
        String priorLastKey = null;
        String lastFileKeypathChecked = "";

        boolean skipMissingFiles =
            this.properties.getBoolProperty("upload.ignoreMissingPaths", false);

        EncryptionUtil encryptionUtil = null;
        if (isEncryptionEnabled) {
            String algorithm = properties
                .getStringProperty("crypto.algorithm", "PBEWithMD5AndDES");
            encryptionUtil = new EncryptionUtil(cryptoPassword, algorithm, EncryptionUtil.DEFAULT_VERSION);
        }

        // Support for multipart uploads -- currently available for Amazon S3 only
        MultipartUtils multipartUtils = null;
        if (storageService instanceof S3Service) {
            long maxUploadPartSize = properties.getLongProperty(
                "upload.max-part-size", MultipartUtils.MAX_OBJECT_SIZE);
            multipartUtils = new MultipartUtils(maxUploadPartSize);
        }

        // Repeat list and upload actions until all objects in bucket have been listed.
        do {
            ComparisonResult result =
                compareLocalAndRemoteFiles(mergedDiscrepancyResults, bucket.getName(), rootObjectPath,
                    priorLastKey, objectKeyToFilepathMap, md5GenerationProgressWatcher);
            priorLastKey = result.priorLastKey;
            FileComparerResults discrepancyResults = result.discrepancyResults;

            // Repeat upload actions until all local files have been uploaded (or we repeat listing loop)
            Iterator<String> objectKeyIter = objectKeyToFilepathMap.keySet().iterator();
            do {
                List<LazyPreparedUploadObject> objectsToUpload = new ArrayList<LazyPreparedUploadObject>();
View Full Code Here

TOP

Related Classes of org.jets3t.service.utils.FileComparerResults

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.