Package org.jets3t.service.multi.s3

Examples of org.jets3t.service.multi.s3.MultipartUploadAndParts


            // Create threaded service and perform upload in multiple threads
            ThreadedS3Service threadedS3Service = new ThreadedS3Service(service,
                new S3ServiceEventAdaptor());
            List<MultipartUploadAndParts> uploadAndParts = new ArrayList<MultipartUploadAndParts>();
            uploadAndParts.add(new MultipartUploadAndParts(
                threadedMultipartUpload, Arrays.asList(objectsForThreadedUpload)));
            threadedS3Service.multipartUploadParts(uploadAndParts);

            // Complete threaded multipart upload using automatic part listing and normal service.
            MultipartCompleted threadedMultipartCompleted = service.multipartCompleteUpload(
View Full Code Here


                }
                partObjects = splitFileIntoObjectsByMaxPartSize(
                    upload.getObjectKey(),
                    object.getDataInputFile());
                uploadAndPartsList.add(
                    new MultipartUploadAndParts(upload, partObjects));
            }

            // Upload all parts for all multipart uploads
            threadedS3Service.multipartUploadParts(uploadAndPartsList);
            throwServiceEventAdaptorErrorIfPresent(eventListener);
View Full Code Here

                new S3Object(threadedMultipartUpload.getObjectKey(), new byte[] {fiveMBTestData[0]}),
            };

            // Create threaded service and perform upload in multiple threads
            ThreadedS3Service threadedS3Service = new ThreadedS3Service(service,
                new S3ServiceEventAdaptor());
            List<MultipartUploadAndParts> uploadAndParts = new ArrayList<MultipartUploadAndParts>();
            uploadAndParts.add(new MultipartUploadAndParts(
                threadedMultipartUpload, Arrays.asList(objectsForThreadedUpload)));
            threadedS3Service.multipartUploadParts(uploadAndParts);
View Full Code Here

            new ArrayList<MultipartUpload>();
        final List<MultipartUploadAndParts> uploadAndPartsList =
            new ArrayList<MultipartUploadAndParts>();

        if (eventListener == null) {
            eventListener = new S3ServiceEventAdaptor();
        }

        // Adaptor solely to capture newly-created MultipartUpload objects, which we
        // will need when it comes time to upload parts or complete the uploads.
        StorageServiceEventAdaptor captureMultipartUploadObjectsEventAdaptor =
            new S3ServiceEventAdaptor() {
                @Override
                public void event(MultipartStartsEvent event) {
                    if (ServiceEvent.EVENT_IN_PROGRESS == event.getEventCode()) {
                        for (MultipartUpload upload: event.getStartedUploads()) {
                            multipartUploadList.add(upload);
View Full Code Here

                new S3Object(threadedMultipartUpload.getObjectKey(), fiveMBTestData),
                new S3Object(threadedMultipartUpload.getObjectKey(), new byte[] {fiveMBTestData[0]}),
            };

            // Create threaded service and perform upload in multiple threads
            ThreadedS3Service threadedS3Service = new ThreadedS3Service(service,
                new S3ServiceEventAdaptor());
            List<MultipartUploadAndParts> uploadAndParts = new ArrayList<MultipartUploadAndParts>();
            uploadAndParts.add(new MultipartUploadAndParts(
                threadedMultipartUpload, Arrays.asList(objectsForThreadedUpload)));
            threadedS3Service.multipartUploadParts(uploadAndParts);

            // Complete threaded multipart upload using automatic part listing and normal service.
            MultipartCompleted threadedMultipartCompleted = service.multipartCompleteUpload(
                threadedMultipartUpload);
View Full Code Here

                }
            };

        List<S3Object> partObjects = null;
        try {
            ThreadedS3Service threadedS3Service =
                new ThreadedS3Service(s3Service, eventListener);
            threadedS3Service.addServiceEventListener(
                captureMultipartUploadObjectsEventAdaptor);

            // Build map from object key to storage object
            final Map<String, StorageObject> objectsByKey =
                new HashMap<String, StorageObject>();
            for (StorageObject object: objectsForMultipartUpload) {
                objectsByKey.put(object.getKey(), object);
            }

            // Start all multipart uploads
            threadedS3Service.multipartStartUploads(bucketName, objectsForMultipartUpload);
            throwServiceEventAdaptorErrorIfPresent(eventListener);

            // Build upload and part lists from new multipart uploads, where new
            // MultipartUpload objects were captured by this method's
            // captureMultipartUploadObjectsEventAdaptor)
            for (MultipartUpload upload: multipartUploadList) {
                StorageObject object = objectsByKey.get(upload.getObjectKey());
                if (object.getDataInputFile() == null) {
                    throw new ServiceException();
                }
                partObjects = splitFileIntoObjectsByMaxPartSize(
                    upload.getObjectKey(),
                    object.getDataInputFile());
                uploadAndPartsList.add(
                    new MultipartUploadAndParts(upload, partObjects));
            }

            // Upload all parts for all multipart uploads
            threadedS3Service.multipartUploadParts(uploadAndPartsList);
            throwServiceEventAdaptorErrorIfPresent(eventListener);

            // Complete all multipart uploads
            threadedS3Service.multipartCompleteUploads(multipartUploadList);
            throwServiceEventAdaptorErrorIfPresent(eventListener);
        } catch (Exception e) {
            if (partObjects != null && partObjects.size() > 0) {
                for (S3Object partObject: partObjects) {
                    partObject.closeDataInputStream();
View Full Code Here

TOP

Related Classes of org.jets3t.service.multi.s3.MultipartUploadAndParts

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.