Package org.jets3t.gui

Examples of org.jets3t.gui.CopyObjectsDialog


   
    private void copyObjects() {
        try {
            final S3Object[] sourceObjects = getSelectedObjects();
           
            CopyObjectsDialog dialog = new CopyObjectsDialog(ownerFrame,
                "Copy or Move Objects", skinsFactory,
                sourceObjects, bucketTableModel.getBuckets());
           
            dialog.setVisible(true);                                       
            if (dialog.isCopyActionApproved()) {
                final String currentBucketName = getCurrentSelectedBucket().getName();
                final String destinationBucketName = dialog.getDestinationBucketName();
                final String[] sourceObjectKeys = dialog.getSourceObjectKeys();
                final S3Object[] destinationObjects = dialog.getDestinationObjects();
                final boolean isDeleteAfterCopy = dialog.isMoveOptionSelected();
                final boolean retainAcls = dialog.isCopyOriginalAccessControlLists();
                dialog.dispose();
               
                if (!destinationBucketName.equals(currentBucketName)) {
                    cachedBuckets.remove(destinationBucketName);
                }
               
                runInBackgroundThread(new Runnable() {
                    public void run() {                          
                        if (retainAcls) {
                            // Retain ACL settings from original objects.
                            if (!s3ServiceMulti.getObjectACLs(
                                getCurrentSelectedBucket(), sourceObjects))
                            {
                                return;
                            }
                            for (int i = 0; i < sourceObjects.length; i++) {
                                destinationObjects[i].setAcl(
                                    sourceObjects[i].getAcl());
                            }
                        }
                       
                        // Copy objects. Metadata is retained, not replaced.
                        s3ServiceMulti.copyObjects(currentBucketName, destinationBucketName,
                            sourceObjectKeys, destinationObjects, false);
                       
                        if (isDeleteAfterCopy) {
                            final S3Object[] sourceObjects = new S3Object[sourceObjectKeys.length];
                            for (int i = 0; i < sourceObjectKeys.length; i++) {
                                sourceObjects[i] = new S3Object(sourceObjectKeys[i]);
                            }
                           
                            s3ServiceMulti.deleteObjects(getCurrentSelectedBucket(), sourceObjects);
                        }
                        if (destinationBucketName.equals(currentBucketName) || isDeleteAfterCopy) {
                            // Refesh object listing for current bucket if the bucket's contents
                            // have changed.
                            listObjects();
                        }                       
                    }
                });                           
                               
            } else {
                dialog.dispose();               
            }
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            stopProgressDialog();
View Full Code Here


   
    private void copyObjects() {
        try {
            final S3Object[] sourceObjects = getSelectedObjects();
           
            CopyObjectsDialog dialog = new CopyObjectsDialog(ownerFrame,
                "Copy or Move Objects", skinsFactory,
                sourceObjects, bucketTableModel.getBuckets());
           
            dialog.setVisible(true);                                       
            if (dialog.isCopyActionApproved()) {
                final String currentBucketName = currentSelectedBucket.getName();
                final String destinationBucketName = dialog.getDestinationBucketName();
                final String[] sourceObjectKeys = dialog.getSourceObjectKeys();
                final S3Object[] destinationObjects = dialog.getDestinationObjects();
                final boolean isDeleteAfterCopy = dialog.isMoveOptionSelected();
                final boolean retainAcls = dialog.isCopyOriginalAccessControlLists();
                dialog.dispose();
               
                if (!destinationBucketName.equals(currentBucketName)) {
                    cachedBuckets.remove(destinationBucketName);
                }
               
                runInBackgroundThread(new Runnable() {
                    public void run() {                          
                        if (retainAcls) {
                            // Retain ACL settings from original objects.
                            if (!s3ServiceMulti.getObjectACLs(
                                currentSelectedBucket, sourceObjects))
                            {
                                return;
                            }
                            for (int i = 0; i < sourceObjects.length; i++) {
                                destinationObjects[i].setAcl(
                                    sourceObjects[i].getAcl());
                            }
                        }
                       
                        // Copy objects. Metadata is retained, not replaced.
                        s3ServiceMulti.copyObjects(currentBucketName, destinationBucketName,
                            sourceObjectKeys, destinationObjects, false);
                       
                        if (isDeleteAfterCopy) {
                            final S3Object[] sourceObjects = new S3Object[sourceObjectKeys.length];
                            for (int i = 0; i < sourceObjectKeys.length; i++) {
                                sourceObjects[i] = new S3Object(sourceObjectKeys[i]);
                            }
                           
                            s3ServiceMulti.deleteObjects(currentSelectedBucket, sourceObjects);
                        }
                        if (destinationBucketName.equals(currentBucketName) || isDeleteAfterCopy) {
                            // Refesh object listing for current bucket if the bucket's contents
                            // have changed.
                            listObjects();
                        }                       
                    }
                });                           
                               
            } else {
                dialog.dispose();               
            }
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            stopProgressDialog();
View Full Code Here

    private void copyObjects() {
        try {
            final S3Object[] sourceObjects = getSelectedObjects();

            CopyObjectsDialog dialog = new CopyObjectsDialog(ownerFrame,
                "Copy or Move Objects", skinsFactory,
                sourceObjects, bucketTableModel.getBuckets());

            dialog.setVisible(true);
            if (dialog.isCopyActionApproved()) {
                final String currentBucketName = currentSelectedBucket.getName();
                final String destinationBucketName = dialog.getDestinationBucketName();
                final String[] sourceObjectKeys = dialog.getSourceObjectKeys();
                final S3Object[] destinationObjects = dialog.getDestinationObjects();
                final boolean isDeleteAfterCopy = dialog.isMoveOptionSelected();
                final boolean retainAcls = dialog.isCopyOriginalAccessControlLists();
                dialog.dispose();

                if (!destinationBucketName.equals(currentBucketName)) {
                    cachedBuckets.remove(destinationBucketName);
                }

                runInBackgroundThread(new Runnable() {
                    public void run() {
                        if (retainAcls) {
                            // Retain ACL settings from original objects.
                            if (!s3ServiceMulti.getObjectACLs(
                                currentSelectedBucket, sourceObjects))
                            {
                                return;
                            }
                            for (int i = 0; i < sourceObjects.length; i++) {
                                destinationObjects[i].setAcl(
                                    sourceObjects[i].getAcl());
                            }
                        }

                        // Copy objects. Metadata is retained, not replaced.
                        s3ServiceMulti.copyObjects(currentBucketName, destinationBucketName,
                            sourceObjectKeys, destinationObjects, false);

                        if (isDeleteAfterCopy) {
                            final S3Object[] sourceObjects = new S3Object[sourceObjectKeys.length];
                            for (int i = 0; i < sourceObjectKeys.length; i++) {
                                sourceObjects[i] = new S3Object(sourceObjectKeys[i]);
                            }

                            s3ServiceMulti.deleteObjects(currentSelectedBucket, sourceObjects);
                        }
                        if (destinationBucketName.equals(currentBucketName) || isDeleteAfterCopy) {
                            // Refesh object listing for current bucket if the bucket's contents
                            // have changed.
                            listObjects();
                        }
                    }
                });

            } else {
                dialog.dispose();
            }
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            stopProgressDialog();
View Full Code Here

TOP

Related Classes of org.jets3t.gui.CopyObjectsDialog

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.