Package org.jets3t.service.model

Examples of org.jets3t.service.model.S3Bucket


    /**
     * Updates the ACL settings for the currently selected bucket.
     */
    private void updateBucketRequesterPaysSetting() {
        try {
            final S3Bucket selectedBucket = currentSelectedBucket;
           
            if (!selectedBucket.isRequesterPaysKnown()) {
                selectedBucket.setRequesterPays(
                    s3ServiceMulti.getS3Service().isRequesterPaysBucket(
                        selectedBucket.getName()));               
            }
           
            boolean originalRequesterPaysFlag = selectedBucket.isRequesterPays();

            RequesterPaysDialog dialog = new RequesterPaysDialog(selectedBucket, ownerFrame, this);
            dialog.setVisible(true);
           
            if (!dialog.getOkClicked()) {
                return;
            }
           
            final boolean newRequesterPaysFlag = dialog.isRequesterPaysSelected();
            dialog.dispose();
           
            if (newRequesterPaysFlag != originalRequesterPaysFlag) {
                runInBackgroundThread(new Runnable() {
                    public void run() {
                        try {
                            s3ServiceMulti.getS3Service().setRequesterPaysBucket(
                                selectedBucket.getName(), newRequesterPaysFlag);
                            selectedBucket.setRequesterPays(newRequesterPaysFlag);
                        } catch (final Exception e) {
                            String message = "Unable to update Requester Pays status";
                            log.error(message, e);
                            ErrorDialog.showDialog(ownerFrame, null, message, e);
                        }
View Full Code Here


        }
    }
   
    private void displayAclModificationDialog() {
        final HyperlinkActivatedListener hyperlinkListener = this;
        final S3Bucket selectedBucket = currentSelectedBucket;
       
        runInBackgroundThread(new Runnable() {
            public void run() {
                final S3Object[] selectedObjects = getSelectedObjects();           
               
View Full Code Here

   
    /**
     * Displays the currently selected bucket's properties in the dialog {@link ItemPropertiesDialog}.
     */
    private void listBucketProperties() {
        final S3Bucket selectedBucket = getCurrentSelectedBucket();
       
        if (selectedBucket.getAcl() == null || !selectedBucket.isLocationKnown()) {
            // Retrieve all a bucket's details before displaying the summary.
            runInBackgroundThread(new Runnable() {
                public void run() {               
                    startProgressDialog("Retrieving details for bucket " + selectedBucket.getName());
                    try {                   
                        if (selectedBucket.getAcl() == null) {
                            selectedBucket.setAcl(
                                s3ServiceMulti.getS3Service().getBucketAcl(
                                    selectedBucket));
                        }
                        if (!selectedBucket.isLocationKnown()) {
                            selectedBucket.setLocation(
                                s3ServiceMulti.getS3Service().getBucketLocation(
                                    selectedBucket.getName()));
                        }
                       
                        stopProgressDialog();                                   
                        runInDispatcherThreadImmediately(new Runnable() {
                            public void run() {                               
View Full Code Here

           
    /**
     * Actions performed when a bucket is selected in the bucket list table.
     */
    private void bucketSelectedAction() {
        S3Bucket newlySelectedBucket = getCurrentSelectedBucket();
        if (newlySelectedBucket == null) {
            viewBucketPropertiesMenuItem.setEnabled(false);
            refreshBucketMenuItem.setEnabled(true);
            updateBucketACLMenuItem.setEnabled(false);
            deleteBucketMenuItem.setEnabled(false);
           
            refreshObjectMenuItem.setEnabled(false);
            uploadFilesMenuItem.setEnabled(false);
           
            objectTableModel.removeAllObjects();
           
            objectsTable.getDropTarget().setActive(false);
            objectsTableSP.getDropTarget().setActive(false);
           
            return;
        }
       
        viewBucketPropertiesMenuItem.setEnabled(true);
        refreshBucketMenuItem.setEnabled(true);
        updateBucketACLMenuItem.setEnabled(true);
        deleteBucketMenuItem.setEnabled(true);
       
        refreshObjectMenuItem.setEnabled(true);
        uploadFilesMenuItem.setEnabled(true);
       
        objectsTable.getDropTarget().setActive(true);
        objectsTableSP.getDropTarget().setActive(true);
       
        if (cachedBuckets.containsKey(newlySelectedBucket.getName())) {
            S3Object[] objects = (S3Object[]) cachedBuckets.get(newlySelectedBucket.getName());
           
            objectTableModel.removeAllObjects();                   
            objectTableModel.addObjects(objects);
            updateObjectsSummary(false);
        } else {       
View Full Code Here

       
        if (!dialog.getOkClicked()) {
            return;
        }
       
        final S3Bucket newBucket = new S3Bucket(dialog.getBucketName(), dialog.getBucketLocation());
        dialog.dispose();
               
        runInBackgroundThread(new Runnable() {
           public void run() {
               if (s3ServiceMulti.createBuckets(new S3Bucket[] { newBucket })) {
                   int modelIndex = bucketTableModel.getBucketIndexByName(newBucket.getName());
                   int viewIndex = bucketTableModelSorter.viewIndex(modelIndex);
                   bucketsTable.setRowSelectionInterval(viewIndex, viewIndex);
               }
           }
        });           
View Full Code Here

    /**
     * Deletes the bucket currently selected in the gui.
     *
     */
    private void deleteSelectedBucket() {
        S3Bucket currentBucket = getCurrentSelectedBucket();
        if (currentBucket == null) {
            log.warn("Ignoring delete bucket command, no currently selected bucket");
            return;
        }
       
        int response = JOptionPane.showConfirmDialog(ownerFrame,
            "Are you sure you want to delete '" + currentBucket.getName() + "'?"
            "Delete Bucket?", JOptionPane.YES_NO_OPTION);
       
        if (response == JOptionPane.NO_OPTION) {
            return;
        }
       
        try {
            s3ServiceMulti.getS3Service().deleteBucket(currentBucket.getName());
            bucketTableModel.removeBucket(currentBucket);
        } catch (Exception e) {
            String message = "Unable to delete bucket";
            log.error(message, e);
            ErrorDialog.showDialog(ownerFrame, this, message, e);
View Full Code Here

                "Name for third-party bucket:",
                "Add a third-party bucket", JOptionPane.QUESTION_MESSAGE);

            if (bucketName != null) {
                if (s3ServiceMulti.getS3Service().isBucketAccessible(bucketName)) {
                    S3Bucket thirdPartyBucket = new S3Bucket(bucketName);
                    bucketTableModel.addBucket(thirdPartyBucket);
                } else {
                    String message = "Unable to access third-party bucket: " + bucketName;
                    log.error(message);
                    ErrorDialog.showDialog(ownerFrame, this, message, null);
View Full Code Here

    /**
     * Updates the ACL settings for the currently selected bucket.
     */
    private void updateBucketAccessControlList() {
        try {
            S3Bucket currentBucket = getCurrentSelectedBucket();
            AccessControlList bucketACL = s3ServiceMulti.getS3Service().getBucketAcl(currentBucket);
           
            AccessControlList updatedBucketACL = AccessControlDialog.showDialog(
                ownerFrame, new S3Bucket[] {currentBucket}, bucketACL, this);
            if (updatedBucketACL != null) {
                currentBucket.setAcl(updatedBucketACL);
                s3ServiceMulti.getS3Service().putBucketAcl(currentBucket);
            }
        } catch (Exception e) {
            String message = "Unable to update bucket's Access Control List";
            log.error(message, e);
View Full Code Here

    grantee = new EmailAddressGrantee();
    grantee.setIdentifier("james@test2.com");
    acl.grantPermission(grantee, Permission.PERMISSION_FULL_CONTROL);

    JFrame f = new JFrame("Cockpit");
    S3Bucket bucket = new S3Bucket();
    bucket.setName("SomeReallyLongAndWackyBucketNamePath.HereItIs");
   
    AccessControlList updatedACL = acl;
    while ((updatedACL = AccessControlDialog.showDialog(f, new S3Bucket[] {bucket}, updatedACL, null)) != null) {
      System.out.println(updatedACL.toXml());
    }   
View Full Code Here

     * the bucket that was created, including only the bucket's name.
     * @throws S3ServiceException
     */
    public S3Bucket createBucket(String bucketName, String location) throws S3ServiceException {
        assertAuthenticatedConnection("createBucket");
        S3Bucket bucket = new S3Bucket(bucketName, location);
        return createBucket(bucket);
    }
View Full Code Here

TOP

Related Classes of org.jets3t.service.model.S3Bucket

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.