Package org.jets3t.service.model

Examples of org.jets3t.service.model.S3Bucket


    }
   
    public int getBucketIndexByName(String name) {
        synchronized (bucketList) {
            for (int index=0; index < bucketList.size(); index++) {
                S3Bucket bucket = getBucket(index);
                if (bucket.getName().equals(name)) {
                    return index;
                }
            }
            return -1;
        }
View Full Code Here


   
    public int getBucketIndexByName(String name) {
        synchronized (bucketList) {
            Iterator bucketIter = bucketList.iterator();
            while (bucketIter.hasNext()) {
                S3Bucket bucket = (S3Bucket) bucketIter.next();
                if (bucket.getName().equals(name)) {
                    return bucketList.indexOf(bucket);
                }
            }
            return -1;
        }
View Full Code Here

            }   
        }
       
        Map map = createObjectImpl(bucketName, null, null, requestEntity, metadata, acl);
       
        S3Bucket bucket = new S3Bucket(bucketName, location);
        bucket.setAcl(acl);
        bucket.replaceAllMetadata(map);
        return bucket;
    }
View Full Code Here

        public void endDocument() {
        }

        public void startElement(String uri, String name, String qName, Attributes attrs) {
            if (name.equals("Bucket")) {
                currentBucket = new S3Bucket();
            } else if (name.equals("Owner")) {
                bucketsOwner = new S3Owner();
            }
        }
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

     * @throws S3ServiceException
     */
    public S3Bucket getOrCreateBucket(String bucketName) throws S3ServiceException {
        assertAuthenticatedConnection("Get or Create Bucket");
       
        S3Bucket bucket = getBucket(bucketName);
        if (bucket == null) {
            // Bucket does not exist in this user's account, create it.
            bucket = createBucket(new S3Bucket(bucketName));
        }
        return bucket;
    }
View Full Code Here

   
    /**
     * Displays the currently selected bucket's properties in the dialog {@link ItemPropertiesDialog}.
     */
    private void listBucketProperties() {
        final S3Bucket selectedBucket = currentSelectedBucket;
       
        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 {           
                        try {
                            if (selectedBucket.getAcl() == null) {
                                selectedBucket.setAcl(
                                    s3ServiceMulti.getS3Service().getBucketAcl(
                                        selectedBucket));
                            }
                            if (!selectedBucket.isLocationKnown()) {
                                selectedBucket.setLocation(
                                    s3ServiceMulti.getS3Service().getBucketLocation(
                                        selectedBucket.getName()));
                            }
                            if (!selectedBucket.isRequesterPaysKnown()) {
                                selectedBucket.setRequesterPays(
                                    s3ServiceMulti.getS3Service().isRequesterPaysBucket(
                                        selectedBucket.getName()));
                            }
                        } catch (S3ServiceException e) {
                            // Retrieving details for a third-party bucket will
                            // often fail when ACL or Location is retrieved,
                            // ignore these failures.
View Full Code Here

     * indirectly via the {@link #retrieveObjectsDetails} method. The <code>retrieveObjectsDetails</code>
     * method retrieves all the details for the currently selected objects, and once they are available
     * knows to display the dialog as the {@link #isViewingOrModifyingObjectProperties} flag is set.
     */
    private void displayObjectsAttributesDialog() {
        final S3Bucket selectedBucket = currentSelectedBucket;

        runInBackgroundThread(new Runnable() {
            public void run() {
                if (!retrieveObjectsDetails(getSelectedObjects())) {
                    return;
                }
                   
                if (objectsAttributesDialog == null) {
                    objectsAttributesDialog = new ObjectsAttributesDialog(
                        ownerFrame, "Object Attributes", skinsFactory);
                }
                       
                final S3Object[] sourceObjects = getSelectedObjects();
               
                boolean ok = runInDispatcherThreadImmediately(new Runnable() {
                    public void run() {
                        objectsAttributesDialog.displayDialog(sourceObjects, true);
                    }
                });
                if (!ok) {
                    return;
                }
               
                final String[] sourceObjectKeys = objectsAttributesDialog.getSourceObjectKeys();
                final S3Object[] destinationObjects = objectsAttributesDialog.getDestinationObjects();
                       
                if (!objectsAttributesDialog.isModifyActionApproved()) {
                    // Do nothing.
                    return;
                }                                                        
                               
                // Retain ACL settings from original objects.
                if (!s3ServiceMulti.getObjectACLs(selectedBucket, sourceObjects)) {
                    return;
                }
                for (int i = 0; i < sourceObjects.length; i++) {
                    destinationObjects[i].setAcl(
                        sourceObjects[i].getAcl());
                }
               
                // Copy objects in-place, to REPLACE their metadata attributes.
                ok = s3ServiceMulti.copyObjects(
                    selectedBucket.getName(), selectedBucket.getName(),
                    sourceObjectKeys, destinationObjects, true);
               
                // Refresh details for modified objects
                if (ok) {
                    s3ServiceMulti.getObjectsHeads(
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

                "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, false);
                } else {
                    String message = "Unable to access third-party bucket: " + bucketName;
                    log.error(message);
                    ErrorDialog.showDialog(ownerFrame, this, message, null);
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.